bin/188008: [patch] Better(?) rm -If behavior (and other combination between -I, -i, and -f)
Edho Arief
edho at live.jp
Thu Mar 27 04:30:01 UTC 2014
>Number: 188008
>Category: bin
>Synopsis: [patch] Better(?) rm -If behavior (and other combination between -I, -i, and -f)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Quarter:
>Keywords:
>Date-Required:
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Thu Mar 27 04:30:00 UTC 2014
>Closed-Date:
>Last-Modified:
>Originator: Edho Arief
>Release: 10.0
>Organization:
>Environment:
FreeBSD izumi.myconan.net 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 22:34:59 UTC 2014 root at snap.freebsd.org:/usr/obj/usr/src/sys/GENERIC amd64
>Description:
Currently, -I flag is completely unrelated with -f and -i flag despite having similar purpose (interactivity). It's especially weird when using -If (expected: no prompt).
This patch changes the behavior so (-f|-i|-I) overrides each other flags (currently only between -i and -f).
Sorry if duplicate.
>How-To-Repeat:
>Fix:
Patch attached with submission follows:
Index: rm.1
===================================================================
--- rm.1 (revision 263791)
+++ rm.1 (working copy)
@@ -68,6 +68,8 @@
.Fl f
option overrides any previous
.Fl i
+and
+.Fl I
options.
.It Fl i
Request confirmation before attempting to remove each file, regardless of
@@ -77,6 +79,8 @@
.Fl i
option overrides any previous
.Fl f
+and
+.Fl I
options.
.It Fl I
Request confirmation once if more than three files are being removed or if a
@@ -84,6 +88,13 @@
This is a far less intrusive option than
.Fl i
yet provides almost the same level of protection against mistakes.
+The
+.Fl I
+option overrides any previous
+.Fl f
+and
+.Fl i
+options.
.It Fl P
Overwrite regular files before deleting them.
Files are overwritten three times, first with the byte pattern 0xff,
Index: rm.c
===================================================================
--- rm.c (revision 263791)
+++ rm.c (working copy)
@@ -115,12 +115,16 @@
case 'f':
fflag = 1;
iflag = 0;
+ Iflag = 0;
break;
case 'i':
fflag = 0;
iflag = 1;
+ Iflag = 0;
break;
case 'I':
+ fflag = 0;
+ iflag = 0;
Iflag = 1;
break;
case 'P':
@@ -629,7 +633,7 @@
{
(void)fprintf(stderr, "%s\n%s\n",
- "usage: rm [-f | -i] [-dIPRrvWx] file ...",
+ "usage: rm [-f | -i | -I] [-dPRrvWx] file ...",
" unlink file");
exit(EX_USAGE);
}
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-bugs
mailing list