Mail Archives: djgpp-workers/2001/02/27/16:37:33
I'm running into a problem with autoupdate.
It is being rewritten in Perl, and invokes autoconf.
At some point, autoconf redirects file descriptor 4
to its output file, or fd 1 if outfile is "-".
However, the
exec 4>&1
causes the following error:
redirection error: Bad file descriptor (EBADF)
Only fd 4 seems to be affected.
The error is easily reproduced; simply place the following
files in the same dir, and run the perl one:
--foo.pl--
open (FOO, "./foo.sh |");
while (<FOO>) { print $_; }
close FOO;
--foo.sh--
#! bash
exec 4>&1
echo foo >&4
There is no problem if foo.sh is run directly, from
another shell script or through system().
And although the error is printed, the exec does actually
seem to succeed ("foo" is output).
Can anyone reproduce this problem (I get it even if using
the perl from perl552b.zip, so it's not my perl 5.6.0 build
that's at fault)?
Is this a Perl thing or a DJGPP thing? I'm pretty certain it's
the former, as running foo.pl under the perl debugger kills the
console input (Perl probably closes fd 4).
Is there a fix / workaround?
- Raw text -