summaryrefslogtreecommitdiff
path: root/src/copy.c
AgeCommit message (Collapse)Author
2002-06-21Include hurd.h.Jim Meyering
(copy_internal): Preserve the stat.st_author field.
2002-05-30(copy_reg): Use a temporary to avoid a warningJim Meyering
from gcc -W about comparison between signed and unsigned. (copy_internal): Likewise, but use a cast.
2002-03-30(copy_internal): Move the block that sets `earlier_file'Jim Meyering
down to just before the first use of that variable. Otherwise, it was possible to make mv (and probably cp, too) malfunction when copying hard-linked files into a directory containing at least one of the source file names. Call forget_created everywhere thereafter where this function returns without creating a destination file that might subsequently be linked. Reported by Iida Yosiaki.
2002-03-19use only one space after semicolonJim Meyering
2002-03-17(copy_internal) [move_mode]: Give a better diagnosticJim Meyering
(using errno from the failed unlink) when a cross-device `mv' fails, e.g., because the destination cannot be unlinked. Prompted by a report from Karl Berry.
2002-03-10(copy_reg): Don't exit upon finding a replaced file.Jim Meyering
Instead, just skip it like the diagnostic says. Reported by Paul Eggert.
2002-03-10(copy_reg): Use a more concise diagnostic forJim Meyering
reporting replaced files. This avoids a bug in the code, which mishandled ino_t wider than long.
2002-03-03(copy_internal): Remove -r warning; no longer needed.Jim Meyering
2002-03-02add a commentJim Meyering
2002-03-02(copy_internal): For each symlink copied by cp -r,Jim Meyering
issue a warning that `cp -r' is not portable.
2002-03-02(copy_reg): Detect abuse of a race conditionJim Meyering
whereby an unprivileged user could gain read access to otherwise- inaccessible files when root uses cp or mv to copy a hierarchy belonging to that user.
2002-02-26tweak commentJim Meyering
2002-01-12(copy_reg): Don't treat errno==ENOENT as a special case.Jim Meyering
(same_file_ok): Detect a case that would have lead to the errno==ENOENT condition above (and a misleading diagnostic), and return 0 so we give a diagnostic about the source and destination being the same file. (copy_internal): Use an explicit test for errno==EXDEV to detect that rename has failed because source and destination are on different devices. This reverts part of a change from 1997-12-13, and is to avoid letting a race condition evoke a bogus diagnostic. Note that while POSIX has encouraged the errno==EXDEV test for years, it was inadequate back in 1997. I'm hoping that many more systems have conforming support these days. Reported by Michael Gaughen <mgaughen@polyserve.com>
2001-11-22(triple_hash_no_name): New function.Jim Meyering
(src_info_init): New function. (copy_internal): Warn and return early for the second and subsequent occurrences of the same source file named on the command line.
2001-11-22(seen_file): Change type of `stats' parameter to pointer.Jim Meyering
(copy_internal): Update caller.
2001-11-22(struct F_triple): Rename from dest_info.Jim Meyering
(seen_file): Rename from seen_dest. Rename parameters accordingly. (record_file): Rename from record_dest. Rename parameters accordingly. (triple_hash): Rename from dest_info_hash. (triple_compare): Rename from dest_info_compare. (triple_free): Rename from dest_info_free.
2001-11-22copy.c shouldn't maintain static state.Jim Meyering
(dest_info): Remove declaration of file-scoped global. (dest_info_init): Require a parameter. Update all callers. (seen_dest): Require a hash table parameter. Update callers. (record_dest): Likewise.
2001-10-21yikes. put the preserve_metadata assignment *after* declarations.Jim Meyering
gcc-3.0 didn't complain.
2001-10-21Include xreadlink.h.Jim Meyering
(copy_internal): Don't use PATH_MAX. Rewrite the symlink-copying code to use xreadlink.
2001-10-18(dest_info_free): New function.Jim Meyering
(dest_info_init): Make the hash table code use it. (record_dest): Store each DEST in malloc'd memory. Hence the above. Use dest_info_free to free the `ent' we couldn't insert.
2001-10-13(copy_internal): Tighten up and add commentsJim Meyering
describing the test for when to record (via remember_copied) a <dst_path, source_dev, source_ino> triple. Relax the test that guards the hard-linked-dir check and the hard-link-preserving code.
2001-10-13* src/copy.h (struct cp_options): Rename members:Jim Meyering
s/preserve_owner_and_group/preserve_ownership/, and s/preserve_chmod_bits/preserve_mode/. * src/copy.c, src/cp.c, src/install.c, src/mv.c: Update all uses.
2001-10-07(copy_dir): Now that remember_copied copies theJim Meyering
file name, free the temporary `dst_path' allocated here.
2001-10-06(record_dest): Fix test for whether to free `ent'.Jim Meyering
Thank heavens for regression tests.
2001-10-06(record_dest): Avoid a small leak.Jim Meyering
(copy_internal): Call remember_copied only for if the source file has 1 < st_nlink, or if it's a directory. Now that EARLIER_FILE is set conditionally, initialize it to NULL.
2001-10-05Include hash-pjw.h and remove definition of hash_pjw.Jim Meyering
2001-09-29(copy_internal): Call record_dest for all types ofJim Meyering
files (for which this makes sense), not just regular ones.
2001-09-28Include "hash.h" and "same.h".Jim Meyering
(struct Dest_info): Define. (dest_info): Declare global. (DEST_INFO_INITIAL_CAPACITY): Define. (hash_pjw): New function. (dest_info_hash): Likewise. (dest_info_compare): Likewise. (dest_info_init): Likewise. (seen_dest): Likewise. (record_dest): Likewise. (copy_internal): If the destination exists, fail if it's in the set of files that have already been created as part of this mv or cp. (copy_internal) [move_mode]: Record the destination dev/ino/filename. (copy_internal) [!move_mode, regular file]: Likewise.
2001-09-22Mostly clean-up (modulo the better diagnostic).Jim Meyering
(copy_internal): Rename parameter, move_mode, to command_line_arg, and adjust caller. Now, move_mode is a local that is derived from command_line_arg. Factor some involved code to produce something slightly more readable. Use x->move_mode, not move_mode in determining which diagnostic to give (`backing up %s would destroy source; %s not moved').
2001-09-15(UNWRITABLE): Define (factored out of copy_internal).Jim Meyering
(copy_internal): Use UNWRITABLE.
2001-09-15(copy_internal) [move_mode]: Support the newJim Meyering
--reply=... option.
2001-09-08(copy_internal): Add braces around now-multi-stmtJim Meyering
if-block. This fixes a bug introduced by my 2001-08-06 change.
2001-08-31(copy_dir): Remove st_size argument.Jim Meyering
2001-08-31Include full-write.h.Jim Meyering
(full_write): Remove decl; not needed. (copy_reg): Don't assume read and write size fits in int.
2001-08-13(overwrite_prompt): New function.Jim Meyering
(copy_internal): Separate the mv-specific and non-move_mode code that determines whether to prompt the user. [move_mode]: Don't make mv fail (i.e. don't return 1) just because the user declined to remove one or more of the files.
2001-08-06(copy_internal): Set *rename_succeeded, so thatJim Meyering
the caller (mv) doesn't remove the source file.
2001-07-08revert unrelated part of last delta -- coming soon with a separate log entryJim Meyering
2001-07-08(get_dest_mode): Clear set-user-ID and set-group-ID bitsJim Meyering
when copying (i.e., not in move mode) and not preserving permissions.
2001-05-12(copy_internal): Remove the code that tested for NULLJim Meyering
dir_name return value. That can't happen.
2001-01-13add comment to go along with last changeJim Meyering
2001-01-13(same_file_ok): When moving a symlink onto itself,Jim Meyering
don't remove the symlink. Reported by David Luyer as Debian bug#82089, via Michael Stone.
2001-01-10(copy_internal): Add a comment.Jim Meyering
Set *copy_into_self in the new code that detects that. Make diagnostic more consistent: s/won't/will not/. [move_mode, copy_into_self]: Give a diagnstic here, now that we have the top_level_* globals. Remove the corresponding diagnostic from mv.c. Add a FIXME comment.
2001-01-10(copy_internal): Don't allow cp (or mv, when workingJim Meyering
across a partition boundary) to overwrite a non-directory with a directory.
2001-01-09add commentJim Meyering
2001-01-09(top_level_src_path, top_level_dst_path): New globals.Jim Meyering
(copy_internal): Use them. (copy): Set them.
2000-12-31Avoid an unnecessary `stat' when using --dereference.Jim Meyering
(same_file_ok): Use stat only if lstat reported that the file was a symbolic link.
2000-12-28tweak commentJim Meyering
2000-12-28tweak commentJim Meyering
2000-12-28(same_file_ok): Fix *another* typo from my 2000-09-03 change: ↵Jim Meyering
s/tmp_dst_sb/tmp_src_sb/.
2000-12-28(same_file_ok): Fix typo from my 2000-09-03 change: s/tmp_dst_sb/tmp_src_sb/.Jim Meyering