jenkins-bot has submitted this change and it was merged.

Change subject: Fixes for duplicateStderr (I833aeb3a)
......................................................................


Fixes for duplicateStderr (I833aeb3a)

* Separate code from data. $2 in limit.sh is an option list.
* Don't duplicate stderr on linux when limit.sh is not used, unless
  duplicateStderr is specified

Change-Id: I8e6e74810864830c12af627bfbe75e74ba34e3e3
---
M includes/GlobalFunctions.php
M includes/limit.sh
2 files changed, 7 insertions(+), 6 deletions(-)

Approvals:
  Aaron Schulz: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php
index 8241d81..d8e6b36 100644
--- a/includes/GlobalFunctions.php
+++ b/includes/GlobalFunctions.php
@@ -2773,10 +2773,6 @@
        $cmd = $envcmd . $cmd;
 
        if ( php_uname( 's' ) == 'Linux' ) {
-               $stderrDuplication = '';
-               if ( $includeStderr ) {
-                       $stderrDuplication = 'exec 2>&1; ';
-               }
                $time = intval ( isset( $limits['time'] ) ? $limits['time'] : 
$wgMaxShellTime );
                if ( isset( $limits['walltime'] ) ) {
                        $wallTime = intval( $limits['walltime'] );
@@ -2792,14 +2788,14 @@
                        $cmd = '/bin/bash ' . escapeshellarg( 
"$IP/includes/limit.sh" ) . ' ' .
                                escapeshellarg( $cmd ) . ' ' .
                                escapeshellarg(
-                                       $stderrDuplication .
+                                       "MW_INCLUDE_STDERR=" . ( $includeStderr 
? '1' : '' ) . ';' .
                                        "MW_CPU_LIMIT=$time; " .
                                        'MW_CGROUP=' . escapeshellarg( 
$wgShellCgroup ) . '; ' .
                                        "MW_MEM_LIMIT=$mem; " .
                                        "MW_FILE_SIZE_LIMIT=$filesize; " .
                                        "MW_WALL_CLOCK_LIMIT=$wallTime"
                                );
-               } else {
+               } elseif ( $includeStderr ) {
                        $cmd .= ' 2>&1';
                }
        } elseif ( $includeStderr ) {
diff --git a/includes/limit.sh b/includes/limit.sh
index 6c4690e..2a1545b 100644
--- a/includes/limit.sh
+++ b/includes/limit.sh
@@ -6,6 +6,7 @@
 # and is available on most Linux systems. If Perl was distributed with
 # BSD::Resource included, we would happily use that instead, but it isn't.
 
+MW_INCLUDE_STDERR=
 MW_CPU_LIMIT=0
 MW_CGROUP=
 MW_MEM_LIMIT=0
@@ -15,6 +16,10 @@
 # Override settings
 eval "$2"
 
+if [ -n "$MW_INCLUDE_STDERR" ]; then
+       exec 2>&1
+fi
+
 if [ "$MW_CPU_LIMIT" -gt 0 ]; then
        ulimit -t "$MW_CPU_LIMIT"
 fi

-- 
To view, visit https://gerrit.wikimedia.org/r/91114
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I8e6e74810864830c12af627bfbe75e74ba34e3e3
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Tim Starling <tstarl...@wikimedia.org>
Gerrit-Reviewer: Aaron Schulz <asch...@wikimedia.org>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to