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

win NT: when close '<&='-d file handle the original one remains open, pecularities of open FH, '-' #5226

Open
p5pRT opened this issue Mar 6, 2002 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 6, 2002

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

Searchable as RT8805$

@p5pRT
Copy link
Author

p5pRT commented Mar 6, 2002

From tagunov@motor.ru

This is a bug report for perl from "Anton Tagunov" <tagunov@​motor.ru>,
generated with the help of perlbug 1.33 running under perl v5.7.3.


Hello!

1) Both of the following examples print their source :-(

use strict; use warnings;
open FH, $0 || die "$!";
open GH, "<&=FH";
close GH;
while(<FH>){print}

use strict; use warnings;
open FH, $0 || die "$!";
open GH, "<&=FH";
close FH;
while(<GH>){print}

That is <&= behaves like <&.

2) BTW, open FH, '-' behaves neither
  like '<&=STDIN' nor like '<=' should behave​:

open STDIN,'<'.$0;
open V,'-';
close V;
while(<STDIN>){print}; #prints the source

open STDIN,'<'.$0;
open V,'-';
close STDIN;
while(<V>){print}; #does not

3) Is this it like expected? Is it documented
  anywhere? Where should this be documented
  if it is not documented?

4) I have found no tests for this. Are there any?

Regards, Anton



Flags​:
  category=core
  severity=medium


Site configuration information for perl v5.7.3​:

Configured by anthony at Wed Mar 6 00​:02​:07 2002.

Summary of my perl5 (revision 5 undef) configuration​:
  Platform​:
  osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
  uname=''
  config_args='undef'
  hint=recommended, useposix=true, d_sigaction=undef
  usethreads=undef use5005threads=undef useithreads=define usemultiplicity=define
  useperlio=define d_sfio=undef uselargefiles=undef usesocks=undef
  use64bitint=undef use64bitall=undef uselongdouble=undef
  usemymalloc=n, bincompat5005=undef
  Compiler​:
  cc='cl', ccflags ='-nologo -Gf -W3 -O1 -MD -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSVCRT_READFIX',
  optimize='-O1 -MD -DNDEBUG',
  cppflags='-DWIN32'
  ccversion='undef', gccversion='', gccosandvers='undef'
  intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
  d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
  ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=4
  alignbytes=8, prototype=define
  Linker and Libraries​:
  ld='link', ldflags ='-nologo -nodefaultlib -release -libpath​:"c​:\perl5047\lib\CORE" -machine​:x86'
  libpth=e​:\apps\ds40\VC\lib
  libs= oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib netapi32.lib uuid.lib wsock32.lib mpr.lib winmm.lib version.lib odbc32.lib odbccp32.lib msvcrt.lib
  perllibs=undef
  libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl57.lib
  Dynamic Linking​:
  dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
  cccdlflags=' ', lddlflags='-dll -nologo -nodefaultlib -release -libpath​:"c​:\perl5047\lib\CORE" -machine​:x86'

Locally applied patches​:
  DEVEL15046


@​INC for perl v5.7.3​:
  c​:/perl15046/lib
  c​:/perl15046/site/lib
  .


Environment for perl v5.7.3​:
  HOME=C​:\
  LANG (unset)
  LANGUAGE (unset)
  LC_ALL=EN_US
  LD_LIBRARY_PATH (unset)
  LOGDIR (unset)
  PATH=E​:\apps\ibm\vaj\eab\bin;C​:\usr\local\bin\;e​:\Program Files\ibm\gsk5\lib;E​:\APPS\ROSE\RATION1\NUTCROOT\bin;E​:\APPS\ROSE\RATION1\NUTCROOT\bin\x11;E​:\APPS\ROSE\RATION~1\NUTCROOT\mksnt;e​:\java\sun\java131\bin;e​:\apps\vbroker\jre\Bin;e​:\apps\vbroker\Bin;C​:\WINNT\system32;C​:\WINNT;c​:\util;E​:\apps\CacheSys\Bin;C​:\Program Files\rksupport;C​:\WINNT\ton\bin;E​:\apps\rose\common;E​:\apps\rose\Rational Test;E​:\apps\borland\delphi\Bin;E​:\apps\borland\delphi\Projects\Bpl;E​:\apps\ibm\IBM\IMNNQ;E​:\apps\ibm\db2p\BIN;E​:\apps\ibm\db2p\FUNCTION;E​:\apps\ibm\db2p\SAMPLES\REPL;E​:\apps\ibm\db2p\HELP;e​:\apps\ibm\websphere\bin
  PERL_BADLANG (unset)
  SHELL (unset)

@p5pRT
Copy link
Author

p5pRT commented Mar 11, 2002

From [Unknown Contact. See original ticket]

use strict; use warnings;
open FH, 'echo a|' or die "$!";
open GH, "<&=FH";
close GH;
my $w;
$SIG{__WARN__}=sub{ $w=shift; };
my $v=<FH>;
print "not " unless $w && !defined($v);
print "ok\n";

- Anton

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