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=t...
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=8...
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