develooper Front page | perl.perl5.porters | Postings from June 2002

[ID 20020628.003] STDIN inaccessable after undef'ing it

Thread Next
From:
Daniel Berlin
Date:
June 28, 2002 08:38
Subject:
[ID 20020628.003] STDIN inaccessable after undef'ing it
Message ID:
000901c21eb9$475a2bb0$0b01a8c0@client1
To: perlbug@perl.org
Subject: STDIN inaccessable after undef'ing it
Reply-To: fw8y079@public.uni-hamburg.de

This is a bug report for perl from fw8y079@public.uni-hamburg.de,
generated with the help of perlbug 1.33 running under perl v5.6.1.

-----------------------------------------------------------------
[Please enter your report here]

# This works:
#
open (FH, '</proc/meminfo') || die;                 # opens that file

print `ls -l /proc/$$/fd | grep -v total`;            # output ok
undef *FH;                                                    # close _and_
undef FH
print `echo;ls -l /proc/$$/fd | grep -v total`;    # output ok

#------------------------------

# This makes *STDIN inaccessable without closing it:
#
undef *STDIN;
print `ls -l /proc/$$/fd | grep -v total`;

# Output #1
#lrwx------ 1 root root 64 Jun 28 17:20 0 -> /dev/tty3
#lrwx------ 1 root root 64 Jun 28 17:20 1 -> /dev/tty3
#lrwx------ 1 root root 64 Jun 28 17:20 2 -> /dev/tty3
#lr-x------ 1 root root 64 Jun 28 17:20 3 -> pipe:[17052169]
#lr-x------ 1 root root 64 Jun 28 17:20 5 -> pipe:[17052170]

close (STDIN);
print `echo; ls -l /proc/$$/fd | grep -v total`;

# Output #2
#lrwx------ 1 root root 64 Jun 28 17:20 0 -> /dev/tty3
#lrwx------ 1 root root 64 Jun 28 17:20 1 -> /dev/tty3
#lrwx------ 1 root root 64 Jun 28 17:20 2 -> /dev/tty3
#lr-x------ 1 root root 64 Jun 28 17:20 3 -> pipe:[17052173]

#----------------------

# If STDIN is dup'ed before ('' open (FH, '<&=STDIN'); ''),
# then ''close (FH)'' closes FD 0 !
# Else it's - imho - impossible to access FD 0...

Thx,
Daniel Berlin

[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
category=core
severity=low
---
Site configuration information for perl v5.6.1:
Configured by bod at Fri Jan 11 04:14:18 EST 2002.
Summary of my perl5 (revision 5.0 version 6 subversion 1) configuration:
Platform:
osname=linux, osvers=2.4.13, archname=i386-linux
uname='linux duende 2.4.13 #1 wed oct 31 19:18:07 est 2001 i686 unknown '
config_args='-Dccflags=-DDEBIAN -Dcccdlflags=-fPIC -Darchname=i386-linux -Dp
refix=/usr -Dprivlib=/usr/share/perl/5.6.1 -Darchlib=/usr/lib/perl/5.6.1 -Dv
endorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 -D
siteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.6.1 -Dsitearch=/usr/
local/lib/perl/5.6.1 -Dman1dir=/usr/share/man/man1 -Dman3dir=/usr/share/man/
man3 -Dman1ext=1 -Dman3ext=3perl -Dpager=/usr/bin/sensible-pager -Uafs -Ud_c
sh -Uusesfio -Duseshrplib -Dlibperl=libperl.so.5.6.1 -Dd_dosuid -des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef
usemultiplicity=undef
useperlio=undef d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
Compiler:
cc='cc', ccflags
='-DDEBIAN -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_
FILE_OFFSET_BITS=64',
optimize='-O2',
cppflags='-DDEBIAN -fno-strict-aliasing -I/usr/local/include'
ccversion='', gccversion='2.95.4 (Debian prerelease)', 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, usemymalloc=n, prototype=define
Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lgdbm -ldb -ldl -lm -lc -lcrypt
perllibs=-ldl -lm -lc -lcrypt
libc=/lib/libc-2.2.4.so, so=so, useshrplib=true, libperl=libperl.so.5.6.1
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'
Locally applied patches:
---
@INC for perl v5.6.1:
/usr/local/lib/perl/5.6.1
/usr/local/share/perl/5.6.1
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.6.1
/usr/share/perl/5.6.1
/usr/local/lib/site_perl/i386-linux
/usr/local/lib/site_perl
..
---
Environment for perl v5.6.1:
HOME=/root
LANG=de_DE
LANGUAGE=de_DE
LC_ALL=de_DE
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6
/bin:/scripts:/usr/games
PERL_BADLANG=0
SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About