Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pp_ftrread appears to use the wrong access mode for -x when using "use filetest 'access';" #9163

Closed
p5pRT opened this issue Dec 21, 2007 · 4 comments

Comments

@p5pRT
Copy link

p5pRT commented Dec 21, 2007

Migrated from rt.perl.org#49003 (status was 'resolved')

Searchable as RT49003$

@p5pRT
Copy link
Author

p5pRT commented Dec 21, 2007

From pravus@cpan.org

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​:

Inline 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

@p5pRT
Copy link
Author

p5pRT commented Jan 6, 2008

From @rgs

On 21/12/2007, via RT pravus @​ cpan. org <perlbug-followup@​perl.org> wrote​:

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.

@p5pRT
Copy link
Author

p5pRT commented Jan 6, 2008

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jan 6, 2008

@rgs - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant