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

Assigning a file glob to ARGV #3455

Closed
p5pRT opened this issue Feb 20, 2001 · 2 comments
Closed

Assigning a file glob to ARGV #3455

p5pRT opened this issue Feb 20, 2001 · 2 comments

Comments

@p5pRT
Copy link

p5pRT commented Feb 20, 2001

Migrated from rt.perl.org#5872 (status was 'resolved')

Searchable as RT5872$

@p5pRT
Copy link
Author

p5pRT commented Feb 20, 2001

From tballard@poci.amis.com

In perl 5.004_04 the following​:

  @​ARGV = <'../../etc/hosts'>;
  print(<>);

results in​:

127.0.0.1 localhost
172.16.32.18 blackbird loghost
172.16.32.5 bubba

In 5.6.0 it results in​:

Can't open '../../etc/hosts'​: No such file or directory at (eval 17)[/usr1/tis/sunos7/lib/perl5/5.6.0/perl5db.pl​:1510] line 2.

Perl Info

Flags:
    category=core
    severity=medium

Site configuration information for perl v5.6.0:

Configured by tballard at Thu Feb 15 08:34:56 MST 2001.

Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration:
  Platform:
    osname=solaris, osvers=2.7, archname=sun4-solaris
    uname='sunos blackbird 5.7 generic_106541-12 sun4u sparc sunw,ultra-4 '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=undef d_sfio=undef uselargefiles=define 
    use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.95.2 19991024 (release)
    cppflags='-fno-strict-aliasing'
    ccflags ='-fno-strict-aliasing -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'
    stdchar='char', d_stdstdio=define, usevfork=false
    intsize=4, longsize=4, ptrsize=4, doublesize=8
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' '
    libpth=/lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt -lsec
    libc=, so=so, useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fPIC', lddlflags='-G'

Locally applied patches:
    


@INC for perl v5.6.0:
    /usr1/tis/sunos7/lib/perl5/5.6.0/sun4-solaris
    /usr1/tis/sunos7/lib/perl5/5.6.0
    /usr1/tis/sunos7/lib/perl5/site_perl/5.6.0/sun4-solaris
    /usr1/tis/sunos7/lib/perl5/site_perl/5.6.0
    /usr1/tis/sunos7/lib/perl5/site_perl
    .


Environment for perl v5.6.0:
    HOME=/home/tballard
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH=/usr/lib:/usr/openwin/lib:/usr/dt/lib:/usr/ucblib:/usr1/tis/sunos7/lib:/usr1/SUNWdtpcv/lib:/usr1/tis/sunos5/lib:/tools/oracle/lib
    LOGDIR (unset)
    PATH=.:/home/tballard/bin:/home/tballard/scripts:/usr/j2se/bin:/usr/openwin/bin:/usr1/tis/sunos7/bin:/usr1/tis/sunos6/bin:/usr/local/bin:/tools/scripts:/tools/local/bin:/bin:/usr/bin:/usr/dt/bin:/usr1/local/bin:/usr/ucb:/usr/ccs/bin:/usr/sbin:/usr1/SUNWdtpcv/bin:/tools/oracle/bin:/home/apps/staroffice/sol2/office5.2/program:/usr1/hosts/sunos7
    PERL_BADLANG (unset)
    SHELL=/bin/csh

@p5pRT
Copy link
Author

p5pRT commented Feb 23, 2001

From [Unknown Contact. See original ticket]

On Tue, 20 Feb 2001 11​:02 -0700, tballard@​poci.amis.com wrote​:

This is a bug report for perl from tballard@​amis.com,
generated with the help of perlbug 1.28 running under perl v5.6.0.

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

In perl 5.004_04 the following​:

@​ARGV = <'../../etc/hosts'>;
print(<>);

results in​:

127.0.0.1 localhost
172.16.32.18 blackbird loghost
172.16.32.5 bubba

In 5.6.0 it results in​:

Can't open '../../etc/hosts'​: No such file or directory at (eval 17)[/usr1/tis/sunos7/lib/perl5/5.6.0/perl5db.pl​:1510] line 2.

From "perldoc perlop"​:

  If what's within the angle brackets is neither a
  filehandle nor a simple scalar variable containing a
  filehandle name, typeglob, or typeglob reference, it is
  interpreted as a filename pattern to be globbed, and
  either a list of filenames or the next filename in the
  list is returned, depending on context. [...]

  One level of double-quote interpretation is done first, [...]

Because of the double-quote interpretation done first, perl5.6.0 tries
to open the file named "'../../etc/hosts'", not "../../etc/hosts" as
  ^ ^
you want. You should use​:

@​ARGV = <../../etc/hosts>;

I believe the bug report can be closed.

Thanks,
Radu Greab

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

1 participant