summaryrefslogtreecommitdiffstats
path: root/bin/cp
Commit message (Collapse)AuthorAgeFilesLines
* MFC r284105,r284106,r284163:bdrewery2015-12-044-71/+98
| | | | | | | | | | | | r284105: Cleanup some indentation issues. r284106: Implement '-s' to copy as symlink, similar to the current -l link(2) handling. r284163: Cleanup some style(9) issues. Relnotes: yes
* MFC r282482: cp: Remove fts sorting.jilles2015-05-141-28/+1
| | | | | | | | | | | | | | | | | | | | | In an attempt to improve performance, cp reordered directories first (although the comment says directories last). This is not effective with new UFS layout policies. The sorting reorders multiple arguments passed to cp, which may be undesirable. Additionally, the comparison function does not induce a total order. Per POSIX, this causes undefined behaviour in qsort(). NetBSD removed the sorting in 2009. On filesystems that return directory entries in hash/btree order, sorting by d_fileno before statting improves performance on large directories. However, this can only be implemented in fts(3). PR: 53475 Reviewed by: bde (in 2004)
* Add a few examples.joel2013-03-151-1/+22
| | | | Obtained from: OpenBSD
* Return with an error from copy_link(), copy_fifo() and copy_special() ifmarkj2013-01-271-0/+17
| | | | | | | | the -n option is specified and the destination file exists. PR: bin/174489 Approved by: rstone (co-mentor) MFC after: 2 weeks
* Return "failure" as we do for 'cp -i' and a "n" answer.obrien2013-01-231-1/+1
| | | | | | Otherwise with '-v' we print out the file name as if it was copied: /tmp/2gb-card/M0132.CTG not overwritten /mnt/DCIM/CANONMSC/M0132.CTG -> /tmp/2gb-card/M0132.CTG
* Remove useless variable 'Pflag':eadler2013-01-171-7/+5
| | | | | | | -P is an alternative to -H and -L, and it is implemented using the Hflag and Lflag variables. Approved by: cperciva MFC after: 3 days
* Explicitly mention that "cp -p" copies ACLs.trasz2012-09-041-2/+2
| | | | | PR: docs/168962 MFC after: 1 month
* Don't try to copy a socket after "xxx is a socket (not copied)." message.trasz2010-06-051-0/+1
| | | | | | | | | Previously, it would either try to copy it anyway and fail (without -R), or create fifo instead of the socket (with -R). Found with: Coverity Prevent CID: 5623 MFC after: 2 weeks
* Change all our own code to use st_*tim instead of st_*timespec.ed2010-03-281-2/+2
| | | | Also remove some local patches to diff(1) which are now unneeded.
* Implement an "-x" option to cp(1), for compatibility with Linux andgavin2010-01-173-7/+12
| | | | | | | | | | | | feature parity with du(1) and similar: When set, cp(1) will not traverse mount points. Initial patch by: Graham J Lee leeg teaching.physics.ox.ac.uk PR: bin/88056 Initial patch by: Graham J Lee leeg teaching.physics.ox.ac.uk Approved by: ed (mentor) MFC after: 1 month
* Add NFSv4 ACL support to cp(1) and fix a few memory leaks.trasz2009-09-021-30/+93
| | | | | | | | | Note that this changes error reporting behaviour somewhat - before, no error was reported if ACL couldn't be copied because the target filesystem doesn't support ACLs. Now, it will be reported - of course, only if there actually is an ACL to copy. Reviewed by: rwatson
* Preserve file flags on symlinks in cp -Rp.jilles2009-05-301-1/+1
| | | | | | | | | This reported ENOSYS before. PR: bin/111226 (part of) Submitted by: Martin Kammerhofer Approved by: ed (mentor) MFC after: 3 weeks
* Make 'struct acl' larger, as required to support NFSv4 ACLs. Providetrasz2009-05-221-1/+1
| | | | | | compatibility interfaces in both kernel and libc. Reviewed by: rwatson
* Teach cat(1) and cp(1) to use a larger buffer if enough memory is presentivoras2008-10-301-2/+29
| | | | | | | | | | | | | | | | | | | | | in the system. A simple heuristics is used to detect what is "enough" memory: if number of physmem pages is greater than 32k (equalling 128 MB on machines with 4 kB pages). Typical immediate result of these changes is reduction in context switches and the goal is to increase efficiency by using large buffers: before: /usr/bin/time -hlp cat file1 > file2 ... 163 voluntary context switches 11194 involuntary context switches after: /usr/bin/time -hlp ./cat file1 > file2 ... 417 voluntary context switches 272 involuntary context switches Reviewed by: hackers@ (no objections to earlier version of cat patch) Approved by: gnn (mentor) MFC after: 4 months
* Add fallback when mmap fails on regular files. Some filesystems,dds2008-10-271-30/+28
| | | | | | | like smbnetfs, do not support mmap. Reported by: Harti Brandt MFC after: 1 month
* Remove redundant close(2).trasz2008-09-091-1/+0
| | | | | Submitted by: kensmith Approved by: rwatson (mentor)
* Fix ACL preservation, apparently broken in 1.47.trasz2008-08-071-1/+3
| | | | | Approved by: rwatson MFC after: 3 weeks
* Add an '-a' option which is identical to specifying '-RpP' forjhb2008-03-103-5/+15
| | | | | | compatibility with other implementations. MFC after: 1 month
* As suggested, replace earlier changed warnx() / exit() with an errx()edwin2007-12-261-4/+3
| | | | Submitted by: Peter Jeremy <peterjeremy@optushome.com.au>
* When copying multiple files to a directory, make sure that a properedwin2007-12-251-1/+1
| | | | | | | | | warning is given when the directory doesn't exist. PR: bin/50656 Submitted by: Edwin Groothuis <edwin@mavetju.org> Approved by: grog@ Not reviewed by: grog@
* Fix typo.ceri2006-11-021-1/+1
|
* Wording nits.trhodes2006-10-271-11/+7
|
* Flesh out the compatibility section a little bit. Bump doc date.trhodes2006-10-241-30/+20
|
* Fix style(9) bugs in previous commit.trhodes2006-10-111-7/+4
| | | | Lesson from: bde
* Make -r a synonym for -R, similar to behavior on Linux while being backwardstrhodes2006-10-072-14/+41
| | | | | | | | compatible with old -r behavior with regards to -L. You can now copy fifos and other special files with -r. Reviewed by: -standards (long ago), das, bde Approved by: bde (recently)
* o Style(9).maxim2006-10-071-9/+7
| | | | Submitted by: bde
* o Avoid division by zero.maxim2006-10-071-3/+8
| | | | | | o Place error checking code near to the syscall. Submitted by: bde
* o Hold copied bytes counter in off_t. This prevents statisticsmaxim2006-10-061-1/+1
| | | | | | | | displayed by SIGINFO handler from overflow. PR: bin/104039 Submitted by: Geoffrey Giesemann MFC after: 2 weeks
* Move the -l option processing to where it belongs.ru2006-09-291-4/+4
| | | | Overall still not kosher but better matches style(9).
* - Fix options order.ru2006-08-252-7/+7
| | | | - Touch manpage's document date.
* Remove a stray -a option that probably sneaked in from julian'sru2006-08-251-2/+2
| | | | attempt to enter append mode twice in vi(1). :-)
* Add an option to allow copying of a hierarchy while linking he regular files.julian2006-08-244-82/+105
| | | | | | Bikeshedded to death on: hackers Submitted by:andersonatcenttech.com MFC in: 1 month
* o Call fts_close() before exit.maxim2006-07-041-0/+1
| | | | Obtained from: NetBSD, Coverity ID 1754
* Attempt to complete the userspace integration of POSIX.1e extended ACLs.csjp2005-09-053-1/+86
| | | | | | | | | | | | | | This includes adding support for ACLs into cp(1) and mv(1) userspace utilities. For mv(1), if _PC_ACL_EXTENDED is in effect for the source AND destination operands, the destination file's ACLs shall reflect the source. For cp(1), if _PC_ACL_EXTENDED is in effect for both source and destination operands, and -p has been specified, the ACLs from the source shall be preserved on the destination. MFC after: 1 month
* Fix a few markup nits in previous commit.trhodes2005-02-251-1/+3
| | | | Noticed by: ru, who else? :)
* Note how cp(1) handles directories ending in "/."trhodes2005-02-241-1/+5
| | | | | PR: 75774 Submitted by: Mike Meyer <mwm@mired.org> (original version)
* Sync program's usage() with manpage's SYNOPSIS.ru2005-02-091-2/+3
|
* Add the new standard EXIT STATUS section where appropriate.ru2005-01-161-1/+1
| | | | Sort standard sections in the (documented) preferred order.
* /*- or .\"- or #- to begin license clauses.imp2005-01-102-1/+2
|
* Mechanically kill hard sentence breaks.ru2004-07-021-1/+2
|
* Plug file descriptor leak in implementation of -n option.tjr2004-06-051-0/+1
|
* Remove clause 3 from the UCB licenses.markm2004-04-064-16/+0
| | | | OK'ed by: imp, core
* Don't mmap(2) and munmap(2) zero-length files.alc2003-11-131-1/+2
| | | | Submitted by: Wiktor Niesiobedzki <bsd@w.evip.pl>
* pass -1 to setfile in cp.cjmg2003-06-301-1/+1
| | | | Submitted by: Jun Kuriyama
* support saving both user/group and permissions on symlinks (from PR)jmg2003-06-221-13/+20
| | | | | | | | also fix a slight bogon that assumed an fd of 0 was not valid. Changed it to be -1. PR: bin/25017 Submitted by: Martin Kammerhofer
* Clarify what -p option does.ru2003-06-071-11/+12
| | | | | | Prodded by: marcel While here, spell the "set-{user,group}-ID bit" correctly.
* Quiet warnings about copyright[].obrien2003-05-011-2/+2
|
* Include <signal.h> instead of depending on namespace pollution inbde2003-04-131-1/+2
| | | | | <sys/param.h>. Include <sys/types.h> instead of of <sys/param.h> so that further such dependencies don't develop.
* Fixed some style bugs in rev.1.44.bde2003-04-131-3/+2
|
* Use the correct data type and qualifier for signal flag.mdodd2003-04-072-2/+2
|
OpenPOWER on IntegriCloud