summaryrefslogtreecommitdiff
path: root/src/copy.c
AgeCommit message (Collapse)Author
2006-03-12(set_author): Rename function, from preserve_author.Jim Meyering
2006-02-04(copy_internal): cp -RL no longer fails when encounteringJim Meyering
the same directory more than once in the hierarchy beneath a single command-line argument. That is legitimate, e.g. when there are two or more symbolic links, each pointing to some directory that would not otherwise be copied. Reported by Christophe LYON.
2006-01-02(set_owner): Correct a comment.Jim Meyering
2006-01-02Include lchmod.h.Paul Eggert
(copy_internal): Use lchmod rather than chmod.
2005-12-17(get_dest_mode): Remove; it is obsolete after removing umask_kill.Jim Meyering
(copy_reg, copy_internal): Use copy_acl and set_acl instead of fchown/chown. Fix the logic for POSIX ACLs. (chown_succeded): Remove; we now always copy acls and preserve S_ISUID, S_ISGID, and S_ISVTX when needed, no matter if we did a chown before or not.
2005-12-04(fchown) [!HAVE_FCHOWN]: Define fchown(...) to -1.Jim Meyering
(set_owner, preserve_author): New functions, factored out of copy_reg. (copy_reg): Use them. (copy_internal): Use them here, too. From Andreas Gruenbacher.
2005-11-24Improve performance a bit by optimizing awayPaul Eggert
unnecessary system calls and going to a block size of at least 8192 (on normal hosts, anyway). This improved performance 5% on my Debian stable host (2.4.27 kernel, x86, copying from root ext3 file system to itself). Include "buffer-lcm.h". (copy_reg): Omit last argument. All callers changed. Use xmalloc to allocate rather than trusting alloca (which is unwise with large block sizes). Declare locals more locally, if possible. Use uintptr_t words instead of int words, for a bit more speed when looking for null blocks on 64-bit hosts. Optimize away reads of zero bytes on regular files. In the typical case, insist on 8 KiB buffers, at least. Avoid unnecessary extra call to fstat when checking for sparse files. Avoid now-unnecessary cast to off_t, and "0L". Avoid unnecessary test of *new_dst when checking for same owner and group.
2005-09-25(HAVE_FCHMOD, HAVE_FCHOWN): Define to 0 if not defined.Paul Eggert
(copy_reg): New args CHOWN_SUCCEDED and DST_SB. All callers changed. Add a "goto close_src_and_dst_desc;" that was missing in the previous patch. (copy_reg) [HAVE_FCHOWN]: Prefer fchown to chown. (copy_reg) [HAVE_FCHMOD]: Prefer fchmod to chmod. (copy_internal): Don't invoke chown if fchown worked, and likewise for chmod and fchmod.
2005-09-23(copy_reg): Preserve time stamps ifPaul Eggert
x->preserve_timestamps is set, using futimens so that we needn't resolve the path again. (copy_internal): Don't preserve time stamps if copy_reg did it already.
2005-09-16Include stat-time.h, and use its functions instead of the obsoletePaul Eggert
TIMESPEC_NS macro.
2005-07-11(copy_reg): Always copy in binary mode.Paul Eggert
2005-07-03Include fcntl--.h, not unistd-safer.h.Paul Eggert
(copy_reg): Don't call fd_safer; no longer needed now that we include fcntl--.h.
2005-06-02Don't use "path" or "filename".Paul Eggert
2005-05-31(chown_privileges, chown_failure_ok): Mark as `extern'.Jim Meyering
This is a crutch so that `make distcheck's sc_tight_scope rule knows that they really are deliberately declared that way.
2005-05-31Port to Solaris 10's rules for whether programs can chown files.Paul Eggert
[HAVE_PRIV_H]: Include <priv.h>. (DO_CHOWN): Remove. Replaced by chown_failure_ok. All callers changed. (copy_internal): If chown failed, don't worry about what happened to the mode bits; they can't have changed. (chown_privileges, chown_failure_ok): New functions.
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-14Update FSF postal mail address.Jim Meyering
2005-05-10(abandon_move): Remove erroneous UNWRITABLE check.Jim Meyering
This makes `mv -i --reply=no f1 f2' work as expected (in not performing the move operation). But note that specifying `-i' after `--reply=no' does *not* work. Tiny patch from Vlada Macek.
2005-04-11Include unistd-safer.h.Paul Eggert
(copy_reg): Use fd_safer.
2005-03-28(copy_reg): Use NULL, not `0'.Jim Meyering
2005-03-15(copy_reg): Copy regular files in binary mode.Jim Meyering
2005-03-11Prompt once again for `mv -i A B' when A and B are hard linksJim Meyering
to the same file. This fixes a bug introduced by my 2003-04-04 (coreutils-5.0.1) change. (abandon_move): New function, factored out of copy_internal, now that this code is being used from two places. (copy_internal): Perform the same interactive-related test for whether it's alright to proceed and (usually) overwrite the destination file.
2005-03-01(copy_internal): Change test of source type from !S_ISREG to S_ISLNK.Jim Meyering
Reported by Paul Eggert in http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
2005-02-09 * src/copy.c (valid_options): Add an assertion thatJim Meyering
not both hard_link and symbolic_link are set.
2004-09-22(copy): Declare as `extern'.Jim Meyering
2004-09-13Adjust to backup enum rename.Paul Eggert
2004-08-11(copy_internal): When preserving links, unlinkPaul Eggert
a destination with link count greater than one. This is so that commands like "cp -a" don't get confused when copying into a destination that already contains many hard links.
2004-07-30(copy_internal, is_ancestor, copy_dir, copy_reg,Paul Eggert
same_file_ok, seen_file, copy_internal, valid_options, copy): Use bool when appropriate.
2004-07-27(copy_internal): find_backup_file_name no longerPaul Eggert
returns NULL, so don't bother to check for this.
2004-07-04(copy_internal): Add a FIXME comment.Jim Meyering
2004-07-04(copy_dir): Assume path_concat returns non-NULL.Jim Meyering
2004-06-30Use "file system" rather than "filesystem" in comments.Jim Meyering
2004-06-20Remove declaration of yesno.Jim Meyering
Instead, include yesno.h.
2004-06-14Remove declaration of euidaccess.Jim Meyering
Instead, include "euidaccess.h".
2004-06-01(copy_internal): Don't use alloca, as it can mess upJim Meyering
royally if the link length is long (e.g., GNU/Hurd). Use xreadlink instead, it's safer. Don't bother to read the link if it's the wrong size. Add a FIXME because this area is a bit murky and undocumented.
2004-04-27(dest_info_init, src_info_init, copy): Add `extern' keyword.Jim Meyering
2004-04-15Include getpagesize.h.Jim Meyering
(copy_reg): Align I/O buffers to page boundaries.
2004-04-12Include "utimecmp.h".Jim Meyering
(copy_internal): Compare time stamps using utimecmp rather than MTIME_CMP.
2004-03-12Sometimes, when source and destination partition are different,Jim Meyering
mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki. When moving a set of N hard-linked files between partitions, via two or more command line arguments where the command line argument containing the Nth link contains no other link to that same file, mv would mistakenly copy the file, rather than hard-linking it to the other(s). That happens because when the final link is processed, its link count has been reduced to 1 since the other links have been `copied' to the destination partition and the source links have been removed. (copy_internal): When in move mode, use the source dev/inode pair to look up destination name even when st_nlink == 1.
2004-03-06cp --sparse=always sparse-image-file.img /dev/hda1 couldJim Meyering
produce an invalid copy on the destination device. (copy_reg): Even with --sparse=always, try to make `holes' only if the destination is a regular file. Reported by Szakacsits Szabolcs.
2004-02-07Remove xstat function pointer member. The way it was used was notJim Meyering
portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static inline `stat' and `lstat' functions, thus making the tests of `xstat == lstat' in copy.c always fail. (copy_dir): Set `.dereference' member, not .xstat. (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'. Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'. (valid_options): Remove now-obsolete FIXME comments.
2004-01-04(copy_internal): Use ASSIGN_STRDUPA rather than alloca and strcpy.Jim Meyering
2003-11-02(copy_internal): Use `sizeof *var' rather than `sizeof EXPLICIT_TYPE'.Jim Meyering
The former is more maintainable and usually shorter.
2003-10-25(triple_hash, triple_hash_no_name): Adjust to reflectJim Meyering
type changes (unsigned int -> size_t) in hash.c.
2003-10-12(copy_internal): Don't #ifdef-out simple uses ofJim Meyering
S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined via system.h.
2003-09-28Remove unnecessary cast of alloca, since now it's guaranteed to be (void *).Jim Meyering
2003-09-09Alphabetize includes.Jim Meyering
Remove duplicate inclusion of "same.h".
2003-08-30When source and destination arguments refer to the same file, resideJim Meyering
on a partition (e.g. VFAT) on which distinct names may refer to the same directory entry (often due to variations in case), and when the link count for the file is 1, mv no longer unlinks the file. FIXME: this is a band-aid fix. If the file happens to have a link count of 2 or greater, mv will still unlink it. (same_file_ok): Invoke same_name (which might still return false for names that refer to the same directory entry) only if the link count is 2 or more.
2003-08-09Include utimens.h.Jim Meyering
(copy_internal): Set file timestamps with utimens, not utime.
2003-07-23Tweak comment: Solaris2.5.1 -> Solaris 2.5.1Jim Meyering