Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perlio bug ? #4314

Open
p5pRT opened this issue Aug 11, 2001 · 4 comments
Open

perlio bug ? #4314

p5pRT opened this issue Aug 11, 2001 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Aug 11, 2001

Migrated from rt.perl.org#7515 (status was 'open')

Searchable as RT7515$

@p5pRT
Copy link
Author

p5pRT commented Aug 11, 2001

From me-01@ton.iguana.be

Run this from the commandline​:

perl -wle 'print $]; sub foo { local (*A, *B); pipe(A,B); return fileno(A)}; sub bar { local *BOE; print open(BOE, "<&=" . foo) ? "bad" : "good"}; bar; close STDIN; bar'

Tested on two systems this gives​:
5.007001
good
bad

5.006
good
good

Written formatted, the code is​:

print $];

sub foo {
  local (*A, *B);
  pipe(A,B);
  return fileno(A)
};

sub bar {
  local *BOE;
  print open(BOE, "<&=" . foo) ? "bad" : "good"
};

bar;
close STDIN;
bar

the filehandles created in foo should be closed when foo is left,
so bar's attempt to fdopen on the filedescriptor should fail.

It however succeeds from perl 5.7 on for filedescriptors 0, 1 and 2
because the closes are in fact not done.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.7.1:

Configured by ton at Sat May 12 18:42:24 CEST 2001.

Summary of my perl5 (revision 5.0 version 7 subversion 1) configuration:
  Platform:
    osname=linux, osvers=2.4.3, archname=i686-linux
    uname='linux quasar 2.4.3 #19 sun apr 1 10:46:29 cest 2001 i686 unknown '
    config_args='-e'
    hint=previous, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
  Compiler:
    cc='cc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUGGING',
    optimize='-g',
    cppflags='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -DDEBUGGING'
    ccversion='', gccversion='egcs-2.91.66 19990314 (egcs-1.1.2 release)', 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=8, usemymalloc=n, prototype=define
  Linker and Libraries:
    ld='cc', ldflags =' -L/usr/local/lib -L/opt/gnu/lib'
    libpth=/usr/local/lib /opt/gnu/lib /lib /usr/lib
    libs=-lnsl -lndbm -ldb -ldl -lm -lc -lposix -lcrypt -lutil
    perllibs=-lnsl -ldl -lm -lc -lposix -lcrypt -lutil
    libc=/lib/libc-2.1.1.so, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic -Wl,-rpath,/usr/lib/perl5/5.7.1/i686-linux/CORE'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib -L/opt/gnu/lib'

Locally applied patches:
    


@INC for perl v5.7.1:
    /usr/lib/perl5/5.7.1/i686-linux
    /usr/lib/perl5/5.7.1
    /usr/lib/perl5/site_perl/5.7.1/i686-linux
    /usr/lib/perl5/site_perl/5.7.1
    /usr/lib/perl5/site_perl
    .


Environment for perl v5.7.1:
    HOME=/home/ton
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/ton/bin.Linux:/home/ton/bin:/home/ton/bin.SampleSetup:/usr/local/bin:/usr/local/sbin:/usr/local/jre/bin:/usr/local/jdk116_v5/bin:/home/oracle/product/8.1.5/bin:/usr/games/bin:/usr/X11R6/bin:/usr/share/bin:/usr/bin:/usr/sbin:/bin:/sbin:.
    PERL_BADLANG (unset)
    SHELL=/bin/bash

@p5pRT
Copy link
Author

p5pRT commented May 2, 2012

From @jkeenan

On Sat Aug 11 12​:29​:40 2001, me-01@​ton.iguana.be wrote​:

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

Run this from the commandline​:

perl -wle 'print $]; sub foo { local (*A, *B); pipe(A,B); return
fileno(A)}; sub bar { local *BOE; print open(BOE, "<&=" . foo) ?
"bad" : "good"}; bar; close STDIN; bar'

Tested on two systems this gives​:
5.007001
good
bad

5.006
good
good

Written formatted, the code is​:

print $];

sub foo {
local (*A, *B);
pipe(A,B);
return fileno(A)
};

sub bar {
local *BOE;
print open(BOE, "<&=" . foo) ? "bad" : "good"
};

bar;
close STDIN;
bar

the filehandles created in foo should be closed when foo is left,
so bar's attempt to fdopen on the filedescriptor should fail.

It however succeeds from perl 5.7 on for filedescriptors 0, 1 and 2
because the closes are in fact not done.

Persists in Perl 5.14.2​:

$ perl -wle 'print $]; sub foo { local (*A, *B); pipe(A,B); return
fileno(A)}; sub bar { local *BOE; print open(BOE, "<&=" . foo) ? "bad" :
"good"}; bar; close STDIN; bar'
5.014002
good
bad

@p5pRT
Copy link
Author

p5pRT commented Jan 16, 2018

From zefram@fysh.org

Leaving low-numbered file descriptors open in these circumstances is
intentional behaviour. This ticket should be closed​: not a bug.

-zefram

@p5pRT
Copy link
Author

p5pRT commented Feb 18, 2018

From @xsawyerx

On Tue, 16 Jan 2018 02​:12​:25 -0800, zefram@​fysh.org wrote​:

Leaving low-numbered file descriptors open in these circumstances is
intentional behaviour. This ticket should be closed​: not a bug.

Can you please expand on "intentional behavior"?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants