[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: libdpkg: m_fork and friends



On Fri, Mar 16, 2012 at 6:03 PM, lkcl luke <luke.leighton@gmail.com> wrote:
> On Fri, Mar 16, 2012 at 5:51 PM, lkcl luke <luke.leighton@gmail.com> wrote:
>
>>  apparently it is actually possible to use the low-level
>> NtCreateProcess function to create a unix version of fork.  sort-of.
>> fuuun....
>
> http://blog.airesoft.co.uk/code/fork.cpp
>
> ye gods what a mess!  but... yep, it looks doable.  *respect* for mr
> airesoft, for solving _that_ one.

 ah i just spoke to him: the code he wrote segfaults when the fork
returns.  i started investigating cygwin's implementation instead:
 http://cygwin.com/cgi-bin/cvsweb.cgi/~checkout~/src/winsup/cygwin/fork.cc?rev=1.233&content-type=text/plain&cvsroot=src

 it's much much worse.

 um... is there any chance of redesigning dpkg to not require fork?
popen looks like it could be used in movecontrolfiles; likewise in
extracthalf.

 deb_reassemble, again subproc_fork appears to be being used as a
subsitute for popen.  and deb_verify.  each of those perform an execlp
immediately after the fork, with a subproc_wait_check...

 falliblesubprocess, too, seems to be executing a remote command and
waiting for it to complete before continuing.

 ok, i'm labouring the point: is there any situation in dpkg where
fork *isn't* used to do the same job as popen?

l.


Reply to: