History log of /src/bin/cp/utils.c |
Revision | | Date | Author | Comments |
1.50 |
| 15-Jan-2024 |
christos | PR/57857: Ricardo Branco: Always copy regular files, even if they appear to be zero-sized.
|
1.49 |
| 17-May-2020 |
christos | No ACL support for install media (SMALLPROG)
|
1.48 |
| 16-May-2020 |
christos | Add ACL support for FFS. From FreeBSD.
|
1.47 |
| 23-Sep-2019 |
christos | PR/54564: Jan Schaumann: cp of a fifo yields an empty file Don't short-circuit 0 sized stat entries if they don't belong to regular files. Also don't try to mmap non-regular files.
|
1.46 |
| 17-Jul-2018 |
darcy | branches: 1.46.2; Re-order the code to short circuit all the opens and closes if linking. Discussed on tech-userlevel and agreed to by christos@. Testing suggests an order of magnitude improvement when linking.
|
1.45 |
| 29-Feb-2016 |
mrg | branches: 1.45.14; 1.45.16; for display in the (post) SIGINFO handler use off_t not size_t for file sizes. fixes incorrect reporting errors on 32 bit platforms with >4GB file sizes.
|
1.44 |
| 03-Mar-2015 |
enami | Fix the name of failed function in warning message.
|
1.43 |
| 02-Mar-2015 |
enami | Don't truncate at microseconds while preserving timestamps.
One of motivation of this change is to make the behavior of test(1) -nt/ot with preserved copy (like cp -p) closer to the NetBSD 6. Of course whether full timestamps are kept or not depends also on underlying file system.
The ifdef added in mv(1) since existing ifdefs was our local change to compile it on solaris (though I couldn't test it): http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html
|
1.42 |
| 11-Dec-2013 |
dholland | branches: 1.42.4; 1.42.6; Remove entirely bogus /* NOTREACHED */ annotation.
|
1.41 |
| 04-Jan-2012 |
christos | branches: 1.41.6; Add siginfo support from Daniel Loffgren.
|
1.40 |
| 03-Aug-2011 |
manu | branches: 1.40.2; Make cp -p and mv preverve extended attributes, and complain if they cannot.
Also introduce library functions for copying extended attributes from one file to another: - extattr_copy_file, extattr_copy_fd, extattr_copy_link, with FreeBSD style, where a namespace is to be supplied - cpxattr, fcpxattr, lcpxattr, with Linux style, where all namespaces accessible to the caller are copied, and the others are silently ignored.
|
1.39 |
| 06-Feb-2011 |
darcy | Add -l option to copy a tree as links. Non-standard option similar to Gnutools cp(1) Approved by core.
|
1.38 |
| 04-Jan-2011 |
wiz | branches: 1.38.2; Fix fd leak in error case. Found by cppcheck.
|
1.37 |
| 21-Dec-2010 |
christos | Add -a archive flag. from Aleksey Cheusov
|
1.36 |
| 25-Oct-2010 |
tron | Re-enable support for reading files of at most 8MB via mmap(2). Write out the mmap-ed data in small chunks to avoid locking the output file for a long time.
Suggested by David Holland on "source-changes-d" mailing list.
|
1.35 |
| 22-Oct-2010 |
pooka | Disable mmap path. With the current vnode locking scheme it has a very annoying property: if the source media is slow (like a slow network), the target file will be locked for the duration of the entire max 8MB write and cause processes attempting to e.g. stat() it to "tstile" (for several minutes in the worst case). Revisit this if/when vnode locking gets a little smarter.
chs ok (although he would rather see vnode locking improvements, but that's a slightly larger project)
|
1.34 |
| 26-Oct-2007 |
hira | Add -N to usage.
|
1.33 |
| 25-Oct-2007 |
jld | Touching up the permissions to preserve set-ID bits is appropriate only in the case where the destination did not previously exist, and necessary only when -p isn't given.
Closes PR bin/30188.
|
1.32 |
| 16-Jul-2006 |
jschauma | branches: 1.32.10; return functionality backed out yesterday after fixing the bug I had introduced before. A regression test will be added to src/regress shortly.
|
1.31 |
| 15-Jul-2006 |
jschauma | The last commit introduced a bug. Revert until that's found and fixed.
|
1.30 |
| 15-Jul-2006 |
jschauma | As suggested on tech-userlevel: "-R" claims: -R [...] Created directories have the same mode as the corre- sponding source directory, unmodified by the process' umask.
Make this actually true.
In addition, make '-P' (no symbolic links are followed) apply even if '-R' is not specified. This allows users to overwrite symbolic links with files and/or to copy symbolic links over a file without indirecting through the link (ie a copy of a link turns the target into a link, not a copy of the file pointed to by the source).
|
1.29 |
| 15-Oct-2005 |
christos | - Don't output 'src -> dst' when -v and there was an error. - Mark usage as noreturn, and remove extraneous exit. - Pass lint. Reported by Liam Foy.
|
1.28 |
| 15-Aug-2005 |
elad | Add and document -N: When used with -p, it will not copy the file flags. PR 13645.
|
1.27 |
| 04-Jan-2004 |
jschauma | remove unused code left from printescaped() backput as pointed out by Jeff Ito in PR bin/23969 and PR bin/23970.
|
1.26 |
| 14-Sep-2003 |
jschauma | Following private discussion with kleink@ and hubertf@ and public discussion on tech-userlevel@, back out printescaped() functionality. kleink: ``We sell rope.''
|
1.25 |
| 07-Aug-2003 |
agc | Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
|
1.24 |
| 04-Aug-2003 |
jschauma | As discusses a little while back on tech-userlevel:
If stdout is a tty, use vis(3) to print any filenames to prevent garbage from being printed if the filename contains control- or other non-printable characters.
While here, sprinkle some EXIT_FAILURE and NOTREACHED where appropriate.
|
1.23 |
| 20-Jan-2003 |
simonb | The Double-Semi-Colon Police.
|
1.22 |
| 16-Dec-2002 |
jrf | Added a -v verbose option to the cp(1) command. Updated man page and utils as well. This applies to PR bin/16834. This change was approved by Christos.
|
1.21 |
| 19-Oct-2002 |
provos | use readlink with bufsize - 1; approved thorpej.
|
1.20 |
| 13-Sep-2001 |
wiz | ANSIfication and some KNF fixes by Petri Koistinen from bin/13681.
|
1.19 |
| 30-Aug-2001 |
chs | enable use of mmap(), falling back to read()/write() if mmap() fails.
|
1.18 |
| 18-Jul-2001 |
tron | Use madvise(2) after mmap(2) in case "VM_AND_BUFFER_CACHE_SYNCHRONIZED" is defined which it is not right now.
|
1.17 |
| 01-Mar-1999 |
mjl | Correct behaviour in case of dangling symlinks: they would be (contrary to what the manpage and POSIX say) copied as symlinks, even without -R. Return ENOENT instead. Closes PR 6975 by Johan Danielsson <joda@pdc.kth.se>.
From FreeBSD: return correct error message if source directory is unreadable; remove unnecessarily included headers.
|
1.16 |
| 08-Oct-1998 |
wsanchez | Fix bug where "cp -f" didn't work. It's suppsed to remove the file and then copy, which it wasn't doing. But no wait, it turns out that the described behaviour in the manual doesn't agree with POSIX. So we change the above fix and the manual to "try copy, and if fail, try remove, then copy". Fix bug where "cp -R" didn't work on read-only directories: It would make the directory, set the mode, and not be able to write files into it. Don't bother mmap()ing files of zero length. Was a workaround for a bug in Rhapsody mmap(), which didn't get along with such files, but makes sense anyway. Fix race condition where "cp -p" would set the mod time of a file before close()ing the file, which would update the mod time and therefore screw up the "-p" idea, except, of course, while running in gdb, which sucked. Add -f option to usage message in binary and man page. Already documented in man page.
|
1.15 |
| 19-Aug-1998 |
thorpej | Add some braces to keep egcs happy.
|
1.14 |
| 28-Jul-1998 |
mycroft | Delint.
|
1.13 |
| 28-Jul-1998 |
mycroft | Delint.
|
1.12 |
| 20-Feb-1998 |
mycroft | Nit: Use MAP_SHARED for read-only mappings where appropriate.
|
1.11 |
| 17-Feb-1998 |
augustss | Use MAP_PRIVATE|MAP_FILE instead of 0 in mmap().
|
1.10 |
| 19-Oct-1997 |
mycroft | Use futimes(2) if possible. Also correct an error message.
|
1.9 |
| 19-Oct-1997 |
enami | Preserve owner/group/mode/atime/mtime of symlink if -p flag is given.
|
1.8 |
| 20-Jul-1997 |
thorpej | - Use __COPYRIGHT() and __RCSID() - Fix compiler warnings.
|
1.7 |
| 15-May-1997 |
mikel | add missing close-brackets; from Greg Oster in PR bin/3613.
|
1.6 |
| 26-Feb-1997 |
cgd | Patch from BSDI (via Keith Bostic): >NFS doesn't support chflags; ignore errors unless there's reason >to believe we're losing bits. (Note, this still won't be right >if the server supports flags and we were trying to *remove* flags >on a file that we copied, i.e., that we didn't create.)
|
1.5 |
| 09-Jan-1997 |
tls | kill use of register
|
1.4 |
| 02-Aug-1995 |
jtc | Don't remove the destination file if there is a write error. This is very bad if it is actually a device or fifo. POSIX.2 requires that a diagnostic message be written, the file descriptor be closed, and for cp to continue on with the rest of the files.
|
1.3 |
| 21-Mar-1995 |
cgd | convert to new RCS id conventions.
|
1.2 |
| 22-Sep-1994 |
mycroft | Merge 4.4-Lite version.
|
1.1 |
| 22-Sep-1994 |
mycroft | branches: 1.1.1; Initial revision
|
1.1.1.1 |
| 22-Sep-1994 |
mycroft | Import original 4.4-Lite version.
|
1.32.10.1 |
| 06-Nov-2007 |
matt | sync with HEAD
|
1.38.2.1 |
| 08-Feb-2011 |
bouyer | Sync with HEAD
|
1.40.2.2 |
| 22-May-2014 |
yamt | sync with head.
for a reference, the tree before this commit was tagged as yamt-pagecache-tag8.
this commit was splitted into small chunks to avoid a limitation of cvs. ("Protocol error: too many arguments")
|
1.40.2.1 |
| 17-Apr-2012 |
yamt | sync with head
|
1.41.6.1 |
| 19-Aug-2014 |
tls | Rebase to HEAD as of a few days ago.
|
1.42.6.1 |
| 03-Mar-2016 |
martin | Pull up following revision(s) (requested by nakayama in ticket #1096): bin/mv/mv.c: revision 1.44 bin/cp/utils.c: revision 1.43-1.44 lib/librumphijack/hijack.c: revision 1.112-1.115 usr.bin/touch/touch.c: revision 1.33 sbin/restore/tape.c: revision 1.68 sbin/restore/dirs.c: revision 1.51 Don't truncate at sub-microsecond while preserving timestamps.
One of motivation of this change is to make the behavior of test(1) -nt/ot with preserved copy (like cp -p) closer to the NetBSD 6. Of course whether full timestamps are kept or not depends also on underlying file system.
The ifdef added in mv(1) since existing ifdefs was our local change to compile it on solaris (though I couldn't test it): http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html
Fix the name of failed function in warning message.
Hijack utimensat(2) so that t_vfs test passes after cp(1)/mv(1) are changed to use the system call. Linux also has this system call, but not tested this on linux.
Also hijack futimens(2) so that t_sh test passes.
Define a generic ATCALL() and use it to implement utimensat() Make ATCALL() behave for absolute paths too.
|
1.42.4.2 |
| 06-Mar-2016 |
martin | Pull up following revision(s) (requested by mrg in ticket #1130): bin/cp/utils.c: revision 1.45 for display in the (post) SIGINFO handler use off_t not size_t for file sizes. fixes incorrect reporting errors on 32 bit platforms with >4GB file sizes.
|
1.42.4.1 |
| 03-Mar-2016 |
martin | Pull up following revision(s) (requested by nakayama in ticket #1096): bin/mv/mv.c: revision 1.44 bin/cp/utils.c: revision 1.43-1.44 lib/librumphijack/hijack.c: revision 1.112-1.115 usr.bin/touch/touch.c: revision 1.33 sbin/restore/tape.c: revision 1.68 sbin/restore/dirs.c: revision 1.51 Don't truncate at sub-microsecond while preserving timestamps.
One of motivation of this change is to make the behavior of test(1) -nt/ot with preserved copy (like cp -p) closer to the NetBSD 6. Of course whether full timestamps are kept or not depends also on underlying file system.
The ifdef added in mv(1) since existing ifdefs was our local change to compile it on solaris (though I couldn't test it): http://mail-index.netbsd.org/tech-userlevel/2014/11/28/msg008831.html
Fix the name of failed function in warning message.
Hijack utimensat(2) so that t_vfs test passes after cp(1)/mv(1) are changed to use the system call. Linux also has this system call, but not tested this on linux.
Also hijack futimens(2) so that t_sh test passes.
Define a generic ATCALL() and use it to implement utimensat() Make ATCALL() behave for absolute paths too.
|
1.45.16.4 |
| 21-Apr-2020 |
martin | Ooops, restore accidently removed files from merge mishap
|
1.45.16.3 |
| 21-Apr-2020 |
martin | Sync with HEAD
|
1.45.16.2 |
| 13-Apr-2020 |
martin | Mostly merge changes from HEAD upto 20200411
|
1.45.16.1 |
| 10-Jun-2019 |
christos | Sync with HEAD
|
1.45.14.1 |
| 28-Jul-2018 |
pgoyette | Sync with HEAD
|
1.46.2.1 |
| 23-Sep-2021 |
martin | Pull up following revision(s) (requested by skrll in ticket #1348):
bin/cp/utils.c: revision 1.47
PR/54564: Jan Schaumann: cp of a fifo yields an empty file
Don't short-circuit 0 sized stat entries if they don't belong to regular files.
Also don't try to mmap non-regular files.
|