bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#7597: multi-threaded sort can segfault (unrelated to the sort -u seg


From: Jim Meyering
Subject: bug#7597: multi-threaded sort can segfault (unrelated to the sort -u segfault)
Date: Mon, 13 Dec 2010 08:30:44 +0100

Paul Eggert wrote:
> On 12/12/2010 07:41 AM, Jim Meyering wrote:
>> That sounds good, assuming it triggers the bug reliably for you.
>> I was hoping to find a way to reproduce it without relying on gensort,
>> but won't object if you want to do that.
>
> In my attempts to reproduce the problem, it's pretty flaky.
> I think it depends on how busy the operating system is.
> Sometimes I'd get failures all the time; sometimes, almost
> never.  (This was with valgrind; I had much less luck without
> valgrind.)
>
> Anyway, I pushed this, which seemed to work well enough
> on my host.  It prefers gensort if available, but falls
> back on seq+shuf if not.
>
> Subject: [PATCH] tests: test for access to stale thread memory
>
> * tests/misc/sort-stale-thread-mem: New tests.
> * tests/Makefile.am (TESTS): Add it.

Thank you!
I did this, too:


>From 8351407f874ab3d6fc0830e78a6c234bf1583e3f Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 13 Dec 2010 08:07:25 +0100
Subject: [PATCH 1/2] tests: mark new test as very expensive

* tests/misc/sort-stale-thread-mem: Don't initialize fail=0 here;
that is done in init.sh.  This avoids a syntax-check failure.
Invoke "Exit $fail" at end, too.
Mark as a very expensive test.
---
 tests/misc/sort-stale-thread-mem |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tests/misc/sort-stale-thread-mem b/tests/misc/sort-stale-thread-mem
index c4f4fcb..8ad60ed 100755
--- a/tests/misc/sort-stale-thread-mem
+++ b/tests/misc/sort-stale-thread-mem
@@ -21,7 +21,7 @@
 . "${srcdir=.}/init.sh"; path_prepend_ ../src
 print_ver_ sort

-expensive_
+very_expensive_

 valgrind --help >/dev/null || skip_ "requires valgrind"
 test "$(nproc)" = 1 && skip_ "requires a multi-core system"
@@ -36,9 +36,10 @@ test "$(nproc)" = 1 && skip_ "requires a multi-core system"
 # on some circa-2010 multicore Linux platforms.  Run the test 10 times
 # so that the probability of missing the bug should be about 1 in
 # 2**100 on these hosts.
-fail=0
 for i in $(seq 100); do
   valgrind --quiet --error-exitcode=3 \
       sort -S 100K --parallel=2 in > /dev/null ||
     { fail=$?; echo iteration $i failed; Exit $fail; }
 done
+
+Exit $fail
--
1.7.3.3.38.gc6d05


>From 0c70708db7ed32d2b379116dc6bf64f07539aaf1 Mon Sep 17 00:00:00 2001
From: Jim Meyering <address@hidden>
Date: Mon, 13 Dec 2010 08:19:12 +0100
Subject: [PATCH 2/2] tests: tweak basic-1 to use warn_ rather than literal 
"exit 77"

* tests/install/basic-1 (just_built_dd): Use warn_, rather than
cat and exit 77.
---
 tests/install/basic-1 |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)

diff --git a/tests/install/basic-1 b/tests/install/basic-1
index 5e07bab..3c45c2a 100755
--- a/tests/install/basic-1
+++ b/tests/install/basic-1
@@ -39,28 +39,16 @@ dd2=dd2$EXEEXT

 just_built_dd=$abs_top_builddir/src/$dd

-test -r "$just_built_dd" || \
-  {
-    cat 1>&2 <<EOF
-$0: WARNING!!!
-Your just-built dd binary, $just_built_dd
-is not readable, so skipping the remaining tests in this file.
-EOF
-    exit 77
-  }
+test -r "$just_built_dd" \
+  || warn_ "WARNING!!! Your just-built dd binary, $just_built_dd
+is not readable, so skipping the remaining tests in this file."

 cp "$just_built_dd" . || fail=1
 cp $dd $dd2 || fail=1

-strip $dd2 || \
-  {
-    cat 1>&2 <<EOF
-$0: WARNING!!!
-Your strip command doesn't seem to work, so skipping
-the test of install's --strip option.
-EOF
-    exit 77
-  }
+strip $dd2 \
+  || warn_ "WARNING!!! Your strip command doesn't seem to work,
+so skipping the test of install's --strip option."

 # This test would fail with 3.16s when using versions of strip that
 # don't work on read-only files (the one from binutils works fine).
--
1.7.3.3.38.gc6d05





reply via email to

[Prev in Thread] Current Thread [Next in Thread]