develooper Front page | perl.perl5.porters | Postings from November 2000

[ID 20001120.010] typo in lib/ broke Cwd::chdir

Thread Next
David Dyck
November 20, 2000 11:43
[ID 20001120.010] typo in lib/ broke Cwd::chdir
Message ID:
This is a bug report for perl from,
generated with the help of perlbug 1.33 running under perl v5.7.0.

[Please enter your report here]

(I've listed this a critical (to Cwd::chdir), since it doesn't
 work until the typo is fixed)

The three line example in perldoc Cwd

           use Cwd 'chdir';
           chdir "/tmp";
           print $ENV{'PWD'};

does not print /tmp as expected (it prints the 
users home directory, as if no argument was
passed to chdir), nor does the chdir to /tmp take place as expected.

It appears that this is due to a typo in lib/

test case:
perl -le 'use Cwd qw(chdir); chdir "/tmp" || die "chdir:$!"; system "/bin/pwd"'

should print /tmp

removing qw(chdir) allows it to work, but then you don't use Cwd::chdir
and $ENV{'PWD'} doesn't get updateded.

As a side note, there was no test case for Cwd::chdir!

The following patch fixes the typo that was introduced in 5.7.0.

--- lib/	Sun Nov 19 18:51:53 2000
+++ lib/	Mon Nov 20 09:36:16 2000
@@ -188,7 +188,7 @@
 sub chdir {
-    my $newdir = @? ? shift : '';	# allow for no arg (chdir to HOME dir)
+    my $newdir = @_ ? shift : '';	# allow for no arg (chdir to HOME dir)
     $newdir =~ s|///*|/|g unless $^O eq 'MSWin32';
     chdir_init() unless $chdir_init;
     return 0 unless CORE::chdir $newdir;

[Please do not change anything below this line]
Site configuration information for perl v5.7.0:

Configured by dcd at Mon Nov 20 10:01:52 PST 2000.

Summary of my perl5 (revision 5.0 version 7 subversion 0) configuration:
    osname=linux, osvers=2.4.0-test11, archname=i686-linux
    uname='linux dd 2.4.0-test11 #1 mon nov 20 09:21:09 pst 2000 i686 '
    config_args='-Dusedevel -Doptimize=-O3 -g -de'
    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
    cc='cc', ccflags ='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
    optimize='-O3 -g',
    cppflags='-DDEBUGGING -fno-strict-aliasing -I/usr/local/include'
    ccversion='', gccversion='egcs- 19990314/Linux (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=4
    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 -ldbm -ldb -ldl -lm -lc
    perllibs=-ldl -lm -lc
    libc=/lib/, so=so, useshrplib=false, libperl=libperl.a
  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.7.0:

Environment for perl v5.7.0:
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PERL_BADLANG (unset)

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About