OpenBSD CVS

CVS log for src/bin/rm/rm.c


[BACK] Up to [local] / src / bin / rm

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.44 / (download) - annotate - [select for diffs], Tue Aug 16 13:52:41 2022 UTC (21 months, 3 weeks ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, HEAD
Changes since 1.43: +8 -6 lines
Diff to previous 1.43 (colored)

-v option should only act based upon syscall success.  test case is
"rm -rfv nonexistent". problem spotted by Alfred Morgan
ok millert

Revision 1.43 / (download) - annotate - [select for diffs], Sun Oct 24 21:24:21 2021 UTC (2 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

For open/openat, if the flags parameter does not contain O_CREAT, the
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

Revision 1.42 / (download) - annotate - [select for diffs], Tue Jun 27 21:49:47 2017 UTC (6 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6, OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.41: +4 -4 lines
Diff to previous 1.41 (colored)

fix a few lines of unusual length

Revision 1.41 / (download) - annotate - [select for diffs], Tue Jun 27 21:43:46 2017 UTC (6 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.40: +17 -7 lines
Diff to previous 1.40 (colored)

add a -v verbose flag to cp, mv, and rm. useful for monitoring progress,
and present on several other systems. some ok, some less ok.
from Job Snijders

Revision 1.40 / (download) - annotate - [select for diffs], Fri Oct 14 10:51:57 2016 UTC (7 years, 7 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.39: +2 -5 lines
Diff to previous 1.39 (colored)

delete useless setlocale(3);
noticed by Jan Stary <hans at stare dot cz>;
return from main while here;
feedback and OK tb@, OK martijn@

Revision 1.39 / (download) - annotate - [select for diffs], Tue Jun 28 18:00:59 2016 UTC (7 years, 11 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.38: +3 -6 lines
Diff to previous 1.38 (colored)

revert previous. better fix applied to fts_open.

Revision 1.38 / (download) - annotate - [select for diffs], Tue Jun 28 15:20:13 2016 UTC (7 years, 11 months ago) by tedu
Branch: MAIN
Changes since 1.37: +6 -3 lines
Diff to previous 1.37 (colored)

don't report errors for 'rm -rf ""'. report by rkitover.
ok benno deraadt

Revision 1.37 / (download) - annotate - [select for diffs], Fri Apr 15 23:09:57 2016 UTC (8 years, 1 month ago) by tedu
Branch: MAIN
Changes since 1.36: +10 -1 lines
Diff to previous 1.36 (colored)

don't allow removal of /. more robust approach involving stat this time.
posix uses the language "resolves to the root directory" in this case.
ok millert

Revision 1.36 / (download) - annotate - [select for diffs], Mon Feb 1 22:34:19 2016 UTC (8 years, 4 months ago) by gsoares
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.35: +3 -3 lines
Diff to previous 1.35 (colored)

style nit - do not add a space between function name and bracket
from Edgar Pettijohn <edgar at pettijohn-web.com>

fix another similar space in line 127. (pointed out by/OK jung@)

OK tb@ jung@

Revision 1.35 / (download) - annotate - [select for diffs], Tue Nov 17 17:17:24 2015 UTC (8 years, 6 months ago) by deraadt
Branch: MAIN
Changes since 1.34: +3 -3 lines
Diff to previous 1.34 (colored)

Missing "getpw" pledges, these were unnoticed because nobody expects
a user_from_uid(3) call...

Revision 1.34 / (download) - annotate - [select for diffs], Tue Oct 13 04:30:53 2015 UTC (8 years, 8 months ago) by daniel
Branch: MAIN
Changes since 1.33: +11 -21 lines
Diff to previous 1.33 (colored)

revert previous. changes the behaviour of:
rm -f ""

Revision 1.33 / (download) - annotate - [select for diffs], Sun Oct 11 03:08:46 2015 UTC (8 years, 8 months ago) by daniel
Branch: MAIN
Changes since 1.32: +22 -12 lines
Diff to previous 1.32 (colored)

Don't allow "rm -rf /"

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@

Revision 1.32 / (download) - annotate - [select for diffs], Fri Oct 9 01:37:06 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.31: +5 -5 lines
Diff to previous 1.31 (colored)

Change all tame callers to namechange to pledge(2).

Revision 1.31 / (download) - annotate - [select for diffs], Thu Oct 8 13:17:06 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.30: +9 -1 lines
Diff to previous 1.30 (colored)

the -P flag overwrites files, so it needs tame "stdio rpath wpath cpath".
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...

Revision 1.30 / (download) - annotate - [select for diffs], Fri Jan 16 06:39:32 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.29: +5 -3 lines
Diff to previous 1.29 (colored)

Replace <sys/param.h> with <limits.h> and other less dirty headers where
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)

Revision 1.29 / (download) - annotate - [select for diffs], Wed May 21 06:23:02 2014 UTC (10 years ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6
Changes since 1.28: +2 -2 lines
Diff to previous 1.28 (colored)

Use errc/warnc to simplify code.

ok jca@ krw@

Revision 1.28 / (download) - annotate - [select for diffs], Tue Apr 23 18:41:08 2013 UTC (11 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

handle large ino_t

Revision 1.27 / (download) - annotate - [select for diffs], Wed Sep 5 19:49:08 2012 UTC (11 years, 9 months ago) by naddy
Branch: MAIN
CVS Tags: OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.26: +2 -2 lines
Diff to previous 1.26 (colored)

overwrite with random stream; a repeating chunk of random data isn't
random at all
ok tedu@

Revision 1.26 / (download) - annotate - [select for diffs], Tue Sep 4 22:22:50 2012 UTC (11 years, 9 months ago) by tedu
Branch: MAIN
Changes since 1.25: +7 -11 lines
Diff to previous 1.25 (colored)

one random overwrite is sufficient, after some discussion on tech

Revision 1.25 / (download) - annotate - [select for diffs], Mon Jun 18 01:03:05 2012 UTC (11 years, 11 months ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2
Changes since 1.24: +7 -3 lines
Diff to previous 1.24 (colored)

Polish the rm -rP turd: if the fts_* routines have lstat()'ed the
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@

Revision 1.24 / (download) - annotate - [select for diffs], Mon Jun 18 00:33:47 2012 UTC (11 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.23: +10 -3 lines
Diff to previous 1.23 (colored)

Fix potential symlink race condition in "rm -P" by adding a check
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@

Revision 1.23 / (download) - annotate - [select for diffs], Tue Oct 27 23:59:22 2009 UTC (14 years, 7 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7
Changes since 1.22: +1 -15 lines
Diff to previous 1.22 (colored)

rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
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

Revision 1.22 / (download) - annotate - [select for diffs], Tue Jun 10 17:14:16 2008 UTC (16 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.21: +4 -3 lines
Diff to previous 1.21 (colored)

do not ask the "override?" question if access fails for other resaons than
EACCES. From Tim van der Molen; ok millert@ ray@

Revision 1.21 / (download) - annotate - [select for diffs], Wed Jun 6 00:08:57 2007 UTC (17 years ago) by ray
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.20: +4 -6 lines
Diff to previous 1.20 (colored)

Unlink files with multiple links when -P flag is specified instead
of just warning and skipping the file.

OK millert and jmc.

Revision 1.20 / (download) - annotate - [select for diffs], Tue Mar 21 20:28:52 2006 UTC (18 years, 2 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.19: +3 -2 lines
Diff to previous 1.19 (colored)

Call fts_close() when done; from NetBSD's Coverity scan; ok millert@
jaredy@

Revision 1.19 / (download) - annotate - [select for diffs], Tue Aug 30 21:00:05 2005 UTC (18 years, 9 months ago) by jmc
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8
Changes since 1.18: +3 -3 lines
Diff to previous 1.18 (colored)

remove -W from synopsis;
from nikolay kalev; ok deraadt@

Revision 1.18 / (download) - annotate - [select for diffs], Tue Jun 14 19:15:35 2005 UTC (19 years ago) by millert
Branch: MAIN
Changes since 1.17: +8 -29 lines
Diff to previous 1.17 (colored)

whiteouts are gone

Revision 1.17 / (download) - annotate - [select for diffs], Wed Jun 2 06:58:54 2004 UTC (20 years ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_7_BASE, OPENBSD_3_7, OPENBSD_3_6_BASE, OPENBSD_3_6
Changes since 1.16: +26 -22 lines
Diff to previous 1.16 (colored)

outline PASS; use size_t for sizes; better error message.
ok millert@ tedu@

Revision 1.16 / (download) - annotate - [select for diffs], Mon May 31 17:18:59 2004 UTC (20 years ago) by tedu
Branch: MAIN
Changes since 1.15: +22 -15 lines
Diff to previous 1.15 (colored)

better error handling with -P option.  from freebsd (bde@)
ok beck@ otto@

Revision 1.15 / (download) - annotate - [select for diffs], Mon Jun 2 23:32:09 2003 UTC (21 years ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.14: +3 -7 lines
Diff to previous 1.14 (colored)

Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.

Revision 1.14 / (download) - annotate - [select for diffs], Sat Jan 11 11:03:53 2003 UTC (21 years, 5 months ago) by hugh
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.13: +7 -2 lines
Diff to previous 1.13 (colored)

Attempt to do something reasonable when overwrite mode is combined
with hard links, and document it. In consultation with dynamo and
approved by millert.

Revision 1.13 / (download) - annotate - [select for diffs], Thu Jul 4 04:26:40 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.12: +9 -18 lines
Diff to previous 1.12 (colored)

ansi

Revision 1.12 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:07 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.11: +8 -8 lines
Diff to previous 1.11 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.11 / (download) - annotate - [select for diffs], Thu Sep 6 13:29:08 2001 UTC (22 years, 9 months ago) by mpech
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.10: +5 -4 lines
Diff to previous 1.10 (colored)

o) __progname aria;

millert@ ok.

Revision 1.10 / (download) - annotate - [select for diffs], Fri Jun 8 13:40:20 2001 UTC (23 years ago) by millert
Branch: MAIN
Changes since 1.9: +3 -3 lines
Diff to previous 1.9 (colored)

Don't give usage warning for 'rm -f' with no files to remove to be
consistent with other implementations.

Revision 1.9 / (download) - annotate - [select for diffs], Sat Jan 2 08:38:58 1999 UTC (25 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8, OPENBSD_2_7_BASE, OPENBSD_2_7, OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5
Changes since 1.8: +3 -3 lines
Diff to previous 1.8 (colored)

indent

Revision 1.8 / (download) - annotate - [select for diffs], Sat Jan 2 08:30:27 1999 UTC (25 years, 5 months ago) by weingart
Branch: MAIN
Changes since 1.7: +5 -4 lines
Diff to previous 1.7 (colored)

Fix possible free() of uninitialized pointer.

Revision 1.7 / (download) - annotate - [select for diffs], Wed Nov 4 21:52:41 1998 UTC (25 years, 7 months ago) by aaron
Branch: MAIN
Changes since 1.6: +18 -7 lines
Diff to previous 1.6 (colored)

use optimal xfer block size in rm_overwrite() instead of assuming 8192

Revision 1.6 / (download) - annotate - [select for diffs], Mon Sep 1 18:30:26 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3, OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

i am bored enough to fix terminal space/tab uglies

Revision 1.5 / (download) - annotate - [select for diffs], Wed Jun 18 19:08:44 1997 UTC (26 years, 11 months ago) by kstailey
Branch: MAIN
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

(foo *)NULL -> NULL

Revision 1.4 / (download) - annotate - [select for diffs], Sat Dec 14 12:18:15 1996 UTC (27 years, 6 months ago) by mickey
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.3: +10 -6 lines
Diff to previous 1.3 (colored)

-Wall'ing.

Revision 1.3 / (download) - annotate - [select for diffs], Fri Aug 2 12:41:05 1996 UTC (27 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0
Changes since 1.2: +2 -3 lines
Diff to previous 1.2 (colored)

zap getopt() case of -?, come on, it is the default!

Revision 1.2 / (download) - annotate - [select for diffs], Sun Jun 23 14:20:59 1996 UTC (27 years, 11 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +2 -1 lines
Diff to previous 1.1 (colored)

update rcsid

Revision 1.1.1.1 / (download) - annotate - [select for diffs] (vendor branch), Wed Oct 18 08:37:20 1995 UTC (28 years, 8 months ago) by deraadt
CVS Tags: netbsd_1_1
Changes since 1.1: +0 -0 lines
Diff to previous 1.1 (colored)

initial import of NetBSD tree

Revision 1.1 / (download) - annotate - [select for diffs], Wed Oct 18 08:37:20 1995 UTC (28 years, 8 months ago) by deraadt
Branch: MAIN

Initial revision

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.