[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]

[perl #59662] Cwd::realpath fails on unsearchable directory (AIX)



# New Ticket Created by  John.Wiersba@thomsonreuters.com 
# Please include the string:  [perl #59662]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=59662 >


This is a bug report for perl from john.wiersba@thomsonreuters.com,
generated with the help of perlbug 1.34 running under perl v5.8.2.
 

-----------------------------------------------------------------
[Please enter your report here]
 
1) Compile the following program as ./a.out:
 
/* C program to demonstrate that system-supplied realpath() works. */
#include <stdio.h>
#include <stdlib.h>
int main ( void )
{
   char buf[1000+1];
   realpath("testdir", buf);
   printf("<%s>\n", buf);
}
 
2) Run the following script:
 
#!/bin/ksh
mkdir testdir
chmod 444 testdir
echo "from perl:"
perl -we '
   use strict;
   use Cwd ();
   print "<", Cwd::realpath("testdir"), ">\n";
'
echo "from a.out:"
./a.out
rmdir testdir
 
3) See the following output:
 
from perl:
Use of uninitialized value in print at -e line 4.
<>
from a.out:
</home/jrw32982/junk/testdir>
 
4) Analysis:
 
Perl's realpath() is aliased to abs_path() which is aliased to
_perl_abs_path().  When _perl_abs_path(ARG) sees that ARG is a
directory, it
tries to opendir("ARG/..") which fails because ARG is not searchable.
The
system-supplied realpath() does not try to opendir("ARG/..") and does
not
fail.
 
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Flags:
    category=library
    severity=medium
---
Site configuration information for perl v5.8.2:
 
Configured by root at Thu Jan 26 14:26:31 CST 2006.
 
Summary of my perl5 (revision 5.0 version 8 subversion 2) configuration:
  Platform:
    osname=aix, osvers=5.2.0.0, archname=aix-thread-multi
    uname='aix animals 2 5 000709cf4c00 '
    config_args=''
    hint=previous, useposix=true, d_sigaction=define
    usethreads=define use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cc_r', ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
-q32 -D_LARGE_FILES -qlonglong',
    optimize='-O',
    cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384
-qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -q32
-D_LARGE_FILES -qlonglong -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
-q32 -D_LARGE_FILES -qlonglong -D_ALL_SOURCE -D_ANSI_C_SOURCE
-D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN
-DNEED_PTHREAD_INIT -q32 -D_LARGE_FILES -qlonglong -D_ALL_SOURCE
-D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384 -qnoansialias
-DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -q32 -D_LARGE_FILES -qlonglong
-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384
-qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT -q32
-D_LARGE_FILES -qlonglong -D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE
-qmaxmem=16384 -qnoansialias -DUSE_NATIVE_DLOPEN -DNEED_PTHREAD_INIT
-q32 -D_LARGE_FILES -qlonglong'
    ccversion='5.0.2.0', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
    d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='ld', ldflags =' -brtl -b32 -bmaxdata:0x80000000'
    libpth=/lib /usr/lib /usr/ccs/lib
    libs=-lbind -lnsl -ldbm -ldl -lld -lm -lpthreads -lc_r -lcrypt -lbsd
-lPW
    perllibs=-lbind -lnsl -ldl -lld -lm -lpthreads -lc_r -lcrypt -lbsd
-lPW
    libc=/lib/libc.a, so=a, useshrplib=true, libperl=libperl.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef,
ccdlflags='-bE:/usr/opt/perl5/lib/5.8.2/aix-thread-multi/CORE/perl.exp
-bE:/usr/opt/perl5/lib/5.8.2/aix-thread-multi/CORE/perl.exp
-bE:/usr/opt/perl5/lib/5.8.2/aix-thread-multi/CORE/perl.exp
-bE:/usr/opt/perl5/lib/5.8.2/aix-thread-multi/CORE/perl.exp'
    cccdlflags=' ', lddlflags='-bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp
-bE:$(BASEEXT).exp -bnoentry -lpthreads -lc_r'
 
Locally applied patches:
    SUIDPERLIO1 - fix PERLIO_DEBUG buffer overflow (CAN-2005-0156)
    SPRINTF0 - fixes for sprintf formatting issues - CVE-2005-3962
 
---
@INC for perl v5.8.2:
    /usr/opt/perl5/lib/5.8.2/aix-thread-multi
    /usr/opt/perl5/lib/5.8.2
    /usr/opt/perl5/lib/site_perl/5.8.2/aix-thread-multi
    /usr/opt/perl5/lib/site_perl/5.8.2
    /usr/opt/perl5/lib/site_perl
    .
 
---
Environment for perl v5.8.2:
    HOME=/home/jrw32982
    LANG=en_US
    LANGUAGE (unset)
    LC_ALL=C
    LC__FASTMSG=true
    LD_LIBRARY_PATH (unset)
    LIBPATH (unset)
    LOGDIR (unset)
 
PATH=/home/jrw32982/perl/bin:/medstat/devl/tools/common/scripts:/home/jr
w32982/sh:/home/jrw32982/bin:/bin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/l
ocal/bin:/usr/local/sbin:/etc:/sbin:/usr/ccs/bin:/usr/ucb:/usr/lbin:/med
stat/devl/tools/AIX_5.3/bin:.
    PERL_BADLANG (unset)
    SHELL=/usr/bin/ksh


[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]