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

Owner: Nobody
Requestors: dougw [at] safeguard.net
Cc:
AdminCc:

Operating System: HPUX
PatchStatus: (no value)
Severity: medium
Type: library
Perl Version: 5.005_03
Fixed In: (no value)



From: Doug Wilson <dougw [...] safeguard.net>
To: "'perlbug [...] perl.com'" <perlbug [...] perl.com>
Subject: System command starting with environment variable on HP-UX
Date: Fri, 21 Jan 2000 16:07:13 -0800
Download (untitled) / with headers
text/plain 2.9k
This is a bug report for perl from dougw@safeguard.net, generated with the help of perlbug 1.26 running under perl 5.00503. ----------------------------------------------------------------- A non zero status is returned from the system() function when the supplied command begins with an environment variable setting where the environment variable contains an underscore or a digit. such as: system('tmp_junk=5 ls') and die "Error:$!"; or: system('tmp_junk1=5 ls') and die "Error:$!"; Even though such a command will work from the command line and return a successful status of zero e.g., the following works on the command line (and outputs the results from ls): tmp_junk=5 ls or: sh -c "tmp_junk=5 ls" ----------------------------------------------------------------- --- Site configuration information for perl 5.00503: Configured by dougw at Fri Jan 21 08:43:13 PST 2000. Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration: Platform: osname=hpux, osvers=10.20, archname=PA-RISC1.1 uname='hp-ux mongo b.10.20 u 9000800 245239331 unlimited-user license ' hint=recommended, useposix=true, d_sigaction=define usethreads=undef useperlio=undef d_sfio=undef Compiler: cc='cc', optimize=' ', gccversion= cppflags='-Ae -DDEBUGGING -I/usr/local/include' ccflags ='-Ae -DDEBUGGING -I/usr/local/include' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 alignbytes=8, usemymalloc=y, prototype=define Linker and Libraries: ld='ld', ldflags =' -L/usr/local/lib' libpth=/usr/local/lib /lib/pa1.1 /lib /usr/lib /usr/ccs/lib libs=-lnsl_s -lndbm -ldld -lm -lc -lndir -lcrypt libc=/lib/libc.sl, so=sl, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_hpux.xs, dlext=sl, d_dlsymun=undef, ccdlflags='-Wl,-E -Wl,-B,deferred ' cccdlflags='+z', lddlflags='-b -L/usr/local/lib' Locally applied patches: --- @INC for perl 5.00503: /home/dougw/perl/lib/5.00503/PA-RISC1.1 /home/dougw/perl/lib/5.00503 /home/dougw/perl/lib/site_perl/5.005/PA-RISC1.1 /home/dougw/perl/lib/site_perl/5.005 . --- Environment for perl 5.00503: HOME=/home/dougw LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/home/dougw/bin:/home/dougw/perl/bin:/usr/bin:/opt/ansic/bin:/usr/ccs/b in:/usr/contrib/bin:/opt/nettladm/bin:/opt/pd/bin:/usr/bin/X11:/usr/contrib/ bin/X11:/opt/upgrade/bin:/opt/perf/bin:/opt/hpnp//bin:/opt/dtcmgr/sbin:/opt/ hparray/bin:/opt/rdtcmgr/sbin:/bin:/opt/langtools/bin:/opt/imake/bin:/opt/pr ed/bin:/opt/ignite/bin:/opt/resmon/bin:/usr/bin:/usr/ccs/bin:/usr/contrib/bi n:/opt/nettladm/bin:/usr/bin/X11:/usr/contrib/bin/X11:/opt/upgrade/bin:/opt/ hpnp/bin:/usr/local/bin:/opt/perl5/bin:/scope/cvs/cvsroot/bin:/opt/fourgen73 1/bin:/opt/informix730/bin:/scope/dev/all.4gm/lib.4gs:/scope/dev/scripts:. PERL_BADLANG (unset) SHELL=/usr/bin/sh
Date: Sat, 22 Jan 2000 18:42:13 +0100
To: Doug Wilson <dougw [...] safeguard.net>
From: Dominic Dunlop <domo [...] computer.org>
Subject: Re: [ID 20000121.005] System command starting with environment variable on HP-UX
Cc: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 861b
At 16:07 -0800 2000-01-21, Doug Wilson wrote: Show quoted text
>A non zero status is returned from the >system() function when the supplied command >begins with an environment variable setting >where the environment variable contains an >underscore or a digit.
It's not HP-specific, or 5.005_03-specific. Here's a one-line fix. It's against 5.005_03, as that's what the report's against, but also applies to 5.005_63 (with an offset of 184 lines). --- perl5.005_03/doio.c-as_received Sat Mar 27 17:57:24 1999 +++ perl5.005_03/doio.c Sat Jan 22 18:10:15 2000 @@ -1069,7 +1069,7 @@ do_exec(char *cmd) if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4])) goto doshell; - for (s = cmd; *s && isALPHA(*s); s++) ; /* catch VAR=val gizmo */ + for (s = cmd; *s && isALNUM_LC(*s); s++) ; /* catch VAR=val gizmo */ if (*s == '=') goto doshell; -- Dominic Dunlop
From: Ilya Zakharevich <ilya [...] math.ohio-state.edu>
Subject: Re: [ID 20000121.005] System command starting with environment
To: domo [...] computer.org (Dominic Dunlop)
Date: Sat, 22 Jan 2000 13:21:14 -0500 (EST)
Cc: dougw [...] safeguard.net (Doug Wilson), perl5-porters [...] perl.org
Dominic Dunlop writes: Show quoted text
> > At 16:07 -0800 2000-01-21, Doug Wilson wrote:
> >A non zero status is returned from the > >system() function when the supplied command > >begins with an environment variable setting > >where the environment variable contains an > >underscore or a digit.
> > It's not HP-specific, or 5.005_03-specific. Here's a one-line fix. > It's against 5.005_03, as that's what the report's against, but also > applies to 5.005_63 (with an offset of 184 lines). > > --- perl5.005_03/doio.c-as_received Sat Mar 27 17:57:24 1999 > +++ perl5.005_03/doio.c Sat Jan 22 18:10:15 2000 > @@ -1069,7 +1069,7 @@ do_exec(char *cmd) > if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4])) > goto doshell; > > - for (s = cmd; *s && isALPHA(*s); s++) ; /* catch VAR=val gizmo */ > + for (s = cmd; *s && isALNUM_LC(*s); s++) ; /* catch VAR=val gizmo */ > if (*s == '=') > goto doshell;
Is not LC locale? Then this is not a fix (set LANG=C), and is a very dangerous modification (putting locale-dependencies in the core operation). What about isWORD (sp?)? Ilya
Date: Sun, 23 Jan 2000 22:58:05 +0100
To: Ilya Zakharevich <ilya [...] math.ohio-state.edu>
From: Dominic Dunlop <domo [...] computer.org>
Subject: Re: [ID 20000121.005] System command starting with environment
Cc: dougw [...] safeguard.net (Doug Wilson), perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
At 13:21 -0500 2000-01-22, Ilya Zakharevich wrote: Show quoted text
>Dominic Dunlop writes:
> > --- perl5.005_03/doio.c-as_received Sat Mar 27 17:57:24 1999 > > +++ perl5.005_03/doio.c Sat Jan 22 18:10:15 2000 > > @@ -1069,7 +1069,7 @@ do_exec(char *cmd) > > if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4])) > > goto doshell; > > > > - for (s = cmd; *s && isALPHA(*s); s++) ; /* catch
>VAR=val gizmo */
> > + for (s = cmd; *s && isALNUM_LC(*s); s++) ; /* catch
>VAR=val gizmo */
> > if (*s == '=') > > goto doshell;
> >Is not LC locale? Then this is not a fix (set LANG=C), and is a very >dangerous modification (putting locale-dependencies in the core >operation). What about isWORD (sp?)?
Good point. There's not an isWORD(), but plain isALNUM() seems to suit, so I should have said: --- perl5.005_03/doio.c-as_received Sat Mar 27 17:57:24 1999 +++ perl5.005_03/doio.c Sat Jan 22 18:10:15 2000 @@ -1069,7 +1069,7 @@ do_exec(char *cmd) if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4])) goto doshell; - for (s = cmd; *s && isALPHA(*s); s++) ; /* catch VAR=val gizmo */ + for (s = cmd; *s && isALNUM(*s); s++) ; /* catch VAR=val gizmo */ if (*s == '=') goto doshell; -- Dominic Dunlop
Date: Mon, 24 Jan 2000 10:15:12 +0100
To: perl5-porters [...] perl.org
From: Dominic Dunlop <domo [...] computer.org>
Subject: Re: [ID 20000121.005] System command starting with environment [PATCH for tests]
Cc: Ilya Zakharevich <ilya [...] math.ohio-state.edu>, dougw [...] safeguard.net (Doug Wilson)
Download (untitled) / with headers
text/plain 1.3k
At 22:58 +0100 2000-01-23, Dominic Dunlop wrote: Show quoted text
>--- perl5.005_03/doio.c-as_received Sat Mar 27 17:57:24 1999 >+++ perl5.005_03/doio.c Sat Jan 22 18:10:15 2000 >@@ -1069,7 +1069,7 @@ do_exec(char *cmd) > if (strnEQ(cmd,"exec",4) && isSPACE(cmd[4])) > goto doshell; > >- for (s = cmd; *s && isALPHA(*s); s++) ; /* catch VAR=val gizmo */ >+ for (s = cmd; *s && isALNUM(*s); s++) ; /* catch VAR=val gizmo */ > if (*s == '=') > goto doshell;
Here's the corresponding test. Again, against 5.005_03, but also applies against 5.005_63 with an offset of 9 lines. --- perl5.005_03/t/op/exec.t-as_received Fri Aug 7 01:02:14 1998 +++ perl5.005_03/t/op/exec.t Mon Jan 24 10:08:32 2000 @@ -11,7 +11,7 @@ exit(0); } -print "1..8\n"; +print "1..10\n"; if ($^O ne 'os2') { print "not ok 1\n" if system "echo ok \\1"; # shell interpreted @@ -32,4 +32,11 @@ unless (exec "lskdjfalksdjfdjfkls") {print "ok 7\n";} else {print "not ok 7\n";} -exec "echo","ok","8"; +# make sure shell is used if shell variable assignment seen +print "not ok 8\n" if system "s_1=bfzky echo ok 8"; + +# apparent assignment after command name should not pull in shell +# (test assumes there's no executable called "set" around) +print "not " unless system "set s_1=bfzky"; print "ok 9\n"; + +exec "echo","ok","10"; -- Dominic Dunlop


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