Age | Commit message (Collapse) | Author |
|
`mv a b' would not remove `a' in some unusual cases. Work around
this by unlinking `a' when necessary.
(same_file_ok): Add an output parameter.
Set it in the offending case.
(copy_internal): When necessary, unlink SRC_PATH and inform caller.
|
|
failure to create a hard link, do not remove the entry associating
the source dev/ino with the destination file name.
|
|
existing destination file, unlink that file and try again.
|
|
|
|
rename a directory, this code would never attempt to rename any
other file in that directory, but would thenceforth always copy.
On some systems (NetApp version ??), renaming a directory may fail
with EXDEV, yet renaming files within that directory to a newly-
created destination directory succeeds.
(copy_internal): Remove local, move_mode;
use x->move_mode instead. Based on a patch from Tom Haynes.
|
|
Patch by Alfred M. Szmidt.
|
|
`failed to preserve ...' to make the failure clearer.
|
|
(copy_internal): Preserve the stat.st_author field.
|
|
from gcc -W about comparison between signed and unsigned.
(copy_internal): Likewise, but use a cast.
|
|
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.
|
|
|
|
(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.
|
|
Instead, just skip it like the diagnostic says.
Reported by Paul Eggert.
|
|
reporting replaced files. This avoids a bug in the code,
which mishandled ino_t wider than long.
|
|
|
|
|
|
issue a warning that `cp -r' is not portable.
|
|
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.
|
|
|
|
(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>
|
|
(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.
|
|
(copy_internal): Update caller.
|
|
(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.
|
|
(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.
|
|
gcc-3.0 didn't complain.
|
|
(copy_internal): Don't use PATH_MAX.
Rewrite the symlink-copying code to use xreadlink.
|
|
(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.
|
|
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.
|
|
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.
|
|
file name, free the temporary `dst_path' allocated here.
|
|
Thank heavens for regression tests.
|
|
(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.
|
|
|
|
files (for which this makes sense), not just regular ones.
|
|
(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.
|
|
(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').
|
|
(copy_internal): Use UNWRITABLE.
|
|
--reply=... option.
|
|
if-block. This fixes a bug introduced by my 2001-08-06 change.
|
|
|
|
(full_write): Remove decl; not needed.
(copy_reg): Don't assume read and write size fits in int.
|
|
(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.
|
|
the caller (mv) doesn't remove the source file.
|
|
|
|
when copying (i.e., not in move mode) and not preserving permissions.
|
|
dir_name return value. That can't happen.
|
|
|
|
don't remove the symlink. Reported by David Luyer as Debian bug#82089,
via Michael Stone.
|
|
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.
|
|
across a partition boundary) to overwrite a non-directory with a directory.
|