GNU bug report logs -
#15926
RFE: unlink command already uses 'unlink' call; make 'rm' use 'remove' call
Previous Next
Reported by: Linda Walsh <coreutils <at> tlinx.org>
Date: Tue, 19 Nov 2013 11:58:02 UTC
Severity: normal
Tags: notabug, patch
Merged with 15943
Done: Assaf Gordon <assafgordon <at> gmail.com>
Bug is archived. No further changes may be made.
Full log
Message #140 received at 15926 <at> debbugs.gnu.org (full text, mbox):
On 11/21/2013 05:11 PM, Jim Meyering wrote:
> Thanks for doing that.
> I was a little surprised to see an rm diagnostic change, but no
> corresponding change in any test. Perhaps an opportunity for
> increased test coverage?
Sure! ;-)
Have a nice day,
Berny
From 2fa074ebd43cbfea0f6b4bc92a4099a273458562 Mon Sep 17 00:00:00 2001
From: Bernhard Voelker <mail <at> bernhard-voelker.de>
Date: Fri, 22 Nov 2013 15:54:06 +0100
Subject: [PATCH] tests: enhance rm test regarding "." and ".."
Recent commit 2da7009d changed the error diagnostic of rm(1) trying
to remove "." or "..". Enhance the corresponding test.
* tests/rm/r-4.sh: Ensure rm(1) outputs the expected error diagnostic.
---
tests/rm/r-4.sh | 25 ++++++++++++++++++++-----
1 file changed, 20 insertions(+), 5 deletions(-)
diff --git a/tests/rm/r-4.sh b/tests/rm/r-4.sh
index 94702a6..a3ceaf9 100755
--- a/tests/rm/r-4.sh
+++ b/tests/rm/r-4.sh
@@ -22,11 +22,26 @@ print_ver_ rm
mkdir d || framework_failure_
touch d/a || framework_failure_
-rm -fr d/. 2>/dev/null && fail=1
-rm -fr d/./ 2>/dev/null && fail=1
-rm -fr d/.//// 2>/dev/null && fail=1
-rm -fr d/.. 2>/dev/null && fail=1
-rm -fr d/../ 2>/dev/null && fail=1
+# Expected error diagnostic as grep pattern.
+exp="^rm: refusing to remove '\.' or '\.\.' directory: skipping '.*'\$"
+
+rmtest()
+{
+ # Try removing - expecting failure.
+ rm -fr "$1" 2> err && fail=1
+
+ # Ensure the expected error diagnostic is output.
+ grep "$exp" err || { cat err; fail=1; }
+
+ return $fail
+}
+
+rmtest 'd/.' || fail=1
+rmtest 'd/./' || fail=1
+rmtest 'd/.////' || fail=1
+rmtest 'd/..' || fail=1
+rmtest 'd/../' || fail=1
+
# This test is too dangerous -- if there's a bug you're wiped out!
# rm -fr / 2>/dev/null && fail=1
--
1.8.4.2
This bug report was last modified 6 years and 225 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.