summaryrefslogtreecommitdiff
path: root/bin/rm
AgeCommit message (Collapse)Author
2022-08-16-v option should only act based upon syscall success. test case isTheo de Raadt
"rm -rfv nonexistent". problem spotted by Alfred Morgan ok millert
2021-10-24For open/openat, if the flags parameter does not contain O_CREAT, theTheo de Raadt
3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
2019-09-02More correction of section 3 layout. directory->opendir, fts->fts_open,Theo de Raadt
getcap->cgetent. pwcache->user_from_uid. And then repair references. ok jmc
2018-03-31Clarify that -P only *attempts* overwriting, which may not succeed;Ingo Schwarze
requested by deraadt@ after repeated questions on bugs@ and tech@, e.g. from Gregoire Jadi and Craig Skinner.
2017-06-28add -v to SYNOPSIS and STANDARDS;Jason McIntyre
2017-06-27fix a few lines of unusual lengthTed Unangst
2017-06-27add a -v verbose flag to cp, mv, and rm. useful for monitoring progress,Ted Unangst
and present on several other systems. some ok, some less ok. from Job Snijders
2016-10-14delete useless setlocale(3);Ingo Schwarze
noticed by Jan Stary <hans at stare dot cz>; return from main while here; feedback and OK tb@, OK martijn@
2016-06-28revert previous. better fix applied to fts_open.Ted Unangst
2016-06-28don't report errors for 'rm -rf ""'. report by rkitover.Ted Unangst
ok benno deraadt
2016-04-15don't allow removal of /. more robust approach involving stat this time.Ted Unangst
posix uses the language "resolves to the root directory" in this case. ok millert
2016-02-01style nit - do not add a space between function name and bracketGleydson Soares
from Edgar Pettijohn <edgar at pettijohn-web.com> fix another similar space in line 127. (pointed out by/OK jung@) OK tb@ jung@
2015-11-17Missing "getpw" pledges, these were unnoticed because nobody expectsTheo de Raadt
a user_from_uid(3) call...
2015-10-13revert previous. changes the behaviour of:Daniel Dickman
rm -f ""
2015-10-11Don't allow "rm -rf /"Daniel Dickman
Patch from Theo Buehler who was inspired by watching Bryan Cantrill in BSD Now 103. Minor tweak from me to turn the complained variables into flags instead of counters. "i think it's ok" tedu@ "this isn't 1980 anymore" deraadt@ ok millert@
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-08the -P flag overwrites files, so it needs tame "stdio rpath wpath cpath".Theo de Raadt
the remaining code paths can use tame "stdio rpath cpath". One again, the "cpath" request says a path-based system call will be used to "change" filesystem pathname layout, for instance any of O_CREAT, symlink, rename, unlink...
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-05-25- it seems our notes that posix require rm to behave like rmdir for directoriesJason McIntyre
is plain wrong: remove it. the note in posix spec is misleading, to be fair - most of the rest of notes in STANDARDS are really historical notes (admittedly caused by the standards i guess) so move them into HISTORY. debatable, yes, but leaves STANDARDS consistent. HISTORY is a hodge podge anyway, by neccesity. - while there, fix a sentence splice in BUGS sobrado agrees with the removal of the rmdir note; millert oks the diff
2014-05-21Use errc/warnc to simplify code.Philip Guenther
ok jca@ krw@
2013-04-23handle large ino_tTheo de Raadt
2012-09-05overwrite with random stream; a repeating chunk of random data isn'tChristian Weisgerber
random at all ok tedu@
2012-09-05use "MS-DOS", for consistency with other docs;Jason McIntyre
2012-09-04one random overwrite is sufficient, after some discussion on techTed Unangst
2012-06-18Polish the rm -rP turd: if the fts_* routines have lstat()'ed thePhilip Guenthe
directory entry then use the struct stat from that instead of doing it again, and skip the rm_overwrite() call if fts_read() indicated that the entry couldn't be a regular file. ok millert@
2012-06-18Fix potential symlink race condition in "rm -P" by adding a checkTodd C. Miller
that the file we have opened is the one we expected. Also open in non-blocking mode to avoid a potential hang with FIFOs. Reported by Radoslaw A. Zarzynski. Fix adapted from NetBSD. OK guenther@
2010-10-04- rearrange STANDARDS slightly to read betterJason McIntyre
- remove a stray .Pp
2010-09-03add an EXIT STATUS section for /bin;Jason McIntyre
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2009-02-08bump the posix reference in STANDARDS to IEEE Std 1003.1-2008, with a fewJason McIntyre
updates to follow;
2008-06-10do not ask the "override?" question if access fails for other resaons thanOtto Moerbeek
EACCES. From Tim van der Molen; ok millert@ ray@
2007-06-06Unlink files with multiple links when -P flag is specified insteadRay Lai
of just warning and skipping the file. OK millert and jmc.
2007-05-31convert to new .Dd format;Jason McIntyre
2007-05-29- consistent STANDARDS blurbJason McIntyre
- note which options are extensions to POSIX discussed w/ deraadt otto millert
2007-05-19simplify the description of -R; from Jeffrey 'jf' LimJason McIntyre
2007-02-16change [-f | -i] to [-fi]: although technically not as correct, it isJason McIntyre
simpler (clearer), and matches cp(1), mv(1), posix, and even usage();
2006-09-21reword a sentence so we are not discussing lfs; help from pedroJason McIntyre
2006-03-21Call fts_close() when done; from NetBSD's Coverity scan; ok millert@Otto Moerbeek
jaredy@
2005-08-30remove -W from synopsis;Jason McIntyre
from nikolay kalev; ok deraadt@
2005-06-14whiteouts are goneTodd C. Miller
2004-06-02outline PASS; use size_t for sizes; better error message.Otto Moerbeek
ok millert@ tedu@
2004-05-31better error handling with -P option. from freebsd (bde@)Ted Unangst
ok beck@ otto@
2003-11-21kill comma splice; from Jared Yanovich;Jason McIntyre
also, put example description before the example, and indent example;
2003-06-02Remove the advertising clause in the UCB license which BerkeleyTodd C. Miller
rescinded 22 July 1999. Proofed by myself and Theo.
2003-05-30merge COMPATIBILITY into STANDARDS;Jason McIntyre
2003-03-12more .LiTheo de Raadt
2003-01-11Attempt to do something reasonable when overwrite mode is combinedHugh Graham
with hard links, and document it. In consultation with dynamo and approved by millert.
2002-09-18fix Xr refs; frisco@blackant.netTheo de Raadt
2002-07-04ansiTheo de Raadt
2002-02-16Part one of userland __P removal. Done with a simple regexp with some minor ↵Todd C. Miller
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.