Jim Meyering
fc64ba37d4
(copy_internal): Fix force and interactive tests.
2000-05-12 20:40:39 +00:00
Jim Meyering
e40b2aea74
(copy_internal): Don't allow mv to move a directory onto
...
a non-directory. Reported by Brian Kimball via Michael Stone.
2000-02-05 06:02:23 +00:00
Jim Meyering
efe3229edb
This affects cp, install, and mv.
...
(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.
2000-01-09 08:20:45 +00:00
Jim Meyering
f880990daf
Revert the previous change.
...
(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-05 15:13:21 +00:00
Jim Meyering
698fd02798
(copy_internal): Be consistent with intra-device behavior
...
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-12-04 17:21:47 +00:00
Jim Meyering
1b6c640f46
(copy_internal): Treat src and dest as the `same' in
...
`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.
1999-11-11 13:19:36 +00:00
Jim Meyering
6b32b53027
Use HAVE_STRUCT_STAT_ST_BLOCKS, not deprecated HAVE_ST_BLOCKS.
1999-11-05 09:55:24 +00:00
Jim Meyering
ca2cd27d3c
(copy_dir): Remove cast of savedir arg.
1999-08-08 10:14:45 +00:00
Jim Meyering
0e39b529b6
(copy_internal): Don't apply the umask in move_mode.
...
Otherwise, `mv' would not preserve the permissions when copying
between partitions. Reported by David Godfrey
1999-05-23 23:23:55 +00:00
Jim Meyering
645015312e
Remove today's earlier misguided attempts.
...
Add a single condition to the existing sameness test.
1999-05-23 20:37:16 +00:00
Jim Meyering
642d250781
Include same.h.
...
(copy_internal): Qualify SAME_INODE test with (link-count == 1
|| same_name(...)).
1999-05-23 19:45:33 +00:00
Jim Meyering
0868b5794a
(copy_internal): Make it so `mv -f FILE FILE' does not remove FILE.
...
Based on a patch from Chris Yeo.
1999-05-23 14:52:32 +00:00
Jim Meyering
25a8d1f1e9
(copy_internal): Move the one-file-system test so that
...
it follows the `if (new_dst || !S_ISDIR (dst_sb.st_mode))' block.
Prior to this change, `cp --one-file-system' would traverse a file-
system boundary if the destination directory existed.
From thospel@mail.dma.be .
1999-04-30 15:40:34 +00:00
Jim Meyering
40d99818ef
(copy_internal): Don't make `mv foo symlink-to-foo' fail.
...
That is, even though source and destination are `the same,' don't fail
if the destination is a symlink. From Peter Samuelson.
1999-04-30 15:15:02 +00:00
Jim Meyering
d1c7f62ba8
(copy_reg, copy_internal): Use proper mode_t types and macros.
...
Don't assume the traditional Unix values for mode bits.
1999-04-26 12:54:51 +00:00
Jim Meyering
07c6f5e387
update copyright dates
1999-02-16 04:14:17 +00:00
Jim Meyering
eaec7699ac
(copy_internal): Describe any backup-related renaming
...
operations when in verbose mode.
(copy_internal): Likewise.
Based on changes from Marty Leisner.
1999-01-31 15:12:43 +00:00
Jim Meyering
0e777744cb
(copy_internal): Handle two more values of errno from
...
failed rename of a directory into a subdirectory of itself.
1999-01-11 03:22:50 +00:00
Jim Meyering
e68c81a48f
(copy_internal): Remove errnoeous `%s: ' prefix
...
from format string. From Michiel Bacchiani.
1998-12-18 14:22:50 +00:00
Jim Meyering
52dedbfebb
Use dir_name, not dirname. Include dirname.h.
1998-12-07 06:20:50 +00:00
Jim Meyering
32df3704e4
(copy_internal): Remove earlier (but less effective)
...
test for move/copy-into-self.
Instead, deduce the move-into-self condition from errno==EINVAL
after a failed rename.
1998-11-30 02:10:13 +00:00
Jim Meyering
b7e1eadbf8
(copy_internal): Do honor `n' reply in move-mode.
...
Otherwise, `touch a b; echo n|mv -i a b' would remove b.
From Bernd Leibing.
1998-09-28 16:15:00 +00:00
Jim Meyering
80499598c1
(copy_internal): Don't preserve hard-linked directories
...
to avoid damaging the destination filesystem when copying from a
Netapp snapshot directory. With code from Kjetil Torgrim Hollstein
and Paul Eggert.
1998-09-27 02:57:29 +00:00
Jim Meyering
0d33861999
(copy_internal) [one-file-system]: Do copy mount point
...
directories (but none of their entries). This makes
`cp --one-file-system' work the same way tar does.
From Marty Leisner.
1998-08-15 21:16:34 +00:00
Jim Meyering
9fc5987250
(copy_internal): Compare time stamps with subsecond resolution if available.
1998-08-02 16:23:28 +00:00
Jim Meyering
3ba948db7e
(SAME_INODE): Remove definition.
1998-07-25 15:30:08 +00:00
Jim Meyering
a97f821233
(copy_internal): Add another exclusion from the
...
sameness test: when --force has been specified, the destination
is unlinked before any copy.
(copy_internal): Add yet another: when both src and dest are symlinks.
1998-07-19 04:14:52 +00:00
Jim Meyering
345c323ffd
(copy_internal): Rename variable and reverse sense of tests
...
to make the code a little clearer.
1998-07-03 23:56:44 +00:00
Jim Meyering
698a43f363
(SAME_INODE): New macro.
...
Use it to replace open-coded equivalents.
1998-07-03 20:57:31 +00:00
Jim Meyering
def9c2bf0b
(copy_internal): Try harder identifying a relative
...
symbolic link in the current directory.
From Andreas Schwab.
1998-07-03 20:32:37 +00:00
Jim Meyering
184870f9bb
(copy_internal): Don't skip test for same file if creating a hardlink
...
from symlink over a non-symlink while making backups.
1998-07-03 20:06:50 +00:00
Jim Meyering
6ccae5e2d8
(copy_internal): Don't call chown on a symlink.
1998-07-03 19:57:42 +00:00
Jim Meyering
6ae99a4290
(copy_internal): Fix it so hard-link test is no longer hidden inside
...
big if-(backup_type == none) block.
1998-06-27 22:09:45 +00:00
Jim Meyering
9d9fef5595
(copy_reg): Detect identical source and dest here.
...
(copy_internal): Make the test symmetric.
1998-06-27 20:44:23 +00:00
Jim Meyering
15aac9a45d
(copy_internal): Plug a small leak.
1998-05-13 03:47:02 +00:00
Jim Meyering
21ae3d911c
(copy_internal): Use new move_mode member.
...
Add parameter.
(copy): Add parameter.
1998-05-11 04:06:22 +00:00
Jim Meyering
8a0a50e6b0
(new_nondir_mode): New function. Use where appropriate.
...
Use more-specific preserve_* members in place of removed `preserve'.
(copy_internal): Honor failed_unlink_is_fatal.
1998-05-10 12:18:21 +00:00
Jim Meyering
c157e5fbef
Add copyright.
1998-03-28 14:56:49 +00:00
Jim Meyering
6684ffa826
Use #if, not #ifdef with HAVE_ macros.
...
Use #if !, not #ifndef with HAVE_ macros.
1998-03-15 17:54:50 +00:00
Jim Meyering
347db9ce77
(copy_dir): Add new parameter, copy_into_self, and set it.
...
(copy_internal): Likewise.
(copy): Likewise.
Update all callers.
1998-03-13 23:37:42 +00:00
Jim Meyering
0eba2a8dd7
(DO_CHOWN): Don't fail for non-root when chown fails due
...
not only to lack of permission (EPERM), but also to lack of support
(EINVAL). Reported by Bengt Martensson.
1998-01-25 09:28:48 +00:00
Jim Meyering
9cdd2e05e6
(copy_internal): Use x->backup_type, not the global.
...
(valid_options): Use VALID_BACKUP_TYPE and VALID_SPARSE_MODE.
1998-01-22 08:22:00 +00:00
Jim Meyering
c9f538deb9
(copy_internal): Use S_ISLNK only if defined.
1997-12-25 16:48:29 +00:00
Jim Meyering
03f9f3dbec
s/__P/PARAMS/g
1997-12-16 15:32:32 +00:00
Jim Meyering
b8c474191a
(copy_reg): Store file size as off_t, not long.
...
Do not assume st_size has been normalized to 512 byte blocks,
or that it fits in size_t after dividing by the blocksize.
1997-11-30 10:24:50 +00:00
Jim Meyering
b74c9a14fd
(copy_dir): Use path_concat rather than open-coding it.
1997-11-12 17:18:55 +00:00
Jim Meyering
df445b0891
Remove old-style xmalloc and xrealloc decls.
1997-10-25 22:03:55 +00:00
Jim Meyering
eae64f3a4f
Remove stpcpy decl.
1997-10-23 16:04:47 +00:00
Jim Meyering
48f0a08332
fix braino
1997-10-06 05:23:49 +00:00
Jim Meyering
fe12b67113
(copy_internal): Use require_preserve.
1997-10-06 04:57:40 +00:00