develooper Front page | perl.perl5.porters | Postings from April 2007

[perl #42829] File::Spec bug on VMS

Thread Next
From:
swkronenfeld @ gmail . com
Date:
April 30, 2007 12:02
Subject:
[perl #42829] File::Spec bug on VMS
Message ID:
rt-3.6.HEAD-1687-1177959440-470.42829-75-0@perl.org
# New Ticket Created by  swkronenfeld@gmail.com 
# Please include the string:  [perl #42829]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42829 >



This is a bug report for perl from swkronenfeld@gmail.com,
generated with the help of perlbug 1.35 running under perl v5.8.6.


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

Whenever my path length is a multiple of 8 + 1 (or a multiple of 8+3 if you count the brackets), i.e. 9, 17, 23, the path is formed incorrectly (as shown below). It discards the second argument and forms a file path based on the first argument only.

my $path = "[DIR."; 
my $tmp = ""; 
for(my $x=0; $x<60; $x++) { 
    $tmp .= "a"; 
    my $tmp2 = $path . $tmp . "]"; 
    print File::Spec->catfile($tmp2, "file") . "\n"; 
} 

----------------------------- 
$ perl test.pl 
USERS:[DIR.a]file 
USERS:[DIR.aa]file 
USERS:[DIR.aaa]file 
USERS:[DIR.aaaa]file 
USERS:[DIR]aaaaa 
USERS:[DIR.aaaaaa]file 
USERS:[DIR.aaaaaaa]file 
USERS:[DIR.aaaaaaaa]file 
USERS:[DIR.aaaaaaaaa]file 
USERS:[DIR.aaaaaaaaaa]file 
USERS:[DIR.aaaaaaaaaaa]file 
USERS:[DIR.aaaaaaaaaaaa]file 
USERS:[DIR]aaaaaaaaaaaaa 
USERS:[DIR.aaaaaaaaaaaaaa]file 
USERS:[DIR.aaaaaaaaaaaaaaa]file 
USERS:[DIR.aaaaaaaaaaaaaaaa]file 


I debugged this and found the following:

There is a bug in the function unixify (in VMS::Filespec). A control character is added to the end of certain length paths:

47: my($npath) = unixify($path); 
DB<7> x $path 0 '[DIR.aaaaa]' 
DB<8> s File::Spec::VMS::eliminate_macros(/perl_root/lib/File/Spec/VMS.pm:48):
48: my($complex) = 0; 
DB<8> x $npath 0 "/USERS/DIR/aaaaa\c@" # <---- What's that \c@ doing there?!

As opposed to

47: my($npath) = unixify($path); 
DB<9> x $path 0 '[DIR.aaaaaaa]' 
DB<10> s File::Spec::VMS::eliminate_macros(/perl_root/lib/File/Spec/VMS.pm:48):
48: my($complex) = 0; 
DB<10> x $npath 0 '/USERS/DIR/aaaaaaa/' 


[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=utilities
    severity=medium
---
Site configuration information for perl v5.8.6:

Configured by john at Wed Dec  8 16:58:35 CST 2004.

Summary of my perl5 (revision 5 version 8 subversion 6) configuration:
  Platform:
    osname=linux, osvers=2.4.21-15.0.4.tlsmp, archname=i686-linux-64int
    uname='linux thugbert.cs.wisc.edu 2.4.21-15.0.4.tlsmp #1 smp tue aug 3 23:02:48 edt 2004 i686 unknown '
    config_args=''
    hint=recommended, useposix=true, d_sigaction=define
    usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=define use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm',
    optimize='-O2',
    cppflags='-fno-strict-aliasing -pipe -I/usr/local/include -I/usr/include/gdbm'
    ccversion='', gccversion='3.4.1', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
    alignbytes=4, prototype=define
  Linker and Libraries:
    ld='gcc', ldflags =' -L/usr/local/lib'
    libpth=/usr/local/lib /lib /usr/lib
    libs=-lnsl -lgdbm -ldb -ldl -lm -lcrypt -lutil -lc
    perllibs=-lnsl -ldl -lm -lcrypt -lutil -lc
    libc=/lib/libc-2.3.2.so, so=so, useshrplib=false, libperl=libperl.a
    gnulibc_version='2.3.2'
  Dynamic Linking:
    dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E'
    cccdlflags='-fpic', lddlflags='-shared -L/usr/local/lib'

Locally applied patches:
    

---
@INC for perl v5.8.6:
    /s/perl-5.8.6/i386_tao10/lib/5.8.6/i686-linux-64int
    /s/perl-5.8.6/i386_tao10/lib/5.8.6
    /s/perl-5.8.6/i386_tao10/lib/site_perl/5.8.6/i686-linux-64int
    /s/perl-5.8.6/i386_tao10/lib/site_perl/5.8.6
    /s/perl-5.8.6/i386_tao10/lib/site_perl
    .

---
Environment for perl v5.8.6:
    HOME=/u/k/r/kronenfe
    LANG=en_US.UTF-8
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=/u/k/r/kronenfe/bin:/s/std/bin:/usr/afsws/bin:/opt/SUNWspro/bin:/usr/ccs/bin:/usr/ucb:/bin:/usr/bin:/usr/stat/bin:/usr/X11R6/bin:/unsup/condor/bin:/unsup/condor/sbin:/p/condor/home/bin:/p/condor/workspaces/vdt/bin:/u/k/r/kronenfe/ruby/ruby/bin:/u/k/r/kronenfe/ruby/ruby/lib/ruby/gems/bin
    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