OpenBSD CVS

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


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

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.53 / (download) - annotate - [select for diffs], Fri Jun 28 13:34:58 2019 UTC (4 years, 11 months 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, OPENBSD_7_1_BASE, OPENBSD_7_1, 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, HEAD
Changes since 1.52: +2 -2 lines
Diff to previous 1.52 (colored)

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 1.52 / (download) - annotate - [select for diffs], Mon Jan 28 18:58:42 2019 UTC (5 years, 4 months ago) by jca
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.51: +8 -2 lines
Diff to previous 1.51 (colored)

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 1.51 / (download) - annotate - [select for diffs], Fri Sep 7 13:46:33 2018 UTC (5 years, 9 months ago) by martijn
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.50: +17 -13 lines
Diff to previous 1.50 (colored)

Revert earlier revert.
It turned out the issue was a badly applied diff on stsp@'s machine.

OK stsp@

Revision 1.50 / (download) - annotate - [select for diffs], Fri Sep 7 11:01:22 2018 UTC (5 years, 9 months ago) by stsp
Branch: MAIN
Changes since 1.49: +13 -17 lines
Diff to previous 1.49 (colored)

Backout recent cp(1) changes; they broke texlive's mktexlsr(1)

Revision 1.49 / (download) - annotate - [select for diffs], Fri Sep 7 07:44:15 2018 UTC (5 years, 9 months ago) by martijn
Branch: MAIN
Changes since 1.48: +4 -4 lines
Diff to previous 1.48 (colored)

Rename dne in copy_file to exists to be more consistent with the other
copy_* functions.

OK stsp@

Revision 1.48 / (download) - annotate - [select for diffs], Fri Sep 7 07:17:14 2018 UTC (5 years, 9 months ago) by martijn
Branch: MAIN
Changes since 1.47: +7 -6 lines
Diff to previous 1.47 (colored)

Also verify a overwrite for the copy of a fifo, link and device node.

OK stsp@

Revision 1.47 / (download) - annotate - [select for diffs], Fri Sep 7 07:11:16 2018 UTC (5 years, 9 months ago) by martijn
Branch: MAIN
Changes since 1.46: +11 -8 lines
Diff to previous 1.46 (colored)

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 1.46 / (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_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.45: +4 -3 lines
Diff to previous 1.45 (colored)

fix a few lines of unusual length

Revision 1.45 / (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.44: +21 -3 lines
Diff to previous 1.44 (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.44 / (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.43: +3 -6 lines
Diff to previous 1.43 (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.43 / (download) - annotate - [select for diffs], Mon Mar 7 18:56:33 2016 UTC (8 years, 3 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.42: +2 -2 lines
Diff to previous 1.42 (colored)

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 1.42 / (download) - annotate - [select for diffs], Fri Oct 9 01:37:06 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.41: +3 -3 lines
Diff to previous 1.41 (colored)

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

Revision 1.41 / (download) - annotate - [select for diffs], Thu Oct 8 04:39:24 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.40: +9 -1 lines
Diff to previous 1.40 (colored)

Try again.  Both -R and -p prevent use of tame, but other cases can use it.

Revision 1.40 / (download) - annotate - [select for diffs], Thu Oct 8 00:07:20 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.39: +0 -5 lines
Diff to previous 1.39 (colored)

ah, fchflags.  We will come back to this issue later

Revision 1.39 / (download) - annotate - [select for diffs], Wed Oct 7 15:44:58 2015 UTC (8 years, 8 months ago) by deraadt
Branch: MAIN
Changes since 1.38: +6 -1 lines
Diff to previous 1.38 (colored)

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 1.38 / (download) - annotate - [select for diffs], Thu May 7 17:32:20 2015 UTC (9 years, 1 month ago) by guenther
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8
Changes since 1.37: +2 -2 lines
Diff to previous 1.37 (colored)

Whoops; missed updating a setfile() call.

problem reported dcoppa; ok millert@

Revision 1.37 / (download) - annotate - [select for diffs], Fri Jan 16 06:39:31 2015 UTC (9 years, 4 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.36: +4 -3 lines
Diff to previous 1.36 (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.36 / (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.35: +4 -6 lines
Diff to previous 1.35 (colored)

Use errc/warnc to simplify code.

ok jca@ krw@

Revision 1.35 / (download) - annotate - [select for diffs], Tue Aug 28 06:02:58 2012 UTC (11 years, 9 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3
Changes since 1.34: +2 -29 lines
Diff to previous 1.34 (colored)

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 1.34 / (download) - annotate - [select for diffs], Sun Nov 4 02:01:57 2007 UTC (16 years, 7 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_5_2_BASE, OPENBSD_5_2, 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, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4, OPENBSD_4_3_BASE, OPENBSD_4_3
Changes since 1.33: +5 -19 lines
Diff to previous 1.33 (colored)

some small nonfunctional tweaks.  ok beck millert

Revision 1.33 / (download) - annotate - [select for diffs], Thu Jul 26 17:15:46 2007 UTC (16 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_2_BASE, OPENBSD_4_2
Changes since 1.32: +3 -3 lines
Diff to previous 1.32 (colored)

STDIN_FILENO is better than fileno(stdin); zinovik@cs.karelia.ru

Revision 1.32 / (download) - annotate - [select for diffs], Tue Apr 25 15:41:07 2006 UTC (18 years, 1 month ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0
Changes since 1.31: +3 -3 lines
Diff to previous 1.31 (colored)

various small lint cleanups; ok otto

Revision 1.31 / (download) - annotate - [select for diffs], Fri Mar 17 23:05:32 2006 UTC (18 years, 2 months ago) by otto
Branch: MAIN
Changes since 1.30: +3 -2 lines
Diff to previous 1.30 (colored)

Call fts_close(); from NetBSD's Coverity analysis; ok jaredy@ millert@

Revision 1.30 / (download) - annotate - [select for diffs], Wed Nov 9 20:03:29 2005 UTC (18 years, 7 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_9_BASE, OPENBSD_3_9
Changes since 1.29: +3 -2 lines
Diff to previous 1.29 (colored)

Handle dir not readable case. Problem noted by chefren. ok hshoexer@ jaredy@

Revision 1.29 / (download) - annotate - [select for diffs], Mon Dec 13 20:25:34 2004 UTC (19 years, 6 months ago) by otto
Branch: MAIN
CVS Tags: OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.28: +5 -2 lines
Diff to previous 1.28 (colored)

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 1.28 / (download) - annotate - [select for diffs], Thu Oct 30 16:01:43 2003 UTC (20 years, 7 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5
Changes since 1.27: +3 -3 lines
Diff to previous 1.27 (colored)

Fix typo in comment; Bruno Rohee

Revision 1.27 / (download) - annotate - [select for diffs], Tue Jul 29 00:24:14 2003 UTC (20 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_4_BASE, OPENBSD_3_4
Changes since 1.26: +5 -7 lines
Diff to previous 1.26 (colored)

spacing

Revision 1.26 / (download) - annotate - [select for diffs], Mon Jun 2 23:32:06 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.25: +3 -7 lines
Diff to previous 1.25 (colored)

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

Revision 1.25 / (download) - annotate - [select for diffs], Sun Jun 1 23:50:02 2003 UTC (21 years ago) by millert
Branch: MAIN
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

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.

Revision 1.24 / (download) - annotate - [select for diffs], Fri May 2 20:31:42 2003 UTC (21 years, 1 month ago) by nino
Branch: MAIN
Changes since 1.23: +0 -5 lines
Diff to previous 1.23 (colored)

Zap unused STRIP_TRAILING_SLASH macro.

Ok millert@.

Revision 1.23 / (download) - annotate - [select for diffs], Thu Mar 13 22:17:04 2003 UTC (21 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_3_BASE, OPENBSD_3_3
Changes since 1.22: +3 -4 lines
Diff to previous 1.22 (colored)

Use the return value of strcpy() to detect ENAMETOOLONG instead of
doing an extra strlen; deraadt@ OK

Revision 1.22 / (download) - annotate - [select for diffs], Thu Mar 13 09:09:20 2003 UTC (21 years, 3 months ago) by deraadt
Branch: MAIN
Changes since 1.21: +3 -3 lines
Diff to previous 1.21 (colored)

lots of sprintf -> snprintf and strcpy -> strlcpy; checked by tedu

Revision 1.21 / (download) - annotate - [select for diffs], Mon Jan 6 01:52:52 2003 UTC (21 years, 5 months ago) by millert
Branch: MAIN
Changes since 1.20: +39 -37 lines
Diff to previous 1.20 (colored)

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 1.20 / (download) - annotate - [select for diffs], Thu Jul 4 04:26:39 2002 UTC (21 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.19: +6 -14 lines
Diff to previous 1.19 (colored)

ansi

Revision 1.19 / (download) - annotate - [select for diffs], Sun Jun 9 05:47:26 2002 UTC (22 years ago) by todd
Branch: MAIN
Changes since 1.18: +10 -10 lines
Diff to previous 1.18 (colored)

knf

Revision 1.18 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:06 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.17: +5 -5 lines
Diff to previous 1.17 (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.17 / (download) - annotate - [select for diffs], Mon Jun 25 04:35:31 2001 UTC (22 years, 11 months ago) by art
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0
Changes since 1.16: +4 -3 lines
Diff to previous 1.16 (colored)

explicit braces to avoid ambiguous else

Revision 1.16 / (download) - annotate - [select for diffs], Fri Jun 22 22:51:22 2001 UTC (22 years, 11 months ago) by millert
Branch: MAIN
Changes since 1.15: +6 -4 lines
Diff to previous 1.15 (colored)

Avoid printing warnings about things like "is a directory" twice.
Found by fgs.

Revision 1.15 / (download) - annotate - [select for diffs], Wed Jun 6 16:06:33 2001 UTC (23 years ago) by millert
Branch: MAIN
Changes since 1.14: +22 -5 lines
Diff to previous 1.14 (colored)

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 1.14 / (download) - annotate - [select for diffs], Sun Feb 20 23:03:55 2000 UTC (24 years, 3 months ago) by ericj
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
Changes since 1.13: +6 -5 lines
Diff to previous 1.13 (colored)

setlocale and get rid of unneeded exit() call. millert@ ok

Revision 1.13 / (download) - annotate - [select for diffs], Thu May 6 17:19:45 1999 UTC (25 years, 1 month ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6
Changes since 1.12: +5 -3 lines
Diff to previous 1.12 (colored)

"cp -f" should unlink the destination before copying.  Similar to
a patch from FreeBSD (but this is simpler).  Closes PR #821

Revision 1.12 / (download) - annotate - [select for diffs], Fri Jul 3 16:43:56 1998 UTC (25 years, 11 months ago) by csapuntz
Branch: MAIN
CVS Tags: OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4
Changes since 1.11: +33 -8 lines
Diff to previous 1.11 (colored)



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 1.11 / (download) - annotate - [select for diffs], Sat Nov 8 23:17:11 1997 UTC (26 years, 7 months ago) by todd
Branch: MAIN
CVS Tags: OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.10: +5 -5 lines
Diff to previous 1.10 (colored)

spelling

Revision 1.10 / (download) - annotate - [select for diffs], Sat Sep 20 17:34:34 1997 UTC (26 years, 8 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.9: +7 -14 lines
Diff to previous 1.9 (colored)

Don't strip trailing '/' in source, fts(3) now does this for us.

Revision 1.9 / (download) - annotate - [select for diffs], Mon Sep 1 18:29:17 1997 UTC (26 years, 9 months ago) by deraadt
Branch: MAIN
Changes since 1.8: +12 -12 lines
Diff to previous 1.8 (colored)

i am bored enough to fix terminal space/tab uglies

Revision 1.8 / (download) - annotate - [select for diffs], Sat Aug 23 00:01:38 1997 UTC (26 years, 9 months ago) by millert
Branch: MAIN
Changes since 1.7: +20 -13 lines
Diff to previous 1.7 (colored)

Strip trailing slashes from source (we already did dest).
Also, use MAXPATHLEN, not MAXPATHLEN+1

Revision 1.7 / (download) - annotate - [select for diffs], Wed Jul 23 14:32:37 1997 UTC (26 years, 10 months ago) by kstailey
Branch: MAIN
Changes since 1.6: +10 -10 lines
Diff to previous 1.6 (colored)

tabify

Revision 1.6 / (download) - annotate - [select for diffs], Wed Jan 15 23:40:20 1997 UTC (27 years, 5 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.5: +3 -3 lines
Diff to previous 1.5 (colored)

getopt(3) returns -1 when out of args, not EOF, whee!

Revision 1.5 / (download) - annotate - [select for diffs], Sat Dec 14 12:17:38 1996 UTC (27 years, 6 months ago) by mickey
Branch: MAIN
Changes since 1.4: +5 -3 lines
Diff to previous 1.4 (colored)

-Wall'ing.

Revision 1.4 / (download) - annotate - [select for diffs], Mon Oct 28 02:55:05 1996 UTC (27 years, 7 months ago) by tholo
Branch: MAIN
Changes since 1.3: +16 -19 lines
Diff to previous 1.3 (colored)

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 1.3 / (download) - annotate - [select for diffs], Fri Aug 2 12:40:51 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:19:09 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:02 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:02 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.