<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Other/pipefail.txt fails when using a timeout command prefix"
   href="http://llvm.org/bugs/show_bug.cgi?id=16743">16743</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Other/pipefail.txt fails when using a timeout command prefix
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>All
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>MacOS X
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>fang@csl.cornell.edu
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu, rafael.espindola@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On darwin8, /bin/sh shell is an old bash-2.0 (pre-pipefail), so I run with the
following patch to use a newer bash (4.0):

diff --git a/utils/lit/lit/LitConfig.py b/utils/lit/lit/LitConfig.py
index 9bcf20b..f2003eb 100644
--- a/utils/lit/lit/LitConfig.py
+++ b/utils/lit/lit/LitConfig.py
@@ -34,7 +34,8 @@ class LitConfig:
         self.debug = debug
         self.isWindows = bool(isWindows)
         self.params = dict(params)
-        self.bashPath = None
+       # local hack only, don't commit this patch
+        self.bashPath = '/sw/bin/bash'

         # Configuration files to look for when discovering test suites.
         self.config_prefix = config_prefix or 'lit'
diff --git a/utils/lit/lit/TestRunner.py b/utils/lit/lit/TestRunner.py
index daa9b7d..a9d8df5 100644
--- a/utils/lit/lit/TestRunner.py
+++ b/utils/lit/lit/TestRunner.py
@@ -389,7 +389,8 @@ def parseIntegratedTestScript(test,
normalize_slashes=False,
             if script and script[-1][-1] == '\\':
                 script[-1] = script[-1][:-1] + ln
             else:
-                script.append(ln)
+                script.append('gtimeout 5m ' +ln)
+               # do not commit this patch
         elif 'XFAIL:' in ln:
             items = ln[ln.index('XFAIL:') + 6:].split(',')
             xfails.extend([s.strip() for s in items])


However, the new pipefail.txt test fails:


FAIL: LLVM :: Other/pipefail.txt (5725 of 8411)
******************** TEST 'LLVM :: Other/pipefail.txt' FAILED
******************
**
Script:
--
gtimeout 5m  ((false | true) && echo true || echo false) | grep false
--
Exit Code: 2
Command Output (stderr):
--
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/test/Other/Output/pipefail.txt.script:
line 1: syntax error near unexpected token `('
/Volumes/Isolde/builds/LLVM/gcc40-cmake-build/test/Other/Output/pipefail.txt.script:
line 1: `set -o pipefail;{ gtimeout 5m  ((false | true) && echo true || echo
false) | grep false; }'
--

********************

Proof that /sw/bin/bash works:
bash-4.2$ set -o pipefail
bash-4.2$ ((false | true) && echo true || echo false) | grep false
false
bash-4.2$ echo $?
0

But, if I paste the failing command into bash:

bash-4.2$ set -o pipefail;{ gtimeout 5m  ((false | true) && echo true || echo
false) | grep false; }
bash: syntax error near unexpected token `('
bash-4.2$ echo $?
2

If I remove the gtimeout prefix, it works again.

bash-4.2$ set -o pipefail;{ ((false | true) && echo true || echo false) | grep
false; }
false
bash-4.2$ echo $?
0

(I use timeout b/c a long time ago, some tests would hang, and only get caught
by timeout.  Not so anymore.)
Is there a trivial syntactic change to this test that would allow a timeout
prefix to work?
Maybe I need to make an exception for prepending timeout when the command
begins with any grouping operator like '('?</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>