[cgiapp] CGI now fails with /bin/sh: 0: Illegal option -p after upgrade to ubuntu precise (/bin/sh-->/bin/dash)

Michael Friendly friendly at yorku.ca
Tue Oct 30 14:18:49 EDT 2012


Env: perl 5.14.2; ubuntu precise 12.04, recently upgraded from ubuntu 
lucid 10.04

This may be at least as much of an OS question as a perl one, but I'm 
hoping that some kind soul will be willing to respond, or else point
me to more appropriate resources for solving this problem.

I have a collection of legacy cgi scripts using the CGI module, shown at 
  http://euclid.psych.yorku.ca/SCS/Online/

All worked fine under my previous ubuntu lucid 10.04 system, but they
now all fail after my upgrade to ubuntu precise 12.04

There's nothing very fancy, but they all use `` to run a system command,
such as
		@output = `$SAS $sasopts -sysin $sasfile_path`;
...
		&croak("$sasfile produced no results") unless @output;

When I run one of these in debug mode, via
euclid: lib/cgi-bin % setenv DEBUG 1
euclid: lib/cgi-bin % ./sascgi 'SASFILE=getlist1.sas&LISTS=1&ITEMS=20'

I get the error reported below:
<br>Running:
<br>  /usr/local/bin/sas -nonews -sasuser /tmp -work /tmp -config 
/usr/local/SAS/SASFoundation/9.2/sasv9.cfg -autoexec 
/home/friendly/autoexec.sas -sysin /var/www/tmp/getlist110165g.sas<br>
/bin/sh: 0: Illegal option -p
<P><STRONG>An error occurred while processing this form:</STRONG>
<P>getlist1.sas produced no results

I understand why this error occurs, but not how to fix it, at either the
perl or OS level.
WHY:  It seems that in my current ubuntu precise release, /bin/sh
has been replaced by /bin/dash, and the latter does not support the
-p option of the former /bin/sh,


  -p privileged
Turn on privileged mode.  This mode is enabled on startup if
either the effective user or group ID is not equal to the real
user or group ID. Turning this mode off sets the effective user
and group IDs to the real user and group IDs.  When this mode is
enabled for interactive shells, the file /etc/suid_profile is
sourced instead of ~/.profile after /etc/profile is sourced, and
the contents of the ENV variable are ignored.

At the perl level, I can't see why or where this -p option is set
in system calls running under CGI.

thanks,
-Michael




More information about the cgiapp mailing list