History log of /freebsd-current/bin/rm/rm.1
Revision Date Author Comments
# 90aea514 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

bin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# b2c76c41 16-Aug-2023 Warner Losh <imp@FreeBSD.org>

Remove $FreeBSD$: one-line nroff pattern

Remove /^\.\\"\s*\$FreeBSD\$$\n/


# 900c4ed3 10-Nov-2018 Conrad Meyer <cem@FreeBSD.org>

rm(1): Formalize non-functional status of -P flag

-P was introduced in 4.4BSD-Lite2 around 1994. It overwrote file contents
with a pass of 0xff, 0x00, then 0xff, in a low effort attempt to "really
delete" files.

It has no user-visible effect; at the end of the day, the file is unlinked via
the filesystem. Furthermore, the utility of overwriting files with patterned
data is extremely limited due to caveats at every layer of the stack[0] and
therefore mostly futile. At the least, three passes is likely wasteful on
modern hardware[1]. It could also be seen as a violation of the "Unix
Philosophy" to do one thing per tiny, composable program.

Since 1994, FreeBSD has left it alone; OpenBSD replaced it with a single
pass of arc4random(3) output in 2012[2]; and NetBSD implemented partial, but
explicitly incomplete support for U.S. DoD 5220.22-M, "National Industrial
Security Program Operating Manual" in 2004[3].

NetBSD's enhanced comment above rm_overwrite makes a strong case for removing
the flag entirely:

> This is an expensive way to keep people from recovering files from your
> non-snapshotted FFS filesystems using fsdb(8). Really. No more.
>
> It is impossible to actually conform to the exact procedure given in
> [NISPOM] if one is overwriting a file, not an entire disk, because the
> procedure requires examination and comparison of the disk's defect lists.
> Any program that claims to securely erase *files* while conforming to the
> standard, then, is not correct.
>
> Furthermore, the presence of track caches, disk and controller write
> caches, and so forth make it extremely difficult to ensure that data have
> actually been written to the disk, particularly when one tries to repeatedly
> overwrite the same sectors in quick succession. We call fsync(), but
> controllers with nonvolatile cache, as well as IDE disks that just plain lie
> about the stable storage of data, will defeat this.
>
> [NISPOM] requires physical media destruction, rather than any technique of
> the sort attempted here, for secret data.

As a first step towards evental removal, make it a placebo. It's not like
it was serving any security function. It is not defined in or mentioned by
POSIX.

If you are security conscious and need to erase your files, use a
woodchipper. At a minimum, the entire disk needs to be overwritten, not
just one file.

[0]: https://www.ru.nl/publish/pages/909282/draft-paper.pdf
[1]: https://commons.erau.edu/cgi/viewcontent.cgi?article=1131&context=jdfsl
[2]: https://github.com/openbsd/src/commit/7c5c57ba81b5fe8ff2d4899ff643af18c
[3]: https://github.com/NetBSD/src/commit/fdf0a7a25e59af958fca1e2159921562cd

Reviewed by: markj, Daniel O'Connor <darius AT dons.net.au> (previous version)
Differential Revision: https://reviews.freebsd.org/D17906


# 19b4f0dc 12-Sep-2018 Ed Maste <emaste@FreeBSD.org>

Fix unlink(1) for files starting with -

Restore the original behavior of unlink(1), passing the provided filename
directly to unlink(2), handling the first argument being "--" correctly.

This fixes "unlink -foo", broken in r97533.

PR: 228448
Submitted by: Brennan Vincent <brennan@umanwizard.com> (original version)
Submitted by: Yuri Pankov
Reported by: Brennan Vincent <brennan@umanwizard.com>
Reviewed by: emaste, kevans, vangyzen, 0mp
Approved by: re (delphij)
Differential Revision: https://reviews.freebsd.org/D17132


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 8e5c71e2 06-Nov-2015 Baptiste Daroussin <bapt@FreeBSD.org>

Protecting against rm -rf / is now POSIXLY_CORRECT per posix 1003.1
edition 2013. No need anymore to disable the protection if one set
the POXILY_CORRECT environment variable.

Reviewed by: imp
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D4092


# cf20d404 15-Jun-2014 Joel Dahl <joel@FreeBSD.org>

mdoc: remove superfluous paragraph macros.


# d4319e74 26-Apr-2013 Eitan Adler <eadler@FreeBSD.org>

Add -x option to avoid crossing mount points when removing a hierarchy.

Discussed on: -hackers
Inspired by: DragonflyBSD
MFC After: 1 week


# e9e3a1ab 15-Mar-2013 Joel Dahl <joel@FreeBSD.org>

Add a few examples.

Obtained from: OpenBSD


# ec1e2365 31-Oct-2010 Ulrich Spörlein <uqs@FreeBSD.org>

Fix typo and grammar nit

Submitted by: arundel
MFC after: 7 days (or when the bikeshed has abated)


# c2c9a540 31-Oct-2010 Ulrich Spörlein <uqs@FreeBSD.org>

Elaborate some more on the non-security implications of using -P

Submitted by: delphij
Discussion at: svn-src-all


# 1f9d1741 27-Oct-2010 Dag-Erling Smørgrav <des@FreeBSD.org>

Language cleanup.


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# a3800f8f 08-Oct-2010 Ulrich Spörlein <uqs@FreeBSD.org>

rm(1): clarify that -P works only when blocks are updated in-place

Suggested by: pjd, ivoras, arundel


# 873ddec3 04-Oct-2010 Xin LI <delphij@FreeBSD.org>

Clarify the combination effect of -P and -f to make it clear.

Submitted by: arundel
MFC after: 2 weeks


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# 88b0915e 26-Dec-2006 Ruslan Ermilov <ru@FreeBSD.org>

Give a hint to the reader as to what the "whiteout" actually means.


# ca3f81d8 26-Dec-2006 Ruslan Ermilov <ru@FreeBSD.org>

Fix markup, add the EXIT STATUS section.


# 86da4a5e 30-Oct-2006 Xin LI <delphij@FreeBSD.org>

Correct a security issue introduced in previous commit:
instead of removing the file and issue a warning about
the removal, do not do any operation at all in case -P
is specified when the dinode has hard links.

With -f and -P specified together, we assume that the
user wants rm to overwrite the contents of the file
and remove it (destroy the contents of file but leave
its hard links as is).

The reason of doing it this way is that, in case where
a hard link is created by a malicious user (currently
this is permitted even if the user has no access to the
file). Losing the link can potentially mean that the
actual owner would lose control completely to the user
who wants to obtain access in a future day.

Discussed with: Peter Jermey


# 0b6f55b7 29-Oct-2006 Xin LI <delphij@FreeBSD.org>

Be more reasonable when overwrite mode is specified while there
is hard links. Overwritting when links > 1 would cause data
loss, which is usually undesired.

Inspired by: discussion on -hackers@
Suggested by: elessar at bsdforen de
Obtained from: OpenBSD


# 8af11131 16-Nov-2005 Ruslan Ermilov <ru@FreeBSD.org>

-mdoc sweep.


# 0b5efa8a 29-Sep-2005 Doug Barton <dougb@FreeBSD.org>

Give .Dd a tummy rub, forgotten on my last commit.


# a5f62950 29-Sep-2005 Doug Barton <dougb@FreeBSD.org>

Handle the case where the -P flag is specified for a read-only file
earlier, and more gracefully. Previously, this combination would be
ignored early in the code where permissions are tested and fail later
with a very unhelpful "permission denied" error.

Instead, test for this flag in the same block that generates the
"override?" messages for read-only files, but instead of trying
to guess what the user has in mind, generate an error and exit.

Update the man page to reflect this new behavior.

Not objected to by: freebsd-hackers@


# a89237ae 09-Feb-2005 Ruslan Ermilov <ru@FreeBSD.org>

Sync program's usage() with manpage's SYNOPSIS.


# 6fca4c7c 16-Jan-2005 Ruslan Ermilov <ru@FreeBSD.org>

Add the new standard EXIT STATUS section where appropriate.
Sort standard sections in the (documented) preferred order.


# 9ddb49cb 10-Jan-2005 Warner Losh <imp@FreeBSD.org>

/*- or .\"- or #- to begin license clauses.


# 164d3f0b 01-Nov-2004 Xin LI <delphij@FreeBSD.org>

Correct a typo and make the documentation more mdoc(7) complaint.

Pointed out by: dd
Approved by: murray (mentor)


# 24c0f738 28-Oct-2004 Xin LI <delphij@FreeBSD.org>

Add -I, an option that asks for confirmation once if recursively
removing directories or if more than 3 files are listed in the
command line.

This feature is intended to provide a safe net but not being too
annoying like having "rm -i" for every deleting operations, and
is generally good for both newbies and power users, preventing
them from being so easily run into ``rm -rf /'', ``rm -rf *''
and so forth.

Originally implemented by Matthew Dillon for DragonFly, plus
some improvements done by various DragonFly contributors.

Approved by: murray (mentor; the original dillon's version)
Discussed with: des
Obtained from: DragonFly's bin/rm/
rm.c rev. 1.4 - 1.8
rm.1 rev. 1.3 - 1.4
MFC After: 1 month


# 3a667daf 04-Oct-2004 Dag-Erling Smørgrav <des@FreeBSD.org>

Markup fixes.

Pointed out by: ru


# 68ef5f71 04-Oct-2004 Dag-Erling Smørgrav <des@FreeBSD.org>

Find out how flame-proof my underwear really is.


# eccea571 02-Jul-2004 Ruslan Ermilov <ru@FreeBSD.org>

Mechanically kill hard sentence breaks.


# 6195fb41 06-Apr-2004 Mark Murray <markm@FreeBSD.org>

Remove clause 3 from the UCB licenses.

OK'ed by: imp, core


# 02b91105 04-Feb-2003 Tom Rhodes <trhodes@FreeBSD.org>

Cross ref chflags(1).

Suggested by: Craig Carey <research@ijs.co.nz) on -doc.


# 7d971bbf 21-Aug-2002 Tom Rhodes <trhodes@FreeBSD.org>

s/filesystem/file system/ as discussed on -developers


# ebd43244 15-May-2002 Tom Rhodes <trhodes@FreeBSD.org>

Consistancy check s/file system/filesystem/

Reviewed by: brian


# 05519408 01-Mar-2002 Doug White <dwhite@FreeBSD.org>

Update STANDARDS section on rm(1) to reflect current conformance.

PR: 35471


# 7ebcc426 15-Jul-2001 Dima Dorfman <dd@FreeBSD.org>

Remove whitespace at EOL.


# 47dec781 13-Feb-2001 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: use the default ``file ...'' feature of the .Ar macro.


# 12e720d7 15-Dec-2000 Ruslan Ermilov <ru@FreeBSD.org>

Prepare for mdoc(7)NG.


# be8b1497 20-Nov-2000 Ruslan Ermilov <ru@FreeBSD.org>

mdoc(7) police: use the new features of the Nm macro.


# 9a73cc73 21-Dec-1999 Sheldon Hearn <sheldonh@FreeBSD.org>

Fix cut'n'paste niggles in previous commit.


# d71e172a 20-Dec-1999 Sheldon Hearn <sheldonh@FreeBSD.org>

Add link(1) and unlink(1) as special cases of ln(1) and rm(1)
respectively, in accordance with SUSv2.

This differs from the approach taken in NetBSD, but provides
less obscure error messages in at least the EISDIR case and
does not take up additional disk space for new binaries.

PR: 13071
PR: 13074
Requested by: James Howard <howardjp@wam.umd.edu>


# 777d1f82 03-Sep-1999 Michael Haro <mharo@FreeBSD.org>

brucify, `v' before `W', mention -v is non-standard in manpage and
make code slightly easier to read

Reviewed by: obrien


# bfbdd545 28-Aug-1999 Michael Haro <mharo@FreeBSD.org>

add verbose flag
exit(1) --> exit(EX_USAGE)

Reviewed by: obrien


# 2a456239 27-Aug-1999 Peter Wemm <peter@FreeBSD.org>

$Id$ -> $FreeBSD$


# f80db2b8 27-May-1999 Kris Kennaway <kris@FreeBSD.org>

Use .Dq instead of ``'' in manpage
Use optimal blocksize for rm -P, instead of always using 8192-byte blocks
to overwrite the file.

Obtained from: OpenBSD


# bd98a815 28-Jan-1999 Garrett Wollman <wollman@FreeBSD.org>

Fix synopsis to match 1003.2. Add text describing the way in which
our implementation does not meet 1003.2 (rather than the now outdated
``is expected to comply' language).


# f43e9d22 18-May-1998 Philippe Charnier <charnier@FreeBSD.org>

.Nm rm -> .Nm.


# 395f4bf0 07-Aug-1997 Steve Price <steve@FreeBSD.org>

Remove remaining Lite1 stuff from the man page and uphold the
precedence in changing sccsid to rcsid as set by Phillippe
Charnier in his previous 100 or so commits.

pointed out by: Bruce Evans <bde@zeta.org.au>


# c4694019 01-Jul-1997 Bruce Evans <bde@FreeBSD.org>

Import Lite2's src/bin. All files in src/bin are off the vendor branch,
so this doesn't change the active versions.


# e9dff556 29-Apr-1997 Doug Rabson <dfr@FreeBSD.org>

Enable whiteout code since we now have the lite2 support for them.


# fa10160c 08-Apr-1997 Mike Pritchard <mpp@FreeBSD.org>

Provide examples of how to remove file names that begin with
a dash in non-getopt implementations. E.g.:
rm /home/mpp/-filename
rm ./-filename

Requested by: bde


# fe83da2e 08-Apr-1997 Mike Pritchard <mpp@FreeBSD.org>

Improve the wording in the NOTES section. Closes PR# 3223.


# b97fa2ef 22-Feb-1997 Peter Wemm <peter@FreeBSD.org>

Revert $FreeBSD$ to $Id$


# 1130b656 14-Jan-1997 Jordan K. Hubbard <jkh@FreeBSD.org>

Make the long-awaited change from $Id$ to $FreeBSD$

This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore. This update would have been
insane otherwise.


# 1f64b5c9 13-Dec-1996 Steve Price <steve@FreeBSD.org>

Merge Lite2 mods, and -Wall cleaning. Unimplemented undelete(2)
cruft is protected by a #ifdef (BSD4_4_LITE) that should be
removed when this is supported by the kernel.


# b8923d4c 29-Aug-1996 Wolfram Schneider <wosch@FreeBSD.org>

[HISTORY] command appeared in Version 1 AT&T UNIX
Obtained from: A Quarter Century of UNIX, Peter H. Salus, page 41


# b0205aff 07-Mar-1996 Wolfram Schneider <wosch@FreeBSD.org>

fix usage string
respond `Y' is equal to `y'

Add a note how to delete file name with beginning `-'


# 89730b29 23-Sep-1994 David Greenman <dg@FreeBSD.org>

Added $Id$


# 4b88c807 26-May-1994 Rodney W. Grimes <rgrimes@FreeBSD.org>

BSD 4.4 Lite bin Sources