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

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

Thread Next
From:
David Dyck
Date:
November 20, 2000 11:43
Subject:
[ID 20001120.010] typo in lib/Cwd.pm broke Cwd::chdir
Message ID:
200011201943.LAA08451@dd.tc.fluke.com
This is a bug report for perl from dcd@tc.fluke.com,
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/Cwd.pm.

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/Cwd.pm.rsync	Sun Nov 19 18:51:53 2000
+++ lib/Cwd.pm	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]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=critical
---
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:
  Platform:
    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 -Dcf_email=dcd@tc.fluke.com'
    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
  Compiler:
    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-2.91.66.1 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/libc.so.5.4.44, 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:
    DEVEL7776

---
@INC for perl v5.7.0:
    /usr/local/lib/perl5/5.7.0/i686-linux
    /usr/local/lib/perl5/5.7.0
    /usr/local/lib/perl5/site_perl/5.7.0/i686-linux
    /usr/local/lib/perl5/site_perl/5.7.0
    /usr/local/lib/perl5/site_perl
    .

---
Environment for perl v5.7.0:
    HOME=/home/dcd
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/home/dcd/bin:/sbin:/usr/local/bin:/bin:/usr/bin:/usr/X11/bin:/usr/games:/usr/local/samba:/home/hobbes/tools/scripts:/home/hobbes/tools/linux:/usr0/hobbes/tools/scripts:/usr0/dcd/bin:/apps/general/bin:/usr/public
    PERL_BADLANG (unset)
    SHELL=/bin/bash


Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About