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

Re: [Libguestfs] [PATCH x 3] Three small fixes for Debian



On Wed, Nov 04, 2009 at 02:49:13PM +0000, Richard W.M. Jones wrote:
> There is currently another bug in the Debian tests which I'm looking
> into.  hexdump always fails as follows:
> 
> libguestfs: error: hexdump: hexdump: /test123: hexdump: /sysroot/test123: Bad file descriptor

Not nice ...  hexdump does 'freopen (filename, "r", stdin)':

http://git.kernel.org/?p=utils/util-linux-ng/util-linux-ng.git;a=blob;f=text-utils/display.c;h=91857c2fa159c24fba0f54b78233471cf15f84e6;hb=HEAD#l305

However when we run external commands, they have no stdin -- not even
/dev/null, fd 0 is literally closed:

http://git.et.redhat.com/?p=libguestfs.git;a=blob;f=daemon/guestfsd.c;h=8c39c39c66b3ae39b62b53a610220008eec2e74f;hb=HEAD#l655

According to the freopen man page, this shouldn't be a problem.  If
'stdin' is closed then freopen should just open a new stdin.  And of
course the same command does work fine on Fedora builds.

Anyway, I'm still experimenting with this one ...  It might be better
just to open /dev/null for stdin, since I suppose other programs could
be unpredictable if they have no stdin at all.

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://et.redhat.com/~rjones/virt-top


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