* tests/rm/fail-eperm: Report failure also if rm is terminated by
authorJim Meyering <jim@meyering.net>
Tue, 3 Oct 2006 13:57:26 +0000 (13:57 +0000)
committerJim Meyering <jim@meyering.net>
Tue, 3 Oct 2006 13:57:26 +0000 (13:57 +0000)
a signal.

ChangeLog
tests/rm/fail-eperm

index d970da9e0ecb44925c28cf856ad9639f271b751a..bbb010e69b0845cc96ecc0ef9cfebc4c49972c0f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-10-03  Jim Meyering  <jim@meyering.net>
 
+       * tests/rm/fail-eperm: Report failure also if rm is terminated by
+       a signal.
+
        * src/c99-to-c89.diff: Convert two c99'isms -- one in remove.c
        and one in shred.c -- that were added before coreutils-6.3.
        Reported by Michael Deutschmann.
index 7e146d4bf4572b9c9208b338bd5f6d1500f97173..fe1e73d73f51b82a46a3d3d7c6158b071ecfc74d 100755 (executable)
@@ -103,10 +103,20 @@ foreach my $dir (@dir_list)
            my $line = <RM>;
 
            close RM;
-           my $status = $? >> 8;
-           $status == 1
-             or die "$ME: unexpected exit status from `$cmd';\n"
-               . "  got $status, expected 1\n";
+           my $rc = $?;
+           if (0x80 < $rc)
+             {
+               my $status = $rc >> 8;
+               $status == 1
+                 or die "$ME: unexpected exit status from `$cmd';\n"
+                   . "  got $status, expected 1\n";
+             }
+           else
+             {
+               # Terminated by a signal.
+               my $sig_num = $rc & 0x7F;
+               die "$ME: command `$cmd' died with signal $sig_num\n";
+             }
 
            my $exp = "$rm: cannot remove `$target_file':";
            $line