Demo Discussion
Forum Config Examples Contributions Vulnerabilities
  Discussion forum about ELOG, Page 792 of 796  Not logged in ELOG logo
New entries since:Thu Jan 1 01:00:00 1970
ID Date Icon Author Author Email Category OS ELOG Versionup Subject
  67069   Fri May 20 22:45:00 2011 Idea John M O'Donnellodonnell@lanl.govBug fixLinuxsvn 2414my_shell (OS_UNIX) uses /tmp/elog_shell - conflict when more than one elogd runs at the same time

all instances of elogd use the same file name in /tmp when calling my_shell.  This can cause some inconsistent behavior when two or more copies of elogd are runnnig at the same time.  (eg. one might detect ImageMagik is installed, and the other not,)

 

The propsed solution is to have the parent read from a pipe to the child rather from a file.  A patch is attached.

Attachment 1: elogd.c.patch_shellPipe
--- elogd.c.orig	2011-05-20 13:28:48.000000000 -0600
+++ elogd.c	2011-05-20 14:16:12.000000000 -0600
@@ -866,25 +866,27 @@
 
 #ifdef OS_UNIX
    pid_t child_pid;
-   int fh, status, i;
+   int fd[2], status, i;
    char str[256];
 
+   /* create pipe for parent<->child communication */
+   if (pipe(fd) < 0)
+      return 0;
+
    if ((child_pid = fork()) < 0)
       return 0;
    else if (child_pid > 0) {
-      /* parent process waits for child */
-      waitpid(child_pid, &status, 0);
+
+      /* parent does not write to child */
+      close(fd[1]);
 
       /* read back result */
       memset(result, 0, size);
-      fh = open("/tmp/elog-shell", O_RDONLY);
-      if (fh > 0) {
-         i = read(fh, result, size);
-         close(fh);
-      }
+      i = read(fd[0], result, size);
+      close(fd[0]);
 
-      /* remove temporary file */
-      remove("/tmp/elog-shell");
+      /* parent process waits for child */
+      waitpid(child_pid, &status, 0);
 
       /* strip trailing CR/LF */
       while (strlen(result) > 0 && (result[strlen(result) - 1] == '\r' || result[strlen(result) - 1] == '\n'))
@@ -926,8 +928,7 @@
             eprintf("Falling back to user \"%s\"\n", str);
       }
 
-      /* execute shell with redirection to /tmp/elog-shell */
-      sprintf(str, "/bin/sh -c \"%s\" > /tmp/elog-shell 2>&1", cmd);
+      /* execute command with redirection to pipe to parent */
 
       if (is_verbose()) {
          efputs("Going to execute: ");
@@ -935,7 +936,17 @@
          efputs("\n");
       }
 
-      system(str);
+      /* redirect stdout/stderr to pipe for parent to read */
+      close(STDOUT_FILENO); dup2(fd[1], STDOUT_FILENO);
+      close(STDERR_FILENO); dup2(fd[1], STDERR_FILENO);
+      /* child does not read the pipe */
+      close(fd[0]);
+      /* child nolonger uses fd[1] - use stderr or stdout instead */
+      close(fd[1]);
+      
+      if (system(cmd) == -1) {
+          fprintf(stderr, "unable to execute command: %s\n", cmd);
+      }
       _exit(0);
    }
 
  67917   Wed May 20 01:52:23 2015 Entry Konstantin Olchanskiolchansk@triumf.caBug reportOtherthis onethis elog errors sending email
this elog gives errors sending mail through PSI email server. (did not capture the error messages, sorry). K.O.
  67918   Wed May 20 01:54:55 2015 Entry Konstantin Olchanskiolchansk@triumf.caBug reportOtherthis oneedit somebody else's draft
this elog offers me to edit a draft message, then yells at me "only some other user can edit this draft!!!".
methinks I should only be offered to edit draft messages that I own or I can edit. K.O.
  67926   Wed May 20 22:12:49 2015 Reply David PilgramDavid.Pilgram@epost.org.ukBug reportOtherthis oneRe: edit somebody else's draft
> this elog offers me to edit a draft message, then yells at me "only some other user can edit this draft!!!".
> methinks I should only be offered to edit draft messages that I own or I can edit. K.O.
I find it odd that I can see someone elses draft, but never one that I am in the middle of composing (using a
different tab of the browser) in the elog listing.  There's one such draft Konstantin refers to in the logbook
listings now - last one was dark blue, this one a pink background, is there a reason for these different colours?
  67930   Fri May 22 13:50:31 2015 Reply Stefan Rittstefan.ritt@psi.chBug reportOtherthis oneRe: edit somebody else's draft
> > this elog offers me to edit a draft message, then yells at me "only some other user can edit this draft!!!".
> > methinks I should only be offered to edit draft messages that I own or I can edit. K.O.
> I find it odd that I can see someone elses draft, but never one that I am in the middle of composing (using a
> different tab of the browser) in the elog listing.  There's one such draft Konstantin refers to in the logbook
> listings now - last one was dark blue, this one a pink background, is there a reason for these different colours?

I just tried that on the "Demo" logbook and could see my own draft entry (which appears pink) in a second tab.

Dark blue means you have not updated the default.css file properly from the current distribution.

Stefan
  67974   Tue Jun 9 15:22:03 2015 Reply Midas Userstefan.ritt@psi.chBug reportOtherthis oneRe: edit somebody else's draft
> this elog offers me to edit a draft message, then yells at me "only some other user can edit this draft!!!".
> methinks I should only be offered to edit draft messages that I own or I can edit. K.O.

I changed this behaviour now, so authors can only edit their own drafts. Furthermore, drafts are not shown any more in the elog lists. In addition, deleting of entries is allowed now again in this forum, so if someone creates a draft by accident, he/she can delete it.

/Stefan
  66873   Wed Aug 4 23:46:34 2010 Question Kontantin Olchanskiolchansk@triumf.caBug reportLinuxunknownelog editor loses all text

I just typed a long text into this elog, clicked "submit" and it bombed with "you must select an Icon", returned me to the editor with all my text gone gone gone. I do not want to select icons, I just want to report a problem with elog. Well, 2 problems, now.

K.O.

 

  66877   Fri Aug 6 13:01:24 2010 Entry Stefan Rittstefan.ritt@psi.chBug reportLinuxunknownRe: elog editor loses all text

Kontantin Olchanski wrote:

I just typed a long text into this elog, clicked "submit" and it bombed with "you must select an Icon", returned me to the editor with all my text gone gone gone. I do not want to select icons, I just want to report a problem with elog. Well, 2 problems, now.

K.O.

 

Well, first RTFM: "Fields marked with a * are required" on top of the elog entry page. Then, use a reasonable browser on a reasonable OS  

On Google Chrome the text is still there (actually I just tried it with this entry). No idea what Safari under OSX does. Under Windows, Safari keeps the text. Actually this is controlled by the FCKEditor inside elog which is written by someone else. So complain there! Funny: We have about 1000+ entries in this forum, and you are the first one complaining about this.

ELOG V3.1.5-2eba886