Jim Meyering [Mon, 25 Mar 2002 09:53:07 +0000 (09:53 +0000)]
(age_of): Return -1 and 0 rather than 0 and 1.
Might as well keep it simple, and like bash.
(binary_operator): Fix bug with -nt and -ot, when one of the
files did not exist. We want to be compatible with the ksh93
documentation, and with Bash.
Jim Meyering [Mon, 25 Mar 2002 09:52:25 +0000 (09:52 +0000)]
(File characteristic tests): Document the
behavior of test -nt and -ot when one of the files does not exist,
using the same behavior that is documented in ksh93.
Jim Meyering [Sun, 17 Mar 2002 19:21:16 +0000 (19:21 +0000)]
(usage): Mention that --format=FORMAT must be
a *floating-point* format, also in description of that option.
(usage): Also add the `=' signs here: --format=FORMAT,
--separator=STRING.
Jim Meyering [Sun, 17 Mar 2002 16:00:54 +0000 (16:00 +0000)]
(copy_internal) [move_mode]: Give a better diagnostic
(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.
Jim Meyering [Sun, 10 Mar 2002 08:17:20 +0000 (08:17 +0000)]
* src/copy.c (copy_reg): Use a more concise diagnostic for
reporting replaced files. This avoids a bug in the code,
which mishandled ino_t wider than long.
* src/remove.c (remove_dir): Likewise, twice.
Jim Meyering [Fri, 8 Mar 2002 16:45:31 +0000 (16:45 +0000)]
Don't allow a malicious user to trick another user's rm process into
removing unintended files. In one scenario, if root is removing a
hierarchy that is writable by the malicious user, that user may trick
root into removing all of `/'. Reported by Wojciech Purczynski.
(remove_dir): After chdir `..', call lstat to get the
dev/inode of "." and fail if they aren't the same as the old numbers.
(remove_cwd_entries): New parameter, `cwd_dev_ino'.
(remove_dir): Likewise.
(rm): Likewise.
Adjust all callers.
Jim Meyering [Sun, 3 Mar 2002 22:30:06 +0000 (22:30 +0000)]
Make cp -r equivalent to cp -R. Add a new cp option --copy-contents
for people who want to emulate the traditional (and rarely desirable)
cp -r behavior.
(cp invocation): Document this.
Fix some related minor bugs: --no-dereference is no longer
equivalent to -d, and --archive (-a) can override the other
symlink options. Warn that cp -R is not portable on symbolic
links unless you also specify -P.
Jim Meyering [Sun, 3 Mar 2002 22:28:48 +0000 (22:28 +0000)]
(COPY_CONTENTS_OPTION): New enum value.
(long_opts): Add --copy-contents.
(usage): Describe new behavior. Sort options.
(main): Implement new behavior. Remove diagnostics for -a and -r;
no longer needed.
Jim Meyering [Sat, 2 Mar 2002 08:38:47 +0000 (08:38 +0000)]
(copy_reg): Detect abuse of a race condition
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.
Jim Meyering [Fri, 1 Mar 2002 23:57:21 +0000 (23:57 +0000)]
Include timespec.h.
(strftime, time, stime): Remove declarations; no longer needed.
(usage): Document %N.
(main): Use gettime rather than time to get the time of day,
so that we can get fractional times.
Similarly for settime and stime, so that we can set fractional times
(though this currently is not available to the user since we don't
parse fractional times; add FIXMES for that).
Check for gettime failures; e.g. this can occur if it
is past 2038 and we are a 32-bit app running on a 64-bit OS.
Get fractional part of file time stamps.
Do not falsely report failures just because time_t happens to be -1
(e.g. a file time stamp 1 second before the epoch).
(show_date): 2nd arg is now struct timespec, not time_t.
All uses changed. Use nstrftime rather than strftime, so that
we can format fractional seconds.