Navigation Menu

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

glob returns warning message in file name #823

Closed
p5pRT opened this issue Nov 6, 1999 · 1 comment
Closed

glob returns warning message in file name #823

p5pRT opened this issue Nov 6, 1999 · 1 comment

Comments

@p5pRT
Copy link

p5pRT commented Nov 6, 1999

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

Searchable as RT1751$

@p5pRT
Copy link
Author

p5pRT commented Nov 6, 1999

From eprice@scarface.doubleclick.net

first of all​:

i have not actually verified this bug with perl v5.004.04.

i have verified it on perl v5.005.02 and v5.005.03.

SunOS 5.6, i believe.

"perl -v" on the machine i was using reports​:
This is perl, version 5.005_03 built for sun4-solaris

anyway

here is test program​:

#!/usr/local/bin/perl -w
use strict;
use diagnostics;

#
# this program will print weird warning message
# as part of first filename returned from "glob"
# if any directories above the one given are not
# readable by current user.
#

my $directory = $ARGV[0];
my $file_suffix = $ARGV[1];

print "directory = $directory\n";
print "file_suffix = $file_suffix\n\n";

print "executing chdir $directory...\n";
chdir $directory;
print "chdir executed.\n\n";

print "executing glob...\n";
my @​files = glob ('*' . $file_suffix);
print "glob executed.\n\n";

for my $file (@​files)
{
  print "filename = { $file }\n";
}

print "\n";

exit;

#
# end of test program
#

if i run the program (called tmp.pl) like this​:

perl tmp.pl SOME_DIRECTORY_NAME SOME_FILE_SUFFIX

where i do not have read access to all directories above
SOME_DIRECTORY_NAME then the first filename returned by glob function
will have "Warning​: cannot determine current directory\n" as part of
(specifically, pre-pended to) the name.

To be clear​: It does *not* generate an error or warning.

Rather, the *text* of that warning message is *part* of the first
returned filename.

This seems pretty clearly wrong, ie a bug. It certainly "complicates"
dealing with the filenames returned by glob!

Hope this helps!
Thanks; perl is cool. :)

-edp

Perl Info


Site configuration information for perl 5.00404:

Configured by vic at Mon Jun 15 22:04:55 EDT 1998.

Summary of my perl5 (5.0 patchlevel 4 subversion 4) configuration:
  Platform:
    osname=solaris, osvers=2.6, archname=sun4-solaris
    uname='sunos wassup.vily.net 5.6 generic sun4m sparc sunw,sparcstation-20 '
    hint=recommended, useposix=true, d_sigaction=define
    bincompat3=y useperlio=undef d_sfio=undef
  Compiler:
    cc='gcc', optimize='-O', gccversion=2.8.1
    cppflags='-I/usr/local/include'
    ccflags ='-I/usr/local/include'
    stdchar='unsigned char', d_stdstdio=define, usevfork=false
    voidflags=15, castflags=0, d_casti32=define, d_castneg=define
    intsize=4, alignbytes=8, usemymalloc=y, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib /usr/ccs/lib
    libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
    libc=/lib/libc.so, so=so
    useshrplib=false, libperl=libperl.a
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
    cccdlflags='-fpic', lddlflags='-G -L/usr/local/lib'

Locally applied patches:
	


@INC for perl 5.00404:
	/usr/local/lib/perl5/sun4-solaris/5.00404
	/usr/local/lib/perl5
	/usr/local/lib/perl5/site_perl/sun4-solaris
	/usr/local/lib/perl5/site_perl
	.


Environment for perl 5.00404:
    HOME=/opt/home/eprice
    LANG (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/opt/oracle/product/8.0.5/bin:/opt/home/eprice/bin:/usr/local/bin:/bin:/usr/bin:/usr/X/bin:/sbin:/usr/sbin:/usr/ccs/bin:/usr/ucb:/usr/opt/SUNWmd/sbin
    PERL_BADLANG (unset)
    SHELL=/usr/local/bin/bash

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