Jim Meyering [Tue, 22 Jun 2004 12:50:01 +0000 (12:50 +0000)]
Fix bug: GNU 'ls' didn't count columns correctly if user or group
names contained multibyte characters where the column count
differed from the byte count. This patch also corrects
some comments.
(format_user_or_group): New function, which counts columns correctly.
(format_user, format_group): Use it.
(format_user_or_group_width): New function, which counts columns correctly.
(format_user_width, format_group_width): Use it.
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.