summaryrefslogtreecommitdiff
path: root/src/copy.c
AgeCommit message (Collapse)Author
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
2000-12-28(same_file_ok): Use a single auto var forJim Meyering
tmp_dst_sb, instead of two static vars. Likewise for tmp_src_sb.
2000-12-25(same_file_ok): Remove declaration and set of unusedJim Meyering
variables: src_sb_no_link, dst_sb_no_link.
2000-09-22(copy_internal): Don't try to unlink directories whenJim Meyering
using --remove-dest with -R.
2000-09-09(copy_internal): Call chmod also if we've made theJim Meyering
preceding chown call and we're supposed to preserve some special permission bit(s) that would have been reset by chown. Reported by Greg Louis.
2000-09-09(SAME_OWNER, SAME_GROUP, SAME_OWNER_AND_GROUP): Define.Jim Meyering
(copy_internal): Avoid calling chown if we know it's not necessary.
2000-09-04Remove declaration of lstat, now that it's in copy.h.Jim Meyering
2000-09-04(same_file_ok): Hoist a test.Jim Meyering
2000-09-04factor out backup/same test, put it after if-else.Jim Meyering
2000-09-04(same_file_ok): factor some more. improve -- now passes all tests.Jim Meyering
checkpoint
2000-09-03(same_file_ok): New function, extracted from copy_internal,Jim Meyering
and partially rewritten. (copy_internal): Unlink destination file when unlink_dest_before_opening option is set, and when the source is neither a regular file nor a directory.
2000-08-27(copy_reg): New parameters: X and NEW_DST.Jim Meyering
Remove the SPARSE_MODE parameter. Update caller. Perform POSIX-mandated (for cp) open-with-O_WRONLY|O_TRUNC when the regular destination file exists; upon failure, unlink that existing file, then open again, but with O_WRONLY|O_CREAT. (copy_internal): `force' in not related to interactive; remove the conjunct. Remove the entire `else if (x->force)' block; justifying removal of the non-directory part is easy: POSIX requires we try to open an existing regular file, so we can't unlink it beforehand. The part that changes the mode on a directory to allow overwriting isn't necessary.
2000-08-27(copy_internal): Set `new_dst' when the move_mode rename fails,Jim Meyering
since we then unlink the destination file.
2000-08-27(copy_reg): Rename two goto labels.Jim Meyering
2000-08-20Declare lstat.Jim Meyering
(copy_dir): Set `xstat' member to lstat so that with `-H' we don't follow symlinks found via recursive traversal. Update uses of `dereference' to compare against new enum member names.
2000-08-18(DO_CHOWN): Do not make a special case for non-root.Jim Meyering
POSIX.2 requires that cp -p and mv attempt to set the uid of the destination file, even if you're not root. This affects behavior only on hosts that let you give files away via chmod.
2000-08-14(copy_reg): Move declaration of local, `n_read', intoJim Meyering
the scope where it's used. (copy_internal): In calling copy_reg, pass not the raw `src_mode', but the possibly-umask-relative mode, `get_dest_mode (x, src_mode)'.
2000-08-13(copy_reg): Add comment.Jim Meyering
2000-08-13(get_dest_mode): Rename from new_nondir_mode.Jim Meyering
Honor the umask for `cp', but not for `mv' or `cp -p'. (copy_reg): New 4th parameter, dst_mode. Pass it as 3rd arg. to open. (copy_internal): Change type of locals `src_mode' and `src_type' from int to mode_t. Remove unnecessary local `fix_mode'. Combine two if-stmts into one. Pass `src_mode' as 4th arg to copy_reg. If we've just created a new regular file, return early, skipping the chmod step. copy_reg now sets permissions of such files upon creation. Use get_dest_mode, so there's just one chmod call here.
2000-08-08(copy_dir, copy_internal): Invoke xalloc_die instead of printing our own ↵Jim Meyering
message.
2000-07-30(copy_internal): Quote the file names that are displayedJim Meyering
with --verbose and --backup.
2000-07-15Convert "`%s'" in format strings to "%s", and wrap eachJim Meyering
corresponding argument in a `quote (...)' call -- if there's only one. If there are more than one, then use `quote_n (0, ...), quote_n (1, ...), ...'.
2000-06-27(copy_dir): Don't set errno beforeJim Meyering
invoking savedir, and assume that errno is nonzero if savedir fails.
2000-06-25(copy_internal): Don't return return immediately after aJim Meyering
failed copy_dir call -- otherwise, the failure to read a single file in a source directory would cause the containing destination directory not to have owner/perms set properly. Reported by Piotr Kwapulinski.
2000-06-16(copy_reg): Give a slightly better diagnostic.Jim Meyering
2000-05-29Allow `cp -d -u' to copy one symlink onto another that's identical.Jim Meyering
(copy_internal): Change the || to ^ in the big sameness test, so copying one symlink onto another, identical one doesn't fail here. If the symlink call fails, don't report the failure if the destination already exists and is a symlink pointing to the proper name.
2000-05-12(copy_internal): Fix force and interactive tests.Jim Meyering
2000-02-05(copy_internal): Don't allow mv to move a directory ontoJim Meyering
a non-directory. Reported by Brian Kimball via Michael Stone.
2000-01-09This affects cp, install, and mv.Jim Meyering
(copy_internal): When making backup files in verbose mode, print the backup file name on the same line as the rest of the information, e.g., `a -> b (backup: b.~13~)' rather than on a line by itself.
1999-12-05Revert the previous change.Jim Meyering
(copy_internal): In move mode, if the rename attempt fails, then unlink any existing destination file. This makes a cross-device `mv' more consistent with the intra-device behavior. This change is required by POSIX to make a cross-device move act with semantics similar to those of the rename syscall. For example now `mv' can move a file onto a symlink to itself when that symlink is on a separate partition. With fileutils-4.0j, it would fail with a diagnostic saying they were the same file. Reported by Bruno Haible.
1999-12-04(copy_internal): Be consistent with intra-device behaviorJim Meyering
and *do* allow `mv' to move a file onto a symlink to itself when that symlink is on a separate partition. With fileutils-4.0j, it would fail with a diagnostic saying they were the same file. Reported by Bruno Haible.
1999-11-11(copy_internal): Treat src and dest as the `same' inJim Meyering
`mv src symlink-to-src' when src and dest are on different partitions. Otherwise, that `mv' command would silently remove `src'. Reported by Michael Stone.