[Bug 294791] rm(1) should prompt the user recursively for files and directories if '-ir' is given
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 294791] rm(1) should prompt the user recursively for files and directories if '-ir' is given"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 294791] rm(1) should prompt the user recursively for files and directories if '-ir' is given"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 294791] rm(1) should prompt the user recursively for files and directories if '-ir' is given"
- Reply: bugzilla-noreply_a_freebsd.org: "[Bug 294791] rm(1) should prompt the user recursively for files and directories if '-ir' is given"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 25 Apr 2026 20:42:29 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=294791
Bug ID: 294791
Summary: rm(1) should prompt the user recursively for files and
directories if '-ir' is given
Product: Base System
Version: CURRENT
Hardware: Any
OS: Any
Status: New
Severity: Affects Many People
Priority: ---
Component: bin
Assignee: bugs@FreeBSD.org
Reporter: jschauma@netmeister.org
Created attachment 270117
--> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=270117&action=edit
patch to bin/rm.c
rm(1) says for the '-R' flag (which is the same as '-r'):
"If the -i option is specified, the user is prompted for confirmation before
each directory's contents are processed (as well as before the attempt is
made to remove the directory)."
But it's actually a bit misleading and only prompts for _removal_ of a
directory, not for processing the contents:
$ mkdir -p dir/subdir/subsub dir/subdir2
$ touch dir/file dir/subdir/file dir/subdir/subsub/file dir/subdir2/file
$ rm -ir dir
remove dir? n
$
On macOS, rm(1) behaves like this:
$ rm -ir dir
examine files in directory dir? y
examine files in directory dir/subdir2? y
remove dir/subdir2/file? n
examine files in directory dir/subdir2/subsub? n
remove dir/subdir2?
Similarly on Linux.
I've just committed a change in NetBSD that matches this behavior:
https://cvsweb.netbsd.org/bsdweb.cgi/src/bin/rm/rm.c.diff?r1=1.57;r2=1.55
For FreeBSD, this ought to look as the attached diff shows.
--
You are receiving this mail because:
You are the assignee for the bug.