bug-coreutils
[Top][All Lists]
Advanced

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

Re: FYI: new test for a hard-to-detect race fix, using gdb(!)


From: Jim Meyering
Subject: Re: FYI: new test for a hard-to-detect race fix, using gdb(!)
Date: Fri, 15 Dec 2006 10:52:07 +0100

Thomas Schwinge <address@hidden> wrote:
> Hello!
>
> On Thu, Dec 14, 2006 at 05:21:34PM +0100, Jim Meyering wrote:
>> [...]
>
>> +( gdb --version ) > gdb.out 2>&1
>> +if test ! -s gdb.out; then
>> +  echo "$0: can't run gdb.  Skipping this test." 1>&2
>> +  (exit 77); exit 77
>> +fi
>
> #v+
> $ ( nonexistent ) > out 2>&1
> $ test ! -s out && echo can\'t run || echo continuing
> continuing
> #v-

Thanks for reporting that.  Fixed by the patch below.

> (Similar case again later, I think.)

The latter use of test -s looks ok to me.

> Also, why do you need to run the `gdb' commands from subshells?

It matters only for the first one,
in case the shell prints a diagnostic to stderr.
For the others it wasn't necessary.  Good catch.

FWIW, with gcc, this test is skipped unless you compile without
optimization, so it's not very useful, other than perhaps as a
model.  Note that Paul Eggert's two brand new scripts

  http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=summary

test for nearly the same condition, and don't rely on gdb at all.
----------------

+2006-12-15  Jim Meyering  <address@hidden>
+
+       * tests/cp/open-perm-race: Correct the gdb-existence check.
+       Don't run either subsequent gdb command in a sub-shell.
+       Reported by Thomas Schwinge.
+       * THANKS: bring up to date.
+
 2006-12-14  Paul Eggert  <address@hidden>

        Make sure cp -p isn't too generous with file permissions.
diff --git a/tests/cp/open-perm-race b/tests/cp/open-perm-race
index b09776a..970d7e8 100755
--- a/tests/cp/open-perm-race
+++ b/tests/cp/open-perm-race
@@ -48,16 +48,17 @@ mkdir d && chgrp $group_2 d && chmod g+s,g-w d || 
framework_failure=1
 touch file && chmod go+w file                  || framework_failure=1

 ( gdb --version ) > gdb.out 2>&1
-if test ! -s gdb.out; then
-  echo "$0: can't run gdb.  Skipping this test." 1>&2
-  (exit 77); exit 77
-fi
+case `cat gdb.out` in
+  'GNU gdb'*) ;;
+  *) echo "$0: can't run gdb.  Skipping this test." 1>&2;
+     (exit 77); exit 77;;
+esac

-( gdb -nx --batch-silent               \
+gdb -nx --batch-silent                 \
     --eval-command='break copy_reg'    \
     --eval-command='break open_safer'  \
     --eval-command='quit'              \
-    $abs_top_builddir/src/cp < /dev/null ) > gdb.out 2>&1
+    $abs_top_builddir/src/cp < /dev/null > gdb.out 2>&1
 if test -s gdb.out; then
   cat <<EOF 1>&2
 $0: can't set breakpoints in cp.  Skipping this test.
@@ -80,8 +81,8 @@ if test $framework_failure = 1; then
   (exit 1); exit 1
 fi

-( gdb -nx --batch-silent --command=gdb-cmd --args \
-    $abs_top_builddir/src/cp -p file d ) > gdb.out 2>&1
+gdb -nx --batch-silent --command=gdb-cmd --args \
+    $abs_top_builddir/src/cp -p file d > gdb.out 2>&1
 # Expect no output.

 if test -s gdb.out; then


diff --git a/THANKS b/THANKS
index 575921f..986167d 100644
--- a/THANKS
+++ b/THANKS
@@ -323,11 +323,13 @@ Matt Perry                          address@hidden
 Matt Schalit                        address@hidden
 Matt Swift                          address@hidden
 Matthew Arnison                     address@hidden
+Matthew M. Boedicker                address@hidden
 Matthew Braun                       address@hidden
 Matthew Clarke                      address@hidden
 Matthew S. Levine                   address@hidden
 Matthew Smith                       address@hidden
 Matthew Swift                       address@hidden
+Matthew Woehlke                     address@hidden
 Matthias Urlichs                    address@hidden
 Matti Aarnio                        address@hidden
 Mattias Wadenstein                  address@hidden
@@ -471,6 +473,7 @@ Thomas Hood                         address@hidden
 Thomas Luzat                        address@hidden
 Thomas M.Ott                        address@hidden
 Thomas Quinot                       address@hidden
+Thomas Schwinge                     address@hidden
 Thomas Wolff                        address@hidden
 Tim J. Robbins                      address@hidden
 Tim Mooney                          address@hidden




reply via email to

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