Fix a bug in how the LS_COLORS ln=target attribute is handled.
[coreutils/bo.git] / ChangeLog-2005
blob4ec81dc4233185a3574b480c56891bbcff4d6fe8
1 2005-10-22  Jim Meyering  <jim@meyering.net>
3         * Version 5.92.
5         * configure.ac: Remove -cvs suffix from version string.
6         * NEWS: Add today's date.
8         * tests/mkdir/writable-under-readonly: New test, neither run
9         nor distributed via tarballs.
11 2005-10-20  Jim Meyering  <jim@meyering.net>
13         * tests/chmod/octal: New file/test, to exercise today's
14         lib/modechange.c fix.
15         * tests/chmod/Makefile.am (TESTS): Add octal.
16         * NEWS: Mention this chmod fix as well as the dircolors one.
18 2005-10-18  Paul Eggert  <eggert@cs.ucla.edu>
20         * src/dircolors.c (append_quoted): Quote ' correctly.
21         Problem reported by Eric Blake.
23 2005-10-19  Jim Meyering  <jim@meyering.net>
25         * tests/dircolors/simple (quote): Add test for the above fix.
27 2005-10-18  Jim Meyering  <jim@meyering.net>
29         * tests/chgrp/basic: Add a comment explaining (probably) why this
30         test fails on OpenBSD 3.2 when run in an NFS-mounted directory.
32 2005-10-17  Jim Meyering  <jim@meyering.net>
34         * configure.ac: Use 5.92-cvs as the version string.
35         * NEWS: Adjust accordingly.
37         * Makefile.maint (my-distcheck): Depend on
38         $(release_archive_dir)/$(prev-tgz) here, so that if it's missing
39         we fail earlier.
41 2005-10-16  Jim Meyering  <jim@meyering.net>
43         * Version 5.91.
45         * Makefile.maint (VERSION_REGEXP): New variable.
46         (news-date-check, changelog-check): Use tighter regular expressions.
48         * configure.ac: Remove -cvs suffix from version string.
49         * NEWS: Add today's date.
51         * NEWS: Mention the `mkdir -p' bug fix.
53 2005-10-15  Jim Meyering  <jim@meyering.net>
55         * src/who.c (usage): Undocument deprecated --idle (-i) option.
57         * src/df.c (main): Warn about the deprecated --kilobytes option.
58         * src/ls.c (decode_switches): Likewise.
60         * src/du.c (usage): Document -m, once again.
61         (main): Warn about use of deprecated long options:
62         --kilobytes and --megabytes.
63         * src/tail.c (parse_options): Remove --allow-missing option.
64         You can use --retry instead.
65         * src/stat.c (main): Remove --link -l options.
66         You can use --dereference (-L) instead.
68 2005-09-30  Eric Blake  <ebb9@byu.net>  (tiny change)
70         * man/Makefile.am (.x.1): Remove temp directory first.
71         * NEWS: Document dircolors change of 2005-09-05.
73 2005-10-07  Paul Eggert  <eggert@cs.ucla.edu>
75         * src/sort.c (sortlines_temp): Redo previous change, since I'm
76         no longer confident that the m4/stdbool.m4 patch suffices.
78 2005-10-06  Paul Eggert  <eggert@cs.ucla.edu>
80         * src/sort.c (sortlines_temp): Undo previous change, since
81         today's change to m4/stdbool.m4 should catch it.
83 2005-10-06  Jim Meyering  <jim@meyering.net>
85         * TODO: rm: add support for a -I option, like that from FreeBSD's.
87 2005-10-05  Jim Meyering  <jim@meyering.net>
89         * src/sort.c (sortlines_temp): Declare temporary as `int' rather
90         than `bool' to work around AIX 5.3 compiler bug in 64-bit mode.
91         From James Lemley.
93 2005-10-03  Jim Meyering  <jim@meyering.net>
95         * src/factor.c (MAX_N_FACTORS): Define in terms of sizeof (uintmax_t)
96         rather than hard-coding to 128.  From Thomas M.Ott.
98 2005-10-02  Jim Meyering  <jim@meyering.net>
100         * Makefile.maint (sc_unmarked_diagnostics):
101         Search only cvs-controlled files.
102         * .x-sc_unmarked_diagnostics: New file.
103         * Makefile.am (EXTRA_DIST): Add it.
105 2005-10-01  Jim Meyering  <jim@meyering.net>
107         * src/factor.c (main): Don't stop processing arguments upon
108         the first invalid one.  Suggestion from Eric Blake
109         * tests/factor/basic: Add a test for this.
111 2005-09-30  Jim Meyering  <jim@meyering.net>
113         * configure.ac: Use 5.91-cvs as the version string.
114         * NEWS: Adjust accordingly.
116 2005-09-29  Paul Eggert  <eggert@cs.ucla.edu>
118         * src/dd.c (main): Don't assume size_t has the same width
119         as unsigned long.  Problem reported by Eric Blake.
121         * NEWS: Clarify "tail - f" example.
123 2005-09-29  Jim Meyering  <jim@meyering.net>
125         * Version 5.90.
127         * configure.ac: Remove -cvs suffix from version string.
128         * NEWS: Add today's date.
130         * NEWS: Mention this bug fix:
131         stat now exits nonzero if a file operand does not exist
133 2005-09-28  Paul Eggert  <eggert@cs.ucla.edu>
135         * src/system.h (LONGEST_MODIFIER): Use ULONG_MAX_LT_ULLONG_MAX
136         instead of ULLONG_MAX, as the latter doesn't work with GCC 2.7.2.1.
138 2005-09-28  Jim Meyering  <jim@meyering.net>
140         * configure.ac: Use 5.90-cvs as the version string, not 5.3.1-cvs.
141         * NEWS: Adjust accordingly.
143         * README: Remove note about FreeBSD make test failure.
145 2005-09-28  Paul Eggert  <eggert@cs.ucla.edu>
147         * tests/install/trap: Work around a bug in FreeBSD 5.0.
149 2005-09-28  Jim Meyering  <jim@meyering.net>
151         * README: Warn about a (now-)known problem on FreeBSD 5.0:
153 2005-09-26  Paul Eggert  <eggert@cs.ucla.edu>
155         * src/touch.c (touch): Handle "touch -c - >&-" by checking for EBADF
156         and ENOSYS.
157         Do not pass "-" to futimens; pass NULL instead.
158         If close (STDIN_FILENO) fails, report the error separately instead
159         of letting the 'close' pollute errno.
160         * tests/touch/empty-file: Test "touch -" too.
161         * tests/touch/no-create-missing: Likewise.
162         * tests/touch/read-only: Likewise.
164 2005-09-26  Jim Meyering  <jim@meyering.net>
166         * tests/touch/read-only: New test, for root of chmod/usage failure.
167         * tests/touch/Makefile.am (TESTS): Add read-only.
169         Work around the root cause of alpha-linux-1.sf.net test failure.
170         * tests/chmod/usage: Remove *all* files before each inner loop
171         iteration.  Otherwise, with a touch program that fails on unwritable
172         files, (this happens at least on linux-2.2.20) a -w file left behind
173         from a previous iteration could cause a spurious test failure.
175 2005-09-25  Paul Eggert  <eggert@cs.ucla.edu>
177         * tests/chmod/usage: Undo the s/files/file/ change, but add
178         comments about why the old version was desired.
180 2005-09-25  Jim Meyering  <jim@meyering.net>
182         * tests/ls-2/tests (setuid-etc): Work around output mismatch when
183         a just-created test file cannot be made set-group-ID.
185         Avoid test failures on alpha-linux-1.sf.net.
186         * tests/chmod/usage: Use newer trap and tmpdir-creation framework.
187         Fix apparent typos (s/files/file/) in inner loop.
189 2005-09-24  Paul Eggert  <eggert@cs.ucla.edu>
191         * NEWS: "touch -" now touches standard output.
192         * src/touch.c (touch): Implement this.
193         (usage): Document this.
195         * src/copy.c (HAVE_FCHMOD, HAVE_FCHOWN): Define to 0 if not defined.
196         (copy_reg): New args CHOWN_SUCCEDED and DST_SB.  All callers changed.
197         Add a "goto close_src_and_dst_desc;" that was missing in the
198         previous patch.
199         (copy_reg) [HAVE_FCHOWN]: Prefer fchown to chown.
200         (copy_reg) [HAVE_FCHMOD]: Prefer fchmod to chmod.
201         (copy_internal): Don't invoke chown if fchown worked,
202         and likewise for chmod and fchmod.
204 2005-09-24  Jim Meyering  <jim@meyering.net>
206         * src/shred.c: Use `#ifdef HAVE_CONFIG_H', not `#if HAVE_CONFIG_H',
207         for consistency with gnulib.
208         * src/dircolors.c: Likewise.
210         * Makefile.maint (sc_no_if_have_config_h): New rule.
211         (syntax-check-rules): Add it.
212         .x-sc_no_if_have_config_h: New file.
213         * Makefile.am (EXTRA_DIST): Add it.
215         * tests/seq/basic (eq-wid-1, eq-wid-2): Disable these tests for now.
216         They fail with non-gcc compilers and some combinations
217         of options and libraries on Solaris systems.
219         * tests/misc/date (uninit-64): Restore this test.
220         Add start-up code to detect, and work around, the cases in
221         which the test might fail.
223 2005-09-24  Paul Eggert  <eggert@cs.ucla.edu>
225         * tests/misc/date (uninit-64): Remove this test.  It wasn't
226         portable in theory (it doesn't work on hosts where 'int' is 64
227         bits, example) or in practice (Solaris 8 localtime returns garbage
228         in tm_year for the specified date, but that's not coreutils's
229         fault).
231 2005-09-23  Paul Eggert  <eggert@cs.ucla.edu>
233         * src/copy.c (copy_reg): Preserve time stamps if
234         x->preserve_timestamps is set, using futimens so that
235         we needn't resolve the path again.
236         (copy_internal): Don't preserve time stamps if copy_reg did it
237         already.
238         * src/install.c (change_timestamps): First arg is source
239         struct stat, not file name.  All uses changed.
240         (install_file_in_file): Stat the source file.
241         Don't try to change time stamps if copy_file did it.
242         * src/system.h: Don't include utime.h; not needed.
243         (struct utimbuf) [!defined HAVE_STRUCT_UTIMBUF]: Remove; not needed.
245 2005-09-23  Jim Meyering  <jim@meyering.net>
247         * src/od.c: Use `verify' to ensure that our hard-coded
248         bytes_to_*_digits arrays are long enough.  Of course, 17+-byte
249         integral types aren't on the near horizon, but just in case...
250         (MAX_INTEGRAL_TYPE_SIZE): Move definition to precede new first use.
251         (bytes_to_oct_digits, bytes_to_signed_dec_digits):
252         (bytes_to_unsigned_dec_digits, bytes_to_hex_digits): Change base
253         type from `char' to the clearer `unsigned int'.
255 2005-09-21  Paul Eggert  <eggert@cs.ucla.edu>
257         * src/rmdir.c (EEXIST, ENOTEMPTY): Remove unused macros.
259         Sync from gnulib.
261         * src/dircolors.c: Include strcase.h.
262         * src/pinky.c: Include canon-host.h rather than declaring
263         canon_host ourselves.
264         * src/who.c: Likewise.
266         * src/system.h (X2NREALLOC, X2REALLOC): Moved here from
267         ../lib/xalloc.h, with args properly parenthesized, and using
268         verify_expr rather than the old VERIFY_EXPR.
270 2005-09-21  Jim Meyering  <jim@meyering.net>
272         * tests/install/basic-1: Require that this test be run as non-root.
273         Otherwise, it fails due to the fact that the chmod 0 . doesn't
274         affect root.
276 2005-09-20  Jim Meyering  <jim@meyering.net>
278         * src/remove.c (write_protected_non_symlink): Change comment to
279         agree with the code.
281 2005-09-19  Jim Meyering  <jim@meyering.net>
283         * src/remove.c (remove_dir): Return RM_ERROR, not `1',
284         when attempting to remove `/' with --preserve-root.
286         * src/remove.c (remove_cwd_entries): Syntactic tweak: move an
287         assignment out of an if-expression.
289 2005-09-17  Jim Meyering  <jim@meyering.net>
291         * src/extract-magic (usage): Request that additions be sent to
292         bug-coreutils@gnu.org, too.
294 2005-09-16  Jim Meyering  <jim@meyering.net>
296         * tests/misc/date (rfc822-1): Compensate for Solaris 5.9's /bin/sh,
297         which emits a diagnostic to stderr when this test's LC_ALL=de_DE
298         setting cannot be honored.
300         * tests/misc/date (subfmt-up1): Put quotes around format string
301         to protect `^' from interpretation by some shells.
302         Add a use of OUT_SUBST to compensate for Solaris strftime's slightly
303         different formatting of %c.
305         * src/dd.c (main): When failing to truncate, mention both the seek
306         block count and the block size, in case the block size is very large.
307         Now `make distcheck' should pass, once again.
309 2005-09-16  Paul Eggert  <eggert@cs.ucla.edu>
311         * src/copy.c: Include stat-time.h.
312         (copy_internal): Use its functions instead of the obsolete
313         TIMESPEC_NS macro.
314         * src/cp.c (re_protect): Likewise.
315         * src/date.c (main): Likewise.
316         * src/du.c (struct duinfo, duinfo_init, duinfo_set, duinfo_add):
317         (show_date, print_size, process_file): Likewise.
318         * src/install.c (change_timestamps): Likewise.
319         * src/ls.c (cmp_ctime, cmp_mtime, cmp_atime, print_long_format):
320         Likewise.
321         * src/pr.c (init_header): Likewise.
322         * src/stat.c (human_time, print_stat): Likewise.
323         * src/tail.c (record_open_fd, tail_forever): Likewise.
324         * src/test.c (get_mtime, binary_operator): Likewise.
325         * src/touch.c (touch, main): Likewise.
326         * src/test.c (get_mtime): Renamed from age_of.  All uses changed.
328 2005-09-16  Jim Meyering  <jim@meyering.net>
330         Date no longer needs to allocate virtual memory to do its job,
331         so it can no longer fail due to an out-of-memory condition.
333         * src/date.c: Include fprintftime.h.
334         Don't include strftime.h or xanstrftime.h -- no longer needed.
335         (show_date): Use new fprintftime function rather than xanstrftime.
336         Correct comment: this function no longer handles a NULL format string.
337         * src/du.c: Likewise.
338         * NEWS: Mention this.
340         * tests/misc/date (subfmt-up1): Test the combination of the
341         to-upper-case modifier (^) and a conversion specifier that
342         expands to a string containing lower case characters.
344 2005-09-15  Paul Eggert  <eggert@cs.ucla.edu>
346         * NEWS: uname -a no longer generates the -p and -i outputs if they
347         are unknown.
348         * src/uname.c (usage): Document this.
349         (main): Implement this.
351 2005-09-14  Jim Meyering  <jim@meyering.net>
353         * tests/misc/date (tz-5w, tz-5wf): Test new %:z format with
354         a field width.
356 2005-09-13  Paul Eggert  <eggert@cs.ucla.edu>
358         * src/dd.c: Detect some very unlikely buffer overflows.
359         (INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP): New macros.
360         (MAX_BLOCKSIZE): Now accepts an arg.  All uses changed.
361         (page_size): New var.
362         (scanargs, skip, main): Use more-straightforward way to detect overflow.
363         (dd_copy): Use page_size rather than invoking getpagesize.
364         Use INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP.
365         (main): Set page_size.
366         Avoid a call to stat in the usual case where ftruncate succeeds.
368         * src/expr.c (docolon): Add IF_LINT check to avoid GCC warning.
370         * configure.ac: Don't invoke AC_CONFIGURE_HOST directly; AB_INIT
371         does it for us, and our invocation evokes a diagnostic from
372         Autoconf 2.59.
374         * NEWS: date has a new --rfc-3339 option, and the old --iso-8601
375         option is deprecated.  date, du, ls, and pr also have new time format
376         specifiers %:z, %::z, %:::z.
377         * src/date.c (TIME_SPEC_DATE): No longer needs to be nonzero, so
378         remove the "=1".
379         (TIME_SPEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put
380         them there.
381         (time_spec_string, time_spec): Hours and minutes must be at
382         start now, so put them there.
383         (rfc_2822_format): Now a string constant, not a boolean.  All uses
384         changed.
385         (iso_8601_format, rfc_format): Remove.
386         (RFC_3339_OPTION): New constant.
387         (long_options): Add --rfc-3339.
388         (usage): Add --rfc-3339.  Don't mention --iso-8601.
389         Mention %:z, %::z, %:::z.
390         (main): Simplify calculation of 'format'; it was getting too hairy
391         to follow.  Add --rfc-3339.
392         (show_date): Assume format arg is not NULL, which is the case
393         now.  The default code is moved to 'main'.  This simplifies things
394         and allows the default to be calculated just once.
395         * tests/misc/date: Add tests for --rfc-3339, %:z, %::z, %:::z.
397 2005-09-13  Jim Meyering  <jim@meyering.net>
399         * Makefile.maint (GZIP_ENV): Add --rsyncable option.
400         (makefile-check): Escape a `$' in a diagnostic.
402         * configure.ac: Use AB_INIT (from autobuild).
404 2005-09-11  Jim Meyering  <jim@meyering.net>
406         * src/factor.c (usage): Remove leading spaces in 2-line
407         description, so that help2man doesn't mangle it.
408         Reported by Justin Pryzby.
410 2005-09-10  Jim Meyering  <jim@meyering.net>
412         csplit could produce corrupt output, given input lines longer than 8KB
414         * src/csplit.c (load_buffer): Don't read from free'd memory
415         when handling lines longer than the initial buffer length.
416         (save_to_hold_area): Don't leak the previous hold_area buffer.
417         Reported by Tristan Miller and Luke Kendall.
418         * NEWS: Mention this.
419         * tests/misc/csplit: New test for this.
421         * src/csplit.c (load_buffer): Avoid integer overflow in buffer
422         size calculations for very long lines.
424 2005-09-09  Paul Eggert  <eggert@cs.ucla.edu>
426         Support regular expressions in 64-bit code correctly, by
427         importing the latest gnulib regexp code, and not assuming
428         that sizes fit in 32 bits.
429         * src/csplit.c (process_regexp): Store match length in regoff_t,
430         not int.  Assume that negative return values less than -2
431         represent regoff_t overflow.
432         * src/expr.c (docolon): Likewise.
433         * src/nl.c (proc_text): Likewise.
434         * src/ptx.c (SKIP_SOMETHING, find_occurs_in_text): Likewise.
435         * src/tac.c (tac_seekable): Likewise.
436         * src/expr.c (docolon) Check for size calculation overflow.
437         * src/nl.c (build_type_arg): Likewise.
438         * src/ptx.c (matcher_error): New function.
439         (SKIP_SOMETHING): Use it to report matcher errors.
440         (alloc_and_compile_regex): No longer any need to worry about
441         int versus size_t mismatch.
443         * NEWS: Document "niceness" vs "nice value".
444         * configure.ac (utils_cv_func_setpriority): Simplify the tests.
445         Define HAVE_NICE rather than NICE_PRIORITY (since a niceness is
446         not a priority); all uses changed.
447         * src/nice.c (main): Hoist errno=0 outside the ifdef.
449 2005-09-09  Jim Meyering  <jim@meyering.net>
451         * tests/misc/date (neg-secs2, fill-1, fill-2): Add new tests.
453 2005-09-07  Paul Eggert  <eggert@cs.ucla.edu>
455         Use the phrase "niceness" instead of "nice value" to describe
456         the biased nice value that can go negative.  This corrects
457         a discrepancy with POSIX, which states that nice values are
458         nonnegative.
459         * src/nice.c (GET_NICENESS): Renamed from GET_NICE_VALUE.
460         All uses changed.
461         (usage): Say "niceness" rather than "nice value".
462         (main): Say "niceness" rather than "priority" (which is something else
463         entirely nowadays).
465 2005-09-07  Jim Meyering  <jim@meyering.net>
467         * src/du.c (time_args): Use NULL in place of 0.
469 2005-09-05  Jim Meyering  <jim@meyering.net>
471         * src/dcgen: Don't omit comments until there is better documentation.
473         Colorize set-user-ID and set-group-ID files and sticky,
474         other-writable, and sticky-and-other-writable directories.
475         * src/dircolors.c (slack_codes): Add new dircolors mode names.
476         (ls_codes): Add corresponding two-letter ls mode strings.
477         * src/ls.c (indicator_no[]): Add new symbols.
478         (indicator_name[]): Add corresponding mode strings.
479         (color_indicator[]): Add an entry for each new mode string.
480         (print_color_indicator): Honor new types.
481         * src/dircolors.hin: Document the default colors for the new strings.
482         From Mike Frysinger, based on a patch from Fedora.
483         * tests/ls-2/tests (setuid-etc): New test, for the above.
485 2005-08-29  Paul Eggert  <eggert@cs.ucla.edu>
487         * NEWS: "rm -FOO" now suggests "rm ./-FOO" if the file "-FOO"
488         exists and "-FOO" is not a valid option.
489         * src/rm.c: Include lstat.h, quotearg.h.
490         (diagnose_leading_hyphen): New function.
491         (main): Use it.
493 2005-08-27  Jim Meyering  <jim@meyering.net>
495         * src/du.c: Go ahead and leave the patch in (i.e., revert
496         today's change).  It doesn't cause a problem after all, since
497         --exclude-from=- is always handled before --files0-from=F.
499         * src/du.c: Revert the du.c part of the change from 2005-07-02:
500         That change (to reopen stdin on F for --files0-from=F) made it so
501         --exclude-from=- and --files0-from=F would not work together.
503 2005-08-23  Jim Meyering  <jim@meyering.net>
505         * configure.ac: Use `5.3.1-cvs' as the version string.
506         * NEWS: Adjust accordingly.
508         * Makefile.maint (sc_useless_cpp_parens): New rule.
509         (syntax-check-rules): Add it.
510         * .x-sc_useless_cpp_parens: New file.
511         * Makefile.am (EXTRA_DIST): Add it.
513         * src/od.c: Include <float.h> unconditionally.
514         * src/uptime.c (print_uptime): Remove unnecessary parens in
515         `#if defined (SYMBOL)' expressions.
516         * src/system.h: Likewise.
517         * src/hostname.c: Likewise.
518         * src/su.c: Likewise.
519         * src/test.c: Likewise.
521 2005-08-22  Jim Meyering  <jim@meyering.net>
523         * src/tail.c (xwrite_stdout): Rename from xwrite.  Remove always-
524         equal-to-STDOUT_FILENO parameter and associated assertion.
525         Adjust all callers.
527 2005-08-21  Jim Meyering  <jim@meyering.net>
529         * src/ln.c (do_link): If ln is invoked with --interactive (-i),
530         encounters an existing destination file, and gets an affirmative
531         response, then first try to unlink the destination file rather
532         than simply failing.  Suggestion from Karl Berry.
533         FIXME: add test for this
535         * src/ln.c (main): Declare `target_directory' with const attribute.
536         * src/du.c (time_style): Add `const' attribute.
537         (tot_dui): Remove unnecessary (and too-short) initializer list.
539 2005-08-19  Jim Meyering  <jim@meyering.net>
541         * src/sort.c (usage) [-b,-t]: Ensure that there are at least two
542         spaces between each option and the corresponding description -- this
543         lets help2man format entries properly.  Reported by Edward Welbourne.
545 2005-08-17  Jim Meyering  <jim@meyering.net>
547         * src/sort.c (usage): Fix typo s/POS 2/POS2/.
548         Reported by Edward Welbourne.
550         * tests/misc/date [neg-secs]: New test for today's strftime.c bug fix.
551         * tests/misc/date: Remove terminating "\n"s once again.
552         Automatically add them whenever EXIT != 0.
554 2005-08-16  Paul Eggert  <eggert@cs.ucla.edu>
556         * src/df.c (show_dev): New arg STAT_FILE.  All uses changed.
557         This sometimes gives better results on networked file systems
558         that do not respect POSIX semantics.  Problem reported by
559         Bruno Haible.
561 2005-08-15  Jim Meyering  <jim@meyering.net>
563         Don't print uninitialized data (or anything else) to stdout
564         upon localtime failure.
565         * src/date.c (show_date): Remove stray `puts (buf);' (debugging?)
566         from the 2004-02-02 change.
567         * tests/misc/date (uninit-64): New test for the above.
568         Rewrite all other OUT strings to include the terminating "\n".
570 2005-08-14  Jim Meyering  <jim@meyering.net>
572         * src/md5sum.c (usage): Fix typo s/formated/formatted/ reported
573         by Norbert Kiesel.
575         Use one fewer file descriptor in a common case.
576         * src/touch.c: Include "fd-reopen.h", rather than "fcntl--.h".
577         Use fd_reopen rather than open.
579 2005-08-14  James Youngman  <jay@gnu.org>
581         * src/test.c (age_of): Return the nanoseconds part of the timestamp,
582         if available.
583         (binary_operator) [-nt, -ot]: Use nanosecond values to break ties.
585 2005-08-14  Jim Meyering  <jim@meyering.net>
587         * src/ls.c (long_time_expected_width): Revert last change, just to
588         be paranoid, and add a comment explaining why.  Paul Eggert mentioned
589         the possibility.
591         * src/wc.c: Don't define mbrtowc at all.
592         If mbstate_t is not defined, then AC_TYPE_MBSTATE_T will define
593         it to `int' for us.  Now wc.c really does compile on HP-UX 11.23.
595 2005-08-13  Jim Meyering  <jim@meyering.net>
597         * tests/date: Remove directory
598         * tests/Makefile.am (SUBDIRS): Remove date.
599         * configure.ac (AC_CONFIG_FILES): Remove tests/date/Makefile.
601         * tests/Coreutils.pm: New keywords, ENV and ENV_DEL, to support
602         tests/misc/date.
604         With todays additions, the generated shell script,
605         tests/date/date-tests had becoming far too large (over 350KB),
606         so use the superior-but-perl-requiring framework instead.
607         * tests/date/Test.pm: Move all tests from here...
608         * tests/misc/date: ...to this new file.
609         * tests/misc/Makefile.am (TESTS): Add date.
611         * tests/date/Test.pm (test_vector) [cross-dst]: New test for
612         just-fixed getdate.y bug.
613         * tests/date/Test.pm (test_vector): Add 364 more tests like the above.
614         Remove unused $sunos4 variable.
616 2005-08-12  Jim Meyering  <jim@meyering.net>
618         * src/nohup.c (main): Explain why we reopen stdin for write-only access.
620         * src/ls.c (long_time_expected_width): Don't test for failed localtime.
621         That cannot happen when the result date's year is in range.
622         Add an assertion instead.
624         * src/ls.c (sort_files): Use cleaner `sizeof *VAR_NAME'
625         rather than `sizeof (TYPE_NAME)'.
626         * src/ptx.c (sort_found_occurs, digest_word_file): Likewise.
627         (alloc_and_compile_regex): Likewise.
629         * src/wc.c: Test `!defined HAVE_MBSTATE_T' rather than
630         `defined mbstate_t' to detect missing support for mbstate_t.
631         The latter didn't work for HP-UX 11.23.
633         Add bulletproofing in case stdin is closed.
634         * src/dircolors.c (have_read_stdin): Remove global variable.
635         (dc_parse_stream): Always use stdin (freopen, if needed) rather
636         than sometimes using fopen to get a new file descriptor.
637         Call fclose unconditionally.
638         (main): Don't close stdin here.  If needed, now it's already done
639         by dc_parse_stream.
641         * src/dircolors.c (dc_parse_file): Remove comment about
642         now-removed OPENOPTS.
644         * src/fold.c (fold_file): Cosmetic: use X2REALLOC rather than x2realloc.
645         * src/pr.c (main): Likewise.
647         * src/csplit.c (new_control_record): Cosmetic: use X2NREALLOC (only
648         two arguments) rather than x2nrealloc (with three).
649         * src/cut.c (ADD_RANGE_PAIR): Likewise.
650         * src/expand.c (add_tab_stop): Likewise.
651         * src/join.c (extract_field, getseq): Likewise.
652         * src/od.c (decode_format_string): Likewise.
653         * src/sort.c (add_temp_dir): Likewise.
654         * src/unexpand.c (add_tab_stop): Likewise.
656         * src/pr.c (main): Cosmetic: use '\0' in place of 0.
658 2005-08-02  Jim Meyering  <jim@meyering.net>
660         * src/date.c: Include "xanstrftime.h".
661         (show_date): Use xanstrftime instead of open-coding it.
662         * src/du.c: Likewise.
664 2005-07-29  Jim Meyering  <jim@meyering.net>
666         * src/date.c (show_date): Remove now-unnecessary code that
667         treated an empty format string as a special case.
668         * tests/date/Test.pm (empty-format): New test, for this case.
670 2005-07-19  Jim Meyering  <jim@meyering.net>
672         * src/md5sum.c (usage): Adjust printf argument list to match
673         new format string.
675 2005-07-19  Paul Eggert  <eggert@cs.ucla.edu>
677         * NEWS: md5sum --check now accepts multiple input files, and
678         similarly for sha1sum.  Extension suggested by Chris Girling.
679         * src/md5sum.c (usage, main): Support this new usage.
681 2005-07-18  Paul Eggert  <eggert@cs.ucla.edu>
683         Fix a problem noted by James Youngman: VPATH-style builds don't
684         work because of po file problems.
685         * src/Makefile.am (BUILT_SOURCES): Remove false.c.
686         (false.c): Remove; it's now a source file.
687         * src/false.c: New file.
688         * src/true.c (EXIT_STATUS): New macro.
689         (PROGRAM_NAME, usage): Behave like "false" if EXIT_STATUS indicates.
690         (usage): Remove "These option names may not be abbreviated."
692 2005-07-15  Paul Eggert  <eggert@cs.ucla.edu>
694         * src/nohup.c (main): Don't worry about POSIXLY_CORRECT.  Today's
695         Austin Group Minutes says that the GNU behavior will be put
696         forward as proposed text for a future revision.
698 2005-07-13  Paul Eggert  <eggert@cs.ucla.edu>
700         * src/Makefile.am (nanosec_libs): Remove $(FESETROUND_LIBM); no longer
701         needed.  Problem reported by Jeff Bailey.
703 2005-07-12  Jim Meyering  <jim@meyering.net>
705         * Makefile.maint (copyright-check): Reflect rearrangement in
706         version-etc files.
708 2005-07-11  Paul Eggert  <eggert@cs.ucla.edu>
710         * NEWS: Binary input and output are now implemented more consistently.
711         These changes affect only platforms like MS-DOS that distinguish
712         between binary and text files.
713         * src/cat.c (usage, main, long_options) [O_BINARY]:
714         Remove support for -B.  Use same rules as other programs to decide
715         whether to use binary I/O, except that the -bensAE options always
716         select text mode.
717         * src/cat.c (main): Avoid setmode; use POSIX-specified routines instead.
718         * src/cksum.c (cksum): Likewise.
719         * src/head.c (head_lines, head_file): Likewise.
720         * src/od.c (open_next_file): Likewise.
721         * src/split.c (main): Likewise.
722         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
723         * src/tac.c (copy_to_temp, tac_file, main): Likewise.
724         * src/tail.c (tail_bytes, tail_lines, tail_file, main): Likewise.
725         * src/tee.c (tee): Likewise.
726         * src/tr.c (main): Likewise.
727         * src/wc.c (wc): Likewise.
728         * src/copy.c (copy_reg): Always copy in binary mode.
729         * src/expand.c (expand): Always copy in text mode.  POSIX says
730         the input and output must be text.
731         * src/unexpand.c (unexpand): Likewise.
732         * src/head.c (elide_tail_bytes_file, elide_tail_lines_file, head_bytes):
733         (head_lines, head_file): Always use binary mode except for std tty.
734         * src/md5sum.c (usage): Clarify whether text or binary is the default.
735         (split_3, main): BINARY is now a 3-way value.  All uses changed.
736         (digest_file): Likewise.  Clear *BINARY if we determine the file
737         to be text.  All uses changed.
738         (main): Don't report a file to be binary if we actually read it
739         as text in MS-DOS, because it was a terminal.
740         * src/shred.c (wipefile): Always use binary mode.  Clearly this
741         never worked right on DOS!
742         * src/system.h (setmode, fileno): Remove; no longer needed, we think.
743         (SET_MODE, SET_BINARY, SET_BINARY2): Remove.
744         [defined __DJGPP__]: Don't include <io.h> or <sys/exceptn.h>.
745         * src/wc.c (wc_file): FILE might be null now.
746         (main): Simplify code a bit, so that fewer places need the
747         setmode fixes.
749 2005-07-09  Paul Eggert  <eggert@cs.ucla.edu>
751         * src/comm.c, src/csplit.c, src/dd.c, src/join.c, src/md5sum.c:
752         * src/pr.c, src/sort.c, src/tee.c:
753         Don't include stdio.h; no longer needed.
755 2005-07-08  Paul Eggert  <eggert@cs.ucla.edu>
757         Fix porting problems reported by Eric Blake.
759         * configure.ac: Remove check for AC_HEADER_TIOCGWINSZ.
760         * src/cat.c, src/ls.c, src/stty.c: Include stropts.h if available,
761         because POSIX says that's where ioctl is declared.
762         * src/cat.c: Use HAVE_SYS_IOCTL_H instead of _POSIX_SOURCE
763         to decide whether to include <sys/ioctl.h>.
764         * src/stty.c: Use only HAVE_SYS_IOCTL_H to decide whether
765         to include <sys/ioctl.h>.
767         * src/id.c (print_user): Don't assume uid fits in unsigned int.
768         (print_group): Likewise, for gid.
770 2005-07-05  Paul Eggert  <eggert@cs.ucla.edu>
772         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Generate a hard error
773         (not just a warning) if GCC is used and the types don't match.
775 2005-07-04  Paul Eggert  <eggert@cs.ucla.edu>
777         * src/system.h (VERIFY_W_TYPEOF): Remove; no longer needed.
778         (DECIMAL_DIGIT_ACCUMULATE): Change last arg from T's maximum value
779         to T itself.  All callers changed.  Check that T is unsigned, and
780         that Accum is of type T.  This fixes a bug in the unlikely case
781         where SIZE_MAX <= INT_MAX, and it no longer requires typeof to do
782         the proper validity checks.
784         * src/od.c: Adjust to verify.h change.
785         * src/system.h (VERIFY_W_TYPEOF): Likewise.
787 2005-07-04  Jim Meyering  <jim@meyering.net>
789         * src/system.h: Include "verify.h".
791         * src/system.h (verify): Rename from VERIFY_EXPR, to be lower case,
792         like assert.  Use sizeof, rather than equivalent ((...)0), for
793         it's slightly simpler syntax.  Suggestions from Paul Eggert.
794         (verify_decl): Rename from VERIFY.
795         * src/od.c: Reflect name change.
797 2005-07-03  Jim Meyering  <jim@meyering.net>
799         * NEWS: cp and mv: the --reply=X option is deprecated
800         Suggested by Bob Proulx, after numerous user complaints
801         about how --reply=no appeared not to work.
802         * src/mv.c (main): Using --reply now evokes a warning.
803         (usage): Remove description of --reply.
804         * src/cp.c (main): Using --reply now evokes a warning.
805         (usage): Remove description of --reply.
806         * tests/mv/i-link-no: Adjust for new diagnostic.
807         * tests/mv/reply-no: Likewise.
809         * src/printf.c (verify_numeric): Rename from verify.
810         Update caller.
812 2005-07-03  Paul Eggert  <eggert@cs.ucla.edu>
814         * src/copy.h: Include "lstat.h" rather than rolling our own.
815         * src/ls.c: Likewise.
816         * src/remove.c: Likewise.
818 2005-07-02  Paul Eggert  <eggert@cs.ucla.edu>
820         Cleanup to isolate "safer" functions to a small part of the code.
821         * src/comm.c: Include stdio--.h, not stdio-safer.h.
822         (compare_files): Use fopen, not fopen_safer.
823         * src/copy.c: Include fcntl--.h, not unistd-safer.h.
824         (copy_reg): Don't call fd_safer; no longer needed
825         now that we include fcntl--.h.
826         * src/csplit.c: Include fd-reopen.h.
827         Include stdio--.h, not stdio-safer.h.
828         (input_desc): Remove.  All uses changed to STDIN_FILENO.
829         (set_input_file): Reopen stdin, to simplify code.
830         (create_output_file): Use fopen, not fopen_safer.
831         * src/dd.c: Include fd-reopen.h.
832         (open_fd): Remove.  All callers changed to use fd_reopen instead.
833         * src/join.c: Include stdio--.h, not stdio-safer.h.
834         (main): Use fopen, not fopen_safer.
835         * src/md5sum.c: Include stdio--.h.
836         (digest_check): Don't try to read both checksums and data from stdin.
837         * src/nohup.c: Include fd-reopen.h.
838         Include unistd--.h, not unistd-safer.h.
839         (main): Use fd_reopen to simplify code.  When replacing stdin,
840         use "/dev/null" not "/", as that's less likely to go wrong these days.
841         (main): Use dup, not dup_safer.
842         * src/pr.c: Include stdio--.h, not stdio-safer.h.
843         (open_file): Invoke fopen, not fopen_safer.
844         * src/shred.c: Include fcntl--.h, not unistd-safer.h.
845         (wipename, wipe_file): Don't use fd_safer; no longer needed
846         now that we include fcntl--.h.
847         * src/sort.c: Include stdio--.h rather than stdio-safer.h.
848         Include stdlib--.h.  Do not include unistd-safer.h.
849         (create_temp_file): Don't call fd_safer; no longer needed
850         now that we include *--.h files.
851         (xfopen): Don't call fopen_safer, for similar reasons.
852         * src/split.c: Include fcntl--.h rather than unistd-safer.h.
853         Include fd-reopen.h.
854         (input_desc): Remove.  All uses replaced by STDIN_FILENO.
855         (cwrite): Don't call fd_safer; no longer needed now that
856         we include fcntl--.h.
857         (main): Reuse stdin rather than opening a new one.  This
858         saves a file descriptor.
859         * src/stty.c: Include fd-reopen.h.
860         (display_all, display_settings, display_window_size, set_window_size):
861         Remove fd arg, since we now assume stdin.  All callers changed.
862         (main): Reuse stdin rather than opening a new one.  This
863         saves a file descriptor.
864         * src/tac.c: Include stdlib--.h rather than unistd-safer.h.
865         (copy_to_temp): Don't call fd_safer; no longer needed now
866         that we include stdlib--.h.
867         * src/tail.c: Include fcntl--.h, not unistd-safer.h.
868         (recheck, tail_file): Don't call fd_safer; no longer needed
869         now that we include fcntl--.h.
870         * src/tee.c: Include stdio--.h, not stdio-safer.h.
871         (tee): Don't call fopen_safer; no longer needed now that we
872         include stdio--.h.
873         * src/touch.c: Include fcntl--.h, not unistd-safer.h.
874         (touch): Don't call fd_safer; no longer needed now that
875         we include fcntl--.h.
877         * src/du.c (main): Reuse stdin rather than opening a new stream.
878         This saves a file descriptor.
879         * src/uniq.c: Don't include stdio-safer.h; no longer needed.
880         (writeline): Remove stream arg; we now always output to stdout.
881         All callers changed.
882         (check_file): Reuse stdout rather than opening a new stream.
883         This saves a file descriptor.
885 2005-07-02  Jim Meyering  <jim@meyering.net>
887         * Makefile.maint (sc_obsolete_symbols): New rule.
888         (syntax-check-rules): Add it to the list.
889         * Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols.
890         * .x-sc_obsolete_symbols: New file.
892 2005-07-01  Jim Meyering  <jim@meyering.net>
894         * src/system.h: Assume HAVE_FCNTL_H (i.e., include <fcntl.h>
895         unconditionally, and don't include <sys/file.h>).
896         * src/system.h: Likewise for HAVE_UNISTD_H.
898 2005-06-30  Jim Meyering  <jim@meyering.net>
900         * src/cp.c: Add uses of ARGMATCH_VERIFY to ensure that
901         corresponding option string and value arrays are consistent.
902         * src/date.c: Likewise.
903         * src/du.c: Likewise.
904         * src/ls.c: Likewise.
905         cp.c and date.c each had a harmless trailing `, 0' (now-removed)
906         in a value list.
908         * src/system.h (VERIFY): Guard definition with #ifndef.
909         (VERIFY_EXPR): Undef before defining.
911 2005-06-29  Jim Meyering  <jim@meyering.net>
913         * src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
914         * src/du.c (show_date): Likewise.
915         * src/date.c (show_date): Likewise.
916         * src/od.c (dump_strings): Likewise.
917         * src/sort.c (fillbuf): Likewise.
918         * src/chmod.c (main): Likewise.
920         * src/system.h (VERIFY): Rewrite to use string-concatenation
921         and __LINE__ so as not to require a struct name parameter.
922         (GL_CONCAT, GL_CONCAT2): Define helper macros.
923         * src/od.c: Update sole use.
925         * src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
926         when computing the --author column width.  This bug might have
927         resulted in misaligned columns when using the --author option
928         on the Hurd.  Spotted by Arnold Robbins.
930 2005-06-28  Jim Meyering  <jim@meyering.net>
932         * src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
933         not x2nrealloc.  The former is a little more concise and readable.
934         N.B. this sort of transformation is ok only when the base type is
935         unlikely ever to change to a multibyte type.
936         * src/du.c (show_date): Likewise.
937         * src/date.c (show_date): Likewise.
938         * src/od.c (dump_strings): Likewise.
939         * src/sort.c (fillbuf): Likewise.
941 2005-06-24  Jim Meyering  <jim@meyering.net>
943         * src/mv.c (usage): Clarify how --reply=no works.
945 2005-06-23  Paul Eggert  <eggert@cs.ucla.edu>
947         Address the following "du" issues:
949         - The option name "--last-time=TYPE" is different from the ls's option
950           "--time=TYPE" with a similar meaning.  I assume this wasn't intended.
952         - --time-style implies --time, but this is not true for "ls".  It's
953           better to be consistent.
955         - Since we don't have POSIX compatibility concerns, there's no need
956           for the "posix-" styles, or for support of styles with newlines, or
957           for the "locale" style, except for parsing the TIME_STYLE
958           environment variable.
960         - It's cleaner (and these days, no less efficient) to use functions
961           rather than macros when possible.
963         - struct duinfo doesn't need a 'valid' flag; you can simply use a time
964           stamp that is less than all valid time stamps.
966         - The code needs a bit of reformatting to fit the usual GNU style.
968         * NEWS: du's --last-time option is now --time.
969         * doc/coreutils.texi (ls invocation): Fix typo: --time=use is
970         equivalent to --time=atime, not --time=ctime.
971         (ls invocation, du invocation): Fix typo: --time-style=long-iso
972         is equivalent to a time style with a leading "+".
973         (du invocation): --last-time is now --time.
974         --time-style no longer implies --time.
975         The locale and posix- stuff now works only for TIME_STYLE, not
976         for --time-style.  Give equivalent format for --time-style=iso.
977         * src/du.c: Do not include hard-locale.h.
978         (struct duinfo): Remove 'valid' member.  All uses changed to use
979         negative nsec instead.
980         (DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
981         (duinfo_init, duinfo_set, duinfo_add): New functions, taking the
982         role of the removed macros.
983         (opt_time): Renamed from opt_last_time.  All uses changed.
984         (TIME_OPTION): Renamed from LAST_TIME_OPTION.  All uses changed.
985         (long_options, usage): Rename --last-time to --time.
986         (locale_time_style): Remove.
987         (time_style_args, time_style_types, usage): Remove support for
988         --time-style=locale.
989         (show_date): Now returns void, since nobody looked at the result.
990         Assume FORMAT is not null.  An empty FORMAT now outputs an empty time.
991         Simplify nstrftime invocation.
992         (main): Put in ls compatibility workarounds only for TIME_STYLE,
993         not for --time-style.  Omit unnecessary space in iso time style.
995 2005-06-23  Jim Meyering  <jim@meyering.net>
997         * src/du.c (time_format): Add `const' attribute.
999         * src/date.c (show_date): Use puts rather than printf ("%s\n",.
1001         * src/du.c (show_date): Rename local `time_format' so as not to
1002         shadow the file-scoped global by that name.
1003         (show_date): Add a FIXME comment.
1005         * src/du.c: Include hard-locale.h and strftime.h.
1006         (DUINFO_INI, DUINFO_SET, DUINFO_ADD):
1007         Enclose body in `do {...} while (0)', not just `{...}'.
1008         Adjust uses (add semicolons).
1009         Adjust formatting, indentation.
1010         (usage): Tweak formatting to maintain more or less constant indentation.
1012 2005-06-14  William Brendling  <wbrendling@gmail.com>
1014         * src/du.c: Add --last-time and --time-style options.
1016 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
1018         * tests/umask-check: New file.
1019         * tests/Makefile.am (EXTRA_DIST): Add umask-check.
1020         * tests/mkdir/perm: Use umask-check.
1021         * tests/cp/cp-parents: Likewise, instead of using chmod
1022         as described below.  Problem reported by Kevin Mudrick.
1024 2005-06-22  Jim Meyering  <jim@meyering.net>
1026         Make rmdir produce diagnostics like this:
1027         rmdir: /tmp: Permission denied
1028         not like this:
1029         rmdir: `/tmp': Permission denied
1031         * src/rmdir.c: Include "quotearg.h", not "quote.h".
1032         (remove_parents, main): Use quotearg_colon, not quote.
1034 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
1036         * tests/cp/cp-parents: Use chmod to work around some hosts with
1037         ACL problems.  Problem reported by Kevin Mudrick.
1039 2005-06-21  Jim Meyering  <jim@meyering.net>
1041         * tests/du/deref-args: Use --apparent-size to avoid the vagaries
1042         of counting blocks.  Kevin Mudrick reported that this test would
1043         fail on an nfs-mounted directory where attribute-caching is
1044         turned on.
1046 2005-06-19  Jim Meyering  <jim@meyering.net>
1048         * src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
1050         * src/shred.c (usage): Use `file system', not `filesystem'.
1052 2005-06-18  Jim Meyering  <jim@meyering.net>
1054         * src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
1056 2005-06-17  Jim Meyering  <jim@meyering.net>
1058         * src/shred.c (usage): Clarify that shred works on an ext3 file
1059         system as long as it's not in data=journal mode.
1060         Tiny change by Mark Melahn.
1062 2005-06-16  Paul Eggert  <eggert@cs.ucla.edu>
1064         * src/hostid.c (main): Don't print fewer than 8 digits, or spurious
1065         leading "f"s.  "f" problem reported by Tim Waugh.
1066         * NEWS: Document this.
1068 2005-06-16  Jim Meyering  <jim@meyering.net>
1070         Don't embed `this'-style quotes in format strings.
1071         * src/tr.c: Rather than this: error (..., "...`%s'...", arg);
1072         do this:                      error (..., "...%s...", quote (arg));
1073         * src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
1074         * src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
1075         * src/split.c, src/tail.c: Likewise.
1077         * src/sleep.c: Include "quote.h".  Remove hard-coded quotes, as above.
1078         * src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
1079         * src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
1081         * src/mv.c: Finally remove support for --version-control=S (-V).
1082         It was deprecated nearly 6 years ago and has been warning
1083         users to switch to --backup=S since fileutils-4.0j.
1084         * src/cp.c, src/install.c, src/ln.c: Likewise.
1086 2005-06-15  Jim Meyering  <jim@meyering.net>
1088         * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
1089         * tests/install/basic-1: Ensure that each `-d'-specified directory
1090         is created.  Ensure that rel-named dirs are not created when
1091         chdir($PWD) fails.
1093         * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
1095 2005-06-14  Paul Eggert  <eggert@cs.ucla.edu>
1097         Improve diagnostics for restore_cwd failure.
1098         * src/install.c (main): Standardize on a diagnostic for
1099         restore_cwd failure, and report errno.
1100         (install_file_in_file_parents): Fail if restore_cwd fails and
1101         one of the files is relative.  This fixes a bug (albeit unlikely).
1102         * src/mkdir.c (create_parents): Remove static var (now local to 'main').
1103         (main): Standardize on a diagnostic for restore_cwd failure,
1104         and report errno.
1105         Don't bother to check cwd_errno unless create_parents.
1106         Use mkdir rather than make_dir; it's simpler.
1108         * src/install.c (main): Adjust to new make_dir_parents convention.
1109         * src/mkdir.c (main): Likewise.
1111 2005-06-14  Jim Meyering  <jim@meyering.net>
1113         * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
1114         is an absolute directory name.
1116         * Makefile.maint (my-distcheck): Add -Wall to the list of options that
1117         are used with -Werror.  This target is not intended for general use.
1119 2005-06-13  Jim Meyering  <jim@meyering.net>
1121         * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
1122         relative directory name after make_dir_parents fails to restore
1123         the working directory.  Before, `mkdir -p' could create directories
1124         in the wrong place in unusual circumstances.
1125         * src/install.c (main): Likewise.
1126         (install_file_in_file_parents): Update make_dir_parents caller.
1127         * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
1128         * tests/mkdir/Makefile.am (TESTS): Add p-3.
1130 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
1132         Act on the Austin Group's response yesterday to XCU ERN 63; see
1133         <http://www.opengroup.org/austin/docs/austin_260.txt>.
1134         * NEWS: ls no longer outputs an extra space between mode and link count.
1135         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
1136         * src/ls.c (any_has_acl): New var.
1137         (clear_files): Clear it.
1138         (gobble_file): Set it if a file has an ACL.
1139         (print_long_format): Omit needless space unless some file has an ACL.
1141 2005-06-10  Jim Meyering  <jim@meyering.net>
1143         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
1145 2005-06-02  Jim Meyering  <jim@meyering.net>
1147         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
1149 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
1151         Use "file name" when talking about file names, instead of "filename"
1152         or "path", as per the GNU coding standards.
1153         * src/basename.c: Don't use "path" or "filename".
1154         * src/copy.c: Likewise.
1155         * src/copy.h: Likewise.
1156         * src/cp-hash.c: Likewise.
1157         * src/cp.c: Likewise.
1158         * src/df.c: Likewise.
1159         * src/install.c: Likewise.
1160         * src/ls.c: Likewise.
1161         * src/pinky.c: Likewise.
1162         * src/pr.c: Likewise.
1163         * src/pwd.c: Likewise.
1164         * src/remove.c: Likewise.
1165         * src/rmdir.c: Likewise.
1166         * src/sort.c: Likewise.
1167         * src/system.h: Likewise.
1168         * src/tty.c: Likewise.
1169         * src/who.c: Likewise.
1170         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
1171         (make_dir_parents_private): Renamed from make_path_private.
1172         All uses changed.
1173         * src/cp.c (usage): Don't use "path" to describe a file name.
1174         * src/readlink.c (usage): Likewise.
1175         * src/rmdir.c (usage): Likewise.
1176         * src/df.c: Don't include "path-concat.h"; not needed.
1177         * src/install.c (install_file_in_file_parents): Renamed from
1178         install_file_to_path.  All uses changed.
1179         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
1180         All uses changed.
1181         * src/ls.c (make_link_name): Renamed from make_link_path.
1182         All uses changed.
1183         * src/pwd.c (struct file_name): Renamed from struct Path.
1184         All uses changed.
1185         (file_name_free): Renamed from path_free.  All uses changed.
1186         (file_name_init): Renamed from path_init.  All uses changed.
1187         (file_name_prepend): Renamed from path_prepend.  All uses changed.
1188         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
1189         All uses changed.
1190         (longopts): Add comment that --path is deprecated.
1192 2005-05-31  Jim Meyering  <jim@meyering.net>
1194         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
1195         This is a crutch so that `make distcheck's sc_tight_scope rule
1196         knows that they really are deliberately declared that way.
1198 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
1200         Port to Solaris 10's rules for whether programs can chown files.
1201         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
1202         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
1203         changed.
1204         (copy_internal): If chown failed, don't worry about what happened
1205         to the mode bits; they can't have changed.
1206         (chown_privileges, chown_failure_ok): New functions.
1207         * src/copy.h: Add copyright notice.
1208         (struct cp_options): Remove myeuid member.  Add chown_privileges
1209         member.
1210         (chown_privileges, chown_failure_ok): New function decls.
1211         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
1212         Use chown_failure_ok rather than our own code.
1213         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
1214         * src/install.c (cp_option_init): Likewise.
1215         * src/mv.c (cp_option_init): Likewise.
1217 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
1219         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
1220         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
1221         Remove decls.
1222         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
1223         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
1224         [!defined _POSIX_VERSION]: Remove decls.
1225         * src/install.c (getpwnam, getgrnam): Remove decl.
1226         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
1227         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
1228         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
1229         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
1230         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
1231         isn't defined.
1232         Don't include <sys/file.h>; no longer needed.
1233         (getegid, geteuid): Remove no-longer-necessary decls.
1235         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
1236         Define to 256, not 255, as per modern POSIX.
1238 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
1240         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
1241         * src/dd.c (skip): Return the number of records that were not
1242         skipped due to encountering EOF.
1243         (dd_copy): If the file wasn't seekable and EOF was encountered,
1244         write zeros past EOF until the desired offset is reached.
1246         * NEWS: expr and test now correctly compare integers of unlimited size.
1247         (Also, correct a comment that claimed that expr detects integer
1248         overflow; it does so only when converting from strings.)
1249         * src/expr.c: Include strnumcmp.h, xstrtol.h.
1250         (looks_like_integer): New function.
1251         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
1252         own diagnostics.
1253         (eval2): Don't look for trouble if !evaluate; this simplifies things.
1254         Compare numbers using string comparison, so that overflow is
1255         not possible.
1256         * src/sort.c: Refactor so that others can use large-integer
1257         comparison functions.
1258         Include "strnumcmp.h".
1259         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
1260         Remove; moved to strnumcmp.
1261         (decimal_point): Now int, to simplify converison overhead with
1262         new API.  All uses changed.
1263         (thousands_sep): Now -1 if there isn't one, as per new API.
1264         All uses changed.
1265         (numcompare): Move contents to strnumcmp module, except for
1266         skipping blanks.
1267         * src/test.c: Include inttostr.h, strnumcmp.h.
1268         (whitespace, digit, digit_value, integer_expected_error): Remove.
1269         (is_int): Remove; replaced by...
1270         (find_int): New function.
1271         (binary_operator): Don't let integers overflow in comparisons;
1272         return the correct answer instead.  Simplify the code.
1273         (unary_operator): Convert the integer ourself, since find_int
1274         no longer does so.
1275         * tests/expr/basic (bigcmp): New test.
1276         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
1278 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
1280         * NEWS: nohup now redirects a tty stdin to an unreadable fd
1281         instead of closing it.
1282         * doc/coreutils.texi (nohup invocation): Document this.
1283         * src/nohup.c (main): Implement this.
1285 2005-05-26  Jim Meyering  <jim@meyering.net>
1287         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
1288         Reported by David Alan Gilbert.
1289         * tests/expr/basic: Add tests using arithmetic on negative integers.
1291 2005-05-19  Jim Meyering  <jim@meyering.net>
1293         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
1294         Remove inaccurate-but-harmless `const' attributes.
1296         * src/join.c (decode_field_spec): Add an abort after
1297         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
1298         about variables being used uninitialized.
1300 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
1302         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
1303         * src/Makefile.am: Add copyright notice.
1304         (factor_LDADD): Remove, as factor no longer needs sqrt.
1305         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
1306         it's always true now.
1308 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
1310         Fix Cygwin porting problem reported by Eric Blake.
1311         * src/remove.c (DT_IS_DIR): Remove.
1312         (DT_IS_KNOWN, DT_MUST_BE): New macros.
1313         (remove_entry): Use them.
1315 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
1317         * src/remove.c: Include unlinkdir.h.
1318         (UNLINK_CAN_UNLINK_DIRS): Remove.
1319         (remove_entry): Use cannot_unlink_dirs () rather than
1320         UNLINK_CAN_UNLINK_DIRS.
1322 2005-05-14  Jim Meyering  <jim@meyering.net>
1324         Update FSF postal mail address.
1325         * Makefile.maint, Makefile.cfg, gnupload
1326         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
1327         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
1328         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
1329         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
1330         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
1331         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
1332         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
1333         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
1334         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
1335         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
1336         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
1337         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
1338         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
1339         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
1340         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
1341         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
1342         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
1343         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
1344         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
1345         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
1346         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
1347         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
1349 2005-05-13  Jim Meyering  <jim@meyering.net>
1351         * NEWS: `rm -r' now removes all of the files it should, even on
1352         systems with a buggy readdir affecting file systems inaccessible
1353         at configure time.
1355         In some unusual circumstances `rm -r' would fail to remove --
1356         or even consider -- all entries in a directory with more than 254
1357         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
1358         other types of systems when using an affected file system via e.g.,
1359         NFS.  The underlying cause was a bug in readdir on those systems.
1360         Coreutils-5.2.1 and earlier used a configure-time test designed
1361         to detect precisely those problem systems, but it would detect
1362         the problem and enable remove.c's work-around code only when its
1363         configure-time test was run on a losing file system.  Obviously,
1364         it couldn't detect a problem if the offending file system wasn't
1365         tested or even mounted at coreutils configure time.  Now, rm itself
1366         performs a minimal-cost run-time test to detect the problem.
1368         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
1369         (remove_cwd_entries):  When readdir returns NULL for a directory from
1370         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
1371         entries, call rewinddir and then resume the readdir/unlink loop.
1372         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
1374 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
1376         * NEWS: nohup now closes stdin if it is a terminal, unless
1377         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
1378         <https://www.opengroup.org/sophocles/show_mail.tpl?
1379         source=L&listname=austin-group-l&id=8341>.
1380         * doc/coreutils.texi (nohup invocation): Document this.
1381         * src/nohup.c (main): Implement this.
1383 2005-05-12  Jim Meyering  <jim@meyering.net>
1385         * src/date.c: Assume `free (NULL)' works.
1386         * src/dd.c: Likewise.
1387         * src/df.c:Likewise.
1388         * src/dircolors.c:Likewise.
1389         * src/head.c: Likewise.
1390         * src/ls.c: Likewise.
1391         * src/md5sum.c: Likewise.
1392         * src/pr.c: Likewise.
1393         * src/sort.c: Likewise.
1395 2005-05-10  Jim Meyering  <jim@meyering.net>
1397         * tests/touch/not-owner: Skip this test if the user running it
1398         owns `/' or has write access to it.
1400         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
1401         This makes `mv -i --reply=no f1 f2' work as expected (in not
1402         performing the move operation).  But note that specifying `-i'
1403         after `--reply=no' does *not* work.
1404         Tiny patch from Vlada Macek.
1405         Correct a comment.
1406         * tests/mv/reply-no: New file.  Test for the above fix.
1407         * tests/mv/Makefile.am (TESTS): Add reply-no.
1409         * tests/ls-2/tests: Don't print PATH to stderr.
1411 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
1413         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
1414         responses.
1416 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
1418         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
1419         * src/dd.c (flags, usage): Add support for "binary" and "text".
1421 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
1423         * NEWS: chmod -w now complains if it differs from chmod a-w.
1424         * src/chmod.c: Include quotearg.h.
1425         (diagnose_surprises): New var.
1426         (process_file): Diagnose surprises.  Simplify the logic a bit,
1427         while we're at it.
1428         (main): Prepare to diagnose surprises.  Remove useless code for
1429         '-' option.
1430         * tests/chmod/Makefile.am (TESTS): Add umask-x.
1431         * tests/chmod/umask-x: New file.
1433 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
1435         * NEWS: ls --indicator-style=directory renamed to ls
1436         --indicator-style=slash, to avoid confusion with ls --directory.
1437         * src/ls.c (usage): Likewise.
1438         (slash): Renamed from directory_only.  All uses changed.
1440 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
1442         * NEWS: "chmod +1 foo" is now diagnosed.
1444 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
1446         * NEWS: ls -p now marks only directories.  New option
1447         --indicator-style=directory equivalent to -p.
1448         * doc/coreutils.texi (ls invocation): Document this.
1449         Also, mention ">" is for doors.
1450         * src/ls.c (enum indicator_style): New constant directory_only,
1451         for -p.
1452         (indicator_style_args, indicator_style_types): Set it appropriately.
1453         (decode_switches, gobble_file, print_type_indicator):
1454         (length_of_file_name_and_frills):
1455         Implement the change described in NEWS.
1456         (decode_switches): Quote ">", too.
1457         (usage): Update to match the new behavior.  Describe ">".
1458         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
1459         The "ls --color" test wasn't being checked; add a check for
1460         "ls --color=auto" instead.
1462         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
1463         * tests/misc/split-fail: Likewise.
1464         * tests/pr/Test.pm: Likewise.
1465         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
1466         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
1467         if they use file names starting with +.
1468         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
1469         * tests/uniq/Test.pm (tv, test_vector): Likewise.
1471         The following was partly derived from a tiny change by Eric Blake:
1472         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
1473         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
1474         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
1475         Work even if the underyling system attaches ACLs to new dirs.
1476         * tests/mv/part-hardlink: Don't use 'set -'.
1477         * tests/stty/row-col-1: Don't use 'set -'.
1479 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
1481         * NEWS: Document fixes described below.
1482         * src/chmod.c (change, umask_value): New static vars.
1483         (reference_file): Move this static var to inside "main".
1484         (process_file, process_files): Remove CHANGES arg; now taken from
1485         static var.  All uses changed.
1486         (usage): Fix incorrect description of MODE operand.
1487         (main): For invalid mode usages, output a brief usage message.
1488         Adjust to new modechange API.
1489         * install.c (main): Adjust to new modechange API.
1490         Also, free the mode_change object when done.
1491         * mkdir.c (main): Likewise.
1492         * mkfifo.c (main): Likewise.
1493         * mknod.c (main): Likewise.
1494         * tests/chmod/equal-X: Check for =xX bug.
1495         * tests/chmod/equals: Check for =u bug.
1496         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
1498 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
1500         Restore support for usages like "head -1" and "tail -1",
1501         even when conforming to POSIX 1003.1-2001.
1502         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
1503         join now supports a NUL field separator, e.g., "join -t '\0'".
1504         join now detects and reports incompatible options, e.g.,
1505         "join -t x -t y",
1506         * NEWS: Document this.
1507         * src/date.c: Remove posixver.h and its uses.
1508         (COMMON_SHORT_OPTIONS): Remove.
1509         (short_options): New constant.
1510         (short_options, usage): -I now always takes an optional arg.
1511         * src/expand.c: Remove posixver.h and its uses.
1512         (shortopts): New constant.  -DIGIT now always takes an optional arg.
1513         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
1514         Don't complain about -DIGIT.
1515         * src/fold.c: Remove posixver.h and its uses.
1516         (shortopts): New constant.  -DIGIT now always takes an optional arg.
1517         (main): Don't preprocess arg list; that was buggy.  Use method
1518         similar to expand.
1519         * src/head.c: Remove posixver.h and its uses.
1520         (header_mode_option): Remove.
1521         (main): Don't complain about obsolete -NUM args.
1522         * src/join.c: Remove posixver.h and its uses.
1523         (obsolete_usage): Remove.
1524         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
1525         they haven't been set yet.
1526         (tab): Now int, not char.  Initialize to -1 to indicate white space
1527         separates columns, so that we can use NUL as a separator.
1528         All uses changed.
1529         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
1530         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
1531         suffices.  Use xstrtoul for sizes; it suffices.
1532         (decode_field_spec): Report an error and exit on failure.  Return void,
1533         not bool.
1534         (add_field_list): Likewise.
1535         (set_join_field): New function.
1536         (enum operand_status): New enum.
1537         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
1538         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
1539         possibilities with obsolete option parsing.
1540         (main): Use it.  Do not depend on POSIX version.
1541         Check for conflicting options.  Parse obsolete options -j1 and -j2
1542         so that it is a pure extension to POSIX 1003.1-2001.
1543         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
1544         * src/nice.c: Remove posixver.h and its uses.
1545         (main): Always support -NUM option.
1546         * src/od.c: Remove posixver.h and its uses.
1547         (short_options): New constant, which always supports -w[num].
1548         (COMMON_SHORT_OPTIONS): Remove.
1549         * src/pr.c: Remove posixver.h and its uses.
1550         (short_options): New constant, which always supports -S[string].
1551         (COMMON_SHORT_OPTIONS): Remove.
1552         * src/sort.c: Remove posixver.h and its uses.
1553         (short_options): New constant, which always supports -y arg.
1554         (COMMON_SHORT_OPTIONS): Remove.
1555         (main): Redo workaround for Solaris compatibility with -y.
1556         This change isn't visible to the user; it just cleans up the
1557         code so that we don't need posixver.h.
1558         * src/split.c: Remove posixver.h and its uses.
1559         (main): Don't complain about -NUM option.
1560         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
1561         * src/unexpand.c: Remove posixver.h and its uses.
1562         (main): Don't complain about -TAB.
1563         * src/uniq.c (main): Don't complain about -NUM.
1565 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
1567         * src/nohup.c (main): If getopt fails, exit with status 127,
1568         not status 1.  POSIX requires this.
1569         * NEWS: Document this.
1571         * src/nice.c (main): Report proper program name when getopt finds
1572         trouble.  Problem reported by Behdad Esfahbod.
1574         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
1575         when the "+x" was being evaluated.
1576         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
1577         * mkfifo.c (main): Likewise.
1578         * mknod.c (main): Likewise.
1579         * tests/mkdir/perm: Test for the above bug.
1581 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
1583         Port test cases to Microsoft-Windows-related environments,
1584         following suggestions from Eric Blake.
1585         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
1586         * tests/install/basic-1: Undo previous change.
1587         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
1588         * tests/install/trap: Undo previous change.
1589         (sig): New var.  Use it insted of "trap '' CHLD".
1590         Append $EXEEXT to executable name.
1592         "fetish" -> "coreutils" in more places.
1593         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
1594         (package Coreutils): Renamed from package Fetish.  All uses changed.
1595         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
1596         remove Fetish.pm.
1598 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
1600         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
1601         directory is actually a symbolic link.  Problem reported by
1602         Eric Blake.
1604         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
1605         than the (incorrect) test -f and the (inadequate) ls.  ls is
1606         inadequate because on some hosts a buggy mv will create a file of
1607         the wrong type (problem reported by Eric Blake).  Skip this test
1608         if test -p doesn't work.
1610         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
1611         since the latter can have shell metacharacters in them (e.g., spaces).
1612         This follows up to the 2005-01-17 patch, which missed this occurrence.
1614 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
1616         "fetish" -> "coreutils" in several places.
1617         * Makefile.cfg (ftp): Remove fetish.sf.net.
1618         * Makefile.maint (emit_upload_commands): Likewise.
1619         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
1620         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
1621         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
1623         * tests/install/basic-1: Use "cat", not "test", to test for
1624         ../../src/dd.  Problem reported by Eric Blake.
1626 2005-04-18  Jim Meyering  <jim@meyering.net>
1628         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
1630 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
1632         Work around a couple of "make check" failures reported for Cygwin
1633         and ash by Eric Blake.
1634         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
1635         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
1637 2005-04-16  Jim Meyering  <jim@meyering.net>
1639         * src/dd.c (S_TYPEISSHM): Remove definition.
1640         Get the definition by including "stat-macros.h", instead.
1642 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
1644         Fix test suite problems reported by Eric Blake on Cygwin.
1645         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
1646         since POSIX doesn't require rename to fail across file systems.
1647         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
1648         it's more reliable.
1649         (other_partition_tmpdir): Remove df from name as that would be
1650         misleading now.
1652 2005-04-14  Jim Meyering  <jim@meyering.net>
1654         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
1656 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
1658         * src/ls.c (usage): "uid" -> "user ID".
1660 2005-04-12  Jim Meyering  <jim@meyering.net>
1662         * src/tsort.c (tsort): Use "%s" as the format string,
1663         rather than a diagnostic or a file name.
1665         * src/comm.c (compare_files): Remove declaration of unused local.
1667         * src/chown-core.c (chopt_free): Mark parameter as unused.
1669 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
1671         * man/chown.x: Reword to match user manual.
1672         * man/id.x: Likewise.
1673         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
1674         for "group ID".
1675         * src/whoami.c (usage, main): Likewise.
1677         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
1678         * src/comm.c: Include stdio-safer.h.
1679         (compare_files): Exit right away on I/O error rather than continuing
1680         and producing confusing output and error messages.
1681         Return void, not int; all callers changed.
1682         Use fopen_safer to avoid confusion with file descriptors.
1683         * src/copy.c: Include unistd-safer.h.
1684         (copy_reg): Use fd_safer.
1685         * src/csplit.c: Include stdio-safer.h.
1686         (input_desc): Remove unnecessary static initialization.
1687         (set_input_file): Use STDIN_FILENO, not 0.
1688         (create_output_file): Use fopen_safer.
1689         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
1690         return stdin.
1691         * src/head.c (head_file): Don't assume open does not return 0.
1692         * src/join.c: Include stdio-safer.h.
1693         (main): Use fopen_safer.  Simplify the resulting code.
1694         * src/md5sum.c (digest_file, digest_check):
1695         Don't assume that fopen does not return stdin.
1696         * src/nohup.c: Include unistd-safer.h.
1697         (main): Don't dup stderr to stdin or stdout by mistake.
1698         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
1699         * src/paste.c (paste_serial): Likewise.
1700         * src/pr.c: Include stdio-safer.h.
1701         (open_file): Use fopen_safer.
1702         (close_file): Don't assume fopen does not return stdin.
1703         * src/ptx.c (main): Don't assume fopen returns stdout after closing
1704         stdout.  Use freopen instead.
1705         * src/shred.c: Include unistd-safer.h.
1706         (wipename): Use fd_safer on directory file descriptor.
1707         (wipefile): Remove special case for /dev/fd/* on older hosts.
1708         It didn't work in general, and wasn't documented.
1709         Use fd_safer.
1710         * src/sort.c: Include unistd-safer.h.
1711         (create_temp_file): Use fd_safer.
1712         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
1713         * src/split.c: Include unistd-safer.h.
1714         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
1715         version, as POSIX requires.
1716         * src/sum.c (bsd_sum_file, sysv_sym_file):
1717         Use same pattern as elsewhere for checking for stdin.
1718         * src/tac.c: Include unistd-safer.h.
1719         (copy_to_temp): Use fd_safer.
1720         (tac_file): Don't assume fopen cannot return stdin.
1721         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
1722         (recheck, tail_file): Use fd_safer rather than open_safer.
1723         * src/tee.c: Include stdio-safer.h.
1724         (tee): Use fopen_safer.
1725         * src/touch.c: Include unistd-safer.h.
1726         (touch): Use fd_safer.
1727         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
1728         removed.
1729         (tsort): Do not assume fopen can't return stdin.
1730         Close stdin before returning.  All uses changed.
1731         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
1732         * src/uniq.c: Include stdio_safer.h.
1733         (check_file): Don't assume fopen cannot return stdin or stdout.
1735 2005-04-09  Jim Meyering  <jim@meyering.net>
1737         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
1739         Now that close_stdout closes standard output unconditionally,
1740         these workarounds for dd and cat are no longer necessary.
1741         * src/dd.c (close_stdout_wrapper): Remove function.
1742         (main): Call atexit with close_stdout, instead.
1743         * src/cat.c (close_stdout_wrapper): Likewise.
1744         Don't close STDOUT_FILENO explicitly; close_stdout does it.
1746         * src/system.h (__attribute__): Readability nit:
1747         Change this:
1748         #  define __attribute__(x)
1749         to this:
1750         #  define __attribute__(x) /* empty */
1752 2005-04-09  Jim Meyering  <jim@meyering.net>
1754         * src/rm.c (usage): Mention that --recursive removes listed
1755         directories too, not just their contents.
1756         Say that by default, rm does not remove directories.
1758         * src/pr.c: Don't include "timespec.h".  system.h does that.
1759         * Makefile.maint (sc_system_h_headers): Propagate exit status
1760         through trap.
1762 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
1764         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
1765         and when conforming to POSIX no longer treats USR1 specially.
1766         Document that dd no longer dumps core when handling signals.
1767         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
1768         replaced with void.
1769         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
1770         All uses changed.
1771         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
1772         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
1773         behavior when called from a signal handler.  All uses changed.
1774         (main) [!defined SA_NOCLDSTOP]:
1775         Use siginterrupt to specify that system calls should be interrupted.
1776         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
1777         (process_signals): Add forward decl.
1778         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
1779         New macros.
1780         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1781         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
1782         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
1783         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
1784         New vars.
1785         (usage): Mention -USR1 versus -INFO.
1786         (cleanup): Don't invoke print_stats; the caller must do it now.
1787         All callers changed.
1788         (quit): Process signals just before exiting.
1789         (interrupt_handler): Simply record the signal and return.
1790         (siginfo_handler): Simply increment the signal counter and return.
1791         (install_handler): Remove, replacing with:
1792         (install_signal_handlers, process_signals, iread, iwrite):
1793         New functions.  All callers to safe_read and full_write replaced
1794         by iread and iwrite.  All callers to install_handler replaced by
1795         install_handlers.
1796         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
1797         All uses changed.
1798         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1799         (main) [! SA_NOCLDSTOP]: Use it.
1800         * src/shred.c: Remove all uses of signals; modern hosts have
1801         /dev/random and don't need this gorp.
1802         Do not include signal.h.
1803         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
1804         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
1805         All uses changed.
1806         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1807         (main) [! SA_NOCLDSTOP]: Use it.
1809         * src/dd.c: Do not include inttostr.h, no longer needed.
1810         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
1811         instead of umaxtostr.
1812         (print_stats): Work even in languages that have special
1813         forms for two of things, for r_truncate and w_bytes.  We can't
1814         fix delta_s in this way, since ngettext doesn't support floating-point.
1815         (main): Rewrite to avoid casts.
1817 2005-04-07  Jim Meyering  <jim@meyering.net>
1819         Placate gcc-4's -Wuninitialized.
1820         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
1821         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
1823         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
1824         be `const'.
1825         (binop): Move function definition to precede first use so we can...
1826         (binop): ...remove prototype.
1828 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
1830         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
1831         * src/basename.c (usage): Add examples.
1832         * src/cat.c (usage): Likewise.
1833         * src/chgrp.c (usage): Likewise.
1834         * src/chown.c (usage): Likewise.
1835         * src/dirname.c (usage): Likewise.
1837 2005-04-05  Jim Meyering  <jim@meyering.net>
1839         * src/nice.c (usage): Mention that some shells provide a
1840         built-in function by the same name.
1841         * src/nohup.c (usage): Likewise.
1842         * src/printenv.c (usage):Likewise.
1844 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
1846         * src/tee.c (tee): When closing files, do not close stdout,
1847         leave this job to close_stdout() instead.
1848         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
1849         * tests/Makefile.am (SUBDIRS): Add tee.
1850         * tests/tee/Makefile.am: New file.
1851         * tests/tee/.cvsignore: Likewise.
1852         * tests/tee/{basic,dash}: New tee tests.
1854 2005-04-04  Jim Meyering  <jim@meyering.net>
1856         * src/echo.c (usage): Mention that some shells provide a
1857         built-in function by the same name.
1858         * src/kill.c (usage): Likewise
1859         * src/printf.c (usage): Likewise.
1860         * src/pwd.c (usage): Likewise.
1861         * src/stat.c (usage): Likewise.
1862         * src/test.c (usage): Likewise.
1863         * src/true.c (usage):
1864         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
1866         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
1867         * man/printf.x: Likewise.
1868         * man/pwd.x: Likewise.
1870 2005-04-03  Jim Meyering  <jim@meyering.net>
1872         * src/pr.c (main): Fix off-by-one error.
1873         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
1874         end of a malloc'd buffer.
1876 2005-04-01  Jim Meyering  <jim@meyering.net>
1878         * src/pr.c (main): Free column_count_string when done with it.
1880         Don't let pr treat +1:-1 like +1:18446744073709551615.
1881         * src/pr.c (strtoumax): Remove declaration.
1882         (first_last_page): Use xstrtoumax in place of strtoumax,
1883         so we don't interpret a negative page number (e.g., in an option
1884         like --pages=1:-1) as valid.
1885         * tests/pr/Test.pm (neg-page): Add a test for this.
1887 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
1889         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
1890         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
1891         * src/users.c (users): Likewise.
1892         * src/who.c (who): Likewise.
1893         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
1894         * src/users.c (main): Likewise.
1895         * src/who.c (main): Likewise.  Also with two arguments.
1896         Omit duplicate code in 2-arg case.
1897         (UT_PID): Moved to ../lib/readutmp.h.
1899 2005-03-29  Jim Meyering  <jim@meyering.net>
1901         * src/system.h (ptr_align): Declare `ptr' parameter to be a
1902         `const' pointer, since this function never writes through it.
1904         * src/uname.c: Indent cpp directives to reflect nesting.
1906 2005-03-28  Jim Meyering  <jim@meyering.net>
1908         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
1909         Add `void' to make this an ANSI-style function declaration.
1910         * src/remove.c (ds_init): Likewise.
1911         * src/pr.c (print_sep_string): Likewise.
1913         * src/stty.c (speeds): Declare this array to be static.
1914         * src/Makefile.am (sc_tight_scope): Adjust to catch any
1915         new declarations like that of stty.c's `speeds'.
1917         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
1918         (GETOPT_VERSION_OPTION_DECL): Likewise.
1919         * src/chown.c (long_options): Likewise.
1920         * src/chgrp.c (long_options): Likewise.
1921         * src/chmod.c (long_options): Likewise.
1922         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
1923         Likewise.
1924         * src/chown-core.c (chopt_init): Likewise.
1925         * src/comm.c (long_options): Likewise.
1926         * src/copy.c (copy_reg): Likewise.
1927         * src/csplit.c (extract_regexp): Likewise.
1928         * src/cut.c (longopts): Likewise.
1929         * src/date.c (time_spec_string): Likewise.
1930         * src/df.c (find_mount_point, show_point): Likewise.
1931         * src/expr.c (docolon): Likewise.
1932         * src/fmt.c (long_options): Likewise.
1933         * src/ls.c (time_style_args, indicator_style_args, long_options)
1934         (format_args, sort_args, time_args, decode_switches)
1935         (gobble_file): Likewise.
1936         * src/md5sum.c (long_options): Likewise.
1937         * src/mv.c (reply_args): Likewise.
1938         * src/paste.c (longopts): Likewise.
1939         * src/pinky.c (print_entry): Likewise.
1940         * src/pr.c (long_options): Likewise.
1941         * src/ptx.c (long_options, format_args): Likewise.
1942         * src/readlink.c (longopts): Likewise.
1943         * src/sort.c (long_options, mergefps): Likewise.
1944         * src/stat.c (long_options): Likewise.
1945         * src/tac.c (main): Likewise.
1946         * src/tail.c (follow_mode_string): Likewise.
1947         * src/touch.c (longopts, time_args): Likewise.
1948         * src/uniq.c (delimit_method_string): Likewise.
1949         * src/uptime.c (print_uptime): Likewise.
1950         * src/who.c (print_user): Likewise.
1952 2005-03-27  Jim Meyering  <jim@meyering.net>
1954         * src/dcgen: Simplify further, clean up.
1955         Add a standard-output-closing global destructor.
1956         Require perl-5.002.
1957         * src/wheel-gen.pl: Use the same global destructor as dcgen.
1959 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
1961         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
1962         array of adjacent strings rather than a more complicated data
1963         structure; this saves space in the dircolors executable.
1964         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
1965         This avoids casts.
1966         (dc_parse_stream, main): Avoid casts.
1967         Adjust to simpler data structure generated by new dcgen.
1969 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
1971         * src/ls.c (usage): Document usage of LS_COLORS.
1973 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
1975         * src/dircolors.hin: Add "TERM cygwin".
1977 2005-03-25  Jim Meyering  <jim@meyering.net>
1979         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
1980         the return value, and update callers:
1981         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
1982         * src/expand.c (parse_tab_stops, main): Likewise.
1983         * src/split.c (main): Likewise.
1984         * src/unexpand.c (parse_tab_stops, main): Likewise.
1985         * src/uniq.c (main): Likewise.
1987 2005-03-22  Jim Meyering  <jim@meyering.net>
1989         * build-aux: New directory.  Renamed from config.
1990         * configure.ac: Reflect renaming: config -> build-aux.
1991         * Makefile.am (dist-hook): Likewise.
1992         * Makefile.maint: Likewise.
1993         * Makefile.cfg (cvs_files): Likewise.
1994         * .x-sc_sun_os_names: Likewise.
1995         * .x-sc_trailing_blank: Likewise.
1997         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
1998         portability to EBCDIC hosts.
2000 2005-03-20  Jim Meyering  <jim@meyering.net>
2002         * src/pr.c (init_header): Add missing `%' in new format string.
2003         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
2005 2005-03-19  Jim Meyering  <jim@meyering.net>
2007         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
2008         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
2010 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
2012         * NEWS: pr -D "FORMAT" now accepts the same formats that
2013         date +"FORMAT" does.
2014         * src/pr.c: Include strftime.h, timespec.h.
2015         (init_header): Obtain and format nanosecond part of time stamp.
2017         * NEWS: nohup now ignores the umask when creating nohup.out.
2018         nohup now closes stderr if it is a terminal and stdout is closed.
2019         * src/nohup.c (main): Likewise.  Be a little more paranoid about
2020         return values; e.g., check for any negative return from open.
2021         Assume free (NULL) works.
2022         Close file descriptor leak when redirecting standard output to a file.
2024 2005-03-17  Jim Meyering  <jim@meyering.net>
2026         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
2027         in place of functionally-equivalent code.
2028         * src/expand.c (parse_tab_stops, main): Likewise.
2029         * src/split.c (main): Likewise.
2030         * src/unexpand.c (parse_tab_stops, main): Likewise.
2031         * src/uniq.c (main): Likewise.
2032         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
2033         declaration.
2034         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
2035         New macros.
2037         Before, this command would make uniq skip 11 fields and print
2038         only the first line:
2039         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
2040         1 1
2041         1 2
2042         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
2043         not like `uniq -f11'.
2045 2005-03-15  Jim Meyering  <jim@meyering.net>
2047         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
2048         `pr -0' should give a better diagnostic and `pr -03' should be
2049         equivalent to `pr -3'.
2050         * src/pr.c (parse_column_count): Change return type to void.
2051         Call error (EXIT_FAILURE, ... for an invalid string.
2052         (main): Allocate space for column_count_string using malloc.
2053         Accumulate all old-style column-count digits before converting.
2054         When the number of columns is specified via both old-style,
2055         (e.g., -3), and a long option (--columns=5), ensure that only
2056         the last one specified takes effect.
2057         * tests/pr/Test.pm: Add tests for the above.
2059 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
2061         * src/copy.c (copy_reg): Copy regular files in binary mode.
2063 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
2065         * NEWS: Restate why ls limits time stamp lengths.
2067 2005-03-12  Jim Meyering  <jim@meyering.net>
2069         Add a little infrastructure to help prevent future bugs like the
2070         one fixed below.
2071         * src/stat.c (xstrcat): New function.
2072         (print_statfs, print_stat): Add buf_len parameter and convert all
2073         uses of strcat to xstrcat.  Update callers.
2074         (print_it): Call print_func with buf_len parameter.
2076         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
2077         could cause a buffer overrun error.
2078         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
2079         conversion of the stat %s format string to the longer printf %llu one.
2080         Patch from Guochun Shi.
2082 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
2084         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
2085         (long_time_expected_width, print_long_format): Use it, to avoid
2086         some possible denial-of-service attacks.
2087         * NEWS: Document this.
2089 2005-03-11  Jim Meyering  <jim@meyering.net>
2091         Prompt once again for `mv -i A B' when A and B are hard links
2092         to the same file.  This fixes a bug introduced by my 2003-04-04
2093         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
2094         * src/copy.c (abandon_move): New function, factored out of
2095         copy_internal, now that this code is being used from two places.
2096         (copy_internal): Perform the same interactive-related test for
2097         whether it's alright to proceed and (usually) overwrite the
2098         destination file.
2099         * tests/mv/i-4: Add tests for the above.
2101         Don't segfault for a very long date format string, e.g.,
2102         ls -ld --time-style=+%99999999H .
2103         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
2104         so format string abuse cannot provoke stack overflow.
2105         (print_long_format): Likewise.
2107         Don't segfault for a long header date string, e.g.,
2108         echo a|pr -D +%9999999A
2109         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
2110         Don't bother with fixed-sized initial buffer;  always use x*alloc.
2112         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
2113         in place of equivalent INT_STRLEN_BOUND + 1.
2114         * src/expr.c (tostring, printv): Likewise.
2116 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
2118         * src/system.h: Include intprops.h.
2119         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
2120         they are now defined in intprops.h.
2122 2005-03-09  Jim Meyering  <jim@meyering.net>
2124         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
2126 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
2128         * src/date.c (usage): Redo to match recent documentation changes.
2129         Don't bother documenting which usages are GNU extensions; the list
2130         wasn't correct, and is better left to the printed manual anyway.
2132 2005-03-06  Jim Meyering  <jim@meyering.net>
2134         Factor out column-count processing.
2135         * src/pr.c: Include "inttostr.h".
2136         (parse_column_count): New function.
2137         (main): Use the new function for both old-style, -9, and long,
2138         --columns=-9, options.
2140         * src/cksum.c: Remove `register' keyword.
2141         * src/cut.c: Likewise.
2142         * src/dd.c: Likewise.
2143         * src/env.c: Likewise.
2144         * src/factor.c: Likewise.
2145         * src/fmt.c: Likewise.
2146         * src/fold.c: Likewise.
2147         * src/id.c: Likewise.
2148         * src/logname.c: Likewise.
2149         * src/ls.c: Likewise.
2150         * src/pr.c: Likewise.
2151         * src/printf.c: Likewise.
2152         * src/shred.c: Likewise.
2153         * src/sort.c: Likewise.
2154         * src/sum.c: Likewise.
2155         * src/test.c: Likewise.
2156         * src/tsort.c: Likewise.
2157         * src/uniq.c: Likewise.
2158         * src/wc.c: Likewise.
2159         * src/whoami.c: Likewise.
2161 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
2163         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
2164         longer needed.
2166 2005-03-01  Jim Meyering  <jim@meyering.net>
2168         * src/copy.c (copy_internal): Change test of source type from
2169         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
2170         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
2172 2005-02-28  Jim Meyering  <jim@meyering.net>
2174         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
2176 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
2178         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
2179         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
2180         hosts with clock_gettime.
2182 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
2184         * NEWS: Describe user-visible change to dd.
2185         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
2186         Remove $(LIB_CLOCK_GETTIME).  These functions now use
2187         gethrxtime instead.
2188         * src/dd.c: Include gethrxtime.h, xtime.h.
2189         (start_time): Now of type xtime_t, not struct timespec.
2190         (print_stats, main): Use gethrxtime rather than gettime.
2191         * src/ls.c (time): Remove obsolete decl.
2192         (get_current_time): gettimeofday always returns 0, so don't
2193         check its result.
2194         * src/shred.c: Include gethrxtime.h.
2195         (isaac_seed): Use gethrxtime rather than a mishmash.
2196         * src/touch.c (time): Remove obsolete decl.
2198         * tests/misc/split-fail: Don't assume that the current host
2199         supports integers wider than 32 bits.  Fix comment typo.
2200         * tests/od/x8: Likewise.
2202         * src/chown-core.c (enum RCH_status): Remove trailing comma,
2203         as it's not valid in standard C89.
2205 2005-02-15  Jim Meyering  <jim@meyering.net>
2207         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
2208         so that file systems of type `xfs' are recognized as such.
2209         * src/fs.h: Regenerate.
2210         Reported by Bernd Eckenfels.
2211         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
2212         * src/fs.h: Regenerate.
2213         Reported by Andreas Schwab.
2215         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
2216         to work around the invalid definition from Darwin 7.7.0.
2217         Test failure reported by Sébastien Maret.
2219 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
2221         * src/sort.c (mergefps): Use binary search rather than linear one
2222         when comparing new line to lines already in main memory.
2223         Idea suggested by James Lemley.
2225 2005-02-09  Jim Meyering  <jim@meyering.net>
2227         * src/copy.c (valid_options): Add an assertion that
2228         not both hard_link and symbolic_link are set.
2230 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
2232         * NEWS: Document stat -f -c %S, plus changes to default formats.
2233         * doc/coreutils.texi (stat invocation): Normalize terminology,
2234         capitalization, and sort order to match --help output.  Mention %c
2235         for file systems.  Add new -f -c format %S, and document %s versus %S;
2236         problem reported by Jeroen van Wolffelaar.
2237         * src/stat.c (usage): Likewise.
2238         (STATFS_FRSIZE): New macro.
2239         (print_statfs): Use it, for stat -f -c %S.
2240         (do_statfs): Change default formats to output %S.
2242 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
2244         * src/system.h: Include "memrchr.h".
2245         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
2247 2005-02-02  Jim Meyering  <jim@meyering.net>
2249         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
2250         systems that don't support sparse files.
2251         Check for $2 -ge 128, rather than $2 = 128, in case
2252         there is a file system type that doesn't support sparse files,
2253         yet for which metadata takes up additional space.
2254         Both reported by Andreas Schwab.
2256 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
2258         * tests/du/8gb: Create a larger test file, so we properly
2259         detect that sparse files can be created on NTFS under cygwin.
2261 2005-01-30  Jim Meyering  <jim@meyering.net>
2263         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
2265         * src/stty.c: Remove unnecessary parentheses in all #if directives.
2267 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
2269         * .cvsignore: Ignore config.cache and config.status.lineno.
2270         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
2271         instead of VSWTCH, for use with CSWTCH.
2273 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
2275         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
2276         * tests/rwx-to-mode: Ignore ACL designation.
2277         * tests/setgid-check: Likewise.
2278         * tests/chown/separator: Quote user and group names.
2280 2005-01-24  Jim Meyering  <jim@meyering.net>
2282         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
2283         Suggestion from Johan Boule.
2285 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
2287         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
2288         duplicates.
2289         * man/Makefile.am (all_programs): Revert previous patch; updated
2290         all_programs.list fixes this.
2291         (.x.1): No need to add $(EXEEXT).
2293 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
2295         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
2296         available.
2298 2005-01-22  Jim Meyering  <jim@meyering.net>
2300         * Makefile.maint (v_etc_file): The version string has moved to
2301         version-etc-fsf.c, search that new file, not version-etc.c.
2303 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
2305         * tests/group-names: Use numeric group ids, not symbolic group names,
2306         since the latter can have shell metacharacters in them (e.g., spaces).
2307         Problem reported by Eric Blake.
2308         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
2309         * tests/chgrp/deref: Likewise.
2310         * tests/chgrp/posix-H: Likewise.
2311         * tests/chgrp/recurse: Likewise.
2313 2005-01-15  Jim Meyering  <jim@meyering.net>
2315         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
2316         because just calling gethrtime evokes an `illegal instruction'
2317         failure when compiled with Sun's c89 on Solaris 8 and 9.
2318         Reported by Nelson Beebe.
2320         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
2321         twice with the same value of `t'.
2322         Replace nested #if-#else blocks with #if-#elif-#elif chain.
2324 2005-01-14  Jim Meyering  <jim@meyering.net>
2326         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
2327         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
2328         sockets, since that's what you get when reading from a command-line-
2329         supplied pipe on Darwin 7.7.
2330         (IS_PIPE_LIKE_FILE_TYPE): Define.
2331         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
2332         Reported by Nelson Beebe.
2333         This same change is also required on NetBSD/sparc-1.5.
2334         Reported by Adrian Bunk.
2336         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
2337         rather than suffering silently.
2338         Before, expr would silently overflow and wrap around:
2339           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
2340           1
2341         Now it detects the problem and exits nonzero:
2342           $ ./expr $(echo 2^63|bc) = 0
2343           ./expr: 9223372036854775808: integer is too large
2345         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
2346         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
2347         reported that this test would fail with the diagnostic,
2348         `cannot find name for group ID 10', on one of his systems.
2350 2005-01-13  Jim Meyering  <jim@meyering.net>
2352         * src/test.c (is_int): Don't overflow when evaluating integer
2353         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
2354         would print `FAIL'.
2356         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
2357         names of temporary files that would clash on 8.3 file systems.
2358         * tests/mk-script (validate): Likewise.
2360 2005-01-12  Jim Meyering  <jim@meyering.net>
2362         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
2364         * tests/tr/Test.pm (repeat-xC): Change test name from
2365         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
2366         Reported by Eric Blake.
2367         (repeat-000): Rename to `repeat-zeros' for the same reason.
2369 2005-01-11  Jim Meyering  <jim@meyering.net>
2371         * configure.ac: Update version to 5.3.1.
2373 2005-01-11  Eric Blake  <ebb9@byu.net>
2375         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
2376         * man/Makefile.am (all_programs): Account for $(EXEEXT).
2378 2005-01-11  Jim Meyering  <jim@meyering.net>
2380         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
2381         with decreasing values.
2383         * src/expand.c (main): Likewise.
2384         * src/unexpand.c (main): Check for overflow in tabstop values
2385         specified via the obsolete form.  E.g., now this command fails:
2386         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
2387         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
2388         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
2390 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
2392         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
2393         * NEWS: Document the changes.
2394         * doc/coreutils.texi (pathchk invocation): Likewise.
2395         * src/pathchk.c (PORTABILITY_OPTION): New constant.
2396         (longopts, usage, main, validate_file_name):
2397         Add support for new -P option.
2398         Reject empty file names (unless -p is not specified and the
2399         current system allows empty file names).
2400         Change --portability so that is now equivalent to -p -P.
2401         Don't test whether file name is too long, if it is known to exist.
2402         (no_leading_hyphen): New function.
2403         * tests/misc/pathchk1: Add tests for empty file names and
2404         pathchk -P.
2406 2005-01-08  Jim Meyering  <jim@meyering.net>
2408         * Version 5.3.0.
2410         `pr --columns=N' was not equivalent to `pr -N' when also using
2411         either -s or -w.
2413         * src/pr.c (main): Set `explicit_columns' for --columns=N,
2414         not just for -N.  This bug has existed since the introduction
2415         of the --columns=N option on 1998-08-15.
2416         * NEWS: Document this.
2417         * tests/pr/Test.pm (test_vector): For each -N test, automatically
2418         create a new test vector using --columns=N.
2420 2005-01-07  Paul Eggert  <eggert@twinsun.com>
2422         * src/pr.c (main): Check for column count overflow with
2423         usages like "pr -2147483648".
2425 2005-01-07  Jim Meyering  <jim@meyering.net>
2427         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
2429 2005-01-06  Jim Meyering  <jim@meyering.net>
2431         * README: List the precise HP-UX version numbers that are affected.
2432         Suggestion from Bob Proulx.
2434         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
2435         predicate before `-name ChangeLog' to avoid a harmless warning
2436         from find-4.2.10.
2438 2005-01-05  Jim Meyering  <jim@meyering.net>
2440         * tests/help-version: Punt on the uptime test, since it fails when
2441         it can't get boot time, and I don't want that to stop `make check'.
2443         * src/du.c (process_file): Evaluate exclusion rules against
2444         the entire file name, not just the last component.
2445         Reported by Robert Lindgren.
2446         * tests/du/exclude: Test for this.
2447         * NEWS: Document this.
2449         Ensure that tests/Makefile.am's check-root actions stay up to date.
2450         * Makefile.maint (sc_root_tests): New rule.
2451         (syntax-check-rules): Add it to the list.
2453 2005-01-04  Jim Meyering  <jim@meyering.net>
2455         * man/shred.x: Change one-line summary to reflect that shred does
2456         not remove files by default.  Suggestion from Helen Faulkner in
2457         http://bugs.debian.org/288552
2459         * README: Request VERBOSE=yes output when reporting test failures.
2460         Other minor changes.
2462         * tests/Makefile.am (check-root): Update.
2464 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
2466         * src/system.h: Undo previous change; we now use Autoconf.
2468 2005-01-03  Jim Meyering  <jim@meyering.net>
2470         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
2471         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
2472         either (or both) to zero would succeed, but subsequent `stty size'
2473         would say `no size information for this device' due to the ioctl
2474         failing with EINVAL.
2476         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
2477         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
2478         then fail at compile-time rather than let tools like od produce
2479         invalid results at run time.
2481 2004-12-21  Jim Meyering  <jim@meyering.net>
2483         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
2484         not `xx01, xx02, ...'.
2485         Reported by Matt Kraai in http://bugs.debian.org/286605
2487         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
2488         when using c89.
2490 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
2492         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
2494 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
2496         * NEWS: Mention that one should eval "`dircolors`" rather than
2497         `dircolors`.
2499 2004-12-17  Jim Meyering  <jim@meyering.net>
2501         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
2502         so temporary directories aren't left behind upon e.g., interrupt.
2504 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
2506         * src/ls.c (print_dir): Use "%s: not listing already-listed
2507         directory", not "not listing already-listed directory: %s", to
2508         format already-listed directories, to be consistent with other
2509         diagnostics involving file names and colons.
2511 2004-12-15  Jim Meyering  <jim@meyering.net>
2513         * src/Makefile.am (__LDADD): Define, so that building `[' on
2514         Solaris still uses the -lgen library that it requires in order
2515         to get a definition of eaccess.
2517 2004-12-14  Jim Meyering  <jim@meyering.net>
2519         tac would exit immediately upon I/O or temp-file creation failure.
2520         Now it continues on, processing any remaining command line arguments.
2522         * src/tac.c: Include quotearg.h.
2523         Use quotearg_colon in most diagnostics.
2524         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
2525         failure.  Before, this command (with /full/tmp being a full partition)
2526           TMPDIR=/full/tmp ./tac /proc/modules tac.c
2527         would exit immediately upon the write error while trying to copy
2528         non-seekable /proc/modules to the full partition.  Now it still
2529         reports the failure but continues on with the remaining file.
2530         (tac_nonseekable): Return false also if copy_to_temp fails.
2531         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
2532         using atexit like this is wrong.
2533         * NEWS: Document this.
2534         * tests/misc/tac-continue: New test for this.
2535         * tests/misc/Makefile.am (TESTS): Add tac-continue.
2537         * tests/chown/basic: Add a few more tests.
2539 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
2541         * src/ls.c (gobble_file): Change arg name to be command_line_arg
2542         rather than explicit_arg, for consistency with copy.c.
2543         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
2544         it is deducible from dirname arg.  All callers changed.
2545         (extract_dirs_from_files, print_dir, queue_directory):
2546         Add command_line_arg arg.  All callers changed.
2547         (struct pending): Add command_line_arg member.
2548         (main): Use NULL rather than 0 when appropriate.
2549         (set_exit_status, file_failure): New functions.
2550         (queue_directory): Store command_line_arg into new structure.
2551         (print_dir, gobble_file, get_link_name):
2552         Use file_failure to report problems in accessing files,
2553         so that the exit status is set consistently.
2554         (print_dir): Simplify readdir failure code yet again.
2555         If closedir fails, report "closing directory" rather than "reading
2556         directory" failure.
2557         (xstrcoll): Use set_exit_status to set status on failure.
2558         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
2559         not status 1.
2561 2004-12-11  Jim Meyering  <jim@meyering.net>
2563         Avoid a race condition vulnerability in chown, when used with
2564         --from=O:G and without the (-h) --no-dereference option.
2565         * src/chown-core.c (restricted_chown): New function.
2566         (change_file_owner): Call it.
2567         Reported by Ulrich Drepper.
2568         * NEWS: Mention this.
2570 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
2572         * ls now exits with status 1 on minor problems, 2 if serious trouble.
2573         * NEWS: Document this.
2574         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
2575         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
2576         specified below.
2577         (main): Initialize exit failure to LS_FAILURE.
2578         (print_dir, gobble_file, get_link_name, xstrcoll):
2579         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
2580         (print_dir): Do not give up on entire directory merely because readdir
2581         returns EOVERFLOW.
2582         (usage): Explain exit status.
2583         * tests/help-version: ls and variants now exit with status 2
2584         on serious trouble.
2586 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
2588         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
2589         together.
2591 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
2593         * src/factor.c (factor): Don't list 1 as a factor of 1.
2594         Problem reported by Thomas Folz-Donahue.
2596 2004-12-06  Jim Meyering  <jim@meyering.net>
2598         * tests/du/files0-from: Sanitize environment.
2599         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
2600         setting is the default (exported from /etc/profile) on at least one
2601         NetBSD 1.6 system.
2602         * tests/du/no-deref: Likewise.
2603         * tests/cp/symlink-slash: Likewise.
2604         * tests/ls/symlink-slash: Likewise
2606 2004-12-05  Jim Meyering  <jim@meyering.net>
2608         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
2609         _POSIX2_VERSION=199209 is in the environment, or when building on
2610         e.g., OpenBSD 3.2.
2612 2004-12-04  Jim Meyering  <jim@meyering.net>
2614         * NEWS: Mention cut's new --complement option.
2616 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
2618         * cut.c (complement, COMPLEMENT_OPTION): New.
2619         (longopts): Add --complement.
2620         (usage): Say not that -b, -c, and -f `print' fields,
2621         but rather that they `select' fields for printing.
2622         Describe the new --complement option.
2623         (mark_range_start): Extracted from set_fields.
2624         (print_kth): Support --complement.
2625         (compare_ranges): New function.
2626         (set_fields): Rewrite the part that populates range_start_ht,
2627         merging it with the part that populates printable_field.
2628         (main): Handle --complement.
2630 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
2632         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
2633         failed.  This works around an assertion failure reported by
2634         Roberto Nibali in:
2635         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
2637 2004-12-02  Jim Meyering  <jim@meyering.net>
2639         With using --color and with LS_COLORS saying not to color
2640         executables, don't stat every file.
2641         * src/ls.c (is_colored): New function.
2642         (gobble_file): Use it.
2643         (main): Use it here, in place of too-strict tests against NULL:
2644         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
2645         old test would fail.
2647 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
2649         * src/comm.c (compare_files): Assume setlocale exists.
2650         * src/join.c (keycmp): Likewise.
2651         * src/seq.c (decimal_point): Treat like sort.  Now char.
2652         All uses changed.
2653         (main): Assume localeconv exists.  Use same code as sort.
2654         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
2655         Assume setlocale exists.
2656         (thousands_sep): Renamed from th_sep.
2657         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
2658         (NONZERO): Parenthesize use of arg.
2659         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
2660         consistency.  Avoid unnecessary negation by reversing
2661         fraccompare args.
2662         (main): Rewrite localeconv call to match seq.c.
2663         * src/system.h: Assume locale.h exists.
2664         (HAVE_SETLOCALE): Remove.
2665         * src/uniq.c (different): Assume setlocale exists.
2667         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
2668         'volatile' on a local variable.  Rewrite to avoid unnecessary
2669         double-assignment to 'func' in the usual case where strcoll does
2670         not fail.
2672 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
2674         * src/pinky.c (gethostname): Remove decl.
2675         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
2676         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
2677         UT_TYPE_BOOT_TIME instead of by-hand code.
2678         * src/users.c (list_entries_users): Use IS_USER_PROCESS
2679         instead of by-hand code.
2680         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
2681         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
2682         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
2683         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
2684         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
2685         (gethostname): Remove decl.
2686         (list_entries_who, scan_entries): Use the new macros defined above,
2687         for consistency with pinky, uptime, and users.
2689 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
2691         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
2692         HP's ANSI C compiler.  Declaring int functions causes warnings on
2693         some modern systems and shouldn't be needed to compile on ancient
2694         ones.
2695         * src/copy.h (stat, lstat, rename): Remove decls.
2696         * src/install.c (stat): Remove decl.
2697         * src/ln.c (link, symlink): Remove decls.
2699 2004-11-25  Jim Meyering  <jim@meyering.net>
2701         * man/help2man: Import help2man-1.35.1.
2702         * man/Makefile.am (.x.1): Remove now-unnecessary use of
2703         locally-added --program-name=NAME option.  Now, help2man gets
2704         the name from the [NAME] section (i.e. from our .x file).
2705         * man/install.x: Use `install', not `ginstall' in the one-line
2706         description.  Reported by Brendan O'Dea.
2707         * man/sha1sum.x: Use `sha1sum', not `shasum'.
2709 2004-11-24  Jim Meyering  <jim@meyering.net>
2711         Since the changes of 2004-05-22, the u.saved_cwd member at
2712         the bottom of the active-directory stack was no longer
2713         strictly necessary.  This change removes that member and uses
2714         the newer cwd_state parameter for the final restore_cwd.
2716         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
2717         [dev_ino]: Rename from `a'.
2718         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
2719         bottom-of-stack cwd-state member.
2720         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
2721         (AD_push_initial): Remove CWD parameter.  Adjust caller.
2723 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
2725         Minor performance improvements and cleanups for "touch".
2726         * src/touch.c (posix_date): Remove; not needed as a static var.
2727         All uses rewritten.
2728         (touch): Use new futimens function to operate more efficiently
2729         in some cases.  Don't stat/fstat existing file when
2730         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
2731         old time stamps aren't needed in that case.
2732         (main): change_times is int, not bool.  Simplify test for
2733         change_times.
2735 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
2737         * src/install.c (usage): Avoid usage that runs afoul of Docbook
2738         translation.  Problem reported by Eric S. Raymond.
2740         Restore dd's noctty flag, reverting the change of 2004-04-08.
2741         POSIX does not allow "dd" to use O_NOCTTY by default.
2742         * NEWS: Add noctty flag to dd.
2743         * doc/coreutils.texi (dd invocation): Likewise.
2744         * src/dd.c (flags, usage, main): Likewise.
2746 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
2748         * src/ls.c (usage): Clarified description of --no-group (-G),
2749         --human-readable (-h), --inode (-i), --size (-s), --time,
2750         and --time-style.
2752 2004-11-19  Jim Meyering  <jim@meyering.net>
2754         * src/ls.c (usage): Clarify description of --author.
2755         Tweak indentation so that help2man creates better nroff.
2756         Reported by Dan Jacobson.
2758         * src/uniq.c (check_file): Don't check stdout for errors here.
2760         * src/pwd.c (find_dir_entry): Update comment to match reality.
2762 2004-11-18  Jim Meyering  <jim@meyering.net>
2764         * src/pwd.c (robust_getcwd): Correct the comment: this function
2765         constructs the directory name.  The caller prints it.
2767 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
2769         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
2770         (do_statfs): Use it.
2772         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
2773         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
2774         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
2775         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
2776         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
2777         * src/readlink.c (main): argv is not const.
2779         * src/cut.c (usage): Improve documentation along the lines suggested
2780         by Debian 5.2.1-2.
2781         * src/echo.c (usage): Likewise.
2782         * src/expr.c (usage): Likewise.
2784         * src/dircolors.hin: Add putty, screen-bce.
2786         * src/pinky.c (print_entry): Fix memory leak.
2787         * src/who.c (print_user): Likewise.
2789 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
2791         * NEWS: New dd operand "status=noxfer".
2792         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
2793         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
2794         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
2795         macros.
2796         (STATUS_NOXFER, statuses): New constants.
2797         (usage, print_stats, scanargs): Add support for status=noxfer.
2798         (usage): Update status output to match new behavior.
2799         (print_stats): Always output complete byte count.
2800         Put space between numbers and units, as SI requires.
2801         Use ngettext so that i18n can use plurals for "byte" and "second".
2802         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
2803         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
2804         the string.
2805         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
2806         problems with regression testing.
2808 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
2810         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
2811         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
2812         * src/dd.c: Include "human.h".
2813         (w_bytes, start_time): New vars.
2814         (usage): Document new I/O statistics output
2815         (print_stats): Output new I/O statistics.
2816         (cleanup): Do statistics after closing stdin and stdout, so that
2817         the times are more accurate.
2818         (write_output, dd_copy): Count output bytes.
2819         (main): Get initial value of clock.
2821 2004-11-14  Jim Meyering  <jim@meyering.net>
2823         Backslash-escape `-'s in email addresses, so that they are
2824         rendered properly in UTF-locales.
2825         * man/help2man (escape_hyphens): New function.
2826         (main): Call it on email addresses.
2828         * src/sort.c (zaptemp): Mark new diagnostic for translation.
2830         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
2831         * tests/misc/Makefile.am (TESTS): Add close-stdout.
2833 2004-11-13  Jim Meyering  <jim@meyering.net>
2835         * src/test.c (usage): Put the description of `[-n] STRING'
2836         on two lines, one for `-n STRING' and one for `STRING' so that
2837         help2man properly escapes the `-'.  Otherwise, the hyphen is
2838         rendered inappropriately in UTF-8 locales.
2839         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
2841 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
2843         * NEWS: Document the following changes.
2845         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
2846         files.
2847         (temptail): New variable, so that we can easily append to list.
2848         (create_temp_file): Create new files at end of list, so that
2849         searching the list has O(N*NMERGE) behavior instead of O(N**2).
2850         (zaptemp): Update temptail if needed.
2851         (mergefps, merge): Accept new arg that counts temp files, and keep it
2852         up to date as we create and remove temporaries.  This is for
2853         efficiency, so that we don't call zaptemp so often.
2854         All callers changed.
2855         (sort): Don't create array in reverse order, since the list of
2856         temporaries is now in the correct order.
2858         (zaptemp): Protect against race condition: if 'sort' is
2859         interrupted in the middle of zaptemp, it might unlink the
2860         temporary file twice, and the second time this happens the file
2861         might already have been created by some other process.
2863         (zaptemp): Warn if a temporary file is not removed.
2865         (create_temp_file): Use offsetof for clarity.
2866         (die): Move it up earlier, to clean up the code a bit.
2868         * src/pr.c (strtoumax): Declare if not declared.
2869         (skip_to_page, first_page_number, last_page_number, page_number,
2870         first_last_page, print_header):
2871         Use uintmax_t for page numbers.
2872         (first_last_page): Remove unnecessary forward declaration.
2873         Do not modify arg (it is now a const pointer).
2874         Return a true if successful, false (without print a diagnostic)
2875         otherwise.
2876         (main): If +XXX does not specify a valid page range, treat it
2877         as a file name.  This follows the response to Open Group XCU ERN 41
2878         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
2879         which says the behavior is allowed.
2880         (skip_to_page): When starting page number exceeds page count,
2881         print both numbers in the diagnostic.
2882         (print_header): Detect page number overflow.
2884 2004-11-07  Jim Meyering  <jim@meyering.net>
2886         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
2887         (main) [__APPLE__]: Get the processor type via syscall rather than
2888         hard-coding "powerpc".  From Toby Peterson.
2890         * src/sort.c (merge): Remove declarations of now-unused variables.
2892 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
2894         * src/sort.c (first_same_file): Remove.  Move most of the code to....
2895         (avoid_trashing_input): New function.
2896         (merge): Avoid some silly merges, e.g., copying a single file to
2897         a temporary file when there are exactly 17 input files to merge.
2898         Take a count of temporary files rather than a max_merge arg.
2899         All uses changed.
2901 2004-11-06  Jim Meyering  <jim@meyering.net>
2903         * src/sort.c (xfclose): Don't close stdout here (just flush it),
2904         since close_stdout now closes stdout unconditionally.
2906 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
2908         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
2909         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
2910         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
2911         temporary files).
2912         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
2913         thus avoiding unchecked stack overflow in some cases.  As a side
2914         effect this improve the performance of "sort -M" by a factor of 4
2915         on my benchmarks.
2917 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
2919         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
2921         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
2922         expression; it's not portable.  Problem reported by Albert Chin.
2923         Don't invoke a program more than once.
2924         * src/groups.sh (version): New variable, containing author info,
2925         for benefit of AUTHORS check.  Use it when acting on --version option.
2926         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
2927         in groups line.
2929         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
2930         as this breaks the new regime that does "#define getopt rpl_getopt".
2931         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
2932         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
2933         I suppose this may cause problems on ancient hosts with
2934         incompatible getopt declarations, but we'll cross that bridge if
2935         the problem gets reported to us by someone who can test the fix.
2937 2004-11-03  Jim Meyering  <jim@meyering.net>
2939         * src/tac.c: quote(...) file names in diagnostics.
2941 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
2943         * NEWS: Document getdate changes.
2945 2004-10-29  Jim Meyering  <jim@meyering.net>
2947         * src/tac.c (tac_file): Remove temporary prototype and move this
2948         function `down' so that it precedes definition of tac_nonseekable.
2950         `tac /proc/modules' would print nothing
2951         Reported by Harald Dunkel in http://bugs.debian.org/278604.
2953         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
2954         now it copies a general file descriptor, not just stdin.
2955         (tac_nonseekable): Renamed/adapted from tac_stdin.
2956         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
2957         since we never used the stream.  Perform "-" to stdin mapping here
2958         rather than in main.  Determine whether a file is seekable,
2959         by trying to `lseek' to its end, and dispatch to tac_seekable or
2960         tac_nonseekable accordingly.
2961         (main): Rewrite argument handling now that it uses only tac_file.
2962         * NEWS: Mention it here.
2964 2004-10-21  Jim Meyering  <jim@meyering.net>
2966         * tests/mv/leak-fd: New file.
2967         * tests/mv/Makefile.am (TESTS): Add it.
2968         * tests/rm/dot-rel: New file.
2969         * tests/rm/Makefile.am (TESTS): Add it.
2971         Correct my patch of 2004-10-18.
2972         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
2973         if necessary, not in remove_dir.  Otherwise, removing multiple
2974         `.'-relative nonempty directories no longer worked.
2976 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
2978         * src/fmt.c (usage): Improve description of --prefix.
2979         Problem reported by Edward Welbourne.
2981         * man/uniq.x: Change summary so that it doesn't imply that
2982         uniq writes to its input file.  Problem reported by
2983         Dan Jacobson.
2985 2004-10-18  Jim Meyering  <jim@meyering.net>
2987         Plug a leak that would cause a cross-device mv to fail when
2988         operating on too many command-line-specified nonempty directories.
2989         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
2990         top of the stack before returning.  This usually closes the file
2991         descriptor that was used to return to the original working directory.
2992         Reported by Cyril Bouthors in
2993         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
2994         * NEWS: Mention it here.
2996         * src/pathchk.c (validate_file_name): Give a more descriptive
2997         diagnostic when pathconf fails.  This also avoids an unwarranted
2998         warning from gcc-3.3.5 about a format not being a string literal.
3000         * src/sleep.c (main): Remove declaration of unused local, c.
3001         * src/printenv.c (main): Likewise.
3002         * src/logname.c (main): Likewise.
3003         * src/uptime.c (main): Likewise, for optc.
3004         * src/tsort.c (main): Likewise, for opt.
3006 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
3008         * AUTHORS: Add self to pathchk.
3009         * src/pathchk.c (AUTHORS): Add self.
3010         Change "path" to "file name" whenever possible.
3011         Remove usage comment, as it was a duplication of the code or doc.
3012         Include <wchar.h> if available.
3013         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
3014         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
3015         pathconf_wrapper, portable_chars, dir_ok): Remove.
3016         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
3017         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
3018         (portable_chars_only): New arg FILELEN.
3019         Don't assume ASCII; we might be on an EBCDIC host.
3020         Don't assume unibyte locale in diagnostic.
3021         (component_start, component_len): New functions.
3022         (validate_file_name): Renamed from validate_path.  All uses changed.
3023         Pretty much a complete rewrite.
3024         Don't make copy of file arg.  Always append trailing slash to
3025         pathconf arg, just in case it's a symlink (this is pure paranoia;
3026         we don't know of any hosts where the trailing slash is required).
3027         Use size_t instead of long int when possible.
3028         Avoid need to call pathconf in most practical cases.
3029         Don't use euidaccess several times to test searchability;
3030         just use lstat once.  Reword diagnostic to put the (often very long)
3031         file names last.
3033 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
3035         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
3037 2004-10-13  Jim Meyering  <jim@meyering.net>
3039         * NEWS: Mention today's fts.c fix.
3041 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
3043         * tests/stty/row-col-1: Set LC_ALL=C.
3045 2004-10-12  Jim Meyering  <jim@meyering.net>
3047         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
3048         From Jesus Climent in http://bugs.debian.org/276149.
3050 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
3052         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
3053         problems.  All uses changed.
3055 2004-10-05  Jim Meyering  <jim@meyering.net>
3057         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
3058         since Karl says its trailing blanks are there to stay :-)
3060 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
3062         * src/expr.c (NEW, OLD): Remove, partly to avoid
3063         reference to obsolescent macro XMALLOC.
3064         All uses replaced by xmalloc and free.
3066 2004-09-28  Jim Meyering  <jim@meyering.net>
3068         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
3069         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
3071 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
3073         * src/od.c (format_address_paren): c is optional, so don't output
3074         it if it's '\0'.
3076 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
3078         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
3079         * NEWS: Document this.
3080         * src/ls.c (file_ignored): Renamed from file_interesting, with
3081         inverted return value.  Accept the file name, not a struct dirent *.
3082         All uses changed.  Avoid the expense of calling fnmatch if the
3083         file is ignorable due to leading '.'.
3084         (all_files, really_all_files): Removed; replaced by:
3085         (ignore): New variable.  All uses changed.
3086         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
3087         New constants.
3088         (hide_patterns): New variable.
3089         (long_options, decode_switches, file_ignored, usage):
3090         Add support for --hide.
3091         (patterns_match): New function.
3092         (usage): Replace "hide" with "ignore" in explanation, to avoid
3093         confusion.
3095 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
3097         * src/ls.c (gobble_file, print_long_format): Don't assume that
3098         human-readable output has a byte count equal to its column width;
3099         this isn't always true in locales where the radix character is not
3100         '.' or ','.
3101         (format_user_or_group): Revamp code to match the above fix;
3102         this avoids the (very faint) possibility of integer overflow.
3104 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
3106         * NEWS: Mention that "chmod -r -w x" now works as expected.
3107         * src/chmod.c (main): Revamp option processing to support this.
3108         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
3109         * tests/chmod/usage: New set of tests for usage like that.
3111 2004-09-24  Jim Meyering  <jim@meyering.net>
3113         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
3114         it lists only cvs-controlled regular files.
3116         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
3117         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
3119 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
3121         * Makefile.maint (CVS_LIST): New macro.
3122         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
3123         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
3124         sc_trailing_blank, po-check): Use it instead of the
3125         nonstandard "cvsu --list".
3127         * src/tail.c (parse_obsolete_option): Bring back support
3128         for obsolete option followed by non-obsolete, or by more
3129         than one file.  When obsolete, conform to SUSv2 rather than
3130         original POSIX 1003.2-1992, as SUSv2 corrected the case of
3131         "tail -c".  Add support for the SUSv2 "b" modifier.
3132         * NEWS: Mention the above.
3133         * tests/tail/Test.pm: New test case obs-b to check the above.
3134         err-[134] no longer need _POSIX2_VERSION=199209.
3135         Fix comments to match revised behavior.
3137 2004-09-22  Jim Meyering  <jim@meyering.net>
3139         * Use automake-1.9.2.  Regenerate dependent files.
3141         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
3142         Improve the comment.
3144         Clean up scoping etc. so that some make `distcheck' tests pass.
3145         * src/csplit.c (xalloc_die): Declare to be static.
3146         * src/chown-core.c (chown_files): Declare as `extern'.
3147         * src/cp-hash.c (remember_created): Likewise.
3148         * src/copy.c (copy): Likewise.
3149         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
3151         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
3152         * src/unexpand.c: Likewise.
3154         * src/Makefile.am (check-AUTHORS): New rule.
3155         (check): Depend on it.
3156         * AUTHORS: Update.
3158         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
3159         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
3161 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
3163         * src/ls.c (decode_switches): Don't compare a short value
3164         to SIZE_MAX: GCC sometimes complains.
3166 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
3168         * NEWS: The following commands now reject unknown options:
3169         basename dirname factor hostname link nohup sync unlink yes
3170         Also, pathchk no longer accepts trailing options.
3172         * src/basename.c: Include <getopt.h>.
3173         * src/chroot.c: Likewise.
3174         * src/dirname.c: Likewise.
3175         * src/factor.c: Likewise.
3176         * src/hostid.c: Likewise.
3177         * src/hostname.c: Likewise.
3178         * src/nohup.c: Likewise.
3179         * src/pwd.c: Likewise.
3180         * src/setuidgid.c: Likewise.
3181         * src/sync.c: Likewise.
3183         * src/basename.c (main): Reject unknown options.
3184         * src/dirname.c (main): Likewise.
3185         * src/factor.c (main): Likewise.
3186         * src/hostid.c (main): Likewise.
3187         * src/hostname.c (main): Likewise.
3188         * src/link.c (main): Likewise.
3189         * src/nohup.c (main): Likewise.
3190         * src/pwd.c (main): Likewise.
3191         * src/setuidgid.c (main): Likewise.
3192         * src/sync.c (main): Likewise.
3193         * src/unlink.c (main): Likewise.
3194         * src/yes.c (main): Likewise.
3196         * src/cat.c (main): Remove unused "case 0".
3197         * src/chgrp.c (main): Likewise.
3198         * src/chmod.c (main): Likewise.
3199         * src/chown.c (main): Likewise.
3200         * src/comm.c (main): Likewise.
3201         * src/cp.c (main): Likewise.
3202         * src/csplit.c (main): Likewise.
3203         * src/cut.c (main): Likewise.
3204         * src/date.c (main): Likewise.
3205         * src/df.c (main): Likewise.
3206         * src/du.c (main): Likewise.
3207         * src/env.c (main): Likewise.
3208         * src/expand.c (main): Likewise.
3209         * src/fold.c (main): Likewise.
3210         * src/head.c (main): Likewise.
3211         * src/id.c (main): Likewise.
3212         * src/install.c (main): Likewise.
3213         * src/join.c (main): Likewise.
3214         * src/ln.c (main): Likewise.
3215         * src/ls.c (decode_switches): Likewise.
3216         * src/mkdir.c (main): Likewise.
3217         * src/mkfifo.c (main): Likewise.
3218         * src/mknode.c (main): Likewise.
3219         * src/mv.c (main): Likewise.
3220         * src/nl.c (main): Likewise.
3221         * src/paste.c (main): Likewise.
3222         * src/pinky.c (main): Likewise.
3223         * src/pr.c (main): Likewise.
3224         * src/ptx.c (main): Likewise.
3225         * src/readlink.c (main): Likewise.
3226         * src/rm.c (main): Likewise.
3227         * src/rmdir.c (main): Likewise.
3228         * src/seq.c (main): Likewise.
3229         * src/shred.c (main): Likewise.
3230         * src/split.c (main): Likewise.
3231         * src/sum.c (main): Likewise.
3232         * src/tac.c (main): Likewise.
3233         * src/tail.c (main): Likewise.
3234         * src/tee.c (main): Likewise.
3235         * src/touch.c (main): Likewise.
3236         * src/tr.c (main): Likewise.
3237         * src/tty.c (main): Likewise.
3238         * src/uname.c (main): Likewise.
3239         * src/unexpand.c (main): Likewise.
3240         * src/wc.c (main): Likewise.
3241         * src/who.c (main): Likewise.
3243         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
3244         * src/cksum.c (main): Likewise.
3245         * src/dd.c (main): Likewise.
3246         * src/logname.c (main): Likewise.
3247         * src/printenv.c (main): Likewise.
3248         * src/sleep.c (main): Likewise.
3249         * src/tsort.c (main): Likewise.
3250         * src/uptime.c (main): Likewise.
3251         * src/users.c (main): Likewise.
3252         * src/whoami.c (main): Likewise.
3254         * src/du.c (long_options): Standardize on NULL vs 0.
3255         * src/rm.c (long_opts): Likewise.
3257         * src/logname.c (long_options): Remove.
3258         * src/printenv.c (long_options): Likewise.
3259         * src/sleep.c (long_options): Likewise.
3260         * src/tsort.c (long_options): Likewise.
3261         * src/uptime.c (longopts): Likewise.
3262         * src/users.c (longopts): Likewise.
3263         * src/whoami.c (long_options): Likewise.
3265         * src/pathchk.c (longopts): Add --help, --version.
3266         (main): Use longopts rather than parse_long_options.
3267         * src/stty.c (longpts, main): Likewise.
3269         * src/pathchk.c (main): Don't reorder arguments, so that
3270         we can check weird file names.
3272         * src/readlink.c: Don't include "long-options.h".
3273         * src/sort.c: Likewise.
3274         * src/stty.c: Likewise.
3276         * src/split.c (verbose): Now bool, not int.
3277         (VERBOSE_OPTION): New enum.
3278         (longopts, main): Use it.
3280         * tests/factor/basic: Adjust to new wording in diagnostic
3281         that results from the above changes.
3283 2004-09-21  Jim Meyering  <jim@meyering.net>
3285         * man/rm.x: Say "the response is affirmative" rather than "the
3286         response begins with y or Y", so that the documentation is
3287         accurate in non-English locales.  Problem reported by Munzir Taha.
3289 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
3291         * src/echo.c (main): Don't pass NULL to strcmp when
3292         POSIXLY_CORRECT and given no arguments.
3294         * src/md5sum.c (STRING_OPTION): Remove.
3295         (long_options, main): Remove support for undocumented and
3296         obsolete --string option, as suggested in the 1996-09-26 patch.
3297         * NEWS: Document this.
3299         * tests/rm/fail-eperm: Don't try to remove writeable files in a
3300         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
3301         you remove such files.  Problem reported by Bert Fischer in:
3302         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
3304 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
3306         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
3307         (long_options, main): Use them instead of magic numbers 2 and 1.
3308         For --string, optarg can't possibly be NULL.
3310         * src/dd.c (usage): Distinguish between options and operands.
3311         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
3312         Say "operands" for operands, not "options".
3313         (main): Use getopt_long, so that "dd --" works as POSIX requires.
3314         * tests/dd/misc: Check for "dd --".
3316         * src/chroot.c (main): Reject unknown options instead of
3317         interpreting them as a directory to chroot to.
3319         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
3320         The current standard (POSIX 1003.1-2004) is correct.
3321         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
3322         collision with builtin function.
3323         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
3324         output the first 0 as 8 digits, to make it easier to compare to
3325         the text of the standard.  Output crctab to be a const array.
3326         (crctab): Use result of above changes.
3327         (long_options): Remove; not needed if empty.
3328         (main): getopt_long can't return 0 here, so simplify the code.
3330 2004-09-13  Jim Meyering  <jim@meyering.net>
3332         * src/Makefile.am (localedir.h): Don't redirect directly to target.
3334 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
3336         * src/id.c (print_full_info): Don't exit with failure status simply
3337         because a user or group number can't be turned into a name.
3338         Problem reported by Felipe Kellermann in:
3339         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
3341 2004-09-12  Jim Meyering  <jim@meyering.net>
3343         * Makefile.maint (my-distcheck): When building with -Werror, also
3344         require -Wshadow.
3346 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
3348         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
3349         * src/tail.c (parse_obsolete_option): Renamed from
3350         parse_obsolescent_option, since the options are obsolete now.
3351         Remove bool *arg; just exit if there's an error.  Revamp to follow
3352         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
3353         file" and "tail -10 -- file" correctly when we are conforming to
3354         the older standard.
3355         (main): Adjust to this change.
3356         * tests/tail/Test.pm (test_vector): minus-* requires
3357         _POSIX2_VERSION=199209 now, to work correctly if there is
3358         an input file.  err-1 and err-3 no longer errors if there
3359         is another file.
3361 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
3363         * src/test.c (usage): Document -r, -w, -x more carefully.
3365 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
3367         * src/test.c (usage): Document "test" (with no args) and "[ ]".
3368         Document that -h and -L don't dereference.
3370         * NEWS: Document that "tr xy -z" now works as per POSIX.
3371         Sort the descriptions.
3372         * src/tr.c (main): Don't reorder options.
3373         * tests/tr/Test.pm (fowler-1): New test case.
3375 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
3377         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
3378         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
3379         conforming to pre-2001 POSIX.
3380         * NEWS: Document this.
3381         * tests/touch/obsolescent: Test for this bug.  Also, set
3382         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
3383         a better test for obsolescent features.
3385         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
3386         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
3387         plain "sort".
3389         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
3390         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
3391         (long_options, main): --strings is now -S, not -s.
3392         (usage): Reflect the usage changes.
3393         (parse_old_offset): Do not issue a diagnostic on failure;
3394         callers now do this as necessary.
3395         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
3396         Add support for new short options (many undocumented) for
3397         compatibility with FreeBSD.  Remove FIXME for -s; it's now
3398         POSIX-compatible.  Default format is now oS, not o2.
3399         * NEWS: Describe the above.
3401 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
3403         * src/stty.c (valid_options): Remove.
3404         (main): Fix some bugs in handling invalid option-combinations
3405         like "stty -F".
3406         (recover_mode): Arg is now char const *, not char *.
3407         (main): Use STDIN_FILENO, not 0.
3408         Simplify option-parsing code a tad.
3409         * tests/stty/basic-1: Check for the fixed bugs.
3411 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
3413         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
3414         it from ever being nonzero.  Reported by Pozsar Balazs in:
3415         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
3416         (human_fstype): Add ramfs, squashfs, sysfs.
3417         Reported by Pozsar Balazs in:
3418         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
3419         (human_fstype): Return char const *, not char *.
3420         Simplify internals a bit, and avoid casts.
3422         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
3423         (bit_count): Remove.  All uses changed to....
3424         (multiple_bits_set): New function.
3425         (scanargs): Use it, and check separately for each set of
3426         incompatible options, to improve diagnostics.
3427         (MX): Remove.
3428         (apply_translations): Move checks for incompatible options
3429         to scanargs, so that they're done consistently.
3431 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
3433         Output correct errno-related diagnostic on "paste" I/O errors.
3434         * src/paste.c (write_error, xputchar): New functions.
3435         (paste_parallel): Use correct errno value after input error.
3436         (paste_parallel, paste_serial): Report errno value after output error.
3438         Port to diet libc.  Problem reported by Felix von Leitner in:
3439         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
3440         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
3441         it's not portable C to assume FILE is a complete type.
3442         (paste_parallel): Use index test instead of ENDLIST, and NULL
3443         instead of CLOSED.
3445 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
3447         POSIX-conformance fixes for "expand" and "unexpand".
3448         Also, consistently use "tab stop" rather than "tabstop".
3449         * NEWS: Document fixes.
3450         * src/expand.c: Revamp to resemble the new unexpand.c better.
3451         (usage): -i does not convert tabs after non-tabs.
3452         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
3453         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
3454         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
3455         (next_file, main): Check fclose against 0, not EOF.
3456         (expand): Remove unnecessary casts.
3457         Add another loop nesting level, for lines, so that per-line variables
3458         are initialized cleanly.
3459         Revamp tab checking.  Check for write error immediately, rather
3460         than just once at the end of the program.
3461         * src/unexpand.c: Lkewise (for the expand.c changes).
3462         (TAB_STOP_SENTINEL): Remove.
3463         (tab_size): Now size_t, not uintmax_t, since we need to store
3464         the sequences of blanks.
3465         (max_column_width): New var.
3466         (usage): Say "blank" where POSIX requires this.
3467         (add_tab_stop): Calculate maximum column width.
3468         (unexpand): Store the pending blanks, instead of merely counting them.
3469         Follow POSIX's rules about -a requiring two blanks before a tab stop.
3470         Get rid of internal label and goto.
3471         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
3472         Add blanks-1 through blanks-13.
3474 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
3476         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
3477         succeed without changing the uid and gid, like FreeBSD.
3478         * src/chgrp.c (parse_group): Return gid_t rather than storing it
3479         through a pointer.  Treat "chgrp '' file" as a no-op change,
3480         as FreeBSD does.
3481         (main): Set chopt.group_name to NULL if the group is the empty
3482         string.
3483         * src/chown-core.c (describe_change): Describe changes to -1:-1
3484         without using "to OWNERSHIP" phrase.
3485         * src/chown.c (usage): "chown '' file" is now allowed.
3486         (main): Do not set user name to the empty string if the group
3487         name is null.
3488         * tests/chgrp/basic: Test "chgrp '' file".
3489         * tests/chown/Makefile.am (TESTS): Add separator.
3490         * tests/chown/separator: New file, partly taken from
3491         Dmitry V. Levin's suggestion in
3492         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
3494 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
3496         * tests/install/basic-1: Test for the -d regression.
3498 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
3500         * src/install.c (main): Fix -d regression introduced with
3501         --target-directory support at 2004-06-25.
3503 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
3505         * src/copy.c (copy_internal): When preserving links, unlink
3506         a destination with link count greater than one.  This is so
3507         that commands like "cp -a" don't get confused when copying into
3508         a destination that already contains many hard links.  Problem
3509         reported by Tim Waugh in:
3510         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
3512 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
3514         Convert all files to UTF-8.
3515         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
3516         * tests/sort/Test.pm (16a): Likewise.
3517         * tests/uniq/Test.pm (8): Likewise.
3518         * tests/misc/printf-hex: Use ASCII, not Latin-1.
3520         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
3521         * src/shred.c (usage): "-" is an operand, not an option.
3522         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
3523         A null file arg means standard output.
3524         (main): "-o -" means to write to a file named "-",
3525         not to standard output.
3526         * src/tee.c (usage, tee): "tee -" writes to standard output, not
3527         to a file named "-".
3529 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
3531         * src/install.c (change_timestamps): Fix int->bool conversion
3532         bugs introduced on 2004-07-29.
3534 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
3536         * src/shred.c (wipename): Work even if the directory is writeable
3537         and not readable.  Prefer write access, since this should work
3538         better with fdatasync.
3540         * src/csplit.c (xalloc_die): New function.
3541         (main): Remove now-obsolete initialization of xalloc_fail_func.
3543         * src/md5sum.c: Adjust to sha->sha1 renaming.
3545 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
3547         Minor code cleanup.
3548         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
3549         (can_mode): Make variable local.
3551 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
3553         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
3554         Do not define, to avoid annoying compiler messages on QNX 6.3.
3555         Problem reported by Johan in:
3556         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
3558 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
3560         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
3561         Define to a concatenation of string literals, not to an expression;
3562         needed for concatenation contexts.
3563         (INTMAX_MAX, INTMAX_MIN): New macros.
3565         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
3566         unsigned long; this isn't true for st_ino on Solaris 9.
3568 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
3570         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
3571         whether to include files.  Include <sys/param.h> if
3572         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
3573         (main) [defined __POWERPC__]: Add a kludge to work around a
3574         Mac OS X bug, so that uname -p defaults to "powerpc" if
3575         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
3576         fails.  Problem reported by Petter Reinholdtsen in:
3577         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
3579         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
3580         main): Use bool for booleans.
3581         (writeline, check_file): Use uintmax_t for line counts.
3582         (check_file): Check for and report line number overflow,
3583         when that matters.
3584         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
3585         (print_lines, print_words, print_chars, print_bytes, print_linelength,
3586         have_read_stdin, wc, wc_file, main):
3587         Use bool for booleans.
3588         (exit_status): Remove.
3589         (wc, wc_file): Return bool status.  All callers changed.
3590         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
3591         * src/whoami.c (main): Print uids using unsigned long int, not
3592         unsigned int.
3594         * src/unexpand.c: Int cleanup and minor reorganization to be more
3595         like src/expand.c.
3596         Include quote.h, xstrndup.h.
3597         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
3598         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
3599         unexpand, main):
3600         Use bool for booleans.
3601         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
3602         Use uintmax_t for column counts.
3603         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
3604         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
3605         as a tab stop.
3606         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
3607         Detect overflow in tab stop string.
3608         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
3609         (unexpand): Concatenate input files the same way expand does.
3611         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
3612         touch, main): Use bool for booleans.
3613         (main): Avoid integer overflow when given more than INT_MAX
3614         options.
3615         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
3616         (have_read_stdin, count_items, scan_zeros, detect_loop,
3617         recurse_tree, walk_tree, tsort, main):
3618         Use bool for booleans.
3619         (exit_status): Remove.
3620         (tsort): Return a success flag instead of storing into a global.
3621         (main): Use it.
3622         * src/tty.c (silent, main): Use bool for booleans.
3623         (main): 0 -> STDIN_FILENO.
3624         * src/uname.c (print_element): Use bool for booleans.
3626         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
3627         Remove.  All uses replaced by C99 boolean primitives.
3628         (TEST_TRUE, TEST_FALSE): New constants, for readability.
3629         (test_unop, binop, unary_operator, binary_operator, two_arguments,
3630         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
3631         one_argument, main): Use bool for booleans.
3632         (advance, unary_advance): Now inline procedures rather than a macros.
3633         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
3634         (term, and, or): When it's easy, loop instead of recursing.
3635         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
3636         (binary_operator, unary_operator): Simplify by systematically rewriting
3637         true==FOO to FOO (where FOO is a boolean).
3638         (unary_operator): Don't consider a file to be a regular file
3639         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
3640         Remove unnecessary casts.  Remove ifdefs for things like
3641         S_ISSOCK that are no longer needed, since stat-macros.h always
3642         defines them now.
3644         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
3645         Use bool for booleans.
3646         (buf_init_from_stdin, buf_free, find_bol, print_line):
3647         Use size_t for sizes.
3648         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
3649         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
3650         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
3651         (tac_seekable): Use ptrdiff_t for pointer subtraction.
3652         Report an error if the result is out of range.
3653         (tac_seekable, main): Check for integer overflow in buffer size
3654         calculations.
3655         (main): Remove unnecessary casts.
3657         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
3658         the callee doesn't have to count 'em.  All callers changed.
3659         Don't allocate more space for the arg vector than we'll need.
3660         Use memcpy to copy the args rather than rolling our own loop.
3661         Use size_t for sizes.
3662         (fast_startup, simulate_login, change_environment, log_su,
3663         correct_password, restricted_shell, main): Use bool for booleans.
3664         (longopts): Don't assume change_environment is an int.
3665         Use NULL, not 0, for pointers.
3666         (xsetenv): New function, replacing xputenv and concat.
3667         All callers changed.
3668         (elements): Remove; no longer needed.
3669         (log_su, correct_passwd, main): Prefer !x to x==NULL.
3670         (log_su): 2 -> STDERR_FILENO.
3671         (modify_environment, main): Don't assume that getenv's returned value
3672         has an indefinite lifetime.
3673         (modify_environment): Allocate a larger environ.
3674         (main): Remove an impossible 'case 0'; if it happens now, it'll
3675         get diagnosed.  Don't assume getpwnam results outlive endpwent.
3676         Check for null or empty pw_name, pw_dir and for null pw_passwd.
3678         * src/stty.c (VA_START): Remove.  All callers now use va_start.
3679         (_POSIX_VDISABLE): Remove unnecessary cast.
3680         (struct control_info, visible): Use cc_t for control chars.
3681         (struct control_info): Use size_t for sizes.
3682         (recover_mode, set_mode, display_speed, display_window_size,
3683         valid_options, main, display_changed):
3684         Use bool for booleans.
3685         (integer_arg): Return unsigned long int, not long int.
3686         Accept new max arg; all callers changed, to specify a maximum
3687         value for integer parameters instead of silently overflowing.
3688         (wrap): Do not overrun the stack buffer if the output contains
3689         more than 1024 bytes.  Instead, malloc a buffer.
3690         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
3691         Remove unnecessary casts.
3692         (set_control_char): Allow int values only up to cc_t range.
3693         (screen_columns): Don't reject INT_MAX.
3694         (display_changed, display_all, display_speed, recover_mode):
3695         Don't assume cc_t fits in int.
3697         * src/remove.h: Add copyright notice.
3698         (struct rm_options): Use bool for booleans.
3699         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
3700         errno_rmdir_non_empty, remove_parents, main): Likewise.
3701         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
3702         main): Likewise.
3703         (main): Don't dump core if invoked with argv[0]==NULL.
3704         * src/tee.c (tee, append, ignore_interrupts, main, tee):
3705         Use bool for booleans.
3706         (tee): Use ssize_t for read returns.
3708         * src/ptx.c: Add a FIXME mentioning that there are many
3709         unchecked integer overflows in this file.
3710         (gnu_extensions, auto_reference, input_reference, right_reference,
3711         ignore_case, initialize_regex, fix_output_parameters,
3712         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
3713         Use bool for booleans.
3714         (SKIP_SOMETHING, compare_words, digest_break_file,
3715         find_occurs_in_text, fix_output_parameters):
3716         Use to_uchar instead of a caset.
3717         (print_field): Rewrite to avoid cast.
3719         * src/printf.c (posixly_correct): Use bool for booleans.
3720         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
3721         (STRTOX): Rewrite to avoid casts.
3722         (print_esc_char): Arg is char, not int.
3723         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
3724         can_mode.
3725         (no_newline, verbose): Use bool for booleans.
3726         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
3727         * src/shred.c (struct Options, main): Use bool for booleans.
3728         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
3729         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
3730         Use bool for booleans.
3731         * src/stat.c (G_fail): Remove.
3732         (print_statfs): Print various gotta-be-nonnegative values using
3733         unsigned long int, not long int or int.
3734         (do_statfs, do_stat): Return a boolean success flag.
3735         (do_stat, main): Use bool for booleans.
3737         * src/pr.c: Add a FIXME mentioning that there are many
3738         unchecked integer overflows in this file.
3739         (TRUE, FALSE): Remove.  All uses replaced by true and false.
3740         (struct COLUMN, read_line, print_page, print_stored, open_file,
3741         skip_to_page, init_fps, parallel_files, align_empty_cols,
3742         empty_line, FF_only, explicit_columns, extremities, keep_FF,
3743         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
3744         print_across_flag, storing_columns, balance_columns,
3745         truncate_lines, join_lines, untabify_input, failed_opens,
3746         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
3747         double_space, ignore_failed_opens, use_col_separator,
3748         pad_vertically, last_line, main, init_parameters, skip_read,
3749         read_line, print_stored):
3750         Use bool for booleans.
3751         (struct COLUMN, char_to_clump, store_char, print_char):
3752         Use char for chars.
3753         (clump_buff, print_clump): Use char[], not int[], for an array whose
3754         elements are always chars.
3755         (first_last_page, main, getoptarg, balance, add_line_number,
3756         char_to_uclump): Remove unnecessary casts.
3757         (init_parameters): Allocate chars, not ints, for clump_buff.
3758         (print_char): Use to_uchar before invoking ISPRINT.
3759         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
3761         * src/nohup.c (main): Use bool for booleans.
3762         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
3763         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
3764         (portable_chars_only): Use to_uchar rather than a cast.
3765         * src/printenv.c (main): Use bool for booleans.
3766         Do not assume that the environ has at most one matching entry
3767         for each option (integer overflow was possible otherwise).
3769         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
3770         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
3771         less.
3772         (struct tspec): Use it.  fmt_string is now an array, not
3773         a pointer, as there's little point to the indirection here.
3774         (struct tspec, flag_dump_strings,
3775         traditional, flag_pseudo_start, limit_bytes_to_format,
3776         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
3777         decode_one_format, open_next_file, check_and_close,
3778         decode_format_string, skip, write_block, read_char, read_block,
3779         parse_old_offset, dump, dump_strings, main):
3780         Use bool for booleans.
3781         (struct tspec): Use void *, not char *, for generic pointers.
3782         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
3783         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
3784         Use char, not unsigned int, since char suffices.
3785         (print_s_char, print_char, print_s_short, print_short,
3786         print_int, print_long, print_long_long, print_float,
3787         print_double, print_long_double): Rewrite to avoid casts.
3788         These now take void * arguments, instead of char *.
3789         Use the same body for all functions, except for the choice
3790         of type.  Assume C89 to simplify handling of signed char.
3791         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
3792         Rewrite to avoid casts.
3793         (print_named_ascii, print_ascii): Now takes void *, not char *.
3794         (decode_one_format): Use int for printf field widths, not
3795         unsigned int.  Pass void * to subsidiary printers,
3796         not char *.  Simplify handling of floating-point formats
3797         by factoring out common code dealing with precision and field width.
3798         (decode_format_string): Avoid need for temporary copy of
3799         each decoded struct tspec.
3800         (get_lcm): Remove unnecessary cast.
3801         (main): Fix bug where more than INT_MAX failed decodes were ignored.
3803 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
3805         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
3806         (enum number_format): Remove.
3807         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
3808         not enum values.
3809         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
3810         (section_del): Now const.
3811         (print_fmt): Remove.
3812         (starting_line_number, page_incr, blank_join, line_no,
3813         print_lineno, proc_text, main):
3814         Use intmax_t for line numbers.
3815         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
3816         Use bool for booleans.
3817         (lineno_format): Now a string, not an enum value.
3818         (build_print_fmt): Remove.  All calls removed.  This work is
3819         now done within print_lineno.
3820         (build_type_arg): Use size_t for sizes.
3821         (print_lineno): Check for line number overflow.
3822         (proc_text, main): Remove unnecessary cast.
3824         * src/ln.c (symbolic_link, interactive, remove_existing_files,
3825         verbose, hard_dir_link, dereference_dest_dir_symlinks,
3826         do_link, main): Use bool for booleans.
3828         * src/ls.c (struct fileinfo, file_interesting,
3829         extract_dirs_from_files, color_symlink_as_referent,
3830         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
3831         numeric_ids, print_block_size, dired, print_with_color,
3832         check_symlink_color, print_inode, recursive, immediate_dirs,
3833         all_files, really_all_files, qmark_funny_chars,
3834         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
3835         main, decode_switches, parse_ls_color, print_dir, file_interesting,
3836         gobble_file, make_link_path, basename_is_dot_or_dotdot,
3837         extract_dirs_from_files, print_long_format):
3838         Use bool for booleans.
3839         (dir_defaulted): Remove; no longer needed.
3840         (main): Use int to count files, since it suffices for argv.
3841         Rewrite to avoid need for dir_defaulted.
3842         (main, print_dir, gobble_file, get_link_name,
3843         xstrcoll):
3844         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
3845         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
3846         Remove unnecessary cast to int.  Use int instead of unsigned
3847         int to count from 0 to 1.
3848         (get_funky_string, print_type_indicator): Use char for bytes, not int.
3849         (make_link_path): Use NULL for null pointers.
3850         (quote_name): Use to_uchar instead of cast.
3852         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
3853         print_full_info): Use bool for booleans.
3854         (problems): Remove, replacing with....
3855         (ok): New var (inverted from old sense).
3856         (print_user, print_group, print_full_info):
3857         Print uids/gids with %lu, not %u.
3858         (xgetgroups): Don't run out of memory if getgroups or getugroups
3859         returns -1.
3860         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
3862         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
3863         int, since it suffices.
3864         (factor, print_factors): Use size_t for sizes.
3865         (print_factors, do_stdin, main): Use bool for booleans.
3866         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
3867         (fold_file, main): Use bool for booleans.
3868         (fold_file, main): Use size_t for sizes.
3869         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
3870         of prohibiting widths greater than INT_MAX.
3871         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
3872         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
3873         elide_tail_lines_pipe, elide_tail_lines_seekable,
3874         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
3875         string_to_integer, main):
3876         Use bool for booleans.
3877         (main): Rewrite to avoid cast.
3879         * src/csplit.c (struct line): Use size_t for sizes.
3880         (main): Remove unnecessary cast.
3881         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
3882         * src/cut.c (cut_file, main): Use bool for booleans.
3883         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
3884         * src/env.c (main): Likewise.
3885         * src/expr.c (nextarg): Likewise.
3886         * src/env.c (main): Remove unused and nonstandard envp arg.
3888         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
3889         fmt's arbitrary limits.
3890         (TRUE, FALSE): Remove; all uses changed to (true, false).
3891         (main): Use bool for booleans.
3892         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
3893         to parse width.
3894         (copy_rest): Remove unnecessary cast.
3895         (get_prefix): Rewrite to avoid cast.
3896         (check_punctuation): Use char *, not unsigned char *; C89 requires
3897         this.  Avoid off-by-one buffer read overrun when line is empty.
3898         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
3899         Remove unnecessary casts.
3900         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
3901         changes.
3903         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
3904         next_file, expand, main):
3905         Use bool for booleans.
3906         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
3907         expand, main):
3908         Use uintmax_t for column counts.
3909         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
3910         All callers changed.
3911         (parse_tabstops): Don't pass a negative char to isblank.
3912         Avoid memory leak with large tab stops.
3913         (validate_tabstops, expand): Don't assume number of tab stops is
3914         <= INT_MAX.
3915         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
3916         storing values into exit_status.
3917         (expand): Use same pattern as unexpand for reading chars.
3918         Report an error when input line is too long, instead of silently
3919         screwing up.  Do not mishandle tab stops when backspacing left
3920         over start of line.
3922         * src/dircolors.c (have_read_stdin, append_quoted,
3923         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
3924         (dc_parse_stream): Use enum for state, rather than int.
3925         Use ssize_t to store getline result.
3927         * src/dd.c (translation_needed, parse_integer, scanargs,
3928         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
3929         Use bool for booleans.
3930         (translate_buffer): Use to_uchar rather than a cast.
3931         (swab_buffer, copy_simple, copy_with_unblock):
3932         Use size_t for sizes.
3934         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
3935         * src/sleep.c (apply_suffix): Likewise.
3936         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
3937         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
3938         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
3939         tail_forever, tail_bytes, tail_lines, tail, tail_file,
3940         parse_obsolescent_option, parse_options, main): Likewise.
3941         * src/sleep.c (apply_suffix): Invert sense of result.
3942         Use int (not unsigned int) for multiplier, as this generates better
3943         code with some compilers.  Simplify code a bit.
3944         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
3945         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
3946         for state counters.
3947         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
3948         make it a bit clearer.
3950         * src/hostname.c: Include "xgethostname.h".
3951         (xgethostname): Remove decl; xgethostname.h has it.
3952         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
3953         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
3954         prototypes rather than K&R form.  Assume any negative value from
3955         sysinfo denotes failure, not just -1.
3956         (main): Simplify use of sethostname.
3958         * src/pinky.c (include_idle, include_heading, include_fullname,
3959         include_project, include_plan, include_home_and_shell, do_short_format,
3960         include_where, main): Use bool for booleans.
3961         (count_ampersands, create_fullname, scan_entries, short_pinky):
3962         Use size_t for sizes.
3963         (create_fullname): Check for overflow in size calculations.
3964         (idle_string): Don't assume that the number of idle days
3965         is less than 10**8 and/or INT_MAX/(24*60*60).
3966         (main): No need to pass a non-NULL last arg to getopt_long.
3967         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
3968         (print_uptime): Remove unused local variable.
3969         (main): No need to pass a non-NULL last arg to getopt_long.
3970         * src/users.c (list_entries_users, users): Use size_t for sizes.
3971         (list_entries_users): Use char for bytes.
3972         (main): No need to pass a non-NULL last arg to getopt_long.
3973         * src/who.c (do_lookup, short_list, short_output, include_idle,
3974         include_heading, include_mesg, include_exit, need_boottime,
3975         need_deadprocs, need_login, need_initspawn, need_clockchange,
3976         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
3977         (print_runlevel): Use unsigned char for bytes.
3978         (list_entries_who, scan_entries, who): Use size_t for sizes.
3979         (main): No need to pass a non-NULL last arg to getopt_long.
3981         * src/install.c (isdir): Remove decl.
3982         (install_file_to_path): Rely on make_path to fail if the destination
3983         is not a directory, by passing preserve_existing==true to it.
3984         Hence we no longer need to call isdir.
3985         Free dest_dir immediately when it's no longer needed, rather than
3986         waiting until the end of the function.
3987         (copy_file): Don't bother calling isdir, as copy will do the
3988         right thing if the destination is a directory.
3990         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
3991         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
3992         Use bool for booleans.
3993         (max_depth): Now size_t, not int, to avoid an arbitrary limit
3994         of INT_MAX on depth.
3995         (G_fail): Remove: no longer needed, now that the relevant
3996         functions return bool.
3997         (process_file): Use return value to signal success rather than
3998         setting a global.  Remove first_call static var; not needed, since
3999         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
4000         about size_t casts, as it's now fixed.  Use xnrealloc rather
4001         than the obsolescent XREALLOC.  Don't bother to check whether
4002         reallocation is needed unless level > prev_level.
4003         (du_files): Invert sense of result, for consistency with
4004         other coreutils code.  All callers changed.
4005         (main): Allow --max-depth values up to SIZE_MAX.
4007         * src/df.c (inode_format, show_all_fs, show_local_fs,
4008         show_listed_fs, posix_format, require_sync, print_type,
4009         selected_fstype, excluded_fstype, show_dev, show_point, main):
4010         Use bool for booleans.
4011         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
4012         (show_dev, show_point, main):
4013         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
4014         Don't assume disk name lengths are <= INT_MAX.
4015         Rewrite pct calculation to avoid cast.
4016         (show_point): Don't assume resolved length is <= SSIZE_MAX.
4018         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
4019         instead of uintptr_t.
4020         * src/shred.c (UINT_MAX_32_BITS): Remove.
4021         (word32): Remove.  All uses changed to uint32_t.
4022         (isaac_seed_data): Remove unnecessary cast.
4023         * src/system.h (ptr_align): Use size_t; in practice, this is just as
4024         good as uintptr_t in checking for alignments, and has fewer
4025         configuration hassles.
4027         * src/Makefile.am (localedir.h): Make it readonly; this
4028         undoes part of the 2004-07-27 patch.
4030 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
4032         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
4033         (IS_THOUSANDS_SEP): Use bool when appropriate.
4034         (numcompare, main): Use char, not int, when the value is always a char.
4035         (numcompare): Remove "register"; compilers are smart enough these days.
4036         * src/system.h (errno, CHAR_BIT): Remove decls;
4037         no longer needed now we assume C89 or better.
4038         Include <inttypes.h> before <stdint.h>, as it's the
4039         Autoconf-recommended pattern.
4040         (to_uchar): New inline function, moved here from tr.c.
4041         Use full names for int types, e.g. "long int" rather than "long".
4042         * src/tr.c (to_uchar): Remove; now in system.h.
4043         (is_char_class_member): Use bool when appropriate.
4045         * src/mkdir.c (create_parents, main): Use bool when appropriate.
4046         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
4048 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
4050         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
4052         * src/chmod.c (recurse, force_silent, process_file, process_files,
4053         main): Use bool when appropriate.
4054         * src/cksum.c (cksum, main): Likewise.
4055         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
4056         compare_files, main): Likewise.
4058         * src/copy.h (struct cp_options): Likewise.
4059         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
4060         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
4061         * src/cp-hash.h (remember_created): Likewise.
4062         * src/cp-hash.c (remember_created): Likewise.
4063         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
4064         re_protect, make_path_private, target_directory_operand, do_copy,
4065         cp_option_init, decode_preserve_arg, main): Likewise.
4066         * src/install.c (isdir, change_timestamps, change_attributes,
4067         copy_file, install_file_to_path, install_file_in_dir,
4068         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
4069         change_attributes, change_timestamps): Likewise.
4070         * src/mv.c (remove_trailing_slashes, rm_option_init,
4071         cp_option_init, do_move, movefile, main): Likewise.
4072         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
4073         AD_push, prompt, remove_dir): Likewise.
4074         * src/rm.c (rm_option_init, main): Likewise.
4076         * src/remove.c (top_dir, pop_dir, full_filename_):
4077         Use size_t for sizes.
4078         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
4079         succeeds.  It's not necessary in that case, as *NEW_DST is always
4080         false already.
4081         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
4082         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
4083         * src/rm.c (main): Likewise.
4085         md5sum, sha1sum integer cleanups.
4087         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
4088         not needed.
4089         (ALG_UNSPECIFIED): Remove.
4090         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
4091         * src/md5.c: Don't include any files other than checksum.h.
4092         * src/sha1sum.c: Likewise.
4093         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
4094         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
4095         Use bool when appropriate.
4096         (digest_check): Increase limit of number of input lines to
4097         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
4098         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
4100 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
4102         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
4103         'ok' flag around.
4104         (simple_cat, cat): Return true if successful.  All callers changed.
4105         (simple_cat, cat, main): Use bool for booleans.
4106         (simple_cat): Use size_t for sizes.
4107         (cat, main): Use the same names for parameters that we use for
4108         long options, to avoid confusion.  This inverts the sense of the
4109         show_tabs (formerly output_tabs) and number_nonblank
4110         (formerly numbers_at_empty_lines) variables.
4111         (main): Don't mess up (due to integer overflow) if we are given
4112         INT_MAX - INT_MIN + 1 options.
4113         [O_BINARY]: Don't invoke isatty unless the other options require it.
4114         (main): When deciding whether to use simple_cat, don't worry
4115         about binary option; it's irrelevant.
4117         * src/dcgen: Remove comments, trailing white space, and empty
4118         lines from the output strings, to save space.
4119         Use a narrower type like 'unsigned char' for line lengths, if
4120         that will do.
4121         Make the output variables static, not extern.
4123         * src/chgrp.c (parse_group): Require base 10 when parsing
4124         groups as integers.
4125         (main): int -> bool when appropriate.
4126         * src/chown.c (main): Likewise.
4127         * src/chown-core.c: Include inttostr.h.
4128         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
4129         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
4130         instead of uint_to_string).
4131         (describe_change): Instead of an int flag, use a char *
4132         auxiliary; this avoids the need for casts.
4133         Assume free (NULL) works.
4134         (change_file_owner): Return true/false, not 0/-1, since
4135         we don't set errno.  All callers changed.
4136         Use bool when appropriate.
4137         (chown_files): Likewise.
4138         * src/chown-core.h (chown_files): Likewise.
4140         * tests/chown/basic: Test for proper handling of uids like
4141         "010", which must be parsed as decimal.
4143         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
4144         pwd when there are multiple names for the working directory
4145         (which can happen with an automounter, sigh).
4147         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
4148         this causes Solaris 8 'make' to refuse to build "groups".
4149         (localedir.h): Don't depend on Makefile: this causes Solaris
4150         8 'make' to build localedir.h unnecessarily.  The dependence
4151         on Makefile is ineffective anyway, since $(localedir) might
4152         change even if Makefile hasn't.
4154         * src/remove.c (remove_dir): If we can't save the state of the
4155         working directory, pretend we started from "/", not ".".
4156         This avoids a bug on hosts like Solaris that don't let you
4157         remove the working directory.
4159 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
4161         * src/printf.c (strtiomax, strtoumax): Declare if not already
4162         declared: this fixes a portability bug with Solaris 8 + GCC.
4163         (STRTOX): Parenthesize use of macro arg as expression.
4164         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
4165         parentheses.
4166         * configure.ac: Check for declaration of strtoumax, for
4167         src/printf.c.
4169         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
4170         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
4172         * tests/readlink/can-e: Don't assume that we can remove the
4173         working directory: this isn't possible under Solaris 8, say.
4174         * tests/readlink/can-f: Likewise.
4175         * tests/readlink/can-m: Likewise.
4177         * src/copy.c (copy_internal): find_backup_file_name no longer
4178         returns NULL, so don't bother to check for this.
4179         * src/cp.c (do_copy): Likewise.
4180         * src/ln.c (do_link): Likewise.
4182 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
4184         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
4185         All uses changed.
4186         (NZERO): New macro, if system doesn't define it already.
4187         (usage): Distinguish priorities from nice values.
4188         Don't assume NZERO is 20.
4189         (main): Use bool instead of int where appropriate.
4190         If user specifies an adjustment out of range, always truncate it
4191         to an inrange value instead of sometimes giving an error message
4192         and sometimes not.
4193         Do not assume that -1 is an error return from "nice" or
4194         "getpriority", as it might be the current nice value minus NZERO.
4195         If nice/setpriority fails with errno == EPERM, go ahead and run
4196         the command anyway; POSIX requires this.
4198         * src/pathchk.c: Include euidaccess.h.
4199         (dir_ok): Use euidaccess, not access.
4200         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
4201         (eaccess): Remove.  All users changed to use euidaccess instead.
4203 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
4205         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
4206         Don't assume ut_line is null-terminated.
4207         * src/who.c (print_line): New arguments USERLEN and LINELEN,
4208         since USER and LINE might not be null terminated.  All callers
4209         changed.
4211 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
4213         Fix bug with "tail -f" reported by Rob Holland in
4214         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
4215         Also, remove the undocumented and unsupported-since-2000
4216         --max-consecutive-size-changes options.  Fix another related bug:
4217         "tail" got confused if stdin, stdout, or stderr were closed.
4218         Also, use output buffering even with "tail -f".
4220         * NEWS: Document this, plus yesterday's patch.
4221         * doc/coreutils.texi (tail invocation): "size has remained the same"
4222         -> "file has not changed", which is more accurate for fifos.
4223         * src/tail.c: Include fcntl-safer.h.
4224         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
4225         (COPY_A_BUFFER): New macro.
4226         (struct File_spec): New members mtime, mode, blocking.
4227         Remove member n_consecutive_size_changes.
4228         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
4229         max_n_consecutive_size_changes_between_opens,
4230         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
4231         (long_options, tail_forever, parse_options):
4232         Remove (non-)support for --max-consecutive-size-changes.
4233         (record_open_fd): New function.
4234         (recheck, tail_file): Use it.  Don't assume that stdin is open.
4235         (dump_remainder): Add support for new COPY_A_BUFFER special value.
4236         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
4237         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
4238         All uses changed.
4239         (n_live_files): Remove, replacing with...
4240         (any_live_files): New function.  All uses changed.
4241         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
4242         is safe; this avoids some hangs when reading from a fifo.
4243         Avoid invoking fstat or sleep when using blocking I/O.
4244         Do not check for changes to size if the file is not a regular file,
4245         as the size is undefined in that case.
4246         Check for changes to mtime or mode, too; this works for non-regular
4247         files.
4248         (tail_forever, main): Redo fflush strategy to work even when input
4249         is nonblocking.  Don't use unbuffered output; just flush when needed.
4251 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
4253         * src/tail.c (main): Ignore -f if no file operand is specified
4254         and standard input is a pipe.
4255         * doc/coreutils.texi (tail invocation): Do not ignore -f for
4256         all pipes, just for when standard input is a pipe and no
4257         file operand is specified.
4258         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
4259         Add a new commented-out f-2 test, which we still fail.
4260         (test_vector): All f-* tests are special cases, not just f-1.
4262 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
4264         * src/uptime.c: Include c-strtod.h.
4265         (print_uptime): Use c_strtod instead of setlocale and sscanf.
4266         Use long int rather than int to count days (for 64-bit hosts),
4267         and check for arithmetic overflow when converting double to time_t.
4269 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
4271         * src/printf.c (vstrtold): Renamed from vstrtod.
4272         Now returns long double.  All uses changed.
4273         (print_direc): Use "L" length modifier when printing floating point
4274         numbers, since we're now printing long double.
4276 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
4278         printf cleanup, to avoid undefined behavior, to add support for
4279         formats that Bash supports, and to support wide integers like
4280         Bash does.
4282         * NEWS: Document this.
4283         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
4284         booleans, so that we don't reserve any values for precision or
4285         width (like Bash).
4286         (STRTOX): Use prototype, not K&R-style definition.
4287         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
4288         in ../lib), with type change to intmax_t.
4289         All uses changed.
4290         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
4291         All uses changed.
4292         (vstrtod): Renamed from xstrtod.  All uses changed.
4293         (print_direc): Use boolean arg instead of special value to indicate
4294         a missing precision or width.  LENGTH no longer includes
4295         length modifiers or conversion character.  New arg CONVERSION
4296         now specifies conversion character.
4297         Use intmax_t-width formatting for integers (like Bash).
4298         Add support for C99 %a, %A, %F (like Bash).
4299         Add support for field width with %c (POSIX requires this).
4300         Add a FIXME for lack of support for field width and precision
4301         for %b.
4302         Add support for '\'', '0' flags.
4303         Check for invalid combinations of flags, field width, precision,
4304         and conversion, to prevent use of undefined behavior.
4305         Allow multiple length modifiers, for formats like "%lld" (like Bash).
4306         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
4307         In error message, output entire invalid conversion specification,
4308         instead of merely outputting % followed by the conversion char.
4309         * tests/misc/printf: Add tests for the above.
4311 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
4313         Change "readlink -f" to be more compatible with prior implementations.
4314         Add more canonicalize options, -e and -m.
4315         Add comprehensive tests for all readlink modes.
4317         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
4318         Do not add canonicalize.c here.
4320         * src/readlink.c (longopts): Add new options.
4321         (usage): Document them.
4322         (canonicalize_fname): New proxy function.
4323         (main): Handle new options.
4324         * doc/coreutils.texi (readlink invocation): Document new
4325         "readlink -f" behaviour and new canonicalize options, -e and -m.
4327         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
4328         * tests/Makefile.am (SUBDIRS): Add readlink.
4329         * tests/readlink/Makefile.am: New file.
4330         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
4331         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
4332         * tests/misc/readlink: Remove file.
4334 2004-07-04  Jim Meyering  <jim@meyering.net>
4336         * src/copy.c (copy_internal): Add a FIXME comment.
4338 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
4340         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
4341         * src/cp.c (do_copy): Likewise.
4342         * src/mv.c (movefile): Likewise.
4344         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
4345         to avoid problem when path_concat dir name is longer than 2 GiB (!).
4347         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
4348         This cleans up the semantics a bit, as we no longer try to open the
4349         same file twice.
4351 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
4353         * NEWS: Add short names -t and -T for --target-directory
4354         and --no-target-directory options, respectively.
4356         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
4357         Remove.  All uses changed to 'T' and 't', respectively.
4358         * src/install.c, src/ln.c, src/mv.c: Likewise.
4360         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
4361         aliases for --target-directory and --no-target-directory,
4362         respectively.
4363         * src/install.c (long_options, main, usage): Likewise.
4364         * src/ln.c, src/mv.c: Likewise.
4366 2004-07-01  Jim Meyering  <jim@meyering.net>
4368         * Makefile.maint (sc_file_system): New target.
4369         (syntax-check-rules): Add it.
4370         .x-sc_file_system: New file.
4371         * Makefile.am (EXTRA_DIST): Add it.
4373         * man/sync.x: Use "file system" rather than "filesystem".
4374         * man/stat.x, man/df.x: Likewise.
4376 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
4378         * src/df.c (usage, main): Output "file system" rather than
4379         "filesystem".
4380         * src/du.c (usage): Likewise.
4381         * src/shred.c (usage): Likewise.
4382         * src/stat.c (usage): Likewise.
4383         * src/stat.c (long_options, usage): Rename "--filesystem" to
4384         "--file-system".  But keep the old name around, for compatibility
4385         reasons.
4387 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
4389         Add support for --no-target-directory option.
4391         * NEWS: Document it.
4392         * doc/coreutils.texi (Common options, Target directory, cp
4393         invocation, install invocation, mv invocation, ln invocation):
4394         Likewise.
4395         (link invocation): Explain how to rewrite link using ln now
4396         that we have --no-target-directory.
4397         (ln invocation): Explain that --no-target-directory subsumes
4398         --no-dereference.
4399         (unlink invocation): Modify wording to match new wording in
4400         link invocation.
4402         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
4403         (long_opts, usage, do_copy, main): Add support for
4404         --no-target-directory,
4405         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
4406         usage): Likewise.
4407         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
4408         main): Likewise.
4409         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
4410         main): Likewise.
4411         * src/mv.c (enum): Sort values.
4413 2004-06-29  Jim Meyering  <jim@meyering.net>
4415         Don't let verbose-mode output from a subshell obscure actual differences.
4416         * tests/rm/inaccessible: Turn off command-echoing just before
4417         invoking subshell, then turn it back on if VERBOSE=yes afterward.
4419 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
4421         Add support for 'install --target-directory', an option
4422         that has been documented for years but not implemented (!).
4423         * doc/coreutils.texi (install invocation): Document
4424         --target-directory in synopsis, too.
4425         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
4426         (long_options, main, usage): Add --target-directory.
4427         (target_directory_operand): New function, stolen from mv.c.
4428         (main): Use it.  Check for -d and --target-directory.
4429         Alter wording of diagnostics to match other programs.
4431 2004-06-28  Jim Meyering  <jim@meyering.net>
4433         * src/cp.c (usage): Fix copy+paste error in description of
4434         --target-directory: s/move/copy/.  From Paul Jarc.
4436 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
4438         Use more-consistent rules among cp, ln, and mv when dealing with
4439         last operands that are (or look like) directories.
4441         * src/cp.c (target_directory_operand): New, nearly-common function,
4442         It reports an error if the destination appears to be a directory
4443         (e.g., because it has a trailing slash) but is not.
4444         * src/ln.c, src/mv.c: Likewise.
4445         * src/cp.c (do_copy): Use it.
4446         * src/ln.c (main): Likewise.
4447         * src/mv.c (main): Likewise.
4449         * src/cp.c (do_copy): Don't assume argc is positive.
4450         Don't bother to lstat dest, since copy() will do that for us.
4451         Use "const" to avoid the need for cast.
4453         * src/cp.c (do_copy): Don't output a usage message because of file
4454         problems (e.g., an operand is not a directory).  Use it only for
4455         syntax.  Standardize on "target %s is not a directory" for the
4456         diagnostic.
4457         * src/ln.c (main): Likewise.
4458         * src/mv.c (main): Likewise.
4460         * src/cp.c (do_copy): Remove test for trailing slash, since
4461         target_directory_operand now does this.
4462         * src/ln.c (main): Likewise.
4463         * src/mv.c (movefile): Likewise.
4465         * src/cp.c (main): Reject multiple target directories.
4466         Check whether a specified target is a directory when parsing the
4467         options, using stat.  This gives more-accurate diagnostics.
4468         * src/ln.c (main): Likewise.
4470         * src/ln.c (isdir): Remove decl; no longer needed.
4471         * src/mv.c (isdir, lstat): Likewise.
4473         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
4474         Don't check the destination ourself; rely on dest_is_dir.
4475         This way we can avoid lstatting the destination in the
4476         usual case, and in the worst case we lstat 1, not 3 times.
4477         Don't bother to unlink unless link failed; this saves a syscall.
4478         Remove unnecessary backup_succeeded flag;
4479         it was identical to "dest_backup != NULL".
4481         * src/ln.c (main): Use int to count to argc, not unsigned int.
4482         This handles negative operand counts.
4483         * src/mv.c (main): Likewise.
4485         * src/mv.c (do_move): Don't call hash_init; expect the caller to
4486         do it, for consistency with cp.c and ln.c.  All callers changed.
4487         (movefile): dest_is_dir parameter is now bool, not int.
4488         (main): Standardize on "missing destination file operand after %s"
4489         for the diagnostic, for consistency with cp.c.
4491         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
4492         will complain about the arg count.
4493         Adjust to new (briefer) diagnostics.
4494         * tests/cp/fail-perm: Add a test to verify that we get the new
4495         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
4497 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
4499         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
4500         d/" incorrectly created a link d/x/x.  It also saves some system
4501         calls.
4503         * NEWS: Document the fix.
4505         * src/ln.c (main): Don't append basename to dest if this
4506         results in an existing directory name.
4507         * tests/ln/misc: See whether a trailing slash is followed too far.
4509 2004-06-26  Jim Meyering  <jim@meyering.net>
4511         * src/printf.c (main): When given no arguments, print the standard
4512         "missing operand\nTry printf --help..." message -- to be consistent.
4514 2004-06-26  Jim Meyering  <jim@meyering.net>
4516         * src/mknod.c (main): Add \n at the end of message output via fprintf.
4518 2004-06-25  Jim Meyering  <jim@meyering.net>
4520         * tests/ln/misc: Add test for ln subscript error.
4522 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
4524         * src/ln.c (do_link): Remove unnecessary call to lstat.
4525         (main): Avoid subscript error when the destination is "".
4527 2004-06-23  Jim Meyering  <jim@meyering.net>
4529         * tests/*: Replace all occurrences of `(exit N); exit' with
4530         `(exit N); exit N'.  Otherwise, those many tests could exit with
4531         improper exit status when exiting via e.g., a trapped interrupt.
4532         Thanks to a report from Bob Proulx.
4534 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
4536         * src/who.c (idle_string, print_user): New arg boottime,
4537         specifying the most recent boot time.  All uses changed.
4538         (idle_string) Consider a line to be "old" if it hasn't been used
4539         since the last boot time.  Watch out for overflow when computing
4540         times, and for times in the future.
4541         (idle_string): Record latest boot time.
4543 2004-06-22  Jim Meyering  <jim@meyering.net>
4545         * src/test.c (usage): Correct description of `-t FD'.  The file
4546         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
4548 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
4550         The 2004-06-19 fix for who and pinky was incomplete, as ctime
4551         has undefined behavior if the year precedes -999 or follows 9999.
4552         Since we have to stop using ctime anyway, we might as well use
4553         strftime and fix the FIXME, and support internationalized dates.
4555         * NEWS: Document the new behavior.
4556         * src/who.c: Include "hard-locale.h".
4557         (time_format, time_format_width): New vars.
4558         (time_string, print_line): Use them.
4559         (main): Set them.
4560         (time_string): Use localtime + strftime instead of
4561         ctime, to avoid problems with years before -999 or after 9999.
4562         * src/pinky.c: Likewise.
4564 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
4566         Fix bug: GNU 'ls' didn't count columns correctly if user or group
4567         names contained multibyte characters where the column count
4568         differed from the byte count.  This patch also corrects
4569         some comments.
4571         * src/ls.c (format_user_or_group): New function, which counts
4572         columns correctly.
4573         (format_user, format_group): Use it.
4574         (format_user_or_group_width): New function, which counts columns
4575         correctly.
4576         (format_user_width, format_group_width): Use it.
4578 2004-06-21  Jim Meyering  <jim@meyering.net>
4580         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
4581         Suggestion from Andreas Schwab.
4583         * tests/priv-check: When running as root, be sure to propagate
4584         PATH through to the process we exec as non-root.
4585         Reported by michael@aplatform.com.
4587         * src/mknod.c (main): Don't segfault when calculating the
4588         expected number of operands for `mknod NAME'.
4590 2004-06-20  Jim Meyering  <jim@meyering.net>
4592         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
4594 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
4596         * src/basename.c (main):
4597         Standardize on the diagnostics given when someone gives
4598         too few operands ("missing operand after `xxx'") or
4599         too many operands ("extra operand `xxx'").
4600         Include "quote.h" and/or "error.h" if it wasn't already being included.
4601         * src/chgrp.c (main): Likewise.
4602         * src/chmod.c (main): Likewise.
4603         * src/chown.c (main): Likewise.
4604         * src/chroot.c (main): Likewise.
4605         * src/comm.c (main): Likewise.
4606         * src/cp.c (do_copy): Likewise.
4607         * src/csplit.c (main): Likewise.
4608         * src/date.c (main): Likewise.
4609         * src/dircolors.c (main): Likewise.
4610         * src/dirname.c (main): Likewise.
4611         * src/du.c (main): Likewise.
4612         * src/expr.c (main): Likewise.
4613         * src/hostid.c (main): Likewise.
4614         * src/hostname.c (main): Likewise.
4615         * src/id.c (main): Likewise.
4616         * src/install.c (main): Likewise.
4617         * src/join.c (add_file_name, main): Likewise.
4618         * src/link.c (main): Likewise.
4619         * src/ln.c (main): Likewise.
4620         * src/logname.c (main): Likewise.
4621         * src/md5sum.c (main): Likewise.
4622         * src/mkdir.c (main): Likewise.
4623         * src/mkfifo.c (main): Likewise.
4624         * src/mknod.c (main): Likewise.
4625         * src/mv.c (main): Likewise.
4626         * src/nohup.c (main): Likewise.
4627         * src/od.c (main): Likewise.
4628         * src/pathchk.c (main): Likewise.
4629         * src/ptx.c (main): Likewise.
4630         * src/readlink.c (main): Likewise.
4631         * src/rm.c (main): Likewise.
4632         * src/rmdir.c (main): Likewise.
4633         * src/seq.c (main): Likewise.
4634         * src/setuidgid.c (main): Likewise.
4635         * src/shred.c (main): Likewise.
4636         * src/sleep.c (main): Likewise.
4637         * src/sort.c (main): Likewise.
4638         * src/split.c (main): Likewise.
4639         * src/stat.c (main): Likewise.
4640         * src/test.c (beyond, main): Likewise.
4641         * src/touch.c (main): Likewise.
4642         * src/tr.c (main): Likewise.
4643         * src/tsort.c (main): Likewise.
4644         * src/tty.c (main): Likewise.
4645         * src/uname.c (main): Likewise.
4646         * src/uniq.c (main): Likewise.
4647         * src/unlink.c (main): Likewise.
4648         * src/uptime.c (main): Likewise.
4649         * src/users.c (main): Likewise.
4650         * src/who.c (main): Likewise.
4651         * src/whoami.c (main): Likewise.
4653         * tests/basename/basic: Adjust to new diagnostics.
4654         * tests/du/files0-from: Likewise.
4655         * tests/expr/basic: Likewise.
4656         * tests/mv/diag: Likewise.
4657         * tests/tsort/basic-1: Likewise.
4659 2004-06-20  Jim Meyering  <jim@meyering.net>
4661         * src/ln.c: Remove declaration of yesno.
4662         Instead, include yesno.h.
4663         * src/copy.c: Likewise.
4665         * src/remove.c: Remove declaration of yesno.
4666         Instead, include yesno.h.
4667         (top_dir): Remove now-unnecessary cast of obstack_base.
4668         (pop_dir): Likewise.
4669         (full_filename_): Likewise.
4671 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
4673         Don't dump core if ctime returns NULL; this is possible on
4674         hosts with 64-bit time_t and 32-bit int.
4675         * src/who.c: Include "inttostr.h".
4676         (time_string): If ctime fails, print the raw time as an integer
4677         instead of dumping core.
4678         * src/pinky.c: Likewise, as follows:
4679         Include "inttostr.h".
4680         (time_string): New function, copied from who.c.
4681         (print_entry): Use it.
4683 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
4685         * src/who.c (print_line): Don't truncate user names at 8 bytes.
4686         Problem reported by Guido Leenders in:
4687         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
4688         * NEWS: document this.
4690 2004-06-19  Jim Meyering  <jim@meyering.net>
4692         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
4693         using GNU_PACKAGE (from PACKAGE) once again.  This restores
4694         `GNU' to the parenthesized package name in --version output.
4695         Before, the first argument from AC_INIT, `GNU coreutils', would
4696         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
4697         Reported by Richard Stallman.
4699 2004-06-17  Jim Meyering  <jim@meyering.net>
4701         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
4702         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
4704 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
4706         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
4707         allows the GNU behavior.  "--" is now supported by chroot, hostid,
4708         hosname, pwd, sync, yes.
4709         * doc/coreutils.texi (yes invocation, false invocation,
4710         true invocation): Document this.
4711         * src/chroot.c (main): Handle "--".
4712         * src/hostid.c (main): Likewise.
4713         * src/hostname.c (main): Likewise.
4714         * src/pwd.c (main): Likewise.
4715         * src/sync.c (main): Likewise.
4716         * src/yes.c (main): Likewise.
4717         * src/true.c (main): Recognize --help and --version even if
4718         POSIXLY_CORRECT is set.
4719         * src/yes.c (main): Likewise.
4721 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
4723         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
4724         the GNU behavior.
4725         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
4726         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
4727         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
4728         variables to the implementation, so it's OK for ls to depend on
4729         TABSIZE.
4730         * src/pr.c: Include "hard-locale.h".
4731         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
4732         POSIX specifies the behavior only in the POSIX locale.
4733         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
4734         since POSIX says the behavior is unspecified here.
4735         * src/tail.c (parse_obsolescent_option): Support multiple file operands
4736         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
4737         * src/printf.c (main): Recognize --help, --version even if
4738         POSIXLY_CORRECT.  POSIX does not specify any options, but it
4739         does not prohibit options either, so "printf" is like "expr" here.
4740         * src/unlink.c (main): Likewise.
4741         * tests/misc/printf: Adjust to the new semantics for \x if
4742         POSIXLY_CORRECT.
4744 2004-06-14  Jim Meyering  <jim@meyering.net>
4746         * tests/misc/pwd: New test, for fix of 2004-04-19.
4747         * tests/misc/Makefile.am (TESTS): Add pwd.
4748         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
4750         * src/copy.c: Remove declaration of euidaccess.
4751         Instead, include "euidaccess.h".
4753 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
4755         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
4756         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
4757         as (sizeof "??") reliably returns 3.
4758         (print_line): Guard against idle and pid being too long
4759         (which is possible when printing headers).
4760         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
4761         Avoid unnecessary cast of sizeof to int.
4762         (make_id_equals_comment): Do not assume that UT_ID returns
4763         a string; it might return a non-null-terminated array.
4764         Use strncat instead.  It's not very often where strncat is
4765         exactly what you want, but this is one of those rare cases.
4767 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
4769         * src/who.c (list_entries_who): Don't output a trailing space.
4771 2004-06-09  Jim Meyering  <jim@meyering.net>
4773         * src/touch.c (usage): Improve wording in description of the
4774         --time=WORD option.  Reported by Dan Jacobson.
4776         * src/chown-core.c (change_file_owner): Change names of parameters
4777         old_uid and old_gid to required_uid and required_gid respectively.
4779         * src/chmod.c (mode_changed): Return false, not 0, now that the
4780         function returns `bool'.
4782 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
4784         Adjust chmod and chown to be similar if -c or -v are given.  In
4785         particular, a no-op chown is no longer reported as a change; this
4786         reverts to previous behavior.  Also, fix both commands so that -v
4787         report failures even if the failure is not due to the chmod or
4788         chown syscalls.
4790         * src/chmod.c (CH_NOT_APPLIED): New constant.
4791         (describe_change): Handle it.
4792         (process_file): Use it, if a symlink wasn't changed.
4793         (mode_changed): Return bool, not int.  Accept new argument
4794         NEW_MODE; all callers changed.  This lets us avoid statting the
4795         file unless the new mode has unusual bits.
4796         (process_file): Return -1 on error.  With -v, report all errors
4797         verbosely, not just some.
4799         * src/chown-core.c (change_file_owner): Return -1 on error, not
4800         1 sometimes and -1 on others.  Our caller ORs together our results,
4801         and (-1 | 1) == 0 on ones-complement hosts.
4802         With -v report all errors verbosely, not just some.
4803         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
4804         file_stats wasn't set properly in that case.
4806         * tests/chgrp/basic: Adjust to above changes.
4808 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
4810         * tests/chgrp/basic: Test that chgrp -h does not fail on
4811         symlinks, even on hosts where that's not supported.
4812         Test that if -R is specified without -H or L, -h is assumed.
4813         Test that chown() is not optimized away.
4815 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
4817         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
4819           Check for incompatible options.  When -R and --dereference are
4820           both used, then either -H or -L must also be used.  When -R and -h
4821           are both used, then -P must be in effect.
4823           -H, -L, and -P have no effect unless -R is also specified.
4824           If -P and -R are both specified, -h is assumed.
4826           Do not optimize away the chown() system call when the file's owner
4827           and group already have the desired value.  This optimization was
4828           incorrect, as it failed to updated the last-changed time and reset
4829           special permission bits, as POSIX requires.
4831           Do not report an error if the owner or group of a
4832           recursively-encountered symbolic link cannot be updated because
4833           the file system does not support it.
4835         * NEWS: Document the above.
4837         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
4838         requires either -H or -L, and -R -h requires -P.  If -H, specify
4839         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
4840         file as much like chown.c as possible.
4841         * src/chown.c (main): Likewise.
4843         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
4844         needed.  Chown a directory only after chowning its children; this
4845         avoids problems if the new directory ownership doesn't permit
4846         access to the children.  Dereference symlinks before doing
4847         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
4848         Do not optimize away the chown() system call when the file's owner
4849         and group already have the desired value.  POSIX does not permit
4850         this optimization.  Rely on chown and lchown to do the right
4851         thing with symlinks and/or -1 arguments, now that we have wrappers
4852         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
4853         errors, not just command-line errors.
4854         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
4856         * src/system.h (ENOTSUP): Remove.
4858         * tests/chgrp/basic: Use chown --from to discover whether the
4859         group changed, since chgrp now changes unconditionally.  This
4860         complicates the sed script a bit.  Do not specify --dereference,
4861         since it's the default (and we want to test this).  Adjust output
4862         to match the fact that chgrp no longer optimizes the case of
4863         changing a file's group to the same value as before.
4864         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
4865         options are incompatible, and their behavior is undefined with POSIX.
4866         (changed, not_changed): Adjust to match the fact that -h is no longer
4867         specified.  Sort names.
4868         * tests/chown/deref: Adjust error-diagnostic spelling to match new
4869         behavior.
4871 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
4873         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
4874         prevented a diagnostic of any operands.
4876 2004-06-08  Jim Meyering  <jim@meyering.net>
4878         * src/shred.c (direct_mode): Turn it on/off with directio, too.
4880 2004-06-07  Jim Meyering  <jim@meyering.net>
4882         Enable direct-mode I/O (bypassing the buffer cache), if possible.
4883         Prompted by a suggestion from Kalle Olavi Niemitalo
4884         in http://bugs.debian.org/207035.
4885         * src/shred.c (direct_mode): New function.
4886         (do_wipefd): Turn on direct-mode I/O.
4887         (dopass): If a file's first write fails with EINVAL,
4888         turn off direct-mode I/O and retry the write.
4890 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
4892         * src/tr.c (main): "tr -d a b" is now a fatal error even if
4893         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
4894         option combination.
4896 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
4898         * src/shred.c (dopass): Don't subtract 1 from the offset after
4899         a write error.  Problem reported by Jon Peatfield in:
4900         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
4902 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
4904         Fix bug reported by Buciuman Adrian in
4905         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
4906         where 'dd' created a file that was too large.  The bug was that dd
4907         assumed that the input file offset does not advance after a failed
4908         read; but POSIX says that the input file offset is undefined after
4909         a failed read.
4911         * src/dd.c (MAX_BLOCKSIZE): New macro.
4912         (input_seekable, input_seek_errno, input_offset,
4913         input_offset_overflow): New vars.
4914         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
4915         (advance_input_offset): New function.
4916         (skip_via_lseek): Set errno to zero when reporting our failure,
4917         so that we don't report based on garbage errno.
4918         (skip): If fdesc is standard input, advance the input offset.
4919         Do not quit if reading, and if noerror was specified;
4920         POSIX seems to require this.
4921         If read fails on output file, report the earlier lseek failure
4922         instead; this fixes a FIXME in dd_copy.
4923         (advance_input_after_read_error): New function.
4924         (dd_copy): Use it, instead of assuming that failed reads
4925         do not advance the file pointer.  Advance input offset
4926         after nonfailed reads.  Advance only a partial block if
4927         the previous read (before the failed read) succeeded, and
4928         do not generate an output block of zeros in this case.
4929         (main): Determine initial input offset, seekability of input,
4930         and error if it wasn't seekable.
4932 2004-06-02  Jim Meyering  <jim@meyering.net>
4934         rm (without -f) could hang unnecessarily when attempting to
4935         remove a symlink to a file on an off-line NFS-mounted partition.
4936         Reported by David Howells in https://bugzilla.redhat.com/124699.
4937         * src/remove.c (write_protected_non_symlink): New function.
4938         Don't invoke euidaccess on symlinks.
4939         (prompt): Use write_protected_non_symlink rather than using
4940         euidaccess directly, being careful not to call lstat twice for a file.
4942         Fix a bug in how the --output-delimiter=D option works with
4943         abutting byte or character ranges.  Reported by David Krider in
4944         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
4945         * src/cut.c (print_kth): Remove special case for open-ended range.
4946         (set_fields): Record the range start index for an interval even
4947         when it abuts another interval on its low side.
4948         Also record the range start index of the longest right-open-interval.
4949         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
4950         abutting and overlapping byte ranges.
4952 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
4954         Some POSIX-conformance cleanups for tr.
4956         * src/tr.c (posix_pedantic): Remove; no longer needed since
4957         we need to test this in just one place now.
4958         (usage): Mention -C.
4959         (unquote): Note that \055, \n, etc are escaped.
4960         Do not worry about POSIXLY_CORRECT when warning about ambiguous
4961         escape sequences.
4962         \ at end of string stands for itself.
4963         Do not diagnose invalid backslash escapes: POSIX says the behavior
4964         is unspecified in this case, so we don't need to diagnose it.
4965         (main): Add support for -C (currently an alias for -c).
4966         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
4967         a diagnostic here.
4968         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
4969         Fix comment for range-a-a.
4971 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
4973         Improve the efficiency (and in one case, correctness) of code
4974         that reads symlinks.
4976         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
4977         royally if the link length is long (e.g., GNU/Hurd).  Use
4978         xreadlink instead, it's safer.  Don't bother to read the link if
4979         it's the wrong size.  Add a FIXME because this area is a bit murky
4980         and undocumented.
4981         * src/ls.c (get_link_name): Update use of xreadlink.
4982         * src/readlink.c (main): Likewise.
4983         * src/stat.c (print_stat): Likewise.
4985 2004-06-01  Jim Meyering  <jim@meyering.net>
4987         * src/env.c (main): Prefer the notation `STREQ (a, b)'
4988         over `!strcmp (a, b)'.
4989         * src/sort.c (main, sort_buffer_size): Prefer the notation
4990         `STREQ (a, b)' over `strcmp (a, b) == 0'.
4991         * src/date.c (batch_convert): Likewise.
4992         * src/expr.c (nextarg): Likewise.
4993         * src/su.c (correct_password, restricted_shell, main): Likewise.
4994         * src/ptx.c (swallow_file_in_memory, main): Likewise.
4995         * src/test.c (binary_operator, and, or, main): Likewise.
4997 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4999         * NEWS: echo compatibility cleanup.
5000         * doc/coreutils.texi (echo invocation): Document the changes.
5001         * src/echo.c (V9_ECHO): Remove; always enabled.
5002         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
5003         we use the same naming convention as bash.  Now an enum,
5004         not a macro.
5005         (usage): Reword to mention -e/-E more accurately.
5006         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
5007         (hextobin): New function.
5008         (main): Use bool rather than int for local vars when appropriate.
5009         Do not allow options if POSIXLY_CORRECT, unless we are using
5010         BSD semantics and the first argument is "-n".
5011         Don't pass unnecessary extra arg to parse_long_options.
5012         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
5013         Do not look for options if !allow_options.
5014         Use size_t rather than int when appropriate.
5015         Open-code option test rather than using strrchr.
5016         Use faster test for "-".
5017         Avoid redundant argc test.
5018         Add support for \x, for Bash compatibility.
5019         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
5020         When '\c' is encountered, stop printing immediately, as POSIX
5021         requires.
5022         Add support for \xhh syntax.
5023         Add support for \0ooo syntax; POSIX requires this.
5025 2004-06-01  Jim Meyering  <jim@meyering.net>
5027         * Use automake-1.8b.  Regenerate dependent files.
5029 2004-05-31  Jim Meyering  <jim@meyering.net>
5031         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
5032         the build src/ directory -- at the front.
5033         ($(srcdir)/$x-tests): Depend on Makefile.am.
5034         Use $x as the program name, except when it would be `test' (test is
5035         the sole program tested via mk-script that is also a shell built-in).
5036         In that case, use the old ../../src/$x.
5038 2004-05-30  Jim Meyering  <jim@meyering.net>
5040         Work around HPUX /bin/cc compiler bug that is exposed, now that
5041         sets are arrays of type `bool'.  More details here:
5042         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
5043         FIXME: verify that the above URL points to the right message
5045         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
5046         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
5047         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
5048         system, those two expressions are not the same (256 vs. 1024).
5049         The effect of this problem was that `tr -c x y' would fail:
5050         tr: when not truncating set1, string2 must be non-empty
5051         (set_initialize): Remove unnecessary initialization of the `in_set'
5052         buffer; that initialization triggered the same compiler bug as above.
5054 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
5056         tr cleanup, mostly having to do with integer type ranges.
5057         Remove all casts.
5059         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
5060         the test cases wouldn't be portable, or would take too much CPU
5061         time, or both.
5063         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
5064         This is safe since the code already assumes N_CHARS fits in int.
5065         (Filter): Remove: we want to prototype everything.
5066         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
5067         (uchar): New function.  All places where a char must be converted
5068         to an unsigned char are now done this way, not by ad-hoc methods.
5069         (count): New type.  Use it whenever counts or states are needed.
5070         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
5071         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
5072         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
5073         whenever appropriate.
5074         (NOT_A_CHAR): Remove global macro; now a local enum.
5075         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
5076         the rest of the code no longer depends on them.
5077         (class_ok): Remove; all uses changed to use inline comparisons.
5078         (RE_NO_TYPE): Remove; wasn't used or needed.
5079         (struct List_element): normal_char and equiv_code are now unsigned
5080         char, not int.
5081         first_char, last_char, and the_repeated_char are now unsigned char,
5082         not unsigned int.  repeat_count is now count, not size_t.
5083         All uses changed.
5084         (struct Spec_list): state is now count, not unsigned int.
5085         lengthis now count, not size_t.
5086         n_indefinite_repeats is now size_t, not int.
5087         has_equiv_class, has_char_class, and has_restricted_char_class
5088         are now bool, not int.  All uses changed.
5089         (struct E_string): s is now char *, not unsigned char *.
5090         escaped is now bool *, not int *.  All uses changed.
5091         (ES_MATCH): Remove macro, replacing with:
5092         (es_match): New inline function.  All uses changed.
5093         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
5094         translating): Now bool, not int.
5095         (io_buf): Now char array, not unsigned char.
5096         (SET_TYPE): Remove.  All uses replaced with bool.
5097         (is_equiv_class_member, unquote, append_range, append_char_class,
5098         append_equiv_class, find_closing_delim, star_digits_closebracket,
5099         build_spec_list, parse_str, homogeneous_spec_list):
5100         Now returns bool, not int.  All uses changed.
5101         (is_equiv_class_member): Now inline.
5102         (is_equiv_class_member, is_char_class_member, make_printable_str,
5103         append_normal_char, append_range, append_repeated_char,
5104         get_s2_spec_stats):
5105         Args are now of proper integer type.
5106         (unquote, look_up_char_class, make_printable_str,
5107         append_equiv_class, build_spec_list, squeeze_filter):
5108         Avoid unsigned char *p; gently convert *p to unsigned char instead.
5109         (unquote, get_spec_stats): Do not jump past declarations and then
5110         use them; C doesn't allow this in portable programs.
5111         (make_printable_str): Check for overflow in size calculations.
5112         (xmemdup): Remove.  All uses rewritten.
5113         (find_bracketed_repeat): Args are now of proper pointer-to-integer
5114         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
5115         (find_bracketed_repeat, star_digits_closebracket): Check that the
5116         digits are not escaped.
5117         (build_spec_list): Don't bother to copy opnd_str; not needed.
5118         (build_spec_list, get_next): Simplify internal logic a bit.
5119         (card_of_complement): Fix bug due to char overflow.
5120         (get_spec_stats): Don't assume len fits into int.
5121         Check for integer overflow.  Use abort() rather than assert(0).
5122         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
5123         was being invoked.
5124         (squeeze_filter): READER is never null now; simplify code.
5125         READER arg now has a simpler type.  Remove unnecessary casts.
5126         (squeeze_filter, main): Calls to fwrite improperly checked result
5127         against zero, rather than against requested size.
5128         (plain_read): New function.
5129         (read_and_delete, read_and_xlate):
5130         Remove unused filter arg, and don't worry about hit_eof.
5131         Simplify by using plain_read.
5132         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
5133         (main): Always pass a non-null procedure to squeeze_filter.
5134         Rewrite so that class_ok isn't needed.
5136 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
5138         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
5139         fdatasync reports EBADF when syncing (unwritable) directories.
5140         Problem reported by Albert Chin-A-Young in:
5141         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
5143 2004-05-29  Jim Meyering  <jim@meyering.net>
5145         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
5146         Patch from Albert Chin.
5148         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
5150         * src/remove.c (push_dir): Merge declaration and adjacent assignment
5151         into a single statement.
5153 2004-05-28  Jim Meyering  <jim@meyering.net>
5155         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
5157 2004-05-22  Jim Meyering  <jim@meyering.net>
5159         rm -r would get a failed assertion when run from an inaccessible
5160         directory and with two or more command line arguments including an
5161         absolute-named directory followed by a relative-named directory.
5163         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
5164         * src/remove.c (struct cwd_state): Define.
5165         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
5166         can be detected by the caller.  Instead of returning a malloc'd
5167         directory name, communicate it to caller via a new parameter, and
5168         return an indication of whether restore_cwd failed.  Update caller.
5169         Eliminate an unnecessary call to AC_stack_top.
5170         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
5171         so we can now communicate to caller whether/how functions like
5172         restore_cwd have failed.  Update caller.
5173         (rm_1): Fail if we've failed to restore the working directory
5174         and the name of the next file to remove is `.'-relative.
5175         (rm): Fail if the require_restore_cwd flag is true and we've
5176         failed to restore the working directory.
5177         * src/mv.c (rm_option_init): Initialize new member,
5178         x->require_restore_cwd.
5179         * src/rm.c (rm_option_init): Likewise.
5181 2004-05-21  Jim Meyering  <jim@meyering.net>
5183         * tests/rm/inaccessible: New test for the above fix.
5184         * tests/rm/Makefile.am (TESTS): Add inaccessible.
5186         * src/remove.c (rm): Use free rather than XFREE.
5187         (remove_dir): Use xmalloc, not XMALLOC.
5188         (ds_init): Likewise.
5190 2004-05-20  Jim Meyering  <jim@meyering.net>
5192         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
5193         diagnostics in shred.c have been fixed, don't exempt shred.c from
5194         this check.
5196         * src/shred.c: Use translatable diagnostics, e.g.
5197         change "%s: remove" to _("%s: failed to remove") and
5198         change "%s: close"  to _("%s: failed to close").
5200 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
5202         * src/shred.c (names): Bring back lower-case letters, "_", and
5203         ".".  But continue to omit +, =, %, @, #, as they're either
5204         shell metacharacters (for some shells) or are not in some
5205         character sets, or (in the case of '%') must be a
5206         metacharacter somewhere.
5208 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
5210         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
5212 2004-05-17  Jim Meyering  <jim@meyering.net>
5214         * src/shred.c (incname): Decrement `len' only once per loop iteration.
5216         chgrp and chown now dereference symlinks by default, per POSIX.
5217         Reported by Michal Politowski as http://bugs.debian.org/249177.
5219         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
5220         * src/chown.c (usage): Update to reflect this.
5221         * src/chgrp.c (usage): Likewise.
5222         * NEWS: Describe the change.
5223         Adapt tests accordingly.
5224         * tests/chgrp/basic: Use -h where necessary to retain semantics.
5225         * tests/chgrp/deref: Likewise.
5226         * tests/chgrp/posix-H: Likewise.
5228 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
5230         In shred, check for errors from fdatasync more carefully.  If
5231         fdatasync fails with errno==EINVAL, it means this implementation
5232         does not support synchronized I/O for this file.  Do not report
5233         this as an error, as (for example) AIX 5.2 fdatasync reports it
5234         for raw disk devices.  Problem reported by Albert Chin in
5235         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
5237         Check for write errors, though: the old code ignored them.
5238         Improve error checking in a few other cases, too (e.g., close of a
5239         directory).
5241         Also, change several 'int' values to 'bool', so that the error
5242         checking is a bit clearer.  Similarly, change unsigned values
5243         to size_t where appropriate.
5245         * src/shred.c: Include "dirname.h".
5246         (datasync) [!HAVE_FDATASYNC]: Remove.
5247         (dosync): New function.
5248         (dopass): Use it.  Return 1 on write error, -1 on other error.
5249         All callers changed.  Report write error if dosync does.
5250         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
5251         not int (0/-1).  All callers changed.  Return false if there's a
5252         write error.
5253         (incname): Return bool (true/false), not int (0/1).  Accept
5254         size_t length, not unsigned.  All callers changed.  Do not
5255         bother checking for non-digits; it can't happen.  Replace
5256         recursion with iteration.
5257         (wipename): Use dir_name, base_name, etc. instead of assuming
5258         Unix file names.  Use size_t for length, not unsigned.
5259         Report error if unlink or close fails.
5260         (wipename, main): Use bool for booleans.
5262         (names): Use only digits and uppercase letters, for greater
5263         portability.
5265 2004-05-16  Jim Meyering  <jim@meyering.net>
5267         * tests/chown/deref: New test for the yesterday's change.
5268         * tests/chown/Makefile.am (TESTS): Add deref.
5270 2004-05-15  Jim Meyering  <jim@meyering.net>
5272         chown --dereference did nothing when the owner/group of a
5273         symlink matched the desired owner/group.  Reported by David Malone.
5274         Also reported in 1999 as http://bugs.debian.org/39642.
5276         * src/chown-core.c (change_file_owner): When --dereference has
5277         been specified, and when processing a symlink, stat it to get the
5278         owner and group of the referent.
5280 2004-05-14  Jim Meyering  <jim@meyering.net>
5282         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
5283         s/supercede/supersede/ reported by Andrew Fabbro.
5285 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
5287         Improve performance of `sort -m' on large files, at the cost of
5288         making some contrived examples unsafe.  POSIX allows this
5289         optimization.  Performance problem reported by Jonathan Baker in
5290         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
5292         * src/sort.c (first_same_file): Do not treat input pipes
5293         differently from other files.
5294         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
5295         might write F before reading all the input.
5296         * NEWS: Likewise.
5298 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
5300         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
5301         '\007', for portability to EBCDIC hosts.
5302         * src/printf.c (print_esc_char): Likewise.
5303         * src/tr.c (unquote, make_printable_str): Likewise.
5305 2004-05-12  Jim Meyering  <jim@meyering.net>
5307         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
5308         where the result is used.  This avoids one unnecessary lstat call
5309         per command line argument.
5311 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
5313         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
5315         * src/Makefile.am (all_programs.list): New rule, copied from
5316         man/Makefile.am and tests/Makefile.am, except that we use the
5317         system tr rather than ./tr and we don't use tr -s.
5318         * tests/Makefile.am (all_programs): Use it.
5319         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
5320         for consistency.  All uses changed.
5322 2004-05-11  Jim Meyering  <jim@meyering.net>
5324         * tests/rm/unread3: New test, for the above fix and today's
5325         lib/save-cwd.c improvement.
5326         * tests/rm/Makefile.am (TESTS): Add unread3.
5328         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
5330 2004-05-10  Jim Meyering  <jim@meyering.net>
5332         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
5333         * tests/install/Makefile.am (TESTS): Add trap.
5335         * src/remove.c (AD_push): Don't use errno in diagnostic about
5336         `changed dev/ino'.
5338         Remove these generated files from CVS.
5339         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
5340         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
5341         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
5342         * tests/tr/tr-tests, tests/wc/wc-tests:
5344 2004-05-09  Jim Meyering  <jim@meyering.net>
5346         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
5347         a loop initializing the just-allocated memory to zero.
5349 2004-05-08  Jim Meyering  <jim@meyering.net>
5351         * tests/rm/no-give-up: New file; check for today's fix.
5352         * tests/rm/Makefile.am (TESTS): Add no-give-up.
5354 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
5356         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
5357         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
5359         * src/remove.c (remove_entry): Check for errno values like ENOENT
5360         that show the file cannot be directory, instead of for errno
5361         values like EPERM that show the file might be a directory.  This
5362         is necessary because, when a single unlink() call has multiple
5363         reasons to fail, it can set errno to any of those reasons; it's
5364         only the rare errno value like ENOENT that excludes all the other
5365         possible reasons to fail even when the file is a directory.
5366         (remove_cwd_entries): Don't attempt chdir if the file is known
5367         to not be a directory.
5368         (remove_dir): Use the same method that remove_cwd_entries uses
5369         (for some reason they differed).  Don't assert that saved_errno
5370         must be EPERM; it might be just about anything.
5372 2004-05-06  Jim Meyering  <jim@meyering.net>
5374         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
5375         Don't add `1' to the buffer size (it was to protect against malloc
5376         implementations that fail to allocate a buffer of size zero).
5377         That is no longer necessary, since we use a malloc wrapper
5378         on such systems.
5380         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
5381         * src/head.c (elide_tail_bytes_pipe): Likewise.
5382         * src/df.c (main): Likewise.
5383         * src/shred.c (do_wipefd): Likewise.
5384         * src/users.c (list_entries_users): Likewise.
5385         * src/tail.c (main): Likewise.
5386         * src/md5sum.c (main): Likewise.
5388 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
5390         * src/df.c (show_disk, show_point): If several filesystems are
5391         mounted on the same mount point, prefer the last one, not the first.
5392         Problem reported by Christian Jones in
5393         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
5394         (show_disk): Remove unused statp arg.  Return bool, not int.
5395         (show_point): Rewrite to avoid gotos.  Use the same algorithm
5396         for lofs and dummies for each pass through the mount table,
5397         rather than subtly different algorithms (which are probably
5398         inadvertent).
5400 2004-05-03  Jim Meyering  <jim@meyering.net>
5402         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
5403         have m4/Makefile*.
5405 2004-05-01  Jim Meyering  <jim@meyering.net>
5407         When chown or chgrp is modifying the referent of a symlink,
5408         use the chown(2) function, if possible.
5409         * src/chown-core.c (change_file_owner): Don't hard-code the
5410         open/fchown/close kludge here.  Use `chown' instead.
5411         The chown function works just fine on conforming systems.
5412         Other systems now go through the new chown wrapper that
5413         resorts to the old kludge.
5415         * src/chown-core.c (change_file_owner): Add a comment.
5417 2004-04-27  Jim Meyering  <jim@meyering.net>
5419         * src/ptx.c: Make over 40 global extern variables `static'.
5420         (syntax_table, re_syntax_table): Remove declarations of two unused
5421         variables (they were exposed by the above change).
5423         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
5424         * src/ln.c (backup_type): Likewise.
5426         * src/remove.c (rm): Add `extern' keyword.
5427         * src/cp-hash.c (forget_created, remember_created)
5428         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
5429         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
5430         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
5431         (uid_to_name, chown_files): Likewise.
5433         * src/Makefile.am (sc_tight_scope): New rule.
5434         * Makefile.maint (sc_tight_scope): New rule.
5435         (syntax-check-rules): Add it.
5437 2004-04-26  Jim Meyering  <jim@meyering.net>
5439         * Use automake-1.8.4.  Regenerate dependent files.
5441         * src/sort.c (limfield): Make a comment clearer.
5443 2004-04-25  Paul Eggert  <eggert@twinsun.com>
5445         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
5446         leading blanks when computing the location of the field end;
5447         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
5448         does conform to POSIX.  Also fix the documentation to clarify
5449         this and related issues.
5451         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
5452         that the options are in alphabetical order.  Describe how -b works
5453         more-accurately; this involves fixing some examples, too.  Mention
5454         what happens if the start field falls after an end field or after
5455         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
5456         Add an example of how to sort IPv4 addresses and Apache Common
5457         Log Format dates.  Remove a duplicate example.
5458         (Putting the tools together): Use separate options rather
5459         than agglomerating them.
5460         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
5461         decode whether to skip leading blanks.
5462         (trailing_blanks): Remove.
5463         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
5465         * tests/pr/Test.pm: Fix typo in env_default comment.
5466         * tests/sort/Test.pm: Likewise.
5467         (18c, 18d): Reverse the order of output lines, so that the
5468         test cases conform to POSIX.
5470 2004-04-22  Paul Eggert  <eggert@twinsun.com>
5472         More signal-handling cleanup for ls.c.  Do not allow signals to
5473         happen between arbitrary output bytes, as the
5474         restore-default-color sequence can bollix up multibyte chars or
5475         color-change sequences in the ordinary output.  Instead, process
5476         signals only between printing a file name and changing the color
5477         back to non_filename_text color.  That way, if the signal handler
5478         changes the color (to the default), 'ls' will change it back when
5479         'ls' continues (after being suspended).
5481         Also, do not bother with signal-handling unless stdout is a
5482         controlling terminal; this lets stdio buffer better when "ls
5483         --color" is piped or sent to a file.
5485         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
5486         Do not include "full-write.h"; no longer needed.
5487         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
5488         (put_indicator_direct): Remove.  All callers changed to use
5489         put_indicator.
5490         (caught_signals, interrupt_signal, stop_signal_count): New vars.
5491         (restore_default_color): Don't bother checking for put_indicator
5492         failure.
5493         (sighandler): Don't handle SIGTSTP; that's another handler now.
5494         Simply set interrupt_signal to the signal, then exit.
5495         (stophandler, process_signals): New functions.
5496         (main): Don't output any color changes until _after_ the signal
5497         handlers are set up.  This fixes a race condition where 'ls'
5498         could be interrupted while initializing colors, and leaving the
5499         terminal in an undesirable state.
5500         Don't mess with signal-handling if standard output is not a
5501         controlling terminal.
5502         When exiting, restore the default color, then restore the
5503         default signal handling, then act on any signals that weren't
5504         acted on yet.
5505         Do not print //DIRED// etc. in colors; this avoids the need
5506         to catch signals when printing them.
5507         (print_name_with_quoting): Process signals just before switching
5508         color back to non_filename_text.
5510 2004-04-23  Jim Meyering  <jim@meyering.net>
5512         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
5513         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
5514         of quotearg_buffer.  Patch by Mikulas Patocka.
5516 2004-04-18  Paul Eggert  <eggert@twinsun.com>
5518         tee ignored SIGPIPE, but POSIX doesn't allow this.
5520         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
5521         does not allow this.  This undoes the 1996-10-24 patch.
5523 2004-04-18  Paul Eggert  <eggert@twinsun.com>
5525         Signal-handling cleanup for coreutils.  Here are the highlights:
5527          - csplit sometimes failed to remove files when interrupted.
5528          - csplit didn't clean up if two signals arrived nearly simultaneously.
5529          - install -s would infloop on System V if SIGCHLD was ignored.
5530          - ls could incorrectly restore color if multiple signals
5531            arrived nearly simultaneously.
5533         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
5534         Define.
5535         (filename_space, prefix, suffix, digits, files_created, remove_files):
5536         Now volatile.
5537         (caught_signals): New var.
5538         (cleanup): Block signals while deleting all files.
5539         (cleanup_fatal, handle_line_error, regexp_error):
5540         Mark with ATTRIBUTE_NORETURN.
5541         (create_output_file, close_output_file, interrupt_handler):
5542         Block signals while changing the number of output files,
5543         to fix some race conditions.
5544         (delete_all_files): Do nothing if remove_files is zero.
5545         Clear files_created.
5546         (main): Don't mess with signals until after argument processing
5547         is done.
5549         * src/csplit.c (main): Rewrite signal-catching code to make it
5550         similar to other coreutils programs.  When processing signals,
5551         block all signals that we catch, but do not block signals that we
5552         don't catch.  Avoid problems with unsigned int warnings.
5553         * src/ls.c (main): Likewise.
5554         * src/sort.c (main): Likewise.
5556         * src/csplit.c (interrupt_handler):
5557         Use void, not (obsolete) RETSIGTYPE.
5558         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
5560         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
5561         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
5562         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
5563         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
5564         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
5565         for SIG_IGN.
5566         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
5568         * src/install.c: Include <signal.h>.
5569         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
5570         given, since System V fork+wait does not work if SIGCHLD is ignored.
5572         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
5573         handler to self, not to SIG_IGN, since SIGTSTP can be received
5574         more than once.
5575         (main): Use SA_RESTART, as that is simpler than checking for EINTR
5576         failures all over the place.
5578 2004-04-20  Jim Meyering  <jim@meyering.net>
5580         * src/remove.c (is_empty_dir): Clarify comment.
5582         * man/help2man: Accept new option: --program-name=NAME, so that we
5583         can override the one in --version output.  This is needed solely
5584         so that test.1 doesn't refer to `[' as the program name.
5585         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
5586         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
5588         * src/pwd.c: Don't include pathmax.h; system.h already does it.
5590         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
5592 2004-04-19  Jim Meyering  <jim@meyering.net>
5594         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
5595         Initialize a buffer to avoid warnings from tools like valgrind.
5597         * Makefile.maint (sc_trailing_blank): New rule.
5598         (syntax-check-rules): Add it.
5599         * .x-sc_trailing_blank: New file.
5601         Make pwd work even if the resulting name is so long that getcwd fails.
5602         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
5603         (nth_parent, find_dir_entry, robust_getcwd): New functions.
5604         (main): First try getcwd, then, upon failure, robust_getcwd.
5606 2004-04-18  Jim Meyering  <jim@meyering.net>
5608         * src/who.c (print_user): Use xrealloc here, rather than
5609         unchecked realloc.  Remove anachronistic casts.
5611         * src/remove.c (full_filename_): Don't leak upon failed realloc.
5613         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
5614         from remove.c.
5615         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
5616         renaming it.  Update uses.
5618 2004-04-17  Jim Meyering  <jim@meyering.net>
5620         * configure.ac: Depend on automake-1.8.3.
5622         * src/join.c (add_file_name): Declare function to be `static'.
5623         (string_to_join_field): Likewise.
5624         * src/remove.c (ds_init, ds_free): Likewise.
5626         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
5627         (syntax-check-rules): Add to the list.
5629 2004-04-13  Paul Eggert  <eggert@twinsun.com>
5631         Use page-aligned buffers whenever we bother to do I/O using buffer
5632         sizes that are tailored for the files.
5634         * src/cat.c: Include getpagesize.h.
5635         * src/copy.c: Likewise.
5636         * src/shred.c: Likewise.
5637         * src/split.c: Likewise.
5638         * src/cat.c (main): Align I/O buffers to page boundaries.
5639         * src/copy.c (copy_reg): Likewise.
5640         * src/shred.c (dopass): Likewise.
5641         * src/split.c (main): Likewise.
5642         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
5643         All uses replaced by ptr_align.
5644         * src/od.c (gcd, lcm): Remove; now in system.h.
5645         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
5647 2004-04-14  Jim Meyering  <jim@meyering.net>
5649         Remove m4/Makefile.am: it's no longer needed, with newer automake
5650         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
5651         * Makefile.am (SUBDIRS): Remove `m4' from the list.
5653 2004-04-13  Jim Meyering  <jim@meyering.net>
5655         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
5657 2004-03-27  Paul Eggert  <eggert@twinsun.com>
5659         * NEWS: cp -pu and mv -u (when copying) now take the destination
5660         file system time stamp resolution into account.
5661         * doc/coreutils.texi (mv invocation): Document this.
5662         (cp invocation): Document -u (it was missing!) with new behavior.
5664         * src/copy.c: Include "utimecmp.h".
5665         (copy_internal): Compare time stamps using utimecmp rather than
5666         MTIME_CMP.
5668 2004-04-09  Jim Meyering  <jim@meyering.net>
5670         * Makefile.maint (.re-list): New rule/file, to replace
5671         hard-coded list of header file names.
5672         (sc_system_h_headers): Use the new file.
5673         Don't look for sys2.h anymore.
5675         * src/system.h: Include new "stat-macros.h" rather than hard-coding
5676         all of its macro definitions -- the list was slightly out of date.
5677         Suggestion from Dmitry V. Levin.
5679 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
5681         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
5682         * doc/coreutils.texi (dd invocation): Likewise.
5683         * src/shred.c (O_NOCTTY): Remove redundant decl.
5684         * src/dd.c (flags, usage): Remove noctty flag.
5685         (main): Always use O_NOCTTY when opening files.
5687 2004-04-08  Jim Meyering  <jim@meyering.net>
5689         * src/dd.c (dd_copy): Mark two diagnostics for translations.
5690         (set_fd_flags): Undo part of today's change: it's a little
5691         cleaner -- and more efficient in the common case -- to go
5692         ahead and OR in the -1 when fcntl fails.
5694         * Makefile.maint (sc_dd_max_sym_length): New target.
5695         (syntax-check-rules): Add it.
5697         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
5698         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
5700         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
5701         Rename parameter, flags, to avoid shadowing global.
5702         (LONGEST_SYMBOL): Tweak comment.
5704 2004-04-07  Paul Eggert  <eggert@twinsun.com>
5706         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
5707         and new dd options iflag= and oflag=.
5708         * src/dd.c (usage): Likewise.
5709         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
5710         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
5711         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
5712         (input_flags, output_flags): New vars.
5713         (LONGEST_SYMBOL): New macro.
5714         (struct symbol_value): Renamed from struct conversion.  Members
5715         symbol and value renamed from convname and conversion.  The
5716         symbol value is now an array instead of a pointer; this saves
5717         a bit of space and time in practice.  All uses changed.
5718         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
5719         (flags): New constant array.
5720         (iflag_error_msgid, oflag_error_msgid): New constants.
5721         (parse_symbols): Renamed from parse_conversion and generalized
5722         to handle either conversion or flag symbols.
5723         (scanargs): Adjust uses of parse_symbols accodingly.  Add
5724         support for iflag= and oflag=.  Reject attempts to use
5725         both excl and nocreat.
5726         (set_fd_flags): New function.
5727         (dd_copy): Just return X rather than calling quit (X), since our
5728         caller invokes quit with the returned value.  Add support for
5729         fdatasync and fsync.
5730         (main): Add support for iflag=, oflag=, and new conv= symbols.
5731         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
5732         O_RSYNC, O_SYNC): Define to 0 if not already defined.
5734         * NEWS: Remove duplicate mention of BLOCKSIZE.
5736 2004-04-02  Andreas Schwab  <schwab@suse.de>
5738         * src/stty.c: Add support for IUTF8 input flag.
5740 2004-04-06  Jim Meyering  <jim@meyering.net>
5742         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
5743         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
5745 2004-04-04  Jim Meyering  <jim@meyering.net>
5747         A specified format is no longer automatically newline terminated.
5748         If you want a newline at the end of your format, use `\n'.
5749         * src/stat.c (print_it): Don't print a newline at the end of
5750         every format.
5751         (do_statfs): Add a newline at end of each default format string.
5753 2004-03-30  Paul Eggert  <eggert@twinsun.com>
5755         * src/nohup.c (main): Adjust to new calling convention
5756         for set_cloexec_flag.
5758 2004-03-31  Jim Meyering  <jim@meyering.net>
5760         * tests/Fetish.pm (run_tests): Remove `.orig' file.
5761         Remove debugging diagnostic.
5763         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
5764         would not elicit an error.
5765         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
5766         (main): Don't use atoi.  Use xstrtoul instead.
5768 2004-03-30  Jim Meyering  <jim@meyering.net>
5770         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
5771         (syntax-check-rules): Add it.
5772         * .x-sc_prohibit_atoi_atof: New file.
5774 2004-03-29  Jim Meyering  <jim@meyering.net>
5776         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
5777         test is not sensitive to system-dependent block size differences.
5778         Prompted by a report of Solaris 8 differences from Paul Eggert.
5780         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
5781         Rename `%tmp' to `%actual'.  Reverse order of last two args to
5782         _compare_files (to $actual, $expected) so as to match declaration.
5784 2004-03-28  Paul Eggert  <eggert@twinsun.com>
5786         Fix some gotchas encountered when porting to Solaris 8, using
5787         the Forte 6u2 compiler.
5789         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
5790         Declare sethostname, since no Solaris header does it.
5791         * src/who.c: Include "vasprintf.h", for asprintf.
5793 2004-03-28  Jim Meyering  <jim@meyering.net>
5795         Minor optimization:
5796         * src/du.c (process_file): Don't record dev/inode for directories.
5798         Under some circumstances, without -c, du would mistakenly count the
5799         space of hard-linked files, not just the first one it encountered.
5800         Reported by Anthony Thyssen.
5801         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
5803         * src/du.c: Rename global `print_totals' to `print_grand_total'.
5805         * src/du.c (main): Rearrange filtering loop to be a tiny bit
5806         more efficient.
5808         * src/chown-core.c: Don't include savedir.h -- no longer needed.
5809         * src/chmod.c: Likewise.
5811 2004-03-25  Jim Meyering  <jim@meyering.net>
5813         * src/du.c (main): Remove now-unused declaration of `i'.
5815 2004-03-24  Paul Eggert  <eggert@twinsun.com>
5817         * src/du.c (main): Filter out file names of length zero before
5818         invoking fts, so that they don't cause fatal errors.
5820 2004-03-25  Jim Meyering  <jim@meyering.net>
5822         * tests/du/files0-from (zero-len): Add a test for the above.
5824 2004-02-25  Paul Eggert  <eggert@twinsun.com>
5826         * NEWS: New environment var BLOCKSIZE.
5827         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
5828         * tests/envvar-check: Test for it.  Factor the code to simplify it.
5830 2004-03-23  Paul Eggert  <eggert@twinsun.com>
5832         * NEWS: Shorten the du --files0-from announcement, and say
5833         "NUL-terminated" rather than "NUL-separated".
5834         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
5835         Remove: not used.
5836         (usage): Say "NUL-terminated", not "NUL-separated".
5837         (main): Check for I/O error when istream is closed.
5838         Allow --files0-from=F even if F is empty; this specifies no files.
5839         (du_files): Now that we allow the list of files to be empty,
5840         handle that case.
5841         * tests/du/files0-from: Adjust to above changes to src/du.c.
5843 2004-03-24  Jim Meyering  <jim@meyering.net>
5845         * tests/tail-2/assert: Avoid race condition that could cause
5846         spurious failure.  Based on a patch from Andreas Schwab.
5848 2004-03-23  Jim Meyering  <jim@meyering.net>
5850         * src/du.c (main): Free the hash table, too.
5852 2004-03-22  Jim Meyering  <jim@meyering.net>
5854         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
5855         the change of 2004-01-22.  I can no longer reproduce the problem
5856         that prompted that change, and `info coreutils pr' would display the
5857         `printing text' section of the manual, not the one on `pr invocation'.
5859         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
5860         to match corrected output.
5862         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
5863         (main): Use readtoken0 functions rather than readtokens.
5864         Don't use errno when diagnosing readtokens0 failure.
5865         Fix off-by-one error in the token number reported in a diagnostic.
5866         (du_files): Return bool, rather than int.
5867         (main): Call readtokens0_free.
5869 2004-03-21  Jim Meyering  <jim@meyering.net>
5871         * src/remove.c (ds_free): Plug a small leak.
5873         * tests/Fetish.pm: Fix typo in comment.
5875 2004-03-07  Jim Meyering  <jim@meyering.net>
5877         * NEWS: du accepts a new option --files0-from=FILE, where FILE
5878         contains a list of NUL-separated file names.
5880         * src/du.c: Include "readtokens.h".
5881         (usage): Describe the new option, and adjust the `Usage':
5882         with this option, no FILE may be specified on the command line.
5883         (main): Handle the new option.
5885         * tests/du/files0-from: New tests, for the above.
5886         * tests/du/Makefile.am (TESTS): Add files0-from.
5888         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
5889         * src/tsort.c (tsort): Likewise.
5891 2004-02-29  Paul Eggert  <eggert@twinsun.com>
5893         * NEWS: Add support for a new notation @N to get_date to represent
5894         the time stamp with numeric value N.  Improve support for
5895         fractional time stamps.  date's -d and -f options now accept them.
5896         Likewise for touch -t.  date has a new option --iso-8601=ns.
5898         * doc/coreutils.texi (touch invocation):
5899         Describe use of fractional seconds.
5900         (date invocation, Options for date): Likewise.
5901         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
5902         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
5903         (Options for date): Describe new --iso-8601=ns option.
5905         * doc/getdate.texi: Add copyright notice.  Change getdate to
5906         get_date when talking about the function name.
5907         (Seconds since the Epoch): New section, containing the time_t
5908         info moved from Date input formats section, along with new
5909         info about the @ syntax.  Mention negative time stamps,
5910         fractional time stamps, and leap seconds.
5911         (General date syntax): Modernize examples a bit to reflect new
5912         features.
5913         (General date syntax, Relative items in date strings):
5914         Use ' rather than " to quote formats.
5915         (Time of day items): Add an example with fractional seconds.
5916         Describe fractional-second syntax.
5918         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
5919         needs clock_gettime.
5921         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
5922         (time_spec_string, time_spec, show_date): Support it.
5923         (usage): Remove description of -ITIMESPEC, as it's obsolete and
5924         confusing.  Mention --iso-8601=ns.
5925         (batch_convert): getline returns ssize_t, not int.
5927         * src/touch.c (newtime): Now an array of two timespecs, one
5928         for access and one for modification.
5929         (ref_stats): Remove.
5930         (get_reldate): Use get_date's parameter profile.
5931         (touch, main): Adjust to above changes.
5932         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
5933         Use gettime instead of gettimeofday, for new get_date signature.
5935         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
5936         ns-relative.
5938 2004-03-15  Jim Meyering  <jim@meyering.net>
5940         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
5941         target before updating $(prev_version_file).
5943         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
5944         See today's change in lib/getdate.y.
5945         * tests/misc/Makefile.am (TESTS): Add date-sec.
5947 2004-03-14  Jim Meyering  <jim@meyering.net>
5949         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
5950         signature files, not `.asc'.  Reported by angico@yahoo.com.
5952 2004-03-13  Jim Meyering  <jim@meyering.net>
5954         * src/cp.c (do_copy): Tweak wording in a diagnostic.
5955         Suggestion from Karl Berry.
5956         Include "quoatearg.h".
5957         (do_copy): Use quotearg_colon (not quote) for diagnostics
5958         that begin with `"%s:'.
5960         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
5961         Suggestion from Dan Jacobson.
5963 2004-03-12  Jim Meyering  <jim@meyering.net>
5965         * Version 5.2.1.
5967         Sometimes, when source and destination partition are different,
5968         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
5970         * src/copy.c: When moving a set of N hard-linked files between
5971         partitions, via two or more command line arguments where the
5972         command line argument containing the Nth link contains no other
5973         link to that same file, mv would mistakenly copy the file, rather
5974         than hard-linking it to the other(s).  That happens because when the
5975         final link is processed, its link count has been reduced to 1 since
5976         the other links have been `copied' to the destination partition
5977         and the source links have been removed.
5978         (copy_internal): When in move mode, use the source dev/inode
5979         pair to look up destination name even when st_nlink == 1.
5980         * src/cp-hash.c (src_to_dest_lookup): New function.
5981         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
5982         * tests/mv/part-hardlink: New file.  Test for the above fix.
5983         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
5985         * announce-gen: Sync with autoconf.
5987         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
5988         This was triggered on a Linux-2.2.19 system using a file system
5989         NFS-mounted from some sort of Sun.
5991 2004-03-11  Jim Meyering  <jim@meyering.net>
5993         * Use automake-1.8.3.  Regenerate dependent files.
5995 2004-03-10  Jim Meyering  <jim@meyering.net>
5997         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
5998         so that this test works with SELinux-enabled systems.
5999         Based on a patch from Tim Waugh.
6001         `join -1 x' would give a misleading diagnostic
6002         * src/join.c (string_to_join_field): Report that a non-numeric field
6003         number is invalid, rather than `so large that it is not representable'.
6004         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
6006 2004-03-06  Jim Meyering  <jim@meyering.net>
6008         cp --sparse=always sparse-image-file.img /dev/hda1 could
6009         produce an invalid copy on the destination device.
6011         * src/copy.c (copy_reg): Even with --sparse=always, try to
6012         make `holes' only if the destination is a regular file.
6013         Reported by Szakacsits Szabolcs.
6015 2004-03-03  Paul Eggert  <eggert@twinsun.com>
6017         * src/nohup.c (main): Don't invoke set_cloexec_flag with
6018         a file descriptor of -1.
6020 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
6022         * src/nohup.c: Include "cloexec.h".
6023         (main): Set the copy of stderr to close on exec.
6025 2004-03-01  Paul Eggert  <eggert@twinsun.com>
6027         * configure.ac: Include <signal.h> when checking for strsignal,
6028         sys_siglist, and friends.  Problem reported by Tony Leneis in
6029         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
6031 2004-02-25  Paul Eggert  <eggert@twinsun.com>
6033         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
6034         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
6035         etc. are set.
6037 2004-02-23  Paul Eggert  <eggert@twinsun.com>
6039         * NEWS: Document how chown's USER.GROUP argument is now parsed.
6041 2004-02-23  Jim Meyering  <jim@meyering.net>
6043         * src/seq.c (usage): Remove stray space after \n in --help output.
6045 2004-02-22  Jim Meyering  <jim@meyering.net>
6047         * src/du.c (usage): Separate -H and --si.  Say that the meaning
6048         of -H will soon change to that of --dereference-args (-D).
6050 2004-02-21  Jim Meyering  <jim@meyering.net>
6052         * src/comm.c (usage): Tell what comm does when there are no options.
6053         Reword in terms of FILE1 and FILE2 rather than `left file' and
6054         `right file'.  Suggestion from Dan Jacobson.
6056 2004-02-15  Paul Eggert  <eggert@twinsun.com>
6058         Fix some POSIX-conformance bugs in expr.
6060         * NEWS: document the following changes to src/expr.c.
6061         * doc/coreutils.texi (expr invocation): Likewise.
6062         Document what forms integers may take, and say "integer"
6063         consistently instead of "number".  Warn about operands
6064         that "expr" can misinterpret, and how to work around the
6065         problem.
6066         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
6067         Accept a bool argument specifying whether to evaluate the
6068         expression.  This is to allow short-circuit evaluation.  All
6069         callers changed.
6070         (null): Report that a string is zero even if it has
6071         a form like "-0" or "00".
6072         (eval1, eval): Use short-circuit evaluation for | and &.
6073         (eval): Return 0 if both arguments are null or zero, instead
6074         of returning the first argument.
6075         * tests/expr/basic: Add some tests for the above.
6077 2004-02-17  Jim Meyering  <jim@meyering.net>
6079         * Version 5.2.0.
6081         `make check' from a build inside a chroot environment would fail
6082         * tests/help-version: Specify an argument (`/') for df, in the
6083         unusual event that there is no valid entry in /etc/mtab.
6084         Likewise for id: add the -u option, so we don't get spurious
6085         failures when there are no user or group names.
6086         Patch by Tim Waugh.
6088         * src/sort.c (usage) [-u]: Add punctuation so that the description in
6089         the help2man-generated (line-joined) man page is more readable.
6090         Reported by Tim Waugh.
6091         [-T]: Add a semicolon, for the same reason.
6093 2004-02-15  Jim Meyering  <jim@meyering.net>
6095         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
6097 2004-02-11  Jim Meyering  <jim@meyering.net>
6099         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
6100         $(srcdir)/../Makefile.am.in, rather than $<.
6101         Suggestion from Michael Elizabeth Chastain.
6103 2004-02-10  Jim Meyering  <jim@meyering.net>
6105         * config/install-sh: Make this script executable.
6106         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
6107         is executable.  Otherwise, on systems that lack a suitable install
6108         binary, `make install' would fail, because of the way this script
6109         is invoked (without `$SHELL ' prefix).
6110         Reported by Bob Proulx.
6112 2004-02-08  Jim Meyering  <jim@meyering.net>
6114         * Version 5.1.3.
6116         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
6117         that would cause an unwarranted test failure.
6118         * tests/rm/rm3: Likewise.
6120 2004-02-07  Jim Meyering  <jim@meyering.net>
6122         Remove xstat function pointer member.  The way it was used was not
6123         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
6124         inline `stat' and `lstat' functions, thus making the tests of
6125         `xstat == lstat' in copy.c always fail.
6126         * src/copy.h (struct cp_options) [xstat]: Remove member.
6127         (XSTAT): New macro.
6128         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
6129         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
6130         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
6131         (valid_options): Remove now-obsolete FIXME comments.
6133         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
6134         `*(x->xstat) (...)'.
6135         (do_copy): Declare/use local xstat rather than x->xstat.
6136         (main): Remove code that set x.xstat.
6137         * src/mv.c (cp_option_init): Don't initialize xstat member.
6138         * src/install.c (cp_option_init): Likewise.
6140         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
6141         so that emit_upload_commands can use these variables, too.
6143 2004-02-06  Jim Meyering  <jim@meyering.net>
6145         * tests/rm/deep-1: Remove `du' stack space test.
6146         Apparently, `ulimit -s N' isn't portable enough.
6147         This test will be restored (with a guard against losing ulimit)
6148         in its own file later.
6150         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
6151         since this test doesn't take long enough to merit them.
6152         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
6154         * Makefile.maint (signatures): Remove definition.
6155         Now, automake's gnupload handles this.
6156         (%.sig: %): Remove now-unused rule.
6157         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
6158         `$(distdir).tar.bz2 $(distdir).tar.gz'.
6159         (emit-upload-commands): Adjust to use gnupload.
6161 2004-02-05  Jim Meyering  <jim@meyering.net>
6163         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
6164         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
6165         Now, those are all defined in timespec.h.
6166         Include timespec.h.
6168         * src/date.c: Don't include timespec.h, now that system.h does it.
6170 2004-02-02  Paul Eggert  <eggert@twinsun.com>
6172         Don't dump core if localtime returns NULL (possible on
6173         hosts with 64-bit time_t and 32-bit int).
6174         * src/date.c: Include "inttostr.h".
6175         (batch_convert, main):
6176         If time conversion fails, exit with nonzero status.
6177         (show_date): Return int to report conversion failure.
6178         Print the time as an int if localtime fails.
6179         * src/uptime.c: Print "??" if the current clock can't
6180         be converted by localtime.  This won't happen until the year
6181         2*31 + 1900, but we don't want to dump core even if the current
6182         clock has the wrong value.
6184         * src/stat.c: Include "inttostr.h".
6185         (human_time): Print the date/time as a number of seconds since the
6186         epoch if it can't be converted by localtime.  This is better than
6187         just saying "invalid", and is consistent with what "ls" does.
6188         Don't dump core if the year has more than 48 digits; this isn't
6189         possible on any contemporary host, but we might as well do it right.
6191 2004-01-31  Paul Eggert  <eggert@twinsun.com>
6193         * src/stat.c (human_time): Accept time rather than
6194         pointer-to-const-time parameter, for clarity.  All callers changed.
6196 2004-02-02  Jim Meyering  <jim@meyering.net>
6198         * src/stat.c (do_stat): Remove extra trailing newline from
6199         default formats.  Reported by Nelson H. F. Beebe.
6201         Print actual fractional seconds in time stamps, not just `.00000000'.
6202         * src/stat.c (human_time): Add and use new parameter, t_ns.
6203         (print_stat): Update callers.
6204         * src/ls.c (TIMESPEC_NS): Remove definition.
6205         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
6206         also uses this macro.
6207         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
6208         fractional seconds for files on an XFS file system, but that stat's
6209         fractional seconds were always zero.
6211 2004-01-28  Paul Eggert  <eggert@twinsun.com>
6213         * src/seq.c (print_numbers): Use 'double' for loop index, not
6214         'int', to avoid problems with integer overflow.  On almost all
6215         machines 'double' works in every case where 'int' works, and
6216         it works on other cases besides.
6218 2004-01-27  Jim Meyering  <jim@meyering.net>
6220         * src/seq.c (usage): Mention that if INCREMENT is omitted,
6221         it defaults to 1, even when FIRST is larger than LAST.
6222         Reword so as not to exclude the possibility that INCREMENT be zero.
6224 2004-01-25  Jim Meyering  <jim@meyering.net>
6226         * Version 5.1.2.
6228         * Makefile.maint (signatures): Comment out definition.
6230 2004-01-23  Jim Meyering  <jim@meyering.net>
6232         * Makefile.maint (header_regexp): Add exitfail.
6234         * man/Makefile.am (EXTRA_DIST): Add help2man.
6235         Reported by Nelson H. F. Beebe.
6237         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
6238         so it works on systems with Perl installed somewhere other than in
6239         /usr/bin.
6241         * src/paste.c (paste_parallel): Declare local, chr, to be of type
6242         `int', not `char', since it must hold EOF.  This bug would make
6243         paste infloop on some systems.  Test failures reported by
6244         Nelson H. F. Beebe and Christian Krackowizer.
6246 2004-01-22  Jim Meyering  <jim@meyering.net>
6248         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
6249         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
6251         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
6252         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
6253         Use --info-page='coreutils PROG' option.
6254         Now, readlink.1 refers the user to `info coreutils readlink'
6255         rather than to `info readlink'.  Reported by Matt Swift.
6257 2004-01-21  Paul Eggert  <eggert@twinsun.com>
6259         Exit status cleanup.
6261         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
6262         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
6263         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
6264         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
6265         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
6266         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
6267         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
6268         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
6269         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
6270         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
6271         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
6272         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
6273         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
6274         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
6275         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
6276         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
6277         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
6279         * src/cat.c (usage): Don't bother normalizing exit status
6280         since the arg is already the correct exit status now.
6281         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
6282         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
6283         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
6284         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
6285         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
6287         * src/chown.c (main): Removed unused local 'fail'.
6289         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
6290         Remove.
6292         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
6293         * src/env.c, src/nice.c, src/su.c: Likewise.
6294         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
6295         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
6296         * src/expr.c (main): Use initialize_exit_failure rather than
6297         setting exit_failure directly; this optimizes away redundant
6298         assignments.
6299         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
6301         * src/chroot.c (main): Exit with status 1 rather than 127
6302         if chroot itself fails, as per documentation.
6304         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
6305         rather than roll-your-own symbols or integers.
6306         * src/env.c (main): Likewise.
6307         * src/nohup.c (main): Likewise.
6308         * src/su.c (run_shell): Likewise.
6310         * src/cp.c (exit_status): Remove static var....
6311         (main): Making it local here instead.  Use =, not |=, to set it.
6313         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
6314         not 2, on errors.
6315         * src/date.c (batch_convert, main): Likewise.
6316         * src/dd.c (dd_copy): Likewise.
6317         * src/pr.c (first_last_page, main, getoptarg): Likewise.
6318         * src/tr.c (main): Likewise.
6319         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
6320         POSIX doesn't require it.
6321         * src/dd.c (write_output, skip, dd_copy): Likewise.
6322         * src/df.c (main): Likewise.
6323         * src/id.c (main): Likewise.
6324         * src/install.c (main): Likewise.
6325         * src/ln.c (main): Likewise.
6326         * src/ls.c (main): Likewise.
6327         * src/mv.c (main): Likewise.
6328         * src/shred.c (main): Likewise.
6330         * src/env.c (main): Exit with status 1, not 2, on errors detected
6331         by env proper.
6332         * src/hostname.c (main): Likewise.
6333         * src/nl.c (main): Likewise.
6334         * src/stty.c (main): Likewise.
6336         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
6337         consistency with the other programs' naming conventions.
6338         All uses changed.
6340         * src/factor.c (main): Do not report a usage error simply
6341         because stdin has bad numbers.
6343         * src/id.c (problems): Now a boolean int, not a counter,
6344         so that we don't have to worry about int overflow.  All uses changed.
6345         * src/touch.c (err): Likewise.
6347         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
6349         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
6350         * src/mknod.c: Likewise.
6352         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
6353         on error; this is in case EXIT_FAILURE is unusual.
6354         * src/su.c (main): Likewise.
6356         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
6357         changed to EXIT_CANNOT_INVOKE.
6359         * src/printenv.c (PRINTENV_FAILURE): New constant.
6360         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
6361         command-line syntax problems.
6363         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
6364         (main): Avoid integer overflow when seeing whether errors occurred.
6366         * src/seq.c (print_numbers): Now returns void, not (zero) int.
6367         All callers changed.
6368         (main): Remove unused local variable 'errs'.  Always exit successfully
6369         if we reach the end.
6371         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
6372         for consistency with other programs here.  All uses changed.
6373         (main): Use 'error' to exit rather than invoking 'exit' here.
6375         * src/sort.c: Don't include <assert.h>.
6376         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
6377         (usage): Don't use 'assert'.
6378         (main): Remove redundant assignment to exit_failure.
6380         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
6381         New enum values.
6382         (initialize_exit_failure): New inline function.
6383         Include exitfail.h here, since we refer to exit_failure.
6384         All callers changed to not include exitfail.h.
6386         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
6387         substitute them for the corresponding integer constants.
6389         * tests/help-version (expected_failure_status_date): Remove, as
6390         'date' is now normal.
6391         (expected_failure_status_nohup): New var.
6393 2004-01-21  Jim Meyering  <jim@meyering.net>
6395         * tests/touch/relative: Remove `command' syntax.
6396         Thanks to Nelson H. F. Beebe and Paul Eggert.
6398         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
6399         so as to avoid problems with systems using TAI clocks.
6400         Although it's no longer necessary, set TZ=UTC0 also for the
6401         initial touch command.  Reported by Paul Jarc here:
6402         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
6404 2004-01-20  Diego Biurrun  <diego@biurrun.de>
6406         * src/dircolors.hin: Add .mov to the list of media files.
6408 2004-01-19  Paul Eggert  <eggert@twinsun.com>
6410         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
6411         portable).  Problem reported by Christian Krackowizer.  Also, use
6412         +0000 rather than +0 to specify a time zone, as the documentation
6413         requires four digits.
6415 2004-01-19  Jim Meyering  <jim@meyering.net>
6417         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
6418         * tests/mv/backup-is-src: Likewise.
6419         Problem reported by Peter Horst
6421 2004-01-17  Jim Meyering  <jim@meyering.net>
6423         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
6425         * Version 5.1.1.
6427 2003-12-15  Paul Eggert  <eggert@twinsun.com>
6429         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
6430         with -r specifying the origin for -d.
6431         * src/touch.c (flexible_date): Remove static var.
6432         (get_reldate): New function.
6433         (main): Use it, to implement this new behavior.
6435 2004-01-16  Jim Meyering  <jim@meyering.net>
6437         * tests/touch/relative: New test for the above.
6438         * tests/touch/Makefile.am (TESTS): Add relative.
6440 2004-01-13  Jim Meyering  <jim@meyering.net>
6442         * src/system.h: Include contents of sys2.h.
6443         * src/sys2.h: Remove file.
6444         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
6446         * Use automake-1.8.2.  Regenerate dependent files.
6448         * Update to gettext-0.13.1.
6449         * configure.ac: Use gettext-0.13.1.
6450         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
6452 2004-01-12  Jim Meyering  <jim@meyering.net>
6454         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
6456         * Makefile.maint (po-check): Ensure that cvsu works before using it.
6457         Reported by Alexandre Duret-Lutz.
6459         * src/tail.c (main): Warn about following stdin only when it's a tty.
6461         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
6463 2004-01-10  Jim Meyering  <jim@meyering.net>
6465         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
6467 2004-01-09  Jim Meyering  <jim@meyering.net>
6469         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
6471 2004-01-08  Jim Meyering  <jim@meyering.net>
6473         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
6474         From Andreas Schwab.
6476         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
6477         remnant) from PATH component.  That would cause tests in this directory
6478         not to run the just-built binaries, but rather whatever happened
6479         to be in one's PATH.  Reported by Christian Krackowizer.
6481 2004-01-04  Jim Meyering  <jim@meyering.net>
6483         * src/csplit.c (new_control_record): Use x2nrealloc
6484         rather than xrealloc.
6486         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
6487         alloca and strcpy.
6488         (make_path_private): Likewise.
6490 2004-01-03  Jim Meyering  <jim@meyering.net>
6492         * src/paste.c: Use `bool' (not int) as the type for a few
6493         global variables.
6494         (collapse_escapes): Rewrite to set globals rather than modifying
6495         its parameter.
6496         Use size_t (not int) for all counters and related index variables.
6497         (paste_parallel): Remove needless complexity of
6498         using xrealloc in the loop;  just allocate the buffers up front.
6499         Free the two temporary buffers.
6500         Move declarations of locals `down' into scope where used.
6501         (paste_serial): Remove `register' attributes.
6502         (main): Simplify delim-related code.
6503         Free `delims', now that it's malloc'd.
6505 2004-01-02  Jim Meyering  <jim@meyering.net>
6507         * src/chroot.c: Include "quote.h".
6508         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
6509         (main): Exit with status of 127, not 1, for too-few-args,
6510         chroot failure, or chdir failure.
6511         Give a better diagnostic upon execvp failure.
6513         * src/du.c (usage): Mention that, with its current meaning,
6514         -H is deprecated.
6516         * src/tail.c (main): Warn about following stdin when it's a tty.
6517         Fail when following by name but no names are specified.
6519 2003-12-30  Jim Meyering  <jim@meyering.net>
6521         * src/fold.c (main): Use memcpy, not strcpy.
6523         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
6524         alloca and strcpy.
6526 2003-12-28  Jim Meyering  <jim@meyering.net>
6528         * src/unexpand.c (n_tabs_allocated): New global.
6529         (add_tabstop): Use x2nrealloc rather than xrealloc.
6530         * src/expand.c: Likewise.
6532         * tests/misc/expand: New file.
6533         * tests/misc/Makefile.am (TESTS): Add expand.
6535         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
6536         (fillbuf): Use x2nrealloc rather than xrealloc.
6537         (sort): Use xnmalloc rather than xmalloc.
6538         (main): Likewise.
6540 2003-12-27  Jim Meyering  <jim@meyering.net>
6542         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
6544 2003-12-29  Paul Eggert  <eggert@twinsun.com>
6546         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
6547         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
6549         * doc/coreutils.texi (join invocation): Remove documentation
6550         accordingly.  Document that -t makes all separators significant.
6552         * src/join.c: Include posixver.h.
6553         (obsolete_usage): New var.
6554         (longopts): Put obsolete options first.
6555         (OBSOLETE_LONG_OPTIONS): New constant.
6556         (get_option, add_file_name): New functions.
6557         (main): Use them to support new behavior.
6558         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
6559         Do not mark -j FIELD as obsolescent; it is longstanding
6560         UNIX tradition and is a valid extension to POSIX.
6562         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
6564 2003-12-28  Paul Eggert  <eggert@twinsun.com>
6566         * src/join.c (add_field_list): Don't use alloca with unbounded
6567         size; just modify the argument, which is no longer const *.
6569         Various other minor cleanups, mostly to avoid the need for casts.
6571         (extract_field): Renamed from ADD_FIELD, as it's now a function.
6573         (struct field.beg): Now char *, not unsigned char const *.  All
6574         uses changed.  It shouldn't be const since xmemcoll writes on its
6575         arguments.
6576         (extract_field): Likewise, for 2nd arg.
6577         (keycmp): Remove now-unnecessary cast of xmemcoll args.
6579         (is_blank): New function, to avoid need to cast arg to unsigned char.
6580         (extract_field): Use it.
6582         (xfields): Rewrite pretty much from scratch.
6584         (hard_LC_COLLATE): Now bool, not int.
6585         (get_line, getseq, add_field_list): Now returns bool, not int.
6586         (decode_field_spec, add_field_list): Return true on success (not
6587         false), for consistency with the rest of the code.  All uses changed.
6589         (tab): Now char, not unsigned char.  This wasn't 100% necessary
6590         but is slightly cleaner.
6591         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
6593         (empty_filler): Now const *.
6595         (make_blank): Remove; wasn't needed.  Remove all calls.
6596         (main): Don't set uni_blank.nfields; zero is fine.
6598 2003-12-27  Jim Meyering  <jim@meyering.net>
6600         * src/join.c: Include "quote.h".
6601         (min, max): Remove definitions.
6602         Make a few function parameters and corresponding
6603         locals `const'.  Use bool for boolean variables.
6604         Use size_t (not int) for all counters and related index variables.
6605         (prjoin): Remove now-useless assertion.
6606         (string_to_join_field): New function.
6607         (main): Accept join fields as large as SIZE_MAX.
6608         (keycmp): Rename `min' to MIN and max to MAX.
6610 2003-12-26  Jim Meyering  <jim@meyering.net>
6612         fold -s didn't work on e.g., alpha-based systems.
6613         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
6614         x2nrealloc works properly on systems with differing sizes for int
6615         and size_t.  Reported by Nelson Beebe.
6617         * src/fold.c: Use `bool' (not int) as the type for a few
6618         global variables.
6620 2003-12-23  Paul Eggert  <eggert@twinsun.com>
6622         * src/ls.c (length_of_file_names_and_frills):
6623         Remove forward decl; not needed.
6624         (print_file_name_and_frills, length_of_file_name_and_frills):
6625         With -m, don't output spaces before inum or size.
6626         (print_with_commas): Don't output space just before newline.
6628 2003-12-24  Jim Meyering  <jim@meyering.net>
6630         * tests/ls/Makefile.am (TESTS): Add m-option.
6631         * tests/ls/m-option: New file.  Test for above fixes.
6633 2003-12-20  Jim Meyering  <jim@meyering.net>
6635         * Version 5.1.0.
6637         * src/pr.c: Change type of global, buff_allocated, to size_t.
6639         * src/join.c [struct seq]: Change types of members count and alloc
6640         from `int' to `size_t'.
6642         * tests/Makefile.am (root-hint): Tweak wording.
6644         * src/du.c: Accept new option (-0, --null) that makes it so each
6645         output line is NUL-terminated rather than newline-terminated.
6647         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
6648         Reported by Volker Paul.
6649         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
6650         * tests/dd/unblock-sync: New test for the above.
6652 2003-12-19  Jim Meyering  <jim@meyering.net>
6654         * tests/misc/nohup: Double quote back-ticked expression,
6655         in case it ends up having an unexpected value.
6657         * tests/ls/no-arg: Use ls's -1 option in both runs.
6659         * src/du.c (fts_debug): New global.
6660         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
6661         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
6662         (main) [DU_DEBUG]: Accept -d option.
6664 2003-12-18  Jim Meyering  <jim@meyering.net>
6666         * src/ls.c (format_user): Increment dired_pos via two statements,
6667         `dired_pos += width; dired_pos++;' rather than one,
6668         `dired_pos += width + 1;' since the latter could conceivably overflow.
6669         (format_group): Likewise.
6670         From Paul Eggert.
6672         * configure.ac: Require automake-1.8.
6674 2003-12-12  Jim Meyering  <jim@meyering.net>
6676         * Use automake-1.8.  Regenerate dependent files.
6678 2003-12-08  Jim Meyering  <jim@meyering.net>
6680         * Makefile.maint (news-date-check): New rule.
6681         (alpha beta major): Depend on it.
6683 2003-12-03  Paul Eggert  <eggert@twinsun.com>
6685         * NEWS: ls -l (and similar options) now adjust all columns to
6686         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
6687         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
6688         (format_user_width, format_group_width, unsigned_file_size,
6689         format_group): New functions.
6690         (block_size_width): Renamed from block_size_size.
6691         (inode_number_width, nlink_width, owner_width, group_width,
6692         author_width, major_device_number_width, minor_device_number_width,
6693         file_size_width): New vars.
6694         (clear_files): Initialize them.
6695         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
6696         (print_long_file): Use them.
6697         (gobble_file): Use a new local variable 'f' to make the code
6698         smaller and more consistent with other functions.
6699         (format_user): Output to stdout, not to a buffer, so that we
6700         don't have to worry about buffer overrun.  Update dired_pos.
6701         (print_long_file): Don't put owner, group, author into buffer;
6702         just print them directly.  Don't assume link counts and
6703         major and minor numbers fit into unsigned long int.
6704         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
6705         'ls' output is fixed-width.
6707 2003-12-02  Jim Meyering  <jim@meyering.net>
6709         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
6711 2003-11-27  Jim Meyering  <jim@meyering.net>
6713         * Use automake-1.7f.  Regenerate dependent files.
6715 2003-11-24  Paul Eggert  <eggert@twinsun.com>
6717         Parse floating-point operands and options in the C locale.
6718         POSIX requires this for printf, and we might as well be
6719         consistent elsewhere (tail, sleep, seq).
6721         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
6722         needed now that we assume C89.  Include "c-strtod.h".
6723         (xstrtod): Call c_strtod, not strtod.
6724         * src/sleep.c: Include "c-strtod.h".
6725         (main): Update xstrtod call to include new argument, c_strtod.
6726         * src/seq.c (scan_double_arg): Likewise.
6727         * src/tail.c (parse_options): Likewise.
6729 2003-11-24  Jim Meyering  <jim@meyering.net>
6731         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
6732         Reported by Mark Conty.
6734 2003-11-22  Jim Meyering  <jim@meyering.net>
6736         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
6737         (sc_system_h_headers): Do this test only if sys2.h exists.
6739 2003-11-20  Jim Meyering  <jim@meyering.net>
6741         * tests/help-version: Ensure that the bug-reporting address is
6742         included in the --help output for every program.
6743         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
6745         * src/ptx.c (usage): Output bug-reporting address.
6746         Reported by Dan Jacobson.
6748 2003-11-19  Jim Meyering  <jim@meyering.net>
6750         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
6751         on the join fields.  Suggestion from Bruce Robertson.
6753 2003-11-18  Jim Meyering  <jim@meyering.net>
6755         `od -c -w9999999' could segfault
6756         * src/od.c (dump): Use xnmalloc/free, not alloca.
6758 2003-11-16  Jim Meyering  <jim@meyering.net>
6760         * Use autoconf-2.59.  Regenerate dependent files.
6762         * tests/du/hard-link: Minor tweak: use mkdir -p.
6764         Fix read-from-free'd-buffer error detected by valgrind.
6765         * src/csplit.c (remove_line): Don't return a pointer to data in
6766         a freed buffer.  Instead, arrange to free the buffer on the
6767         subsequent call.
6769         * tests/misc/csplit: New test for above fix.
6771 2003-11-11  Jim Meyering  <jim@meyering.net>
6773         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
6774         This avoids a warning from valgrind about memcpy with overlapping
6775         source and destination.
6777         * configure.ac: Require automake-1.7.8.
6779 2003-11-09  Jim Meyering  <jim@meyering.net>
6781         * Use automake-1.7.9.  Regenerate dependent files.
6783         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
6784         * src/chown.c: Likewise.
6786         * src/chown-core.c: Include "root-dev-ino.h".
6787         (chopt_init): Initialize new member.
6788         (change_file_owner): Support rm's new --preserve-root option.
6790         * src/remove.c: Include "root-dev-ino.h".
6791         (remove_cwd_entries): Remove now-obsolete FIXME comment.
6792         (remove_dir): Support rm's new --preserve-root option.
6794         * src/chown.c: Include "root-dev-ino.h".
6795         Add new options: --preserve-root and --no-preserve-root.
6797         * src/chmod.c: Include "root-dev-ino.h".
6798         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
6799         ROOT_DEV_INO_WARN macros.
6800         (get_root_dev_ino): Remove function definition, now that it's
6801         been moved to a separate file.
6802         (usage): Describe new options.
6804         * src/mv.c (rm_option_init): Initialized new member.
6806         * src/remove.h: Include "dev-ino.h".
6807         (struct rm_options): Add new member: root_dev_ino.
6808         * src/chown-core.h: Include "dev-ino.h".
6809         (struct Chown_option): Add new member: root_dev_ino.
6811 2003-11-06  Jim Meyering  <jim@meyering.net>
6813         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
6814         hard-coding `sizeof FILE*'.
6816 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
6818         * src/wc.c (main): Free `fstatus' so there is no confusion about
6819         whether it's leaked or not.
6820         * src/who.c (who): Likewise for `utmp_buf'.
6822 2003-11-05  Paul Eggert  <eggert@twinsun.com>
6824         Fix 'cut' problems with size_t overflow and unsigned int.
6825         More generally, resize integer variables to fit use more precisely.
6826         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
6827         (struct range_pair): Make members to be of type size_t, not unsigned.
6828         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
6829         (suppress_non_delimited, output_delimiter_specified,
6830         have_read_stdin, print_kth, set_fields): Now bool, nt int.
6831         (delim): Now unsigned char, not int.
6832         (mark_printable_field, is_printable_field, is_range_start_index,
6833         set_fields, set_fields, cut_bytes, cut_fields):
6834         Use size_t, not unsigned, for field and byte counts.
6835         (hash_int): Use uintptr_t, not unsigned, for pointers converted
6836         to integers.  This squeezes more info out of them.
6837         (set_fields, cut_bytes, cut_fields, main):
6838         Use bool, not int, for booleans.
6839         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
6841 2003-11-05  Paul Eggert  <eggert@twinsun.com>
6843         * man/Makefile.am (check-programs-vs-x):
6844         Work even if $(programs) contains '$'.
6845         Work even if 'missing=1' in environment.
6846         Don't report an error simply because $(programs) outputs nothing.
6848 2003-11-05  Jim Meyering  <jim@meyering.net>
6850         * Use autoconf-2.58.  Regenerate dependent files.
6852         * src/tr.c (spec_init): Fix typo in last change.
6854         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
6855         call to variadic version_etc function, so that it works even on systems
6856         for which sizeof char* != sizeof int.
6857         * src/true.c (main): Likewise.
6858         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
6859         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
6860         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
6861         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
6862         Similarly, cast NULL to `(char *)' in call to variadic function,
6863         parse_long_options, so that it works even on systems for which
6864         sizeof char* != sizeof int.
6865         A similar problem was reported by Harti Brandt in
6866         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
6868         * src/users.c (users): Free `utmp_buf' explicitly so that people
6869         don't mistake this for a real leak.
6870         Patch by Dennis Smit <ds@nerds-incorporated.org.
6872 2003-11-04  Paul Eggert  <eggert@twinsun.com>
6874         * README: Document _POSIX2_VERSION.
6876 2003-11-04  Jim Meyering  <jim@meyering.net>
6878         * src/tac.c (memrchr): Remove #if-0'd function.
6879         (tac_stdin_to_mem): Clean up #if-0'd code.
6881         * src/od.c (decode_format_string): Remove unnecessary casts.
6882         Use more maintainable `sizeof *var'.
6883         (main): Call decode_format_string rather than decode_one_format,
6884         now that `spec' may be NULL.
6886         * src/chmod.c (AUTHORS): Add my name.
6888         * src/split.c (next_file_name): Use `sizeof *var' rather than
6889         hard-coding `sizeof size_t'.
6891         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
6893         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
6894         to avoid potential overflow in pointer arithmetic.
6895         (set_fields): Use not `1', but rather `sizeof *printable_field' as
6896         second argument to xcalloc.
6897         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
6898         rather than xrealloc.
6899         * src/date.c (show_date): Likewise.
6900         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
6901         * src/pr.c (store_char): Likewise.
6902         * src/fold.c (fold_file): Likewise.
6904         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6905         type changes (unsigned int -> size_t) in hash.c.
6906         * src/cp-hash.c (src_to_dest_hash): Likewise.
6907         * src/du.c (entry_hash): Likewise.
6908         * src/ls.c (dev_ino_hash): Likewise.
6909         * src/cut.c (hash_int): Likewise.  Declare function as static.
6911 2003-11-03  Jim Meyering  <jim@meyering.net>
6913         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6914         * tests/misc/fold: Fail the test immediately if we're not running
6915         the expected version of fold.
6917 2003-11-02  Jim Meyering  <jim@meyering.net>
6919         * src/tr.c (append_normal_char, append_range, append_char_class)
6920         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
6921         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
6922         and usually shorter.
6923         * src/copy.c (copy_internal): Likewise.
6924         * src/join.c (initseq, add_field, make_blank): Likewise.
6925         * src/od.c (main): Likewise.
6926         * src/cp.c (make_path_private): Likewise.
6927         * src/tsort.c (new_item, record_relation): Likewise.
6929         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
6930         (main): Also remove anachronistic cast of xmalloc return value.
6931         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
6932         (main): Also remove anachronistic cast of xmalloc return value.
6933         * src/sort.c (inittables): Likewise.
6934         (sort): Also Split a long line.
6936 2003-10-25  Jim Meyering  <jim@meyering.net>
6938         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6939         type changes (unsigned int -> size_t) in hash.c.
6940         * src/cp-hash.c (src_to_dest_hash): Likewise.
6941         * src/du.c (entry_hash): Likewise.
6942         * src/ls.c (dev_ino_hash): Likewise.
6943         * src/cut.c (hash_int): Likewise.  Declare function as static.
6945 2003-10-21  Jim Meyering  <jim@meyering.net>
6947         Don't fail when run with VERBOSE=yes.
6948         * tests/chgrp/basic: Do `set +x' before starting the subshell
6949         from which we invoke chgrp.  Otherwise, the output from the
6950         VERBOSE=yes-induced `set -x' would result in spurious differences.
6951         Reported by Russel Coker via Michael Stone.
6953 2003-10-19  Jim Meyering  <jim@meyering.net>
6955         chmod now uses fts to perform a directory traversal when -R is
6956         specified.  Before, it operated on full path names, and as such
6957         would encounter the PATH_MAX (often 4096) limit.
6959         * src/chmod.c: Include "xfts.h".
6960         (process_file): Rename from change_file_mode.
6961         Adapt to be used with fts.
6962         (process_files): New function.
6964 2003-10-18  Jim Meyering  <jim@meyering.net>
6966         * tests/du/deref-args: Ensure that du -D now dereferences all
6967         symlinks specified on the command line, not just those that
6968         reference directories.
6970         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6971         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6972         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6973         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6974         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6975         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6976         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6977         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
6978         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
6979         Update the call to parse_long_options so that `AUTHORS, NULL' are the
6980         last parameters.
6981         * src/true.c (main): Append NULL to version_etc argument list.
6982         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6984 2003-10-17  Andreas Schwab  <schwab@suse.de>
6986         * tests/mk-script: Get $srcdir from first parameter instead of
6987         hardcoding it.
6988         (main): Update usage.
6990         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
6991         first argument of mk-script.
6992         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
6994 2003-10-17  Jim Meyering  <jim@meyering.net>
6996         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
6997         generated `man' page is more readable.  Suggestion from Dan Jacobson.
6999         * src/chown-core.c (change_file_owner): Handle the cases in
7000         which fts_info indicates an error with the given entry.
7002         * src/du.c (main): Simply assign to bit_flags.
7003         Don't bother with bit arithmetic.
7005         * tests/chmod/no-x: New file.
7006         * tests/chgrp/no-x: New file.
7007         * tests/chmod/Makefile.am (TESTS): Add no-x.
7008         * tests/chgrp/Makefile.am (TESTS): Likewise.
7010         * src/du.c: Include "xfts.h".
7011         (du_files): Use xfts_open, rather than fts_open.
7012         * src/chown-core.c (chown_files): Likewise.
7014 2003-10-16  Jim Meyering  <jim@meyering.net>
7016         * src/chgrp.c (main): Simply assign to bit_flags.
7017         Don't bother with bit arithmetic.
7018         * src/chown.c (main): Likewise.
7019         Rename a couple of local variables.
7020         Remove unnecessary casts.
7022         * src/tail.c (start_bytes): Rename local, remainder, to avoid
7023         gcc's warning about shadowing a global.
7025 2003-10-15  Jim Meyering  <jim@meyering.net>
7027         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
7028         use fts to perform a directory traversal when -R is specified.
7029         Before, they operated on full path names, and as such would
7030         encounter the PATH_MAX (often 4096) limit.
7031         They are more efficient.  For example, before, chgrp -R would
7032         take almost 5 seconds to change about 2000 directories and fail
7033         (with `File name too long'), while now it succeeds on a hierarchy
7034         of depth 20,000 in 1/10 the time.
7036         * src/chown.c: Include "userspec.h" and "fts_.h".
7037         (WRITTEN_BY): Add my name.
7038         (getpwnam, getgrnam, getgrgid): Remove declarations.
7039         (endpwent): Remove definition.
7040         (usage): Update.
7041         (main): Handle new options.
7042         Call new function, chown_files rather than change_file_owner.
7044         * src/chgrp.c: Include "fts_.h".
7045         (WRITTEN_BY): Add my name.
7046         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
7047         the latter.
7048         (usage): Update.
7049         (main): Handle new options.
7050         Call new function, chown_files rather than change_file_owner.
7052         Rewrite to iterate through hierarchies using fts rather than
7053         via explicit recursion.
7054         * src/chown-core.c: Include "fts_.h"
7055         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
7056         on a single file at a time.
7057         (chown_files): New function.
7058         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
7059         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
7060         [struct Chown_option] (dereference): Remove member with ambiguous name.
7061         [struct Chown_option] (affect_symlink_referent): New member.
7062         (chown_files): New prototype.
7064         * tests/chgrp/recurse: Update tests accordingly.
7065         * tests/chgrp/posix-H: New tests for the above.
7066         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
7068         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
7069         work even for superuser.  Suggestion from Dan Jacobson.
7071 2003-10-14  Paul Eggert  <eggert@twinsun.com>
7073         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
7074         properly diagnosed.
7075         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
7076         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
7077         * src/sort.c (parse_field_count): Handle the case where overflow
7078         and invalid suffix char are both reported.
7080 2003-10-14  Jim Meyering  <jim@meyering.net>
7082         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
7083         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
7084         true on Linux.
7086 2003-10-13  Paul Eggert  <eggert@twinsun.com>
7088         Fix to avoid a denial-of-service attack if the display width is
7089         enormous.  Also, clean up the code a bit by removing duplicate code.
7091         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
7092         (calculate_columns): New function, that contains code that used
7093         to be common to print_many_per_line and print_horizontal.
7094         (print_many_per_line, print_horizontal): Use it.
7095         (decode_switches): Set max_idx here, not in calculate_columns.
7096         (print_current_files): Don't call init_column_info; calculate_columns
7097         now does that.
7098         (init_column_info): Don't allocate a lot more space than is needed
7099         to represent the current set of files.  Allocate all the new
7100         size_t cells in one call to xnmalloc, rather than a row at a time.
7102 2003-10-13  Jim Meyering  <jim@meyering.net>
7104         * src/ls.c (init_column_info): Add another FIXME comment.
7106 2003-10-13  Paul Eggert  <eggert@twinsun.com>
7108         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
7109         Remove several arbitrary limits on hosts where int cannot represent
7110         all size_t values.
7112         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
7113         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
7114         struct column_info.col_arr[0], max_idx):
7115         Now size_t, not int.
7116         (get_funky_string): Return bool indicating success, instead of
7117         a negative count to indicate failure.  Store number of columns
7118         through new parameter OUTPUT_COUNT; that way, they can never
7119         go negative.  Change equals_end from int to bool.  All uses
7120         changed.
7121         (struct column_info.valid_len): Now bool, not int.  All uses changed.
7122         (dired_dump_obstack, get_funky_string, clear_files,
7123         extract_dirs_from_files, print_current_files,
7124         print_many_per_line, print_horizontal, init_column_info,
7125         put_indicator, length_of_file_name_and_frills,
7126         print_with_commas): Use size_t, not int, for local variables
7127         that count sizes.
7128         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
7129         Check for TIOCGWINSZ returing negative values (or values greater
7130         than SIZE_MAX!).
7131         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
7132         init_column_info):
7133         Use xmalloc and xnmalloc, not XMALLOC.
7134         (gobble_file): Use xnrealloc, not XREALLOC.
7135         (print_color_indicator): Remove now-unnecessary cast to size_t.
7137 2003-10-12  Paul Eggert  <eggert@twinsun.com>
7139         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
7140         * tests/sort/sort-tests: Remove from CVS; assume that people
7141         brave enough to check coreutils out from CVS can rebuild it.
7143 2003-10-12  Jim Meyering  <jim@meyering.net>
7145         New options: --preserve-root and --no-preserve-root.
7146         * src/chmod.c (change_file_mode): Honor new option.
7147         (change_file_mode): Strip trailing slashes on directory
7148         argument passed to change_dir_mode.
7149         (get_root_dev_ino): New function.
7150         (main): Initialize global, root_dev_ino.
7152         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
7153         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
7154         via system.h.
7155         * src/chmod.c (change_file_mode): Likewise.
7157 2003-10-08  Jim Meyering  <jim@meyering.net>
7159         * src/csplit.c (main): Remove obsolete FIXME.
7161 2003-10-07  Jim Meyering  <jim@meyering.net>
7163         * Use automake-1.7.8.  Regenerate dependent files.
7165 2003-09-29  Paul Eggert  <eggert@twinsun.com>
7167         csplit cleanup.
7169         * doc/coreutils.texi (csplit invocation):
7170         The regexp offset need not have a sign; POSIX requires support
7171         for signless offets.
7173         Be more careful about int widths.  For example, remove some
7174         arbitrary limits by replacing 'unsigned' with 'size_t',
7175         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
7176         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
7177         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
7178         to <stdbool.h> usage.
7179         (struct control): offset is now intmax_t, not int.
7180         repeat_forever is now bool, not int.
7181         (struct cstring): len is now size_t, not unsigned int.
7182         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
7183         size_t, not unsigned.  start_line, first_available are now
7184         uintmax_t, not unsigned.
7185         (hold_count, control_used): Now size_t, not unsigned.
7186         (last_line_number, current_line, bytes_written):
7187         Now uintmax_t, not unsigned.
7188         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
7189         create_new_buffer, get_new_buffer, load_buffer, find_line,
7190         process_regexp, split_file, new_control_record, extract_regexp,
7191         get_format_width, get_format_prec, max_out):
7192         size args, locals, and returned values are now size_t, not unsigned
7193         or int.
7194         (get_first_line_in_buffer, find_line, write_to_file,
7195         handle_line_error, process_line_count, regexp_error, process_regexp,
7196         split_file):
7197         File line, byte, and repetition counts are now uintmax_t, not unsigned.
7198         (check_for_offset): Don't require a sign before the offset.
7199         Use xstrtoimax to do the real work.
7200         (extract_regexp): Remove harmful cast of size to unsigned.
7201         256 -> 1<<CHAR_BIT, for clarity.
7202         (get_format_flags): Return at most 3, to avoid worries about overflow.
7204         (bytes_to_octal_digits): Remove.
7206         (cleanup): Don't check whether output_stream is NULL, since
7207         close_output_file does that for us.
7209         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
7210         (sizeof *p);" instead of the more long-winded alternatives.
7212         (get_new_buffer): Use O(1) algorithm for resizing a buffer
7213         to a much larger size, instead of an O(N) algorithm.
7215         (process_regexp): Use plain NULL rather than casted 0.
7217         (make_filename): Use %u, not %d, to format unsigned file number.
7219         (new_control_record): Use xrealloc exclusively, since it handles
7220         NULL reliably.
7222         (extract_regexp): Change misspelled word in diagnostic.
7224         (get_format_width): Even if a minimum field width is specified,
7225         allow room for enough octal digits to represent the value of
7226         the maximum representible integer.  This fixes a potential
7227         buffer overrun.  Calculate this room at compile-time, not
7228         at run-time; this removes the need for bytes_to_octal_digits.
7229         Check for overflow; this removes a FIXME.
7231         (get_format_prec): Don't allow precision to be signed; it's
7232         not ANSI.  Check for overflow.  Remove hardcoded "11" as
7233         default precision; this fixes a potential buffer overrun
7234         on hosts with wider size_t.
7236         (get_format_conv_type): Change local variable to be of type
7237         unsigned char, not int; this removes a potential subscript
7238         violation on hosts where char is signed.
7240         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
7241         Allow "%%" in format.  Don't overflow when
7242         counting lots of percents.
7244         (usage): Default sprintf format is %02u, not %d.
7246 2003-10-05  Jim Meyering  <jim@meyering.net>
7248         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
7250         * src/du.c (du_files): Mark diagnostic for translation.
7252 2003-10-04  Jim Meyering  <jim@meyering.net>
7254         * src/du.c (du_files): Ignore any failure of fts_close.
7255         Give better diagnostics for failed fts_open.
7257         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
7259         Deprecate existing use of -H (aka --si).
7260         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
7261         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
7262         (main): Warn that the meaning of -H will soon change to be
7263         POSIX compliant.
7265 2003-10-03  Jim Meyering  <jim@meyering.net>
7267         * src/du.c: Accept --no-dereference (-P).
7269 2003-10-02  Jim Meyering  <jim@meyering.net>
7271         * tests/du/trailing-slash: Adjust for slightly different output.
7273         Rewrite du.c to use fts.
7274         * src/du.c: Include "fts_.h", not ftw.h.
7275         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
7276         (IS_FTW_DIR_TYPE): Remove definition.
7277         (IS_DIR_TYPE): Define.
7278         (is_symlink_to_dir): Remove now-unnecessary function.
7279         (process_file, du_files): Rewrite to use fts.
7281         * tests/du/inaccessible-cwd: Ensure that even when run from an
7282         inaccessible directory, du can still operate on accessible
7283         directories elsewhere.
7284         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
7286         * tests/rm/deep-1: Ensure that du can process a hierarchy
7287         of depth 400 while using no more than 50KB of stack space.
7289 2003-10-01  Akim Demaille  <akim@epita.fr>
7291         * announce-gen (print_news_deltas): New function, extracted from main.
7292         (main): Make `news_file' an array.
7293         Use '...=s' => \@var for --news and --url-directory specs.
7294         Before there were a couple of portability problems.
7296 2003-09-28  Jim Meyering  <jim@meyering.net>
7298         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
7299         (syntax-check-rules): Add it.
7301         * src/copy.c: Remove unnecessary cast of alloca, since now it's
7302         guaranteed to be (void *).
7303         * src/cp.c: Likewise.
7304         * src/join.c: Likewise.
7305         * src/ln.c: Likewise.
7306         * src/ls.c: Likewise.
7307         * src/od.c: Likewise.
7308         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
7310 2003-09-27  Jim Meyering  <jim@meyering.net>
7312         Don't exhaust virtual memory when processing large inputs.
7313         Fix this by removing csplit's internal free-list management;
7314         instead rely on malloc for that.
7316         * src/csplit.c (free_list): Remove global.
7317         (clear_all_line_control): Remove function.
7318         (get_new_buffer): Always use create_new_buffer to obtain a
7319         new buffer, rather than searching free_list.
7320         (free_buffer): Just call free.
7321         Reported by Nikola Milutinovic.
7323 2003-09-26  Jim Meyering  <jim@meyering.net>
7325         * man/rm.x: Also list `chattr' in SEE ALSO section.
7326         Suggestion from Mark Hubbart.
7328 2003-09-25  Jim Meyering  <jim@meyering.net>
7330         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
7331         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
7333         * Use autoconf-2.57d.  Regenerate dependent files.
7335 2003-09-24  Jim Meyering  <jim@meyering.net>
7337         Minor efficiency tweak.
7338         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
7339         (do_link): Likewise.
7341 2003-09-23  Jim Meyering  <jim@meyering.net>
7343         * src/paste.c (paste_serial): Save errno after input error,
7344         to report proper errno value.
7345         Based on a patch from Paul Eggert.
7347         * src/tee.c (tee): Adjust fwrite arguments so that the return
7348         value is the number of bytes written.
7350 2003-09-16  Paul Eggert  <eggert@twinsun.com>
7352         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
7354         * src/comm.c (compare_files): Save errno after input error,
7355         to report proper errno value.
7356         * src/fold.c (fold_file): Likewise.
7357         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
7358         * src/unexpand.c (unexpand): Likewise.
7360         * src/csplit.c (close_output_file): Don't report bogus errno value
7361         after ferror discovers an output error.  We don't know the proper
7362         errno value, since it might have been caused by any of a whole
7363         bunch of calls, and it might have been trashed in the meantime.
7364         Fixing this problem will require much more extensive changes;
7365         in the meantime just say "write error".
7366         * src/od.c (check_and_close, dump, dump_strings): Likewise.
7367         * src/uniq.c (check_file): Likewise.
7369         * src/join.c (get_line): Report error right away if I/O fails,
7370         so that the proper errno value is used.
7371         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
7372         * src/tee.c (tee): Likewise.
7373         * src/uniq.c (check_file): Likewise.
7375         * src/od.c (skip): If a read fails, don't retry it later, so
7376         that we report the proper errno.
7378         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
7380         * src/tee.c (tee): Once a write failure has occurred, don't bother
7381         writing anything more to that stream.
7383         * src/uniq.c (check_file): Check for ferror (stdout) even if
7384         ostream == stdout.
7386         * src/yes.c (UNROLL): Remove.
7387         (main): Exit immediately when write failure is detected.
7388         Simplify code by assigning to argv when argc == 1.
7390 2003-09-21  Paul Eggert  <eggert@twinsun.com>
7392         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
7393         (WRITTEN_BY): Change "Franc,ois" (actually using
7394         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
7395         xgettext requires.
7397 2003-09-19  Jim Meyering  <jim@meyering.net>
7399         `du -D symlink-to-dir' would mistakenly omit the slash in
7400         lines like this: 24     symlink-to-dir/subdir
7401         * src/du.c (process_file): Fix offset calculation.
7402         Reported by Jeff Sheinberg as Debian bug #211591;
7403         http://bugs.debian.org/205251
7405         * tests/du/deref-args: New file/test for the above.
7406         * tests/du/Makefile.am (TESTS): Add deref-args.
7408         * src/du.c (process_file): Remove useless disjunct.
7410         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
7411         to Written_by.
7412         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
7413         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
7414         Mark each WRITTEN_BY string as translatable.
7416         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
7417         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
7418         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
7419         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
7420         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
7421         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
7422         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
7423         * who.c, whoami.c, yes.c: Revert yesterday's changes.
7424         Instead, a subsequent change will embed `Written by ' in
7425         each string along with the author names.
7427         * src/true.c: Revert yesterday's changes.
7428         * src/sys2.h: Likewise.
7430 2003-09-18  Jim Meyering  <jim@meyering.net>
7432         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
7433         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
7434         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
7435         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
7436         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
7437         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
7438         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
7439         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
7440         comma-separated list of strings and/or update the call to
7441         parse_long_options so that `AUTHORS, NULL' are the last parameters.
7442         * src/true.c (main): Append NULL to version_etc argument list.
7443         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
7445         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
7446         shadowing the math function name.  Also rename loga to log_a.
7448 2003-09-14  Jim Meyering  <jim@meyering.net>
7450         * src/factor.c (print_factors): Give a separate diagnostic
7451         for numbers that are too large, but otherwise valid.
7452         Reported by Dániel Varga.
7454 2003-09-10  Jim Meyering  <jim@meyering.net>
7456         * Use automake-1.7.7.  Regenerate dependent files.
7458         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
7459         of `fmt -1'.  Using the just-built tr is a little cleaner.
7460         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
7461         * man/Makefile.am (programs, check-x-vs-1): Likewise.
7463 2003-09-09  Jim Meyering  <jim@meyering.net>
7465         * src/copy.c: Alphabetize includes.
7466         Remove duplicate inclusion of "same.h".
7468 2003-09-08  Jim Meyering  <jim@meyering.net>
7470         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
7471         Didn't give enough of a benefit, mainly because it's not yet
7472         in wide enough use.
7474         * Version 5.0.91.
7476         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
7477         (check-programs-vs-x): Fail if $(programs) is empty.
7479         * src/remove.c: Add a comment.
7481 2003-09-07  Jim Meyering  <jim@meyering.net>
7483         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
7484         Don't define.  These symbols are no longer used.
7486         * tests/misc/tty-eof: Write ^D as \cD.
7487         Complete the change of 2003-08-02.
7489         * Makefile.maint (po-check): Use cvsu, so that a temporary source
7490         file in lib/ or src/ doesn't induce an unwarranted failure.
7491         Add a kludge to filter out the sole generated source file that
7492         also has translatable messages: src/false.c.
7494 2003-09-06  Jim Meyering  <jim@meyering.net>
7496         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
7497         (parse_options): Give a diagnostic for (but still accept) the
7498         deprecated --allow-missing option.
7500 2003-09-04  Paul Eggert  <eggert@twinsun.com>
7502         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
7503         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
7505         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
7506         size_bound ourselves. if an input file is a pipe and the user
7507         specified a size, use that size instead of trying to guess the
7508         pipe size.  This has the beneficial side effect of avoiding the
7509         overhead of default_sort_size in that case.  All callers changed.
7510         (sort): Remove static var size; now done by sort_buffer_size.
7512 2003-09-05  Jim Meyering  <jim@meyering.net>
7514         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
7516         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
7517         to start, rather than just .1.  Upon failure, print unexpected state.
7519 2003-09-04  Paul Eggert  <eggert@twinsun.com>
7521         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
7522         SAFE_READ_ERROR to tmp->nbytes.
7523         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
7525         * src/head.c (struct linebuffer): Change nbytes and nlines
7526         from unsigned int to size_t.  unsigned int is safe (after the
7527         2003-09-03 patch) but size_t is cleaner.
7528         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
7529         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
7531         Standardize on BUFSIZ as opposed to other macro names and values.
7532         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
7533         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
7534         stdio.h has always defined it,
7535         and other code already assumes it's defined.
7536         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
7537         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
7538         (io_buf): IO_BUF_SIZE -> BUFSIZ.
7540 2003-09-04  Paul Eggert  <eggert@twinsun.com>
7542         * src/seq.c (step): Default to 1.
7543         (print_numbers): Allow the output to be empty.
7544         (main): The default step is 1, even if LAST < FIRST;
7545         as per documentation.
7546         * tests/seq/basic (onearg-2): Output should be empty.
7548 2003-09-05  Jim Meyering  <jim@meyering.net>
7550         * Makefile.cfg (wget_files): Temporarily disable, until master
7551         versions are restored to ftp.gnu.org.
7553         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
7555         Make seq's --width (-w) option work properly even when the
7556         endpoint requiring the larger width is negative and smaller than
7557         the other endpoint.
7558         * src/seq.c (get_width_format): Include `-' in the set of bytes
7559         allowed in a `simple' number (no decimal point, no exponent).
7560         Reported by Patrick Mauritz.
7562 2003-09-02  Paul Eggert  <eggert@twinsun.com>
7564         * NEWS: sort -t '\0' now uses a NUL tab.
7565         sort option order no longer matters, unless POSIX requires it.
7566         * src/sort.c (usage): Say "blanks" instead of "whitespace",
7567         Similar fixes for many comments.
7568         (TAB_DEFAULT): New constant, so that we can support NUL as
7569         the field separator.
7570         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
7571         (specify_sort_size): If multiple sizes are specified, use the largest.
7572         (begfield, limfield): Support NUL tab char.
7573         (set_ordering): Do not let -i override -d.
7574         (main): Report an error if incompatible -o or -t options are given.
7575         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
7577 2003-09-05  Jim Meyering  <jim@meyering.net>
7579         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
7581 2003-09-03  Andreas Schwab  <schwab@suse.de>
7583         Bug report and patch here:
7584         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
7585         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
7586         * src/head.c (elide_tail_lines_pipe): Likewise.
7588 2003-09-03  Jim Meyering  <jim@meyering.net>
7590         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
7591         small amount of code from him was first moved to lib/human.c, and was
7592         subsequently rewritten entirely.
7593         * src/df.c (AUTHORS): Likewise.
7595 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
7597         * src/md5sum.c (split_3): Accept the BSD format for generic
7598         message digest modes.  Currently works with BSD's MD5 and SHA1
7599         formats since these are the two algorithms presently used in
7600         coreutils.  Updated comments to reflect this change.
7601         (bsd_split_3): Updated comments.
7603         * tests/md5sum/basic-1: New test to make sure that
7604         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
7605         from `check-bsd' test in tests/sha1sum/basic-1).
7607         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
7608         --check exit status and BSD SHA1 format (adapted from tests
7609         in tests/md5sum/basic-1).
7611 2003-08-30  Jim Meyering  <jim@meyering.net>
7613         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
7615         When source and destination arguments refer to the same file, reside
7616         on a partition (e.g. VFAT) on which distinct names may refer to the
7617         same directory entry (often due to variations in case), and when the
7618         link count for the file is 1, mv no longer unlinks the file.  Instead,
7619         it gives the expected diagnostic that the source and destination are
7620         the same.  WARNING: this is an incomplete fix.  If the file happens
7621         to have a link count of 2 or greater, such an erroneous mv command
7622         will still unlink it.
7623         Although that is not possible on vfat or umsdos, it is possible on
7624         other file system types, e.g., ntfs, and hpfs.
7625         * src/copy.c (same_file_ok): Invoke same_name (which might still
7626         return false for names that refer to the same directory entry)
7627         only if the link count is 2 or more.
7628         * tests/mv/vfat: Show how to demonstrate the above problem.
7629         This test is not run.
7630         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
7632 2003-08-27  Jim Meyering  <jim@meyering.net>
7634         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
7635         who's -l option has been eliciting an unconditional warning about
7636         this impending change since sh-utils-2.0.12 (April 2002).
7638         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
7639         This would happen for nonempty files not ending with a newline.
7640         Reported by Dan Jacobson.
7641         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
7642         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
7644         * src/stat.c (print_it): Avoid buffer overrun that would
7645         occur when the user-specified format string ends with `%'.
7646         Patch by Tommi Kyntola.
7647         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
7648         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
7650 2003-08-26  Jim Meyering  <jim@meyering.net>
7652         Apply changes from bison.
7653         * GNUmakefile (SHELL): Define to `sh', if necessary.
7654         Add copyright.
7655         * Makefile.maint (WGETFLAGS): Define to `-C off'.
7656         Update all uses of $(WGET).
7658 2003-08-22  Akim Demaille  <akim@epita.fr>
7660         * Makefile.cfg (local-checks-to-skip): New.
7661         * Makefile.maint (local-check): Rename as...
7662         (local-checks-available): this.
7663         (local-check): New.
7665 2003-08-26  Akim Demaille  <akim@epita.fr>
7667         * announce-gen (print_changelog_deltas): Neutralize "<#" as
7668         "<\#" to avoid magic from Gnus when posting parts of this script.
7670 2003-08-25  Jim Meyering  <jim@meyering.net>
7672         * src/stat.c (main): Warn about use of deprecated `-l' option.
7674 2003-08-22  Jim Meyering  <jim@meyering.net>
7676         * src/stat.c (do_stat): For link count at end of line, use %h format,
7677         instead of %-5h.  The latter would make stat emit trailing spaces.
7678         Reported by Dan Jacobson.
7680 2003-08-20  Jim Meyering  <jim@meyering.net>
7682         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
7684 2003-08-19  Jim Meyering  <jim@meyering.net>
7686         * src/system.h: Include stdlib.h unconditionally,
7687         as we're now assuming that part of hosted C89.
7689 2003-08-18  Jim Meyering  <jim@meyering.net>
7691         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
7692         to avoid warnings from gcc.
7694 2003-08-17  Jim Meyering  <jim@meyering.net>
7696         Avoid unnecessary and sometimes time-consuming hostname lookups.
7697         * src/who.c (print_user): Use strchr, not strrchr.
7698         * src/pinky.c (print_entry): Likewise.
7699         Patch by Michael Stone.
7700         This fixes a typo I introduced in who-users.c on 1996-02-23.
7702         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
7703         disallowed between `@...@'.
7705 2003-08-16  Paul Eggert  <eggert@twinsun.com>
7707         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
7708         done by gnulib .m4 files.
7709         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
7710         * src/sys2.h (strtoull): Remove unused declaration.
7712 2003-08-16  Jim Meyering  <jim@meyering.net>
7714         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
7715         are read-only.
7717         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
7718         race condition bug.  The bug would be triggered when tailing a file
7719         with file pointer not at beginning of file, and where the file was
7720         truncated to have a length of less than the initial offset at just
7721         the right moment (between the two lseek calls in this function).
7723         An invalid initial value for *read_pos would result in
7724         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
7725         busy-wait rather than sleeping between iterations.  The bug manifests
7726         itself only when tailing regular files that are initially nonempty.
7727         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
7728         each xlseek call.
7729         (tail_lines): Likewise, after lseek calls.
7730         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
7731         * tests/tail-2/tail-n0f: New file.  Test for above fix.
7732         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
7734 2003-08-15  Jim Meyering  <jim@meyering.net>
7736         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
7737         (sc_sun_os_names): Likewise.
7738         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
7740         * man/help2man: Remove some SPACEs before TAB.
7742 2003-08-14  Paul Eggert  <eggert@twinsun.com>
7744         * Makefile.maint (LC_ALL): Set to C.
7745         * man/Makefile.am (ASSORT): New var.
7746         (check-x-vs-1, programs): Use it.
7747         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
7748         * tests/Makefile.am (ASSORT, all_programs): Likewise.
7750 2003-08-11  Jim Meyering  <jim@meyering.net>
7752         fold -s -wN would infloop for N < 8 with TABs in the input.
7753         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
7754         * src/fold.c (fold_file): Move contents of `else'-block
7755         out of conditional so it's used also for --spaces (-s).
7756         * tests/misc/fold: Test for the above fix.
7757         * tests/misc/Makefile.am (TESTS): Add fold.
7759 2003-08-10  Jim Meyering  <jim@meyering.net>
7761         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
7762         system.h so the types from time.h and sys/time.h are available.
7763         It appears that this is necessary for OpenBSD, NetBSD, and
7764         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
7766 2003-08-06  Paul Eggert  <eggert@twinsun.com>
7768         * NEWS: Add support for setting file timestamps to microsecond
7769         resolution, on hosts that support this.
7770         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
7771         * src/copy.c (copy_internal):
7772         Set file timestamps with utimens, not utime.
7773         * src/cp.c (re_protect): Likewise.
7774         * src/install.c (change_timestamps): Likewise.
7775         * src/touch.c (newtime, touch, main): Likewise.
7777 2003-08-09  Jim Meyering  <jim@meyering.net>
7779         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
7780         from Paul Eggert.
7781         (syntax-check-rules): Add it.
7783         * src/tail.c (main): Tweak Solaris OS version number in comment.
7784         * src/wc.c (wc): Likewise
7785         * tests/tail-2/fflush: Likewise.
7787         * src/tail.c: Add new undocumented option, --presume-input-pipe.
7788         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
7790 2003-08-08  Paul Eggert  <eggert@twinsun.com>
7792         Use new gnulib 'extensions' module.
7793         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
7794         AC_GNU_SOURCE.
7796 2003-08-08  Paul Eggert  <eggert@twinsun.com>
7798         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
7800 2003-08-09  Jim Meyering  <jim@meyering.net>
7802         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
7803         For tests of obsolete behavior, don't presume that unsetting
7804         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
7806 2003-08-07  Paul Eggert  <eggert@twinsun.com>
7808         * doc/coreutils.texi (split invocation):
7809         Add -d or --numeric-suffixes option to 'split'.
7810         From a suggestion by Jesse Kornblum.
7811         * src/split.c (suffix_alphabet): New var.
7812         (longopts, usage, next_file_name, main): Support -d.
7813         (next_file_name, main): Allow -a0, as POSIX requires.
7814         (next_file_name): Don't assume ASCII-like encoding;
7815         'a' through 'z' are not contiguous in EBCDIC.
7817 2003-08-05  Paul Eggert  <eggert@twinsun.com>
7819         Merge getline from gnulib.
7820         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
7821         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
7822         New files, from gnulib.
7823         * lib/getdelim2.c, lib/getdelim2.h: Remove.
7824         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
7825         getdelim2.h to getndelim2.c and getndelim2.h.
7826         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
7827         checking for getdelim.
7828         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
7829         than rolling our own.
7830         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
7831         (cut_fields): Invoke getndelim2 rather than getdelim2.
7833 2003-08-04  Jim Meyering  <jim@meyering.net>
7835         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
7836         and for the indices to iterate through nsigs.
7838 2003-08-02  Paul Eggert  <eggert@twinsun.com>
7840         * src/sort.c: Minor code cleanups, mostly to use more accurate
7841         types and to remove unnecessary casts.
7842         (min, max): Remove.  All uses changed to MIN and MAX.
7843         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
7844         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
7845         keyfield.numeric, struct keyfield.general_numeric, struct
7846         keyfield.month, struct keyfield.reverse, reverse, unique,
7847         have_read_stdin): Now bool, not int.  All uses changed.
7848         (eolchar): Now char, not int.
7849         (struct keyfield.ignore): Now bool const *, not int *.
7850         (struct keyfield.translate): Now char const *, not char *.
7851         (struct month.name): Likewise.
7852         (blanks, nonprinting, nondictionary): Now bool[], not int[].
7853         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
7854         check, sort, main): Use const * pointers when possible.
7855         (month_cmp): Rewrite to avoid casts.
7856         (inittables): Initialize tables unconditionally, to avoid branches.
7857         (fillbuf): Return bool, not int.  All uses changed.
7858         (fillbuf, keycompare, new_key, main):
7859         Use SIZE_MAX rather than (size_t) -1.
7860         (trailing_blanks): Renamed from trim_trailing_blanks.
7861         Return the number of blanks to trim.  All uses changed.
7862         (getmonth): Use trailing_blanks rather than open code.
7863         (keycompare): Do not cast char * to unsigned char *; not needed.
7864         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
7865         ourselves.
7866         (compare, main): Use | rather than || to avoid jumps.
7867         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
7868         be nonzero there.
7869         (check, first_same_file, sort, main):
7870         Use bool instead of int local vars when possible.
7871         (check): Merge the old 'checkfp' and 'check' into a single function,
7872         that returns a boolean (true if the file was ordered).
7873         All uses changed.
7874         (main): Use int instead of unsigned for iterating through nsigs.
7875         Rename local var "posix_pedantic" to "posixly_correct".
7877 2003-08-02  Jim Meyering  <jim@meyering.net>
7879         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
7880         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
7882         * src/cut.c (cut_fields): Don't read again after encountering an
7883         initial EOF.  E.g., `cut -f2' would do so.
7884         * tests/misc/tty-eof: Add a test for the above fix.
7886         * src/sort.c (sortlines): Add description and references.
7887         From Paul Eggert.
7889         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
7890         the tests in help-version will use the just-built binaries.
7891         Reported by Christian Krackowizer.
7893 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7895         * NEWS: Add --rfc-2822 option to GNU date.
7896         * doc/coreutils.texi (Time directives, Options for date, Examples
7897         of date): Likewise.
7898         * src/date.c (long_options, usage, main): Likewise.
7899         * doc/getdate.texi (General date syntax): Likewise.
7900         * doc/coreutils.texi (Options for date): Fix a typo in format:
7901         it's now %d not %_d.  Add URLs.
7903 2003-08-01  Jim Meyering  <jim@meyering.net>
7905         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
7906         Otherwise, with at least the /bin/sh from HPUX 10.20,
7907         the trap code would end up converting that to exit 1 and thus an
7908         unexpected test failure.  Reported by Christian Krackowizer.
7910 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7912         * src/ptx.c: Do not include bumpalloc.h.
7913         (WORD_TABLE): New member alloc.
7914         (ALLOC_NEW_WORD): Remove.
7915         (occurs_alloc): New var.
7916         (digest_word_file, find_occurs_in_text): Check for arithmetic
7917         overflow when computing table size.  Use xrealloc rather than
7918         bumpalloc primitives.
7920 2003-07-29  Jim Meyering  <jim@meyering.net>
7922         * Version 5.0.90.
7924         * README: When running tests as root, suggest using
7925         sudo with NON_ROOT_USERNAME=$USER.
7927         * tests/Makefile.am (all_programs): Makefile is in ../src, not
7928         $(srcdir)/../src.
7930 2003-07-28  Jim Meyering  <jim@meyering.net>
7932         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
7934 2003-07-28  Paul Eggert  <eggert@twinsun.com>
7936         * lib/stdbool.hin (_Bool): Make it signed char, instead of
7937         an enum type, so that it's guaranteed to promote to int.
7938         * src/sort.c (sortlines_temp): Undo previous change.
7940 2003-07-28  Jim Meyering  <jim@meyering.net>
7942         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
7943         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
7944         would cause lines[-1 - swap] (with swap = false) to evaluate to
7945         lines[4294967295].
7947 2003-07-27  Jim Meyering  <jim@meyering.net>
7949         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
7950         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
7952         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
7953         directories, as required by POSIX.   Reported by Karl Berry.
7954         * tests/rm/dir-no-w: New file.  Test for the above fix.
7955         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
7957         * tests/mk-script: Emit `$xx', not its expansion.
7959 2003-07-27  Paul Eggert  <eggert@twinsun.com>
7961         This change was inspired by a similar proposal by Stepan Kasal.
7962         * src/sort.c (mergelines, sortlines_temp): New functions.
7963         (sortlines): Use them, to reduce the number of times that
7964         we need to copy 'struct line' values.  This improved CPU
7965         performance by about 30% on one 18 MB test.
7966         (sort): Don't invoke sortlines unless we have 2 or more lines.
7968 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
7970         * src/sort.c (sort): Don't require two `struct line's per text line,
7971         the new sort algorithm requires just 1.5.
7973 2003-07-27  Jim Meyering  <jim@meyering.net>
7975         * src/pathchk.c (validate_path): Use %lu, not %ld.
7976         From Paul Eggert.
7977         * src/cut.c (is_printable_field): Simplify bit arithmetic.
7978         From Paul Eggert.
7979         * src/ls.c (sort_files): Put `volatile' in the right place.
7980         From Paul Eggert.
7982 2003-07-26  Jim Meyering  <jim@meyering.net>
7984         Use only one bit per field/offset in array, not one `int'.
7985         * src/cut.c (printable_field): Change type to `unsigned char'.
7986         (mark_printable_field, is_printable_field): New functions.
7987         Use them in place of all direct accesses of `printable_field'.
7989         * src/expand.c (parse_tabstops): Detect overflow properly.
7990         * src/cut.c (set_fields): Likewise.
7992         * src/rm.c: Include "dirname.h".
7993         (usage): Use base_name (program_name) in body of --help output.
7994         This lets me...
7995         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
7996         Idea from Brendan O'Dea, who suggested using
7997         `program_name = basename (argv[0]);' everywhere --
7998         can't do that, but using base_name works just fine here.
8000         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
8002 2003-07-24  Paul Eggert  <eggert@twinsun.com>
8004         Fix some POSIX-compliance problems with 'test'.  This makes
8005         'test' more compatible with Bash.
8007         * NEWS, doc/coreutils.texi: Document the following.
8008         * src/test.c: Include exitfail.h.
8009         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
8010         (test-syntax_error): Use it.
8011         (binary_operator): Now takes bool arg specifying whether left operand
8012         is -l ARG, so that caller determines this rather than us.
8013         All uses changed.
8014         (term): Use posixtest to evaluate parenthesized subexpressions.
8015         (unary_operator, one_argument): Remove support for -t without operand.
8016         (one_argument): Take argument from argv[pos].
8017         (one_argument, two_arguments, three_arguments): Advance pos.
8018         All callers changed.
8019         (three_arguments): Look for binary ops before "!".  Then look
8020         for parenthesized one_argument expressions, instead of trusting
8021         expr () to do the right thing.
8022         (posixtest): Now takes number of args.  All callers changed.
8023         Treat "( A B )" like "A B".
8024         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
8025         POSIXLY_CORRECT, as we now conform to POSIX by default.
8026         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
8027         * tests/test/Test.pm (test_vector): Add several tests to check
8028         the above.  Syntax errors now exit with status 2, not 1.
8029         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
8031 2003-07-26  Jim Meyering  <jim@meyering.net>
8033         * tests/help-version: Adjust for above change in test behavior:
8034         `[' exits with 2, not 1, and test doesn't accept --help or --version.
8036         * Makefile.maint (ME): Don't use trick suggested in Make manual.
8037         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
8039         * Makefile.maint (sc_system_h_headers): Another syntax check.
8040         (syntax-check-rules): Add it to the list.
8042         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
8043         so it matches `%ld' format even on 32-bit systems.
8045         * src/fmt.c (flush_paragraph): Cast field width to `int' to
8046         avoid warning on 64-bit systems.
8048         * src/ls.c (sort_files): Make `func' volatile, so it can't be
8049         clobbered by a `longjmp' into this function.
8051 2003-07-25  Jim Meyering  <jim@meyering.net>
8053         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
8054         value.
8056         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
8057         because it'd evoke spurious failure on 64-bit systems.
8059 2003-07-24  Jim Meyering  <jim@meyering.net>
8061         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
8062         output its current record counts.  Reported by Jurriaan.
8064         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
8065         `wc' with no options.  This goes along with the change of 2003-07-20.
8067 2003-07-23  Jim Meyering  <jim@meyering.net>
8069         Don't include headers already included by system.h:
8070         * src/tr.c: Don't include errno.h.
8071         * src/true.c: Don't include version-etc.h.
8072         * src/test.c: Don't include limits.h or error.h.
8073         * src/stat.c: Don't include unistd.h or time.h.
8074         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
8075         * src/pr.c: Don't include time.h.
8076         * src/pathchk.c: Don't include errno.h.
8077         * src/nice.c: Don't include sys/time.h.
8078         * src/ls.c: Don't include stdlib.h.
8080         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
8081         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
8082         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
8083         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
8084         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
8085         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
8086         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
8087         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
8088         Don't include closeout.h.
8090         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
8091         can access the required version of rm.
8092         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
8094         * tests/cut/Test.pm (out-delim3a): New test.
8096         * man/help2man: Update to version 1.33.
8098         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
8100         * src/dircolors.c: Include xstrndup.h.
8101         (xstrndup): Remove function, now that it's been factored out into
8102         it's own file.
8104 2003-07-22  Paul Eggert  <eggert@twinsun.com>
8106         * src/wc.c (wc): Fix typo in computation of file from file_x,
8107         which caused the former to be used uninitialized if file_x was
8108         nonzero.
8110 2003-07-22  Jim Meyering  <jim@meyering.net>
8112         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
8114         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
8115         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
8116         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
8118         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
8120         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
8122         * src/cut.c (set_fields): Mark all selected indices before trying to
8123         determine range endpoints.
8124         * tests/cut/Test.pm: New test for the above fix.
8126         Begin to address this comment: What if someone wants to
8127         extract the 1,000,000-th field of some huge input file?
8128         The first step is to rearrange things so that the values
8129         in the printable_field array are all 0/1 rather than 0/1/2.
8130         * src/cut.c (RANGE_START_SENTINEL): Remove.
8131         Store range-start indices in a hash table, rather than
8132         overloading the `printable_field' array.
8133         (range_start_ht): New global.
8134         (hash_int, hash_compare_ints, is_range_start_index): New functions.
8135         (print_kth): Use is_range_start_index; don't test printable_field.
8136         (set_fields): Detect overflow.
8137         (set_fields): Insert each range-start index into range_start_ht.
8138         (main): Call set_fields only once, and only after
8139         output_delimiter_specified and (if required) range_start_ht have
8140         been defined.
8142 2003-07-20  Paul Eggert  <eggert@twinsun.com>
8144         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
8145         invoked with a null pointer when there were no file arguments.
8147 2003-07-20  Jim Meyering  <jim@meyering.net>
8149         * Makefile.maint (sc_changelog): Add another nit-picky check.
8151         * src/wc.c (write_counts): Add a comment.
8152         (wc): Rename `file' parameter.
8153         Set new local, `file', to be the file name, or (when it's NULL)
8154         _("standard output") so that all uses of `file' use the proper value.
8155         Use STREQ, not strcmp.
8157 2003-07-20  Paul Eggert  <eggert@twinsun.com>
8159         wc count field widths now are heuristically adjusted depending
8160         on the input size, if known.  If only one count is printed, it
8161         is guaranteed to be printed without leading spaces.
8163         Previously, wc did not align the count fields if
8164         POSIXLY_CORRECT was set, but POSIX did not actually require
8165         this undesirable behavior, so it has been removed.
8167         * NEWS: Document this.
8168         * doc/coreutils.texi (wc invocation): Likewise.
8170         * src/wc.c (number_width): New var.
8171         (posixly_correct): Remove.
8172         (struct fstatus): New struct.
8173         (write_counts): Output fields of width number_width.
8174         Do not worry about POSIXLY_CORRECT.
8175         Use null file, not empty-string file, to denote stdin,
8176         since "" is a valid file name on some hosts.
8177         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
8178         if possible.
8179         (wc):  Avoid problems if end_pos - current_pos overflows.
8180         Do not print odd message if stdin has a read error.
8181         (get_input_fstatus, compute_number_width): New functions.
8182         (main): Use them to implement the new behavior.
8183         Ignore POSIXLY_CORRECT.
8185         * tests/wc/Test.pm: Adjust to the new output widths.
8187 2003-07-19  Jim Meyering  <jim@meyering.net>
8189         * tests/rm/fail-eperm: Don't create temporary directory --
8190         we don't use it.
8192         * tests/shred/remove: Don't open-code test for UID != 0.
8193         Use priv-check's require-non-root instead.
8194         Update to use newer framework.
8196         * tests/help-version (expected_failure_status_expr): Record that
8197         expr exits with status of 3 for e.g., a write error.
8199         * tests/priv-check: Use `id -u' to see if we're running as root,
8200         rather than trying go write to an write-protected file.
8201         When running as root, ensure $NON_ROOT_USERNAME is valid.
8202         When running as root with `require-non-root', ensure that `.'
8203         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
8204         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
8206         * src/printenv.c: Include "exitfail.h".
8207         (main): Set exit_failure rather than calling close_stdout_set_status.
8208         * src/date.c: Likewise.
8209         * src/sort.c: Likewise.
8210         * src/tty.c: Likewise.
8212 2003-07-18  Jim Meyering  <jim@meyering.net>
8214         * tests/touch/not-owner: Update to use newer framework.
8216         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
8217         directory, and remove Perl-coded `you may not run as root' test.
8218         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
8219         hard-coding something not quite equivalent.
8220         Paul Jarc reported the inconsistent diagnostics.
8222         * src/sort.c (main): Use close_stdout via atexit.
8223         Now `sort --version' and `sort --help' fail, as they should
8224         when their output is redirected to /dev/full.
8226         * src/su.c (usage): Don't call close_stdout here.
8227         (main): Use close_stdout via atexit.
8228         Now `su --version > /dev/full' fails, as it should.
8229         Somehow, the change of 2000-05-07 that purports to fix this
8230         was not checked in.
8232         * tests/help-version (--help/--version vs. /dev/full): Special-case
8233         `[' to protect it from expected_failure_status-`eval'.
8235         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
8236         count and the corresponding line, as required by POSIX.
8237         Reported by Clement Wang.
8238         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
8240         * tests/expr/basic: Add tests for when exit status is 2.
8242         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
8243         Use an anonymous `enum', rather than #define.
8245 2003-07-17  Paul Eggert  <eggert@twinsun.com>
8247         * src/expr.c: Include "exitfail.h", "quotearg.h".
8248         (EXPR_INVALID, EXPR_ERROR): New constants.
8249         (nomoreargs, null, toarith, nextarg): Return bool, not int.
8250         (syntax_error): New function, exiting with status 2.  Use it
8251         insteading of printing "syntax error" ourselves.
8252         (main): Initialize exit_failure to EXPR_ERROR.
8253         Exit with EXPR_INVALID on syntax error (too few arguments).
8254         (nextarg): Use strcmp, not strcoll; strcoll might return
8255         an undesirable 0, or might fail.
8256         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
8257         or other such error.
8258         (eval2): Report an error if strcoll fails in a string comparison.
8259         * src/sort.c: Include "exitfail.h".
8260         (main): Set exit_failure, not xalloc_exit_failure and
8261         xmemcoll_exit_failure.
8262         * tests/expr/basic: Invalid value exits with status 3, not 2.
8264 2003-07-16  Jim Meyering  <jim@meyering.net>
8266         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
8267         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
8269         This script would have caught at least two recent bugs:
8270         those in [ and kill.
8271         * tests/help-version: Revive this script.
8272         It wasn't doing anything useful, since $all_programs wasn't being
8273         defined by the invoking Makefile.am.
8274         Reflect that nohup is no longer a script, so don't exclude it.
8275         Add framework to handle the programs added since it was last run:
8276         kill, stat, unlink, [, link, readlink.
8277         Fix path-related problems deriving from the move of this script
8278         from src/ to its present location.
8279         * tests/Makefile.am (all_programs): Define.
8280         (TESTS_ENVIRONMENT): Use it.
8282         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
8283         whereby kill would always attempt to operate on argv[0] and fail.
8285         * src/test.c (integer_expected_error): Improve diagnostic -- now,
8286         it also matches the one from bash's builtin test.
8287         (binary_operator): Add \n at end of diagnostic.
8289         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
8290         * tests/priv-check: Move setuidgid-related and
8291         NON_ROOT_USERNAME-checking code to this file.
8293         * README: Update section on testing as `root'.
8294         Suggestion from Paul Jarc.
8296         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
8297         names of authors that I just found in bash's builtins/test.def.
8299         Running `[' with no arguments would evoke a segfault.
8300         * src/test.c (main) [LBRACKET]: Move initialization of argv to
8301         precede potential use via test_syntax_error.
8303         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
8304         warning from automake -Wall.
8306 2003-07-15  Jim Meyering  <jim@meyering.net>
8308         * Version 5.0.1.
8310         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
8311         prompt us about it.
8313         * announce-gen (print_changelog_deltas): Relax tests for matching
8314         version-number line in NEWS.
8315         Change the .sig suffix to .asc here, too.
8317 2003-07-14  Jim Meyering  <jim@meyering.net>
8319         * Makefile.maint (%.asc): Renamed from %.sig.
8320         Generate and use ascii-armored signatures.
8321         Use gpg's -o option.
8323 2003-07-13  Jim Meyering  <jim@meyering.net>
8325         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
8326         (main): Use them.
8328         * Makefile.maint (syntax-check): Move each individual check into
8329         its own target.
8330         (syntax-check-rules): This is the list of syntax-check targets.
8331         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
8332         (sc_cast_of_x_alloc_return_value, sc_space_tab):
8333         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
8335 2003-07-12  Jim Meyering  <jim@meyering.net>
8337         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
8338         traces of the nohup script.
8340         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
8341         $(OPTIONAL_BIN_ZCRIPTS).
8343         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
8344         target, not before the `>'.
8346         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
8347         now that that function no longer calls `error'.
8349         * src/df.c (find_mount_point): Emit a diagnostic for each
8350         failed syscall, rather than relying on caller to do that.
8351         The caller couldn't do a good job, anyhow -- too many different
8352         ways to fail (each with a different referent).
8353         Give a diagnostic upon failed save_cwd, now that that function
8354         no longer calls `error'.
8355         (show_point): Don't diagnose find_mount_point's errors, now that
8356         it handles them itself.
8358         * src/df.c (find_mount_point): Don't let free clobber errno upon
8359         failed chdir.
8361         * src/sys2.h: Remove alloca-related block.
8362         * src/system.h: Include <alloca.h> here, instead.
8364         It appears that the `#pragma alloca' included via "system.h" is
8365         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
8366         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
8367         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
8369         * src/chown-core.c (change_file_owner): Do not restore any special
8370         permission bits (e.g., set-user-ID, set-group-ID) that are reset
8371         by chown(2) on some systems.  Suggestion and insistence :-) from
8372         Michael Stone.
8374         * tests/input-tty: Also check `test -t 1'.
8375         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
8376         test would block when run in the background.
8378 2003-07-11  Jim Meyering  <jim@meyering.net>
8380         * tests/sample-test: Also fail if cat-to-create-expected-output
8381         fails.  Otherwise, if both `exp' and `out' were to end up empty
8382         because of e.g., a full disk, they would mistakenly compare equal.
8384         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
8385         This solves a portability problem: on at least Solaris systems,
8386         when nohup.sh used the vendor /bin/sh, it would exit with status
8387         of `1' rather than the required 126 or 127 upon failure to exec
8388         the specified program.
8390         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
8391         (bin_PROGRAMS): Add nohup.
8392         (EXTRA_DIST): Remove nohup.sh.
8393         (all_programs): Remove use of $(EXTRA_SCRIPTS).
8394         * src/nohup.sh: Remove file.
8395         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
8397         * tests/misc/nohup: Tests for the above.
8398         * tests/misc/Makefile.am (TESTS): Add nohup.
8400         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
8401         the macro, COPY_FD_DIAGNOSE.
8402         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
8403         (head_file): Likewise.
8405         * src/date.c: Include "quote.h".
8406         (batch_convert): Use the quote function rather than using literal `...'
8407         in a diagnostic.
8409         * src/setuidgid.c (main): Enclose diagnostic in _(...).
8410         * src/fmt.c (main): Likewise.
8411         * src/mknod.c (main): Likewise.
8412         * src/tac.c (tac_seekable): Likewise.
8413         * src/yes.c (main): Likewise.
8414         * src/od.c (main): Likewise.
8415         * src/install.c (change_attributes): Likewise.
8417 2003-07-10  Jim Meyering  <jim@meyering.net>
8419         * src/head.c (usage): Use 1024*1024 in place of 1048576.
8420         * src/tail.c (usage): Likewise.
8422         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
8423         place of the kludge in this test.  Suggestion from Paul Jarc.
8425         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
8426         * src/setuidgid.c: New program, solely for testing (not installed).
8428         * src/chown-core.c (change_file_owner): Don't leak file descriptors
8429         when dereferencing symlinks.
8431 2003-07-09  Jim Meyering  <jim@meyering.net>
8433         * tests/du/slash: New file/test for today's lib/ftw.c fix.
8434         * tests/du/Makefile.am (TESTS): Add slash
8436         * src/tail.c (xlseek): Avoid warning about ``return without value
8437         from function returning non-void''.
8439 2003-07-08  Jim Meyering  <jim@meyering.net>
8441         * man/help2man: Update to version 1.29.
8443         * man/help2man: Add END handler to close STDOUT and check for errors.
8445 2003-06-30  Paul Eggert  <eggert@twinsun.com>
8447         Add support for a "[" that conforms to the GNU coding standards,
8448         i.e., that does not depend on its name.
8449         * src/lbracket.c: New file.
8450         * README: Add "[".
8451         * man/Makefile.am (programs): Ignore "[", since it doesn't have
8452         a separate man page.
8453         * src/Makefile.am (bin_PROGRAMS): Add "[".
8454         (__SOURCES): New var.
8455         * src/test.c (LBRACKET): Define to 0 if not defined.
8456         (main): Use LBRACKET rather than argv[0].
8458         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
8459         Reported by Paul Jarc and Dan Jacobson.
8461         * src/test.c (main): Do not recognize --help or --version if
8462         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
8463         Do not bother testing that margv[margc] is non-null.
8465 2003-07-04  Jim Meyering  <jim@meyering.net>
8467         * src/who.c (print_line): Rewrite to use asprintf, in order to be
8468         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
8470         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
8471         option, and perform the +1600 invocations of head IFF the envvar
8472         RUN_EXPENSIVE_TESTS is set.
8474 2003-07-03  Jim Meyering  <jim@meyering.net>
8476         * src/cp.c (do_copy): Give a better diagnostic when failing due
8477         to nonexistent destination directory.  Reported by Dmitry Rutsky.
8478         See http://bugs.debian.org/199730 for details.
8480 2003-06-27  Jim Meyering  <jim@meyering.net>
8482         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
8483         * src/split.c (longopts): Use `1', not `0' as the value for
8484         for &verbose.  Reported by Keith Thompson.
8486         Test for the above fix.
8487         * tests/misc/split-a: Also use --verbose and compare stderr
8488         output with what we'd expect.
8490 2003-06-20  Jim Meyering  <jim@meyering.net>
8492         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
8493         Use `error_t' (rather than int) as type for local `err'.
8494         From Alfred M. Szmidt.
8496 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
8498         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
8499         Fix author preservation code.
8501 2003-06-19  Jim Meyering  <jim@meyering.net>
8503         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
8504         (do_link): Don't warn about hard link to symlink.
8506 2003-06-18  Jim Meyering  <jim@meyering.net>
8508         * src/cut.c: Include "getdelim2.h", not "getstr.h".
8509         Reflect renaming: getstr -> getdelim2.
8511         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
8512         readline -> readlinebuffer.
8514 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8516         * src/readlink.c: Include <sys/types.h> before system.h (because
8517         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
8519 2003-06-17  Jim Meyering  <jim@meyering.net>
8521         * src/system.h (initialize_main): Define.
8522         Use it in every `main'.  Applied via this:
8523         p='initialize_main (&argc, &argv);'
8524         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
8525           $(grep -l program_name.=.argv.0 *.c)
8526         test.c uses margc/margv, so I made the change manually for that file.
8527         Based on a patch from Bernard Giroud.
8529 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8531         Fix for build failure on Ultrix 4.3.
8532         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
8533         Include sys/param.h and sys/mount.h on ultrix.
8535 2003-06-16  Jim Meyering  <jim@meyering.net>
8537         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
8538         definitions.
8539         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
8540         them here instead, but with one change: define EISDIR to -1, not 0.
8542         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
8543         guaranteed to be defined.
8544         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
8546         * README: Mention the CVS repository.
8547         Encourage addition of test cases.
8549 2003-06-12  Jim Meyering  <jim@meyering.net>
8551         * src/touch.c (touch): Call close only if necessary.
8552         From Bruno Haible.
8554         * src/wc.c (usage): Correct wording: wc prints counts in the order
8555         `newline, word, byte'.  Reported by Keith M. Briggs.
8556         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
8558 2003-06-10  Jim Meyering  <jim@meyering.net>
8560         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
8562 2003-06-07  Jim Meyering  <jim@meyering.net>
8564         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
8565         rule.
8567 2003-06-06  Jim Meyering  <jim@meyering.net>
8569         * src/extract-magic (main): Avoid newer 3-arg form of open,
8570         so this script works also with e.g., perl5.005_03.
8571         Patch by John David Anglin.
8573 2003-06-04  Paul Eggert  <eggert@twinsun.com>
8575         * src/system.h: Include <stdbool.h> unconditionally.
8577 2003-06-04  Jim Meyering  <jim@meyering.net>
8579         * man/Makefile.am (check-programs-vs-x): Rename target
8580         from check-programs-vs-1.  Adjust rule to check for the
8581         primary (.x) file, not the generated one (.1).
8583 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
8585         * man/kill.x: New file.
8586         * man/Makefile.am (dist_man_MANS): Add kill.1.
8587         (kill.1): New rule.
8589 2003-06-04  Jim Meyering  <jim@meyering.net>
8591         Ensure that the .x file for a new program is never forgotten again.
8592         * man/Makefile.am (programs): Define.
8593         (check-programs-vs-1): New phony target.
8594         (check-local): Depend on it.
8596 2003-06-03  Jim Meyering  <jim@meyering.net>
8598         Avoid unnecessary copying of environment.
8599         * src/env.c (main): Rather than clearing the environment and --
8600         unless told to ignore environment -- copying all settings from
8601         the saved, original environment, clear the environment only when
8602         that is requested.  Suggested by Jens Elkner.
8604 2003-06-02  Jim Meyering  <jim@meyering.net>
8606         * src/system.h: Always include <string.h>, since we assume C89.
8607         Include <limits.h> without checking for HAVE_LIMITS_H.
8609         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
8610         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
8612 2003-06-01  Jim Meyering  <jim@meyering.net>
8614         Avoid a race condition in `tail -f' described by Ken Raeburn in
8615         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
8616         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
8617         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
8618         (tail_bytes, tail_lines, tail): Likewise.
8619         (tail_file): Use the new `read_pos' value as the size,
8620         rather than stats.st_size from the fstat call.
8622 2003-05-28  Jim Meyering  <jim@meyering.net>
8624         * src/extract-magic: Allow expansion of `$file' in the here-
8625         document corresponding to the comment at the top of fs.h.
8627 2003-05-26  Jim Meyering  <jim@meyering.net>
8629         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
8630         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
8631         Use #if/#elif/... cascade so we get only one set of include files.
8632         Reported by Nelson Beebe.
8634 2003-05-24  Jim Meyering  <jim@meyering.net>
8636         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
8637         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
8638         accept the BSD format.
8640 2003-03-28  Joe Orton  <jorton@redhat.com>
8642         * src/md5sum.c (bsd_split_3): New function.
8643         (split_3): Detect checksums from BSD 'md5' command and handle them
8644         using bsd_split_3.
8646         * tests/md5sum/basic-1: New tests for --check exit status, and for
8647         BSD-style checksum files.
8649 2003-05-21  Jim Meyering  <jim@meyering.net>
8651         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
8652         This sort of thing is why it'd be *Really Good* to factor
8653         out the common code used here and in tail.c.
8655 2003-05-14  Jim Meyering  <jim@meyering.net>
8657         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
8659         * tests/du/slink: Skip this test if `.' is on an XFS file system.
8661         * tests/du/fd-leak: New file.  Test for the bug in du that
8662         was fixed by the 2003-05-12 change to lib/ftw.c.
8663         * tests/du/Makefile.am (TESTS): Add fd-leak.
8665         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
8666         includes a translatable word, `and'.
8668         * src/dd.c (usage): Don't use `,' as the thousands separator
8669         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
8670         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
8671         * src/df.c (usage): Likewise.
8672         * src/du.c (usage): Likewise.
8673         * src/ls.c (usage): Likewise.
8675         * Makefile.maint (syntax-check): Add another check.
8677 2003-05-13  Paul Eggert  <eggert@twinsun.com>
8679         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
8680         must output nothing.  Problem reported by Josh Hyman.
8682         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
8683         (output_unique, output_first_repeated, output_later_repeated):
8684         New vars.  All uses of "mode" changed to use these variables,
8685         which are not mutually exclusive as "mode" was.
8686         (writeline): New arg "match", used to control whether to
8687         obey output_first_repeated or output_later_repeated.
8688         All callers changed.
8689         (check_file, main): Adjust to above changes.
8691         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
8693 2003-05-14  Jim Meyering  <jim@meyering.net>
8695         * tests/rm/rm3: Use tr's \n notation rather than \012.
8696         This package can afford to do that, since its tests are guaranteed use
8697         GNU tr, which has accepted the more modern notation for 10 years.
8698         * tests/rm/rm5: Likewise.
8699         * tests/cp/same-file: Likewise.
8700         * tests/stty/row-col-1: Likewise.
8701         * tests/stty/basic-1: Likewise.
8702         * tests/rm/deep-1: Likewise.
8703         * tests/mv/part-symlink: Likewise.
8704         * tests/mkdir/perm: Likewise.
8705         * tests/misc/nice: Likewise.
8707 2003-05-13  Jim Meyering  <jim@meyering.net>
8709         * src/copy.c (struct F_triple) [name]: Remove const attribute.
8710         (triple_free): Don't apply cast to argument of free.
8711         (seen_file): Add cast here instead.
8713         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
8714         (src_to_dest_free): Don't apply cast to argument of free.
8716         * src/sort.c (zaptemp): Don't apply cast to argument of free.
8717         * src/pr.c (init_fps, init_store_cols): Likewise.
8718         * src/join.c (delseq, freeline): Likewise.
8719         * src/expr.c (OLD): Likewise.
8720         * src/sort.c (sort): Likewise.
8721         * src/head.c (elide_tail_lines_pipe): Likewise.
8723         * src/tail.c: Include "quote.h".
8724         Use quote in diagnostics.  Change many error format strings
8725         from just `%s' to e.g., `error reading %s'.
8726         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
8727         Rewrite newline-counting loop to use memchr.
8729         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
8730         Now that assert is no longer used, don't include <assert.h>.
8732 2003-05-12  Jim Meyering  <jim@meyering.net>
8734         * src/head.c: Include <assert.h>.
8735         (AUTHORS): Add my name.
8736         (elide_tail_lines_pipe): New function.
8738 2003-05-10  Jim Meyering  <jim@meyering.net>
8740         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
8742         * src/readlink.c (main): Set program_name before first use.
8743         Remove that (redundant) first use.
8744         Don't exit successfully just because --verbose was specified.
8745         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
8746         parameter is 0, error does not exit.
8748         * src/uname.c (main): When failing due to too many arguments, also say
8749         that, rather than just "Try `uname --help' for more information.".
8750         * src/comm.c (main): Likewise, but for too few arguments.
8751         * src/logname.c: Include error.h.
8752         (main): Say why we're failing.
8754         * src/uniq.c (main): Don't segfault when argc < optind.
8755         * src/who.c (main): Handle argc < optind.
8756         * src/df.c (main): Likewise.
8757         * src/install.c (main): Likewise.
8758         * src/mv.c (main): Likewise.
8759         * src/pwd.c (main): Likewise.
8760         * src/tty.c (main): Likewise.
8761         * src/chroot.c (main): Likewise.
8762         * src/hostname.c: Likewise.
8763         * src/du.c (main): Likewise.
8764         * src/expand.c (main): Likewise.
8765         * src/env.c (main): Likewise.
8766         * src/unexpand.c (main): Likewise.
8767         * src/printenv.c (main): Likewise.
8768         * src/sync.c (main): Handle argc == 0.
8769         * src/expr.c (main): Likewise.
8770         * src/printf.c (main): Likewise.
8771         * src/basename.c (main): Likewise.
8772         * src/ln.c (main): Test for `missing argument' before computing n_files.
8773         * src/tail.c (main): Test for the case of no arguments before
8774         computing n_files.
8776         * src/kill.c (send_signals): Don't check command line arguments here.
8777         (main): Check them here instead.  Handle argc < optind.
8779         * src/logname.c (main): Use error, rather than fprintf, for the sake
8780         of consistency.
8782         * src/rm.c (main): Don't overrun array bound if argc is 0.
8784 2003-05-09  Jim Meyering  <jim@meyering.net>
8786         * src/sort.c (main): Don't overrun array bound if argc is 0.
8787         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
8788         Reported by Wartan Hachaturow.
8790 2003-05-07  Jim Meyering  <jim@meyering.net>
8792         Implement support so that `head --lines=-N' works on seekable files.
8793         * src/head.c (enum Copy_fd_status): Define.
8794         (COPY_FD_DIAGNOSE): New macro.
8795         (elide_tail_lines_seekable): New funtion.
8796         (elide_tail_lines_file): Call it here.
8798 2003-05-06  Jim Meyering  <jim@meyering.net>
8800         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
8802 2003-05-04  Jim Meyering  <jim@meyering.net>
8804         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
8805         caused the addition of thousands of small files to the tar archive.
8806         * tests/misc/head-elide-tail: New file.  Add them here instead.
8807         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
8809 2003-05-04  Paul Eggert  <eggert@twinsun.com>
8811         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
8812         (IF_READDIR_NEEDS_REWINDDIR): Remove.
8813         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
8814         which was a bit weird because it couldn't be emulated by a function.
8816 2003-05-03  Jim Meyering  <jim@meyering.net>
8818         Extend head to accept --lines=-N (--bytes=-N) and to print all
8819         but the N lines (bytes) at the end of the file.
8820         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
8821         Use quote() in diagnostics, rather than literal `' marks.
8822         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
8823         New functions.
8824         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
8825         (head_file): Reorganize so as to call head from only one place.
8826         (main): Likewise, for head_file.
8827         Handle new, undocumented option, --presume-input-pipe.
8828         Handle negative line and byte counts.
8829         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
8831         * tests/du/8gb: Skip test if the file system of `.' doesn't support
8832         sparse files -- otherwise it'd create a file of size 8GB.
8834 2003-05-02  Jim Meyering  <jim@meyering.net>
8836         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
8837         Instead explain about `-' and standard input.
8838         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
8839         Reported by Keith Thompson.
8840         * tests/fmt/basic: Add test for the above fix.
8842         * src/fmt.c: Include "quote.h".
8843         Use quote() in diagnostics, rather than literal `' marks.
8844         (main): Exit nonzero when unable to open an input file.
8845         * tests/fmt/basic: Add test for the above fix.
8847         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
8848         specifications like `-72x'.
8849         * tests/fmt/basic: Add test for the above fix.
8851         Work around nasty readdir bug on Darwin6.5.
8852         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
8853         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
8854         returned NULL and there has been at least one successful unlink or
8855         rmdir call since the opendir or previous rewinddir, then call
8856         rewinddir and reiterate the loop.
8858         Factor out common code.
8859         * src/remove.c (readdir_ignoring_dotdirs): New function.
8860         (is_empty_dir): Use it here.
8861         (remove_cwd_entries): Use it here.
8863 2003-05-01  Jim Meyering  <jim@meyering.net>
8865         * tests/rm/r-3: Create 500 rather than just 300 files.
8866         There's a bug in Darwin6.5's readdir that shows up only with
8867         338 or more files.
8868         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
8869         has two components.
8871         * src/tail.c:
8872         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
8873         (dump_remainder): Move two declarations `down' into the scope
8874         where they are used.
8875         (xlseek): Return the resulting offset.
8876         (file_lines): Rename parameter, file_length, to end_pos.
8877         (pipe_lines): Don't coerce safe_read return value to `int'.
8878         Adapt tests accordingly.
8879         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
8880         to `unsigned int'.
8881         Change type of `total_bytes' from `int' to `size_t',
8882         since the former wouldn't always be wide enough.
8883         Don't coerce safe_read return value to `int',
8884         and adapt tests accordingly.
8885         Now that testing for a read error no longer involves
8886         using `tmp', handle that case *after* freeing `tmp'.
8887         (start_bytes): Clean up.
8888         (tail_bytes): Now that `n_bytes' may be larger than
8889         OFF_T_MAX, test for that condition and, if it's true, don't
8890         use lseek optimizations.
8891         (parse_options): Don't fail just because N_UNITS is larger than
8892         the maximum size of a file -- tail may be applied to an input
8893         stream (e.g., a pipe) with more data than that.
8895         * Makefile.maint (syntax-check): Rename from alloc-check.
8896         Also check for SPACE-TAB sequences.
8897         Also check for malloc/calloc/realloc casts.
8899 2003-05-01  Jim Meyering  <jim@meyering.net>
8901         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
8903 2003-04-28  Jim Meyering  <jim@meyering.net>
8905         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
8906         make the now-more-picky tsort fail.
8908 2003-04-24  Jim Meyering  <jim@meyering.net>
8910         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
8911         (main): Minor syntactic clean-up.
8913         * src/tsort.c (tsort): Fail if the input contains an odd number of
8914         tokens.  Reported by junkio@cox.net.
8916         * tests/tsort/basic-1: Test for the above fix.
8918 2003-04-21  Jim Meyering  <jim@meyering.net>
8920         * tests/misc/printf: Add tests for the printf fixes below.
8922         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
8924 2003-04-20  Paul Eggert  <eggert@twinsun.com>
8926         Fix printf POSIX compatibility bug reported by Ben Harris in
8927         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
8928         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
8929         \0NNN in the %b operand.
8930         * src/printf.c (usage): Likewise.
8931         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
8932         is desired.  All uses changed.  Behave like Bash printf if %b
8933         operand uses \NNN where the initial N is not 0.
8935 2003-04-17  Jim Meyering  <jim@meyering.net>
8937         * src/stty.c: Remove uses of PROTOTYPE macro.
8939 2003-04-15  Jim Meyering  <jim@meyering.net>
8941         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
8942         each sequence of spaces before a TAB character.
8944 2003-04-13  Jim Meyering  <jim@meyering.net>
8946         * src/remove.c (is_empty_dir): Don't closedir (NULL).
8948 2003-04-12  Jim Meyering  <jim@meyering.net>
8950         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
8951         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
8952         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
8953         * src/nl.c (main): Fix those problems and remove literal quote marks
8954         (e.g., "`%s'") from format string; instead use "%s" in each format
8955         string and `quote (optarg)' as the corresponding argument.
8956         Also, diagnose all invalid command line options before failing.
8958         * src/nl.c (proc_text): Fix a bug that would make nl output extra
8959         newlines in some cases.  Details here: http://bugs.debian.org/177256.
8960         This bug was introduced on 2001-11-10 for textutils-2.0.17.
8961         * tests/misc/nl: Add test for the above-fixed bug.
8963         * tests/misc/readlink: New file.  Test the --canonicalize option.
8964         * tests/misc/Makefile.am (TESTS): Add readlink.
8966 2003-04-11  Jim Meyering  <jim@meyering.net>
8968         Clean up.
8969         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
8970         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
8971         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
8972         retain alignment) each sequence of spaces before a TAB character.
8974         * src/ls.c: Include <stdlib.h> unconditionally.
8976         * Makefile.maint (xalloc-check): Rename from header-check.
8978         * src/yes.c: Include error.h after system.h, not before.
8980         Clean up.
8981         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
8982         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
8983         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
8984         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
8985         * src/tr.c: * src/unexpand.c, src/users.c:
8986         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
8987         return values and of xrealloc's first argument.
8988         Fix the former with this:
8989         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
8991 2003-04-10  Jim Meyering  <jim@meyering.net>
8993         * src/stty.c (wrapf): Declare with format attribute.
8995         The S_MAGIC_... names shouldn't be maintained in two places (prior
8996         to this change, one would have to keep stat.c and fs.h in sync).
8997         This change makes it so those names and the corresponding
8998         hexadecimal constants all reside in stat.c.  fs.h is now generated.
8999         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
9000         (BUILT_SOURCES): Add fs.h, now that it's generated.
9001         (EXTRA_DIST): Add extract-magic.
9002         * src/extract-magic: New script to extract fs.h definitions from stat.c.
9003         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
9004         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
9006         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
9007         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
9009         * man/unexpand.x: Add `SEE ALSO' reference to expand.
9010         * man/expand.x: Add `SEE ALSO' reference to unexpand.
9011         Suggestion from Dan Jacobson.
9013 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
9015         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
9016         * src/stat.c (human_fstype): Handle Linux's devpts.
9018 2003-04-09  Paul Eggert  <eggert@twinsun.com>
9020         * src/split.c (line_bytes_split): Arg is of type size_t, since
9021         that's all that is supported for now.
9022         (main): Check for overflow in obsolescent line count option.
9024 2003-04-09  Jim Meyering  <jim@meyering.net>
9026         * tests/misc/split-fail: Add a new test for the above fix.
9028         * src/split.c (bytes_split): Use size_t temporary (rather than
9029         uintmax_t original) in remaining computations.  From Paul Eggert.
9031         Handle command line option arguments larger than 2^31.
9032         This allows e.g., splitting into files of size 2GB and larger,
9033         and running split --lines=N with N=2^31 or more.
9034         But for --line-bytes=N, the restriction that N <= SIZE_MAX
9035         remains (for now), due to the way it is implemented.
9037         * src/split.c: Include "inttostr.h".
9038         (bytes_split, lines_split, line_bytes_split, main):
9039         Use uintmax_t, not size_t, for file sizes.
9040         (main): Give a better diagnostic for option arguments == 0.
9041         Use umaxtostr to print file sizes.
9042         Reported by Luke Hassell.
9044 2003-04-08  Jim Meyering  <jim@meyering.net>
9046         * src/rm.c (usage): Mention that --directory (-d) works only
9047         on some systems.  Suggestion from Samuel Tardieu.
9049         * tests/basename/basic: Run $PERL to see if it is available,
9050         rather than testing its value.
9051         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
9052         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
9053         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
9054         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
9055         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
9056         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
9057         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
9058         * tests/sum/basic-1, tests/seq/basic: Likewise.
9060         * tests/misc/Makefile.am (TESTS): Add split-fail.
9061         * tests/misc/split-fail: New file.
9063         * src/split.c: Rename local variables: nchars -> n_bytes.
9064         (lines_split): Rename local, nlines -> n_lines.
9065         (main): Rename local variable: s/accum/n_units/.
9066         (main): Use STDIN_FILENO, not literal `0'.
9068 2003-04-07  Jim Meyering  <jim@meyering.net>
9070         * src/stat.c: Add #include directives for Ultrix 4.4.
9071         Based on a suggested change from Bert Deknuydt.
9073 2003-04-06  Jim Meyering  <jim@meyering.net>
9075         * Makefile.maint (makefile-check): New rule.
9076         (local-check): Add it.
9078 2003-04-05  Jim Meyering  <jim@meyering.net>
9080         * Makefile.am (nearly all of them):
9081         Use $(VAR) rather than @VAR@, now that we can rely on automake to
9082         emit a definition for each substituted variable.
9083         * tests/Makefile.am.in: Likewise.
9085         * tests/rm/rm5: Add a comment explaining why this test fails when
9086         using Tru64's broken sed.
9087         * tests/rm/rm3: Likewise.
9089         Make `kill -t' output signal descriptions (not `?') on Tru64.
9090         * src/kill.c (sys_siglist): Also check for __sys_siglist.
9091         Patch by Tony Leneis.
9092         * configure.ac: Also check for declaration of __sys_siglist.
9093         Required for Tru64 4.0D, 4.0F, and 5.1.
9094         Reported by Tony Leneis.
9096 2003-04-04  Jim Meyering  <jim@meyering.net>
9098         * src/Makefile.am (PERL): Remove unnecessary definition.
9100         Because of inappropriate (but POSIX-mandated) behavior of rename,
9101         `mv a b' would not remove `a' in some unusual cases.  Work around
9102         this by unlinking `a' when necessary.
9104         * src/copy.c (same_file_ok): Add an output parameter.
9105         Set it in the offending case.
9106         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
9107         Reported by Ed Avis.
9108         * tests/mv/hard-4: New test for the above.
9109         * tests/mv/Makefile.am (TESTS): Add hard-4.
9111         Clean up rules for automatically generated sources:
9112         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
9113         Make each generated file be read-only.
9114         Add each file name to BUILT_SOURCES separately.
9115         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
9117         Put LOCALEDIR macro definition in new file: localedir.h.
9118         * src/Makefile.am (DEFS): Remove definition.
9119         (localedir.h): New rule.
9120         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
9121         * src/system.h: Include "localedir.h".
9123 2003-04-02  Jim Meyering  <jim@meyering.net>
9125         * Version 5.0.
9127         * tests/misc/Makefile.am (TESTS): Add false.
9129         * Makefile.maint (TMPDIR): Make sure it's defined.
9130         (my-distcheck): Build in $(TMPDIR), not `.'.
9132         * src/Makefile.am (false.c): Change all occurrences of
9133         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
9134         unsuccessfully also with --help.  Reported by Paul Jarc,
9135         * tests/misc/false: New test for the above.
9137 2003-03-30  Jim Meyering  <jim@meyering.net>
9139         * NEWS: Note the location of older NEWS files.
9141         * src/remove.c (is_empty_dir): Don't let a failing closedir
9142         clobber errno.  Spotted by Arnold Robbins.
9144         * src/env.c: Fix typo in comment.  From Arnold Robbins.
9146 2003-03-29  Jim Meyering  <jim@meyering.net>
9148         * Version 4.5.12.
9150         * README: Note to expect build problems for stat.c on Ultrix 4.3.
9151         Note that there are some harmless test failures when running
9152         `make check' as root on some systems.
9154 2003-03-28  Jim Meyering  <jim@meyering.net>
9156         * tests/stty/row-col-1: Skip this test if stty can't get window size.
9157         This happens when connecting to sparc-solaris5.7 via ssh from within
9158         emacs.  Reported by Karl Berry.
9160         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
9161         Otherwise, on systems (DJGPP) that emulate pipes using files,
9162         this test would never complete, waiting for `yes' to terminate.
9163         * tests/du/slink: As above, use seq, not `yes' to generate link target.
9164         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
9165         Reported by Rich Dawe.
9167 2003-03-27  Jim Meyering  <jim@meyering.net>
9169         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
9170         from `written by...' comment, at his request.
9172 2003-03-24  Paul Eggert  <eggert@twinsun.com>
9174         Fix buffer overrun problem reported by TAKAI Kousuke, along
9175         with some other POSIX incompatibilities.
9177         * src/printf.c (print_esc): Do not treat \x specially if
9178         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
9179         in backslash.  Treat incomplete escape sequences as strings
9180         of characters, as POSIX requires.
9181         (print_formatted): Allow multiple flags.  Avoid buffer overrun
9182         if the format is incomplete.
9184 2003-03-24  Jim Meyering  <jim@meyering.net>
9186         * tests/misc/printf: Add tests for the above fixes and changes.
9188 2003-03-26  Jim Meyering  <jim@meyering.net>
9190         * src/copy.h (struct cp_options): Add a comment.
9192 2003-03-23  Jim Meyering  <jim@meyering.net>
9194         * README: Describe problem with 64-bit mode on HPUX 11.x,
9195         with patch for /usr/include/inttypes.h.
9196         * TODO: Plan to add an autoconf test to work around the bug.
9198 2003-03-22  Jim Meyering  <jim@meyering.net>
9200         * src/stat.c: Don't include <sys/sysmacros.h>.
9201         That is already done via system.h.  Otherwise, the multiple
9202         inclusion would evoke redefinition warnings from Cray's /bin/cc,
9203         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
9204         (human_fstype): Factor some directives `up', out of this function.
9205         Cast away `const' to avoid error from Cray's /bin/cc.
9207 2003-03-20  Jim Meyering  <jim@meyering.net>
9209         * announce-gen (print_changelog_deltas): Ensure that a newline
9210         precedes each row of `*'s.
9212 2003-03-20  Jim Meyering  <jim@meyering.net>
9214         * Version 4.5.11.
9216         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
9217         format flag characters.
9218         Do not require that a field width be specified.
9219         Do not fail when given a field width of `0'.
9220         Reported by Dan Jacobson.
9221         * tests/seq/basic: Add new tests for the above-fixed bug.
9223         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
9224         (install-root): Likewise.
9225         (install-exec-local): Likewise.
9226         Based on a patch from Richard Dawe.
9228 2003-03-19  Jim Meyering  <jim@meyering.net>
9230         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
9231         because the DJGPP 2.03 port of 'ln -s' doesn't work.
9232         Include $(EXEEXT) in program names.
9233         Since $(LN_S) may degenerate to `cp -p', be careful
9234         to invoke it from the destination directory.
9235         Mostly from Richard Dawe.
9236         * configure.ac: Use AC_PROG_LN_S.
9238         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
9239         CDPATH shell variable set could cause this test to fail.
9240         Reported by Karl Berry.
9242 2003-03-18  Jim Meyering  <jim@meyering.net>
9244         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
9245         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
9246         AIX 5.1's xlc could not compile the former.
9247         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
9249 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
9251         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
9252         program names, since automake only adds $(EXEEXT) to programs
9253         in its *_PROGRAMS.
9255 2003-03-16  Jim Meyering  <jim@meyering.net>
9257         * src/remove.c (rm): Put two local variables in static storage,
9258         so they can't be clobbered by the potential longjmp.
9260 2003-03-15  Jim Meyering  <jim@meyering.net>
9262         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
9263         so that a version number with a two-digit component can still count
9264         as an alpha release.  Reported by Richard A Downing.
9265         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
9267 2003-03-14  Jim Meyering  <jim@meyering.net>
9269         * src/ansi2knr.c: Remove no-longer-used file.
9270         * src/ansi2knr.1: Likewise.
9272         * Makefile.maint (prev_version_file): Don't use ?= for this particular
9273         assignment, since it causes trouble with old versions of GNU make
9274         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
9275         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
9276         Patch from Alexandre Duret-Lutz.
9278         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
9279         subdirectories so that each includes a definition of ACLOCAL_M4.
9281         * announce-gen (main): Label the compressed source URLs.
9283         * Version 4.5.10.
9285         * tests/du/slink: Relax the test for the `local'ness of a file system,
9286         so that now it works also for tmpfs.
9288         * tests/du/hard-link: Transform output from first du, so that this
9289         test doesn't fail on file systems like tmpfs that order directory
9290         entries differently.
9292 2003-03-13  Jim Meyering  <jim@meyering.net>
9294         * tests/du/8gb: Work around what appears to be an NFS failure that
9295         would make this test fail on some systems.
9297 2003-03-11  Jim Meyering  <jim@meyering.net>
9299         * tests/du/basic: Make the test file exactly 4k bytes long.
9301         * src/split.c (longopts): Don't hard-code `2' here.
9302         Instead, just specify `&verbose', and ...
9303         (main): ... remove the `case 2:' block for --verbose.
9305         * tests/du/basic: Make the test file larger than 64 bytes, so that
9306         we don't immediately disqualify file systems (e.g., NetApp) on which
9307         smaller files take up zero disk blocks.  Reported by Vin Shelton.
9309 2003-03-10  Jim Meyering  <jim@meyering.net>
9311         Don't segfault for a negative field width or precision in format string.
9312         Note that this is just a stopgap fix.  The longer term solution may
9313         involve adapting bash's builtins/printf.def.
9315         * src/printf.c: (UNSPECIFIED): Define.
9316         (print_direc): Use the special value, UNSPECIFIED, to indicate
9317         that field_width or precision has not been specified.
9318         (print_formatted): Fail if field_width or precision is the
9319         special value, UNSPECIFIED.
9320         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
9322         * src/sys2.h (INT_MIN): Define, if necessary.
9323         * tests/misc/printf: Add a test for the above-fixed bug.
9325 2003-03-09  Jim Meyering  <jim@meyering.net>
9327         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
9328         changing its sign.  This avoids a warning from gcc on 64-bit systems.
9329         Reported by Bob Proulx.
9330         (pop_dir): Reverse order of sign change and cast, to be consistent
9331         with the above.
9333 2003-03-08  Jim Meyering  <jim@meyering.net>
9335         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
9336         shell variable, but only in the environment.  With /bin/sh->bash, the
9337         shell variable is set to `y', and that would cause a spurious warning.
9338         Reported by Bob Proulx.
9340         * tests/Makefile.am (check-root): Remove touch/fifo.
9341         It doesn't appear to have to be run as root.
9343         * tests/rm/fail-2eperm: Rather than simply using the first non-root
9344         user name, make sure that the selected user name has a usable shell.
9345         Reported by Paul Jarc.
9347         Before, when using shred on a device, one had to specify --exact,
9348         or be careful to choose a size that would not be rounded up and
9349         exceed the maximum value;  that could result in a failure of
9350         the final write.
9351         * src/shred.c (do_wipefd): --exact is now the default for non-regular
9352         files.  Suggestion from Ben Elliston.
9353         (usage): Say it.
9355         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
9356         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
9357         Patch by Bob Proulx.
9359         * src/Makefile.am (check-misc): Check for use of `defined' in
9360         #define directives.
9361         Change to $(srcdir) before running grep.
9363         * src/sleep.c: Remove now-unused #include and #define directives.
9365         * src/du.c (process_file): If a file's size is not being counted
9366         e.g., because it's a hard link to a file we've already counted,
9367         then don't print a line for it.
9369         * tests/du/hard-link: New test for the above-fixed bug.
9370         * tests/du/Makefile.am (TESTS): Add hard-link.
9372         `du -S' didn't work
9373         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
9374         and make the two-array approach work.
9376         * tests/du/basic: Correct/add tests for the above fix.
9377         Set LC_ALL, etc., now that we use sort.
9378         Check the block/size of a small file, too.
9379         Correct expected results for simple dir1/dir2/file case.
9380         Add another test of du -S.
9382 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
9384         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
9385         middle-end/9986).  As one of GCC's optimizations, it transforms a
9386         fputs_unlocked call to a fputc_unlocked call when the string is
9387         one character long.  However, hpux doesn't have fputc_unlocked.
9389         * expr.c (usage): Use putchar, not fputs, to output a single character.
9390         * ls.c (dired_dump_obstack): Likewise.
9391         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
9392         * stat.c (print_it): Likewise.
9394 2003-03-07  Jim Meyering  <jim@meyering.net>
9396         * src/cp.c: Remove everything associated with mmap-stack.c.
9397         This reverts the two changes of 2003-02-21.
9398         * src/du.c: Remove everything associated with mmap-stack.c.
9399         This reverts the change of 2003-02-19.
9401 2003-03-06  Jim Meyering  <jim@meyering.net>
9403         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
9404         CDPATH shell variable set could cause this test to fail.
9405         Reported by Karl Berry.
9407 2003-03-05  Jim Meyering  <jim@meyering.net>
9409         * Version 4.5.9.
9411         * src/printf.c (print_esc): Remove pointless comparison of unsigned
9412         integer with zero, to avoid a warning from Intel's ecc.
9413         Reported by Nelson Beebe.
9415         * src/du.c (process_file): Sizes must all be of type uintmax_t.
9416         Otherwise, for files or totals that are too big, numbers would
9417         be truncated.  Patch mostly by Michael Stone.
9418         Reported by Ingo Saitz as Debian bug #183210.
9420         * tests/du/8gb: New test for the above-fixed bug.
9421         * tests/du/Makefile.am (TESTS): Add 8gb.
9423         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
9424         rather than UTILS_OPEN_MAX - 10.
9426 2003-03-04  Jim Meyering  <jim@meyering.net>
9428         * README: Refer new feature discussion to bug-coreutils@gnu.org,
9429         rather than bug-gnu-utils, now that the former is better known.
9430         Suggestion from Göran Uddeborg.
9432         * src/stat.c (usage): Capitalize consistently.
9433         Reported by Göran Uddeborg.
9435         * Makefile.maint (rel-files): Include $(signatures), so that
9436         those files are also copied into $(release_archive_dir).
9438         * src/df.c (find_mount_point): Call error here, now that restore_cwd
9439         no longer does it.
9440         * src/remove.c (AD_pop_and_chdir): Likewise.
9442         * tests/Makefile.am (check-root): Add fail-2eperm.
9444 2003-03-03  Jim Meyering  <jim@meyering.net>
9446         * src/remove.c (remove_cwd_entries): Include the full filename of
9447         the offending file, not just the basename.
9449         * tests/misc/tty-eof: Set $ME properly.
9451         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
9452         Remove now-unused variables.
9453         (tag-prev-version, prev-cvs-tag): Likewise.
9455         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
9456         accurate diagnostic when failing to remove a file owned by some other
9457         user.  Reported by Ivo Timmermans via Michael Stone.
9458         This fixes Debian bug# 178471.
9460         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
9461         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
9462         Based on a report from Ivo Timmermans.
9464 2003-03-02  Jim Meyering  <jim@meyering.net>
9466         * src/copy.c (copy_internal) [un_backup]: When recovering from a
9467         failure to create a hard link, do not remove the entry associating
9468         the source dev/ino with the destination file name.
9469         * tests/mv/Makefile.am (TESTS): Add hard-3.
9470         * tests/mv/hard-3: New test, for the above-fixed bug.
9471         Inspired by a report from Iida Yosiaki.
9473 2003-03-01  Jim Meyering  <jim@meyering.net>
9475         * src/df.c (print_header): Don't embed spaces in a separate `Type'
9476         header string.  Instead, put `Filesystem' and `Type' headers in the
9477         same string, so translators can use horizontal space as needed.
9478         Reported by Jean Charles Delepine.
9480 2003-02-28  Jim Meyering  <jim@meyering.net>
9482         * src/copy.c (copy_internal): When link fails because of an
9483         existing destination file, unlink that file and try again.
9484         Reported by Iida Yosiaki.
9486         * tests/mv/Makefile.am (TESTS): Add hard-2.
9487         * tests/mv/hard-2: New test for the above-fixed bug.
9488         Based on a test case from Iida Yosiaki.
9490 2003-02-26  Jim Meyering  <jim@meyering.net>
9492         * tests/du/basic: Don't test du's -b option here.  Directory byte
9493         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
9494         and IBM AIX 4.2.  Reported by Nelson Beebe.
9496 2003-02-25  Jim Meyering  <jim@meyering.net>
9498         * Makefile.maint (announcement): Now that ChangeLog entries
9499         are output by announce-gen, don't do it here.
9500         * announce-gen (print_changelog_deltas): New function.
9501         (main): Use it.
9503 2003-02-22  Jim Meyering  <jim@meyering.net>
9505         * announce-gen: New option: --release-type=TYPE
9506         * Makefile.maint (beta, major): New targets.  Remove `release'.
9507         Put them all together on a line.
9508         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
9509         invocation of `announcement'.
9510         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
9512         * announce-gen: New option: --news=NEWS_FILE.
9513         Extract NEWS entries here, not via rules in Makefile.maint.
9514         * Makefile.maint (announcement): Now that NEWS entries are
9515         extracted by announce-gen, don't do it here.
9516         (news-r1, news-r2): Remove now-unused definitions.
9518 2003-02-21  Jim Meyering  <jim@meyering.net>
9520         * Version 4.5.8.
9522         Merge in changes from autoconf's version of this file.
9523         * Makefile.maint (www-gnu): Define.
9524         (standards.texi-url_prefix): Use $(www-gnu).
9525         (make-stds.texi-url_prefix): Likewise.
9527         * src/cp.c: Include "mmap-stack.h".
9528         (main): Invoke `run' through a macro that (when possible) runs it
9529         with a large, mmap'd stack.
9531         * src/cp.c (run): New function, preparing for the above.
9532         Exit from this function, not from main
9533         (main): Call run.
9535         * src/du.c: New option: --apparent-size.
9536         (enum) [APPARENT_SIZE_OPTION]: New member.
9537         (long_options): Add it.
9538         (usage): Describe it.
9539         (main): Handle it.
9540         ['b']: Set apparent_size.
9541         David Eisner reported that the behavior of --bytes had changed.
9542         Paul Eggert proposed the use of a new option, --apparent-size.
9544         * src/du.c (apparent_size): New global.
9545         (print_only_size): Reflect the fact that we're printing byte counts,
9546         not ST_NBLOCKSIZE-byte-block counts.
9547         (print_size): Call print_only_size rather than duplicating its code.
9548         (process_file): Accumulate byte counts, rather than block counts.
9550         * src/du.c (process_file): Always reset size_to_propagate_to_parent
9551         for --separate-dirs (-S).
9553 2003-02-20  Jim Meyering  <jim@meyering.net>
9555         * Use automake-1.7.3.  Regenerate dependent files.
9557         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
9558         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
9559         (usage) [%B]: Describe it.
9560         [%b]: Refer to %B.
9562         * src/du.c (process_file): Reorganize the code to use only
9563         one `sum' array, and change how -S works back to the way it was
9564         before 2003-01-31.  Patch by Bruno Haible.
9566         * tests/du/basic: New test.
9567         * tests/du/Makefile.am (TESTS): Add basic.
9569         * tests/envvar-check: Add checks for the following:
9570         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
9572         * tests/Makefile.am: Rename phony target envvar-check to evar-check
9573         so as not to conflict with the distributed file by the same name.
9575         * src/du.c (process_file): Set info->skip before any possible return.
9577         Report correct usage for directories, not 0.
9578         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
9579         _before_ recording the dev/ino of a directory.
9580         Reported by Bruno Haible.
9582         Now, df always displays the device file name corresponding to the
9583         listed mount point under `Filesystem'.  Before, for an unmounted
9584         block- or character-special file argument, it would display the
9585         command-line argument instead.
9586         * src/df.c (show_disk): Return a value indicating whether
9587         there was a match.  Don't try to find a mount point here.
9588         (show_entry): If show_disk doesn't find a match, call show_point.
9590 2003-02-19  Jim Meyering  <jim@meyering.net>
9592         * src/du.c: Include "mmap-stack.h".
9593         (du_files): Add prototype with ATTRIBUTE_NORETURN.
9594         Exit from this function, not from...
9595         (main): ...here.
9596         Instead, if possible, invoke du_files through a macro that
9597         runs it with a large, mmap'd stack.
9599         * src/join.c (usage): Change wording in --help output:
9600         use FILENUM instead of `SIDE' and say what FILENUM means.
9601         Reported by Bernhard Gabler.
9603         * src/df.c (print_header): Rather than using a hard-coded literal
9604         string of spaces matching the length of the English `...Type' header,
9605         output the right number of spaces to match the selected translation.
9606         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
9608         * src/split.c (bytes_split): Remove unnecessary `else' after break.
9609         (lines_split): Likewise.  and correct misleading indentation.
9611         * src/split.c: Include "full-read.h".
9612         (bytes_split, lines_split, line_bytes_split): Use full_read,
9613         not safe_read.   The way split was using the latter, a short read
9614         could cause split to terminate before EOF.
9616         * tests/misc/tty-eof: Test all programs that can read stdin,
9617         requiring no arguments and that write to standard output.
9619         * tests/misc/tty-eof: New file.  Renamed from ...
9620         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
9621         * tests/misc/Makefile.am (TESTS): Reflect renaming.
9623 2003-02-18  Jim Meyering  <jim@meyering.net>
9625         cksum would perform an extra read after encountering EOF
9626         * src/cksum.c (cksum): Exit the loop upon EOF, too.
9627         Patch by Michael Bacarella.
9629         Test for the bug fixed today in cksum, md5sum, and sha1sum.
9630         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
9631         cat, cksum, md5sum, and sha1sum all in the same loop.
9633 2003-02-14  Jim Meyering  <jim@meyering.net>
9635         * src/remove.c: Include "euidaccess.h".
9636         Remove declaration of euidaccess.
9638 2003-02-12  Jim Meyering  <jim@meyering.net>
9640         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
9641         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
9643 2003-02-10  Jim Meyering  <jim@meyering.net>
9645         * src/test.c: Don't include group-member.h.
9646         Include euidaccess.h.
9647         (eaccess): Rewrite function to set the real uid and gid temporarily
9648         to the effective uid and gid, then invoke 'access', and then set the
9649         real uid and gid back.  On systems that lack setreuid or setregid,
9650         fall back on the kludges in euidaccess.  Before, it would not work
9651         for e.g., files with ACLs, files that were marked immutable,
9652         or on file systems mounted read-only.  Nelson Beebe raised the issue.
9653         Paul Eggert suggested the new implementation.
9655 2003-02-09  Jim Meyering  <jim@meyering.net>
9657         * src/test.c (test_stat): Remove function.  It's job is done (only
9658         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
9660 2003-02-08  Jim Meyering  <jim@meyering.net>
9662         * Version 4.5.7.
9664         * tests/mv/part-symlink: Don't assume that the file owner username
9665         length is less than 9 in ls output: instead, omit that field
9666         altogether.  Reported by, and suggested fix from, Ferdinand.
9668         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
9669         * tests/du/Makefile.am (TESTS): Add restore-wd.
9671         * src/rm.c: Correct now-invalid comment about cycle-detection.
9673 2003-02-06  Jim Meyering  <jim@meyering.net>
9675         * NEWS: Add entries from old/*/NEWS
9676         from fileutils-4.1 through 4.1.11 and
9677         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
9679         * Version 4.5.6.
9681         * src/du.c (process_file): Don't return early for excluded files
9682         or for files whose dev/inode we've already seen.
9684 2003-02-05  Jim Meyering  <jim@meyering.net>
9686         * tests/du/exclude: New file.
9687         * tests/du/Makefile.am (TESTS): Add exclude.
9689 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
9691         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
9692         Fix memory allocation arithmetic.
9694 2003-02-04  Jim Meyering  <jim@meyering.net>
9696         `df /dev/block-or-char-device-file--not-mounted' now reports
9697         the name of the file system on which the file resides, usually `/'.
9698         Before, it would leave the `Mounted on' field blank.
9699         * src/df.c (show_disk): Move function to precede find_mount_point.
9700         (show_disk): Add parameter: STATP.
9701         If we don't find a matching device name, then resort to calling
9702         find_mount_point.  Reported by Bob Proulx.
9704 2003-02-03  Andreas Schwab  <schwab@suse.de>
9706         * tests/rm/cycle: Require non-root.
9707         * tests/rm/isatty: Likewise.
9709 2003-02-02  Jim Meyering  <jim@meyering.net>
9711         * Version 4.5.5.
9713         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
9715         Ensure that there are no offending uses of `:'.
9716         * Makefile.maint (makefile_path_separator_check): New rule.
9717         (local-check): Add it to the list.
9719 2003-02-01  Jim Meyering  <jim@meyering.net>
9721         * src/du.c (MAX_N_DESCRIPTORS): Define.
9723         * src/stat.c (G_fail): New global.
9724         (human_time): Diagnose failed localtime, not failed nstrftime.
9725         (main): Fail if G_fail is set.
9727 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
9729         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
9730         hard-coding the path-separator.  Also double-quote the new PATH,
9731         to avoid problems when the path-separator is a semi-colon or when
9732         `pwd` contains e.g. a space.
9733         * tests/chgrp/Makefile.am: Likewise.
9734         * tests/chmod/Makefile.am: Likewise.
9735         * tests/chown/Makefile.am: Likewise.
9736         * tests/cp/Makefile.am: Likewise.
9737         * tests/dd/Makefile.am: Likewise.
9738         * tests/dircolors/Makefile.am: Likewise.
9739         * tests/du/Makefile.am: Likewise.
9740         * tests/expr/Makefile.am: Likewise.
9741         * tests/factor/Makefile.am: Likewise.
9742         * tests/fmt/Makefile.am: Likewise.
9743         * tests/install/Makefile.am: Likewise.
9744         * tests/ln/Makefile.am: Likewise.
9745         * tests/ls/Makefile.am: Likewise.
9746         * tests/ls-2/Makefile.am: Likewise.
9747         * tests/md5sum/Makefile.am: Likewise.
9748         * tests/misc/Makefile.am: Likewise.
9749         * tests/mkdir/Makefile.am: Likewise.
9750         * tests/mv/Makefile.am: Likewise.
9751         * tests/od/Makefile.am: Likewise.
9752         * tests/rm/Makefile.am: Likewise.
9753         * tests/rmdir/Makefile.am: Likewise.
9754         * tests/seq/Makefile.am: Likewise.
9755         * tests/sha1sum/Makefile.am: Likewise.
9756         * tests/shred/Makefile.am: Likewise.
9757         * tests/stty/Makefile.am: Likewise.
9758         * tests/sum/Makefile.am: Likewise.
9759         * tests/tail-2/Makefile.am: Likewise.
9760         * tests/touch/Makefile.am: Likewise.
9761         * tests/tsort/Makefile.am: Likewise.
9762         * tests/unexpand/Makefile.am: Likewise.
9764 2003-01-31  Jim Meyering  <jim@meyering.net>
9766         * src/stat.c: Include "file-type.h"
9767         (print_human_type): Remove function.
9768         (human_access): Rename from print_human_access.  Return a string.
9769         (human_time): Rename from print_human_time.  Return a string.
9770         (print_stat): Arrange so that field width and an alignment specifier
9771         are honored for the %A, %F, %x, %y, and %z formats.
9772         [%F]: Use file_type; this gives slightly different file type strings,
9773         e.g., `directory' instead of `Directory' and `regular file' or
9774         `regular empty file' instead of `Regular file'.
9775         Prompted by a report from Richard Dawe that the uses of
9776         S_IFSOCK and S_IFIFO in print_human_time were not portable
9777         to systems using e.g., DJGPP.
9779 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
9781         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
9782         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
9784 2003-01-31  Jim Meyering  <jim@meyering.net>
9786         * src/du.c (main): Upon processing an invalid option or an invalid
9787         --exclude-from or --max-depth option argument, don't exit right away,
9788         in case there are others.  Rather record the failure and exit after
9789         processing other options.
9791         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
9792         tar archive easier to reproduce.
9794         Rewrite to perform directory traversal using nftw.
9796         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
9797         (AUTHORS): Add self.
9798         (opt_one_file_system): Move global into `main'.
9799         (path, xstat, exit_status): Remove declarations.
9800         (arg_length, suffix_length): New globals.
9801         (G_fail): New global, sort of like the old `exit_status'.
9802         (IS_FTW_DIR_TYPE): Define.
9803         (print_only_size): New function.
9804         (process_file): New function.
9805         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
9806         (str_trunc, pop_dir, count_entry): Likewise.
9807         (du_files): Rewrite to use nftw.
9809 2003-01-30  Jim Meyering  <jim@meyering.net>
9811         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
9812         symlink-to-directory with -L, even without the trailing slash.
9814 2003-01-27  Jim Meyering  <jim@meyering.net>
9816         * src/Makefile.am (check-misc): Check for st_blocks, too.
9818         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
9819         Reported by Richard Dawe.
9821 2003-01-27  Andreas Schwab  <schwab@suse.de>
9823         * src/ls.c (quote_name): Add fourth parameter, width, into which to
9824         store the screen columns, and return the number of bytes instead.
9825         (print_dir): Pass NULL as fourth parameter of quote_name.
9826         (print_name_with_quoting): Likewise.
9827         (length_of_file_name_and_frills): Get the width from the fourth
9828         parameter of quote_name instead of return value.
9830 2003-01-27  Jim Meyering  <jim@meyering.net>
9832         * src/ls.c (decode_switches): If `dired' is set without
9833         `format == long_format', then silently reset dired.  This doesn't
9834         change the behavior of ls (all prior uses of dired were protected
9835         by `&& format == long_format'), and lets us...
9836         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
9837         (PUSH_CURRENT_DIRED_POS): Likewise.
9838         (main): Likewise.
9840 2003-01-22  Jim Meyering  <jim@meyering.net>
9842         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
9843         * tests/du/Makefile.am (TESTS): Add no-x.
9845 2003-01-21  Jim Meyering  <jim@meyering.net>
9847         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
9848         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
9849         it may still be a directory -- or not (e.g., with FreeBSD on an
9850         NFS-mounted file system), so resort to calling lstat to find out.
9851         Based on a patch by Michael van Elst.
9853         * tests/cp/same-file: Don't assume that the file owner username
9854         length is less than 9 in ls output: instead, omit that field
9855         altogether.  Reported by, and suggested fix from, Ferdinand.
9857 2003-01-20  Jim Meyering  <jim@meyering.net>
9859         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
9860         large format widths no longer cause strftime to infloop.
9862         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
9864 2003-01-19  Jim Meyering  <jim@meyering.net>
9866         * src/readlink.c: Include "canonicalize.h".
9868 2003-01-18  Jim Meyering  <jim@meyering.net>
9870         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
9871         New member.
9872         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
9873         (long_options): Add option --dereference-command-line-symlink-to-dir.
9874         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
9875         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
9876         -d, -F, -l options is specified.
9877         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
9878         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
9879         Change --dereference-command-line (-H) to dereference *all*
9880         command line arguments, including broken symlinks.
9882 2003-01-15  Paul Eggert  <eggert@twinsun.com>
9884         Change ls -H back to the way it was yesterday, since this is
9885         compatible with FreeBSD and the POSIX spec is confusing
9886         and somewhat contradictory.
9888         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
9889         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
9890         (long_options): Change the long option name back.
9891         (usage): Change the usage back.
9892         (gobble_file): When -H is specified, dereference a top-level
9893         arg even if it points to a non-directory.
9895 2003-01-15  Jim Meyering  <jim@meyering.net>
9897         * src/ls.c (gobble_file): Fall back on using lstat when required:
9898         when --dereference (-L) is not specified, and
9899         - when operating on a dangling symlink
9900         - when operating on command-line-symlink-to-directories
9901         This fixes numerous problems.  Here are examples:
9902         - `ls dangling-symlink' would fail with `no such file...'
9903         Now it prints `dangling-symlink'.
9904         - `ls -i symlink' would mistakenly print the inode of the referent.
9905         Now it prints the inode of the symlink.  Likewise for --size (-s).
9906         Based on a patch from Michael Stone.
9907         Reported by Deepak Goel as Debian bug #173793.
9909         Rename ls's --dereference-command-line (-H)
9910         option to   --dereference-command-line-symlink-to-dir.
9911         * src/ls.c [enum Dereference_symlink]
9912         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
9913         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
9914         (long_options): Rename the long option.
9915         (usage): Say that --dereference-... changes how ls treats
9916         only symlinks to directories specified on the command line.
9918 2003-01-14  Jim Meyering  <jim@meyering.net>
9920         * tests/ls/dangle: New file/test, for the above fix.
9921         * tests/ls/inode: Another new file/test, for the above fix.
9922         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
9924         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
9925         so that ls --color would no longer highlight the names of files with
9926         the execute bit set when not specified on the command line.
9927         Patch by Michael Stone.  Reported by Stephen Depooter as
9928         Debian bug 175135.
9930         * tests/ls-2/tests (color-exe): New test, for the above fix.
9932 2003-01-13  Jim Meyering  <jim@meyering.net>
9934         * tests/shred/exact: Also test for just fixed bug with --zero.
9936         * src/shred.c (long_opts): --zero does not require an argument.
9937         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
9939 2003-01-12  Jim Meyering  <jim@meyering.net>
9941         * Makefile.maint (cvs-update): Skip any file with local modifications.
9943         * src/unexpand.c (usage): Document --first-only and mention that
9944         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
9946 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
9948         * src/df.c: Include "canonicalize.h".
9949         Use canonicalize_file_name unconditionally.
9951 2003-01-09  Jim Meyering  <jim@meyering.net>
9953         * README: Add readlink.
9955 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9957         * src/df.c: Include "xgetcwd.h".
9958         * src/pwd.c: Likewise.
9960 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9962         * src/shred.c: Remove declaration of xstrdup.
9963         We already get it via xalloc.h which is included via system.h.
9965 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
9967         New program: readlink.
9969         * src/Makefile.am (bin_PROGRAMS): Add readlink.
9970         * src/readlink.c: New file.
9972         * man/readlink.x: New file.
9973         * man/Makefile.am (dist_man_MANS): Add readlink.1.
9974         (readlink.1): New rule.
9976 2003-01-09  Jim Meyering  <jim@meyering.net>
9978         When selecting ranges of byte offsets (as opposed to ranges of fields)
9979         and when --output-delimiter=STRING is specified, output STRING between
9980         ranges of selected bytes.
9981         * src/cut.c (RANGE_START_SENTINEL): Define.
9982         (output_delimiter_specified): New global.
9983         (print_kth): Add parameter.  Adjust all callers.
9984         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
9985         (cut_bytes): When requested, output STRING between ranges of
9986         selected bytes.
9987         (main): Make a diagnostic a little clearer.
9988         Based on a patch from Jan Nieuwenhuizen.
9990         * tests/cut/Test.pm: New tests for the above.
9992         * src/cut.c (set_fields): Make code agree with comment:
9993         Don't merge abutting ranges like 4- and 2-3.  This makes no
9994         difference currently, but is required to support an upcoming change.
9996 2003-01-07  Jim Meyering  <jim@meyering.net>
9998         * src/cut.c (set_fields): Fix typo in comment.
10000         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
10001         * tests/touch/Makefile.am (TESTS): Add not-owner.
10002         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
10003         Now, this tests only the nonexistent-directory diagnostic.
10004         Suggestion from Michael Stone.
10006         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
10008 2003-01-04  Jim Meyering  <jim@meyering.net>
10010         * src/copy.h: Remove use of PARAMS.
10011         * src/remove.h: Likewise.
10012         * src/chown-core.h: Likewise.
10014         rm could be tricked into mistakenly reporting a cycle.
10015         * src/remove.c: [cycle_check_state]: New global.
10016         (remove_cwd_entries): Adapt to new semantics of cycle_check.
10017         (rm): Call cycle_check_init and cycle_check_free for each file.
10018         * tests/rm/cycle (rm): New test, for the above fix.
10019         * tests/rm/Makefile.am (TESTS): Add cycle.
10021         When rm detects a cycle, don't abort the entire command,
10022         but rather just the affected command line argument.
10023         * src/remove.c: Include <setjmp.h>
10024         (struct dirstack_state) [current_arg_jumpbuf]: New member.
10025         (remove_cwd_entries): Call longjmp if we detect a cycle.
10026         (rm): Call setjmp here.
10028         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
10029         Instead, include cycle-check.h and use it.
10031         * src/remove.h (struct dev_ino): Remove declaration.
10033         * src/remove.c (remove_cwd_entries): Fix typos in comment.
10035         Don't include trailing /. in diagnostics about directories.
10036         * src/remove.c (full_filename_): When FILENAME is just `.'
10037         and there is a nonempty directory-name part, don't append `/.'.
10038         * tests/rm/unread2: Remove trailing /. from diagnostic.
10039         * tests/rm/rm2: Likewise.
10041         * src/remove.c (struct dirstack_state): Define.
10042         To be used in place of these file-scoped globals ...
10043         (dir_stack, len_stack, Active_dir): Remove globals.
10044         (ds_init, ds_free): New functions.
10045         (full_filename): Define.
10046         (full_filename_): Rename from full_filename.
10048         Begin to make AD_* functions more generic.
10049         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
10050         (AD_push): Likewise.
10051         (AD_INIT_OTHER_MEMBERS): Define.
10052         (remove_dir): Define the `status' member manually after each
10053         call to AD_push or AD_push_initial.
10055         * src/Makefile.am (check-misc): New rule, to ensure that no more
10056         S_IS* macro definitions sneak into the code.
10057         (check): Depend on check-misc.
10059         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
10060         * src/du.c (count_entry) [S_ISLNK]: Don't define.
10061         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
10063 2003-01-03  Jim Meyering  <jim@meyering.net>
10065         * src/true.c: Add copyright.
10066         (AUTHORS): I suppose I've written it.
10068         * src/Makefile.am (false.c): Make the generated file be read-only.
10070 2003-01-04  Jim Meyering  <jim@meyering.net>
10072         * src/ls.c: Include "dev-ino.h".
10073         [struct dev_ino]: Remove declaration.
10075 2003-01-02  Jim Meyering  <jim@meyering.net>
10077         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
10078         from mv: s/missing file arguments/missing file argument/.
10079         With --target-directory=DIR, cp and mv work with a single file argument.
10080         Reported by Karl Berry.
10082         * tests/rm/isatty: Enable this test.
10084 2002-12-31  Jim Meyering  <jim@meyering.net>
10086         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
10087         (AD_push): Likewise.
10088         (AD_INIT_OTHER_MEMBERS): Define.
10089         (remove_dir): Define the `status' member manually after each
10090         call to AD_push or AD_push_initial.
10092         * src/ls.c [struct dev_ino]: Remove definition.
10093         Include "dev-ino.h" instead.
10095 2002-12-28  Jim Meyering  <jim@meyering.net>
10097         * tests/du/Makefile.am (TESTS): Add no-deref.
10098         * tests/du/no-deref: New script.
10100 2002-12-23  Jim Meyering  <jim@meyering.net>
10102         * src/remove.c (remove_cwd_entries): Fix typo in comment.
10104 2002-12-21  Jim Meyering  <jim@meyering.net>
10106         * announce-gen: Generate MML-formatted announcement.
10107         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
10109 2002-12-20  Jim Meyering  <jim@meyering.net>
10111         * src/touch.c (touch): Change the wording of a diagnostic so
10112         that it makes sense both when the file exists and when it doesn't.
10113         Suggestion from Michael Stone.
10115 2002-12-18  Jim Meyering  <jim@meyering.net>
10117         * src/stty.c (valid_options): Declare to be static.
10119 2002-12-15  Jim Meyering  <jim@meyering.net>
10121         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
10123         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
10124         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
10125         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
10126         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
10127         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
10129         * src/remove.c (PARAMS): Remove definition.
10130         * src/sys2.h: Likewise.
10132         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
10133         Include strftime.h instead.
10135 2002-12-14  Jim Meyering  <jim@meyering.net>
10137         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
10139         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
10140         This is necessary at least for Irix6.5 when using c89.
10141         Reported by Nelson Beebe.
10143         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
10145         * tests/misc/cat-tty-eof: New test.
10147         * src/mknod.c (usage): Specify how major and minor mode numbers
10148         are interpreted.  Report forwarded by Kristin E Thomas.
10149         * src/mknod.c: Remove now-redundant usage-specifying comment.
10151 2002-12-13  Jim Meyering  <jim@meyering.net>
10153         * Version 4.5.4.
10155         * tests/du/trailing-slash: Allow for a directory of size `0'.
10156         That happens at least on file systems of type tmpfs on linux-2.4.18.
10158         * announce-gen: New script to begin replacing the commands
10159         associated with the rule here...
10160         * Makefile.maint (announcement): Invoke announce-gen.
10161         * Makefile.am (EXTRA_DIST): Add announce-gen.
10163         * tests/cp/preserve-2: New file/test, for latest fix.
10164         * tests/cp/Makefile.am (TESTS): Add preserve-2.
10166 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
10168         Fix a bug whereby cp would fail to parse an option like
10169         --preserve=mode,ownership.
10170         * src/cp.c (decode_preserve_arg): Advance `comma' to
10171         point the character following the comma.
10173 2002-12-11  Jim Meyering  <jim@meyering.net>
10175         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
10176         in case it's already defined.
10178 2002-12-09  Jim Meyering  <jim@meyering.net>
10180         * tests/touch/fail-diag: Don't get a test failure if /no exists.
10181         Instead, evoke a framework failure if /no-$$ exists.
10182         Reported by Michael Stone.
10184 2002-12-08  Jim Meyering  <jim@meyering.net>
10186         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
10187         Define to rpl_lstat, so that even on systems like Solaris 5.8,
10188         du honors (per POSIX) the trailing slash on an argument referring
10189         to a symlink-to-directory.
10191 2002-12-06  Jim Meyering  <jim@meyering.net>
10193         * Use autoconf-2.57.  Regenerate dependent files.
10194         * Use automake-1.7.2.  Regenerate dependent files.
10196         * src/ls.c (gobble_file): Also stat the file if it's a
10197         regular file and --indicator-style=classify (aka -F).
10198         Thanks to Ed Santiago for opening my eyes.
10200         * tests/ls/file-type: New file.  Test for the above.
10201         A test to contrast ls -F and ls --indicator-style=file-type.
10202         * tests/ls/Makefile.am (TESTS): Add file-type.
10204 2002-12-04  Jim Meyering  <jim@meyering.net>
10206         * tests/ls/follow-slink: Make sure the symlink was created.
10207         Richard Dawe reported that `ln -s link link' succeeds, but creates
10208         no file on systems running some version of the DJGPP libc.
10210 2002-12-03  Jim Meyering  <jim@meyering.net>
10212         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
10213         since this package no longer panders to K&R compilers.
10215 2002-12-02  Jim Meyering  <jim@meyering.net>
10217         * tests/du/slink: Skip this test if `.' is on a non-local file system.
10219         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
10220         something to replace.
10222 2002-12-01  Jim Meyering  <jim@meyering.net>
10224         * src/stat.c: Don't include <string.h> or <ctype.h>.
10225         That's already done via system.h.
10226         * src/dircolors.c: Don't include <ctype.h>.
10228 2002-11-30  Jim Meyering  <jim@meyering.net>
10230         * ls.c (gobble_file): Remove the block of code that caused
10231         `ls --color -F symlink-to-dir' to list the files in
10232         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
10233         like `ls -F symlink-to-dir') but with the addition of highlighting.
10234         Similarly, `ls --color -dF symlink-to-dir' would print
10235         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
10236         Reported by Jeff Sheinberg as Debian bug #168203.
10237         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
10239         ls is now more efficient: with certain options, it no longer needs
10240         to stat each directory entry on systems with valid dirent.d_type.
10241         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
10242         (main): Make --recursive set format_needs_type, not format_needs_stat.
10243         (gobble_file): Remove a FIXME comment, now that it's fixed.
10245 2002-11-24  Jim Meyering  <jim@meyering.net>
10247         * src/du.c (du_files): Don't strip any trailing slash.
10248         Rewrite so that `/' is no longer represented internally as
10249         the empty string.
10250         (count_entry): When appending a file name component,
10251         account for the fact that the current path may end in `/'.
10252         François Pinard reported that `du symlink-to-dir/' was not
10253         equivalent to `du symlink-to-dir/.'.  Now it is.
10254         * tests/du/trailing-slash: New file/test, for the above fix.
10255         * tests/du/Makefile.am (TESTS): Add trailing-slash.
10257 2002-11-23  Jim Meyering  <jim@meyering.net>
10259         * src/tac.c (output): Declare some local variables to be of type size_t,
10260         rather than `int' to avoid warnings from gcc.
10262 2002-11-21  Paul Eggert  <eggert@twinsun.com>
10264         * src/ls.c (decode_switches): Use case-sensitive matching to
10265         decode the QUOTING_STYLE environment variable.  This is more
10266         consistent with the documentation, and with --quoting-style.
10268 2002-11-21  Martin Buck  <martin.buck@ascom.ch
10270         * src/stty.c (struct speeds): Add support for all baud rates defined
10271         in linux-2.4.19.
10273 2002-11-19  Jim Meyering  <jim@meyering.net>
10275         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
10276         run in a UTF locale.  Report and suggested fix by Bruno Haible.
10277         * tests/fmt/basic: Likewise.
10279 2002-11-17  Jim Meyering  <jim@meyering.net>
10281         * configure.ac: Update via autoupdate.
10282         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
10284         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
10285         Reported by Hans Ginzel.
10287 2002-11-15  Jim Meyering  <jim@meyering.net>
10289         * Makefile.cfg (gnu_rel_host): Define.
10290         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
10291         on whether $(VERSION) looks like a major release number.
10293         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
10294         (release): Rename from `alpha'.
10295         (alpha): Depend on release.
10297         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
10299 2002-11-14  Jim Meyering  <jim@meyering.net>
10301         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
10302         (announcement): Use the new variable.
10304         * Makefile.maint: Sync with Bison, i.e.:
10305         (po-check): Scan .l and .y files instead of the
10306         .c and the .h files that they generate.  This fixes the bug
10307         reported by Tim Van Holder in:
10308         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
10309         Look for N_ as well as for _.  Try to avoid matching #define for
10310         N_ and _.
10311         From Paul Eggert.
10313 2002-11-12  Jim Meyering  <jim@meyering.net>
10315         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
10316         Replace sole use with equivalent `#ifdef S_ISLNK'.
10317         Inconsistency reported by Dmitry V. Levin.
10319 2002-11-11  Jim Meyering  <jim@meyering.net>
10321         * src/stat.c (usage): Transform --help items output via s/ - /   /,
10322         so that help2man produces properly formatted man pages.
10323         Reported by Herbert Xu as Debian bug #168400.
10325 2002-11-10  Jim Meyering  <jim@meyering.net>
10327         * src/ls.c (sighandler): Handle SIGTSTP specially.
10328         Based on suggestions from Solar Designer and Dmitry V. Levin.
10329         Add comments.
10331         * Makefile.cfg (cvs_files): Define.  From autoconf.
10332         (local_updates): Likewise.
10334         * src/ls.c (restore_default_color_handler, sigtstp_handler):
10335         Remove functions.
10336         (sighandler): New function, based on the one in sort.c.
10337         (main): Use sigaction, if possible; otherwise signal.
10338         Handle these signals:
10339         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
10340         Don't register our handler if the signal is already being ignored.
10342         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
10343         * src/csplit.c (interrupt_handler): Likewise.
10344         * src/sort.c (sighandler): Likewise.
10345         (main): Declare `i' and `nsigs' to be unsigned, not int.
10347 2002-11-09  Jim Meyering  <jim@meyering.net>
10349         ls --color: restore terminal text color upon signal.
10350         * src/ls.c: Include "full-write.h" and <signal.h>.
10351         (restore_default_color, restore_default_color_handler): New functions.
10352         (sigtstp_handler, put_indicator_direct): New functions.
10353         (main) [print_with_color]: Register signal handlers.
10354         Patch mostly by Solar Designer and Stanislav Ievlev.
10356         Update from autoconf.
10357         * Makefile.maint (AMTAR): Remove definition.
10358         (update, cvs-update, po-update, do-po-update): New rules.
10359         (wget-update): Update (thus renaming to cvs-update).
10360         (automake_repo): Use anoncvs@sources.redhat.com.
10362 2002-11-06  Jim Meyering  <jim@meyering.net>
10364         * tests/misc/Makefile.am (TESTS): Add printf-hex.
10366         * tests/misc/printf: Be careful to test the code in this package,
10367         not the shell built-in function.
10369         * src/printf.c (print_esc): A hexadecimal escape sequence has
10370         at most two hex. digits, not three.  Reported by Padraig Brady.
10371         (usage): Update description.
10372         * tests/misc/printf-hex: New file/test, for the above fix.
10374 2002-10-07  Paul Eggert  <eggert@twinsun.com>
10376         Add support for locale-specific size indications (e.g.,
10377         thousands-separators) and for explicit size suffixes on output.
10379         * doc/coreutils.texi (Block size): Say that:
10380         This affects display format as well as block size.
10381         Fractional block counts are rounded up.
10382         ls file size blocksize defaults to 1.
10383         A block size spec preceded by ' generates thousands separators.
10384         A suffix without a preceding integer generates suffixes.
10385         (tail invocation): 32k -> 32 KiB.
10386         (What information is listed): ls -h is now equivalent to
10387         ls --block-size=human, and ls -H is now equivalent to
10388         ls --block-size=si.  Displayed file size is now always affected by
10389         --block-size.
10391         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
10392         lib/umaxtostr.c: New files, taken from GNU tar.
10394         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
10395         umaxtostr.c.
10396         (EXTRA_DIST): Add inttostr.c.
10398         * lib/human.c, lib/human.h: Rewrite to support locale-specific
10399         notations like thousands separators.
10400         Specify what includer of include.h must include beforehand.
10401         (human_group_digits, human_suppress_point_zero, human_autoscale,
10402         human_base_1024, human_SI, human_B): New enum values.
10403         (human_readable): Rename from human_readable_inexact; put the
10404         options before the sizes.  All uses changed.  The old human_readable
10405         function has been removed; use inttostr.h instead.
10406         (human_options): Renamed from human_block_size, with new signature
10407         that allows block sizes up to UINTMAX_MAX.  All callers changed.
10409         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
10410         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
10411         freestanding C89.  No need to check for stdlib.h or string.h since
10412         autoconf does this now.
10414         * src/cksum.c (cksum): Use primitives from inttostr.h, not
10415         human.h, to print large numbers simply.
10416         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
10417         * src/dd.c (print_stats, main): Likewise.
10418         * src/df.c (print_header): Likewise.
10419         * src/factor.c (print_factors): Likewise.
10420         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
10421         * src/shred.c (dopass): Likewise.
10422         * src/sort.c (checkfp): Likewise.
10423         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
10424         * src/tail.c (xlseek): Likewise.
10425         * src/wc.c (write_counts, wc): Likewise.
10427         * src/df.c (human_output_opts): New var.
10428         (output_block_size): Now uintmax_t, not int, to handle larger
10429         block sizes.  All uses changed.
10430         * src/du.c: Likewise.
10431         * src/ls.c: Likewise.
10433         * src/df.c (print_header): In the header line, prefer SI to human
10434         representation if it's shorter; if neither is shorter, try to
10435         intuit what the user would prefer.
10437         * src/expr.c (inttostr): Remove; use new imaxtostr library
10438         function instead.
10440         * src/ls.c (file_output_block_size): New var, to distinguish
10441         file sizes from other sizes.
10442         (decode_switches): Set it.
10444         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
10445         (dopass): When printing progress, use floor for what has been done
10446         so far (since we should be conservative there), and ceiling for
10447         what needs to be done (since that's what other programs use).
10449 2002-10-19  Jim Meyering  <jim@meyering.net>
10451         * src/pinky.c (print_heading): Align TTY and Name headings.
10452         Reported by Karl Eichwalder.
10454 2002-10-18  Jim Meyering  <jim@meyering.net>
10456         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
10457         Remove now-useless cast.
10458         (stdread): Remove function.
10459         (bytes_split): Use size_t instead of int.
10460         Use safe_read, not stdread.
10461         (lines_split): Likewise.
10462         Use memchr rather than a `while' loop.
10463         (line_bytes_split): Use size_t instead of int.
10464         Use safe_read, not stdread.
10465         (main): Add some FIXME comments to remind me to remove casts.
10467         * src/system.h (ST_BLKSIZE): Correct comment describing how to
10468         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
10470 2002-10-17  Jim Meyering  <jim@meyering.net>
10472         Fix a problem that could make e.g., `cat' misbehave on systems which
10473         give invalid (unreasonably large) values for stat.st_blksize.
10474         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
10475         Reported by Petter Reinholdtsen.
10477 2002-10-14  Jim Meyering  <jim@meyering.net>
10479         Specifying a printf conversion specifer as nl's separator string
10480         could cause nl to segfault.
10481         * src/nl.c (build_print_fmt): Don't include separator string
10482         in the printf format; it might contain `%'.
10483         Use a better bound on the length of the print_fmt buffer.
10484         (print_lineno): Print the separator here instead.
10485         Reported by Doug Coleman.
10487         * tests/misc/nl: New file/tests, including a test for the above.
10488         * tests/misc/Makefile.am (TESTS): Add nl.
10490         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
10491         * tests/misc/Makefile.am (TESTS): Add split-l.
10493 2002-10-13  Jim Meyering  <jim@meyering.net>
10495         * Version 4.5.3.
10497         * src/du.c (usage): Tweak description of --dereference-args/-D.
10499         * src/du.c (count_entry): Also save cwd when dereferencing (via
10500         --dereference-args, -D) a command-line argument.
10501         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
10503         * src/Makefile.am (../AUTHORS): New target/rule.
10505 2002-10-12  Jim Meyering  <jim@meyering.net>
10507         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
10508         of type size_t, since that's the way it's used and avoids a warning.
10510         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
10511         since that's how it's always used and avoids a new warning from gcc.
10512         (read_input): Adapt to new safe_read ABI.
10514         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
10515         to avoid warnings.
10517         * src/pinky.c (print_long_entry): fread returns size_t.
10518         Declare local `bytes' accordingly, to avoid warning.
10520         tail -c +N would perform an extra read after encountering EOF
10521         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
10522         * src/tail.c (start_bytes): Detect EOF, inform caller.
10523         (tail_bytes): Upon EOF in start_bytes, return immediately.
10524         (file_lines): Reorganize to use memrchr rather than an explicit loop.
10525         Adapt to new safe_read ABI.
10527 2002-10-11  Jim Meyering  <jim@meyering.net>
10529         * tests/du/deref: New file/test, for the above fix.
10530         * tests/du/Makefile.am (TESTS): Add deref.
10532 2002-10-10  Jim Meyering  <jim@meyering.net>
10534         * tests/ln/Makefile.am (TESTS): Add target-1.
10535         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
10537 2002-10-09  Jim Meyering  <jim@meyering.net>
10539         * tests/cp/backup-is-src: Ensure that certain environment variables
10540         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
10542         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
10543         consume 4GB of disk space on systems without support for sparse files.
10544         Fix a logic error that'd make it `cat err' even though dd didn't fail.
10546         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
10547         Patch by steven@magelico.net, forwarded by Michael Stone.
10549         * tests/ls/dired: Ensure that ls produces English messages.
10550         Patch by Alexey Vyskubov, forwarded by Michael Stone.
10552 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
10554         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
10556 2002-10-08  Jim Meyering  <jim@meyering.net>
10558         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
10559         Fix syntax in test: use =, not ==.
10560         Reported by Bob Proulx.
10561         Change all the rest like this: grep -lR "testing framework'" .\
10562         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
10564         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
10565         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
10566         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
10567         * src/wc.c (wc): Likewise.
10569 2002-10-07  Paul Eggert  <eggert@twinsun.com>
10571         * src/cat.c (cat):
10572         Don't advance the write pointer past the end of the write buffer.
10573         * src/sort.c (begfield, limfield): Likewise.
10575 2002-10-07  Jim Meyering  <jim@meyering.net>
10577         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
10578         * src/head.c (head_bytes, head_lines): Likewise.
10580 2002-10-06  Jim Meyering  <jim@meyering.net>
10582         * src/dd.c (scanargs): Ensure that specified block sizes (specified
10583         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
10584         (skip, dd_copy): Adapt to new safe_read ABI.
10586         * Makefile.maint (signatures): Define.
10587         (%.sig): New rule.
10588         (announcement): Depend on $(signatures).
10590         * Makefile.maint (announcement): Output all URLs for detached
10591         signatures, not just the last one from the previous loop.
10593 2002-10-05  Jim Meyering  <jim@meyering.net>
10595         * Version 4.5.2.
10597         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
10598         don't recurse into directory, DIR.  Prompted by a report from
10599         Leonardo Milano.
10601         * tests/rm/i-no-r: New file/test, for the above fix.
10602         * tests/rm/Makefile.am (TESTS): Add i-no-r.
10604         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
10605         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
10607 2002-10-03  Jim Meyering  <jim@meyering.net>
10609         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
10610         * src/df.c (AUTHORS): Likewise.
10611         * src/du.c (AUTHORS): Likewise.
10612         * src/tail.c (AUTHORS): Likewise.
10613         * src/touch.c (AUTHORS): Likewise.
10615 2002-10-02  Jim Meyering  <jim@meyering.net>
10617         * Makefile.am (SUBDIRS): Remove `old'.
10618         (EXTRA_DIST): List the files in old/.
10619         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
10620         Suggestion from Akim Demaille.
10622 2002-10-01  Jim Meyering  <jim@meyering.net>
10624         * src/sys2.h (SSIZE_MAX): Define.
10626 2002-09-30  Jim Meyering  <jim@meyering.net>
10628         * src/csplit.c: Don't include stdlib.h here.  It's already included
10629         via system.h.
10631 2002-09-29  Jim Meyering  <jim@meyering.net>
10633         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
10634         expression to avoid bogus warning from gcc.
10636         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
10637         (cat): Declare insize and outsize to be of type size_t, not int.
10638         Rearrange pointer/integer expressions to avoid bogus warnings.
10639         (main): Declare insize and outsize to be of type size_t, not int.
10641         * src/tail.c (parse_options): Give a sensible diagnostic for
10642         an invalid byte or line count.  Reported by Mikko Tuumanen.
10644         * src/touch.c (main): Split a long line.
10646         * tests/du/Makefile.am (TESTS): Add slink.
10647         * tests/du/slink: New test for system.h change of 2002-08-31.
10649         In move mode, always first try to rename.  Before, upon failure to
10650         rename a directory, this code would never attempt to rename any
10651         other file in that directory, but would thenceforth always copy.
10652         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
10653         may fail with EXDEV, yet renaming files within that directory to
10654         a newly-created destination directory succeeds.
10655         * src/copy.c (copy_internal): Remove local, move_mode;
10656         use x->move_mode instead.  Based on a patch from Tom Haynes.
10658 2002-09-28  Jim Meyering  <jim@meyering.net>
10660         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
10661         Factor out some duplication.
10662         (main): Use it.
10663         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
10665         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
10666         compiler warnings.
10667         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
10668         to avoid compiler warnings.
10670         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
10671         compiler warnings.
10673         Fix things so `mkdir -p' can create very deep directories, e.g.,
10674         mkdir -p $(perl -e 'print "a/" x 40000') now works.
10675         * src/mkdir.c (main): For --parents (-p), call make_path with the
10676         entire directory name, so we don't ever require that file operations
10677         like stat or chmod be performed on the entire command line argument.
10678         * makepath.c (make_path): Restore umask *before* creating the final
10679         component.
10681 2002-09-27  Andreas Schwab  <schwab@suse.de>
10683         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
10684         to avoid overflow.  Reported by Hans Lermen.
10686 2002-09-26  Jim Meyering  <jim@meyering.net>
10688         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
10690 2002-09-25  Jim Meyering  <jim@meyering.net>
10692         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
10693         and add a cast, to avoid a warning about `signed and unsigned type in
10694         conditional expression'.
10696 2002-09-22  Jim Meyering  <jim@meyering.net>
10698         * src/rmdir.c: Include "dirname.h", for declaration of
10699         strip_trailing_slashes.
10701         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
10702         Now they're defined through system.h.
10704         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
10705         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
10706         since it's already included from sys2.h via system.h.
10708         * Use automake-1.6f.  Regenerate dependent files.
10710         * src/Makefile.am (PERL): Remove duplicate definition.
10712         fmt's -s, -t, -c options didn't work properly for long lines.
10713         Since get_line may end up calling put_paragraph (for long lines),
10714         be sure to set global, `other_indent', before it is used there.
10716         * src/fmt.c (set_other_indent): New function, factored out of...
10717         (get_paragraph): ... here.  Call it.
10718         (get_line): Call set_other_indent before calling flush_paragraph,
10719         which calls fmt_paragraph, which in turn calls put_paragraph,
10720         which uses other_indent.
10722         * tests/fmt/Makefile.am (TESTS): Add long-line.
10723         * tests/fmt/long-line: New file/test, for the above fix.
10725 2002-09-21  Jim Meyering  <jim@meyering.net>
10727         * src/od.c: No longer include deprecated <values.h>.
10728         It was required solely for now-removed reference to BITSPERBYTE.
10729         * src/install.c: Likewise.
10730         Suggestion from Bruno Haible.
10732 2002-09-06  Andreas Schwab  <schwab@suse.de>
10734         `rmdir -p dir-specified-with-trailing-slash/' would fail.
10735         * src/rmdir.c (remove_parents): Strip trailing slashes.
10737 2002-09-20  Jim Meyering  <jim@meyering.net>
10739         * tests/rmdir/t-slash: New file/test, for the above fix.
10740         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
10742         * Makefile.maint (announcement): Arrange to gpg-sign the message.
10743         Add a URL for each detached signature file.
10745 2002-09-07  Bruno Haible  <bruno@clisp.org>
10747         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
10749 2002-09-18  Jim Meyering  <jim@meyering.net>
10751         `od -t x8' used the wrong (`l'-prefixed) printf format.
10752         Likewise for the o8 and u8 formats.
10753         * src/od.c (ISPEC_TO_FORMAT): Define macro.
10754         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
10755         Reported by Arun Sharma.
10757 2002-09-17  Jim Meyering  <jim@meyering.net>
10759         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
10760         From gettext's intl/loadmsgcat.c.
10762         * tests/od/x8: New file/test, for the above fix.
10763         * tests/od/Makefile.am (TESTS): Add x8.
10765 2002-09-15  Jim Meyering  <jim@meyering.net>
10767         * Use autoconf-2.54.  Regenerate dependent files.
10769         * src/csplit.c (get_format_width): Add cast to avoid
10770         warning about `signed and unsigned type in conditional expression'.
10772 2002-09-14  Jim Meyering  <jim@meyering.net>
10774         * src/who.c (print_user): Change type of local to size_t
10775         to avoid warnings about `comparison between signed and unsigned'.
10776         * src/ptx.c (generate_all_output): Likewise.
10778         * src/dd.c (main, skip): Add casts to avoid warnings about
10779         `comparison between signed and unsigned'.
10781         * src/id.c (print_full_info, print_group_list): Add casts to avoid
10782         warnings about `signed and unsigned type in conditional expression'.
10784         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
10785         to avoid warnings about `comparison between signed and unsigned'.
10786         (split_3): Change parameter names to be readable and add comment.
10787         Clean up the test for whether a line may be ignored.
10789 2002-09-13  Jim Meyering  <jim@meyering.net>
10791         * src/printf.c (main): Handle leading command line argument of `--'.
10792         Reported by Raul: DervishD <raul@pleyades.net>
10793         * tests/misc/printf: New file: test for the above.
10794         * tests/misc/Makefile.am (TESTS): Add printf.
10796         * src/date.c (usage): Explain that %S's range of [0..60] is required --
10797         rather than 0..59 -- to accommodate the occasional positive leap second.
10798         Reported by Richard Neill.
10800 2002-09-12  Jim Meyering  <jim@meyering.net>
10802         * src/Makefile.am (nanosec_libs): Define.
10803         (sleep_LDADD, tail_LDADD): Use it here.
10805         Factor nanosleep-related code into ../lib/xnanosleep.c.
10806         * src/sleep.c: Include xnanosleep.h.
10807         Factor out fenv.h-related code.
10808         (timespec_subtract): Remove function.
10809         (main): Remove code that deals with computing start and stop times
10810         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
10812         Allow S (in --sleep-interval=S) to be a floating point value.
10813         * src/tail.c: Include xnanosleep.h and xstrtod.h.
10814         Move declaration of global variable, sleep_interval, to ...
10815         (main): ...here.
10816         (usage): Update description of --sleep-interval option.
10817         (tail_forever): New parameter, sleep_interval.  Update caller.
10818         Use xnanosleep, rather than sleep.
10819         (parse_options): New parameter, sleep_interval.  Update caller.
10820         Use xstrtod, now that we accept floating point values.
10821         Prompted by a patch from Augey Mikus.
10823 2002-09-06  Jim Meyering  <jim@meyering.net>
10825         * src/remove.c (prompt): Change comment to give a better note to
10826         translators.  From Michael Piefel.
10828 2002-09-02  Jim Meyering  <jim@meyering.net>
10830         * README: A good problem report/patch includes diffs against
10831         the most recent test release.
10833         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
10834         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
10836         * src/kill.c (print_table_row): Use an unsigned type for widths
10837         to avoid warning about comparison between signed and unsigned.
10838         (list_signals): Likewise.
10840         * src/od.c (skip): Add a cast to avoid warning about comparison
10841         between signed and unsigned.
10842         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
10843         comparisons to make them more readable.
10845 2002-09-01  Jim Meyering  <jim@meyering.net>
10847         * Version 4.5.1.
10849 2002-08-31  Jim Meyering  <jim@meyering.net>
10851         Symlinks were always reported as using 0 blocks.
10852         * src/system.h (ST_NBLOCKS): Don't depend on file type.
10853         This reverts the change of 2000-01-30.
10854         Based on a report and patch from Neil Brown via Michael Stone.
10855         This fixes Debian Bug#156358.
10857         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
10858         `exit (1)' to `exit (EXIT_FAILURE)', and
10859         `usage (1)' to `usage (EXIT_FAILURE)'.
10861         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
10862         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
10863         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
10864         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
10865         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
10866         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
10867         error never exits successfully.
10869 2002-08-29  Jim Meyering  <jim@meyering.net>
10871         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
10872         when ignoring any return value.
10874         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
10875         failures.  On some systems (at least EMC Celerra and Solaris5.8),
10876         this appears to be necessary.
10877         (is_empty_dir): Likewise.  Also, always close directory handle.
10878         * src/ls.c (print_dir): Likewise.
10879         (print_dir): Rename local variable: reading -> dirp.
10880         Reported by Mike Coleman.
10882 2002-08-28  Jim Meyering  <jim@meyering.net>
10884         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
10885         Give a diagnostic and fail if closedir fails.
10887 2002-08-26  Jim Meyering  <jim@meyering.net>
10889         * Makefile.am (THANKS-to-translators): New rule.
10890         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
10891         * THANKStt.in: New file.
10893         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
10894         file-scoped global.
10895         (main): Register it with atexit.
10896         Close STDOUT_FILENO, to avoid a problem when writing to
10897         /dev/audio on at least Solaris 5.7 and 5.8 systems.
10898         Reported by Shing-Shong Shei.
10900 2002-08-25  Jim Meyering  <jim@meyering.net>
10902         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
10903         * src/tac.c (main): Likewise.
10904         * src/tail.c (main): Likewise.
10905         * src/tee.c (main): Likewise.
10906         * src/tr.c (main): Likewise.
10907         * src/wc.c (main): Likewise.
10909 2002-08-20  Jim Meyering  <jim@meyering.net>
10911         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
10913 2002-08-10  Paul Eggert  <eggert@twinsun.com>
10915         * src/nohup.sh: Don't use "exec --"; it's not portable and
10916         shouldn't be needed.
10918 2002-08-09  Jim Meyering  <jim@meyering.net>
10920         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
10921         (usage): Clarify help text for the -COLUMN option.
10922         Patch by Padraig Brady.
10923         * tests/pr/Test.pm [col-last]: New test for the above.
10925         * configure.ac: Start with version 4.5.1, chosen so that it's larger
10926         than the latest version numbers of the component packages.
10928         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
10929         programs in ../src.
10931 2002-08-08  Jim Meyering  <jim@meyering.net>
10933         * src/date.c: Guard inclusion of <langinfo.h> with
10934         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
10935         * src/sort.c: Likewise.
10936         Patch by GOTO Masanori.
10938 2002-08-05  Paul Eggert  <eggert@twinsun.com>
10940         Fix some minor time-related bugs with POSIX time arguments.
10941         Some valid time stamps were being rejected (notably -1, and
10942         time stamps before 1900 on 64-bit hosts).  And some invalid
10943         time stamps were being accepted, e.g. September 31.
10945         * src/date.c (main): Adjust to posixtime signature change.
10946         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
10947         Use localtime, not posixtm, to warn about obsolete "touch".
10949 2002-08-05  Jim Meyering  <jim@meyering.net>
10951         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
10953 2002-08-04  Jim Meyering  <jim@meyering.net>
10955         * src/Makefile.am (check-README): New target/rule.
10956         (check): Depend on it.
10958         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
10960 2002-08-03  Jim Meyering  <jim@meyering.net>
10962         * Makefile.am (SUBDIRS): Add old.
10963         * old/: New directory, containing legacy ChangeLog* and NEWS files
10964         from the fileutils, sh-utils, and textutils packages.
10966         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
10968 2002-08-02  Paul Eggert  <eggert@twinsun.com>
10970         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
10972         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
10973         (hard_LC_COLLATE): New var.
10974         (different): Args are now char *, not const char *.
10975         Use xmemcoll instead of memcmp to compare lines, so that
10976         LC_COLLATE has effect.  However, use memcmp if it is an
10977         easy locale.
10978         (check_file): Do not include newline in comparison, so that
10979         xmemcoll has a byte to stomp on temporarily.
10980         (main): Set hard_LC_COLLATE.
10982 2002-07-29  Jim Meyering  <jim@meyering.net>
10984         * Makefile.am (SUBDIRS): Remove djgpp, for now.
10986 2002-07-20  Jim Meyering  <jim@meyering.net>
10988         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
10989         into EXIT_FAILURE.  Otherwise, false --help and false --version
10990         would fail.
10992 2002-07-08  Jim Meyering  <jim@meyering.net>
10994         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
10995         rather than the hard-coded `sh-utils'.
10997 2002-07-01  Jim Meyering  <jim@meyering.net>
10999         * configure.ac: Merge the three files from fileutils,
11000         textutils, and sh-utils.
11001         * Makefile.am: Likewise.
11002         * src/Makefile.am: Likewise.
11005         -----
11007         Copyright (C) 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
11009         Copying and distribution of this file, with or without
11010         modification, are permitted provided the copyright notice
11011         and this notice are preserved.