# New Ticket Created by Petr Pajas
# Please include the string: [perl #37033]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=37033 >
This is a bug report for perl from [EMAIL PROTECTED],
generated with the help of perlbug 1.35 running under perl v5.8.6.
-----------------------------------------------------------------
Hi!
A virtual beer to anyone who sheds some light on this:-)
I'm puzzled by a weird behavior of output redirection in a larger
application of mine. Finally, I was able to trim the code down to the
few lines below.
__CODE_STARTS_HERE__
#!/usr/bin/env perl
close STDIN;
eval <<'EVAL'; # <- remove or replace with eval {}
# to see the correct output
use Encode::Byte; # <- instead of POD of this
use IPC::Open2;
open2('>&STDOUT',$P,'cat') || die "cannot open pipe: $!\n";
print $P ("HALLO\n");
EVAL
__END__
It is now only a way round to pass the string "HALLO\n" to 'cat'
program. However, under the specific scenario, the content that follows
__END__ in the module Encode/Byte.pm is unexpectedly passed to 'cat'
instead.
HELLO is printed if either of the following conditions is satisfied:
* eval "" is removed
* eval "" is replaced with eval { }
* the initial close STDIN is removed
* close STDIN is moved into the eval
If 'use Encode::Byte' is removed, the program outputs nothing.
I'm assuming this is a bug because I don't see a reason why changing
eval"" to eval{} should make any difference here and also why closing
STDIN should be relevant.
I'm marking the bug as medium severe because of the fact that 'use
Module' exposes an open filehandle (fd0) with an unexpected content and open2
passes it to a subprocess where it shouldn't.
Beside the reported versions, I was able to reproduce the problem with
a 5.9.3 build on Fedora Core 3.
Thanks,
-- Petr
-----------------------------------------------------------------
---
Flags:
category=core
severity=medium
---
This perlbug was built using Perl v5.8.6 - Sat Mar 19 17:33:54 UTC 2005
It is being executed now by Perl v5.8.6 - Sat Mar 19 17:29:44 UTC 2005.
Site configuration information for perl v5.8.6:
Configured by abuild at Sat Mar 19 17:29:44 UTC 2005.
Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
Platform:
osname=linux, osvers=2.6.9, archname=i586-linux-thread-multi
uname='linux salieri 2.6.9 #1 smp fri jan 14 15:41:33 utc 2005 i686 athlon
i386 gnulinux '
config_args='-ds -e -Dprefix=/usr -Dvendorprefix=/usr -Dinstallusrbinperl
-Dusethreads -Di_db -Di_dbm -Di_ndbm -Di_gdbm -Duseshrplib=true
-Doptimize=-O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall
-pipe'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS
-DDEBUGGING -fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE
-D_FILE_OFFSET_BITS=64',
optimize='-O2 -march=i586 -mcpu=i686 -fmessage-length=0 -Wall -g -Wall
-pipe',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DTHREADS_HAVE_PIDS -DDEBUGGING
-fno-strict-aliasing -pipe'
ccversion='', gccversion='3.3.5 20050117 (prerelease) (SUSE Linux)',
gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
alignbytes=4, prototype=define
Linker and Libraries:
ld='cc', ldflags =''
libpth=/lib /usr/lib /usr/local/lib
libs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
perllibs=-lnsl -ldl -lm -lcrypt -lutil -lpthread -lc
libc=, so=so, useshrplib=true, libperl=libperl.so
gnulibc_version='2.3.4'
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E
-Wl,-rpath,/usr/lib/perl5/5.8.6/i586-linux-thread-multi/CORE'
cccdlflags='-fPIC', lddlflags='-shared'
Locally applied patches:
---
@INC for perl v5.8.6:
/usr/lib/perl5/5.8.6/i586-linux-thread-multi
/usr/lib/perl5/5.8.6
/usr/lib/perl5/site_perl/5.8.6/i586-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.6
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.6/i586-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.6
/usr/lib/perl5/vendor_perl
.
---
Environment for perl v5.8.6:
HOME=/home/pajas
LANG=cs_CZ.UTF-8
LANGUAGE (unset)
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/home/pajas/bin:/usr/local/bin:/usr/bin:/usr/X11R6/bin:/bin:/usr/games:/opt/gnome/bin:/opt/kde3/bin
PERL_BADLANG (unset)
SHELL=/bin/bash