#
1.53 |
|
28-Jun-2019 |
deraadt |
When system calls indicate an error they return -1, not some arbitrary value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
|
Revision tags: OPENBSD_6_5_BASE
|
#
1.52 |
|
28-Jan-2019 |
jca |
Implement cp -a ("archive" mode)
Not standard, but supported at least by GNU cp, IllumOS, NetBSD, FreeBSD, DragonflyBSD. No need to be gratuitously different. This should also allow us to drop patches in ~10 ports.
Based on an initial diff by benno@ with input from sthen@ and jmc@ ok benno@ danj@ sthen@ martijn@ deraadt@
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.51 |
|
07-Sep-2018 |
martijn |
Revert earlier revert. It turned out the issue was a badly applied diff on stsp@'s machine.
OK stsp@
|
#
1.50 |
|
07-Sep-2018 |
stsp |
Backout recent cp(1) changes; they broke texlive's mktexlsr(1)
|
#
1.49 |
|
07-Sep-2018 |
martijn |
Rename dne in copy_file to exists to be more consistent with the other copy_* functions.
OK stsp@
|
#
1.48 |
|
07-Sep-2018 |
martijn |
Also verify a overwrite for the copy of a fifo, link and device node.
OK stsp@
|
#
1.47 |
|
07-Sep-2018 |
martijn |
The combination of -v and -i and the deny of a copy would cause the copy still to be printed. This fixes that edge-case.
OK stsp@
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
|
#
1.46 |
|
27-Jun-2017 |
tedu |
fix a few lines of unusual length
|
#
1.45 |
|
27-Jun-2017 |
tedu |
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 tags: OPENBSD_6_1_BASE
|
#
1.44 |
|
14-Oct-2016 |
schwarze |
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 tags: OPENBSD_6_0_BASE
|
#
1.43 |
|
07-Mar-2016 |
tb |
Make cp -i behave as mv -i or rm -i, independently of whether stdin is a tty or not. From Timo Buhrmester.
ok jca@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.42 |
|
09-Oct-2015 |
deraadt |
Change all tame callers to namechange to pledge(2).
|
#
1.41 |
|
08-Oct-2015 |
deraadt |
Try again. Both -R and -p prevent use of tame, but other cases can use it.
|
#
1.40 |
|
08-Oct-2015 |
deraadt |
ah, fchflags. We will come back to this issue later
|
#
1.39 |
|
07-Oct-2015 |
deraadt |
We cannot tame if -R is specified, because mknod and mkfifo may be called. But in other cases, we can use tame "stdio rpath wpath cpath fattr", including for the historical -r option.
|
Revision tags: OPENBSD_5_8_BASE
|
#
1.38 |
|
07-May-2015 |
guenther |
Whoops; missed updating a setfile() call.
problem reported dcoppa; ok millert@
|
Revision tags: OPENBSD_5_7_BASE
|
#
1.37 |
|
16-Jan-2015 |
deraadt |
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 tags: OPENBSD_5_6_BASE
|
#
1.36 |
|
21-May-2014 |
guenther |
Use errc/warnc to simplify code.
ok jca@ krw@
|
Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
|
#
1.35 |
|
28-Aug-2012 |
otto |
Don't order file and dir creation, no measurable effect, ffs allocation strategy has changed since a long time and added to that cp(1) should not try to be smart and guess things it shouldn't know. ok guenther@ krw@
|
Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.34 |
|
04-Nov-2007 |
tedu |
some small nonfunctional tweaks. ok beck millert
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.33 |
|
26-Jul-2007 |
deraadt |
STDIN_FILENO is better than fileno(stdin); zinovik@cs.karelia.ru
|
Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
|
#
1.32 |
|
25-Apr-2006 |
deraadt |
various small lint cleanups; ok otto
|
#
1.31 |
|
17-Mar-2006 |
otto |
Call fts_close(); from NetBSD's Coverity analysis; ok jaredy@ millert@
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.30 |
|
09-Nov-2005 |
otto |
Handle dir not readable case. Problem noted by chefren. ok hshoexer@ jaredy@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.29 |
|
13-Dec-2004 |
otto |
Only warn if we try to cp(1) a socket. Consequently, this makes mv(1)ing trees containing sockets across filesystems much more smooth. ok millert@ tedu@ fgsch@ pedro@ deraadt@
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
|
#
1.28 |
|
30-Oct-2003 |
millert |
Fix typo in comment; Bruno Rohee
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.27 |
|
29-Jul-2003 |
deraadt |
spacing
|
#
1.26 |
|
02-Jun-2003 |
millert |
Remove the advertising clause in the UCB license which Berkeley rescinded 22 July 1999. Proofed by myself and Theo.
|
#
1.25 |
|
01-Jun-2003 |
millert |
Undo a misguided attempt to fix speling errors from long ago. UCB copyrights say "acknowledgement", not "acknowledgment". You cannot just go changing the text of a license willy-nilly.
|
#
1.24 |
|
02-May-2003 |
nino |
Zap unused STRIP_TRAILING_SLASH macro.
Ok millert@.
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
13-Mar-2003 |
millert |
Use the return value of strcpy() to detect ENAMETOOLONG instead of doing an extra strlen; deraadt@ OK
|
#
1.22 |
|
13-Mar-2003 |
deraadt |
lots of sprintf -> snprintf and strcpy -> strlcpy; checked by tedu
|
#
1.21 |
|
06-Jan-2003 |
millert |
Set directory mode/user/times on the post-order pass, not pre-order. Fixes a problem with "cp -R" (and probably cp -p) with directories that do not grant the owner write permission. However, we need to know whether or not we created the directory ourselves so stash that fact in fts_pointer (treat it as a boolean) but add a macro to access it for readability. This also allows me to remove the duplicated file times setting code for "cp -p".
Closes PR 3058; deraadt@ OK
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.20 |
|
04-Jul-2002 |
deraadt |
ansi
|
#
1.19 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.18 |
|
16-Feb-2002 |
millert |
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 tags: OPENBSD_3_0_BASE
|
#
1.17 |
|
25-Jun-2001 |
art |
explicit braces to avoid ambiguous else
|
#
1.16 |
|
22-Jun-2001 |
millert |
Avoid printing warnings about things like "is a directory" twice. Found by fgs.
|
#
1.15 |
|
06-Jun-2001 |
millert |
In -p mode, set directory times in post-order pass since otherwise the times get squashed when we add files to the dir. Problem found by Christophe.Deroulers@ens.fr, fix by me.
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
|
#
1.14 |
|
20-Feb-2000 |
ericj |
setlocale and get rid of unneeded exit() call. millert@ ok
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.13 |
|
06-May-1999 |
millert |
"cp -f" should unlink the destination before copying. Similar to a patch from FreeBSD (but this is simpler). Closes PR #821
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
03-Jul-1998 |
csapuntz |
Fix handling of trailing slashes. Don't ever strip them, because that's the way the user tells us that he really wants a directory. Also, a trailing slash does not mean that the last component is null (in fact, according to POSIX, a component can't be 0 bytes). Rather, the last component is the one directly preceding the trailing slashes.
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.11 |
|
08-Nov-1997 |
todd |
spelling
|
Revision tags: OPENBSD_2_2_BASE
|
#
1.10 |
|
20-Sep-1997 |
millert |
Don't strip trailing '/' in source, fts(3) now does this for us.
|
#
1.9 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.8 |
|
23-Aug-1997 |
millert |
Strip trailing slashes from source (we already did dest). Also, use MAXPATHLEN, not MAXPATHLEN+1
|
#
1.7 |
|
23-Jul-1997 |
kstailey |
tabify
|
Revision tags: OPENBSD_2_1_BASE
|
#
1.6 |
|
15-Jan-1997 |
millert |
getopt(3) returns -1 when out of args, not EOF, whee!
|
#
1.5 |
|
14-Dec-1996 |
mickey |
-Wall'ing.
|
#
1.4 |
|
28-Oct-1996 |
tholo |
Don't strip off the last slash in the pathname "/". cp used to stat the pathname "" in order to decide that the pathname "/" is a directory. This caused `cp kernel /' to fail if the kernel has the POSIX behaviour of not allowing the pathname "" to be an alias for ".". It presumably also caused `cp /etc/motd /' to fail in the unlikely event that "." is not stat'able.
Be more careful about concatenating pathnames: don't check that the pathname fits until prefixes have been discarded (the check was too strict). Print the final pathname in error messages. Terminate the target directory name properly for error messages. Don't add a slash between components if there is already a slash.
Fix from FreeBSD
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.3 |
|
02-Aug-1996 |
deraadt |
zap getopt() case of -?, come on, it is the default!
|
#
1.2 |
|
23-Jun-1996 |
deraadt |
update rcsid
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|
#
1.52 |
|
28-Jan-2019 |
jca |
Implement cp -a ("archive" mode)
Not standard, but supported at least by GNU cp, IllumOS, NetBSD, FreeBSD, DragonflyBSD. No need to be gratuitously different. This should also allow us to drop patches in ~10 ports.
Based on an initial diff by benno@ with input from sthen@ and jmc@ ok benno@ danj@ sthen@ martijn@ deraadt@
|
Revision tags: OPENBSD_6_4_BASE
|
#
1.51 |
|
07-Sep-2018 |
martijn |
Revert earlier revert. It turned out the issue was a badly applied diff on stsp@'s machine.
OK stsp@
|
#
1.50 |
|
07-Sep-2018 |
stsp |
Backout recent cp(1) changes; they broke texlive's mktexlsr(1)
|
#
1.49 |
|
07-Sep-2018 |
martijn |
Rename dne in copy_file to exists to be more consistent with the other copy_* functions.
OK stsp@
|
#
1.48 |
|
07-Sep-2018 |
martijn |
Also verify a overwrite for the copy of a fifo, link and device node.
OK stsp@
|
#
1.47 |
|
07-Sep-2018 |
martijn |
The combination of -v and -i and the deny of a copy would cause the copy still to be printed. This fixes that edge-case.
OK stsp@
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
|
#
1.46 |
|
27-Jun-2017 |
tedu |
fix a few lines of unusual length
|
#
1.45 |
|
27-Jun-2017 |
tedu |
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 tags: OPENBSD_6_1_BASE
|
#
1.44 |
|
14-Oct-2016 |
schwarze |
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 tags: OPENBSD_6_0_BASE
|
#
1.43 |
|
07-Mar-2016 |
tb |
Make cp -i behave as mv -i or rm -i, independently of whether stdin is a tty or not. From Timo Buhrmester.
ok jca@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.42 |
|
09-Oct-2015 |
deraadt |
Change all tame callers to namechange to pledge(2).
|
#
1.41 |
|
08-Oct-2015 |
deraadt |
Try again. Both -R and -p prevent use of tame, but other cases can use it.
|
#
1.40 |
|
08-Oct-2015 |
deraadt |
ah, fchflags. We will come back to this issue later
|
#
1.39 |
|
07-Oct-2015 |
deraadt |
We cannot tame if -R is specified, because mknod and mkfifo may be called. But in other cases, we can use tame "stdio rpath wpath cpath fattr", including for the historical -r option.
|
Revision tags: OPENBSD_5_8_BASE
|
#
1.38 |
|
07-May-2015 |
guenther |
Whoops; missed updating a setfile() call.
problem reported dcoppa; ok millert@
|
Revision tags: OPENBSD_5_7_BASE
|
#
1.37 |
|
16-Jan-2015 |
deraadt |
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 tags: OPENBSD_5_6_BASE
|
#
1.36 |
|
21-May-2014 |
guenther |
Use errc/warnc to simplify code.
ok jca@ krw@
|
Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
|
#
1.35 |
|
28-Aug-2012 |
otto |
Don't order file and dir creation, no measurable effect, ffs allocation strategy has changed since a long time and added to that cp(1) should not try to be smart and guess things it shouldn't know. ok guenther@ krw@
|
Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.34 |
|
04-Nov-2007 |
tedu |
some small nonfunctional tweaks. ok beck millert
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.33 |
|
26-Jul-2007 |
deraadt |
STDIN_FILENO is better than fileno(stdin); zinovik@cs.karelia.ru
|
Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
|
#
1.32 |
|
25-Apr-2006 |
deraadt |
various small lint cleanups; ok otto
|
#
1.31 |
|
17-Mar-2006 |
otto |
Call fts_close(); from NetBSD's Coverity analysis; ok jaredy@ millert@
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.30 |
|
09-Nov-2005 |
otto |
Handle dir not readable case. Problem noted by chefren. ok hshoexer@ jaredy@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.29 |
|
13-Dec-2004 |
otto |
Only warn if we try to cp(1) a socket. Consequently, this makes mv(1)ing trees containing sockets across filesystems much more smooth. ok millert@ tedu@ fgsch@ pedro@ deraadt@
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
|
#
1.28 |
|
30-Oct-2003 |
millert |
Fix typo in comment; Bruno Rohee
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.27 |
|
29-Jul-2003 |
deraadt |
spacing
|
#
1.26 |
|
02-Jun-2003 |
millert |
Remove the advertising clause in the UCB license which Berkeley rescinded 22 July 1999. Proofed by myself and Theo.
|
#
1.25 |
|
01-Jun-2003 |
millert |
Undo a misguided attempt to fix speling errors from long ago. UCB copyrights say "acknowledgement", not "acknowledgment". You cannot just go changing the text of a license willy-nilly.
|
#
1.24 |
|
02-May-2003 |
nino |
Zap unused STRIP_TRAILING_SLASH macro.
Ok millert@.
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
13-Mar-2003 |
millert |
Use the return value of strcpy() to detect ENAMETOOLONG instead of doing an extra strlen; deraadt@ OK
|
#
1.22 |
|
13-Mar-2003 |
deraadt |
lots of sprintf -> snprintf and strcpy -> strlcpy; checked by tedu
|
#
1.21 |
|
06-Jan-2003 |
millert |
Set directory mode/user/times on the post-order pass, not pre-order. Fixes a problem with "cp -R" (and probably cp -p) with directories that do not grant the owner write permission. However, we need to know whether or not we created the directory ourselves so stash that fact in fts_pointer (treat it as a boolean) but add a macro to access it for readability. This also allows me to remove the duplicated file times setting code for "cp -p".
Closes PR 3058; deraadt@ OK
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.20 |
|
04-Jul-2002 |
deraadt |
ansi
|
#
1.19 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.18 |
|
16-Feb-2002 |
millert |
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 tags: OPENBSD_3_0_BASE
|
#
1.17 |
|
25-Jun-2001 |
art |
explicit braces to avoid ambiguous else
|
#
1.16 |
|
22-Jun-2001 |
millert |
Avoid printing warnings about things like "is a directory" twice. Found by fgs.
|
#
1.15 |
|
06-Jun-2001 |
millert |
In -p mode, set directory times in post-order pass since otherwise the times get squashed when we add files to the dir. Problem found by Christophe.Deroulers@ens.fr, fix by me.
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
|
#
1.14 |
|
20-Feb-2000 |
ericj |
setlocale and get rid of unneeded exit() call. millert@ ok
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.13 |
|
06-May-1999 |
millert |
"cp -f" should unlink the destination before copying. Similar to a patch from FreeBSD (but this is simpler). Closes PR #821
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
03-Jul-1998 |
csapuntz |
Fix handling of trailing slashes. Don't ever strip them, because that's the way the user tells us that he really wants a directory. Also, a trailing slash does not mean that the last component is null (in fact, according to POSIX, a component can't be 0 bytes). Rather, the last component is the one directly preceding the trailing slashes.
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.11 |
|
08-Nov-1997 |
todd |
spelling
|
Revision tags: OPENBSD_2_2_BASE
|
#
1.10 |
|
20-Sep-1997 |
millert |
Don't strip trailing '/' in source, fts(3) now does this for us.
|
#
1.9 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.8 |
|
23-Aug-1997 |
millert |
Strip trailing slashes from source (we already did dest). Also, use MAXPATHLEN, not MAXPATHLEN+1
|
#
1.7 |
|
23-Jul-1997 |
kstailey |
tabify
|
Revision tags: OPENBSD_2_1_BASE
|
#
1.6 |
|
15-Jan-1997 |
millert |
getopt(3) returns -1 when out of args, not EOF, whee!
|
#
1.5 |
|
14-Dec-1996 |
mickey |
-Wall'ing.
|
#
1.4 |
|
28-Oct-1996 |
tholo |
Don't strip off the last slash in the pathname "/". cp used to stat the pathname "" in order to decide that the pathname "/" is a directory. This caused `cp kernel /' to fail if the kernel has the POSIX behaviour of not allowing the pathname "" to be an alias for ".". It presumably also caused `cp /etc/motd /' to fail in the unlikely event that "." is not stat'able.
Be more careful about concatenating pathnames: don't check that the pathname fits until prefixes have been discarded (the check was too strict). Print the final pathname in error messages. Terminate the target directory name properly for error messages. Don't add a slash between components if there is already a slash.
Fix from FreeBSD
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.3 |
|
02-Aug-1996 |
deraadt |
zap getopt() case of -?, come on, it is the default!
|
#
1.2 |
|
23-Jun-1996 |
deraadt |
update rcsid
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|
#
1.51 |
|
07-Sep-2018 |
martijn |
Revert earlier revert. It turned out the issue was a badly applied diff on stsp@'s machine.
OK stsp@
|
#
1.50 |
|
07-Sep-2018 |
stsp |
Backout recent cp(1) changes; they broke texlive's mktexlsr(1)
|
#
1.49 |
|
07-Sep-2018 |
martijn |
Rename dne in copy_file to exists to be more consistent with the other copy_* functions.
OK stsp@
|
#
1.48 |
|
07-Sep-2018 |
martijn |
Also verify a overwrite for the copy of a fifo, link and device node.
OK stsp@
|
#
1.47 |
|
07-Sep-2018 |
martijn |
The combination of -v and -i and the deny of a copy would cause the copy still to be printed. This fixes that edge-case.
OK stsp@
|
Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE
|
#
1.46 |
|
27-Jun-2017 |
tedu |
fix a few lines of unusual length
|
#
1.45 |
|
27-Jun-2017 |
tedu |
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 tags: OPENBSD_6_1_BASE
|
#
1.44 |
|
14-Oct-2016 |
schwarze |
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 tags: OPENBSD_6_0_BASE
|
#
1.43 |
|
07-Mar-2016 |
tb |
Make cp -i behave as mv -i or rm -i, independently of whether stdin is a tty or not. From Timo Buhrmester.
ok jca@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.42 |
|
09-Oct-2015 |
deraadt |
Change all tame callers to namechange to pledge(2).
|
#
1.41 |
|
08-Oct-2015 |
deraadt |
Try again. Both -R and -p prevent use of tame, but other cases can use it.
|
#
1.40 |
|
08-Oct-2015 |
deraadt |
ah, fchflags. We will come back to this issue later
|
#
1.39 |
|
07-Oct-2015 |
deraadt |
We cannot tame if -R is specified, because mknod and mkfifo may be called. But in other cases, we can use tame "stdio rpath wpath cpath fattr", including for the historical -r option.
|
Revision tags: OPENBSD_5_8_BASE
|
#
1.38 |
|
07-May-2015 |
guenther |
Whoops; missed updating a setfile() call.
problem reported dcoppa; ok millert@
|
Revision tags: OPENBSD_5_7_BASE
|
#
1.37 |
|
16-Jan-2015 |
deraadt |
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 tags: OPENBSD_5_6_BASE
|
#
1.36 |
|
21-May-2014 |
guenther |
Use errc/warnc to simplify code.
ok jca@ krw@
|
Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
|
#
1.35 |
|
28-Aug-2012 |
otto |
Don't order file and dir creation, no measurable effect, ffs allocation strategy has changed since a long time and added to that cp(1) should not try to be smart and guess things it shouldn't know. ok guenther@ krw@
|
Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.34 |
|
04-Nov-2007 |
tedu |
some small nonfunctional tweaks. ok beck millert
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.33 |
|
26-Jul-2007 |
deraadt |
STDIN_FILENO is better than fileno(stdin); zinovik@cs.karelia.ru
|
Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
|
#
1.32 |
|
25-Apr-2006 |
deraadt |
various small lint cleanups; ok otto
|
#
1.31 |
|
17-Mar-2006 |
otto |
Call fts_close(); from NetBSD's Coverity analysis; ok jaredy@ millert@
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.30 |
|
09-Nov-2005 |
otto |
Handle dir not readable case. Problem noted by chefren. ok hshoexer@ jaredy@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.29 |
|
13-Dec-2004 |
otto |
Only warn if we try to cp(1) a socket. Consequently, this makes mv(1)ing trees containing sockets across filesystems much more smooth. ok millert@ tedu@ fgsch@ pedro@ deraadt@
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
|
#
1.28 |
|
30-Oct-2003 |
millert |
Fix typo in comment; Bruno Rohee
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.27 |
|
29-Jul-2003 |
deraadt |
spacing
|
#
1.26 |
|
02-Jun-2003 |
millert |
Remove the advertising clause in the UCB license which Berkeley rescinded 22 July 1999. Proofed by myself and Theo.
|
#
1.25 |
|
01-Jun-2003 |
millert |
Undo a misguided attempt to fix speling errors from long ago. UCB copyrights say "acknowledgement", not "acknowledgment". You cannot just go changing the text of a license willy-nilly.
|
#
1.24 |
|
02-May-2003 |
nino |
Zap unused STRIP_TRAILING_SLASH macro.
Ok millert@.
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
13-Mar-2003 |
millert |
Use the return value of strcpy() to detect ENAMETOOLONG instead of doing an extra strlen; deraadt@ OK
|
#
1.22 |
|
13-Mar-2003 |
deraadt |
lots of sprintf -> snprintf and strcpy -> strlcpy; checked by tedu
|
#
1.21 |
|
06-Jan-2003 |
millert |
Set directory mode/user/times on the post-order pass, not pre-order. Fixes a problem with "cp -R" (and probably cp -p) with directories that do not grant the owner write permission. However, we need to know whether or not we created the directory ourselves so stash that fact in fts_pointer (treat it as a boolean) but add a macro to access it for readability. This also allows me to remove the duplicated file times setting code for "cp -p".
Closes PR 3058; deraadt@ OK
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.20 |
|
04-Jul-2002 |
deraadt |
ansi
|
#
1.19 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.18 |
|
16-Feb-2002 |
millert |
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 tags: OPENBSD_3_0_BASE
|
#
1.17 |
|
25-Jun-2001 |
art |
explicit braces to avoid ambiguous else
|
#
1.16 |
|
22-Jun-2001 |
millert |
Avoid printing warnings about things like "is a directory" twice. Found by fgs.
|
#
1.15 |
|
06-Jun-2001 |
millert |
In -p mode, set directory times in post-order pass since otherwise the times get squashed when we add files to the dir. Problem found by Christophe.Deroulers@ens.fr, fix by me.
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
|
#
1.14 |
|
20-Feb-2000 |
ericj |
setlocale and get rid of unneeded exit() call. millert@ ok
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.13 |
|
06-May-1999 |
millert |
"cp -f" should unlink the destination before copying. Similar to a patch from FreeBSD (but this is simpler). Closes PR #821
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
03-Jul-1998 |
csapuntz |
Fix handling of trailing slashes. Don't ever strip them, because that's the way the user tells us that he really wants a directory. Also, a trailing slash does not mean that the last component is null (in fact, according to POSIX, a component can't be 0 bytes). Rather, the last component is the one directly preceding the trailing slashes.
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.11 |
|
08-Nov-1997 |
todd |
spelling
|
Revision tags: OPENBSD_2_2_BASE
|
#
1.10 |
|
20-Sep-1997 |
millert |
Don't strip trailing '/' in source, fts(3) now does this for us.
|
#
1.9 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.8 |
|
23-Aug-1997 |
millert |
Strip trailing slashes from source (we already did dest). Also, use MAXPATHLEN, not MAXPATHLEN+1
|
#
1.7 |
|
23-Jul-1997 |
kstailey |
tabify
|
Revision tags: OPENBSD_2_1_BASE
|
#
1.6 |
|
15-Jan-1997 |
millert |
getopt(3) returns -1 when out of args, not EOF, whee!
|
#
1.5 |
|
14-Dec-1996 |
mickey |
-Wall'ing.
|
#
1.4 |
|
28-Oct-1996 |
tholo |
Don't strip off the last slash in the pathname "/". cp used to stat the pathname "" in order to decide that the pathname "/" is a directory. This caused `cp kernel /' to fail if the kernel has the POSIX behaviour of not allowing the pathname "" to be an alias for ".". It presumably also caused `cp /etc/motd /' to fail in the unlikely event that "." is not stat'able.
Be more careful about concatenating pathnames: don't check that the pathname fits until prefixes have been discarded (the check was too strict). Print the final pathname in error messages. Terminate the target directory name properly for error messages. Don't add a slash between components if there is already a slash.
Fix from FreeBSD
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.3 |
|
02-Aug-1996 |
deraadt |
zap getopt() case of -?, come on, it is the default!
|
#
1.2 |
|
23-Jun-1996 |
deraadt |
update rcsid
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|
Revision tags: OPENBSD_6_2_BASE
|
#
1.46 |
|
27-Jun-2017 |
tedu |
fix a few lines of unusual length
|
#
1.45 |
|
27-Jun-2017 |
tedu |
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 tags: OPENBSD_6_1_BASE
|
#
1.44 |
|
14-Oct-2016 |
schwarze |
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 tags: OPENBSD_6_0_BASE
|
#
1.43 |
|
07-Mar-2016 |
tb |
Make cp -i behave as mv -i or rm -i, independently of whether stdin is a tty or not. From Timo Buhrmester.
ok jca@
|
Revision tags: OPENBSD_5_9_BASE
|
#
1.42 |
|
09-Oct-2015 |
deraadt |
Change all tame callers to namechange to pledge(2).
|
#
1.41 |
|
08-Oct-2015 |
deraadt |
Try again. Both -R and -p prevent use of tame, but other cases can use it.
|
#
1.40 |
|
08-Oct-2015 |
deraadt |
ah, fchflags. We will come back to this issue later
|
#
1.39 |
|
07-Oct-2015 |
deraadt |
We cannot tame if -R is specified, because mknod and mkfifo may be called. But in other cases, we can use tame "stdio rpath wpath cpath fattr", including for the historical -r option.
|
Revision tags: OPENBSD_5_8_BASE
|
#
1.38 |
|
07-May-2015 |
guenther |
Whoops; missed updating a setfile() call.
problem reported dcoppa; ok millert@
|
Revision tags: OPENBSD_5_7_BASE
|
#
1.37 |
|
16-Jan-2015 |
deraadt |
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 tags: OPENBSD_5_6_BASE
|
#
1.36 |
|
21-May-2014 |
guenther |
Use errc/warnc to simplify code.
ok jca@ krw@
|
Revision tags: OPENBSD_5_3_BASE OPENBSD_5_4_BASE OPENBSD_5_5_BASE
|
#
1.35 |
|
28-Aug-2012 |
otto |
Don't order file and dir creation, no measurable effect, ffs allocation strategy has changed since a long time and added to that cp(1) should not try to be smart and guess things it shouldn't know. ok guenther@ krw@
|
Revision tags: OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE OPENBSD_4_8_BASE OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
|
#
1.34 |
|
04-Nov-2007 |
tedu |
some small nonfunctional tweaks. ok beck millert
|
Revision tags: OPENBSD_4_2_BASE
|
#
1.33 |
|
26-Jul-2007 |
deraadt |
STDIN_FILENO is better than fileno(stdin); zinovik@cs.karelia.ru
|
Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE
|
#
1.32 |
|
25-Apr-2006 |
deraadt |
various small lint cleanups; ok otto
|
#
1.31 |
|
17-Mar-2006 |
otto |
Call fts_close(); from NetBSD's Coverity analysis; ok jaredy@ millert@
|
Revision tags: OPENBSD_3_9_BASE
|
#
1.30 |
|
09-Nov-2005 |
otto |
Handle dir not readable case. Problem noted by chefren. ok hshoexer@ jaredy@
|
Revision tags: OPENBSD_3_7_BASE OPENBSD_3_8_BASE
|
#
1.29 |
|
13-Dec-2004 |
otto |
Only warn if we try to cp(1) a socket. Consequently, this makes mv(1)ing trees containing sockets across filesystems much more smooth. ok millert@ tedu@ fgsch@ pedro@ deraadt@
|
Revision tags: OPENBSD_3_5_BASE OPENBSD_3_6_BASE
|
#
1.28 |
|
30-Oct-2003 |
millert |
Fix typo in comment; Bruno Rohee
|
Revision tags: OPENBSD_3_4_BASE
|
#
1.27 |
|
29-Jul-2003 |
deraadt |
spacing
|
#
1.26 |
|
02-Jun-2003 |
millert |
Remove the advertising clause in the UCB license which Berkeley rescinded 22 July 1999. Proofed by myself and Theo.
|
#
1.25 |
|
01-Jun-2003 |
millert |
Undo a misguided attempt to fix speling errors from long ago. UCB copyrights say "acknowledgement", not "acknowledgment". You cannot just go changing the text of a license willy-nilly.
|
#
1.24 |
|
02-May-2003 |
nino |
Zap unused STRIP_TRAILING_SLASH macro.
Ok millert@.
|
Revision tags: OPENBSD_3_3_BASE
|
#
1.23 |
|
13-Mar-2003 |
millert |
Use the return value of strcpy() to detect ENAMETOOLONG instead of doing an extra strlen; deraadt@ OK
|
#
1.22 |
|
13-Mar-2003 |
deraadt |
lots of sprintf -> snprintf and strcpy -> strlcpy; checked by tedu
|
#
1.21 |
|
06-Jan-2003 |
millert |
Set directory mode/user/times on the post-order pass, not pre-order. Fixes a problem with "cp -R" (and probably cp -p) with directories that do not grant the owner write permission. However, we need to know whether or not we created the directory ourselves so stash that fact in fts_pointer (treat it as a boolean) but add a macro to access it for readability. This also allows me to remove the duplicated file times setting code for "cp -p".
Closes PR 3058; deraadt@ OK
|
Revision tags: OPENBSD_3_2_BASE
|
#
1.20 |
|
04-Jul-2002 |
deraadt |
ansi
|
#
1.19 |
|
09-Jun-2002 |
todd |
knf
|
Revision tags: OPENBSD_3_1_BASE
|
#
1.18 |
|
16-Feb-2002 |
millert |
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 tags: OPENBSD_3_0_BASE
|
#
1.17 |
|
25-Jun-2001 |
art |
explicit braces to avoid ambiguous else
|
#
1.16 |
|
22-Jun-2001 |
millert |
Avoid printing warnings about things like "is a directory" twice. Found by fgs.
|
#
1.15 |
|
06-Jun-2001 |
millert |
In -p mode, set directory times in post-order pass since otherwise the times get squashed when we add files to the dir. Problem found by Christophe.Deroulers@ens.fr, fix by me.
|
Revision tags: OPENBSD_2_7_BASE OPENBSD_2_8_BASE OPENBSD_2_9_BASE
|
#
1.14 |
|
20-Feb-2000 |
ericj |
setlocale and get rid of unneeded exit() call. millert@ ok
|
Revision tags: OPENBSD_2_6_BASE
|
#
1.13 |
|
06-May-1999 |
millert |
"cp -f" should unlink the destination before copying. Similar to a patch from FreeBSD (but this is simpler). Closes PR #821
|
Revision tags: OPENBSD_2_4_BASE OPENBSD_2_5_BASE
|
#
1.12 |
|
03-Jul-1998 |
csapuntz |
Fix handling of trailing slashes. Don't ever strip them, because that's the way the user tells us that he really wants a directory. Also, a trailing slash does not mean that the last component is null (in fact, according to POSIX, a component can't be 0 bytes). Rather, the last component is the one directly preceding the trailing slashes.
|
Revision tags: OPENBSD_2_3_BASE
|
#
1.11 |
|
08-Nov-1997 |
todd |
spelling
|
Revision tags: OPENBSD_2_2_BASE
|
#
1.10 |
|
20-Sep-1997 |
millert |
Don't strip trailing '/' in source, fts(3) now does this for us.
|
#
1.9 |
|
01-Sep-1997 |
deraadt |
i am bored enough to fix terminal space/tab uglies
|
#
1.8 |
|
23-Aug-1997 |
millert |
Strip trailing slashes from source (we already did dest). Also, use MAXPATHLEN, not MAXPATHLEN+1
|
#
1.7 |
|
23-Jul-1997 |
kstailey |
tabify
|
Revision tags: OPENBSD_2_1_BASE
|
#
1.6 |
|
15-Jan-1997 |
millert |
getopt(3) returns -1 when out of args, not EOF, whee!
|
#
1.5 |
|
14-Dec-1996 |
mickey |
-Wall'ing.
|
#
1.4 |
|
28-Oct-1996 |
tholo |
Don't strip off the last slash in the pathname "/". cp used to stat the pathname "" in order to decide that the pathname "/" is a directory. This caused `cp kernel /' to fail if the kernel has the POSIX behaviour of not allowing the pathname "" to be an alias for ".". It presumably also caused `cp /etc/motd /' to fail in the unlikely event that "." is not stat'able.
Be more careful about concatenating pathnames: don't check that the pathname fits until prefixes have been discarded (the check was too strict). Print the final pathname in error messages. Terminate the target directory name properly for error messages. Don't add a slash between components if there is already a slash.
Fix from FreeBSD
|
Revision tags: OPENBSD_2_0_BASE
|
#
1.3 |
|
02-Aug-1996 |
deraadt |
zap getopt() case of -?, come on, it is the default!
|
#
1.2 |
|
23-Jun-1996 |
deraadt |
update rcsid
|
#
1.1 |
|
18-Oct-1995 |
deraadt |
branches: 1.1.1; Initial revision
|