[LLVMbugs] [Bug 19744] New: FileCheck mishandles buffering on Windows when Cygwin is on PATH?

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed May 14 12:44:46 PDT 2014


            Bug ID: 19744
           Summary: FileCheck mishandles buffering on Windows when Cygwin
                    is on PATH?
           Product: Test Suite
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: lit
          Assignee: unassignedbugs at nondot.org
          Reporter: timurrrr at google.com
                CC: daniel at zuster.org, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Steps to repro as of r208805:
1) Have LLVM+Clang+compiler-rt checkout on a Windows machine

2) Do a cmake/ninja build

4) Put cygwin at the end of your PATH like so:
$ set PATH=%PATH%;C:\cygwin\bin

3) Run
$ python bin\llvm-lit.py -v
projects\compiler-rt\test\asan\32bitConfig\TestCases --filter=thread_stack
and make sure it passes

4) Apply the following simple patch to compiler-rt:
diff --git lib/sanitizer_common/sanitizer_win.cc
index ec6ce99..f82f78e 100644
--- lib/sanitizer_common/sanitizer_win.cc
+++ lib/sanitizer_common/sanitizer_win.cc
@@ -304,6 +304,7 @@ uptr internal_write(fd_t fd, const void *buf, uptr count) {

   DWORD ret;
+  Sleep(100);  // Make the failure stable rather than flaky.
   if (WriteFile(output_stream, buf, count, &ret, 0))
     return ret;

diff --git test/asan/TestCases/Windows/thread_stack_array_left_oob.cc
index 31a58bb..e6db163 100644
--- test/asan/TestCases/Windows/thread_stack_array_left_oob.cc
+++ test/asan/TestCases/Windows/thread_stack_array_left_oob.cc
@@ -1,7 +1,7 @@
 // RUN: %clangxx_asan -O0 %s -Fe%t 2>&1
 // 'cat' is used below to work around FileCheck buffering bug which makes this
 // test flaky.  FIXME: file an issue.
-// RUN: not %run %t 2>&1 | cat | FileCheck %s
+// RUN: not %run %t 2>&1 | FileCheck %s

 #include <windows.h>

5) Run the same test again.

I observe a failure like this:
Command Output (stderr):
error: expected string not found in input
// CHECK: AddressSanitizer: stack-buffer-overflow on address
<stdin>:1:1: note: scanning from here


Testing Time: 5.02s
Failing Tests (1):
    AddressSanitizer32 :: TestCases/Windows/thread_stack_array_left_oob.cc

It looks like the pipe between the binary and FileCheck gets interrupted
without waiting for the writer process to finish/close it.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20140514/fcd40236/attachment.html>

More information about the llvm-bugs mailing list