Jim Meyering [Mon, 21 Jun 2004 15:03:35 +0000 (15:03 +0000)]
(main): Standardize on the diagnostics given when someone gives
too few operands ("missing operand after `xxx'") or
too many operands ("extra operand `xxx'").
Include "quote.h" and/or "error.h" if it wasn't already being included.
Jim Meyering [Mon, 21 Jun 2004 15:02:28 +0000 (15:02 +0000)]
Standardize on the diagnostics given when someone gives
too few operands ("missing operand after `xxx'") or
too many operands ("extra operand `xxx'").
Include "quote.h" and/or "error.h" if it wasn't already being included.
(do_copy): Likewise.
Jim Meyering [Mon, 21 Jun 2004 15:02:14 +0000 (15:02 +0000)]
Standardize on the diagnostics given when someone gives
too few operands ("missing operand after `xxx'") or
too many operands ("extra operand `xxx'").
Include "quote.h" and/or "error.h" if it wasn't already being included.
(add_file_name, main): Likewise.
Jim Meyering [Mon, 21 Jun 2004 15:01:54 +0000 (15:01 +0000)]
Standardize on the diagnostics given when someone gives
too few operands ("missing operand after `xxx'") or
too many operands ("extra operand `xxx'").
Include "quote.h" and/or "error.h" if it wasn't already being included.
(beyond, main): Likewise.
Jim Meyering [Sun, 20 Jun 2004 06:49:42 +0000 (06:49 +0000)]
(print_line): Don't truncate user names at 8 bytes.
Problem reported by Guido Leenders in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
Jim Meyering [Sat, 19 Jun 2004 09:23:52 +0000 (09:23 +0000)]
(case_GETOPT_VERSION_CHAR): Switch back to using GNU_PACKAGE (from
PACKAGE) once again. This restores `GNU' to the parenthesized package
name in --version output. Before, the first argument from AC_INIT,
`GNU coreutils', would be propagated to the PACKAGE variable. Now,
`GNU ' is trimmed. Reported by Richard Stallman.
Jim Meyering [Tue, 15 Jun 2004 18:04:13 +0000 (18:04 +0000)]
(main): Recognize --help, --version even if
POSIXLY_CORRECT. POSIX does not specify any options, but it
does not prohibit options either, so "unlink" is like "expr" here.
Jim Meyering [Tue, 15 Jun 2004 18:00:35 +0000 (18:00 +0000)]
(print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
since POSIX says the behavior is unspecified here.
(main): Recognize --help, --version even if
POSIXLY_CORRECT. POSIX does not specify any options, but it
does not prohibit options either, so "printf" is like "expr" here.
Jim Meyering [Tue, 15 Jun 2004 18:00:03 +0000 (18:00 +0000)]
(decode_switches): Pay attention to TABSIZE even if POSIXLY_CORRECT
is set. POSIX reserves upper-case environment variables to the
implementation, so it's OK for ls to depend on TABSIZE.
Jim Meyering [Sun, 13 Jun 2004 22:03:07 +0000 (22:03 +0000)]
(PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
(UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
as (sizeof "??") reliably returns 3.
(print_line): Guard against idle and pid being too long
(which is possible when printing headers).
(print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
Avoid unnecessary cast of sizeof to int.
(make_id_equals_comment): Do not assume that UT_ID returns
a string; it might return a non-null-terminated array.
Use strncat instead. It's not very often where strncat is
exactly what you want, but this is one of those rare cases.
Jim Meyering [Wed, 9 Jun 2004 13:37:52 +0000 (13:37 +0000)]
Adjust chmod and chown to be similar if -c or -v are given. In
particular, a no-op chown is no longer reported as a change; this
reverts to previous behavior. Also, fix both commands so that -v
report failures even if the failure is not due to the chmod or
chown syscalls.
* src/chown-core.c (change_file_owner): Return -1 on error, not
1 sometimes and -1 on others. Our caller ORs together our results,
and (-1 | 1) == 0 on ones-complement hosts.
With -v report all errors verbosely, not just some.
Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
file_stats wasn't set properly in that case.
Jim Meyering [Wed, 9 Jun 2004 09:05:02 +0000 (09:05 +0000)]
Adjust chmod and chown to be similar if -c or -v are given. In
particular, a no-op chown is no longer reported as a change; this
reverts to previous behavior. Also, fix both commands so that -v
report failures even if the failure is not due to the chmod or
chown syscalls.
* src/chmod.c (CH_NOT_APPLIED): New constant.
(describe_change): Handle it.
(process_file): Use it, if a symlink wasn't changed.
(mode_changed): Return bool, not int. Accept new argument
NEW_MODE; all callers changed. This lets us avoid statting the
file unless the new mode has unusual bits.
(process_file): Return -1 on error. With -v, report all errors
verbosely, not just some.
Jim Meyering [Tue, 8 Jun 2004 16:58:28 +0000 (16:58 +0000)]
Test that chgrp -h does not fail on
symlinks, even on hosts where that's not supported.
Test that if -R is specified without -H or L, -h is assumed.
Test that chown() is not optimized away.
Jim Meyering [Tue, 8 Jun 2004 15:25:59 +0000 (15:25 +0000)]
Do not attempt to combine -h and -H; these
options are incompatible, and their behavior is undefined with POSIX.
(changed, not_changed): Adjust to match the fact that -h is no longer
specified. Sort names.
Jim Meyering [Tue, 8 Jun 2004 15:25:45 +0000 (15:25 +0000)]
Use chown --from to discover whether the
group changed, since chgrp now changes unconditionally. This
complicates the sed script a bit. Do not specify --dereference,
since it's the default (and we want to test this). Adjust output
to match the fact that chgrp no longer optimizes the case of
changing a file's group to the same value as before.
Jim Meyering [Tue, 8 Jun 2004 14:57:57 +0000 (14:57 +0000)]
(change_file_owner): Use ent->fts_statp only if
needed. Chown a directory only after chowning its children; this
avoids problems if the new directory ownership doesn't permit
access to the children. Dereference symlinks before doing
ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
Do not optimize away the chown() system call when the file's owner
and group already have the desired value. POSIX does not permit
this optimization. Rely on chown and lchown to do the right
thing with symlinks and/or -1 arguments, now that we have wrappers
to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
errors, not just command-line errors.
(chown_files): Pass FTS_STAT to xfts_open if we don't need file status.
Jim Meyering [Tue, 8 Jun 2004 13:40:00 +0000 (13:40 +0000)]
(main): Check for incompatible options. -R --dereference
requires either -H or -L, and -R -h requires -P. If -H, specify
FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
file as much like chown.c as possible.
Jim Meyering [Tue, 8 Jun 2004 13:37:40 +0000 (13:37 +0000)]
(main): Check for incompatible options. -R --dereference
requires either -H or -L, and -R -h requires -P. If -H, specify
FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
file as much like chgrp.c as possible.