I
Ilya Zakharevich
Some time ago I got ideas that the process start logic of Perl may be
flawed (at least the part implemented by me :-[ ;-). So I spend some
time, and made a primitive script to stress-test Perl in the "tricky"
situations. See ilyaz.org/software/tmp/check_redir.pl
The best-hoped-for results are: having only <123//456> and <> as
possible output strings (ones after the colon in the output), maybe
interspersed with some warnings about closed filehandles. I tested on
3 architectures OS/2, BSD, and RedHat. I see much more than this.
The problems which I see are:
a) $! may become "Inappropriate ioctl for device" during
closing (some of) STDERR, STDOUT, STDIN.
b) I may see output <<456>>, which means that STDERR was NOT redirected.
c) Shell may be called in
open GRANDKID, q(|-), "$^X -wl - 2>&1" or die 12;
while Perl has enough whistles to do it without shell ( as I assume
it is doing with q(-|) ).
d) I see "Unknown error 171324724" as content of $!.
e) I see $? being -1, or 256 when things end in exit(0).
f) the grandchild may block.
(What is most surprising is that BSD behaves differently than Linux...)
I suspected that most of the errors would be due to MY code in Perl;
one piece implementing shell-less 2>&1 redirection, and one reporting
the error of exec() to the fork()'s parent. These would be easy to
fix (one could "relocate" generated filehandles to be above 2 - and,
for best result, above $^F). But it looks like there are different
cans of worms present in the picture...
Can you experiment (just run the script without arguments) and report
if you see some OTHER problems than those mentioned?
Thanks,
Ilya
flawed (at least the part implemented by me :-[ ;-). So I spend some
time, and made a primitive script to stress-test Perl in the "tricky"
situations. See ilyaz.org/software/tmp/check_redir.pl
The best-hoped-for results are: having only <123//456> and <> as
possible output strings (ones after the colon in the output), maybe
interspersed with some warnings about closed filehandles. I tested on
3 architectures OS/2, BSD, and RedHat. I see much more than this.
The problems which I see are:
a) $! may become "Inappropriate ioctl for device" during
closing (some of) STDERR, STDOUT, STDIN.
b) I may see output <<456>>, which means that STDERR was NOT redirected.
c) Shell may be called in
open GRANDKID, q(|-), "$^X -wl - 2>&1" or die 12;
while Perl has enough whistles to do it without shell ( as I assume
it is doing with q(-|) ).
d) I see "Unknown error 171324724" as content of $!.
e) I see $? being -1, or 256 when things end in exit(0).
f) the grandchild may block.
(What is most surprising is that BSD behaves differently than Linux...)
I suspected that most of the errors would be due to MY code in Perl;
one piece implementing shell-less 2>&1 redirection, and one reporting
the error of exec() to the fork()'s parent. These would be easy to
fix (one could "relocate" generated filehandles to be above 2 - and,
for best result, above $^F). But it looks like there are different
cans of worms present in the picture...
Can you experiment (just run the script without arguments) and report
if you see some OTHER problems than those mentioned?
Thanks,
Ilya