Skip Menu |
 
Report information
Id: 49003
Status: resolved
Priority: 0/
Queue: perl5

Owner: Nobody
Requestors: pravus [at] cpan.org
Cc:
AdminCc:

Operating System: Linux
PatchStatus: (no value)
Severity: medium
Type: core
Perl Version: 5.10.0
Fixed In: (no value)



Subject: pp_ftrread appears to use the wrong access mode for -x when using "use filetest 'access';"
Date: Fri, 21 Dec 2007 12:04:31 -0600
To: perlbug [...] perl.org
From: jhord [...] wyrmsoft.tzo.net
Download (untitled) / with headers
text/plain 3.3k
This is a bug report for perl from pravus@cpan.org, generated with the help of perlbug 1.36 running under perl 5.10.0. I have found that the '-x' test will fail even when I do have execute access to a file if the filetest 'access' pragma is enabled. Here is a short test case: { use filetest qw/ access /; print -x '/bin/cat' ? "YES" : "NO", "\n"; } print -x '/bin/cat' ? "YES" : "NO", "\n"; The first test fails but the second test succeeds (as expected). I looked at pp_sys.c and it appears as though OP_FTEEXEC is using W_OK instead of X_OK. Below is a small patch: diff -urP perl-5.10.0-orig/pp_sys.c perl-5.10.0/pp_sys.c --- perl-5.10.0-orig/pp_sys.c 2007-12-18 04:47:08.000000000 -0600 +++ perl-5.10.0/pp_sys.c 2007-12-21 11:32:29.000000000 -0600 @@ -3002,7 +3002,7 @@ case OP_FTEEXEC: #ifdef PERL_EFF_ACCESS - access_mode = W_OK; + access_mode = X_OK; #else use_access = 0; #endif -- jason hord pravus@cpan.org --- Flags: category=core severity=medium --- Site configuration information for perl 5.10.0: Configured by jhord at Tue Dec 18 13:12:38 CST 2007. Summary of my perl5 (revision 5 version 10 subversion 0) configuration: Platform: osname=linux, osvers=2.6.22-gentoo-r5, archname=i686-linux uname='linux behemoth 2.6.22-gentoo-r5 #2 sat sep 8 08:03:39 cdt 2007 i686 intel(r) pentium(r) 4 cpu 2.26ghz genuineintel gnulinux ' config_args='-Dprefix=/opt/perl-5.10.0 -des' hint=recommended, useposix=true, d_sigaction=define useithreads=undef, usemultiplicity=undef useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef use64bitint=undef, use64bitall=undef, uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='cc', ccflags ='-fno-strict-aliasing -pipe -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/include/gdbm', optimize='-O2', cppflags='-fno-strict-aliasing -pipe -I/usr/include/gdbm' ccversion='', gccversion='4.1.2 (Gentoo 4.1.2)', 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=8 alignbytes=4, prototype=define Linker and Libraries: ld='cc', 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.6.1.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='2.6.1' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-Wl,-E' cccdlflags='-fPIC', lddlflags='-shared -O2 -L/usr/local/lib' Locally applied patches: --- @INC for perl 5.10.0: /opt/perl-5.10.0/lib/5.10.0/i686-linux /opt/perl-5.10.0/lib/5.10.0 /opt/perl-5.10.0/lib/site_perl/5.10.0/i686-linux /opt/perl-5.10.0/lib/site_perl/5.10.0 . --- Environment for perl 5.10.0: HOME=/home/jhord LANG (unset) LANGUAGE (unset) LC_ALL=en_US.UTF-8 LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/opt/perl-5.10.0/bin:/opt/perl/bin:/sbin:/usr/sbin:/usr/local/sbin:/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/i686-pc-linux-gnu/gcc-bin/4.1.2:/usr/i686-pc-linux-gnu/gcc-bin/4.1.1:/usr/games/bin:/home/jhord/bin PERL_BADLANG (unset) SHELL=/bin/bash
Subject: Re: [perl #49003] pp_ftrread appears to use the wrong access mode for -x when using "use filetest 'access';"
Date: Sun, 6 Jan 2008 17:20:29 +0100
To: perl5-porters [...] perl.org
From: "Rafael Garcia-Suarez" <rgarciasuarez [...] gmail.com>
Download (untitled) / with headers
text/plain 804b
On 21/12/2007, via RT pravus @ cpan. org <perlbug-followup@perl.org> wrote: Show quoted text
> I have found that the '-x' test will fail even when I do have execute > access to a file if the filetest 'access' pragma is enabled. Here is > a short test case: > > { > use filetest qw/ access /; > print -x '/bin/cat' ? "YES" : "NO", "\n"; > } > > print -x '/bin/cat' ? "YES" : "NO", "\n"; > > The first test fails but the second test succeeds (as expected). I > looked at pp_sys.c and it appears as though OP_FTEEXEC is using W_OK > instead of X_OK. Below is a small patch: > > diff -urP perl-5.10.0-orig/pp_sys.c perl-5.10.0/pp_sys.c > --- perl-5.10.0-orig/pp_sys.c 2007-12-18 04:47:08.000000000 -0600 > +++ perl-5.10.0/pp_sys.c 2007-12-21 11:32:29.000000000 -0600
Thanks, applied as change #32874.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org