Run ulimit4.sh using /bin/bash to avoid noexec
authorAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 18 Aug 2010 23:20:56 +0000 (23:20 +0000)
committerAryeh Gregor <simetrical@users.mediawiki.org>
Wed, 18 Aug 2010 23:20:56 +0000 (23:20 +0000)
Panora200 on IRC reported the error "/bin/bash: bad interpreter:
Permission denied", which we tracked down to the fact that /var/www (or
whatever) was mounted noexec.  Prepending '/bin/bash ' to the command
line should fix it.  Not heavily tested -- I only checked that
wfShellExec() seemed to work from eval.php for trivial uses.

RELEASE-NOTES
includes/GlobalFunctions.php

index 2e72a5c..08bfc52 100644 (file)
@@ -294,6 +294,7 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
   longer pollutes the parser cache.
 * (bug 17031) Correct which characters the parser allows in tag attributes.
 * Save 200 useless queries on each category page view
+* Shell commands will now work on Linux in filesystems mounted noexec
 
 === API changes in 1.17 ===
 * (bug 22738) Allow filtering by action type on query=logevent.
index 6a2139c..08b8c60 100644 (file)
@@ -2454,7 +2454,7 @@ function wfShellExec( $cmd, &$retval = null ) {
                if ( $time > 0 && $mem > 0 ) {
                        $script = "$IP/bin/ulimit4.sh";
                        if ( is_executable( $script ) ) {
-                               $cmd = escapeshellarg( $script ) . " $time $mem $filesize " . escapeshellarg( $cmd );
+                               $cmd = '/bin/bash ' . escapeshellarg( $script ) . " $time $mem $filesize " . escapeshellarg( $cmd );
                        }
                }
        } elseif ( php_uname( 's' ) == 'Windows NT' &&
@@ -3472,4 +3472,4 @@ function wfGetRepository() {
        }
        
        return $wgRepository;
-} 
\ No newline at end of file
+}