nmh-workers
[Top] [All Lists]

Re: [Nmh-workers] outstanding patches

2005-05-26 02:32:37
    Date:        Wed, 25 May 2005 22:48:13 +0200
    From:        Harald Geyer <Harald(_dot_)Geyer(_at_)gmx(_dot_)at>
    Message-ID:  
<E1Db2nc-0000FC-Fl(_at_)chello080108070152(_dot_)13(_dot_)11(_dot_)univie(_dot_)teleweb(_dot_)at>

  | Sorry, but you are wrong. If this was the case, I would have written the
  | bug report along the lines of "Please work around the broken linux
  | vfork()". But out of reason I didn't.

OK.

  | But BTW IIRC there is no guarantee that this "requirement" is met in the
  | standards. Ie #define vfork() fork() is a valid implementation.

Yes.   While the processes share address space, the parent blocks.  Once
that has ceased, either via exit (no more child), exec (whole new address
space for child) or because they never did share (using fork()) the parent
can continue.   The kernel gets to decide when that happens, a process
using vfork() cannot depend upon any of it.

  | Obviously nmh does depend upon errno being unchanged, so it's the fault
  | of nmh itself not linux.

That would be correct.   In that case one might wonder though why the bug
is only observed under linux?

I haven't seen the bug report, would you care to indicate exactly where
the problem occurs (and the symptoms observed) ?   (Private mail if you
prefer).

  | (Indeed I overlooked, that this is 
  | a bug even if fork() is used instead.

It would be, yes, though the bug might be harder to spot, as fork()
when it succeeds most probably doesn't alter errno.

  | However, I guess it's still a bad
  | idea to use any syscalls between vfork() and exec() - so actually it's
  | two bugs to be fixed...)

No, sys calls are generally fine (it does depend what they do, read() would
not be a good idea... except perhaps into a local buffer in a function
called by the child process) - in fact, sys calls are expected, the child
has a new open file table already, and is allowed to manipulate that, and
usually is expected to manipulate that, before the exec.   What is generally
required though is that only genuine sys calls be used (e.g. even though I
mentioned exit(), I really meant the sys call exit(2), not the libc exit(3).
After a vfork, before exec, the child generally needs to use _exit() to avoid
fooling with the parent's stdio structures).

kre




_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers

<Prev in Thread] Current Thread [Next in Thread>