[cgiapp] CGI now fails with /bin/sh: 0: Illegal option -p after upgrade to ubuntu precise (/bin/sh--/bin/dash)
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.sasLISTS=1ITEMS=20' I get the error reported below: brRunning: 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.sasbr /bin/sh: 0: Illegal option -p PSTRONGAn error occurred while processing this form:/STRONG Pgetlist1.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 # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] CGI now fails with /bin/sh: 0: Illegal option -p after upgrade to ubuntu precise (/bin/sh--/bin/dash)
euclid: lib/cgi-bin % setenv DEBUG 1 euclid: lib/cgi-bin % ./sascgi 'SASFILE=getlist1.sasLISTS=1ITEMS=20' 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. What happens you explicitly run the Perl script via bash instead of dash? bash -c perl./sascgi 'SASFILE=getlist1.sasLISTS=1ITEMS=20' Mark # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####
Re: [cgiapp] CGI now fails with /bin/sh: 0: Illegal option -p after upgrade to ubuntu precise (/bin/sh--/bin/dash)
On Tue, Oct 30, 2012 at 02:18:49PM -0400, Michael Friendly wrote: 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, Michael, you can change the default shell back to bash using sudo dpkg-reconfigure dash and answering n to the question Install dash as /bin/sh? Might slow down system start a little, but should actually work. Regards Matthias # CGI::Application community mailing list #### ## To unsubscribe, or change your message delivery options, ## ## visit: http://www.erlbaum.net/mailman/listinfo/cgiapp## #### ## Web archive: http://www.erlbaum.net/pipermail/cgiapp/ ## ## Wiki: http://cgiapp.erlbaum.net/ ## ####