*** empty log message ***
[platform/upstream/coreutils.git] / ChangeLog
1 2005-06-19  Jim Meyering  <jim@meyering.net>
2
3         * Version 5.3.1.
4
5         * src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
6
7         * src/shred.c (usage): Use `file system', not `filesystem'.
8
9 2005-06-18  Jim Meyering  <jim@meyering.net>
10
11         * src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
12
13 2005-06-17  Jim Meyering  <jim@meyering.net>
14
15         * src/shred.c (usage): Clarify that shred works on an ext3 file
16         system as long as it's not in data=journal mode.
17         Tiny change by Mark Melahn.
18
19 2005-06-16  Paul Eggert  <eggert@cs.ucla.edu>
20
21         * src/hostid.c (main): Don't print fewer than 8 digits, or spurious
22         leading "f"s.  "f" problem reported by Tim Waugh.
23         * NEWS: Document this.
24
25 2005-06-16  Jim Meyering  <jim@meyering.net>
26
27         Don't embed `this'-style quotes in format strings.
28         * src/tr.c: Rather than this: error (..., "...`%s'...", arg);
29         do this:                      error (..., "...%s...", quote (arg));
30         * src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
31         * src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
32         * src/split.c, src/tail.c: Likewise.
33
34         * src/sleep.c: Include "quote.h".  Remove hard-coded quotes, as above.
35         * src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
36         * src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
37
38         * src/mv.c: Finally remove support for --version-control=S (-V).
39         It was deprecated nearly 6 years ago and has been warning
40         users to switch to --backup=S since fileutils-4.0j.
41         * src/cp.c, src/install.c, src/ln.c: Likewise.
42
43 2005-06-15  Jim Meyering  <jim@meyering.net>
44
45         * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
46         * tests/install/basic-1: Ensure that each `-d'-specified directory
47         is created.  Ensure that rel-named dirs are not created when
48         chdir($PWD) fails.
49
50         * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
51
52 2005-06-14  Paul Eggert  <eggert@cs.ucla.edu>
53
54         Improve diagnostics for restore_cwd failure.
55         * src/install.c (main): Standardize on a diagnostic for
56         restore_cwd failure, and report errno.
57         (install_file_in_file_parents): Fail if restore_cwd fails and
58         one of the files is relative.  This fixes a bug (albeit unlikely).
59         * src/mkdir.c (create_parents): Remove static var (now local to 'main').
60         (main): Standardize on a diagnostic for restore_cwd failure,
61         and report errno.
62         Don't bother to check cwd_errno unless create_parents.
63         Use mkdir rather than make_dir; it's simpler.
64
65         * src/install.c (main): Adjust to new make_dir_parents convention.
66         * src/mkdir.c (main): Likewise.
67
68 2005-06-14  Jim Meyering  <jim@meyering.net>
69
70         * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
71         is an absolute directory name.
72
73         * Makefile.maint (my-distcheck): Add -Wall to the list of options that
74         are used with -Werror.  This target is not intended for general use.
75
76 2005-06-13  Jim Meyering  <jim@meyering.net>
77
78         * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
79         relative directory name after make_dir_parents fails to restore
80         the working directory.  Before, `mkdir -p' could create directories
81         in the wrong place in unusual circumstances.
82         * src/install.c (main): Likewise.
83         (install_file_in_file_parents): Update make_dir_parents caller.
84         * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
85         * tests/mkdir/Makefile.am (TESTS): Add p-3.
86
87 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
88
89         Act on the Austin Group's response yesterday to XCU ERN 63; see
90         <http://www.opengroup.org/austin/docs/austin_260.txt>.
91         * NEWS: ls no longer outputs an extra space between mode and link count.
92         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
93         * src/ls.c (any_has_acl): New var.
94         (clear_files): Clear it.
95         (gobble_file): Set it if a file has an ACL.
96         (print_long_format): Omit needless space unless some file has an ACL.
97
98 2005-06-10  Jim Meyering  <jim@meyering.net>
99
100         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
101
102 2005-06-02  Jim Meyering  <jim@meyering.net>
103
104         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
105
106 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
107
108         Use "file name" when talking about file names, instead of "filename"
109         or "path", as per the GNU coding standards.
110         * src/basename.c: Don't use "path" or "filename".
111         * src/copy.c: Likewise.
112         * src/copy.h: Likewise.
113         * src/cp-hash.c: Likewise.
114         * src/cp.c: Likewise.
115         * src/df.c: Likewise.
116         * src/install.c: Likewise.
117         * src/ls.c: Likewise.
118         * src/pinky.c: Likewise.
119         * src/pr.c: Likewise.
120         * src/pwd.c: Likewise.
121         * src/remove.c: Likewise.
122         * src/rmdir.c: Likewise.
123         * src/sort.c: Likewise.
124         * src/system.h: Likewise.
125         * src/tty.c: Likewise.
126         * src/who.c: Likewise.
127         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
128         (make_dir_parents_private): Renamed from make_path_private.
129         All uses changed.
130         * src/cp.c (usage): Don't use "path" to describe a file name.
131         * src/readlink.c (usage): Likewise.
132         * src/rmdir.c (usage): Likewise.
133         * src/df.c: Don't include "path-concat.h"; not needed.
134         * src/install.c (install_file_in_file_parents): Renamed from
135         install_file_to_path.  All uses changed.
136         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
137         All uses changed.
138         * src/ls.c (make_link_name): Renamed from make_link_path.
139         All uses changed.
140         * src/pwd.c (struct file_name): Renamed from struct Path.
141         All uses changed.
142         (file_name_free): Renamed from path_free.  All uses changed.
143         (file_name_init): Renamed from path_init.  All uses changed.
144         (file_name_prepend): Renamed from path_prepend.  All uses changed.
145         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
146         All uses changed.
147         (longopts): Add comment that --path is deprecated.
148
149 2005-05-31  Jim Meyering  <jim@meyering.net>
150
151         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
152         This is a crutch so that `make distcheck's sc_tight_scope rule
153         knows that they really are deliberately declared that way.
154
155 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
156
157         Port to Solaris 10's rules for whether programs can chown files.
158         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
159         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
160         changed.
161         (copy_internal): If chown failed, don't worry about what happened
162         to the mode bits; they can't have changed.
163         (chown_privileges, chown_failure_ok): New functions.
164         * src/copy.h: Add copyright notice.
165         (struct cp_options): Remove myeuid member.  Add chown_privileges
166         member.
167         (chown_privileges, chown_failure_ok): New function decls.
168         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
169         Use chown_failure_ok rather than our own code.
170         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
171         * src/install.c (cp_option_init): Likewise.
172         * src/mv.c (cp_option_init): Likewise.
173
174 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
175
176         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
177         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
178         Remove decls.
179         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
180         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
181         [!defined _POSIX_VERSION]: Remove decls.
182         * src/install.c (getpwnam, getgrnam): Remove decl.
183         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
184         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
185         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
186         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
187         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
188         isn't defined.
189         Don't include <sys/file.h>; no longer needed.
190         (getegid, geteuid): Remove no-longer-necessary decls.
191
192         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
193         Define to 256, not 255, as per modern POSIX.
194
195 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
196
197         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
198         * src/dd.c (skip): Return the number of records that were not
199         skipped due to encountering EOF.
200         (dd_copy): If the file wasn't seekable and EOF was encountered,
201         write zeros past EOF until the desired offset is reached.
202
203         * NEWS: expr and test now correctly compare integers of unlimited size.
204         (Also, correct a comment that claimed that expr detects integer
205         overflow; it does so only when converting from strings.)
206         * src/expr.c: Include strnumcmp.h, xstrtol.h.
207         (looks_like_integer): New function.
208         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
209         own diagnostics.
210         (eval2): Don't look for trouble if !evaluate; this simplifies things.
211         Compare numbers using string comparison, so that overflow is
212         not possible.
213         * src/sort.c: Refactor so that others can use large-integer
214         comparison functions.
215         Include "strnumcmp.h".
216         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
217         Remove; moved to strnumcmp.
218         (decimal_point): Now int, to simplify converison overhead with
219         new API.  All uses changed.
220         (thousands_sep): Now -1 if there isn't one, as per new API.
221         All uses changed.
222         (numcompare): Move contents to strnumcmp module, except for
223         skipping blanks.
224         * src/test.c: Include inttostr.h, strnumcmp.h.
225         (whitespace, digit, digit_value, integer_expected_error): Remove.
226         (is_int): Remove; replaced by...
227         (find_int): New function.
228         (binary_operator): Don't let integers overflow in comparisons;
229         return the correct answer instead.  Simplify the code.
230         (unary_operator): Convert the integer ourself, since find_int
231         no longer does so.
232         * tests/expr/basic (bigcmp): New test.
233         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
234
235 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
236
237         * NEWS: nohup now redirects a tty stdin to an unreadable fd
238         instead of closing it.
239         * doc/coreutils.texi (nohup invocation): Document this.
240         * src/nohup.c (main): Implement this.
241
242 2005-05-26  Jim Meyering  <jim@meyering.net>
243
244         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
245         Reported by David Alan Gilbert.
246         * tests/expr/basic: Add tests using arithmetic on negative integers.
247
248 2005-05-19  Jim Meyering  <jim@meyering.net>
249
250         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
251         Remove inaccurate-but-harmless `const' attributes.
252
253         * src/join.c (decode_field_spec): Add an abort after
254         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
255         about variables being used uninitialized.
256
257 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
258
259         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
260         * src/Makefile.am: Add copyright notice.
261         (factor_LDADD): Remove, as factor no longer needs sqrt.
262         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
263         it's always true now.
264
265 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
266
267         Fix Cygwin porting problem reported by Eric Blake.
268         * src/remove.c (DT_IS_DIR): Remove.
269         (DT_IS_KNOWN, DT_MUST_BE): New macros.
270         (remove_entry): Use them.
271
272 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
273
274         * src/remove.c: Include unlinkdir.h.
275         (UNLINK_CAN_UNLINK_DIRS): Remove.
276         (remove_entry): Use cannot_unlink_dirs () rather than
277         UNLINK_CAN_UNLINK_DIRS.
278
279 2005-05-14  Jim Meyering  <jim@meyering.net>
280
281         Update FSF postal mail address.
282         * Makefile.maint, Makefile.cfg, gnupload
283         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
284         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
285         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
286         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
287         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
288         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
289         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
290         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
291         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
292         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
293         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
294         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
295         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
296         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
297         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
298         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
299         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
300         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
301         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
302         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
303         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
304         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
305
306 2005-05-13  Jim Meyering  <jim@meyering.net>
307
308         * NEWS: `rm -r' now removes all of the files it should, even on
309         systems with a buggy readdir affecting file systems inaccessible
310         at configure time.
311
312         In some unusual circumstances `rm -r' would fail to remove --
313         or even consider -- all entries in a directory with more than 254
314         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
315         other types of systems when using an affected file system via e.g.,
316         NFS.  The underlying cause was a bug in readdir on those systems.
317         Coreutils-5.2.1 and earlier used a configure-time test designed
318         to detect precisely those problem systems, but it would detect
319         the problem and enable remove.c's work-around code only when its
320         configure-time test was run on a losing file system.  Obviously,
321         it couldn't detect a problem if the offending file system wasn't
322         tested or even mounted at coreutils configure time.  Now, rm itself
323         performs a minimal-cost run-time test to detect the problem.
324
325         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
326         (remove_cwd_entries):  When readdir returns NULL for a directory from
327         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
328         entries, call rewinddir and then resume the readdir/unlink loop.
329         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
330
331 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
332
333         * NEWS: nohup now closes stdin if it is a terminal, unless
334         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
335         <https://www.opengroup.org/sophocles/show_mail.tpl?
336         source=L&listname=austin-group-l&id=8341>.
337         * doc/coreutils.texi (nohup invocation): Document this.
338         * src/nohup.c (main): Implement this.
339
340 2005-05-12  Jim Meyering  <jim@meyering.net>
341
342         * src/date.c: Assume `free (NULL)' works.
343         * src/dd.c: Likewise.
344         * src/df.c:Likewise.
345         * src/dircolors.c:Likewise.
346         * src/head.c: Likewise.
347         * src/ls.c: Likewise.
348         * src/md5sum.c: Likewise.
349         * src/pr.c: Likewise.
350         * src/sort.c: Likewise.
351
352 2005-05-10  Jim Meyering  <jim@meyering.net>
353
354         * tests/touch/not-owner: Skip this test if the user running it
355         owns `/' or has write access to it.
356
357         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
358         This makes `mv -i --reply=no f1 f2' work as expected (in not
359         performing the move operation).  But note that specifying `-i'
360         after `--reply=no' does *not* work.
361         Tiny patch from Vlada Macek.
362         Correct a comment.
363         * tests/mv/reply-no: New file.  Test for the above fix.
364         * tests/mv/Makefile.am (TESTS): Add reply-no.
365
366         * tests/ls-2/tests: Don't print PATH to stderr.
367
368 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
369
370         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
371         responses.
372
373 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
374
375         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
376         * src/dd.c (flags, usage): Add support for "binary" and "text".
377
378 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
379
380         * NEWS: chmod -w now complains if it differs from chmod a-w.
381         * src/chmod.c: Include quotearg.h.
382         (diagnose_surprises): New var.
383         (process_file): Diagnose surprises.  Simplify the logic a bit,
384         while we're at it.
385         (main): Prepare to diagnose surprises.  Remove useless code for
386         '-' option.
387         * tests/chmod/Makefile.am (TESTS): Add umask-x.
388         * tests/chmod/umask-x: New file.
389
390 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
391
392         * NEWS: ls --indicator-style=directory renamed to ls
393         --indicator-style=slash, to avoid confusion with ls --directory.
394         * src/ls.c (usage): Likewise.
395         (slash): Renamed from directory_only.  All uses changed.
396
397 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
398
399         * NEWS: "chmod +1 foo" is now diagnosed.
400
401 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
402
403         * NEWS: ls -p now marks only directories.  New option
404         --indicator-style=directory equivalent to -p.
405         * doc/coreutils.texi (ls invocation): Document this.
406         Also, mention ">" is for doors.
407         * src/ls.c (enum indicator_style): New constant directory_only,
408         for -p.
409         (indicator_style_args, indicator_style_types): Set it appropriately.
410         (decode_switches, gobble_file, print_type_indicator):
411         (length_of_file_name_and_frills):
412         Implement the change described in NEWS.
413         (decode_switches): Quote ">", too.
414         (usage): Update to match the new behavior.  Describe ">".
415         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
416         The "ls --color" test wasn't being checked; add a check for
417         "ls --color=auto" instead.
418
419         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
420         * tests/misc/split-fail: Likewise.
421         * tests/pr/Test.pm: Likewise.
422         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
423         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
424         if they use file names starting with +.
425         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
426         * tests/uniq/Test.pm (tv, test_vector): Likewise.
427
428         The following was partly derived from a tiny change by Eric Blake:
429         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
430         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
431         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
432         Work even if the underyling system attaches ACLs to new dirs.
433         * tests/mv/part-hardlink: Don't use 'set -'.
434         * tests/stty/row-col-1: Don't use 'set -'.
435
436 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
437
438         * NEWS: Document fixes described below.
439         * src/chmod.c (change, umask_value): New static vars.
440         (reference_file): Move this static var to inside "main".
441         (process_file, process_files): Remove CHANGES arg; now taken from
442         static var.  All uses changed.
443         (usage): Fix incorrect description of MODE operand.
444         (main): For invalid mode usages, output a brief usage message.
445         Adjust to new modechange API.
446         * install.c (main): Adjust to new modechange API.
447         Also, free the mode_change object when done.
448         * mkdir.c (main): Likewise.
449         * mkfifo.c (main): Likewise.
450         * mknod.c (main): Likewise.
451         * tests/chmod/equal-X: Check for =xX bug.
452         * tests/chmod/equals: Check for =u bug.
453         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
454
455 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
456
457         Restore support for usages like "head -1" and "tail -1",
458         even when conforming to POSIX 1003.1-2001.
459         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
460         join now supports a NUL field separator, e.g., "join -t '\0'".
461         join now detects and reports incompatible options, e.g.,
462         "join -t x -t y",
463         * NEWS: Document this.
464         * src/date.c: Remove posixver.h and its uses.
465         (COMMON_SHORT_OPTIONS): Remove.
466         (short_options): New constant.
467         (short_options, usage): -I now always takes an optional arg.
468         * src/expand.c: Remove posixver.h and its uses.
469         (shortopts): New constant.  -DIGIT now always takes an optional arg.
470         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
471         Don't complain about -DIGIT.
472         * src/fold.c: Remove posixver.h and its uses.
473         (shortopts): New constant.  -DIGIT now always takes an optional arg.
474         (main): Don't preprocess arg list; that was buggy.  Use method
475         similar to expand.
476         * src/head.c: Remove posixver.h and its uses.
477         (header_mode_option): Remove.
478         (main): Don't complain about obsolete -NUM args.
479         * src/join.c: Remove posixver.h and its uses.
480         (obsolete_usage): Remove.
481         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
482         they haven't been set yet.
483         (tab): Now int, not char.  Initialize to -1 to indicate white space
484         separates columns, so that we can use NUL as a separator.
485         All uses changed.
486         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
487         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
488         suffices.  Use xstrtoul for sizes; it suffices.
489         (decode_field_spec): Report an error and exit on failure.  Return void,
490         not bool.
491         (add_field_list): Likewise.
492         (set_join_field): New function.
493         (enum operand_status): New enum.
494         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
495         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
496         possibilities with obsolete option parsing.
497         (main): Use it.  Do not depend on POSIX version.
498         Check for conflicting options.  Parse obsolete options -j1 and -j2
499         so that it is a pure extension to POSIX 1003.1-2001.
500         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
501         * src/nice.c: Remove posixver.h and its uses.
502         (main): Always support -NUM option.
503         * src/od.c: Remove posixver.h and its uses.
504         (short_options): New constant, which always supports -w[num].
505         (COMMON_SHORT_OPTIONS): Remove.
506         * src/pr.c: Remove posixver.h and its uses.
507         (short_options): New constant, which always supports -S[string].
508         (COMMON_SHORT_OPTIONS): Remove.
509         * src/sort.c: Remove posixver.h and its uses.
510         (short_options): New constant, which always supports -y arg.
511         (COMMON_SHORT_OPTIONS): Remove.
512         (main): Redo workaround for Solaris compatibility with -y.
513         This change isn't visible to the user; it just cleans up the
514         code so that we don't need posixver.h.
515         * src/split.c: Remove posixver.h and its uses.
516         (main): Don't complain about -NUM option.
517         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
518         * src/unexpand.c: Remove posixver.h and its uses.
519         (main): Don't complain about -TAB.
520         * src/uniq.c (main): Don't complain about -NUM.
521
522 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
523
524         * src/nohup.c (main): If getopt fails, exit with status 127,
525         not status 1.  POSIX requires this.
526         * NEWS: Document this.
527
528         * src/nice.c (main): Report proper program name when getopt finds
529         trouble.  Problem reported by Behdad Esfahbod.
530
531         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
532         when the "+x" was being evaluated.
533         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
534         * mkfifo.c (main): Likewise.
535         * mknod.c (main): Likewise.
536         * tests/mkdir/perm: Test for the above bug.
537
538 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
539
540         Port test cases to Microsoft-Windows-related environments,
541         following suggestions from Eric Blake.
542         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
543         * tests/install/basic-1: Undo previous change.
544         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
545         * tests/install/trap: Undo previous change.
546         (sig): New var.  Use it insted of "trap '' CHLD".
547         Append $EXEEXT to executable name.
548
549         "fetish" -> "coreutils" in more places.
550         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
551         (package Coreutils): Renamed from package Fetish.  All uses changed.
552         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
553         remove Fetish.pm.
554
555 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
556
557         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
558         directory is actually a symbolic link.  Problem reported by
559         Eric Blake.
560
561         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
562         than the (incorrect) test -f and the (inadequate) ls.  ls is
563         inadequate because on some hosts a buggy mv will create a file of
564         the wrong type (problem reported by Eric Blake).  Skip this test
565         if test -p doesn't work.
566
567         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
568         since the latter can have shell metacharacters in them (e.g., spaces).
569         This follows up to the 2005-01-17 patch, which missed this occurrence.
570
571 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
572
573         "fetish" -> "coreutils" in several places.
574         * Makefile.cfg (ftp): Remove fetish.sf.net.
575         * Makefile.maint (emit_upload_commands): Likewise.
576         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
577         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
578         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
579
580         * tests/install/basic-1: Use "cat", not "test", to test for
581         ../../src/dd.  Problem reported by Eric Blake.
582
583 2005-04-18  Jim Meyering  <jim@meyering.net>
584
585         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
586
587 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
588
589         Work around a couple of "make check" failures reported for Cygwin
590         and ash by Eric Blake.
591         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
592         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
593
594 2005-04-16  Jim Meyering  <jim@meyering.net>
595
596         * src/dd.c (S_TYPEISSHM): Remove definition.
597         Get the definition by including "stat-macros.h", instead.
598
599 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
600
601         Fix test suite problems reported by Eric Blake on Cygwin.
602         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
603         since POSIX doesn't require rename to fail across file systems.
604         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
605         it's more reliable.
606         (other_partition_tmpdir): Remove df from name as that would be
607         misleading now.
608
609 2005-04-14  Jim Meyering  <jim@meyering.net>
610
611         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
612
613 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
614
615         * src/ls.c (usage): "uid" -> "user ID".
616
617 2005-04-12  Jim Meyering  <jim@meyering.net>
618
619         * src/tsort.c (tsort): Use "%s" as the format string,
620         rather than a diagnostic or a file name.
621
622         * src/comm.c (compare_files): Remove declaration of unused local.
623
624         * src/chown-core.c (chopt_free): Mark parameter as unused.
625
626 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
627
628         * man/chown.x: Reword to match user manual.
629         * man/id.x: Likewise.
630         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
631         for "group ID".
632         * src/whoami.c (usage, main): Likewise.
633
634         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
635         * src/comm.c: Include stdio-safer.h.
636         (compare_files): Exit right away on I/O error rather than continuing
637         and producing confusing output and error messages.
638         Return void, not int; all callers changed.
639         Use fopen_safer to avoid confusion with file descriptors.
640         * src/copy.c: Include unistd-safer.h.
641         (copy_reg): Use fd_safer.
642         * src/csplit.c: Include stdio-safer.h.
643         (input_desc): Remove unnecessary static initialization.
644         (set_input_file): Use STDIN_FILENO, not 0.
645         (create_output_file): Use fopen_safer.
646         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
647         return stdin.
648         * src/head.c (head_file): Don't assume open does not return 0.
649         * src/join.c: Include stdio-safer.h.
650         (main): Use fopen_safer.  Simplify the resulting code.
651         * src/md5sum.c (digest_file, digest_check):
652         Don't assume that fopen does not return stdin.
653         * src/nohup.c: Include unistd-safer.h.
654         (main): Don't dup stderr to stdin or stdout by mistake.
655         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
656         * src/paste.c (paste_serial): Likewise.
657         * src/pr.c: Include stdio-safer.h.
658         (open_file): Use fopen_safer.
659         (close_file): Don't assume fopen does not return stdin.
660         * src/ptx.c (main): Don't assume fopen returns stdout after closing
661         stdout.  Use freopen instead.
662         * src/shred.c: Include unistd-safer.h.
663         (wipename): Use fd_safer on directory file descriptor.
664         (wipefile): Remove special case for /dev/fd/* on older hosts.
665         It didn't work in general, and wasn't documented.
666         Use fd_safer.
667         * src/sort.c: Include unistd-safer.h.
668         (create_temp_file): Use fd_safer.
669         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
670         * src/split.c: Include unistd-safer.h.
671         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
672         version, as POSIX requires.
673         * src/sum.c (bsd_sum_file, sysv_sym_file):
674         Use same pattern as elsewhere for checking for stdin.
675         * src/tac.c: Include unistd-safer.h.
676         (copy_to_temp): Use fd_safer.
677         (tac_file): Don't assume fopen cannot return stdin.
678         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
679         (recheck, tail_file): Use fd_safer rather than open_safer.
680         * src/tee.c: Include stdio-safer.h.
681         (tee): Use fopen_safer.
682         * src/touch.c: Include unistd-safer.h.
683         (touch): Use fd_safer.
684         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
685         removed.
686         (tsort): Do not assume fopen can't return stdin.
687         Close stdin before returning.  All uses changed.
688         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
689         * src/uniq.c: Include stdio_safer.h.
690         (check_file): Don't assume fopen cannot return stdin or stdout.
691
692 2005-04-09  Jim Meyering  <jim@meyering.net>
693
694         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
695
696         Now that close_stdout closes standard output unconditionally,
697         these workarounds for dd and cat are no longer necessary.
698         * src/dd.c (close_stdout_wrapper): Remove function.
699         (main): Call atexit with close_stdout, instead.
700         * src/cat.c (close_stdout_wrapper): Likewise.
701         Don't close STDOUT_FILENO explicitly; close_stdout does it.
702
703         * src/system.h (__attribute__): Readability nit:
704         Change this:
705         #  define __attribute__(x)
706         to this:
707         #  define __attribute__(x) /* empty */
708
709 2005-04-09  Jim Meyering  <jim@meyering.net>
710
711         * src/rm.c (usage): Mention that --recursive removes listed
712         directories too, not just their contents.
713         Say that by default, rm does not remove directories.
714
715         * src/pr.c: Don't include "timespec.h".  system.h does that.
716         * Makefile.maint (sc_system_h_headers): Propagate exit status
717         through trap.
718
719 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
720
721         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
722         and when conforming to POSIX no longer treats USR1 specially.
723         Document that dd no longer dumps core when handling signals.
724         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
725         replaced with void.
726         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
727         All uses changed.
728         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
729         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
730         behavior when called from a signal handler.  All uses changed.
731         (main) [!defined SA_NOCLDSTOP]:
732         Use siginterrupt to specify that system calls should be interrupted.
733         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
734         (process_signals): Add forward decl.
735         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
736         New macros.
737         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
738         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
739         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
740         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
741         New vars.
742         (usage): Mention -USR1 versus -INFO.
743         (cleanup): Don't invoke print_stats; the caller must do it now.
744         All callers changed.
745         (quit): Process signals just before exiting.
746         (interrupt_handler): Simply record the signal and return.
747         (siginfo_handler): Simply increment the signal counter and return.
748         (install_handler): Remove, replacing with:
749         (install_signal_handlers, process_signals, iread, iwrite):
750         New functions.  All callers to safe_read and full_write replaced
751         by iread and iwrite.  All callers to install_handler replaced by
752         install_handlers.
753         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
754         All uses changed.
755         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
756         (main) [! SA_NOCLDSTOP]: Use it.
757         * src/shred.c: Remove all uses of signals; modern hosts have
758         /dev/random and don't need this gorp.
759         Do not include signal.h.
760         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
761         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
762         All uses changed.
763         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
764         (main) [! SA_NOCLDSTOP]: Use it.
765
766         * src/dd.c: Do not include inttostr.h, no longer needed.
767         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
768         instead of umaxtostr.
769         (print_stats): Work even in languages that have special
770         forms for two of things, for r_truncate and w_bytes.  We can't
771         fix delta_s in this way, since ngettext doesn't support floating-point.
772         (main): Rewrite to avoid casts.
773
774 2005-04-07  Jim Meyering  <jim@meyering.net>
775
776         Placate gcc-4's -Wuninitialized.
777         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
778         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
779
780         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
781         be `const'.
782         (binop): Move function definition to precede first use so we can...
783         (binop): ...remove prototype.
784
785 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
786
787         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
788         * src/basename.c (usage): Add examples.
789         * src/cat.c (usage): Likewise.
790         * src/chgrp.c (usage): Likewise.
791         * src/chown.c (usage): Likewise.
792         * src/dirname.c (usage): Likewise.
793
794 2005-04-05  Jim Meyering  <jim@meyering.net>
795
796         * src/nice.c (usage): Mention that some shells provide a
797         built-in function by the same name.
798         * src/nohup.c (usage): Likewise.
799         * src/printenv.c (usage):Likewise.
800
801 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
802
803         * src/tee.c (tee): When closing files, do not close stdout,
804         leave this job to close_stdout() instead.
805         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
806         * tests/Makefile.am (SUBDIRS): Add tee.
807         * tests/tee/Makefile.am: New file.
808         * tests/tee/.cvsignore: Likewise.
809         * tests/tee/{basic,dash}: New tee tests.
810
811 2005-04-04  Jim Meyering  <jim@meyering.net>
812
813         * src/echo.c (usage): Mention that some shells provide a
814         built-in function by the same name.
815         * src/kill.c (usage): Likewise
816         * src/printf.c (usage): Likewise.
817         * src/pwd.c (usage): Likewise.
818         * src/stat.c (usage): Likewise.
819         * src/test.c (usage): Likewise.
820         * src/true.c (usage):
821         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
822
823         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
824         * man/printf.x: Likewise.
825         * man/pwd.x: Likewise.
826
827 2005-04-03  Jim Meyering  <jim@meyering.net>
828
829         * src/pr.c (main): Fix off-by-one error.
830         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
831         end of a malloc'd buffer.
832
833 2005-04-01  Jim Meyering  <jim@meyering.net>
834
835         * src/pr.c (main): Free column_count_string when done with it.
836
837         Don't let pr treat +1:-1 like +1:18446744073709551615.
838         * src/pr.c (strtoumax): Remove declaration.
839         (first_last_page): Use xstrtoumax in place of strtoumax,
840         so we don't interpret a negative page number (e.g., in an option
841         like --pages=1:-1) as valid.
842         * tests/pr/Test.pm (neg-page): Add a test for this.
843
844 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
845
846         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
847         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
848         * src/users.c (users): Likewise.
849         * src/who.c (who): Likewise.
850         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
851         * src/users.c (main): Likewise.
852         * src/who.c (main): Likewise.  Also with two arguments.
853         Omit duplicate code in 2-arg case.
854         (UT_PID): Moved to ../lib/readutmp.h.
855
856 2005-03-29  Jim Meyering  <jim@meyering.net>
857
858         * src/system.h (ptr_align): Declare `ptr' parameter to be a
859         `const' pointer, since this function never writes through it.
860
861         * src/uname.c: Indent cpp directives to reflect nesting.
862
863 2005-03-28  Jim Meyering  <jim@meyering.net>
864
865         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
866         Add `void' to make this an ANSI-style function declaration.
867         * src/remove.c (ds_init): Likewise.
868         * src/pr.c (print_sep_string): Likewise.
869
870         * src/stty.c (speeds): Declare this array to be static.
871         * src/Makefile.am (sc_tight_scope): Adjust to catch any
872         new declarations like that of stty.c's `speeds'.
873
874         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
875         (GETOPT_VERSION_OPTION_DECL): Likewise.
876         * src/chown.c (long_options): Likewise.
877         * src/chgrp.c (long_options): Likewise.
878         * src/chmod.c (long_options): Likewise.
879         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
880         Likewise.
881         * src/chown-core.c (chopt_init): Likewise.
882         * src/comm.c (long_options): Likewise.
883         * src/copy.c (copy_reg): Likewise.
884         * src/csplit.c (extract_regexp): Likewise.
885         * src/cut.c (longopts): Likewise.
886         * src/date.c (time_spec_string): Likewise.
887         * src/df.c (find_mount_point, show_point): Likewise.
888         * src/expr.c (docolon): Likewise.
889         * src/fmt.c (long_options): Likewise.
890         * src/ls.c (time_style_args, indicator_style_args, long_options)
891         (format_args, sort_args, time_args, decode_switches)
892         (gobble_file): Likewise.
893         * src/md5sum.c (long_options): Likewise.
894         * src/mv.c (reply_args): Likewise.
895         * src/paste.c (longopts): Likewise.
896         * src/pinky.c (print_entry): Likewise.
897         * src/pr.c (long_options): Likewise.
898         * src/ptx.c (long_options, format_args): Likewise.
899         * src/readlink.c (longopts): Likewise.
900         * src/sort.c (long_options, mergefps): Likewise.
901         * src/stat.c (long_options): Likewise.
902         * src/tac.c (main): Likewise.
903         * src/tail.c (follow_mode_string): Likewise.
904         * src/touch.c (longopts, time_args): Likewise.
905         * src/uniq.c (delimit_method_string): Likewise.
906         * src/uptime.c (print_uptime): Likewise.
907         * src/who.c (print_user): Likewise.
908
909 2005-03-27  Jim Meyering  <jim@meyering.net>
910
911         * src/dcgen: Simplify further, clean up.
912         Add a standard-output-closing global destructor.
913         Require perl-5.002.
914         * src/wheel-gen.pl: Use the same global destructor as dcgen.
915
916 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
917
918         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
919         array of adjacent strings rather than a more complicated data
920         structure; this saves space in the dircolors executable.
921         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
922         This avoids casts.
923         (dc_parse_stream, main): Avoid casts.
924         Adjust to simpler data structure generated by new dcgen.
925
926 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
927
928         * src/ls.c (usage): Document usage of LS_COLORS.
929
930 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
931
932         * src/dircolors.hin: Add "TERM cygwin".
933
934 2005-03-25  Jim Meyering  <jim@meyering.net>
935
936         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
937         the return value, and update callers:
938         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
939         * src/expand.c (parse_tab_stops, main): Likewise.
940         * src/split.c (main): Likewise.
941         * src/unexpand.c (parse_tab_stops, main): Likewise.
942         * src/uniq.c (main): Likewise.
943
944 2005-03-22  Jim Meyering  <jim@meyering.net>
945
946         * build-aux: New directory.  Renamed from config.
947         * configure.ac: Reflect renaming: config -> build-aux.
948         * Makefile.am (dist-hook): Likewise.
949         * Makefile.maint: Likewise.
950         * Makefile.cfg (cvs_files): Likewise.
951         * .x-sc_sun_os_names: Likewise.
952         * .x-sc_trailing_blank: Likewise.
953
954         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
955         portability to EBCDIC hosts.
956
957 2005-03-20  Jim Meyering  <jim@meyering.net>
958
959         * src/pr.c (init_header): Add missing `%' in new format string.
960         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
961
962 2005-03-19  Jim Meyering  <jim@meyering.net>
963
964         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
965         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
966
967 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
968
969         * NEWS: pr -D "FORMAT" now accepts the same formats that
970         date +"FORMAT" does.
971         * src/pr.c: Include strftime.h, timespec.h.
972         (init_header): Obtain and format nanosecond part of time stamp.
973
974         * NEWS: nohup now ignores the umask when creating nohup.out.
975         nohup now closes stderr if it is a terminal and stdout is closed.
976         * src/nohup.c (main): Likewise.  Be a little more paranoid about
977         return values; e.g., check for any negative return from open.
978         Assume free (NULL) works.
979         Close file descriptor leak when redirecting standard output to a file.
980
981 2005-03-17  Jim Meyering  <jim@meyering.net>
982
983         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
984         in place of functionally-equivalent code.
985         * src/expand.c (parse_tab_stops, main): Likewise.
986         * src/split.c (main): Likewise.
987         * src/unexpand.c (parse_tab_stops, main): Likewise.
988         * src/uniq.c (main): Likewise.
989         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
990         declaration.
991         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
992         New macros.
993
994         Before, this command would make uniq skip 11 fields and print
995         only the first line:
996         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
997         1 1
998         1 2
999         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
1000         not like `uniq -f11'.
1001
1002 2005-03-15  Jim Meyering  <jim@meyering.net>
1003
1004         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
1005         `pr -0' should give a better diagnostic and `pr -03' should be
1006         equivalent to `pr -3'.
1007         * src/pr.c (parse_column_count): Change return type to void.
1008         Call error (EXIT_FAILURE, ... for an invalid string.
1009         (main): Allocate space for column_count_string using malloc.
1010         Accumulate all old-style column-count digits before converting.
1011         When the number of columns is specified via both old-style,
1012         (e.g., -3), and a long option (--columns=5), ensure that only
1013         the last one specified takes effect.
1014         * tests/pr/Test.pm: Add tests for the above.
1015
1016 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1017
1018         * src/copy.c (copy_reg): Copy regular files in binary mode.
1019
1020 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
1021
1022         * NEWS: Restate why ls limits time stamp lengths.
1023
1024 2005-03-12  Jim Meyering  <jim@meyering.net>
1025
1026         Add a little infrastructure to help prevent future bugs like the
1027         one fixed below.
1028         * src/stat.c (xstrcat): New function.
1029         (print_statfs, print_stat): Add buf_len parameter and convert all
1030         uses of strcat to xstrcat.  Update callers.
1031         (print_it): Call print_func with buf_len parameter.
1032
1033         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
1034         could cause a buffer overrun error.
1035         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
1036         conversion of the stat %s format string to the longer printf %llu one.
1037         Patch from Guochun Shi.
1038
1039 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
1040
1041         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
1042         (long_time_expected_width, print_long_format): Use it, to avoid
1043         some possible denial-of-service attacks.
1044         * NEWS: Document this.
1045
1046 2005-03-11  Jim Meyering  <jim@meyering.net>
1047
1048         Prompt once again for `mv -i A B' when A and B are hard links
1049         to the same file.  This fixes a bug introduced by my 2003-04-04
1050         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
1051         * src/copy.c (abandon_move): New function, factored out of
1052         copy_internal, now that this code is being used from two places.
1053         (copy_internal): Perform the same interactive-related test for
1054         whether it's alright to proceed and (usually) overwrite the
1055         destination file.
1056         * tests/mv/i-4: Add tests for the above.
1057
1058         Don't segfault for a very long date format string, e.g.,
1059         ls -ld --time-style=+%99999999H .
1060         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
1061         so format string abuse cannot provoke stack overflow.
1062         (print_long_format): Likewise.
1063
1064         Don't segfault for a long header date string, e.g.,
1065         echo a|pr -D +%9999999A
1066         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
1067         Don't bother with fixed-sized initial buffer;  always use x*alloc.
1068
1069         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
1070         in place of equivalent INT_STRLEN_BOUND + 1.
1071         * src/expr.c (tostring, printv): Likewise.
1072
1073 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
1074
1075         * src/system.h: Include intprops.h.
1076         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1077         they are now defined in intprops.h.
1078
1079 2005-03-09  Jim Meyering  <jim@meyering.net>
1080
1081         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
1082
1083 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
1084
1085         * src/date.c (usage): Redo to match recent documentation changes.
1086         Don't bother documenting which usages are GNU extensions; the list
1087         wasn't correct, and is better left to the printed manual anyway.
1088
1089 2005-03-06  Jim Meyering  <jim@meyering.net>
1090
1091         Factor out column-count processing.
1092         * src/pr.c: Include "inttostr.h".
1093         (parse_column_count): New function.
1094         (main): Use the new function for both old-style, -9, and long,
1095         --columns=-9, options.
1096
1097         * src/cksum.c: Remove `register' keyword.
1098         * src/cut.c: Likewise.
1099         * src/dd.c: Likewise.
1100         * src/env.c: Likewise.
1101         * src/factor.c: Likewise.
1102         * src/fmt.c: Likewise.
1103         * src/fold.c: Likewise.
1104         * src/id.c: Likewise.
1105         * src/logname.c: Likewise.
1106         * src/ls.c: Likewise.
1107         * src/pr.c: Likewise.
1108         * src/printf.c: Likewise.
1109         * src/shred.c: Likewise.
1110         * src/sort.c: Likewise.
1111         * src/sum.c: Likewise.
1112         * src/test.c: Likewise.
1113         * src/tsort.c: Likewise.
1114         * src/uniq.c: Likewise.
1115         * src/wc.c: Likewise.
1116         * src/whoami.c: Likewise.
1117
1118 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1119
1120         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1121         longer needed.
1122
1123 2005-03-01  Jim Meyering  <jim@meyering.net>
1124
1125         * src/copy.c (copy_internal): Change test of source type from
1126         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1127         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1128
1129 2005-02-28  Jim Meyering  <jim@meyering.net>
1130
1131         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1132
1133 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1134
1135         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1136         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1137         hosts with clock_gettime.
1138
1139 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1140
1141         * NEWS: Describe user-visible change to dd.
1142         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1143         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1144         gethrxtime instead.
1145         * src/dd.c: Include gethrxtime.h, xtime.h.
1146         (start_time): Now of type xtime_t, not struct timespec.
1147         (print_stats, main): Use gethrxtime rather than gettime.
1148         * src/ls.c (time): Remove obsolete decl.
1149         (get_current_time): gettimeofday always returns 0, so don't
1150         check its result.
1151         * src/shred.c: Include gethrxtime.h.
1152         (isaac_seed): Use gethrxtime rather than a mishmash.
1153         * src/touch.c (time): Remove obsolete decl.
1154
1155         * tests/misc/split-fail: Don't assume that the current host
1156         supports integers wider than 32 bits.  Fix comment typo.
1157         * tests/od/x8: Likewise.
1158
1159         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1160         as it's not valid in standard C89.
1161
1162 2005-02-15  Jim Meyering  <jim@meyering.net>
1163
1164         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1165         so that file systems of type `xfs' are recognized as such.
1166         * src/fs.h: Regenerate.
1167         Reported by Bernd Eckenfels.
1168         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1169         * src/fs.h: Regenerate.
1170         Reported by Andreas Schwab.
1171
1172         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1173         to work around the invalid definition from Darwin 7.7.0.
1174         Test failure reported by Sébastien Maret.
1175
1176 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1177
1178         * src/sort.c (mergefps): Use binary search rather than linear one
1179         when comparing new line to lines already in main memory.
1180         Idea suggested by James Lemley.
1181
1182 2005-02-09  Jim Meyering  <jim@meyering.net>
1183
1184         * src/copy.c (valid_options): Add an assertion that
1185         not both hard_link and symbolic_link are set.
1186
1187 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1188
1189         * NEWS: Document stat -f -c %S, plus changes to default formats.
1190         * doc/coreutils.texi (stat invocation): Normalize terminology,
1191         capitalization, and sort order to match --help output.  Mention %c
1192         for file systems.  Add new -f -c format %S, and document %s versus %S;
1193         problem reported by Jeroen van Wolffelaar.
1194         * src/stat.c (usage): Likewise.
1195         (STATFS_FRSIZE): New macro.
1196         (print_statfs): Use it, for stat -f -c %S.
1197         (do_statfs): Change default formats to output %S.
1198
1199 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1200
1201         * src/system.h: Include "memrchr.h".
1202         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1203
1204 2005-02-02  Jim Meyering  <jim@meyering.net>
1205
1206         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1207         systems that don't support sparse files.
1208         Check for $2 -ge 128, rather than $2 = 128, in case
1209         there is a file system type that doesn't support sparse files,
1210         yet for which metadata takes up additional space.
1211         Both reported by Andreas Schwab.
1212
1213 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1214
1215         * tests/du/8gb: Create a larger test file, so we properly
1216         detect that sparse files can be created on NTFS under cygwin.
1217
1218 2005-01-30  Jim Meyering  <jim@meyering.net>
1219
1220         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1221
1222         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1223
1224 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1225
1226         * .cvsignore: Ignore config.cache and config.status.lineno.
1227         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1228         instead of VSWTCH, for use with CSWTCH.
1229
1230 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1231
1232         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1233         * tests/rwx-to-mode: Ignore ACL designation.
1234         * tests/setgid-check: Likewise.
1235         * tests/chown/separator: Quote user and group names.
1236
1237 2005-01-24  Jim Meyering  <jim@meyering.net>
1238
1239         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1240         Suggestion from Johan Boule.
1241
1242 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1243
1244         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1245         duplicates.
1246         * man/Makefile.am (all_programs): Revert previous patch; updated
1247         all_programs.list fixes this.
1248         (.x.1): No need to add $(EXEEXT).
1249
1250 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1251
1252         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1253         available.
1254
1255 2005-01-22  Jim Meyering  <jim@meyering.net>
1256
1257         * Makefile.maint (v_etc_file): The version string has moved to
1258         version-etc-fsf.c, search that new file, not version-etc.c.
1259
1260 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1261
1262         * tests/group-names: Use numeric group ids, not symbolic group names,
1263         since the latter can have shell metacharacters in them (e.g., spaces).
1264         Problem reported by Eric Blake.
1265         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1266         * tests/chgrp/deref: Likewise.
1267         * tests/chgrp/posix-H: Likewise.
1268         * tests/chgrp/recurse: Likewise.
1269
1270 2005-01-15  Jim Meyering  <jim@meyering.net>
1271
1272         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1273         because just calling gethrtime evokes an `illegal instruction'
1274         failure when compiled with Sun's c89 on Solaris 8 and 9.
1275         Reported by Nelson Beebe.
1276
1277         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1278         twice with the same value of `t'.
1279         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1280
1281 2005-01-14  Jim Meyering  <jim@meyering.net>
1282
1283         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1284         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1285         sockets, since that's what you get when reading from a command-line-
1286         supplied pipe on Darwin 7.7.
1287         (IS_PIPE_LIKE_FILE_TYPE): Define.
1288         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1289         Reported by Nelson Beebe.
1290         This same change is also required on NetBSD/sparc-1.5.
1291         Reported by Adrian Bunk.
1292
1293         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1294         rather than suffering silently.
1295         Before, expr would silently overflow and wrap around:
1296           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1297           1
1298         Now it detects the problem and exits nonzero:
1299           $ ./expr $(echo 2^63|bc) = 0
1300           ./expr: 9223372036854775808: integer is too large
1301
1302         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1303         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1304         reported that this test would fail with the diagnostic,
1305         `cannot find name for group ID 10', on one of his systems.
1306
1307 2005-01-13  Jim Meyering  <jim@meyering.net>
1308
1309         * src/test.c (is_int): Don't overflow when evaluating integer
1310         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1311         would print `FAIL'.
1312
1313         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1314         names of temporary files that would clash on 8.3 file systems.
1315         * tests/mk-script (validate): Likewise.
1316
1317 2005-01-12  Jim Meyering  <jim@meyering.net>
1318
1319         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1320
1321         * tests/tr/Test.pm (repeat-xC): Change test name from
1322         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1323         Reported by Eric Blake.
1324         (repeat-000): Rename to `repeat-zeros' for the same reason.
1325
1326 2005-01-11  Jim Meyering  <jim@meyering.net>
1327
1328         * configure.ac: Update version to 5.3.1.
1329
1330 2005-01-11  Eric Blake  <ebb9@byu.net>
1331
1332         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1333         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1334
1335 2005-01-11  Jim Meyering  <jim@meyering.net>
1336
1337         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1338         with decreasing values.
1339
1340         * src/expand.c (main): Likewise.
1341         * src/unexpand.c (main): Check for overflow in tabstop values
1342         specified via the obsolete form.  E.g., now this command fails:
1343         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1344         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1345         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1346
1347 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1348
1349         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1350         * NEWS: Document the changes.
1351         * doc/coreutils.texi (pathchk invocation): Likewise.
1352         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1353         (longopts, usage, main, validate_file_name):
1354         Add support for new -P option.
1355         Reject empty file names (unless -p is not specified and the
1356         current system allows empty file names).
1357         Change --portability so that is now equivalent to -p -P.
1358         Don't test whether file name is too long, if it is known to exist.
1359         (no_leading_hyphen): New function.
1360         * tests/misc/pathchk1: Add tests for empty file names and
1361         pathchk -P.
1362
1363 2005-01-08  Jim Meyering  <jim@meyering.net>
1364
1365         * Version 5.3.0.
1366
1367         `pr --columns=N' was not equivalent to `pr -N' when also using
1368         either -s or -w.
1369
1370         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1371         not just for -N.  This bug has existed since the introduction
1372         of the --columns=N option on 1998-08-15.
1373         * NEWS: Document this.
1374         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1375         create a new test vector using --columns=N.
1376
1377 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1378
1379         * src/pr.c (main): Check for column count overflow with
1380         usages like "pr -2147483648".
1381
1382 2005-01-07  Jim Meyering  <jim@meyering.net>
1383
1384         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1385
1386 2005-01-06  Jim Meyering  <jim@meyering.net>
1387
1388         * README: List the precise HP-UX version numbers that are affected.
1389         Suggestion from Bob Proulx.
1390
1391         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1392         predicate before `-name ChangeLog' to avoid a harmless warning
1393         from find-4.2.10.
1394
1395 2005-01-05  Jim Meyering  <jim@meyering.net>
1396
1397         * tests/help-version: Punt on the uptime test, since it fails when
1398         it can't get boot time, and I don't want that to stop `make check'.
1399
1400         * src/du.c (process_file): Evaluate exclusion rules against
1401         the entire file name, not just the last component.
1402         Reported by Robert Lindgren.
1403         * tests/du/exclude: Test for this.
1404         * NEWS: Document this.
1405
1406         Ensure that tests/Makefile.am's check-root actions stay up to date.
1407         * Makefile.maint (sc_root_tests): New rule.
1408         (syntax-check-rules): Add it to the list.
1409
1410 2005-01-04  Jim Meyering  <jim@meyering.net>
1411
1412         * man/shred.x: Change one-line summary to reflect that shred does
1413         not remove files by default.  Suggestion from Helen Faulkner in
1414         http://bugs.debian.org/288552
1415
1416         * README: Request VERBOSE=yes output when reporting test failures.
1417         Other minor changes.
1418
1419         * tests/Makefile.am (check-root): Update.
1420
1421 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1422
1423         * src/system.h: Undo previous change; we now use Autoconf.
1424
1425 2005-01-03  Jim Meyering  <jim@meyering.net>
1426
1427         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1428         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1429         either (or both) to zero would succeed, but subsequent `stty size'
1430         would say `no size information for this device' due to the ioctl
1431         failing with EINVAL.
1432
1433         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1434         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1435         then fail at compile-time rather than let tools like od produce
1436         invalid results at run time.
1437
1438 2004-12-21  Jim Meyering  <jim@meyering.net>
1439
1440         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1441         not `xx01, xx02, ...'.
1442         Reported by Matt Kraai in http://bugs.debian.org/286605
1443
1444         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1445         when using c89.
1446
1447 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1448
1449         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1450
1451 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1452
1453         * NEWS: Mention that one should eval "`dircolors`" rather than
1454         `dircolors`.
1455
1456 2004-12-17  Jim Meyering  <jim@meyering.net>
1457
1458         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1459         so temporary directories aren't left behind upon e.g., interrupt.
1460
1461 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1462
1463         * src/ls.c (print_dir): Use "%s: not listing already-listed
1464         directory", not "not listing already-listed directory: %s", to
1465         format already-listed directories, to be consistent with other
1466         diagnostics involving file names and colons.
1467
1468 2004-12-15  Jim Meyering  <jim@meyering.net>
1469
1470         * src/Makefile.am (__LDADD): Define, so that building `[' on
1471         Solaris still uses the -lgen library that it requires in order
1472         to get a definition of eaccess.
1473
1474 2004-12-14  Jim Meyering  <jim@meyering.net>
1475
1476         tac would exit immediately upon I/O or temp-file creation failure.
1477         Now it continues on, processing any remaining command line arguments.
1478
1479         * src/tac.c: Include quotearg.h.
1480         Use quotearg_colon in most diagnostics.
1481         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1482         failure.  Before, this command (with /full/tmp being a full partition)
1483           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1484         would exit immediately upon the write error while trying to copy
1485         non-seekable /proc/modules to the full partition.  Now it still
1486         reports the failure but continues on with the remaining file.
1487         (tac_nonseekable): Return false also if copy_to_temp fails.
1488         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1489         using atexit like this is wrong.
1490         * NEWS: Document this.
1491         * tests/misc/tac-continue: New test for this.
1492         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1493
1494         * tests/chown/basic: Add a few more tests.
1495
1496 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1497
1498         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1499         rather than explicit_arg, for consistency with copy.c.
1500         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1501         it is deducible from dirname arg.  All callers changed.
1502         (extract_dirs_from_files, print_dir, queue_directory):
1503         Add command_line_arg arg.  All callers changed.
1504         (struct pending): Add command_line_arg member.
1505         (main): Use NULL rather than 0 when appropriate.
1506         (set_exit_status, file_failure): New functions.
1507         (queue_directory): Store command_line_arg into new structure.
1508         (print_dir, gobble_file, get_link_name):
1509         Use file_failure to report problems in accessing files,
1510         so that the exit status is set consistently.
1511         (print_dir): Simplify readdir failure code yet again.
1512         If closedir fails, report "closing directory" rather than "reading
1513         directory" failure.
1514         (xstrcoll): Use set_exit_status to set status on failure.
1515         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1516         not status 1.
1517
1518 2004-12-11  Jim Meyering  <jim@meyering.net>
1519
1520         Avoid a race condition vulnerability in chown, when used with
1521         --from=O:G and without the (-h) --no-dereference option.
1522         * src/chown-core.c (restricted_chown): New function.
1523         (change_file_owner): Call it.
1524         Reported by Ulrich Drepper.
1525         * NEWS: Mention this.
1526
1527 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1528
1529         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1530         * NEWS: Document this.
1531         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1532         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1533         specified below.
1534         (main): Initialize exit failure to LS_FAILURE.
1535         (print_dir, gobble_file, get_link_name, xstrcoll):
1536         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1537         (print_dir): Do not give up on entire directory merely because readdir
1538         returns EOVERFLOW.
1539         (usage): Explain exit status.
1540         * tests/help-version: ls and variants now exit with status 2
1541         on serious trouble.
1542
1543 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1544
1545         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1546         together.
1547
1548 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1549
1550         * src/factor.c (factor): Don't list 1 as a factor of 1.
1551         Problem reported by Thomas Folz-Donahue.
1552
1553 2004-12-06  Jim Meyering  <jim@meyering.net>
1554
1555         * tests/du/files0-from: Sanitize environment.
1556         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1557         setting is the default (exported from /etc/profile) on at least one
1558         NetBSD 1.6 system.
1559         * tests/du/no-deref: Likewise.
1560         * tests/cp/symlink-slash: Likewise.
1561         * tests/ls/symlink-slash: Likewise
1562
1563 2004-12-05  Jim Meyering  <jim@meyering.net>
1564
1565         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1566         _POSIX2_VERSION=199209 is in the environment, or when building on
1567         e.g., OpenBSD 3.2.
1568
1569 2004-12-04  Jim Meyering  <jim@meyering.net>
1570
1571         * NEWS: Mention cut's new --complement option.
1572
1573 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1574
1575         * cut.c (complement, COMPLEMENT_OPTION): New.
1576         (longopts): Add --complement.
1577         (usage): Say not that -b, -c, and -f `print' fields,
1578         but rather that they `select' fields for printing.
1579         Describe the new --complement option.
1580         (mark_range_start): Extracted from set_fields.
1581         (print_kth): Support --complement.
1582         (compare_ranges): New function.
1583         (set_fields): Rewrite the part that populates range_start_ht,
1584         merging it with the part that populates printable_field.
1585         (main): Handle --complement.
1586
1587 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1588
1589         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1590         failed.  This works around an assertion failure reported by
1591         Roberto Nibali in:
1592         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1593
1594 2004-12-02  Jim Meyering  <jim@meyering.net>
1595
1596         With using --color and with LS_COLORS saying not to color
1597         executables, don't stat every file.
1598         * src/ls.c (is_colored): New function.
1599         (gobble_file): Use it.
1600         (main): Use it here, in place of too-strict tests against NULL:
1601         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1602         old test would fail.
1603
1604 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1605
1606         * src/comm.c (compare_files): Assume setlocale exists.
1607         * src/join.c (keycmp): Likewise.
1608         * src/seq.c (decimal_point): Treat like sort.  Now char.
1609         All uses changed.
1610         (main): Assume localeconv exists.  Use same code as sort.
1611         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1612         Assume setlocale exists.
1613         (thousands_sep): Renamed from th_sep.
1614         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1615         (NONZERO): Parenthesize use of arg.
1616         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1617         consistency.  Avoid unnecessary negation by reversing
1618         fraccompare args.
1619         (main): Rewrite localeconv call to match seq.c.
1620         * src/system.h: Assume locale.h exists.
1621         (HAVE_SETLOCALE): Remove.
1622         * src/uniq.c (different): Assume setlocale exists.
1623
1624         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1625         'volatile' on a local variable.  Rewrite to avoid unnecessary
1626         double-assignment to 'func' in the usual case where strcoll does
1627         not fail.
1628
1629 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1630
1631         * src/pinky.c (gethostname): Remove decl.
1632         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1633         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1634         UT_TYPE_BOOT_TIME instead of by-hand code.
1635         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1636         instead of by-hand code.
1637         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1638         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1639         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1640         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1641         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1642         (gethostname): Remove decl.
1643         (list_entries_who, scan_entries): Use the new macros defined above,
1644         for consistency with pinky, uptime, and users.
1645
1646 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1647
1648         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1649         HP's ANSI C compiler.  Declaring int functions causes warnings on
1650         some modern systems and shouldn't be needed to compile on ancient
1651         ones.
1652         * src/copy.h (stat, lstat, rename): Remove decls.
1653         * src/install.c (stat): Remove decl.
1654         * src/ln.c (link, symlink): Remove decls.
1655
1656 2004-11-25  Jim Meyering  <jim@meyering.net>
1657
1658         * man/help2man: Import help2man-1.35.1.
1659         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1660         locally-added --program-name=NAME option.  Now, help2man gets
1661         the name from the [NAME] section (i.e. from our .x file).
1662         * man/install.x: Use `install', not `ginstall' in the one-line
1663         description.  Reported by Brendan O'Dea.
1664         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1665
1666 2004-11-24  Jim Meyering  <jim@meyering.net>
1667
1668         Since the changes of 2004-05-22, the u.saved_cwd member at
1669         the bottom of the active-directory stack was no longer
1670         strictly necessary.  This change removes that member and uses
1671         the newer cwd_state parameter for the final restore_cwd.
1672
1673         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1674         [dev_ino]: Rename from `a'.
1675         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1676         bottom-of-stack cwd-state member.
1677         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1678         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1679
1680 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1681
1682         Minor performance improvements and cleanups for "touch".
1683         * src/touch.c (posix_date): Remove; not needed as a static var.
1684         All uses rewritten.
1685         (touch): Use new futimens function to operate more efficiently
1686         in some cases.  Don't stat/fstat existing file when
1687         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1688         old time stamps aren't needed in that case.
1689         (main): change_times is int, not bool.  Simplify test for
1690         change_times.
1691
1692 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1693
1694         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1695         translation.  Problem reported by Eric S. Raymond.
1696
1697         Restore dd's noctty flag, reverting the change of 2004-04-08.
1698         POSIX does not allow "dd" to use O_NOCTTY by default.
1699         * NEWS: Add noctty flag to dd.
1700         * doc/coreutils.texi (dd invocation): Likewise.
1701         * src/dd.c (flags, usage, main): Likewise.
1702
1703 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1704
1705         * src/ls.c (usage): Clarified description of --no-group (-G),
1706         --human-readable (-h), --inode (-i), --size (-s), --time,
1707         and --time-style.
1708
1709 2004-11-19  Jim Meyering  <jim@meyering.net>
1710
1711         * src/ls.c (usage): Clarify description of --author.
1712         Tweak indentation so that help2man creates better nroff.
1713         Reported by Dan Jacobson.
1714
1715         * src/uniq.c (check_file): Don't check stdout for errors here.
1716
1717         * src/pwd.c (find_dir_entry): Update comment to match reality.
1718
1719 2004-11-18  Jim Meyering  <jim@meyering.net>
1720
1721         * src/pwd.c (robust_getcwd): Correct the comment: this function
1722         constructs the directory name.  The caller prints it.
1723
1724 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
1725
1726         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1727         (do_statfs): Use it.
1728
1729         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1730         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1731         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1732         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1733         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1734         * src/readlink.c (main): argv is not const.
1735
1736         * src/cut.c (usage): Improve documentation along the lines suggested
1737         by Debian 5.2.1-2.
1738         * src/echo.c (usage): Likewise.
1739         * src/expr.c (usage): Likewise.
1740
1741         * src/dircolors.hin: Add putty, screen-bce.
1742
1743         * src/pinky.c (print_entry): Fix memory leak.
1744         * src/who.c (print_user): Likewise.
1745
1746 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1747
1748         * NEWS: New dd operand "status=noxfer".
1749         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1750         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1751         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1752         macros.
1753         (STATUS_NOXFER, statuses): New constants.
1754         (usage, print_stats, scanargs): Add support for status=noxfer.
1755         (usage): Update status output to match new behavior.
1756         (print_stats): Always output complete byte count.
1757         Put space between numbers and units, as SI requires.
1758         Use ngettext so that i18n can use plurals for "byte" and "second".
1759         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1760         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1761         the string.
1762         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1763         problems with regression testing.
1764
1765 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
1766
1767         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1768         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1769         * src/dd.c: Include "human.h".
1770         (w_bytes, start_time): New vars.
1771         (usage): Document new I/O statistics output
1772         (print_stats): Output new I/O statistics.
1773         (cleanup): Do statistics after closing stdin and stdout, so that
1774         the times are more accurate.
1775         (write_output, dd_copy): Count output bytes.
1776         (main): Get initial value of clock.
1777
1778 2004-11-14  Jim Meyering  <jim@meyering.net>
1779
1780         Backslash-escape `-'s in email addresses, so that they are
1781         rendered properly in UTF-locales.
1782         * man/help2man (escape_hyphens): New function.
1783         (main): Call it on email addresses.
1784
1785         * src/sort.c (zaptemp): Mark new diagnostic for translation.
1786
1787         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
1788         * tests/misc/Makefile.am (TESTS): Add close-stdout.
1789
1790 2004-11-13  Jim Meyering  <jim@meyering.net>
1791
1792         * src/test.c (usage): Put the description of `[-n] STRING'
1793         on two lines, one for `-n STRING' and one for `STRING' so that
1794         help2man properly escapes the `-'.  Otherwise, the hyphen is
1795         rendered inappropriately in UTF-8 locales.
1796         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1797
1798 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
1799
1800         * NEWS: Document the following changes.
1801
1802         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1803         files.
1804         (temptail): New variable, so that we can easily append to list.
1805         (create_temp_file): Create new files at end of list, so that
1806         searching the list has O(N*NMERGE) behavior instead of O(N**2).
1807         (zaptemp): Update temptail if needed.
1808         (mergefps, merge): Accept new arg that counts temp files, and keep it
1809         up to date as we create and remove temporaries.  This is for
1810         efficiency, so that we don't call zaptemp so often.
1811         All callers changed.
1812         (sort): Don't create array in reverse order, since the list of
1813         temporaries is now in the correct order.
1814
1815         (zaptemp): Protect against race condition: if 'sort' is
1816         interrupted in the middle of zaptemp, it might unlink the
1817         temporary file twice, and the second time this happens the file
1818         might already have been created by some other process.
1819
1820         (zaptemp): Warn if a temporary file is not removed.
1821
1822         (create_temp_file): Use offsetof for clarity.
1823         (die): Move it up earlier, to clean up the code a bit.
1824
1825         * src/pr.c (strtoumax): Declare if not declared.
1826         (skip_to_page, first_page_number, last_page_number, page_number,
1827         first_last_page, print_header):
1828         Use uintmax_t for page numbers.
1829         (first_last_page): Remove unnecessary forward declaration.
1830         Do not modify arg (it is now a const pointer).
1831         Return a true if successful, false (without print a diagnostic)
1832         otherwise.
1833         (main): If +XXX does not specify a valid page range, treat it
1834         as a file name.  This follows the response to Open Group XCU ERN 41
1835         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1836         which says the behavior is allowed.
1837         (skip_to_page): When starting page number exceeds page count,
1838         print both numbers in the diagnostic.
1839         (print_header): Detect page number overflow.
1840
1841 2004-11-07  Jim Meyering  <jim@meyering.net>
1842
1843         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1844         (main) [__APPLE__]: Get the processor type via syscall rather than
1845         hard-coding "powerpc".  From Toby Peterson.
1846
1847         * src/sort.c (merge): Remove declarations of now-unused variables.
1848
1849 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
1850
1851         * src/sort.c (first_same_file): Remove.  Move most of the code to....
1852         (avoid_trashing_input): New function.
1853         (merge): Avoid some silly merges, e.g., copying a single file to
1854         a temporary file when there are exactly 17 input files to merge.
1855         Take a count of temporary files rather than a max_merge arg.
1856         All uses changed.
1857
1858 2004-11-06  Jim Meyering  <jim@meyering.net>
1859
1860         * src/sort.c (xfclose): Don't close stdout here (just flush it),
1861         since close_stdout now closes stdout unconditionally.
1862
1863 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
1864
1865         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1866         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1867         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1868         temporary files).
1869         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1870         thus avoiding unchecked stack overflow in some cases.  As a side
1871         effect this improve the performance of "sort -M" by a factor of 4
1872         on my benchmarks.
1873
1874 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
1875
1876         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1877
1878         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1879         expression; it's not portable.  Problem reported by Albert Chin.
1880         Don't invoke a program more than once.
1881         * src/groups.sh (version): New variable, containing author info,
1882         for benefit of AUTHORS check.  Use it when acting on --version option.
1883         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
1884         in groups line.
1885
1886         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1887         as this breaks the new regime that does "#define getopt rpl_getopt".
1888         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1889         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1890         I suppose this may cause problems on ancient hosts with
1891         incompatible getopt declarations, but we'll cross that bridge if
1892         the problem gets reported to us by someone who can test the fix.
1893
1894 2004-11-03  Jim Meyering  <jim@meyering.net>
1895
1896         * src/tac.c: quote(...) file names in diagnostics.
1897
1898 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
1899
1900         * NEWS: Document getdate changes.
1901
1902 2004-10-29  Jim Meyering  <jim@meyering.net>
1903
1904         * src/tac.c (tac_file): Remove temporary prototype and move this
1905         function `down' so that it precedes definition of tac_nonseekable.
1906
1907         `tac /proc/modules' would print nothing
1908         Reported by Harald Dunkel in http://bugs.debian.org/278604.
1909
1910         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1911         now it copies a general file descriptor, not just stdin.
1912         (tac_nonseekable): Renamed/adapted from tac_stdin.
1913         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1914         since we never used the stream.  Perform "-" to stdin mapping here
1915         rather than in main.  Determine whether a file is seekable,
1916         by trying to `lseek' to its end, and dispatch to tac_seekable or
1917         tac_nonseekable accordingly.
1918         (main): Rewrite argument handling now that it uses only tac_file.
1919         * NEWS: Mention it here.
1920
1921 2004-10-21  Jim Meyering  <jim@meyering.net>
1922
1923         * tests/mv/leak-fd: New file.
1924         * tests/mv/Makefile.am (TESTS): Add it.
1925         * tests/rm/dot-rel: New file.
1926         * tests/rm/Makefile.am (TESTS): Add it.
1927
1928         Correct my patch of 2004-10-18.
1929         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1930         if necessary, not in remove_dir.  Otherwise, removing multiple
1931         `.'-relative nonempty directories no longer worked.
1932
1933 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
1934
1935         * src/fmt.c (usage): Improve description of --prefix.
1936         Problem reported by Edward Welbourne.
1937
1938         * man/uniq.x: Change summary so that it doesn't imply that
1939         uniq writes to its input file.  Problem reported by
1940         Dan Jacobson.
1941
1942 2004-10-18  Jim Meyering  <jim@meyering.net>
1943
1944         Plug a leak that would cause a cross-device mv to fail when
1945         operating on too many command-line-specified nonempty directories.
1946         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1947         top of the stack before returning.  This usually closes the file
1948         descriptor that was used to return to the original working directory.
1949         Reported by Cyril Bouthors in
1950         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1951         * NEWS: Mention it here.
1952
1953         * src/pathchk.c (validate_file_name): Give a more descriptive
1954         diagnostic when pathconf fails.  This also avoids an unwarranted
1955         warning from gcc-3.3.5 about a format not being a string literal.
1956
1957         * src/sleep.c (main): Remove declaration of unused local, c.
1958         * src/printenv.c (main): Likewise.
1959         * src/logname.c (main): Likewise.
1960         * src/uptime.c (main): Likewise, for optc.
1961         * src/tsort.c (main): Likewise, for opt.
1962
1963 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
1964
1965         * AUTHORS: Add self to pathchk.
1966         * src/pathchk.c (AUTHORS): Add self.
1967         Change "path" to "file name" whenever possible.
1968         Remove usage comment, as it was a duplication of the code or doc.
1969         Include <wchar.h> if available.
1970         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1971         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1972         pathconf_wrapper, portable_chars, dir_ok): Remove.
1973         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1974         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1975         (portable_chars_only): New arg FILELEN.
1976         Don't assume ASCII; we might be on an EBCDIC host.
1977         Don't assume unibyte locale in diagnostic.
1978         (component_start, component_len): New functions.
1979         (validate_file_name): Renamed from validate_path.  All uses changed.
1980         Pretty much a complete rewrite.
1981         Don't make copy of file arg.  Always append trailing slash to
1982         pathconf arg, just in case it's a symlink (this is pure paranoia;
1983         we don't know of any hosts where the trailing slash is required).
1984         Use size_t instead of long int when possible.
1985         Avoid need to call pathconf in most practical cases.
1986         Don't use euidaccess several times to test searchability;
1987         just use lstat once.  Reword diagnostic to put the (often very long)
1988         file names last.
1989
1990 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
1991
1992         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1993
1994 2004-10-13  Jim Meyering  <jim@meyering.net>
1995
1996         * NEWS: Mention today's fts.c fix.
1997
1998 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
1999
2000         * tests/stty/row-col-1: Set LC_ALL=C.
2001
2002 2004-10-12  Jim Meyering  <jim@meyering.net>
2003
2004         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
2005         From Jesus Climent in http://bugs.debian.org/276149.
2006
2007 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
2008
2009         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
2010         problems.  All uses changed.
2011
2012 2004-10-05  Jim Meyering  <jim@meyering.net>
2013
2014         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
2015         since Karl says its trailing blanks are there to stay :-)
2016
2017 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
2018
2019         * src/expr.c (NEW, OLD): Remove, partly to avoid
2020         reference to obsolescent macro XMALLOC.
2021         All uses replaced by xmalloc and free.
2022
2023 2004-09-28  Jim Meyering  <jim@meyering.net>
2024
2025         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
2026         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2027
2028 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
2029
2030         * src/od.c (format_address_paren): c is optional, so don't output
2031         it if it's '\0'.
2032
2033 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
2034
2035         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
2036         * NEWS: Document this.
2037         * src/ls.c (file_ignored): Renamed from file_interesting, with
2038         inverted return value.  Accept the file name, not a struct dirent *.
2039         All uses changed.  Avoid the expense of calling fnmatch if the
2040         file is ignorable due to leading '.'.
2041         (all_files, really_all_files): Removed; replaced by:
2042         (ignore): New variable.  All uses changed.
2043         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
2044         New constants.
2045         (hide_patterns): New variable.
2046         (long_options, decode_switches, file_ignored, usage):
2047         Add support for --hide.
2048         (patterns_match): New function.
2049         (usage): Replace "hide" with "ignore" in explanation, to avoid
2050         confusion.
2051
2052 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
2053
2054         * src/ls.c (gobble_file, print_long_format): Don't assume that
2055         human-readable output has a byte count equal to its column width;
2056         this isn't always true in locales where the radix character is not
2057         '.' or ','.
2058         (format_user_or_group): Revamp code to match the above fix;
2059         this avoids the (very faint) possibility of integer overflow.
2060
2061 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
2062
2063         * NEWS: Mention that "chmod -r -w x" now works as expected.
2064         * src/chmod.c (main): Revamp option processing to support this.
2065         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
2066         * tests/chmod/usage: New set of tests for usage like that.
2067
2068 2004-09-24  Jim Meyering  <jim@meyering.net>
2069
2070         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
2071         it lists only cvs-controlled regular files.
2072
2073         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2074         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
2075
2076 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
2077
2078         * Makefile.maint (CVS_LIST): New macro.
2079         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2080         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2081         sc_trailing_blank, po-check): Use it instead of the
2082         nonstandard "cvsu --list".
2083
2084         * src/tail.c (parse_obsolete_option): Bring back support
2085         for obsolete option followed by non-obsolete, or by more
2086         than one file.  When obsolete, conform to SUSv2 rather than
2087         original POSIX 1003.2-1992, as SUSv2 corrected the case of
2088         "tail -c".  Add support for the SUSv2 "b" modifier.
2089         * NEWS: Mention the above.
2090         * tests/tail/Test.pm: New test case obs-b to check the above.
2091         err-[134] no longer need _POSIX2_VERSION=199209.
2092         Fix comments to match revised behavior.
2093
2094 2004-09-22  Jim Meyering  <jim@meyering.net>
2095
2096         * Use automake-1.9.2.  Regenerate dependent files.
2097
2098         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2099         Improve the comment.
2100
2101         Clean up scoping etc. so that some make `distcheck' tests pass.
2102         * src/csplit.c (xalloc_die): Declare to be static.
2103         * src/chown-core.c (chown_files): Declare as `extern'.
2104         * src/cp-hash.c (remember_created): Likewise.
2105         * src/copy.c (copy): Likewise.
2106         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2107
2108         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2109         * src/unexpand.c: Likewise.
2110
2111         * src/Makefile.am (check-AUTHORS): New rule.
2112         (check): Depend on it.
2113         * AUTHORS: Update.
2114
2115         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2116         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2117
2118 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2119
2120         * src/ls.c (decode_switches): Don't compare a short value
2121         to SIZE_MAX: GCC sometimes complains.
2122
2123 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2124
2125         * NEWS: The following commands now reject unknown options:
2126         basename dirname factor hostname link nohup sync unlink yes
2127         Also, pathchk no longer accepts trailing options.
2128
2129         * src/basename.c: Include <getopt.h>.
2130         * src/chroot.c: Likewise.
2131         * src/dirname.c: Likewise.
2132         * src/factor.c: Likewise.
2133         * src/hostid.c: Likewise.
2134         * src/hostname.c: Likewise.
2135         * src/nohup.c: Likewise.
2136         * src/pwd.c: Likewise.
2137         * src/setuidgid.c: Likewise.
2138         * src/sync.c: Likewise.
2139
2140         * src/basename.c (main): Reject unknown options.
2141         * src/dirname.c (main): Likewise.
2142         * src/factor.c (main): Likewise.
2143         * src/hostid.c (main): Likewise.
2144         * src/hostname.c (main): Likewise.
2145         * src/link.c (main): Likewise.
2146         * src/nohup.c (main): Likewise.
2147         * src/pwd.c (main): Likewise.
2148         * src/setuidgid.c (main): Likewise.
2149         * src/sync.c (main): Likewise.
2150         * src/unlink.c (main): Likewise.
2151         * src/yes.c (main): Likewise.
2152
2153         * src/cat.c (main): Remove unused "case 0".
2154         * src/chgrp.c (main): Likewise.
2155         * src/chmod.c (main): Likewise.
2156         * src/chown.c (main): Likewise.
2157         * src/comm.c (main): Likewise.
2158         * src/cp.c (main): Likewise.
2159         * src/csplit.c (main): Likewise.
2160         * src/cut.c (main): Likewise.
2161         * src/date.c (main): Likewise.
2162         * src/df.c (main): Likewise.
2163         * src/du.c (main): Likewise.
2164         * src/env.c (main): Likewise.
2165         * src/expand.c (main): Likewise.
2166         * src/fold.c (main): Likewise.
2167         * src/head.c (main): Likewise.
2168         * src/id.c (main): Likewise.
2169         * src/install.c (main): Likewise.
2170         * src/join.c (main): Likewise.
2171         * src/ln.c (main): Likewise.
2172         * src/ls.c (decode_switches): Likewise.
2173         * src/mkdir.c (main): Likewise.
2174         * src/mkfifo.c (main): Likewise.
2175         * src/mknode.c (main): Likewise.
2176         * src/mv.c (main): Likewise.
2177         * src/nl.c (main): Likewise.
2178         * src/paste.c (main): Likewise.
2179         * src/pinky.c (main): Likewise.
2180         * src/pr.c (main): Likewise.
2181         * src/ptx.c (main): Likewise.
2182         * src/readlink.c (main): Likewise.
2183         * src/rm.c (main): Likewise.
2184         * src/rmdir.c (main): Likewise.
2185         * src/seq.c (main): Likewise.
2186         * src/shred.c (main): Likewise.
2187         * src/split.c (main): Likewise.
2188         * src/sum.c (main): Likewise.
2189         * src/tac.c (main): Likewise.
2190         * src/tail.c (main): Likewise.
2191         * src/tee.c (main): Likewise.
2192         * src/touch.c (main): Likewise.
2193         * src/tr.c (main): Likewise.
2194         * src/tty.c (main): Likewise.
2195         * src/uname.c (main): Likewise.
2196         * src/unexpand.c (main): Likewise.
2197         * src/wc.c (main): Likewise.
2198         * src/who.c (main): Likewise.
2199
2200         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2201         * src/cksum.c (main): Likewise.
2202         * src/dd.c (main): Likewise.
2203         * src/logname.c (main): Likewise.
2204         * src/printenv.c (main): Likewise.
2205         * src/sleep.c (main): Likewise.
2206         * src/tsort.c (main): Likewise.
2207         * src/uptime.c (main): Likewise.
2208         * src/users.c (main): Likewise.
2209         * src/whoami.c (main): Likewise.
2210
2211         * src/du.c (long_options): Standardize on NULL vs 0.
2212         * src/rm.c (long_opts): Likewise.
2213
2214         * src/logname.c (long_options): Remove.
2215         * src/printenv.c (long_options): Likewise.
2216         * src/sleep.c (long_options): Likewise.
2217         * src/tsort.c (long_options): Likewise.
2218         * src/uptime.c (longopts): Likewise.
2219         * src/users.c (longopts): Likewise.
2220         * src/whoami.c (long_options): Likewise.
2221
2222         * src/pathchk.c (longopts): Add --help, --version.
2223         (main): Use longopts rather than parse_long_options.
2224         * src/stty.c (longpts, main): Likewise.
2225
2226         * src/pathchk.c (main): Don't reorder arguments, so that
2227         we can check weird file names.
2228
2229         * src/readlink.c: Don't include "long-options.h".
2230         * src/sort.c: Likewise.
2231         * src/stty.c: Likewise.
2232
2233         * src/split.c (verbose): Now bool, not int.
2234         (VERBOSE_OPTION): New enum.
2235         (longopts, main): Use it.
2236
2237         * tests/factor/basic: Adjust to new wording in diagnostic
2238         that results from the above changes.
2239
2240 2004-09-21  Jim Meyering  <jim@meyering.net>
2241
2242         * man/rm.x: Say "the response is affirmative" rather than "the
2243         response begins with y or Y", so that the documentation is
2244         accurate in non-English locales.  Problem reported by Munzir Taha.
2245
2246 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2247
2248         * src/echo.c (main): Don't pass NULL to strcmp when
2249         POSIXLY_CORRECT and given no arguments.
2250
2251         * src/md5sum.c (STRING_OPTION): Remove.
2252         (long_options, main): Remove support for undocumented and
2253         obsolete --string option, as suggested in the 1996-09-26 patch.
2254         * NEWS: Document this.
2255
2256         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2257         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2258         you remove such files.  Problem reported by Bert Fischer in:
2259         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2260
2261 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2262
2263         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2264         (long_options, main): Use them instead of magic numbers 2 and 1.
2265         For --string, optarg can't possibly be NULL.
2266
2267         * src/dd.c (usage): Distinguish between options and operands.
2268         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2269         Say "operands" for operands, not "options".
2270         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2271         * tests/dd/misc: Check for "dd --".
2272
2273         * src/chroot.c (main): Reject unknown options instead of
2274         interpreting them as a directory to chroot to.
2275
2276         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2277         The current standard (POSIX 1003.1-2004) is correct.
2278         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2279         collision with builtin function.
2280         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2281         output the first 0 as 8 digits, to make it easier to compare to
2282         the text of the standard.  Output crctab to be a const array.
2283         (crctab): Use result of above changes.
2284         (long_options): Remove; not needed if empty.
2285         (main): getopt_long can't return 0 here, so simplify the code.
2286
2287 2004-09-13  Jim Meyering  <jim@meyering.net>
2288
2289         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2290
2291 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2292
2293         * src/id.c (print_full_info): Don't exit with failure status simply
2294         because a user or group number can't be turned into a name.
2295         Problem reported by Felipe Kellermann in:
2296         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2297
2298 2004-09-12  Jim Meyering  <jim@meyering.net>
2299
2300         * Makefile.maint (my-distcheck): When building with -Werror, also
2301         require -Wshadow.
2302
2303 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2304
2305         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2306         * src/tail.c (parse_obsolete_option): Renamed from
2307         parse_obsolescent_option, since the options are obsolete now.
2308         Remove bool *arg; just exit if there's an error.  Revamp to follow
2309         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2310         file" and "tail -10 -- file" correctly when we are conforming to
2311         the older standard.
2312         (main): Adjust to this change.
2313         * tests/tail/Test.pm (test_vector): minus-* requires
2314         _POSIX2_VERSION=199209 now, to work correctly if there is
2315         an input file.  err-1 and err-3 no longer errors if there
2316         is another file.
2317
2318 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2319
2320         * src/test.c (usage): Document -r, -w, -x more carefully.
2321
2322 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2323
2324         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2325         Document that -h and -L don't dereference.
2326
2327         * NEWS: Document that "tr xy -z" now works as per POSIX.
2328         Sort the descriptions.
2329         * src/tr.c (main): Don't reorder options.
2330         * tests/tr/Test.pm (fowler-1): New test case.
2331
2332 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2333
2334         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2335         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2336         conforming to pre-2001 POSIX.
2337         * NEWS: Document this.
2338         * tests/touch/obsolescent: Test for this bug.  Also, set
2339         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2340         a better test for obsolescent features.
2341
2342         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2343         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2344         plain "sort".
2345
2346         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2347         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2348         (long_options, main): --strings is now -S, not -s.
2349         (usage): Reflect the usage changes.
2350         (parse_old_offset): Do not issue a diagnostic on failure;
2351         callers now do this as necessary.
2352         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2353         Add support for new short options (many undocumented) for
2354         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2355         POSIX-compatible.  Default format is now oS, not o2.
2356         * NEWS: Describe the above.
2357
2358 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2359
2360         * src/stty.c (valid_options): Remove.
2361         (main): Fix some bugs in handling invalid option-combinations
2362         like "stty -F".
2363         (recover_mode): Arg is now char const *, not char *.
2364         (main): Use STDIN_FILENO, not 0.
2365         Simplify option-parsing code a tad.
2366         * tests/stty/basic-1: Check for the fixed bugs.
2367
2368 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2369
2370         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2371         it from ever being nonzero.  Reported by Pozsar Balazs in:
2372         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2373         (human_fstype): Add ramfs, squashfs, sysfs.
2374         Reported by Pozsar Balazs in:
2375         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2376         (human_fstype): Return char const *, not char *.
2377         Simplify internals a bit, and avoid casts.
2378
2379         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2380         (bit_count): Remove.  All uses changed to....
2381         (multiple_bits_set): New function.
2382         (scanargs): Use it, and check separately for each set of
2383         incompatible options, to improve diagnostics.
2384         (MX): Remove.
2385         (apply_translations): Move checks for incompatible options
2386         to scanargs, so that they're done consistently.
2387
2388 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2389
2390         Output correct errno-related diagnostic on "paste" I/O errors.
2391         * src/paste.c (write_error, xputchar): New functions.
2392         (paste_parallel): Use correct errno value after input error.
2393         (paste_parallel, paste_serial): Report errno value after output error.
2394
2395         Port to diet libc.  Problem reported by Felix von Leitner in:
2396         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2397         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2398         it's not portable C to assume FILE is a complete type.
2399         (paste_parallel): Use index test instead of ENDLIST, and NULL
2400         instead of CLOSED.
2401
2402 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2403
2404         POSIX-conformance fixes for "expand" and "unexpand".
2405         Also, consistently use "tab stop" rather than "tabstop".
2406         * NEWS: Document fixes.
2407         * src/expand.c: Revamp to resemble the new unexpand.c better.
2408         (usage): -i does not convert tabs after non-tabs.
2409         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2410         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2411         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2412         (next_file, main): Check fclose against 0, not EOF.
2413         (expand): Remove unnecessary casts.
2414         Add another loop nesting level, for lines, so that per-line variables
2415         are initialized cleanly.
2416         Revamp tab checking.  Check for write error immediately, rather
2417         than just once at the end of the program.
2418         * src/unexpand.c: Lkewise (for the expand.c changes).
2419         (TAB_STOP_SENTINEL): Remove.
2420         (tab_size): Now size_t, not uintmax_t, since we need to store
2421         the sequences of blanks.
2422         (max_column_width): New var.
2423         (usage): Say "blank" where POSIX requires this.
2424         (add_tab_stop): Calculate maximum column width.
2425         (unexpand): Store the pending blanks, instead of merely counting them.
2426         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2427         Get rid of internal label and goto.
2428         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2429         Add blanks-1 through blanks-13.
2430
2431 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2432
2433         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2434         succeed without changing the uid and gid, like FreeBSD.
2435         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2436         through a pointer.  Treat "chgrp '' file" as a no-op change,
2437         as FreeBSD does.
2438         (main): Set chopt.group_name to NULL if the group is the empty
2439         string.
2440         * src/chown-core.c (describe_change): Describe changes to -1:-1
2441         without using "to OWNERSHIP" phrase.
2442         * src/chown.c (usage): "chown '' file" is now allowed.
2443         (main): Do not set user name to the empty string if the group
2444         name is null.
2445         * tests/chgrp/basic: Test "chgrp '' file".
2446         * tests/chown/Makefile.am (TESTS): Add separator.
2447         * tests/chown/separator: New file, partly taken from
2448         Dmitry V. Levin's suggestion in
2449         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2450
2451 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2452
2453         * tests/install/basic-1: Test for the -d regression.
2454
2455 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2456
2457         * src/install.c (main): Fix -d regression introduced with
2458         --target-directory support at 2004-06-25.
2459
2460 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2461
2462         * src/copy.c (copy_internal): When preserving links, unlink
2463         a destination with link count greater than one.  This is so
2464         that commands like "cp -a" don't get confused when copying into
2465         a destination that already contains many hard links.  Problem
2466         reported by Tim Waugh in:
2467         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2468
2469 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2470
2471         Convert all files to UTF-8.
2472         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2473         * tests/sort/Test.pm (16a): Likewise.
2474         * tests/uniq/Test.pm (8): Likewise.
2475         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2476
2477         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2478         * src/shred.c (usage): "-" is an operand, not an option.
2479         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2480         A null file arg means standard output.
2481         (main): "-o -" means to write to a file named "-",
2482         not to standard output.
2483         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2484         to a file named "-".
2485
2486 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2487
2488         * src/install.c (change_timestamps): Fix int->bool conversion
2489         bugs introduced on 2004-07-29.
2490
2491 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2492
2493         * src/shred.c (wipename): Work even if the directory is writeable
2494         and not readable.  Prefer write access, since this should work
2495         better with fdatasync.
2496
2497         * src/csplit.c (xalloc_die): New function.
2498         (main): Remove now-obsolete initialization of xalloc_fail_func.
2499
2500         * src/md5sum.c: Adjust to sha->sha1 renaming.
2501
2502 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2503
2504         Minor code cleanup.
2505         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2506         (can_mode): Make variable local.
2507
2508 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2509
2510         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2511         Do not define, to avoid annoying compiler messages on QNX 6.3.
2512         Problem reported by Johan in:
2513         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2514
2515 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2516
2517         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2518         Define to a concatenation of string literals, not to an expression;
2519         needed for concatenation contexts.
2520         (INTMAX_MAX, INTMAX_MIN): New macros.
2521
2522         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2523         unsigned long; this isn't true for st_ino on Solaris 9.
2524
2525 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2526
2527         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2528         whether to include files.  Include <sys/param.h> if
2529         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2530         (main) [defined __POWERPC__]: Add a kludge to work around a
2531         Mac OS X bug, so that uname -p defaults to "powerpc" if
2532         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2533         fails.  Problem reported by Petter Reinholdtsen in:
2534         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2535
2536         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2537         main): Use bool for booleans.
2538         (writeline, check_file): Use uintmax_t for line counts.
2539         (check_file): Check for and report line number overflow,
2540         when that matters.
2541         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2542         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2543         have_read_stdin, wc, wc_file, main):
2544         Use bool for booleans.
2545         (exit_status): Remove.
2546         (wc, wc_file): Return bool status.  All callers changed.
2547         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2548         * src/whoami.c (main): Print uids using unsigned long int, not
2549         unsigned int.
2550
2551         * src/unexpand.c: Int cleanup and minor reorganization to be more
2552         like src/expand.c.
2553         Include quote.h, xstrndup.h.
2554         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2555         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2556         unexpand, main):
2557         Use bool for booleans.
2558         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2559         Use uintmax_t for column counts.
2560         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2561         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2562         as a tab stop.
2563         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2564         Detect overflow in tab stop string.
2565         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2566         (unexpand): Concatenate input files the same way expand does.
2567
2568         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2569         touch, main): Use bool for booleans.
2570         (main): Avoid integer overflow when given more than INT_MAX
2571         options.
2572         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2573         (have_read_stdin, count_items, scan_zeros, detect_loop,
2574         recurse_tree, walk_tree, tsort, main):
2575         Use bool for booleans.
2576         (exit_status): Remove.
2577         (tsort): Return a success flag instead of storing into a global.
2578         (main): Use it.
2579         * src/tty.c (silent, main): Use bool for booleans.
2580         (main): 0 -> STDIN_FILENO.
2581         * src/uname.c (print_element): Use bool for booleans.
2582
2583         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2584         Remove.  All uses replaced by C99 boolean primitives.
2585         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2586         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2587         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2588         one_argument, main): Use bool for booleans.
2589         (advance, unary_advance): Now inline procedures rather than a macros.
2590         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2591         (term, and, or): When it's easy, loop instead of recursing.
2592         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2593         (binary_operator, unary_operator): Simplify by systematically rewriting
2594         true==FOO to FOO (where FOO is a boolean).
2595         (unary_operator): Don't consider a file to be a regular file
2596         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2597         Remove unnecessary casts.  Remove ifdefs for things like
2598         S_ISSOCK that are no longer needed, since stat-macros.h always
2599         defines them now.
2600
2601         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2602         Use bool for booleans.
2603         (buf_init_from_stdin, buf_free, find_bol, print_line):
2604         Use size_t for sizes.
2605         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2606         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2607         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2608         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2609         Report an error if the result is out of range.
2610         (tac_seekable, main): Check for integer overflow in buffer size
2611         calculations.
2612         (main): Remove unnecessary casts.
2613
2614         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2615         the callee doesn't have to count 'em.  All callers changed.
2616         Don't allocate more space for the arg vector than we'll need.
2617         Use memcpy to copy the args rather than rolling our own loop.
2618         Use size_t for sizes.
2619         (fast_startup, simulate_login, change_environment, log_su,
2620         correct_password, restricted_shell, main): Use bool for booleans.
2621         (longopts): Don't assume change_environment is an int.
2622         Use NULL, not 0, for pointers.
2623         (xsetenv): New function, replacing xputenv and concat.
2624         All callers changed.
2625         (elements): Remove; no longer needed.
2626         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2627         (log_su): 2 -> STDERR_FILENO.
2628         (modify_environment, main): Don't assume that getenv's returned value
2629         has an indefinite lifetime.
2630         (modify_environment): Allocate a larger environ.
2631         (main): Remove an impossible 'case 0'; if it happens now, it'll
2632         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2633         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2634
2635         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2636         (_POSIX_VDISABLE): Remove unnecessary cast.
2637         (struct control_info, visible): Use cc_t for control chars.
2638         (struct control_info): Use size_t for sizes.
2639         (recover_mode, set_mode, display_speed, display_window_size,
2640         valid_options, main, display_changed):
2641         Use bool for booleans.
2642         (integer_arg): Return unsigned long int, not long int.
2643         Accept new max arg; all callers changed, to specify a maximum
2644         value for integer parameters instead of silently overflowing.
2645         (wrap): Do not overrun the stack buffer if the output contains
2646         more than 1024 bytes.  Instead, malloc a buffer.
2647         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2648         Remove unnecessary casts.
2649         (set_control_char): Allow int values only up to cc_t range.
2650         (screen_columns): Don't reject INT_MAX.
2651         (display_changed, display_all, display_speed, recover_mode):
2652         Don't assume cc_t fits in int.
2653
2654         * src/remove.h: Add copyright notice.
2655         (struct rm_options): Use bool for booleans.
2656         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2657         errno_rmdir_non_empty, remove_parents, main): Likewise.
2658         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2659         main): Likewise.
2660         (main): Don't dump core if invoked with argv[0]==NULL.
2661         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2662         Use bool for booleans.
2663         (tee): Use ssize_t for read returns.
2664
2665         * src/ptx.c: Add a FIXME mentioning that there are many
2666         unchecked integer overflows in this file.
2667         (gnu_extensions, auto_reference, input_reference, right_reference,
2668         ignore_case, initialize_regex, fix_output_parameters,
2669         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2670         Use bool for booleans.
2671         (SKIP_SOMETHING, compare_words, digest_break_file,
2672         find_occurs_in_text, fix_output_parameters):
2673         Use to_uchar instead of a caset.
2674         (print_field): Rewrite to avoid cast.
2675
2676         * src/printf.c (posixly_correct): Use bool for booleans.
2677         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2678         (STRTOX): Rewrite to avoid casts.
2679         (print_esc_char): Arg is char, not int.
2680         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2681         can_mode.
2682         (no_newline, verbose): Use bool for booleans.
2683         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2684         * src/shred.c (struct Options, main): Use bool for booleans.
2685         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2686         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2687         Use bool for booleans.
2688         * src/stat.c (G_fail): Remove.
2689         (print_statfs): Print various gotta-be-nonnegative values using
2690         unsigned long int, not long int or int.
2691         (do_statfs, do_stat): Return a boolean success flag.
2692         (do_stat, main): Use bool for booleans.
2693
2694         * src/pr.c: Add a FIXME mentioning that there are many
2695         unchecked integer overflows in this file.
2696         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2697         (struct COLUMN, read_line, print_page, print_stored, open_file,
2698         skip_to_page, init_fps, parallel_files, align_empty_cols,
2699         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2700         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2701         print_across_flag, storing_columns, balance_columns,
2702         truncate_lines, join_lines, untabify_input, failed_opens,
2703         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2704         double_space, ignore_failed_opens, use_col_separator,
2705         pad_vertically, last_line, main, init_parameters, skip_read,
2706         read_line, print_stored):
2707         Use bool for booleans.
2708         (struct COLUMN, char_to_clump, store_char, print_char):
2709         Use char for chars.
2710         (clump_buff, print_clump): Use char[], not int[], for an array whose
2711         elements are always chars.
2712         (first_last_page, main, getoptarg, balance, add_line_number,
2713         char_to_uclump): Remove unnecessary casts.
2714         (init_parameters): Allocate chars, not ints, for clump_buff.
2715         (print_char): Use to_uchar before invoking ISPRINT.
2716         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2717
2718         * src/nohup.c (main): Use bool for booleans.
2719         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2720         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2721         (portable_chars_only): Use to_uchar rather than a cast.
2722         * src/printenv.c (main): Use bool for booleans.
2723         Do not assume that the environ has at most one matching entry
2724         for each option (integer overflow was possible otherwise).
2725
2726         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2727         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
2728         less.
2729         (struct tspec): Use it.  fmt_string is now an array, not
2730         a pointer, as there's little point to the indirection here.
2731         (struct tspec, flag_dump_strings,
2732         traditional, flag_pseudo_start, limit_bytes_to_format,
2733         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2734         decode_one_format, open_next_file, check_and_close,
2735         decode_format_string, skip, write_block, read_char, read_block,
2736         parse_old_offset, dump, dump_strings, main):
2737         Use bool for booleans.
2738         (struct tspec): Use void *, not char *, for generic pointers.
2739         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2740         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2741         Use char, not unsigned int, since char suffices.
2742         (print_s_char, print_char, print_s_short, print_short,
2743         print_int, print_long, print_long_long, print_float,
2744         print_double, print_long_double): Rewrite to avoid casts.
2745         These now take void * arguments, instead of char *.
2746         Use the same body for all functions, except for the choice
2747         of type.  Assume C89 to simplify handling of signed char.
2748         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2749         Rewrite to avoid casts.
2750         (print_named_ascii, print_ascii): Now takes void *, not char *.
2751         (decode_one_format): Use int for printf field widths, not
2752         unsigned int.  Pass void * to subsidiary printers,
2753         not char *.  Simplify handling of floating-point formats
2754         by factoring out common code dealing with precision and field width.
2755         (decode_format_string): Avoid need for temporary copy of
2756         each decoded struct tspec.
2757         (get_lcm): Remove unnecessary cast.
2758         (main): Fix bug where more than INT_MAX failed decodes were ignored.
2759
2760 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
2761
2762         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2763         (enum number_format): Remove.
2764         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2765         not enum values.
2766         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2767         (section_del): Now const.
2768         (print_fmt): Remove.
2769         (starting_line_number, page_incr, blank_join, line_no,
2770         print_lineno, proc_text, main):
2771         Use intmax_t for line numbers.
2772         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2773         Use bool for booleans.
2774         (lineno_format): Now a string, not an enum value.
2775         (build_print_fmt): Remove.  All calls removed.  This work is
2776         now done within print_lineno.
2777         (build_type_arg): Use size_t for sizes.
2778         (print_lineno): Check for line number overflow.
2779         (proc_text, main): Remove unnecessary cast.
2780
2781         * src/ln.c (symbolic_link, interactive, remove_existing_files,
2782         verbose, hard_dir_link, dereference_dest_dir_symlinks,
2783         do_link, main): Use bool for booleans.
2784
2785         * src/ls.c (struct fileinfo, file_interesting,
2786         extract_dirs_from_files, color_symlink_as_referent,
2787         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2788         numeric_ids, print_block_size, dired, print_with_color,
2789         check_symlink_color, print_inode, recursive, immediate_dirs,
2790         all_files, really_all_files, qmark_funny_chars,
2791         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2792         main, decode_switches, parse_ls_color, print_dir, file_interesting,
2793         gobble_file, make_link_path, basename_is_dot_or_dotdot,
2794         extract_dirs_from_files, print_long_format):
2795         Use bool for booleans.
2796         (dir_defaulted): Remove; no longer needed.
2797         (main): Use int to count files, since it suffices for argv.
2798         Rewrite to avoid need for dir_defaulted.
2799         (main, print_dir, gobble_file, get_link_name,
2800         xstrcoll):
2801         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2802         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2803         Remove unnecessary cast to int.  Use int instead of unsigned
2804         int to count from 0 to 1.
2805         (get_funky_string, print_type_indicator): Use char for bytes, not int.
2806         (make_link_path): Use NULL for null pointers.
2807         (quote_name): Use to_uchar instead of cast.
2808
2809         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2810         print_full_info): Use bool for booleans.
2811         (problems): Remove, replacing with....
2812         (ok): New var (inverted from old sense).
2813         (print_user, print_group, print_full_info):
2814         Print uids/gids with %lu, not %u.
2815         (xgetgroups): Don't run out of memory if getgroups or getugroups
2816         returns -1.
2817         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2818
2819         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2820         int, since it suffices.
2821         (factor, print_factors): Use size_t for sizes.
2822         (print_factors, do_stdin, main): Use bool for booleans.
2823         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2824         (fold_file, main): Use bool for booleans.
2825         (fold_file, main): Use size_t for sizes.
2826         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2827         of prohibiting widths greater than INT_MAX.
2828         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2829         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2830         elide_tail_lines_pipe, elide_tail_lines_seekable,
2831         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2832         string_to_integer, main):
2833         Use bool for booleans.
2834         (main): Rewrite to avoid cast.
2835
2836         * src/csplit.c (struct line): Use size_t for sizes.
2837         (main): Remove unnecessary cast.
2838         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2839         * src/cut.c (cut_file, main): Use bool for booleans.
2840         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2841         * src/env.c (main): Likewise.
2842         * src/expr.c (nextarg): Likewise.
2843         * src/env.c (main): Remove unused and nonstandard envp arg.
2844
2845         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2846         fmt's arbitrary limits.
2847         (TRUE, FALSE): Remove; all uses changed to (true, false).
2848         (main): Use bool for booleans.
2849         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
2850         to parse width.
2851         (copy_rest): Remove unnecessary cast.
2852         (get_prefix): Rewrite to avoid cast.
2853         (check_punctuation): Use char *, not unsigned char *; C89 requires
2854         this.  Avoid off-by-one buffer read overrun when line is empty.
2855         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2856         Remove unnecessary casts.
2857         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2858         changes.
2859
2860         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2861         next_file, expand, main):
2862         Use bool for booleans.
2863         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2864         expand, main):
2865         Use uintmax_t for column counts.
2866         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2867         All callers changed.
2868         (parse_tabstops): Don't pass a negative char to isblank.
2869         Avoid memory leak with large tab stops.
2870         (validate_tabstops, expand): Don't assume number of tab stops is
2871         <= INT_MAX.
2872         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2873         storing values into exit_status.
2874         (expand): Use same pattern as unexpand for reading chars.
2875         Report an error when input line is too long, instead of silently
2876         screwing up.  Do not mishandle tab stops when backspacing left
2877         over start of line.
2878
2879         * src/dircolors.c (have_read_stdin, append_quoted,
2880         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2881         (dc_parse_stream): Use enum for state, rather than int.
2882         Use ssize_t to store getline result.
2883
2884         * src/dd.c (translation_needed, parse_integer, scanargs,
2885         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2886         Use bool for booleans.
2887         (translate_buffer): Use to_uchar rather than a cast.
2888         (swab_buffer, copy_simple, copy_with_unblock):
2889         Use size_t for sizes.
2890
2891         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2892         * src/sleep.c (apply_suffix): Likewise.
2893         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2894         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2895         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2896         tail_forever, tail_bytes, tail_lines, tail, tail_file,
2897         parse_obsolescent_option, parse_options, main): Likewise.
2898         * src/sleep.c (apply_suffix): Invert sense of result.
2899         Use int (not unsigned int) for multiplier, as this generates better
2900         code with some compilers.  Simplify code a bit.
2901         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2902         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2903         for state counters.
2904         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2905         make it a bit clearer.
2906
2907         * src/hostname.c: Include "xgethostname.h".
2908         (xgethostname): Remove decl; xgethostname.h has it.
2909         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2910         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2911         prototypes rather than K&R form.  Assume any negative value from
2912         sysinfo denotes failure, not just -1.
2913         (main): Simplify use of sethostname.
2914
2915         * src/pinky.c (include_idle, include_heading, include_fullname,
2916         include_project, include_plan, include_home_and_shell, do_short_format,
2917         include_where, main): Use bool for booleans.
2918         (count_ampersands, create_fullname, scan_entries, short_pinky):
2919         Use size_t for sizes.
2920         (create_fullname): Check for overflow in size calculations.
2921         (idle_string): Don't assume that the number of idle days
2922         is less than 10**8 and/or INT_MAX/(24*60*60).
2923         (main): No need to pass a non-NULL last arg to getopt_long.
2924         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2925         (print_uptime): Remove unused local variable.
2926         (main): No need to pass a non-NULL last arg to getopt_long.
2927         * src/users.c (list_entries_users, users): Use size_t for sizes.
2928         (list_entries_users): Use char for bytes.
2929         (main): No need to pass a non-NULL last arg to getopt_long.
2930         * src/who.c (do_lookup, short_list, short_output, include_idle,
2931         include_heading, include_mesg, include_exit, need_boottime,
2932         need_deadprocs, need_login, need_initspawn, need_clockchange,
2933         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2934         (print_runlevel): Use unsigned char for bytes.
2935         (list_entries_who, scan_entries, who): Use size_t for sizes.
2936         (main): No need to pass a non-NULL last arg to getopt_long.
2937
2938         * src/install.c (isdir): Remove decl.
2939         (install_file_to_path): Rely on make_path to fail if the destination
2940         is not a directory, by passing preserve_existing==true to it.
2941         Hence we no longer need to call isdir.
2942         Free dest_dir immediately when it's no longer needed, rather than
2943         waiting until the end of the function.
2944         (copy_file): Don't bother calling isdir, as copy will do the
2945         right thing if the destination is a directory.
2946
2947         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2948         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2949         Use bool for booleans.
2950         (max_depth): Now size_t, not int, to avoid an arbitrary limit
2951         of INT_MAX on depth.
2952         (G_fail): Remove: no longer needed, now that the relevant
2953         functions return bool.
2954         (process_file): Use return value to signal success rather than
2955         setting a global.  Remove first_call static var; not needed, since
2956         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
2957         about size_t casts, as it's now fixed.  Use xnrealloc rather
2958         than the obsolescent XREALLOC.  Don't bother to check whether
2959         reallocation is needed unless level > prev_level.
2960         (du_files): Invert sense of result, for consistency with
2961         other coreutils code.  All callers changed.
2962         (main): Allow --max-depth values up to SIZE_MAX.
2963
2964         * src/df.c (inode_format, show_all_fs, show_local_fs,
2965         show_listed_fs, posix_format, require_sync, print_type,
2966         selected_fstype, excluded_fstype, show_dev, show_point, main):
2967         Use bool for booleans.
2968         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2969         (show_dev, show_point, main):
2970         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2971         Don't assume disk name lengths are <= INT_MAX.
2972         Rewrite pct calculation to avoid cast.
2973         (show_point): Don't assume resolved length is <= SSIZE_MAX.
2974
2975         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2976         instead of uintptr_t.
2977         * src/shred.c (UINT_MAX_32_BITS): Remove.
2978         (word32): Remove.  All uses changed to uint32_t.
2979         (isaac_seed_data): Remove unnecessary cast.
2980         * src/system.h (ptr_align): Use size_t; in practice, this is just as
2981         good as uintptr_t in checking for alignments, and has fewer
2982         configuration hassles.
2983
2984         * src/Makefile.am (localedir.h): Make it readonly; this
2985         undoes part of the 2004-07-27 patch.
2986
2987 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
2988
2989         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2990         (IS_THOUSANDS_SEP): Use bool when appropriate.
2991         (numcompare, main): Use char, not int, when the value is always a char.
2992         (numcompare): Remove "register"; compilers are smart enough these days.
2993         * src/system.h (errno, CHAR_BIT): Remove decls;
2994         no longer needed now we assume C89 or better.
2995         Include <inttypes.h> before <stdint.h>, as it's the
2996         Autoconf-recommended pattern.
2997         (to_uchar): New inline function, moved here from tr.c.
2998         Use full names for int types, e.g. "long int" rather than "long".
2999         * src/tr.c (to_uchar): Remove; now in system.h.
3000         (is_char_class_member): Use bool when appropriate.
3001
3002         * src/mkdir.c (create_parents, main): Use bool when appropriate.
3003         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3004
3005 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
3006
3007         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
3008
3009         * src/chmod.c (recurse, force_silent, process_file, process_files,
3010         main): Use bool when appropriate.
3011         * src/cksum.c (cksum, main): Likewise.
3012         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
3013         compare_files, main): Likewise.
3014
3015         * src/copy.h (struct cp_options): Likewise.
3016         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
3017         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
3018         * src/cp-hash.h (remember_created): Likewise.
3019         * src/cp-hash.c (remember_created): Likewise.
3020         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
3021         re_protect, make_path_private, target_directory_operand, do_copy,
3022         cp_option_init, decode_preserve_arg, main): Likewise.
3023         * src/install.c (isdir, change_timestamps, change_attributes,
3024         copy_file, install_file_to_path, install_file_in_dir,
3025         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
3026         change_attributes, change_timestamps): Likewise.
3027         * src/mv.c (remove_trailing_slashes, rm_option_init,
3028         cp_option_init, do_move, movefile, main): Likewise.
3029         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
3030         AD_push, prompt, remove_dir): Likewise.
3031         * src/rm.c (rm_option_init, main): Likewise.
3032
3033         * src/remove.c (top_dir, pop_dir, full_filename_):
3034         Use size_t for sizes.
3035         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
3036         succeeds.  It's not necessary in that case, as *NEW_DST is always
3037         false already.
3038         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
3039         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
3040         * src/rm.c (main): Likewise.
3041
3042         md5sum, sha1sum integer cleanups.
3043
3044         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
3045         not needed.
3046         (ALG_UNSPECIFIED): Remove.
3047         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
3048         * src/md5.c: Don't include any files other than checksum.h.
3049         * src/sha1sum.c: Likewise.
3050         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
3051         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
3052         Use bool when appropriate.
3053         (digest_check): Increase limit of number of input lines to
3054         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
3055         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
3056
3057 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
3058
3059         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
3060         'ok' flag around.
3061         (simple_cat, cat): Return true if successful.  All callers changed.
3062         (simple_cat, cat, main): Use bool for booleans.
3063         (simple_cat): Use size_t for sizes.
3064         (cat, main): Use the same names for parameters that we use for
3065         long options, to avoid confusion.  This inverts the sense of the
3066         show_tabs (formerly output_tabs) and number_nonblank
3067         (formerly numbers_at_empty_lines) variables.
3068         (main): Don't mess up (due to integer overflow) if we are given
3069         INT_MAX - INT_MIN + 1 options.
3070         [O_BINARY]: Don't invoke isatty unless the other options require it.
3071         (main): When deciding whether to use simple_cat, don't worry
3072         about binary option; it's irrelevant.
3073
3074         * src/dcgen: Remove comments, trailing white space, and empty
3075         lines from the output strings, to save space.
3076         Use a narrower type like 'unsigned char' for line lengths, if
3077         that will do.
3078         Make the output variables static, not extern.
3079
3080         * src/chgrp.c (parse_group): Require base 10 when parsing
3081         groups as integers.
3082         (main): int -> bool when appropriate.
3083         * src/chown.c (main): Likewise.
3084         * src/chown-core.c: Include inttostr.h.
3085         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3086         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3087         instead of uint_to_string).
3088         (describe_change): Instead of an int flag, use a char *
3089         auxiliary; this avoids the need for casts.
3090         Assume free (NULL) works.
3091         (change_file_owner): Return true/false, not 0/-1, since
3092         we don't set errno.  All callers changed.
3093         Use bool when appropriate.
3094         (chown_files): Likewise.
3095         * src/chown-core.h (chown_files): Likewise.
3096
3097         * tests/chown/basic: Test for proper handling of uids like
3098         "010", which must be parsed as decimal.
3099
3100         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3101         pwd when there are multiple names for the working directory
3102         (which can happen with an automounter, sigh).
3103
3104         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3105         this causes Solaris 8 'make' to refuse to build "groups".
3106         (localedir.h): Don't depend on Makefile: this causes Solaris
3107         8 'make' to build localedir.h unnecessarily.  The dependence
3108         on Makefile is ineffective anyway, since $(localedir) might
3109         change even if Makefile hasn't.
3110
3111         * src/remove.c (remove_dir): If we can't save the state of the
3112         working directory, pretend we started from "/", not ".".
3113         This avoids a bug on hosts like Solaris that don't let you
3114         remove the working directory.
3115
3116 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3117
3118         * src/printf.c (strtiomax, strtoumax): Declare if not already
3119         declared: this fixes a portability bug with Solaris 8 + GCC.
3120         (STRTOX): Parenthesize use of macro arg as expression.
3121         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3122         parentheses.
3123         * configure.ac: Check for declaration of strtoumax, for
3124         src/printf.c.
3125
3126         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3127         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3128
3129         * tests/readlink/can-e: Don't assume that we can remove the
3130         working directory: this isn't possible under Solaris 8, say.
3131         * tests/readlink/can-f: Likewise.
3132         * tests/readlink/can-m: Likewise.
3133
3134         * src/copy.c (copy_internal): find_backup_file_name no longer
3135         returns NULL, so don't bother to check for this.
3136         * src/cp.c (do_copy): Likewise.
3137         * src/ln.c (do_link): Likewise.
3138
3139 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3140
3141         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3142         All uses changed.
3143         (NZERO): New macro, if system doesn't define it already.
3144         (usage): Distinguish priorities from nice values.
3145         Don't assume NZERO is 20.
3146         (main): Use bool instead of int where appropriate.
3147         If user specifies an adjustment out of range, always truncate it
3148         to an inrange value instead of sometimes giving an error message
3149         and sometimes not.
3150         Do not assume that -1 is an error return from "nice" or
3151         "getpriority", as it might be the current nice value minus NZERO.
3152         If nice/setpriority fails with errno == EPERM, go ahead and run
3153         the command anyway; POSIX requires this.
3154
3155         * src/pathchk.c: Include euidaccess.h.
3156         (dir_ok): Use euidaccess, not access.
3157         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3158         (eaccess): Remove.  All users changed to use euidaccess instead.
3159
3160 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3161
3162         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3163         Don't assume ut_line is null-terminated.
3164         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3165         since USER and LINE might not be null terminated.  All callers
3166         changed.
3167
3168 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3169
3170         Fix bug with "tail -f" reported by Rob Holland in
3171         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3172         Also, remove the undocumented and unsupported-since-2000
3173         --max-consecutive-size-changes options.  Fix another related bug:
3174         "tail" got confused if stdin, stdout, or stderr were closed.
3175         Also, use output buffering even with "tail -f".
3176
3177         * NEWS: Document this, plus yesterday's patch.
3178         * doc/coreutils.texi (tail invocation): "size has remained the same"
3179         -> "file has not changed", which is more accurate for fifos.
3180         * src/tail.c: Include fcntl-safer.h.
3181         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3182         (COPY_A_BUFFER): New macro.
3183         (struct File_spec): New members mtime, mode, blocking.
3184         Remove member n_consecutive_size_changes.
3185         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3186         max_n_consecutive_size_changes_between_opens,
3187         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3188         (long_options, tail_forever, parse_options):
3189         Remove (non-)support for --max-consecutive-size-changes.
3190         (record_open_fd): New function.
3191         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3192         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3193         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3194         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3195         All uses changed.
3196         (n_live_files): Remove, replacing with...
3197         (any_live_files): New function.  All uses changed.
3198         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3199         is safe; this avoids some hangs when reading from a fifo.
3200         Avoid invoking fstat or sleep when using blocking I/O.
3201         Do not check for changes to size if the file is not a regular file,
3202         as the size is undefined in that case.
3203         Check for changes to mtime or mode, too; this works for non-regular
3204         files.
3205         (tail_forever, main): Redo fflush strategy to work even when input
3206         is nonblocking.  Don't use unbuffered output; just flush when needed.
3207
3208 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3209
3210         * src/tail.c (main): Ignore -f if no file operand is specified
3211         and standard input is a pipe.
3212         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3213         all pipes, just for when standard input is a pipe and no
3214         file operand is specified.
3215         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3216         Add a new commented-out f-2 test, which we still fail.
3217         (test_vector): All f-* tests are special cases, not just f-1.
3218
3219 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3220
3221         * src/uptime.c: Include c-strtod.h.
3222         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3223         Use long int rather than int to count days (for 64-bit hosts),
3224         and check for arithmetic overflow when converting double to time_t.
3225
3226 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3227
3228         * src/printf.c (vstrtold): Renamed from vstrtod.
3229         Now returns long double.  All uses changed.
3230         (print_direc): Use "L" length modifier when printing floating point
3231         numbers, since we're now printing long double.
3232
3233 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3234
3235         printf cleanup, to avoid undefined behavior, to add support for
3236         formats that Bash supports, and to support wide integers like
3237         Bash does.
3238
3239         * NEWS: Document this.
3240         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3241         booleans, so that we don't reserve any values for precision or
3242         width (like Bash).
3243         (STRTOX): Use prototype, not K&R-style definition.
3244         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3245         in ../lib), with type change to intmax_t.
3246         All uses changed.
3247         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3248         All uses changed.
3249         (vstrtod): Renamed from xstrtod.  All uses changed.
3250         (print_direc): Use boolean arg instead of special value to indicate
3251         a missing precision or width.  LENGTH no longer includes
3252         length modifiers or conversion character.  New arg CONVERSION
3253         now specifies conversion character.
3254         Use intmax_t-width formatting for integers (like Bash).
3255         Add support for C99 %a, %A, %F (like Bash).
3256         Add support for field width with %c (POSIX requires this).
3257         Add a FIXME for lack of support for field width and precision
3258         for %b.
3259         Add support for '\'', '0' flags.
3260         Check for invalid combinations of flags, field width, precision,
3261         and conversion, to prevent use of undefined behavior.
3262         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3263         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3264         In error message, output entire invalid conversion specification,
3265         instead of merely outputting % followed by the conversion char.
3266         * tests/misc/printf: Add tests for the above.
3267
3268 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3269
3270         Change "readlink -f" to be more compatible with prior implementations.
3271         Add more canonicalize options, -e and -m.
3272         Add comprehensive tests for all readlink modes.
3273
3274         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3275         Do not add canonicalize.c here.
3276
3277         * src/readlink.c (longopts): Add new options.
3278         (usage): Document them.
3279         (canonicalize_fname): New proxy function.
3280         (main): Handle new options.
3281         * doc/coreutils.texi (readlink invocation): Document new
3282         "readlink -f" behaviour and new canonicalize options, -e and -m.
3283
3284         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3285         * tests/Makefile.am (SUBDIRS): Add readlink.
3286         * tests/readlink/Makefile.am: New file.
3287         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3288         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3289         * tests/misc/readlink: Remove file.
3290
3291 2004-07-04  Jim Meyering  <jim@meyering.net>
3292
3293         * src/copy.c (copy_internal): Add a FIXME comment.
3294
3295 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3296
3297         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3298         * src/cp.c (do_copy): Likewise.
3299         * src/mv.c (movefile): Likewise.
3300
3301         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3302         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3303
3304         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3305         This cleans up the semantics a bit, as we no longer try to open the
3306         same file twice.
3307
3308 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3309
3310         * NEWS: Add short names -t and -T for --target-directory
3311         and --no-target-directory options, respectively.
3312
3313         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3314         Remove.  All uses changed to 'T' and 't', respectively.
3315         * src/install.c, src/ln.c, src/mv.c: Likewise.
3316
3317         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3318         aliases for --target-directory and --no-target-directory,
3319         respectively.
3320         * src/install.c (long_options, main, usage): Likewise.
3321         * src/ln.c, src/mv.c: Likewise.
3322
3323 2004-07-01  Jim Meyering  <jim@meyering.net>
3324
3325         * Makefile.maint (sc_file_system): New target.
3326         (syntax-check-rules): Add it.
3327         .x-sc_file_system: New file.
3328         * Makefile.am (EXTRA_DIST): Add it.
3329
3330         * man/sync.x: Use "file system" rather than "filesystem".
3331         * man/stat.x, man/df.x: Likewise.
3332
3333 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3334
3335         * src/df.c (usage, main): Output "file system" rather than
3336         "filesystem".
3337         * src/du.c (usage): Likewise.
3338         * src/shred.c (usage): Likewise.
3339         * src/stat.c (usage): Likewise.
3340         * src/stat.c (long_options, usage): Rename "--filesystem" to
3341         "--file-system".  But keep the old name around, for compatibility
3342         reasons.
3343
3344 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3345
3346         Add support for --no-target-directory option.
3347
3348         * NEWS: Document it.
3349         * doc/coreutils.texi (Common options, Target directory, cp
3350         invocation, install invocation, mv invocation, ln invocation):
3351         Likewise.
3352         (link invocation): Explain how to rewrite link using ln now
3353         that we have --no-target-directory.
3354         (ln invocation): Explain that --no-target-directory subsumes
3355         --no-dereference.
3356         (unlink invocation): Modify wording to match new wording in
3357         link invocation.
3358
3359         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3360         (long_opts, usage, do_copy, main): Add support for
3361         --no-target-directory,
3362         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3363         usage): Likewise.
3364         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3365         main): Likewise.
3366         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3367         main): Likewise.
3368         * src/mv.c (enum): Sort values.
3369
3370 2004-06-29  Jim Meyering  <jim@meyering.net>
3371
3372         Don't let verbose-mode output from a subshell obscure actual differences.
3373         * tests/rm/inaccessible: Turn off command-echoing just before
3374         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3375
3376 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3377
3378         Add support for 'install --target-directory', an option
3379         that has been documented for years but not implemented (!).
3380         * doc/coreutils.texi (install invocation): Document
3381         --target-directory in synopsis, too.
3382         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3383         (long_options, main, usage): Add --target-directory.
3384         (target_directory_operand): New function, stolen from mv.c.
3385         (main): Use it.  Check for -d and --target-directory.
3386         Alter wording of diagnostics to match other programs.
3387
3388 2004-06-28  Jim Meyering  <jim@meyering.net>
3389
3390         * src/cp.c (usage): Fix copy+paste error in description of
3391         --target-directory: s/move/copy/.  From Paul Jarc.
3392
3393 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3394
3395         Use more-consistent rules among cp, ln, and mv when dealing with
3396         last operands that are (or look like) directories.
3397
3398         * src/cp.c (target_directory_operand): New, nearly-common function,
3399         It reports an error if the destination appears to be a directory
3400         (e.g., because it has a trailing slash) but is not.
3401         * src/ln.c, src/mv.c: Likewise.
3402         * src/cp.c (do_copy): Use it.
3403         * src/ln.c (main): Likewise.
3404         * src/mv.c (main): Likewise.
3405
3406         * src/cp.c (do_copy): Don't assume argc is positive.
3407         Don't bother to lstat dest, since copy() will do that for us.
3408         Use "const" to avoid the need for cast.
3409
3410         * src/cp.c (do_copy): Don't output a usage message because of file
3411         problems (e.g., an operand is not a directory).  Use it only for
3412         syntax.  Standardize on "target %s is not a directory" for the
3413         diagnostic.
3414         * src/ln.c (main): Likewise.
3415         * src/mv.c (main): Likewise.
3416
3417         * src/cp.c (do_copy): Remove test for trailing slash, since
3418         target_directory_operand now does this.
3419         * src/ln.c (main): Likewise.
3420         * src/mv.c (movefile): Likewise.
3421
3422         * src/cp.c (main): Reject multiple target directories.
3423         Check whether a specified target is a directory when parsing the
3424         options, using stat.  This gives more-accurate diagnostics.
3425         * src/ln.c (main): Likewise.
3426
3427         * src/ln.c (isdir): Remove decl; no longer needed.
3428         * src/mv.c (isdir, lstat): Likewise.
3429
3430         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3431         Don't check the destination ourself; rely on dest_is_dir.
3432         This way we can avoid lstatting the destination in the
3433         usual case, and in the worst case we lstat 1, not 3 times.
3434         Don't bother to unlink unless link failed; this saves a syscall.
3435         Remove unnecessary backup_succeeded flag;
3436         it was identical to "dest_backup != NULL".
3437
3438         * src/ln.c (main): Use int to count to argc, not unsigned int.
3439         This handles negative operand counts.
3440         * src/mv.c (main): Likewise.
3441
3442         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3443         do it, for consistency with cp.c and ln.c.  All callers changed.
3444         (movefile): dest_is_dir parameter is now bool, not int.
3445         (main): Standardize on "missing destination file operand after %s"
3446         for the diagnostic, for consistency with cp.c.
3447
3448         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3449         will complain about the arg count.
3450         Adjust to new (briefer) diagnostics.
3451         * tests/cp/fail-perm: Add a test to verify that we get the new
3452         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3453
3454 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3455
3456         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3457         d/" incorrectly created a link d/x/x.  It also saves some system
3458         calls.
3459
3460         * NEWS: Document the fix.
3461
3462         * src/ln.c (main): Don't append basename to dest if this
3463         results in an existing directory name.
3464         * tests/ln/misc: See whether a trailing slash is followed too far.
3465
3466 2004-06-26  Jim Meyering  <jim@meyering.net>
3467
3468         * src/printf.c (main): When given no arguments, print the standard
3469         "missing operand\nTry printf --help..." message -- to be consistent.
3470
3471 2004-06-26  Jim Meyering  <jim@meyering.net>
3472
3473         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3474
3475 2004-06-25  Jim Meyering  <jim@meyering.net>
3476
3477         * tests/ln/misc: Add test for ln subscript error.
3478
3479 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3480
3481         * src/ln.c (do_link): Remove unnecessary call to lstat.
3482         (main): Avoid subscript error when the destination is "".
3483
3484 2004-06-23  Jim Meyering  <jim@meyering.net>
3485
3486         * tests/*: Replace all occurrences of `(exit N); exit' with
3487         `(exit N); exit N'.  Otherwise, those many tests could exit with
3488         improper exit status when exiting via e.g., a trapped interrupt.
3489         Thanks to a report from Bob Proulx.
3490
3491 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3492
3493         * src/who.c (idle_string, print_user): New arg boottime,
3494         specifying the most recent boot time.  All uses changed.
3495         (idle_string) Consider a line to be "old" if it hasn't been used
3496         since the last boot time.  Watch out for overflow when computing
3497         times, and for times in the future.
3498         (idle_string): Record latest boot time.
3499
3500 2004-06-22  Jim Meyering  <jim@meyering.net>
3501
3502         * src/test.c (usage): Correct description of `-t FD'.  The file
3503         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3504
3505 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3506
3507         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3508         has undefined behavior if the year precedes -999 or follows 9999.
3509         Since we have to stop using ctime anyway, we might as well use
3510         strftime and fix the FIXME, and support internationalized dates.
3511
3512         * NEWS: Document the new behavior.
3513         * src/who.c: Include "hard-locale.h".
3514         (time_format, time_format_width): New vars.
3515         (time_string, print_line): Use them.
3516         (main): Set them.
3517         (time_string): Use localtime + strftime instead of
3518         ctime, to avoid problems with years before -999 or after 9999.
3519         * src/pinky.c: Likewise.
3520
3521 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3522
3523         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3524         names contained multibyte characters where the column count
3525         differed from the byte count.  This patch also corrects
3526         some comments.
3527
3528         * src/ls.c (format_user_or_group): New function, which counts
3529         columns correctly.
3530         (format_user, format_group): Use it.
3531         (format_user_or_group_width): New function, which counts columns
3532         correctly.
3533         (format_user_width, format_group_width): Use it.
3534
3535 2004-06-21  Jim Meyering  <jim@meyering.net>
3536
3537         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3538         Suggestion from Andreas Schwab.
3539
3540         * tests/priv-check: When running as root, be sure to propagate
3541         PATH through to the process we exec as non-root.
3542         Reported by michael@aplatform.com.
3543
3544         * src/mknod.c (main): Don't segfault when calculating the
3545         expected number of operands for `mknod NAME'.
3546
3547 2004-06-20  Jim Meyering  <jim@meyering.net>
3548
3549         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3550
3551 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3552
3553         * src/basename.c (main):
3554         Standardize on the diagnostics given when someone gives
3555         too few operands ("missing operand after `xxx'") or
3556         too many operands ("extra operand `xxx'").
3557         Include "quote.h" and/or "error.h" if it wasn't already being included.
3558         * src/chgrp.c (main): Likewise.
3559         * src/chmod.c (main): Likewise.
3560         * src/chown.c (main): Likewise.
3561         * src/chroot.c (main): Likewise.
3562         * src/comm.c (main): Likewise.
3563         * src/cp.c (do_copy): Likewise.
3564         * src/csplit.c (main): Likewise.
3565         * src/date.c (main): Likewise.
3566         * src/dircolors.c (main): Likewise.
3567         * src/dirname.c (main): Likewise.
3568         * src/du.c (main): Likewise.
3569         * src/expr.c (main): Likewise.
3570         * src/hostid.c (main): Likewise.
3571         * src/hostname.c (main): Likewise.
3572         * src/id.c (main): Likewise.
3573         * src/install.c (main): Likewise.
3574         * src/join.c (add_file_name, main): Likewise.
3575         * src/link.c (main): Likewise.
3576         * src/ln.c (main): Likewise.
3577         * src/logname.c (main): Likewise.
3578         * src/md5sum.c (main): Likewise.
3579         * src/mkdir.c (main): Likewise.
3580         * src/mkfifo.c (main): Likewise.
3581         * src/mknod.c (main): Likewise.
3582         * src/mv.c (main): Likewise.
3583         * src/nohup.c (main): Likewise.
3584         * src/od.c (main): Likewise.
3585         * src/pathchk.c (main): Likewise.
3586         * src/ptx.c (main): Likewise.
3587         * src/readlink.c (main): Likewise.
3588         * src/rm.c (main): Likewise.
3589         * src/rmdir.c (main): Likewise.
3590         * src/seq.c (main): Likewise.
3591         * src/setuidgid.c (main): Likewise.
3592         * src/shred.c (main): Likewise.
3593         * src/sleep.c (main): Likewise.
3594         * src/sort.c (main): Likewise.
3595         * src/split.c (main): Likewise.
3596         * src/stat.c (main): Likewise.
3597         * src/test.c (beyond, main): Likewise.
3598         * src/touch.c (main): Likewise.
3599         * src/tr.c (main): Likewise.
3600         * src/tsort.c (main): Likewise.
3601         * src/tty.c (main): Likewise.
3602         * src/uname.c (main): Likewise.
3603         * src/uniq.c (main): Likewise.
3604         * src/unlink.c (main): Likewise.
3605         * src/uptime.c (main): Likewise.
3606         * src/users.c (main): Likewise.
3607         * src/who.c (main): Likewise.
3608         * src/whoami.c (main): Likewise.
3609
3610         * tests/basename/basic: Adjust to new diagnostics.
3611         * tests/du/files0-from: Likewise.
3612         * tests/expr/basic: Likewise.
3613         * tests/mv/diag: Likewise.
3614         * tests/tsort/basic-1: Likewise.
3615
3616 2004-06-20  Jim Meyering  <jim@meyering.net>
3617
3618         * src/ln.c: Remove declaration of yesno.
3619         Instead, include yesno.h.
3620         * src/copy.c: Likewise.
3621
3622         * src/remove.c: Remove declaration of yesno.
3623         Instead, include yesno.h.
3624         (top_dir): Remove now-unnecessary cast of obstack_base.
3625         (pop_dir): Likewise.
3626         (full_filename_): Likewise.
3627
3628 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3629
3630         Don't dump core if ctime returns NULL; this is possible on
3631         hosts with 64-bit time_t and 32-bit int.
3632         * src/who.c: Include "inttostr.h".
3633         (time_string): If ctime fails, print the raw time as an integer
3634         instead of dumping core.
3635         * src/pinky.c: Likewise, as follows:
3636         Include "inttostr.h".
3637         (time_string): New function, copied from who.c.
3638         (print_entry): Use it.
3639
3640 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3641
3642         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3643         Problem reported by Guido Leenders in:
3644         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3645         * NEWS: document this.
3646
3647 2004-06-19  Jim Meyering  <jim@meyering.net>
3648
3649         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3650         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3651         `GNU' to the parenthesized package name in --version output.
3652         Before, the first argument from AC_INIT, `GNU coreutils', would
3653         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3654         Reported by Richard Stallman.
3655
3656 2004-06-17  Jim Meyering  <jim@meyering.net>
3657
3658         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3659         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3660
3661 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3662
3663         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3664         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3665         hosname, pwd, sync, yes.
3666         * doc/coreutils.texi (yes invocation, false invocation,
3667         true invocation): Document this.
3668         * src/chroot.c (main): Handle "--".
3669         * src/hostid.c (main): Likewise.
3670         * src/hostname.c (main): Likewise.
3671         * src/pwd.c (main): Likewise.
3672         * src/sync.c (main): Likewise.
3673         * src/yes.c (main): Likewise.
3674         * src/true.c (main): Recognize --help and --version even if
3675         POSIXLY_CORRECT is set.
3676         * src/yes.c (main): Likewise.
3677
3678 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3679
3680         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3681         the GNU behavior.
3682         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3683         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3684         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3685         variables to the implementation, so it's OK for ls to depend on
3686         TABSIZE.
3687         * src/pr.c: Include "hard-locale.h".
3688         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3689         POSIX specifies the behavior only in the POSIX locale.
3690         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3691         since POSIX says the behavior is unspecified here.
3692         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3693         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3694         * src/printf.c (main): Recognize --help, --version even if
3695         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3696         does not prohibit options either, so "printf" is like "expr" here.
3697         * src/unlink.c (main): Likewise.
3698         * tests/misc/printf: Adjust to the new semantics for \x if
3699         POSIXLY_CORRECT.
3700
3701 2004-06-14  Jim Meyering  <jim@meyering.net>
3702
3703         * tests/misc/pwd: New test, for fix of 2004-04-19.
3704         * tests/misc/Makefile.am (TESTS): Add pwd.
3705         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3706
3707         * src/copy.c: Remove declaration of euidaccess.
3708         Instead, include "euidaccess.h".
3709
3710 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
3711
3712         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3713         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3714         as (sizeof "??") reliably returns 3.
3715         (print_line): Guard against idle and pid being too long
3716         (which is possible when printing headers).
3717         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
3718         Avoid unnecessary cast of sizeof to int.
3719         (make_id_equals_comment): Do not assume that UT_ID returns
3720         a string; it might return a non-null-terminated array.
3721         Use strncat instead.  It's not very often where strncat is
3722         exactly what you want, but this is one of those rare cases.
3723
3724 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3725
3726         * src/who.c (list_entries_who): Don't output a trailing space.
3727
3728 2004-06-09  Jim Meyering  <jim@meyering.net>
3729
3730         * src/touch.c (usage): Improve wording in description of the
3731         --time=WORD option.  Reported by Dan Jacobson.
3732
3733         * src/chown-core.c (change_file_owner): Change names of parameters
3734         old_uid and old_gid to required_uid and required_gid respectively.
3735
3736         * src/chmod.c (mode_changed): Return false, not 0, now that the
3737         function returns `bool'.
3738
3739 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
3740
3741         Adjust chmod and chown to be similar if -c or -v are given.  In
3742         particular, a no-op chown is no longer reported as a change; this
3743         reverts to previous behavior.  Also, fix both commands so that -v
3744         report failures even if the failure is not due to the chmod or
3745         chown syscalls.
3746
3747         * src/chmod.c (CH_NOT_APPLIED): New constant.
3748         (describe_change): Handle it.
3749         (process_file): Use it, if a symlink wasn't changed.
3750         (mode_changed): Return bool, not int.  Accept new argument
3751         NEW_MODE; all callers changed.  This lets us avoid statting the
3752         file unless the new mode has unusual bits.
3753         (process_file): Return -1 on error.  With -v, report all errors
3754         verbosely, not just some.
3755
3756         * src/chown-core.c (change_file_owner): Return -1 on error, not
3757         1 sometimes and -1 on others.  Our caller ORs together our results,
3758         and (-1 | 1) == 0 on ones-complement hosts.
3759         With -v report all errors verbosely, not just some.
3760         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3761         file_stats wasn't set properly in that case.
3762
3763         * tests/chgrp/basic: Adjust to above changes.
3764
3765 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3766
3767         * tests/chgrp/basic: Test that chgrp -h does not fail on
3768         symlinks, even on hosts where that's not supported.
3769         Test that if -R is specified without -H or L, -h is assumed.
3770         Test that chown() is not optimized away.
3771
3772 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
3773
3774         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3775
3776           Check for incompatible options.  When -R and --dereference are
3777           both used, then either -H or -L must also be used.  When -R and -h
3778           are both used, then -P must be in effect.
3779
3780           -H, -L, and -P have no effect unless -R is also specified.
3781           If -P and -R are both specified, -h is assumed.
3782
3783           Do not optimize away the chown() system call when the file's owner
3784           and group already have the desired value.  This optimization was
3785           incorrect, as it failed to updated the last-changed time and reset
3786           special permission bits, as POSIX requires.
3787
3788           Do not report an error if the owner or group of a
3789           recursively-encountered symbolic link cannot be updated because
3790           the file system does not support it.
3791
3792         * NEWS: Document the above.
3793
3794         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
3795         requires either -H or -L, and -R -h requires -P.  If -H, specify
3796         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
3797         file as much like chown.c as possible.
3798         * src/chown.c (main): Likewise.
3799
3800         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3801         needed.  Chown a directory only after chowning its children; this
3802         avoids problems if the new directory ownership doesn't permit
3803         access to the children.  Dereference symlinks before doing
3804         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3805         Do not optimize away the chown() system call when the file's owner
3806         and group already have the desired value.  POSIX does not permit
3807         this optimization.  Rely on chown and lchown to do the right
3808         thing with symlinks and/or -1 arguments, now that we have wrappers
3809         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3810         errors, not just command-line errors.
3811         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3812
3813         * src/system.h (ENOTSUP): Remove.
3814
3815         * tests/chgrp/basic: Use chown --from to discover whether the
3816         group changed, since chgrp now changes unconditionally.  This
3817         complicates the sed script a bit.  Do not specify --dereference,
3818         since it's the default (and we want to test this).  Adjust output
3819         to match the fact that chgrp no longer optimizes the case of
3820         changing a file's group to the same value as before.
3821         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3822         options are incompatible, and their behavior is undefined with POSIX.
3823         (changed, not_changed): Adjust to match the fact that -h is no longer
3824         specified.  Sort names.
3825         * tests/chown/deref: Adjust error-diagnostic spelling to match new
3826         behavior.
3827
3828 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
3829
3830         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3831         prevented a diagnostic of any operands.
3832
3833 2004-06-08  Jim Meyering  <jim@meyering.net>
3834
3835         * src/shred.c (direct_mode): Turn it on/off with directio, too.
3836
3837 2004-06-07  Jim Meyering  <jim@meyering.net>
3838
3839         Enable direct-mode I/O (bypassing the buffer cache), if possible.
3840         Prompted by a suggestion from Kalle Olavi Niemitalo
3841         in http://bugs.debian.org/207035.
3842         * src/shred.c (direct_mode): New function.
3843         (do_wipefd): Turn on direct-mode I/O.
3844         (dopass): If a file's first write fails with EINVAL,
3845         turn off direct-mode I/O and retry the write.
3846
3847 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
3848
3849         * src/tr.c (main): "tr -d a b" is now a fatal error even if
3850         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
3851         option combination.
3852
3853 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
3854
3855         * src/shred.c (dopass): Don't subtract 1 from the offset after
3856         a write error.  Problem reported by Jon Peatfield in:
3857         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3858
3859 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
3860
3861         Fix bug reported by Buciuman Adrian in
3862         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3863         where 'dd' created a file that was too large.  The bug was that dd
3864         assumed that the input file offset does not advance after a failed
3865         read; but POSIX says that the input file offset is undefined after
3866         a failed read.
3867
3868         * src/dd.c (MAX_BLOCKSIZE): New macro.
3869         (input_seekable, input_seek_errno, input_offset,
3870         input_offset_overflow): New vars.
3871         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3872         (advance_input_offset): New function.
3873         (skip_via_lseek): Set errno to zero when reporting our failure,
3874         so that we don't report based on garbage errno.
3875         (skip): If fdesc is standard input, advance the input offset.
3876         Do not quit if reading, and if noerror was specified;
3877         POSIX seems to require this.
3878         If read fails on output file, report the earlier lseek failure
3879         instead; this fixes a FIXME in dd_copy.
3880         (advance_input_after_read_error): New function.
3881         (dd_copy): Use it, instead of assuming that failed reads
3882         do not advance the file pointer.  Advance input offset
3883         after nonfailed reads.  Advance only a partial block if
3884         the previous read (before the failed read) succeeded, and
3885         do not generate an output block of zeros in this case.
3886         (main): Determine initial input offset, seekability of input,
3887         and error if it wasn't seekable.
3888
3889 2004-06-02  Jim Meyering  <jim@meyering.net>
3890
3891         rm (without -f) could hang unnecessarily when attempting to
3892         remove a symlink to a file on an off-line NFS-mounted partition.
3893         Reported by David Howells in https://bugzilla.redhat.com/124699.
3894         * src/remove.c (write_protected_non_symlink): New function.
3895         Don't invoke euidaccess on symlinks.
3896         (prompt): Use write_protected_non_symlink rather than using
3897         euidaccess directly, being careful not to call lstat twice for a file.
3898
3899         Fix a bug in how the --output-delimiter=D option works with
3900         abutting byte or character ranges.  Reported by David Krider in
3901         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3902         * src/cut.c (print_kth): Remove special case for open-ended range.
3903         (set_fields): Record the range start index for an interval even
3904         when it abuts another interval on its low side.
3905         Also record the range start index of the longest right-open-interval.
3906         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3907         abutting and overlapping byte ranges.
3908
3909 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
3910
3911         Some POSIX-conformance cleanups for tr.
3912
3913         * src/tr.c (posix_pedantic): Remove; no longer needed since
3914         we need to test this in just one place now.
3915         (usage): Mention -C.
3916         (unquote): Note that \055, \n, etc are escaped.
3917         Do not worry about POSIXLY_CORRECT when warning about ambiguous
3918         escape sequences.
3919         \ at end of string stands for itself.
3920         Do not diagnose invalid backslash escapes: POSIX says the behavior
3921         is unspecified in this case, so we don't need to diagnose it.
3922         (main): Add support for -C (currently an alias for -c).
3923         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3924         a diagnostic here.
3925         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3926         Fix comment for range-a-a.
3927
3928 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
3929
3930         Improve the efficiency (and in one case, correctness) of code
3931         that reads symlinks.
3932
3933         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3934         royally if the link length is long (e.g., GNU/Hurd).  Use
3935         xreadlink instead, it's safer.  Don't bother to read the link if
3936         it's the wrong size.  Add a FIXME because this area is a bit murky
3937         and undocumented.
3938         * src/ls.c (get_link_name): Update use of xreadlink.
3939         * src/readlink.c (main): Likewise.
3940         * src/stat.c (print_stat): Likewise.
3941
3942 2004-06-01  Jim Meyering  <jim@meyering.net>
3943
3944         * src/env.c (main): Prefer the notation `STREQ (a, b)'
3945         over `!strcmp (a, b)'.
3946         * src/sort.c (main, sort_buffer_size): Prefer the notation
3947         `STREQ (a, b)' over `strcmp (a, b) == 0'.
3948         * src/date.c (batch_convert): Likewise.
3949         * src/expr.c (nextarg): Likewise.
3950         * src/su.c (correct_password, restricted_shell, main): Likewise.
3951         * src/ptx.c (swallow_file_in_memory, main): Likewise.
3952         * src/test.c (binary_operator, and, or, main): Likewise.
3953
3954 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
3955
3956         * NEWS: echo compatibility cleanup.
3957         * doc/coreutils.texi (echo invocation): Document the changes.
3958         * src/echo.c (V9_ECHO): Remove; always enabled.
3959         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3960         we use the same naming convention as bash.  Now an enum,
3961         not a macro.
3962         (usage): Reword to mention -e/-E more accurately.
3963         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3964         (hextobin): New function.
3965         (main): Use bool rather than int for local vars when appropriate.
3966         Do not allow options if POSIXLY_CORRECT, unless we are using
3967         BSD semantics and the first argument is "-n".
3968         Don't pass unnecessary extra arg to parse_long_options.
3969         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3970         Do not look for options if !allow_options.
3971         Use size_t rather than int when appropriate.
3972         Open-code option test rather than using strrchr.
3973         Use faster test for "-".
3974         Avoid redundant argc test.
3975         Add support for \x, for Bash compatibility.
3976         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3977         When '\c' is encountered, stop printing immediately, as POSIX
3978         requires.
3979         Add support for \xhh syntax.
3980         Add support for \0ooo syntax; POSIX requires this.
3981
3982 2004-06-01  Jim Meyering  <jim@meyering.net>
3983
3984         * Use automake-1.8b.  Regenerate dependent files.
3985
3986 2004-05-31  Jim Meyering  <jim@meyering.net>
3987
3988         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3989         the build src/ directory -- at the front.
3990         ($(srcdir)/$x-tests): Depend on Makefile.am.
3991         Use $x as the program name, except when it would be `test' (test is
3992         the sole program tested via mk-script that is also a shell built-in).
3993         In that case, use the old ../../src/$x.
3994
3995 2004-05-30  Jim Meyering  <jim@meyering.net>
3996
3997         Work around HPUX /bin/cc compiler bug that is exposed, now that
3998         sets are arrays of type `bool'.  More details here:
3999         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
4000         FIXME: verify that the above URL points to the right message
4001
4002         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
4003         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
4004         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
4005         system, those two expressions are not the same (256 vs. 1024).
4006         The effect of this problem was that `tr -c x y' would fail:
4007         tr: when not truncating set1, string2 must be non-empty
4008         (set_initialize): Remove unnecessary initialization of the `in_set'
4009         buffer; that initialization triggered the same compiler bug as above.
4010
4011 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4012
4013         tr cleanup, mostly having to do with integer type ranges.
4014         Remove all casts.
4015
4016         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
4017         the test cases wouldn't be portable, or would take too much CPU
4018         time, or both.
4019
4020         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
4021         This is safe since the code already assumes N_CHARS fits in int.
4022         (Filter): Remove: we want to prototype everything.
4023         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
4024         (uchar): New function.  All places where a char must be converted
4025         to an unsigned char are now done this way, not by ad-hoc methods.
4026         (count): New type.  Use it whenever counts or states are needed.
4027         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
4028         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
4029         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
4030         whenever appropriate.
4031         (NOT_A_CHAR): Remove global macro; now a local enum.
4032         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
4033         the rest of the code no longer depends on them.
4034         (class_ok): Remove; all uses changed to use inline comparisons.
4035         (RE_NO_TYPE): Remove; wasn't used or needed.
4036         (struct List_element): normal_char and equiv_code are now unsigned
4037         char, not int.
4038         first_char, last_char, and the_repeated_char are now unsigned char,
4039         not unsigned int.  repeat_count is now count, not size_t.
4040         All uses changed.
4041         (struct Spec_list): state is now count, not unsigned int.
4042         lengthis now count, not size_t.
4043         n_indefinite_repeats is now size_t, not int.
4044         has_equiv_class, has_char_class, and has_restricted_char_class
4045         are now bool, not int.  All uses changed.
4046         (struct E_string): s is now char *, not unsigned char *.
4047         escaped is now bool *, not int *.  All uses changed.
4048         (ES_MATCH): Remove macro, replacing with:
4049         (es_match): New inline function.  All uses changed.
4050         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
4051         translating): Now bool, not int.
4052         (io_buf): Now char array, not unsigned char.
4053         (SET_TYPE): Remove.  All uses replaced with bool.
4054         (is_equiv_class_member, unquote, append_range, append_char_class,
4055         append_equiv_class, find_closing_delim, star_digits_closebracket,
4056         build_spec_list, parse_str, homogeneous_spec_list):
4057         Now returns bool, not int.  All uses changed.
4058         (is_equiv_class_member): Now inline.
4059         (is_equiv_class_member, is_char_class_member, make_printable_str,
4060         append_normal_char, append_range, append_repeated_char,
4061         get_s2_spec_stats):
4062         Args are now of proper integer type.
4063         (unquote, look_up_char_class, make_printable_str,
4064         append_equiv_class, build_spec_list, squeeze_filter):
4065         Avoid unsigned char *p; gently convert *p to unsigned char instead.
4066         (unquote, get_spec_stats): Do not jump past declarations and then
4067         use them; C doesn't allow this in portable programs.
4068         (make_printable_str): Check for overflow in size calculations.
4069         (xmemdup): Remove.  All uses rewritten.
4070         (find_bracketed_repeat): Args are now of proper pointer-to-integer
4071         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
4072         (find_bracketed_repeat, star_digits_closebracket): Check that the
4073         digits are not escaped.
4074         (build_spec_list): Don't bother to copy opnd_str; not needed.
4075         (build_spec_list, get_next): Simplify internal logic a bit.
4076         (card_of_complement): Fix bug due to char overflow.
4077         (get_spec_stats): Don't assume len fits into int.
4078         Check for integer overflow.  Use abort() rather than assert(0).
4079         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4080         was being invoked.
4081         (squeeze_filter): READER is never null now; simplify code.
4082         READER arg now has a simpler type.  Remove unnecessary casts.
4083         (squeeze_filter, main): Calls to fwrite improperly checked result
4084         against zero, rather than against requested size.
4085         (plain_read): New function.
4086         (read_and_delete, read_and_xlate):
4087         Remove unused filter arg, and don't worry about hit_eof.
4088         Simplify by using plain_read.
4089         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4090         (main): Always pass a non-null procedure to squeeze_filter.
4091         Rewrite so that class_ok isn't needed.
4092
4093 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4094
4095         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4096         fdatasync reports EBADF when syncing (unwritable) directories.
4097         Problem reported by Albert Chin-A-Young in:
4098         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4099
4100 2004-05-29  Jim Meyering  <jim@meyering.net>
4101
4102         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4103         Patch from Albert Chin.
4104
4105         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4106
4107         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4108         into a single statement.
4109
4110 2004-05-28  Jim Meyering  <jim@meyering.net>
4111
4112         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4113
4114 2004-05-22  Jim Meyering  <jim@meyering.net>
4115
4116         rm -r would get a failed assertion when run from an inaccessible
4117         directory and with two or more command line arguments including an
4118         absolute-named directory followed by a relative-named directory.
4119
4120         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4121         * src/remove.c (struct cwd_state): Define.
4122         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4123         can be detected by the caller.  Instead of returning a malloc'd
4124         directory name, communicate it to caller via a new parameter, and
4125         return an indication of whether restore_cwd failed.  Update caller.
4126         Eliminate an unnecessary call to AC_stack_top.
4127         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4128         so we can now communicate to caller whether/how functions like
4129         restore_cwd have failed.  Update caller.
4130         (rm_1): Fail if we've failed to restore the working directory
4131         and the name of the next file to remove is `.'-relative.
4132         (rm): Fail if the require_restore_cwd flag is true and we've
4133         failed to restore the working directory.
4134         * src/mv.c (rm_option_init): Initialize new member,
4135         x->require_restore_cwd.
4136         * src/rm.c (rm_option_init): Likewise.
4137
4138 2004-05-21  Jim Meyering  <jim@meyering.net>
4139
4140         * tests/rm/inaccessible: New test for the above fix.
4141         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4142
4143         * src/remove.c (rm): Use free rather than XFREE.
4144         (remove_dir): Use xmalloc, not XMALLOC.
4145         (ds_init): Likewise.
4146
4147 2004-05-20  Jim Meyering  <jim@meyering.net>
4148
4149         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4150         diagnostics in shred.c have been fixed, don't exempt shred.c from
4151         this check.
4152
4153         * src/shred.c: Use translatable diagnostics, e.g.
4154         change "%s: remove" to _("%s: failed to remove") and
4155         change "%s: close"  to _("%s: failed to close").
4156
4157 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4158
4159         * src/shred.c (names): Bring back lower-case letters, "_", and
4160         ".".  But continue to omit +, =, %, @, #, as they're either
4161         shell metacharacters (for some shells) or are not in some
4162         character sets, or (in the case of '%') must be a
4163         metacharacter somewhere.
4164
4165 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4166
4167         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4168
4169 2004-05-17  Jim Meyering  <jim@meyering.net>
4170
4171         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4172
4173         chgrp and chown now dereference symlinks by default, per POSIX.
4174         Reported by Michal Politowski as http://bugs.debian.org/249177.
4175
4176         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4177         * src/chown.c (usage): Update to reflect this.
4178         * src/chgrp.c (usage): Likewise.
4179         * NEWS: Describe the change.
4180         Adapt tests accordingly.
4181         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4182         * tests/chgrp/deref: Likewise.
4183         * tests/chgrp/posix-H: Likewise.
4184
4185 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4186
4187         In shred, check for errors from fdatasync more carefully.  If
4188         fdatasync fails with errno==EINVAL, it means this implementation
4189         does not support synchronized I/O for this file.  Do not report
4190         this as an error, as (for example) AIX 5.2 fdatasync reports it
4191         for raw disk devices.  Problem reported by Albert Chin in
4192         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4193
4194         Check for write errors, though: the old code ignored them.
4195         Improve error checking in a few other cases, too (e.g., close of a
4196         directory).
4197
4198         Also, change several 'int' values to 'bool', so that the error
4199         checking is a bit clearer.  Similarly, change unsigned values
4200         to size_t where appropriate.
4201
4202         * src/shred.c: Include "dirname.h".
4203         (datasync) [!HAVE_FDATASYNC]: Remove.
4204         (dosync): New function.
4205         (dopass): Use it.  Return 1 on write error, -1 on other error.
4206         All callers changed.  Report write error if dosync does.
4207         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4208         not int (0/-1).  All callers changed.  Return false if there's a
4209         write error.
4210         (incname): Return bool (true/false), not int (0/1).  Accept
4211         size_t length, not unsigned.  All callers changed.  Do not
4212         bother checking for non-digits; it can't happen.  Replace
4213         recursion with iteration.
4214         (wipename): Use dir_name, base_name, etc. instead of assuming
4215         Unix file names.  Use size_t for length, not unsigned.
4216         Report error if unlink or close fails.
4217         (wipename, main): Use bool for booleans.
4218
4219         (names): Use only digits and uppercase letters, for greater
4220         portability.
4221
4222 2004-05-16  Jim Meyering  <jim@meyering.net>
4223
4224         * tests/chown/deref: New test for the yesterday's change.
4225         * tests/chown/Makefile.am (TESTS): Add deref.
4226
4227 2004-05-15  Jim Meyering  <jim@meyering.net>
4228
4229         chown --dereference did nothing when the owner/group of a
4230         symlink matched the desired owner/group.  Reported by David Malone.
4231         Also reported in 1999 as http://bugs.debian.org/39642.
4232
4233         * src/chown-core.c (change_file_owner): When --dereference has
4234         been specified, and when processing a symlink, stat it to get the
4235         owner and group of the referent.
4236
4237 2004-05-14  Jim Meyering  <jim@meyering.net>
4238
4239         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4240         s/supercede/supersede/ reported by Andrew Fabbro.
4241
4242 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4243
4244         Improve performance of `sort -m' on large files, at the cost of
4245         making some contrived examples unsafe.  POSIX allows this
4246         optimization.  Performance problem reported by Jonathan Baker in
4247         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4248
4249         * src/sort.c (first_same_file): Do not treat input pipes
4250         differently from other files.
4251         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4252         might write F before reading all the input.
4253         * NEWS: Likewise.
4254
4255 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4256
4257         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4258         '\007', for portability to EBCDIC hosts.
4259         * src/printf.c (print_esc_char): Likewise.
4260         * src/tr.c (unquote, make_printable_str): Likewise.
4261
4262 2004-05-12  Jim Meyering  <jim@meyering.net>
4263
4264         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4265         where the result is used.  This avoids one unnecessary lstat call
4266         per command line argument.
4267
4268 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4269
4270         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4271
4272         * src/Makefile.am (all_programs.list): New rule, copied from
4273         man/Makefile.am and tests/Makefile.am, except that we use the
4274         system tr rather than ./tr and we don't use tr -s.
4275         * tests/Makefile.am (all_programs): Use it.
4276         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4277         for consistency.  All uses changed.
4278
4279 2004-05-11  Jim Meyering  <jim@meyering.net>
4280
4281         * tests/rm/unread3: New test, for the above fix and today's
4282         lib/save-cwd.c improvement.
4283         * tests/rm/Makefile.am (TESTS): Add unread3.
4284
4285         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4286
4287 2004-05-10  Jim Meyering  <jim@meyering.net>
4288
4289         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4290         * tests/install/Makefile.am (TESTS): Add trap.
4291
4292         * src/remove.c (AD_push): Don't use errno in diagnostic about
4293         `changed dev/ino'.
4294
4295         Remove these generated files from CVS.
4296         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4297         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4298         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4299         * tests/tr/tr-tests, tests/wc/wc-tests:
4300
4301 2004-05-09  Jim Meyering  <jim@meyering.net>
4302
4303         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4304         a loop initializing the just-allocated memory to zero.
4305
4306 2004-05-08  Jim Meyering  <jim@meyering.net>
4307
4308         * tests/rm/no-give-up: New file; check for today's fix.
4309         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4310
4311 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4312
4313         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4314         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4315
4316         * src/remove.c (remove_entry): Check for errno values like ENOENT
4317         that show the file cannot be directory, instead of for errno
4318         values like EPERM that show the file might be a directory.  This
4319         is necessary because, when a single unlink() call has multiple
4320         reasons to fail, it can set errno to any of those reasons; it's
4321         only the rare errno value like ENOENT that excludes all the other
4322         possible reasons to fail even when the file is a directory.
4323         (remove_cwd_entries): Don't attempt chdir if the file is known
4324         to not be a directory.
4325         (remove_dir): Use the same method that remove_cwd_entries uses
4326         (for some reason they differed).  Don't assert that saved_errno
4327         must be EPERM; it might be just about anything.
4328
4329 2004-05-06  Jim Meyering  <jim@meyering.net>
4330
4331         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4332         Don't add `1' to the buffer size (it was to protect against malloc
4333         implementations that fail to allocate a buffer of size zero).
4334         That is no longer necessary, since we use a malloc wrapper
4335         on such systems.
4336
4337         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4338         * src/head.c (elide_tail_bytes_pipe): Likewise.
4339         * src/df.c (main): Likewise.
4340         * src/shred.c (do_wipefd): Likewise.
4341         * src/users.c (list_entries_users): Likewise.
4342         * src/tail.c (main): Likewise.
4343         * src/md5sum.c (main): Likewise.
4344
4345 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4346
4347         * src/df.c (show_disk, show_point): If several filesystems are
4348         mounted on the same mount point, prefer the last one, not the first.
4349         Problem reported by Christian Jones in
4350         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4351         (show_disk): Remove unused statp arg.  Return bool, not int.
4352         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4353         for lofs and dummies for each pass through the mount table,
4354         rather than subtly different algorithms (which are probably
4355         inadvertent).
4356
4357 2004-05-03  Jim Meyering  <jim@meyering.net>
4358
4359         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4360         have m4/Makefile*.
4361
4362 2004-05-01  Jim Meyering  <jim@meyering.net>
4363
4364         When chown or chgrp is modifying the referent of a symlink,
4365         use the chown(2) function, if possible.
4366         * src/chown-core.c (change_file_owner): Don't hard-code the
4367         open/fchown/close kludge here.  Use `chown' instead.
4368         The chown function works just fine on conforming systems.
4369         Other systems now go through the new chown wrapper that
4370         resorts to the old kludge.
4371
4372         * src/chown-core.c (change_file_owner): Add a comment.
4373
4374 2004-04-27  Jim Meyering  <jim@meyering.net>
4375
4376         * src/ptx.c: Make over 40 global extern variables `static'.
4377         (syntax_table, re_syntax_table): Remove declarations of two unused
4378         variables (they were exposed by the above change).
4379
4380         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4381         * src/ln.c (backup_type): Likewise.
4382
4383         * src/remove.c (rm): Add `extern' keyword.
4384         * src/cp-hash.c (forget_created, remember_created)
4385         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4386         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4387         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4388         (uid_to_name, chown_files): Likewise.
4389
4390         * src/Makefile.am (sc_tight_scope): New rule.
4391         * Makefile.maint (sc_tight_scope): New rule.
4392         (syntax-check-rules): Add it.
4393
4394 2004-04-26  Jim Meyering  <jim@meyering.net>
4395
4396         * Use automake-1.8.4.  Regenerate dependent files.
4397
4398         * src/sort.c (limfield): Make a comment clearer.
4399
4400 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4401
4402         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4403         leading blanks when computing the location of the field end;
4404         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4405         does conform to POSIX.  Also fix the documentation to clarify
4406         this and related issues.
4407
4408         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4409         that the options are in alphabetical order.  Describe how -b works
4410         more-accurately; this involves fixing some examples, too.  Mention
4411         what happens if the start field falls after an end field or after
4412         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4413         Add an example of how to sort IPv4 addresses and Apache Common
4414         Log Format dates.  Remove a duplicate example.
4415         (Putting the tools together): Use separate options rather
4416         than agglomerating them.
4417         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4418         decode whether to skip leading blanks.
4419         (trailing_blanks): Remove.
4420         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4421
4422         * tests/pr/Test.pm: Fix typo in env_default comment.
4423         * tests/sort/Test.pm: Likewise.
4424         (18c, 18d): Reverse the order of output lines, so that the
4425         test cases conform to POSIX.
4426
4427 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4428
4429         More signal-handling cleanup for ls.c.  Do not allow signals to
4430         happen between arbitrary output bytes, as the
4431         restore-default-color sequence can bollix up multibyte chars or
4432         color-change sequences in the ordinary output.  Instead, process
4433         signals only between printing a file name and changing the color
4434         back to non_filename_text color.  That way, if the signal handler
4435         changes the color (to the default), 'ls' will change it back when
4436         'ls' continues (after being suspended).
4437
4438         Also, do not bother with signal-handling unless stdout is a
4439         controlling terminal; this lets stdio buffer better when "ls
4440         --color" is piped or sent to a file.
4441
4442         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4443         Do not include "full-write.h"; no longer needed.
4444         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4445         (put_indicator_direct): Remove.  All callers changed to use
4446         put_indicator.
4447         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4448         (restore_default_color): Don't bother checking for put_indicator
4449         failure.
4450         (sighandler): Don't handle SIGTSTP; that's another handler now.
4451         Simply set interrupt_signal to the signal, then exit.
4452         (stophandler, process_signals): New functions.
4453         (main): Don't output any color changes until _after_ the signal
4454         handlers are set up.  This fixes a race condition where 'ls'
4455         could be interrupted while initializing colors, and leaving the
4456         terminal in an undesirable state.
4457         Don't mess with signal-handling if standard output is not a
4458         controlling terminal.
4459         When exiting, restore the default color, then restore the
4460         default signal handling, then act on any signals that weren't
4461         acted on yet.
4462         Do not print //DIRED// etc. in colors; this avoids the need
4463         to catch signals when printing them.
4464         (print_name_with_quoting): Process signals just before switching
4465         color back to non_filename_text.
4466
4467 2004-04-23  Jim Meyering  <jim@meyering.net>
4468
4469         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4470         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4471         of quotearg_buffer.  Patch by Mikulas Patocka.
4472
4473 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4474
4475         tee ignored SIGPIPE, but POSIX doesn't allow this.
4476
4477         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4478         does not allow this.  This undoes the 1996-10-24 patch.
4479
4480 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4481
4482         Signal-handling cleanup for coreutils.  Here are the highlights:
4483
4484          - csplit sometimes failed to remove files when interrupted.
4485          - csplit didn't clean up if two signals arrived nearly simultaneously.
4486          - install -s would infloop on System V if SIGCHLD was ignored.
4487          - ls could incorrectly restore color if multiple signals
4488            arrived nearly simultaneously.
4489
4490         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4491         Define.
4492         (filename_space, prefix, suffix, digits, files_created, remove_files):
4493         Now volatile.
4494         (caught_signals): New var.
4495         (cleanup): Block signals while deleting all files.
4496         (cleanup_fatal, handle_line_error, regexp_error):
4497         Mark with ATTRIBUTE_NORETURN.
4498         (create_output_file, close_output_file, interrupt_handler):
4499         Block signals while changing the number of output files,
4500         to fix some race conditions.
4501         (delete_all_files): Do nothing if remove_files is zero.
4502         Clear files_created.
4503         (main): Don't mess with signals until after argument processing
4504         is done.
4505
4506         * src/csplit.c (main): Rewrite signal-catching code to make it
4507         similar to other coreutils programs.  When processing signals,
4508         block all signals that we catch, but do not block signals that we
4509         don't catch.  Avoid problems with unsigned int warnings.
4510         * src/ls.c (main): Likewise.
4511         * src/sort.c (main): Likewise.
4512
4513         * src/csplit.c (interrupt_handler):
4514         Use void, not (obsolete) RETSIGTYPE.
4515         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4516
4517         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4518         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4519         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4520         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4521         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4522         for SIG_IGN.
4523         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4524
4525         * src/install.c: Include <signal.h>.
4526         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4527         given, since System V fork+wait does not work if SIGCHLD is ignored.
4528
4529         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4530         handler to self, not to SIG_IGN, since SIGTSTP can be received
4531         more than once.
4532         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4533         failures all over the place.
4534
4535 2004-04-20  Jim Meyering  <jim@meyering.net>
4536
4537         * src/remove.c (is_empty_dir): Clarify comment.
4538
4539         * man/help2man: Accept new option: --program-name=NAME, so that we
4540         can override the one in --version output.  This is needed solely
4541         so that test.1 doesn't refer to `[' as the program name.
4542         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4543         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4544
4545         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4546
4547         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4548
4549 2004-04-19  Jim Meyering  <jim@meyering.net>
4550
4551         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4552         Initialize a buffer to avoid warnings from tools like valgrind.
4553
4554         * Makefile.maint (sc_trailing_blank): New rule.
4555         (syntax-check-rules): Add it.
4556         * .x-sc_trailing_blank: New file.
4557
4558         Make pwd work even if the resulting name is so long that getcwd fails.
4559         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4560         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4561         (main): First try getcwd, then, upon failure, robust_getcwd.
4562
4563 2004-04-18  Jim Meyering  <jim@meyering.net>
4564
4565         * src/who.c (print_user): Use xrealloc here, rather than
4566         unchecked realloc.  Remove anachronistic casts.
4567
4568         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4569
4570         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4571         from remove.c.
4572         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4573         renaming it.  Update uses.
4574
4575 2004-04-17  Jim Meyering  <jim@meyering.net>
4576
4577         * configure.ac: Depend on automake-1.8.3.
4578
4579         * src/join.c (add_file_name): Declare function to be `static'.
4580         (string_to_join_field): Likewise.
4581         * src/remove.c (ds_init, ds_free): Likewise.
4582
4583         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4584         (syntax-check-rules): Add to the list.
4585
4586 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4587
4588         Use page-aligned buffers whenever we bother to do I/O using buffer
4589         sizes that are tailored for the files.
4590
4591         * src/cat.c: Include getpagesize.h.
4592         * src/copy.c: Likewise.
4593         * src/shred.c: Likewise.
4594         * src/split.c: Likewise.
4595         * src/cat.c (main): Align I/O buffers to page boundaries.
4596         * src/copy.c (copy_reg): Likewise.
4597         * src/shred.c (dopass): Likewise.
4598         * src/split.c (main): Likewise.
4599         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4600         All uses replaced by ptr_align.
4601         * src/od.c (gcd, lcm): Remove; now in system.h.
4602         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4603
4604 2004-04-14  Jim Meyering  <jim@meyering.net>
4605
4606         Remove m4/Makefile.am: it's no longer needed, with newer automake
4607         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4608         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4609
4610 2004-04-13  Jim Meyering  <jim@meyering.net>
4611
4612         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4613
4614 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4615
4616         * NEWS: cp -pu and mv -u (when copying) now take the destination
4617         file system time stamp resolution into account.
4618         * doc/coreutils.texi (mv invocation): Document this.
4619         (cp invocation): Document -u (it was missing!) with new behavior.
4620
4621         * src/copy.c: Include "utimecmp.h".
4622         (copy_internal): Compare time stamps using utimecmp rather than
4623         MTIME_CMP.
4624
4625 2004-04-09  Jim Meyering  <jim@meyering.net>
4626
4627         * Makefile.maint (.re-list): New rule/file, to replace
4628         hard-coded list of header file names.
4629         (sc_system_h_headers): Use the new file.
4630         Don't look for sys2.h anymore.
4631
4632         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4633         all of its macro definitions -- the list was slightly out of date.
4634         Suggestion from Dmitry V. Levin.
4635
4636 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4637
4638         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4639         * doc/coreutils.texi (dd invocation): Likewise.
4640         * src/shred.c (O_NOCTTY): Remove redundant decl.
4641         * src/dd.c (flags, usage): Remove noctty flag.
4642         (main): Always use O_NOCTTY when opening files.
4643
4644 2004-04-08  Jim Meyering  <jim@meyering.net>
4645
4646         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4647         (set_fd_flags): Undo part of today's change: it's a little
4648         cleaner -- and more efficient in the common case -- to go
4649         ahead and OR in the -1 when fcntl fails.
4650
4651         * Makefile.maint (sc_dd_max_sym_length): New target.
4652         (syntax-check-rules): Add it.
4653
4654         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4655         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4656
4657         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4658         Rename parameter, flags, to avoid shadowing global.
4659         (LONGEST_SYMBOL): Tweak comment.
4660
4661 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4662
4663         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4664         and new dd options iflag= and oflag=.
4665         * src/dd.c (usage): Likewise.
4666         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4667         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4668         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4669         (input_flags, output_flags): New vars.
4670         (LONGEST_SYMBOL): New macro.
4671         (struct symbol_value): Renamed from struct conversion.  Members
4672         symbol and value renamed from convname and conversion.  The
4673         symbol value is now an array instead of a pointer; this saves
4674         a bit of space and time in practice.  All uses changed.
4675         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4676         (flags): New constant array.
4677         (iflag_error_msgid, oflag_error_msgid): New constants.
4678         (parse_symbols): Renamed from parse_conversion and generalized
4679         to handle either conversion or flag symbols.
4680         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4681         support for iflag= and oflag=.  Reject attempts to use
4682         both excl and nocreat.
4683         (set_fd_flags): New function.
4684         (dd_copy): Just return X rather than calling quit (X), since our
4685         caller invokes quit with the returned value.  Add support for
4686         fdatasync and fsync.
4687         (main): Add support for iflag=, oflag=, and new conv= symbols.
4688         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4689         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4690
4691         * NEWS: Remove duplicate mention of BLOCKSIZE.
4692
4693 2004-04-02  Andreas Schwab  <schwab@suse.de>
4694
4695         * src/stty.c: Add support for IUTF8 input flag.
4696
4697 2004-04-06  Jim Meyering  <jim@meyering.net>
4698
4699         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4700         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4701
4702 2004-04-04  Jim Meyering  <jim@meyering.net>
4703
4704         A specified format is no longer automatically newline terminated.
4705         If you want a newline at the end of your format, use `\n'.
4706         * src/stat.c (print_it): Don't print a newline at the end of
4707         every format.
4708         (do_statfs): Add a newline at end of each default format string.
4709
4710 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4711
4712         * src/nohup.c (main): Adjust to new calling convention
4713         for set_cloexec_flag.
4714
4715 2004-03-31  Jim Meyering  <jim@meyering.net>
4716
4717         * tests/Fetish.pm (run_tests): Remove `.orig' file.
4718         Remove debugging diagnostic.
4719
4720         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4721         would not elicit an error.
4722         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4723         (main): Don't use atoi.  Use xstrtoul instead.
4724
4725 2004-03-30  Jim Meyering  <jim@meyering.net>
4726
4727         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4728         (syntax-check-rules): Add it.
4729         * .x-sc_prohibit_atoi_atof: New file.
4730
4731 2004-03-29  Jim Meyering  <jim@meyering.net>
4732
4733         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4734         test is not sensitive to system-dependent block size differences.
4735         Prompted by a report of Solaris 8 differences from Paul Eggert.
4736
4737         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4738         Rename `%tmp' to `%actual'.  Reverse order of last two args to
4739         _compare_files (to $actual, $expected) so as to match declaration.
4740
4741 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4742
4743         Fix some gotchas encountered when porting to Solaris 8, using
4744         the Forte 6u2 compiler.
4745
4746         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4747         Declare sethostname, since no Solaris header does it.
4748         * src/who.c: Include "vasprintf.h", for asprintf.
4749
4750 2004-03-28  Jim Meyering  <jim@meyering.net>
4751
4752         Minor optimization:
4753         * src/du.c (process_file): Don't record dev/inode for directories.
4754
4755         Under some circumstances, without -c, du would mistakenly count the
4756         space of hard-linked files, not just the first one it encountered.
4757         Reported by Anthony Thyssen.
4758         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4759
4760         * src/du.c: Rename global `print_totals' to `print_grand_total'.
4761
4762         * src/du.c (main): Rearrange filtering loop to be a tiny bit
4763         more efficient.
4764
4765         * src/chown-core.c: Don't include savedir.h -- no longer needed.
4766         * src/chmod.c: Likewise.
4767
4768 2004-03-25  Jim Meyering  <jim@meyering.net>
4769
4770         * src/du.c (main): Remove now-unused declaration of `i'.
4771
4772 2004-03-24  Paul Eggert  <eggert@twinsun.com>
4773
4774         * src/du.c (main): Filter out file names of length zero before
4775         invoking fts, so that they don't cause fatal errors.
4776
4777 2004-03-25  Jim Meyering  <jim@meyering.net>
4778
4779         * tests/du/files0-from (zero-len): Add a test for the above.
4780
4781 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4782
4783         * NEWS: New environment var BLOCKSIZE.
4784         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4785         * tests/envvar-check: Test for it.  Factor the code to simplify it.
4786
4787 2004-03-23  Paul Eggert  <eggert@twinsun.com>
4788
4789         * NEWS: Shorten the du --files0-from announcement, and say
4790         "NUL-terminated" rather than "NUL-separated".
4791         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4792         Remove: not used.
4793         (usage): Say "NUL-terminated", not "NUL-separated".
4794         (main): Check for I/O error when istream is closed.
4795         Allow --files0-from=F even if F is empty; this specifies no files.
4796         (du_files): Now that we allow the list of files to be empty,
4797         handle that case.
4798         * tests/du/files0-from: Adjust to above changes to src/du.c.
4799
4800 2004-03-24  Jim Meyering  <jim@meyering.net>
4801
4802         * tests/tail-2/assert: Avoid race condition that could cause
4803         spurious failure.  Based on a patch from Andreas Schwab.
4804
4805 2004-03-23  Jim Meyering  <jim@meyering.net>
4806
4807         * src/du.c (main): Free the hash table, too.
4808
4809 2004-03-22  Jim Meyering  <jim@meyering.net>
4810
4811         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4812         the change of 2004-01-22.  I can no longer reproduce the problem
4813         that prompted that change, and `info coreutils pr' would display the
4814         `printing text' section of the manual, not the one on `pr invocation'.
4815
4816         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4817         to match corrected output.
4818
4819         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4820         (main): Use readtoken0 functions rather than readtokens.
4821         Don't use errno when diagnosing readtokens0 failure.
4822         Fix off-by-one error in the token number reported in a diagnostic.
4823         (du_files): Return bool, rather than int.
4824         (main): Call readtokens0_free.
4825
4826 2004-03-21  Jim Meyering  <jim@meyering.net>
4827
4828         * src/remove.c (ds_free): Plug a small leak.
4829
4830         * tests/Fetish.pm: Fix typo in comment.
4831
4832 2004-03-07  Jim Meyering  <jim@meyering.net>
4833
4834         * NEWS: du accepts a new option --files0-from=FILE, where FILE
4835         contains a list of NUL-separated file names.
4836
4837         * src/du.c: Include "readtokens.h".
4838         (usage): Describe the new option, and adjust the `Usage':
4839         with this option, no FILE may be specified on the command line.
4840         (main): Handle the new option.
4841
4842         * tests/du/files0-from: New tests, for the above.
4843         * tests/du/Makefile.am (TESTS): Add files0-from.
4844
4845         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4846         * src/tsort.c (tsort): Likewise.
4847
4848 2004-02-29  Paul Eggert  <eggert@twinsun.com>
4849
4850         * NEWS: Add support for a new notation @N to get_date to represent
4851         the time stamp with numeric value N.  Improve support for
4852         fractional time stamps.  date's -d and -f options now accept them.
4853         Likewise for touch -t.  date has a new option --iso-8601=ns.
4854
4855         * doc/coreutils.texi (touch invocation):
4856         Describe use of fractional seconds.
4857         (date invocation, Options for date): Likewise.
4858         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4859         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4860         (Options for date): Describe new --iso-8601=ns option.
4861
4862         * doc/getdate.texi: Add copyright notice.  Change getdate to
4863         get_date when talking about the function name.
4864         (Seconds since the Epoch): New section, containing the time_t
4865         info moved from Date input formats section, along with new
4866         info about the @ syntax.  Mention negative time stamps,
4867         fractional time stamps, and leap seconds.
4868         (General date syntax): Modernize examples a bit to reflect new
4869         features.
4870         (General date syntax, Relative items in date strings):
4871         Use ' rather than " to quote formats.
4872         (Time of day items): Add an example with fractional seconds.
4873         Describe fractional-second syntax.
4874
4875         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4876         needs clock_gettime.
4877
4878         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4879         (time_spec_string, time_spec, show_date): Support it.
4880         (usage): Remove description of -ITIMESPEC, as it's obsolete and
4881         confusing.  Mention --iso-8601=ns.
4882         (batch_convert): getline returns ssize_t, not int.
4883
4884         * src/touch.c (newtime): Now an array of two timespecs, one
4885         for access and one for modification.
4886         (ref_stats): Remove.
4887         (get_reldate): Use get_date's parameter profile.
4888         (touch, main): Adjust to above changes.
4889         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4890         Use gettime instead of gettimeofday, for new get_date signature.
4891
4892         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4893         ns-relative.
4894
4895 2004-03-15  Jim Meyering  <jim@meyering.net>
4896
4897         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4898         target before updating $(prev_version_file).
4899
4900         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4901         See today's change in lib/getdate.y.
4902         * tests/misc/Makefile.am (TESTS): Add date-sec.
4903
4904 2004-03-14  Jim Meyering  <jim@meyering.net>
4905
4906         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4907         signature files, not `.asc'.  Reported by angico@yahoo.com.
4908
4909 2004-03-13  Jim Meyering  <jim@meyering.net>
4910
4911         * src/cp.c (do_copy): Tweak wording in a diagnostic.
4912         Suggestion from Karl Berry.
4913         Include "quoatearg.h".
4914         (do_copy): Use quotearg_colon (not quote) for diagnostics
4915         that begin with `"%s:'.
4916
4917         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4918         Suggestion from Dan Jacobson.
4919
4920 2004-03-12  Jim Meyering  <jim@meyering.net>
4921
4922         * Version 5.2.1.
4923
4924         Sometimes, when source and destination partition are different,
4925         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
4926
4927         * src/copy.c: When moving a set of N hard-linked files between
4928         partitions, via two or more command line arguments where the
4929         command line argument containing the Nth link contains no other
4930         link to that same file, mv would mistakenly copy the file, rather
4931         than hard-linking it to the other(s).  That happens because when the
4932         final link is processed, its link count has been reduced to 1 since
4933         the other links have been `copied' to the destination partition
4934         and the source links have been removed.
4935         (copy_internal): When in move mode, use the source dev/inode
4936         pair to look up destination name even when st_nlink == 1.
4937         * src/cp-hash.c (src_to_dest_lookup): New function.
4938         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4939         * tests/mv/part-hardlink: New file.  Test for the above fix.
4940         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4941
4942         * announce-gen: Sync with autoconf.
4943
4944         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4945         This was triggered on a Linux-2.2.19 system using a file system
4946         NFS-mounted from some sort of Sun.
4947
4948 2004-03-11  Jim Meyering  <jim@meyering.net>
4949
4950         * Use automake-1.8.3.  Regenerate dependent files.
4951
4952 2004-03-10  Jim Meyering  <jim@meyering.net>
4953
4954         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4955         so that this test works with SELinux-enabled systems.
4956         Based on a patch from Tim Waugh.
4957
4958         `join -1 x' would give a misleading diagnostic
4959         * src/join.c (string_to_join_field): Report that a non-numeric field
4960         number is invalid, rather than `so large that it is not representable'.
4961         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4962
4963 2004-03-06  Jim Meyering  <jim@meyering.net>
4964
4965         cp --sparse=always sparse-image-file.img /dev/hda1 could
4966         produce an invalid copy on the destination device.
4967
4968         * src/copy.c (copy_reg): Even with --sparse=always, try to
4969         make `holes' only if the destination is a regular file.
4970         Reported by Szakacsits Szabolcs.
4971
4972 2004-03-03  Paul Eggert  <eggert@twinsun.com>
4973
4974         * src/nohup.c (main): Don't invoke set_cloexec_flag with
4975         a file descriptor of -1.
4976
4977 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
4978
4979         * src/nohup.c: Include "cloexec.h".
4980         (main): Set the copy of stderr to close on exec.
4981
4982 2004-03-01  Paul Eggert  <eggert@twinsun.com>
4983
4984         * configure.ac: Include <signal.h> when checking for strsignal,
4985         sys_siglist, and friends.  Problem reported by Tony Leneis in
4986         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4987
4988 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4989
4990         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4991         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4992         etc. are set.
4993
4994 2004-02-23  Paul Eggert  <eggert@twinsun.com>
4995
4996         * NEWS: Document how chown's USER.GROUP argument is now parsed.
4997
4998 2004-02-23  Jim Meyering  <jim@meyering.net>
4999
5000         * src/seq.c (usage): Remove stray space after \n in --help output.
5001
5002 2004-02-22  Jim Meyering  <jim@meyering.net>
5003
5004         * src/du.c (usage): Separate -H and --si.  Say that the meaning
5005         of -H will soon change to that of --dereference-args (-D).
5006
5007 2004-02-21  Jim Meyering  <jim@meyering.net>
5008
5009         * src/comm.c (usage): Tell what comm does when there are no options.
5010         Reword in terms of FILE1 and FILE2 rather than `left file' and
5011         `right file'.  Suggestion from Dan Jacobson.
5012
5013 2004-02-15  Paul Eggert  <eggert@twinsun.com>
5014
5015         Fix some POSIX-conformance bugs in expr.
5016
5017         * NEWS: document the following changes to src/expr.c.
5018         * doc/coreutils.texi (expr invocation): Likewise.
5019         Document what forms integers may take, and say "integer"
5020         consistently instead of "number".  Warn about operands
5021         that "expr" can misinterpret, and how to work around the
5022         problem.
5023         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
5024         Accept a bool argument specifying whether to evaluate the
5025         expression.  This is to allow short-circuit evaluation.  All
5026         callers changed.
5027         (null): Report that a string is zero even if it has
5028         a form like "-0" or "00".
5029         (eval1, eval): Use short-circuit evaluation for | and &.
5030         (eval): Return 0 if both arguments are null or zero, instead
5031         of returning the first argument.
5032         * tests/expr/basic: Add some tests for the above.
5033
5034 2004-02-17  Jim Meyering  <jim@meyering.net>
5035
5036         * Version 5.2.0.
5037
5038         `make check' from a build inside a chroot environment would fail
5039         * tests/help-version: Specify an argument (`/') for df, in the
5040         unusual event that there is no valid entry in /etc/mtab.
5041         Likewise for id: add the -u option, so we don't get spurious
5042         failures when there are no user or group names.
5043         Patch by Tim Waugh.
5044
5045         * src/sort.c (usage) [-u]: Add punctuation so that the description in
5046         the help2man-generated (line-joined) man page is more readable.
5047         Reported by Tim Waugh.
5048         [-T]: Add a semicolon, for the same reason.
5049
5050 2004-02-15  Jim Meyering  <jim@meyering.net>
5051
5052         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
5053
5054 2004-02-11  Jim Meyering  <jim@meyering.net>
5055
5056         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
5057         $(srcdir)/../Makefile.am.in, rather than $<.
5058         Suggestion from Michael Elizabeth Chastain.
5059
5060 2004-02-10  Jim Meyering  <jim@meyering.net>
5061
5062         * config/install-sh: Make this script executable.
5063         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
5064         is executable.  Otherwise, on systems that lack a suitable install
5065         binary, `make install' would fail, because of the way this script
5066         is invoked (without `$SHELL ' prefix).
5067         Reported by Bob Proulx.
5068
5069 2004-02-08  Jim Meyering  <jim@meyering.net>
5070
5071         * Version 5.1.3.
5072
5073         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5074         that would cause an unwarranted test failure.
5075         * tests/rm/rm3: Likewise.
5076
5077 2004-02-07  Jim Meyering  <jim@meyering.net>
5078
5079         Remove xstat function pointer member.  The way it was used was not
5080         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5081         inline `stat' and `lstat' functions, thus making the tests of
5082         `xstat == lstat' in copy.c always fail.
5083         * src/copy.h (struct cp_options) [xstat]: Remove member.
5084         (XSTAT): New macro.
5085         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5086         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5087         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5088         (valid_options): Remove now-obsolete FIXME comments.
5089
5090         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5091         `*(x->xstat) (...)'.
5092         (do_copy): Declare/use local xstat rather than x->xstat.
5093         (main): Remove code that set x.xstat.
5094         * src/mv.c (cp_option_init): Don't initialize xstat member.
5095         * src/install.c (cp_option_init): Likewise.
5096
5097         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5098         so that emit_upload_commands can use these variables, too.
5099
5100 2004-02-06  Jim Meyering  <jim@meyering.net>
5101
5102         * tests/rm/deep-1: Remove `du' stack space test.
5103         Apparently, `ulimit -s N' isn't portable enough.
5104         This test will be restored (with a guard against losing ulimit)
5105         in its own file later.
5106
5107         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5108         since this test doesn't take long enough to merit them.
5109         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5110
5111         * Makefile.maint (signatures): Remove definition.
5112         Now, automake's gnupload handles this.
5113         (%.sig: %): Remove now-unused rule.
5114         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5115         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5116         (emit-upload-commands): Adjust to use gnupload.
5117
5118 2004-02-05  Jim Meyering  <jim@meyering.net>
5119
5120         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5121         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5122         Now, those are all defined in timespec.h.
5123         Include timespec.h.
5124
5125         * src/date.c: Don't include timespec.h, now that system.h does it.
5126
5127 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5128
5129         Don't dump core if localtime returns NULL (possible on
5130         hosts with 64-bit time_t and 32-bit int).
5131         * src/date.c: Include "inttostr.h".
5132         (batch_convert, main):
5133         If time conversion fails, exit with nonzero status.
5134         (show_date): Return int to report conversion failure.
5135         Print the time as an int if localtime fails.
5136         * src/uptime.c: Print "??" if the current clock can't
5137         be converted by localtime.  This won't happen until the year
5138         2*31 + 1900, but we don't want to dump core even if the current
5139         clock has the wrong value.
5140
5141         * src/stat.c: Include "inttostr.h".
5142         (human_time): Print the date/time as a number of seconds since the
5143         epoch if it can't be converted by localtime.  This is better than
5144         just saying "invalid", and is consistent with what "ls" does.
5145         Don't dump core if the year has more than 48 digits; this isn't
5146         possible on any contemporary host, but we might as well do it right.
5147
5148 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5149
5150         * src/stat.c (human_time): Accept time rather than
5151         pointer-to-const-time parameter, for clarity.  All callers changed.
5152
5153 2004-02-02  Jim Meyering  <jim@meyering.net>
5154
5155         * src/stat.c (do_stat): Remove extra trailing newline from
5156         default formats.  Reported by Nelson H. F. Beebe.
5157
5158         Print actual fractional seconds in time stamps, not just `.00000000'.
5159         * src/stat.c (human_time): Add and use new parameter, t_ns.
5160         (print_stat): Update callers.
5161         * src/ls.c (TIMESPEC_NS): Remove definition.
5162         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5163         also uses this macro.
5164         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5165         fractional seconds for files on an XFS file system, but that stat's
5166         fractional seconds were always zero.
5167
5168 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5169
5170         * src/seq.c (print_numbers): Use 'double' for loop index, not
5171         'int', to avoid problems with integer overflow.  On almost all
5172         machines 'double' works in every case where 'int' works, and
5173         it works on other cases besides.
5174
5175 2004-01-27  Jim Meyering  <jim@meyering.net>
5176
5177         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5178         it defaults to 1, even when FIRST is larger than LAST.
5179         Reword so as not to exclude the possibility that INCREMENT be zero.
5180
5181 2004-01-25  Jim Meyering  <jim@meyering.net>
5182
5183         * Version 5.1.2.
5184
5185         * Makefile.maint (signatures): Comment out definition.
5186
5187 2004-01-23  Jim Meyering  <jim@meyering.net>
5188
5189         * Makefile.maint (header_regexp): Add exitfail.
5190
5191         * man/Makefile.am (EXTRA_DIST): Add help2man.
5192         Reported by Nelson H. F. Beebe.
5193
5194         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5195         so it works on systems with Perl installed somewhere other than in
5196         /usr/bin.
5197
5198         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5199         `int', not `char', since it must hold EOF.  This bug would make
5200         paste infloop on some systems.  Test failures reported by
5201         Nelson H. F. Beebe and Christian Krackowizer.
5202
5203 2004-01-22  Jim Meyering  <jim@meyering.net>
5204
5205         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5206         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5207
5208         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5209         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5210         Use --info-page='coreutils PROG' option.
5211         Now, readlink.1 refers the user to `info coreutils readlink'
5212         rather than to `info readlink'.  Reported by Matt Swift.
5213
5214 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5215
5216         Exit status cleanup.
5217
5218         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5219         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5220         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5221         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5222         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5223         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5224         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5225         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5226         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5227         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5228         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5229         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5230         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5231         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5232         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5233         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5234         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5235
5236         * src/cat.c (usage): Don't bother normalizing exit status
5237         since the arg is already the correct exit status now.
5238         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5239         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5240         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5241         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5242         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5243
5244         * src/chown.c (main): Removed unused local 'fail'.
5245
5246         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5247         Remove.
5248
5249         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5250         * src/env.c, src/nice.c, src/su.c: Likewise.
5251         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5252         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5253         * src/expr.c (main): Use initialize_exit_failure rather than
5254         setting exit_failure directly; this optimizes away redundant
5255         assignments.
5256         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5257
5258         * src/chroot.c (main): Exit with status 1 rather than 127
5259         if chroot itself fails, as per documentation.
5260
5261         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5262         rather than roll-your-own symbols or integers.
5263         * src/env.c (main): Likewise.
5264         * src/nohup.c (main): Likewise.
5265         * src/su.c (run_shell): Likewise.
5266
5267         * src/cp.c (exit_status): Remove static var....
5268         (main): Making it local here instead.  Use =, not |=, to set it.
5269
5270         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5271         not 2, on errors.
5272         * src/date.c (batch_convert, main): Likewise.
5273         * src/dd.c (dd_copy): Likewise.
5274         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5275         * src/tr.c (main): Likewise.
5276         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5277         POSIX doesn't require it.
5278         * src/dd.c (write_output, skip, dd_copy): Likewise.
5279         * src/df.c (main): Likewise.
5280         * src/id.c (main): Likewise.
5281         * src/install.c (main): Likewise.
5282         * src/ln.c (main): Likewise.
5283         * src/ls.c (main): Likewise.
5284         * src/mv.c (main): Likewise.
5285         * src/shred.c (main): Likewise.
5286
5287         * src/env.c (main): Exit with status 1, not 2, on errors detected
5288         by env proper.
5289         * src/hostname.c (main): Likewise.
5290         * src/nl.c (main): Likewise.
5291         * src/stty.c (main): Likewise.
5292
5293         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5294         consistency with the other programs' naming conventions.
5295         All uses changed.
5296
5297         * src/factor.c (main): Do not report a usage error simply
5298         because stdin has bad numbers.
5299
5300         * src/id.c (problems): Now a boolean int, not a counter,
5301         so that we don't have to worry about int overflow.  All uses changed.
5302         * src/touch.c (err): Likewise.
5303
5304         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5305
5306         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5307         * src/mknod.c: Likewise.
5308
5309         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5310         on error; this is in case EXIT_FAILURE is unusual.
5311         * src/su.c (main): Likewise.
5312
5313         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5314         changed to EXIT_CANNOT_INVOKE.
5315
5316         * src/printenv.c (PRINTENV_FAILURE): New constant.
5317         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5318         command-line syntax problems.
5319
5320         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5321         (main): Avoid integer overflow when seeing whether errors occurred.
5322
5323         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5324         All callers changed.
5325         (main): Remove unused local variable 'errs'.  Always exit successfully
5326         if we reach the end.
5327
5328         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5329         for consistency with other programs here.  All uses changed.
5330         (main): Use 'error' to exit rather than invoking 'exit' here.
5331
5332         * src/sort.c: Don't include <assert.h>.
5333         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5334         (usage): Don't use 'assert'.
5335         (main): Remove redundant assignment to exit_failure.
5336
5337         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5338         New enum values.
5339         (initialize_exit_failure): New inline function.
5340         Include exitfail.h here, since we refer to exit_failure.
5341         All callers changed to not include exitfail.h.
5342
5343         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5344         substitute them for the corresponding integer constants.
5345
5346         * tests/help-version (expected_failure_status_date): Remove, as
5347         'date' is now normal.
5348         (expected_failure_status_nohup): New var.
5349
5350 2004-01-21  Jim Meyering  <jim@meyering.net>
5351
5352         * tests/touch/relative: Remove `command' syntax.
5353         Thanks to Nelson H. F. Beebe and Paul Eggert.
5354
5355         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5356         so as to avoid problems with systems using TAI clocks.
5357         Although it's no longer necessary, set TZ=UTC0 also for the
5358         initial touch command.  Reported by Paul Jarc here:
5359         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5360
5361 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5362
5363         * src/dircolors.hin: Add .mov to the list of media files.
5364
5365 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5366
5367         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5368         portable).  Problem reported by Christian Krackowizer.  Also, use
5369         +0000 rather than +0 to specify a time zone, as the documentation
5370         requires four digits.
5371
5372 2004-01-19  Jim Meyering  <jim@meyering.net>
5373
5374         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5375         * tests/mv/backup-is-src: Likewise.
5376         Problem reported by Peter Horst
5377
5378 2004-01-17  Jim Meyering  <jim@meyering.net>
5379
5380         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5381
5382         * Version 5.1.1.
5383
5384 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5385
5386         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5387         with -r specifying the origin for -d.
5388         * src/touch.c (flexible_date): Remove static var.
5389         (get_reldate): New function.
5390         (main): Use it, to implement this new behavior.
5391
5392 2004-01-16  Jim Meyering  <jim@meyering.net>
5393
5394         * tests/touch/relative: New test for the above.
5395         * tests/touch/Makefile.am (TESTS): Add relative.
5396
5397 2004-01-13  Jim Meyering  <jim@meyering.net>
5398
5399         * src/system.h: Include contents of sys2.h.
5400         * src/sys2.h: Remove file.
5401         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5402
5403         * Use automake-1.8.2.  Regenerate dependent files.
5404
5405         * Update to gettext-0.13.1.
5406         * configure.ac: Use gettext-0.13.1.
5407         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5408
5409 2004-01-12  Jim Meyering  <jim@meyering.net>
5410
5411         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5412
5413         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5414         Reported by Alexandre Duret-Lutz.
5415
5416         * src/tail.c (main): Warn about following stdin only when it's a tty.
5417
5418         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5419
5420 2004-01-10  Jim Meyering  <jim@meyering.net>
5421
5422         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5423
5424 2004-01-09  Jim Meyering  <jim@meyering.net>
5425
5426         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5427
5428 2004-01-08  Jim Meyering  <jim@meyering.net>
5429
5430         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5431         From Andreas Schwab.
5432
5433         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5434         remnant) from PATH component.  That would cause tests in this directory
5435         not to run the just-built binaries, but rather whatever happened
5436         to be in one's PATH.  Reported by Christian Krackowizer.
5437
5438 2004-01-04  Jim Meyering  <jim@meyering.net>
5439
5440         * src/csplit.c (new_control_record): Use x2nrealloc
5441         rather than xrealloc.
5442
5443         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5444         alloca and strcpy.
5445         (make_path_private): Likewise.
5446
5447 2004-01-03  Jim Meyering  <jim@meyering.net>
5448
5449         * src/paste.c: Use `bool' (not int) as the type for a few
5450         global variables.
5451         (collapse_escapes): Rewrite to set globals rather than modifying
5452         its parameter.
5453         Use size_t (not int) for all counters and related index variables.
5454         (paste_parallel): Remove needless complexity of
5455         using xrealloc in the loop;  just allocate the buffers up front.
5456         Free the two temporary buffers.
5457         Move declarations of locals `down' into scope where used.
5458         (paste_serial): Remove `register' attributes.
5459         (main): Simplify delim-related code.
5460         Free `delims', now that it's malloc'd.
5461
5462 2004-01-02  Jim Meyering  <jim@meyering.net>
5463
5464         * src/chroot.c: Include "quote.h".
5465         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5466         (main): Exit with status of 127, not 1, for too-few-args,
5467         chroot failure, or chdir failure.
5468         Give a better diagnostic upon execvp failure.
5469
5470         * src/du.c (usage): Mention that, with its current meaning,
5471         -H is deprecated.
5472
5473         * src/tail.c (main): Warn about following stdin when it's a tty.
5474         Fail when following by name but no names are specified.
5475
5476 2003-12-30  Jim Meyering  <jim@meyering.net>
5477
5478         * src/fold.c (main): Use memcpy, not strcpy.
5479
5480         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5481         alloca and strcpy.
5482
5483 2003-12-28  Jim Meyering  <jim@meyering.net>
5484
5485         * src/unexpand.c (n_tabs_allocated): New global.
5486         (add_tabstop): Use x2nrealloc rather than xrealloc.
5487         * src/expand.c: Likewise.
5488
5489         * tests/misc/expand: New file.
5490         * tests/misc/Makefile.am (TESTS): Add expand.
5491
5492         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5493         (fillbuf): Use x2nrealloc rather than xrealloc.
5494         (sort): Use xnmalloc rather than xmalloc.
5495         (main): Likewise.
5496
5497 2003-12-27  Jim Meyering  <jim@meyering.net>
5498
5499         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5500
5501 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5502
5503         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5504         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5505
5506         * doc/coreutils.texi (join invocation): Remove documentation
5507         accordingly.  Document that -t makes all separators significant.
5508
5509         * src/join.c: Include posixver.h.
5510         (obsolete_usage): New var.
5511         (longopts): Put obsolete options first.
5512         (OBSOLETE_LONG_OPTIONS): New constant.
5513         (get_option, add_file_name): New functions.
5514         (main): Use them to support new behavior.
5515         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5516         Do not mark -j FIELD as obsolescent; it is longstanding
5517         UNIX tradition and is a valid extension to POSIX.
5518
5519         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5520
5521 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5522
5523         * src/join.c (add_field_list): Don't use alloca with unbounded
5524         size; just modify the argument, which is no longer const *.
5525
5526         Various other minor cleanups, mostly to avoid the need for casts.
5527
5528         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5529
5530         (struct field.beg): Now char *, not unsigned char const *.  All
5531         uses changed.  It shouldn't be const since xmemcoll writes on its
5532         arguments.
5533         (extract_field): Likewise, for 2nd arg.
5534         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5535
5536         (is_blank): New function, to avoid need to cast arg to unsigned char.
5537         (extract_field): Use it.
5538
5539         (xfields): Rewrite pretty much from scratch.
5540
5541         (hard_LC_COLLATE): Now bool, not int.
5542         (get_line, getseq, add_field_list): Now returns bool, not int.
5543         (decode_field_spec, add_field_list): Return true on success (not
5544         false), for consistency with the rest of the code.  All uses changed.
5545
5546         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5547         but is slightly cleaner.
5548         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5549
5550         (empty_filler): Now const *.
5551
5552         (make_blank): Remove; wasn't needed.  Remove all calls.
5553         (main): Don't set uni_blank.nfields; zero is fine.
5554
5555 2003-12-27  Jim Meyering  <jim@meyering.net>
5556
5557         * src/join.c: Include "quote.h".
5558         (min, max): Remove definitions.
5559         Make a few function parameters and corresponding
5560         locals `const'.  Use bool for boolean variables.
5561         Use size_t (not int) for all counters and related index variables.
5562         (prjoin): Remove now-useless assertion.
5563         (string_to_join_field): New function.
5564         (main): Accept join fields as large as SIZE_MAX.
5565         (keycmp): Rename `min' to MIN and max to MAX.
5566
5567 2003-12-26  Jim Meyering  <jim@meyering.net>
5568
5569         fold -s didn't work on e.g., alpha-based systems.
5570         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5571         x2nrealloc works properly on systems with differing sizes for int
5572         and size_t.  Reported by Nelson Beebe.
5573
5574         * src/fold.c: Use `bool' (not int) as the type for a few
5575         global variables.
5576
5577 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5578
5579         * src/ls.c (length_of_file_names_and_frills):
5580         Remove forward decl; not needed.
5581         (print_file_name_and_frills, length_of_file_name_and_frills):
5582         With -m, don't output spaces before inum or size.
5583         (print_with_commas): Don't output space just before newline.
5584
5585 2003-12-24  Jim Meyering  <jim@meyering.net>
5586
5587         * tests/ls/Makefile.am (TESTS): Add m-option.
5588         * tests/ls/m-option: New file.  Test for above fixes.
5589
5590 2003-12-20  Jim Meyering  <jim@meyering.net>
5591
5592         * Version 5.1.0.
5593
5594         * src/pr.c: Change type of global, buff_allocated, to size_t.
5595
5596         * src/join.c [struct seq]: Change types of members count and alloc
5597         from `int' to `size_t'.
5598
5599         * tests/Makefile.am (root-hint): Tweak wording.
5600
5601         * src/du.c: Accept new option (-0, --null) that makes it so each
5602         output line is NUL-terminated rather than newline-terminated.
5603
5604         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5605         Reported by Volker Paul.
5606         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5607         * tests/dd/unblock-sync: New test for the above.
5608
5609 2003-12-19  Jim Meyering  <jim@meyering.net>
5610
5611         * tests/misc/nohup: Double quote back-ticked expression,
5612         in case it ends up having an unexpected value.
5613
5614         * tests/ls/no-arg: Use ls's -1 option in both runs.
5615
5616         * src/du.c (fts_debug): New global.
5617         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5618         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5619         (main) [DU_DEBUG]: Accept -d option.
5620
5621 2003-12-18  Jim Meyering  <jim@meyering.net>
5622
5623         * src/ls.c (format_user): Increment dired_pos via two statements,
5624         `dired_pos += width; dired_pos++;' rather than one,
5625         `dired_pos += width + 1;' since the latter could conceivably overflow.
5626         (format_group): Likewise.
5627         From Paul Eggert.
5628
5629         * configure.ac: Require automake-1.8.
5630
5631 2003-12-12  Jim Meyering  <jim@meyering.net>
5632
5633         * Use automake-1.8.  Regenerate dependent files.
5634
5635 2003-12-08  Jim Meyering  <jim@meyering.net>
5636
5637         * Makefile.maint (news-date-check): New rule.
5638         (alpha beta major): Depend on it.
5639
5640 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5641
5642         * NEWS: ls -l (and similar options) now adjust all columns to
5643         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5644         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5645         (format_user_width, format_group_width, unsigned_file_size,
5646         format_group): New functions.
5647         (block_size_width): Renamed from block_size_size.
5648         (inode_number_width, nlink_width, owner_width, group_width,
5649         author_width, major_device_number_width, minor_device_number_width,
5650         file_size_width): New vars.
5651         (clear_files): Initialize them.
5652         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5653         (print_long_file): Use them.
5654         (gobble_file): Use a new local variable 'f' to make the code
5655         smaller and more consistent with other functions.
5656         (format_user): Output to stdout, not to a buffer, so that we
5657         don't have to worry about buffer overrun.  Update dired_pos.
5658         (print_long_file): Don't put owner, group, author into buffer;
5659         just print them directly.  Don't assume link counts and
5660         major and minor numbers fit into unsigned long int.
5661         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5662         'ls' output is fixed-width.
5663
5664 2003-12-02  Jim Meyering  <jim@meyering.net>
5665
5666         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5667
5668 2003-11-27  Jim Meyering  <jim@meyering.net>
5669
5670         * Use automake-1.7f.  Regenerate dependent files.
5671
5672 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5673
5674         Parse floating-point operands and options in the C locale.
5675         POSIX requires this for printf, and we might as well be
5676         consistent elsewhere (tail, sleep, seq).
5677
5678         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5679         needed now that we assume C89.  Include "c-strtod.h".
5680         (xstrtod): Call c_strtod, not strtod.
5681         * src/sleep.c: Include "c-strtod.h".
5682         (main): Update xstrtod call to include new argument, c_strtod.
5683         * src/seq.c (scan_double_arg): Likewise.
5684         * src/tail.c (parse_options): Likewise.
5685
5686 2003-11-24  Jim Meyering  <jim@meyering.net>
5687
5688         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5689         Reported by Mark Conty.
5690
5691 2003-11-22  Jim Meyering  <jim@meyering.net>
5692
5693         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5694         (sc_system_h_headers): Do this test only if sys2.h exists.
5695
5696 2003-11-20  Jim Meyering  <jim@meyering.net>
5697
5698         * tests/help-version: Ensure that the bug-reporting address is
5699         included in the --help output for every program.
5700         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5701
5702         * src/ptx.c (usage): Output bug-reporting address.
5703         Reported by Dan Jacobson.
5704
5705 2003-11-19  Jim Meyering  <jim@meyering.net>
5706
5707         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5708         on the join fields.  Suggestion from Bruce Robertson.
5709
5710 2003-11-18  Jim Meyering  <jim@meyering.net>
5711
5712         `od -c -w9999999' could segfault
5713         * src/od.c (dump): Use xnmalloc/free, not alloca.
5714
5715 2003-11-16  Jim Meyering  <jim@meyering.net>
5716
5717         * Use autoconf-2.59.  Regenerate dependent files.
5718
5719         * tests/du/hard-link: Minor tweak: use mkdir -p.
5720
5721         Fix read-from-free'd-buffer error detected by valgrind.
5722         * src/csplit.c (remove_line): Don't return a pointer to data in
5723         a freed buffer.  Instead, arrange to free the buffer on the
5724         subsequent call.
5725
5726         * tests/misc/csplit: New test for above fix.
5727
5728 2003-11-11  Jim Meyering  <jim@meyering.net>
5729
5730         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5731         This avoids a warning from valgrind about memcpy with overlapping
5732         source and destination.
5733
5734         * configure.ac: Require automake-1.7.8.
5735
5736 2003-11-09  Jim Meyering  <jim@meyering.net>
5737
5738         * Use automake-1.7.9.  Regenerate dependent files.
5739
5740         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5741         * src/chown.c: Likewise.
5742
5743         * src/chown-core.c: Include "root-dev-ino.h".
5744         (chopt_init): Initialize new member.
5745         (change_file_owner): Support rm's new --preserve-root option.
5746
5747         * src/remove.c: Include "root-dev-ino.h".
5748         (remove_cwd_entries): Remove now-obsolete FIXME comment.
5749         (remove_dir): Support rm's new --preserve-root option.
5750
5751         * src/chown.c: Include "root-dev-ino.h".
5752         Add new options: --preserve-root and --no-preserve-root.
5753
5754         * src/chmod.c: Include "root-dev-ino.h".
5755         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5756         ROOT_DEV_INO_WARN macros.
5757         (get_root_dev_ino): Remove function definition, now that it's
5758         been moved to a separate file.
5759         (usage): Describe new options.
5760
5761         * src/mv.c (rm_option_init): Initialized new member.
5762
5763         * src/remove.h: Include "dev-ino.h".
5764         (struct rm_options): Add new member: root_dev_ino.
5765         * src/chown-core.h: Include "dev-ino.h".
5766         (struct Chown_option): Add new member: root_dev_ino.
5767
5768 2003-11-06  Jim Meyering  <jim@meyering.net>
5769
5770         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5771         hard-coding `sizeof FILE*'.
5772
5773 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
5774
5775         * src/wc.c (main): Free `fstatus' so there is no confusion about
5776         whether it's leaked or not.
5777         * src/who.c (who): Likewise for `utmp_buf'.
5778
5779 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5780
5781         Fix 'cut' problems with size_t overflow and unsigned int.
5782         More generally, resize integer variables to fit use more precisely.
5783         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5784         (struct range_pair): Make members to be of type size_t, not unsigned.
5785         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5786         (suppress_non_delimited, output_delimiter_specified,
5787         have_read_stdin, print_kth, set_fields): Now bool, nt int.
5788         (delim): Now unsigned char, not int.
5789         (mark_printable_field, is_printable_field, is_range_start_index,
5790         set_fields, set_fields, cut_bytes, cut_fields):
5791         Use size_t, not unsigned, for field and byte counts.
5792         (hash_int): Use uintptr_t, not unsigned, for pointers converted
5793         to integers.  This squeezes more info out of them.
5794         (set_fields, cut_bytes, cut_fields, main):
5795         Use bool, not int, for booleans.
5796         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5797
5798 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5799
5800         * man/Makefile.am (check-programs-vs-x):
5801         Work even if $(programs) contains '$'.
5802         Work even if 'missing=1' in environment.
5803         Don't report an error simply because $(programs) outputs nothing.
5804
5805 2003-11-05  Jim Meyering  <jim@meyering.net>
5806
5807         * Use autoconf-2.58.  Regenerate dependent files.
5808
5809         * src/tr.c (spec_init): Fix typo in last change.
5810
5811         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5812         call to variadic version_etc function, so that it works even on systems
5813         for which sizeof char* != sizeof int.
5814         * src/true.c (main): Likewise.
5815         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5816         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5817         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5818         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5819         Similarly, cast NULL to `(char *)' in call to variadic function,
5820         parse_long_options, so that it works even on systems for which
5821         sizeof char* != sizeof int.
5822         A similar problem was reported by Harti Brandt in
5823         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5824
5825         * src/users.c (users): Free `utmp_buf' explicitly so that people
5826         don't mistake this for a real leak.
5827         Patch by Dennis Smit <ds@nerds-incorporated.org.
5828
5829 2003-11-04  Paul Eggert  <eggert@twinsun.com>
5830
5831         * README: Document _POSIX2_VERSION.
5832
5833 2003-11-04  Jim Meyering  <jim@meyering.net>
5834
5835         * src/tac.c (memrchr): Remove #if-0'd function.
5836         (tac_stdin_to_mem): Clean up #if-0'd code.
5837
5838         * src/od.c (decode_format_string): Remove unnecessary casts.
5839         Use more maintainable `sizeof *var'.
5840         (main): Call decode_format_string rather than decode_one_format,
5841         now that `spec' may be NULL.
5842
5843         * src/chmod.c (AUTHORS): Add my name.
5844
5845         * src/split.c (next_file_name): Use `sizeof *var' rather than
5846         hard-coding `sizeof size_t'.
5847
5848         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5849
5850         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5851         to avoid potential overflow in pointer arithmetic.
5852         (set_fields): Use not `1', but rather `sizeof *printable_field' as
5853         second argument to xcalloc.
5854         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5855         rather than xrealloc.
5856         * src/date.c (show_date): Likewise.
5857         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5858         * src/pr.c (store_char): Likewise.
5859         * src/fold.c (fold_file): Likewise.
5860
5861         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5862         type changes (unsigned int -> size_t) in hash.c.
5863         * src/cp-hash.c (src_to_dest_hash): Likewise.
5864         * src/du.c (entry_hash): Likewise.
5865         * src/ls.c (dev_ino_hash): Likewise.
5866         * src/cut.c (hash_int): Likewise.  Declare function as static.
5867
5868 2003-11-03  Jim Meyering  <jim@meyering.net>
5869
5870         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5871         * tests/misc/fold: Fail the test immediately if we're not running
5872         the expected version of fold.
5873
5874 2003-11-02  Jim Meyering  <jim@meyering.net>
5875
5876         * src/tr.c (append_normal_char, append_range, append_char_class)
5877         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5878         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
5879         and usually shorter.
5880         * src/copy.c (copy_internal): Likewise.
5881         * src/join.c (initseq, add_field, make_blank): Likewise.
5882         * src/od.c (main): Likewise.
5883         * src/cp.c (make_path_private): Likewise.
5884         * src/tsort.c (new_item, record_relation): Likewise.
5885
5886         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5887         (main): Also remove anachronistic cast of xmalloc return value.
5888         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5889         (main): Also remove anachronistic cast of xmalloc return value.
5890         * src/sort.c (inittables): Likewise.
5891         (sort): Also Split a long line.
5892
5893 2003-10-25  Jim Meyering  <jim@meyering.net>
5894
5895         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5896         type changes (unsigned int -> size_t) in hash.c.
5897         * src/cp-hash.c (src_to_dest_hash): Likewise.
5898         * src/du.c (entry_hash): Likewise.
5899         * src/ls.c (dev_ino_hash): Likewise.
5900         * src/cut.c (hash_int): Likewise.  Declare function as static.
5901
5902 2003-10-21  Jim Meyering  <jim@meyering.net>
5903
5904         Don't fail when run with VERBOSE=yes.
5905         * tests/chgrp/basic: Do `set +x' before starting the subshell
5906         from which we invoke chgrp.  Otherwise, the output from the
5907         VERBOSE=yes-induced `set -x' would result in spurious differences.
5908         Reported by Russel Coker via Michael Stone.
5909
5910 2003-10-19  Jim Meyering  <jim@meyering.net>
5911
5912         chmod now uses fts to perform a directory traversal when -R is
5913         specified.  Before, it operated on full path names, and as such
5914         would encounter the PATH_MAX (often 4096) limit.
5915
5916         * src/chmod.c: Include "xfts.h".
5917         (process_file): Rename from change_file_mode.
5918         Adapt to be used with fts.
5919         (process_files): New function.
5920
5921 2003-10-18  Jim Meyering  <jim@meyering.net>
5922
5923         * tests/du/deref-args: Ensure that du -D now dereferences all
5924         symlinks specified on the command line, not just those that
5925         reference directories.
5926
5927         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5928         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5929         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5930         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5931         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5932         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5933         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5934         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5935         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
5936         Update the call to parse_long_options so that `AUTHORS, NULL' are the
5937         last parameters.
5938         * src/true.c (main): Append NULL to version_etc argument list.
5939         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5940
5941 2003-10-17  Andreas Schwab  <schwab@suse.de>
5942
5943         * tests/mk-script: Get $srcdir from first parameter instead of
5944         hardcoding it.
5945         (main): Update usage.
5946
5947         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5948         first argument of mk-script.
5949         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
5950
5951 2003-10-17  Jim Meyering  <jim@meyering.net>
5952
5953         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5954         generated `man' page is more readable.  Suggestion from Dan Jacobson.
5955
5956         * src/chown-core.c (change_file_owner): Handle the cases in
5957         which fts_info indicates an error with the given entry.
5958
5959         * src/du.c (main): Simply assign to bit_flags.
5960         Don't bother with bit arithmetic.
5961
5962         * tests/chmod/no-x: New file.
5963         * tests/chgrp/no-x: New file.
5964         * tests/chmod/Makefile.am (TESTS): Add no-x.
5965         * tests/chgrp/Makefile.am (TESTS): Likewise.
5966
5967         * src/du.c: Include "xfts.h".
5968         (du_files): Use xfts_open, rather than fts_open.
5969         * src/chown-core.c (chown_files): Likewise.
5970
5971 2003-10-16  Jim Meyering  <jim@meyering.net>
5972
5973         * src/chgrp.c (main): Simply assign to bit_flags.
5974         Don't bother with bit arithmetic.
5975         * src/chown.c (main): Likewise.
5976         Rename a couple of local variables.
5977         Remove unnecessary casts.
5978
5979         * src/tail.c (start_bytes): Rename local, remainder, to avoid
5980         gcc's warning about shadowing a global.
5981
5982 2003-10-15  Jim Meyering  <jim@meyering.net>
5983
5984         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5985         use fts to perform a directory traversal when -R is specified.
5986         Before, they operated on full path names, and as such would
5987         encounter the PATH_MAX (often 4096) limit.
5988         They are more efficient.  For example, before, chgrp -R would
5989         take almost 5 seconds to change about 2000 directories and fail
5990         (with `File name too long'), while now it succeeds on a hierarchy
5991         of depth 20,000 in 1/10 the time.
5992
5993         * src/chown.c: Include "userspec.h" and "fts_.h".
5994         (WRITTEN_BY): Add my name.
5995         (getpwnam, getgrnam, getgrgid): Remove declarations.
5996         (endpwent): Remove definition.
5997         (usage): Update.
5998         (main): Handle new options.
5999         Call new function, chown_files rather than change_file_owner.
6000
6001         * src/chgrp.c: Include "fts_.h".
6002         (WRITTEN_BY): Add my name.
6003         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
6004         the latter.
6005         (usage): Update.
6006         (main): Handle new options.
6007         Call new function, chown_files rather than change_file_owner.
6008
6009         Rewrite to iterate through hierarchies using fts rather than
6010         via explicit recursion.
6011         * src/chown-core.c: Include "fts_.h"
6012         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
6013         on a single file at a time.
6014         (chown_files): New function.
6015         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
6016         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
6017         [struct Chown_option] (dereference): Remove member with ambiguous name.
6018         [struct Chown_option] (affect_symlink_referent): New member.
6019         (chown_files): New prototype.
6020
6021         * tests/chgrp/recurse: Update tests accordingly.
6022         * tests/chgrp/posix-H: New tests for the above.
6023         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
6024
6025         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
6026         work even for superuser.  Suggestion from Dan Jacobson.
6027
6028 2003-10-14  Paul Eggert  <eggert@twinsun.com>
6029
6030         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
6031         properly diagnosed.
6032         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
6033         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
6034         * src/sort.c (parse_field_count): Handle the case where overflow
6035         and invalid suffix char are both reported.
6036
6037 2003-10-14  Jim Meyering  <jim@meyering.net>
6038
6039         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
6040         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
6041         true on Linux.
6042
6043 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6044
6045         Fix to avoid a denial-of-service attack if the display width is
6046         enormous.  Also, clean up the code a bit by removing duplicate code.
6047
6048         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
6049         (calculate_columns): New function, that contains code that used
6050         to be common to print_many_per_line and print_horizontal.
6051         (print_many_per_line, print_horizontal): Use it.
6052         (decode_switches): Set max_idx here, not in calculate_columns.
6053         (print_current_files): Don't call init_column_info; calculate_columns
6054         now does that.
6055         (init_column_info): Don't allocate a lot more space than is needed
6056         to represent the current set of files.  Allocate all the new
6057         size_t cells in one call to xnmalloc, rather than a row at a time.
6058
6059 2003-10-13  Jim Meyering  <jim@meyering.net>
6060
6061         * src/ls.c (init_column_info): Add another FIXME comment.
6062
6063 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6064
6065         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
6066         Remove several arbitrary limits on hosts where int cannot represent
6067         all size_t values.
6068
6069         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
6070         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
6071         struct column_info.col_arr[0], max_idx):
6072         Now size_t, not int.
6073         (get_funky_string): Return bool indicating success, instead of
6074         a negative count to indicate failure.  Store number of columns
6075         through new parameter OUTPUT_COUNT; that way, they can never
6076         go negative.  Change equals_end from int to bool.  All uses
6077         changed.
6078         (struct column_info.valid_len): Now bool, not int.  All uses changed.
6079         (dired_dump_obstack, get_funky_string, clear_files,
6080         extract_dirs_from_files, print_current_files,
6081         print_many_per_line, print_horizontal, init_column_info,
6082         put_indicator, length_of_file_name_and_frills,
6083         print_with_commas): Use size_t, not int, for local variables
6084         that count sizes.
6085         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6086         Check for TIOCGWINSZ returing negative values (or values greater
6087         than SIZE_MAX!).
6088         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6089         init_column_info):
6090         Use xmalloc and xnmalloc, not XMALLOC.
6091         (gobble_file): Use xnrealloc, not XREALLOC.
6092         (print_color_indicator): Remove now-unnecessary cast to size_t.
6093
6094 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6095
6096         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6097         * tests/sort/sort-tests: Remove from CVS; assume that people
6098         brave enough to check coreutils out from CVS can rebuild it.
6099
6100 2003-10-12  Jim Meyering  <jim@meyering.net>
6101
6102         New options: --preserve-root and --no-preserve-root.
6103         * src/chmod.c (change_file_mode): Honor new option.
6104         (change_file_mode): Strip trailing slashes on directory
6105         argument passed to change_dir_mode.
6106         (get_root_dev_ino): New function.
6107         (main): Initialize global, root_dev_ino.
6108
6109         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6110         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6111         via system.h.
6112         * src/chmod.c (change_file_mode): Likewise.
6113
6114 2003-10-08  Jim Meyering  <jim@meyering.net>
6115
6116         * src/csplit.c (main): Remove obsolete FIXME.
6117
6118 2003-10-07  Jim Meyering  <jim@meyering.net>
6119
6120         * Use automake-1.7.8.  Regenerate dependent files.
6121
6122 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6123
6124         csplit cleanup.
6125
6126         * doc/coreutils.texi (csplit invocation):
6127         The regexp offset need not have a sign; POSIX requires support
6128         for signless offets.
6129
6130         Be more careful about int widths.  For example, remove some
6131         arbitrary limits by replacing 'unsigned' with 'size_t',
6132         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6133         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6134         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6135         to <stdbool.h> usage.
6136         (struct control): offset is now intmax_t, not int.
6137         repeat_forever is now bool, not int.
6138         (struct cstring): len is now size_t, not unsigned int.
6139         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6140         size_t, not unsigned.  start_line, first_available are now
6141         uintmax_t, not unsigned.
6142         (hold_count, control_used): Now size_t, not unsigned.
6143         (last_line_number, current_line, bytes_written):
6144         Now uintmax_t, not unsigned.
6145         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6146         create_new_buffer, get_new_buffer, load_buffer, find_line,
6147         process_regexp, split_file, new_control_record, extract_regexp,
6148         get_format_width, get_format_prec, max_out):
6149         size args, locals, and returned values are now size_t, not unsigned
6150         or int.
6151         (get_first_line_in_buffer, find_line, write_to_file,
6152         handle_line_error, process_line_count, regexp_error, process_regexp,
6153         split_file):
6154         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6155         (check_for_offset): Don't require a sign before the offset.
6156         Use xstrtoimax to do the real work.
6157         (extract_regexp): Remove harmful cast of size to unsigned.
6158         256 -> 1<<CHAR_BIT, for clarity.
6159         (get_format_flags): Return at most 3, to avoid worries about overflow.
6160
6161         (bytes_to_octal_digits): Remove.
6162
6163         (cleanup): Don't check whether output_stream is NULL, since
6164         close_output_file does that for us.
6165
6166         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6167         (sizeof *p);" instead of the more long-winded alternatives.
6168
6169         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6170         to a much larger size, instead of an O(N) algorithm.
6171
6172         (process_regexp): Use plain NULL rather than casted 0.
6173
6174         (make_filename): Use %u, not %d, to format unsigned file number.
6175
6176         (new_control_record): Use xrealloc exclusively, since it handles
6177         NULL reliably.
6178
6179         (extract_regexp): Change misspelled word in diagnostic.
6180
6181         (get_format_width): Even if a minimum field width is specified,
6182         allow room for enough octal digits to represent the value of
6183         the maximum representible integer.  This fixes a potential
6184         buffer overrun.  Calculate this room at compile-time, not
6185         at run-time; this removes the need for bytes_to_octal_digits.
6186         Check for overflow; this removes a FIXME.
6187
6188         (get_format_prec): Don't allow precision to be signed; it's
6189         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6190         default precision; this fixes a potential buffer overrun
6191         on hosts with wider size_t.
6192
6193         (get_format_conv_type): Change local variable to be of type
6194         unsigned char, not int; this removes a potential subscript
6195         violation on hosts where char is signed.
6196
6197         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6198         Allow "%%" in format.  Don't overflow when
6199         counting lots of percents.
6200
6201         (usage): Default sprintf format is %02u, not %d.
6202
6203 2003-10-05  Jim Meyering  <jim@meyering.net>
6204
6205         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6206
6207         * src/du.c (du_files): Mark diagnostic for translation.
6208
6209 2003-10-04  Jim Meyering  <jim@meyering.net>
6210
6211         * src/du.c (du_files): Ignore any failure of fts_close.
6212         Give better diagnostics for failed fts_open.
6213
6214         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6215
6216         Deprecate existing use of -H (aka --si).
6217         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6218         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6219         (main): Warn that the meaning of -H will soon change to be
6220         POSIX compliant.
6221
6222 2003-10-03  Jim Meyering  <jim@meyering.net>
6223
6224         * src/du.c: Accept --no-dereference (-P).
6225
6226 2003-10-02  Jim Meyering  <jim@meyering.net>
6227
6228         * tests/du/trailing-slash: Adjust for slightly different output.
6229
6230         Rewrite du.c to use fts.
6231         * src/du.c: Include "fts_.h", not ftw.h.
6232         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6233         (IS_FTW_DIR_TYPE): Remove definition.
6234         (IS_DIR_TYPE): Define.
6235         (is_symlink_to_dir): Remove now-unnecessary function.
6236         (process_file, du_files): Rewrite to use fts.
6237
6238         * tests/du/inaccessible-cwd: Ensure that even when run from an
6239         inaccessible directory, du can still operate on accessible
6240         directories elsewhere.
6241         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6242
6243         * tests/rm/deep-1: Ensure that du can process a hierarchy
6244         of depth 400 while using no more than 50KB of stack space.
6245
6246 2003-10-01  Akim Demaille  <akim@epita.fr>
6247
6248         * announce-gen (print_news_deltas): New function, extracted from main.
6249         (main): Make `news_file' an array.
6250         Use '...=s' => \@var for --news and --url-directory specs.
6251         Before there were a couple of portability problems.
6252
6253 2003-09-28  Jim Meyering  <jim@meyering.net>
6254
6255         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6256         (syntax-check-rules): Add it.
6257
6258         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6259         guaranteed to be (void *).
6260         * src/cp.c: Likewise.
6261         * src/join.c: Likewise.
6262         * src/ln.c: Likewise.
6263         * src/ls.c: Likewise.
6264         * src/od.c: Likewise.
6265         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6266
6267 2003-09-27  Jim Meyering  <jim@meyering.net>
6268
6269         Don't exhaust virtual memory when processing large inputs.
6270         Fix this by removing csplit's internal free-list management;
6271         instead rely on malloc for that.
6272
6273         * src/csplit.c (free_list): Remove global.
6274         (clear_all_line_control): Remove function.
6275         (get_new_buffer): Always use create_new_buffer to obtain a
6276         new buffer, rather than searching free_list.
6277         (free_buffer): Just call free.
6278         Reported by Nikola Milutinovic.
6279
6280 2003-09-26  Jim Meyering  <jim@meyering.net>
6281
6282         * man/rm.x: Also list `chattr' in SEE ALSO section.
6283         Suggestion from Mark Hubbart.
6284
6285 2003-09-25  Jim Meyering  <jim@meyering.net>
6286
6287         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6288         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6289
6290         * Use autoconf-2.57d.  Regenerate dependent files.
6291
6292 2003-09-24  Jim Meyering  <jim@meyering.net>
6293
6294         Minor efficiency tweak.
6295         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6296         (do_link): Likewise.
6297
6298 2003-09-23  Jim Meyering  <jim@meyering.net>
6299
6300         * src/paste.c (paste_serial): Save errno after input error,
6301         to report proper errno value.
6302         Based on a patch from Paul Eggert.
6303
6304         * src/tee.c (tee): Adjust fwrite arguments so that the return
6305         value is the number of bytes written.
6306
6307 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6308
6309         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6310
6311         * src/comm.c (compare_files): Save errno after input error,
6312         to report proper errno value.
6313         * src/fold.c (fold_file): Likewise.
6314         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6315         * src/unexpand.c (unexpand): Likewise.
6316
6317         * src/csplit.c (close_output_file): Don't report bogus errno value
6318         after ferror discovers an output error.  We don't know the proper
6319         errno value, since it might have been caused by any of a whole
6320         bunch of calls, and it might have been trashed in the meantime.
6321         Fixing this problem will require much more extensive changes;
6322         in the meantime just say "write error".
6323         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6324         * src/uniq.c (check_file): Likewise.
6325
6326         * src/join.c (get_line): Report error right away if I/O fails,
6327         so that the proper errno value is used.
6328         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6329         * src/tee.c (tee): Likewise.
6330         * src/uniq.c (check_file): Likewise.
6331
6332         * src/od.c (skip): If a read fails, don't retry it later, so
6333         that we report the proper errno.
6334
6335         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6336
6337         * src/tee.c (tee): Once a write failure has occurred, don't bother
6338         writing anything more to that stream.
6339
6340         * src/uniq.c (check_file): Check for ferror (stdout) even if
6341         ostream == stdout.
6342
6343         * src/yes.c (UNROLL): Remove.
6344         (main): Exit immediately when write failure is detected.
6345         Simplify code by assigning to argv when argc == 1.
6346
6347 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6348
6349         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6350         (WRITTEN_BY): Change "Franc,ois" (actually using
6351         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6352         xgettext requires.
6353
6354 2003-09-19  Jim Meyering  <jim@meyering.net>
6355
6356         `du -D symlink-to-dir' would mistakenly omit the slash in
6357         lines like this: 24     symlink-to-dir/subdir
6358         * src/du.c (process_file): Fix offset calculation.
6359         Reported by Jeff Sheinberg as Debian bug #211591;
6360         http://bugs.debian.org/205251
6361
6362         * tests/du/deref-args: New file/test for the above.
6363         * tests/du/Makefile.am (TESTS): Add deref-args.
6364
6365         * src/du.c (process_file): Remove useless disjunct.
6366
6367         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6368         to Written_by.
6369         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6370         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6371         Mark each WRITTEN_BY string as translatable.
6372
6373         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6374         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6375         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6376         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6377         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6378         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6379         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6380         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6381         Instead, a subsequent change will embed `Written by ' in
6382         each string along with the author names.
6383
6384         * src/true.c: Revert yesterday's changes.
6385         * src/sys2.h: Likewise.
6386
6387 2003-09-18  Jim Meyering  <jim@meyering.net>
6388
6389         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6390         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6391         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6392         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6393         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6394         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6395         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6396         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6397         comma-separated list of strings and/or update the call to
6398         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6399         * src/true.c (main): Append NULL to version_etc argument list.
6400         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6401
6402         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6403         shadowing the math function name.  Also rename loga to log_a.
6404
6405 2003-09-14  Jim Meyering  <jim@meyering.net>
6406
6407         * src/factor.c (print_factors): Give a separate diagnostic
6408         for numbers that are too large, but otherwise valid.
6409         Reported by Dániel Varga.
6410
6411 2003-09-10  Jim Meyering  <jim@meyering.net>
6412
6413         * Use automake-1.7.7.  Regenerate dependent files.
6414
6415         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6416         of `fmt -1'.  Using the just-built tr is a little cleaner.
6417         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6418         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6419
6420 2003-09-09  Jim Meyering  <jim@meyering.net>
6421
6422         * src/copy.c: Alphabetize includes.
6423         Remove duplicate inclusion of "same.h".
6424
6425 2003-09-08  Jim Meyering  <jim@meyering.net>
6426
6427         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6428         Didn't give enough of a benefit, mainly because it's not yet
6429         in wide enough use.
6430
6431         * Version 5.0.91.
6432
6433         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6434         (check-programs-vs-x): Fail if $(programs) is empty.
6435
6436         * src/remove.c: Add a comment.
6437
6438 2003-09-07  Jim Meyering  <jim@meyering.net>
6439
6440         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6441         Don't define.  These symbols are no longer used.
6442
6443         * tests/misc/tty-eof: Write ^D as \cD.
6444         Complete the change of 2003-08-02.
6445
6446         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6447         file in lib/ or src/ doesn't induce an unwarranted failure.
6448         Add a kludge to filter out the sole generated source file that
6449         also has translatable messages: src/false.c.
6450
6451 2003-09-06  Jim Meyering  <jim@meyering.net>
6452
6453         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6454         (parse_options): Give a diagnostic for (but still accept) the
6455         deprecated --allow-missing option.
6456
6457 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6458
6459         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6460         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6461
6462         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6463         size_bound ourselves. if an input file is a pipe and the user
6464         specified a size, use that size instead of trying to guess the
6465         pipe size.  This has the beneficial side effect of avoiding the
6466         overhead of default_sort_size in that case.  All callers changed.
6467         (sort): Remove static var size; now done by sort_buffer_size.
6468
6469 2003-09-05  Jim Meyering  <jim@meyering.net>
6470
6471         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6472
6473         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6474         to start, rather than just .1.  Upon failure, print unexpected state.
6475
6476 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6477
6478         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6479         SAFE_READ_ERROR to tmp->nbytes.
6480         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6481
6482         * src/head.c (struct linebuffer): Change nbytes and nlines
6483         from unsigned int to size_t.  unsigned int is safe (after the
6484         2003-09-03 patch) but size_t is cleaner.
6485         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6486         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6487
6488         Standardize on BUFSIZ as opposed to other macro names and values.
6489         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6490         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6491         stdio.h has always defined it,
6492         and other code already assumes it's defined.
6493         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6494         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6495         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6496
6497 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6498
6499         * src/seq.c (step): Default to 1.
6500         (print_numbers): Allow the output to be empty.
6501         (main): The default step is 1, even if LAST < FIRST;
6502         as per documentation.
6503         * tests/seq/basic (onearg-2): Output should be empty.
6504
6505 2003-09-05  Jim Meyering  <jim@meyering.net>
6506
6507         * Makefile.cfg (wget_files): Temporarily disable, until master
6508         versions are restored to ftp.gnu.org.
6509
6510         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6511
6512         Make seq's --width (-w) option work properly even when the
6513         endpoint requiring the larger width is negative and smaller than
6514         the other endpoint.
6515         * src/seq.c (get_width_format): Include `-' in the set of bytes
6516         allowed in a `simple' number (no decimal point, no exponent).
6517         Reported by Patrick Mauritz.
6518
6519 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6520
6521         * NEWS: sort -t '\0' now uses a NUL tab.
6522         sort option order no longer matters, unless POSIX requires it.
6523         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6524         Similar fixes for many comments.
6525         (TAB_DEFAULT): New constant, so that we can support NUL as
6526         the field separator.
6527         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6528         (specify_sort_size): If multiple sizes are specified, use the largest.
6529         (begfield, limfield): Support NUL tab char.
6530         (set_ordering): Do not let -i override -d.
6531         (main): Report an error if incompatible -o or -t options are given.
6532         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6533
6534 2003-09-05  Jim Meyering  <jim@meyering.net>
6535
6536         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6537
6538 2003-09-03  Andreas Schwab  <schwab@suse.de>
6539
6540         Bug report and patch here:
6541         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6542         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6543         * src/head.c (elide_tail_lines_pipe): Likewise.
6544
6545 2003-09-03  Jim Meyering  <jim@meyering.net>
6546
6547         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6548         small amount of code from him was first moved to lib/human.c, and was
6549         subsequently rewritten entirely.
6550         * src/df.c (AUTHORS): Likewise.
6551
6552 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6553
6554         * src/md5sum.c (split_3): Accept the BSD format for generic
6555         message digest modes.  Currently works with BSD's MD5 and SHA1
6556         formats since these are the two algorithms presently used in
6557         coreutils.  Updated comments to reflect this change.
6558         (bsd_split_3): Updated comments.
6559
6560         * tests/md5sum/basic-1: New test to make sure that
6561         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6562         from `check-bsd' test in tests/sha1sum/basic-1).
6563
6564         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6565         --check exit status and BSD SHA1 format (adapted from tests
6566         in tests/md5sum/basic-1).
6567
6568 2003-08-30  Jim Meyering  <jim@meyering.net>
6569
6570         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6571
6572         When source and destination arguments refer to the same file, reside
6573         on a partition (e.g. VFAT) on which distinct names may refer to the
6574         same directory entry (often due to variations in case), and when the
6575         link count for the file is 1, mv no longer unlinks the file.  Instead,
6576         it gives the expected diagnostic that the source and destination are
6577         the same.  WARNING: this is an incomplete fix.  If the file happens
6578         to have a link count of 2 or greater, such an erroneous mv command
6579         will still unlink it.
6580         Although that is not possible on vfat or umsdos, it is possible on
6581         other file system types, e.g., ntfs, and hpfs.
6582         * src/copy.c (same_file_ok): Invoke same_name (which might still
6583         return false for names that refer to the same directory entry)
6584         only if the link count is 2 or more.
6585         * tests/mv/vfat: Show how to demonstrate the above problem.
6586         This test is not run.
6587         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6588
6589 2003-08-27  Jim Meyering  <jim@meyering.net>
6590
6591         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6592         who's -l option has been eliciting an unconditional warning about
6593         this impending change since sh-utils-2.0.12 (April 2002).
6594
6595         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6596         This would happen for nonempty files not ending with a newline.
6597         Reported by Dan Jacobson.
6598         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6599         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6600
6601         * src/stat.c (print_it): Avoid buffer overrun that would
6602         occur when the user-specified format string ends with `%'.
6603         Patch by Tommi Kyntola.
6604         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6605         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6606
6607 2003-08-26  Jim Meyering  <jim@meyering.net>
6608
6609         Apply changes from bison.
6610         * GNUmakefile (SHELL): Define to `sh', if necessary.
6611         Add copyright.
6612         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6613         Update all uses of $(WGET).
6614
6615 2003-08-22  Akim Demaille  <akim@epita.fr>
6616
6617         * Makefile.cfg (local-checks-to-skip): New.
6618         * Makefile.maint (local-check): Rename as...
6619         (local-checks-available): this.
6620         (local-check): New.
6621
6622 2003-08-26  Akim Demaille  <akim@epita.fr>
6623
6624         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6625         "<\#" to avoid magic from Gnus when posting parts of this script.
6626
6627 2003-08-25  Jim Meyering  <jim@meyering.net>
6628
6629         * src/stat.c (main): Warn about use of deprecated `-l' option.
6630
6631 2003-08-22  Jim Meyering  <jim@meyering.net>
6632
6633         * src/stat.c (do_stat): For link count at end of line, use %h format,
6634         instead of %-5h.  The latter would make stat emit trailing spaces.
6635         Reported by Dan Jacobson.
6636
6637 2003-08-20  Jim Meyering  <jim@meyering.net>
6638
6639         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6640
6641 2003-08-19  Jim Meyering  <jim@meyering.net>
6642
6643         * src/system.h: Include stdlib.h unconditionally,
6644         as we're now assuming that part of hosted C89.
6645
6646 2003-08-18  Jim Meyering  <jim@meyering.net>
6647
6648         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6649         to avoid warnings from gcc.
6650
6651 2003-08-17  Jim Meyering  <jim@meyering.net>
6652
6653         Avoid unnecessary and sometimes time-consuming hostname lookups.
6654         * src/who.c (print_user): Use strchr, not strrchr.
6655         * src/pinky.c (print_entry): Likewise.
6656         Patch by Michael Stone.
6657         This fixes a typo I introduced in who-users.c on 1996-02-23.
6658
6659         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6660         disallowed between `@...@'.
6661
6662 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6663
6664         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6665         done by gnulib .m4 files.
6666         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6667         * src/sys2.h (strtoull): Remove unused declaration.
6668
6669 2003-08-16  Jim Meyering  <jim@meyering.net>
6670
6671         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6672         are read-only.
6673
6674         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6675         race condition bug.  The bug would be triggered when tailing a file
6676         with file pointer not at beginning of file, and where the file was
6677         truncated to have a length of less than the initial offset at just
6678         the right moment (between the two lseek calls in this function).
6679
6680         An invalid initial value for *read_pos would result in
6681         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6682         busy-wait rather than sleeping between iterations.  The bug manifests
6683         itself only when tailing regular files that are initially nonempty.
6684         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6685         each xlseek call.
6686         (tail_lines): Likewise, after lseek calls.
6687         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6688         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6689         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6690
6691 2003-08-15  Jim Meyering  <jim@meyering.net>
6692
6693         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6694         (sc_sun_os_names): Likewise.
6695         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6696
6697         * man/help2man: Remove some SPACEs before TAB.
6698
6699 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6700
6701         * Makefile.maint (LC_ALL): Set to C.
6702         * man/Makefile.am (ASSORT): New var.
6703         (check-x-vs-1, programs): Use it.
6704         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6705         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6706
6707 2003-08-11  Jim Meyering  <jim@meyering.net>
6708
6709         fold -s -wN would infloop for N < 8 with TABs in the input.
6710         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6711         * src/fold.c (fold_file): Move contents of `else'-block
6712         out of conditional so it's used also for --spaces (-s).
6713         * tests/misc/fold: Test for the above fix.
6714         * tests/misc/Makefile.am (TESTS): Add fold.
6715
6716 2003-08-10  Jim Meyering  <jim@meyering.net>
6717
6718         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6719         system.h so the types from time.h and sys/time.h are available.
6720         It appears that this is necessary for OpenBSD, NetBSD, and
6721         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
6722
6723 2003-08-06  Paul Eggert  <eggert@twinsun.com>
6724
6725         * NEWS: Add support for setting file timestamps to microsecond
6726         resolution, on hosts that support this.
6727         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6728         * src/copy.c (copy_internal):
6729         Set file timestamps with utimens, not utime.
6730         * src/cp.c (re_protect): Likewise.
6731         * src/install.c (change_timestamps): Likewise.
6732         * src/touch.c (newtime, touch, main): Likewise.
6733
6734 2003-08-09  Jim Meyering  <jim@meyering.net>
6735
6736         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6737         from Paul Eggert.
6738         (syntax-check-rules): Add it.
6739
6740         * src/tail.c (main): Tweak Solaris OS version number in comment.
6741         * src/wc.c (wc): Likewise
6742         * tests/tail-2/fflush: Likewise.
6743
6744         * src/tail.c: Add new undocumented option, --presume-input-pipe.
6745         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6746
6747 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6748
6749         Use new gnulib 'extensions' module.
6750         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6751         AC_GNU_SOURCE.
6752
6753 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6754
6755         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6756
6757 2003-08-09  Jim Meyering  <jim@meyering.net>
6758
6759         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6760         For tests of obsolete behavior, don't presume that unsetting
6761         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6762
6763 2003-08-07  Paul Eggert  <eggert@twinsun.com>
6764
6765         * doc/coreutils.texi (split invocation):
6766         Add -d or --numeric-suffixes option to 'split'.
6767         From a suggestion by Jesse Kornblum.
6768         * src/split.c (suffix_alphabet): New var.
6769         (longopts, usage, next_file_name, main): Support -d.
6770         (next_file_name, main): Allow -a0, as POSIX requires.
6771         (next_file_name): Don't assume ASCII-like encoding;
6772         'a' through 'z' are not contiguous in EBCDIC.
6773
6774 2003-08-05  Paul Eggert  <eggert@twinsun.com>
6775
6776         Merge getline from gnulib.
6777         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6778         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6779         New files, from gnulib.
6780         * lib/getdelim2.c, lib/getdelim2.h: Remove.
6781         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6782         getdelim2.h to getndelim2.c and getndelim2.h.
6783         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6784         checking for getdelim.
6785         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6786         than rolling our own.
6787         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6788         (cut_fields): Invoke getndelim2 rather than getdelim2.
6789
6790 2003-08-04  Jim Meyering  <jim@meyering.net>
6791
6792         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6793         and for the indices to iterate through nsigs.
6794
6795 2003-08-02  Paul Eggert  <eggert@twinsun.com>
6796
6797         * src/sort.c: Minor code cleanups, mostly to use more accurate
6798         types and to remove unnecessary casts.
6799         (min, max): Remove.  All uses changed to MIN and MAX.
6800         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6801         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6802         keyfield.numeric, struct keyfield.general_numeric, struct
6803         keyfield.month, struct keyfield.reverse, reverse, unique,
6804         have_read_stdin): Now bool, not int.  All uses changed.
6805         (eolchar): Now char, not int.
6806         (struct keyfield.ignore): Now bool const *, not int *.
6807         (struct keyfield.translate): Now char const *, not char *.
6808         (struct month.name): Likewise.
6809         (blanks, nonprinting, nondictionary): Now bool[], not int[].
6810         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6811         check, sort, main): Use const * pointers when possible.
6812         (month_cmp): Rewrite to avoid casts.
6813         (inittables): Initialize tables unconditionally, to avoid branches.
6814         (fillbuf): Return bool, not int.  All uses changed.
6815         (fillbuf, keycompare, new_key, main):
6816         Use SIZE_MAX rather than (size_t) -1.
6817         (trailing_blanks): Renamed from trim_trailing_blanks.
6818         Return the number of blanks to trim.  All uses changed.
6819         (getmonth): Use trailing_blanks rather than open code.
6820         (keycompare): Do not cast char * to unsigned char *; not needed.
6821         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6822         ourselves.
6823         (compare, main): Use | rather than || to avoid jumps.
6824         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6825         be nonzero there.
6826         (check, first_same_file, sort, main):
6827         Use bool instead of int local vars when possible.
6828         (check): Merge the old 'checkfp' and 'check' into a single function,
6829         that returns a boolean (true if the file was ordered).
6830         All uses changed.
6831         (main): Use int instead of unsigned for iterating through nsigs.
6832         Rename local var "posix_pedantic" to "posixly_correct".
6833
6834 2003-08-02  Jim Meyering  <jim@meyering.net>
6835
6836         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6837         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6838
6839         * src/cut.c (cut_fields): Don't read again after encountering an
6840         initial EOF.  E.g., `cut -f2' would do so.
6841         * tests/misc/tty-eof: Add a test for the above fix.
6842
6843         * src/sort.c (sortlines): Add description and references.
6844         From Paul Eggert.
6845
6846         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6847         the tests in help-version will use the just-built binaries.
6848         Reported by Christian Krackowizer.
6849
6850 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6851
6852         * NEWS: Add --rfc-2822 option to GNU date.
6853         * doc/coreutils.texi (Time directives, Options for date, Examples
6854         of date): Likewise.
6855         * src/date.c (long_options, usage, main): Likewise.
6856         * doc/getdate.texi (General date syntax): Likewise.
6857         * doc/coreutils.texi (Options for date): Fix a typo in format:
6858         it's now %d not %_d.  Add URLs.
6859
6860 2003-08-01  Jim Meyering  <jim@meyering.net>
6861
6862         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6863         Otherwise, with at least the /bin/sh from HPUX 10.20,
6864         the trap code would end up converting that to exit 1 and thus an
6865         unexpected test failure.  Reported by Christian Krackowizer.
6866
6867 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6868
6869         * src/ptx.c: Do not include bumpalloc.h.
6870         (WORD_TABLE): New member alloc.
6871         (ALLOC_NEW_WORD): Remove.
6872         (occurs_alloc): New var.
6873         (digest_word_file, find_occurs_in_text): Check for arithmetic
6874         overflow when computing table size.  Use xrealloc rather than
6875         bumpalloc primitives.
6876
6877 2003-07-29  Jim Meyering  <jim@meyering.net>
6878
6879         * Version 5.0.90.
6880
6881         * README: When running tests as root, suggest using
6882         sudo with NON_ROOT_USERNAME=$USER.
6883
6884         * tests/Makefile.am (all_programs): Makefile is in ../src, not
6885         $(srcdir)/../src.
6886
6887 2003-07-28  Jim Meyering  <jim@meyering.net>
6888
6889         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6890
6891 2003-07-28  Paul Eggert  <eggert@twinsun.com>
6892
6893         * lib/stdbool.hin (_Bool): Make it signed char, instead of
6894         an enum type, so that it's guaranteed to promote to int.
6895         * src/sort.c (sortlines_temp): Undo previous change.
6896
6897 2003-07-28  Jim Meyering  <jim@meyering.net>
6898
6899         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6900         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6901         would cause lines[-1 - swap] (with swap = false) to evaluate to
6902         lines[4294967295].
6903
6904 2003-07-27  Jim Meyering  <jim@meyering.net>
6905
6906         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6907         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6908
6909         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6910         directories, as required by POSIX.   Reported by Karl Berry.
6911         * tests/rm/dir-no-w: New file.  Test for the above fix.
6912         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6913
6914         * tests/mk-script: Emit `$xx', not its expansion.
6915
6916 2003-07-27  Paul Eggert  <eggert@twinsun.com>
6917
6918         This change was inspired by a similar proposal by Stepan Kasal.
6919         * src/sort.c (mergelines, sortlines_temp): New functions.
6920         (sortlines): Use them, to reduce the number of times that
6921         we need to copy 'struct line' values.  This improved CPU
6922         performance by about 30% on one 18 MB test.
6923         (sort): Don't invoke sortlines unless we have 2 or more lines.
6924
6925 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
6926
6927         * src/sort.c (sort): Don't require two `struct line's per text line,
6928         the new sort algorithm requires just 1.5.
6929
6930 2003-07-27  Jim Meyering  <jim@meyering.net>
6931
6932         * src/pathchk.c (validate_path): Use %lu, not %ld.
6933         From Paul Eggert.
6934         * src/cut.c (is_printable_field): Simplify bit arithmetic.
6935         From Paul Eggert.
6936         * src/ls.c (sort_files): Put `volatile' in the right place.
6937         From Paul Eggert.
6938
6939 2003-07-26  Jim Meyering  <jim@meyering.net>
6940
6941         Use only one bit per field/offset in array, not one `int'.
6942         * src/cut.c (printable_field): Change type to `unsigned char'.
6943         (mark_printable_field, is_printable_field): New functions.
6944         Use them in place of all direct accesses of `printable_field'.
6945
6946         * src/expand.c (parse_tabstops): Detect overflow properly.
6947         * src/cut.c (set_fields): Likewise.
6948
6949         * src/rm.c: Include "dirname.h".
6950         (usage): Use base_name (program_name) in body of --help output.
6951         This lets me...
6952         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6953         Idea from Brendan O'Dea, who suggested using
6954         `program_name = basename (argv[0]);' everywhere --
6955         can't do that, but using base_name works just fine here.
6956
6957         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6958
6959 2003-07-24  Paul Eggert  <eggert@twinsun.com>
6960
6961         Fix some POSIX-compliance problems with 'test'.  This makes
6962         'test' more compatible with Bash.
6963
6964         * NEWS, doc/coreutils.texi: Document the following.
6965         * src/test.c: Include exitfail.h.
6966         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6967         (test-syntax_error): Use it.
6968         (binary_operator): Now takes bool arg specifying whether left operand
6969         is -l ARG, so that caller determines this rather than us.
6970         All uses changed.
6971         (term): Use posixtest to evaluate parenthesized subexpressions.
6972         (unary_operator, one_argument): Remove support for -t without operand.
6973         (one_argument): Take argument from argv[pos].
6974         (one_argument, two_arguments, three_arguments): Advance pos.
6975         All callers changed.
6976         (three_arguments): Look for binary ops before "!".  Then look
6977         for parenthesized one_argument expressions, instead of trusting
6978         expr () to do the right thing.
6979         (posixtest): Now takes number of args.  All callers changed.
6980         Treat "( A B )" like "A B".
6981         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
6982         POSIXLY_CORRECT, as we now conform to POSIX by default.
6983         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6984         * tests/test/Test.pm (test_vector): Add several tests to check
6985         the above.  Syntax errors now exit with status 2, not 1.
6986         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6987
6988 2003-07-26  Jim Meyering  <jim@meyering.net>
6989
6990         * tests/help-version: Adjust for above change in test behavior:
6991         `[' exits with 2, not 1, and test doesn't accept --help or --version.
6992
6993         * Makefile.maint (ME): Don't use trick suggested in Make manual.
6994         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
6995
6996         * Makefile.maint (sc_system_h_headers): Another syntax check.
6997         (syntax-check-rules): Add it to the list.
6998
6999         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
7000         so it matches `%ld' format even on 32-bit systems.
7001
7002         * src/fmt.c (flush_paragraph): Cast field width to `int' to
7003         avoid warning on 64-bit systems.
7004
7005         * src/ls.c (sort_files): Make `func' volatile, so it can't be
7006         clobbered by a `longjmp' into this function.
7007
7008 2003-07-25  Jim Meyering  <jim@meyering.net>
7009
7010         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
7011         value.
7012
7013         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
7014         because it'd evoke spurious failure on 64-bit systems.
7015
7016 2003-07-24  Jim Meyering  <jim@meyering.net>
7017
7018         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
7019         output its current record counts.  Reported by Jurriaan.
7020
7021         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
7022         `wc' with no options.  This goes along with the change of 2003-07-20.
7023
7024 2003-07-23  Jim Meyering  <jim@meyering.net>
7025
7026         Don't include headers already included by system.h:
7027         * src/tr.c: Don't include errno.h.
7028         * src/true.c: Don't include version-etc.h.
7029         * src/test.c: Don't include limits.h or error.h.
7030         * src/stat.c: Don't include unistd.h or time.h.
7031         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
7032         * src/pr.c: Don't include time.h.
7033         * src/pathchk.c: Don't include errno.h.
7034         * src/nice.c: Don't include sys/time.h.
7035         * src/ls.c: Don't include stdlib.h.
7036
7037         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
7038         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
7039         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
7040         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
7041         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
7042         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
7043         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
7044         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
7045         Don't include closeout.h.
7046
7047         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
7048         can access the required version of rm.
7049         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
7050
7051         * tests/cut/Test.pm (out-delim3a): New test.
7052
7053         * man/help2man: Update to version 1.33.
7054
7055         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
7056
7057         * src/dircolors.c: Include xstrndup.h.
7058         (xstrndup): Remove function, now that it's been factored out into
7059         it's own file.
7060
7061 2003-07-22  Paul Eggert  <eggert@twinsun.com>
7062
7063         * src/wc.c (wc): Fix typo in computation of file from file_x,
7064         which caused the former to be used uninitialized if file_x was
7065         nonzero.
7066
7067 2003-07-22  Jim Meyering  <jim@meyering.net>
7068
7069         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
7070
7071         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
7072         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
7073         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
7074
7075         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7076
7077         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
7078
7079         * src/cut.c (set_fields): Mark all selected indices before trying to
7080         determine range endpoints.
7081         * tests/cut/Test.pm: New test for the above fix.
7082
7083         Begin to address this comment: What if someone wants to
7084         extract the 1,000,000-th field of some huge input file?
7085         The first step is to rearrange things so that the values
7086         in the printable_field array are all 0/1 rather than 0/1/2.
7087         * src/cut.c (RANGE_START_SENTINEL): Remove.
7088         Store range-start indices in a hash table, rather than
7089         overloading the `printable_field' array.
7090         (range_start_ht): New global.
7091         (hash_int, hash_compare_ints, is_range_start_index): New functions.
7092         (print_kth): Use is_range_start_index; don't test printable_field.
7093         (set_fields): Detect overflow.
7094         (set_fields): Insert each range-start index into range_start_ht.
7095         (main): Call set_fields only once, and only after
7096         output_delimiter_specified and (if required) range_start_ht have
7097         been defined.
7098
7099 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7100
7101         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7102         invoked with a null pointer when there were no file arguments.
7103
7104 2003-07-20  Jim Meyering  <jim@meyering.net>
7105
7106         * Makefile.maint (sc_changelog): Add another nit-picky check.
7107
7108         * src/wc.c (write_counts): Add a comment.
7109         (wc): Rename `file' parameter.
7110         Set new local, `file', to be the file name, or (when it's NULL)
7111         _("standard output") so that all uses of `file' use the proper value.
7112         Use STREQ, not strcmp.
7113
7114 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7115
7116         wc count field widths now are heuristically adjusted depending
7117         on the input size, if known.  If only one count is printed, it
7118         is guaranteed to be printed without leading spaces.
7119
7120         Previously, wc did not align the count fields if
7121         POSIXLY_CORRECT was set, but POSIX did not actually require
7122         this undesirable behavior, so it has been removed.
7123
7124         * NEWS: Document this.
7125         * doc/coreutils.texi (wc invocation): Likewise.
7126
7127         * src/wc.c (number_width): New var.
7128         (posixly_correct): Remove.
7129         (struct fstatus): New struct.
7130         (write_counts): Output fields of width number_width.
7131         Do not worry about POSIXLY_CORRECT.
7132         Use null file, not empty-string file, to denote stdin,
7133         since "" is a valid file name on some hosts.
7134         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7135         if possible.
7136         (wc):  Avoid problems if end_pos - current_pos overflows.
7137         Do not print odd message if stdin has a read error.
7138         (get_input_fstatus, compute_number_width): New functions.
7139         (main): Use them to implement the new behavior.
7140         Ignore POSIXLY_CORRECT.
7141
7142         * tests/wc/Test.pm: Adjust to the new output widths.
7143
7144 2003-07-19  Jim Meyering  <jim@meyering.net>
7145
7146         * tests/rm/fail-eperm: Don't create temporary directory --
7147         we don't use it.
7148
7149         * tests/shred/remove: Don't open-code test for UID != 0.
7150         Use priv-check's require-non-root instead.
7151         Update to use newer framework.
7152
7153         * tests/help-version (expected_failure_status_expr): Record that
7154         expr exits with status of 3 for e.g., a write error.
7155
7156         * tests/priv-check: Use `id -u' to see if we're running as root,
7157         rather than trying go write to an write-protected file.
7158         When running as root, ensure $NON_ROOT_USERNAME is valid.
7159         When running as root with `require-non-root', ensure that `.'
7160         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7161         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7162
7163         * src/printenv.c: Include "exitfail.h".
7164         (main): Set exit_failure rather than calling close_stdout_set_status.
7165         * src/date.c: Likewise.
7166         * src/sort.c: Likewise.
7167         * src/tty.c: Likewise.
7168
7169 2003-07-18  Jim Meyering  <jim@meyering.net>
7170
7171         * tests/touch/not-owner: Update to use newer framework.
7172
7173         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7174         directory, and remove Perl-coded `you may not run as root' test.
7175         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7176         hard-coding something not quite equivalent.
7177         Paul Jarc reported the inconsistent diagnostics.
7178
7179         * src/sort.c (main): Use close_stdout via atexit.
7180         Now `sort --version' and `sort --help' fail, as they should
7181         when their output is redirected to /dev/full.
7182
7183         * src/su.c (usage): Don't call close_stdout here.
7184         (main): Use close_stdout via atexit.
7185         Now `su --version > /dev/full' fails, as it should.
7186         Somehow, the change of 2000-05-07 that purports to fix this
7187         was not checked in.
7188
7189         * tests/help-version (--help/--version vs. /dev/full): Special-case
7190         `[' to protect it from expected_failure_status-`eval'.
7191
7192         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7193         count and the corresponding line, as required by POSIX.
7194         Reported by Clement Wang.
7195         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7196
7197         * tests/expr/basic: Add tests for when exit status is 2.
7198
7199         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7200         Use an anonymous `enum', rather than #define.
7201
7202 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7203
7204         * src/expr.c: Include "exitfail.h", "quotearg.h".
7205         (EXPR_INVALID, EXPR_ERROR): New constants.
7206         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7207         (syntax_error): New function, exiting with status 2.  Use it
7208         insteading of printing "syntax error" ourselves.
7209         (main): Initialize exit_failure to EXPR_ERROR.
7210         Exit with EXPR_INVALID on syntax error (too few arguments).
7211         (nextarg): Use strcmp, not strcoll; strcoll might return
7212         an undesirable 0, or might fail.
7213         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7214         or other such error.
7215         (eval2): Report an error if strcoll fails in a string comparison.
7216         * src/sort.c: Include "exitfail.h".
7217         (main): Set exit_failure, not xalloc_exit_failure and
7218         xmemcoll_exit_failure.
7219         * tests/expr/basic: Invalid value exits with status 3, not 2.
7220
7221 2003-07-16  Jim Meyering  <jim@meyering.net>
7222
7223         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7224         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7225
7226         This script would have caught at least two recent bugs:
7227         those in [ and kill.
7228         * tests/help-version: Revive this script.
7229         It wasn't doing anything useful, since $all_programs wasn't being
7230         defined by the invoking Makefile.am.
7231         Reflect that nohup is no longer a script, so don't exclude it.
7232         Add framework to handle the programs added since it was last run:
7233         kill, stat, unlink, [, link, readlink.
7234         Fix path-related problems deriving from the move of this script
7235         from src/ to its present location.
7236         * tests/Makefile.am (all_programs): Define.
7237         (TESTS_ENVIRONMENT): Use it.
7238
7239         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7240         whereby kill would always attempt to operate on argv[0] and fail.
7241
7242         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7243         it also matches the one from bash's builtin test.
7244         (binary_operator): Add \n at end of diagnostic.
7245
7246         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7247         * tests/priv-check: Move setuidgid-related and
7248         NON_ROOT_USERNAME-checking code to this file.
7249
7250         * README: Update section on testing as `root'.
7251         Suggestion from Paul Jarc.
7252
7253         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7254         names of authors that I just found in bash's builtins/test.def.
7255
7256         Running `[' with no arguments would evoke a segfault.
7257         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7258         precede potential use via test_syntax_error.
7259
7260         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7261         warning from automake -Wall.
7262
7263 2003-07-15  Jim Meyering  <jim@meyering.net>
7264
7265         * Version 5.0.1.
7266
7267         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7268         prompt us about it.
7269
7270         * announce-gen (print_changelog_deltas): Relax tests for matching
7271         version-number line in NEWS.
7272         Change the .sig suffix to .asc here, too.
7273
7274 2003-07-14  Jim Meyering  <jim@meyering.net>
7275
7276         * Makefile.maint (%.asc): Renamed from %.sig.
7277         Generate and use ascii-armored signatures.
7278         Use gpg's -o option.
7279
7280 2003-07-13  Jim Meyering  <jim@meyering.net>
7281
7282         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7283         (main): Use them.
7284
7285         * Makefile.maint (syntax-check): Move each individual check into
7286         its own target.
7287         (syntax-check-rules): This is the list of syntax-check targets.
7288         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7289         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7290         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7291
7292 2003-07-12  Jim Meyering  <jim@meyering.net>
7293
7294         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7295         traces of the nohup script.
7296
7297         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7298         $(OPTIONAL_BIN_ZCRIPTS).
7299
7300         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7301         target, not before the `>'.
7302
7303         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7304         now that that function no longer calls `error'.
7305
7306         * src/df.c (find_mount_point): Emit a diagnostic for each
7307         failed syscall, rather than relying on caller to do that.
7308         The caller couldn't do a good job, anyhow -- too many different
7309         ways to fail (each with a different referent).
7310         Give a diagnostic upon failed save_cwd, now that that function
7311         no longer calls `error'.
7312         (show_point): Don't diagnose find_mount_point's errors, now that
7313         it handles them itself.
7314
7315         * src/df.c (find_mount_point): Don't let free clobber errno upon
7316         failed chdir.
7317
7318         * src/sys2.h: Remove alloca-related block.
7319         * src/system.h: Include <alloca.h> here, instead.
7320
7321         It appears that the `#pragma alloca' included via "system.h" is
7322         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7323         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7324         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7325
7326         * src/chown-core.c (change_file_owner): Do not restore any special
7327         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7328         by chown(2) on some systems.  Suggestion and insistence :-) from
7329         Michael Stone.
7330
7331         * tests/input-tty: Also check `test -t 1'.
7332         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7333         test would block when run in the background.
7334
7335 2003-07-11  Jim Meyering  <jim@meyering.net>
7336
7337         * tests/sample-test: Also fail if cat-to-create-expected-output
7338         fails.  Otherwise, if both `exp' and `out' were to end up empty
7339         because of e.g., a full disk, they would mistakenly compare equal.
7340
7341         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7342         This solves a portability problem: on at least Solaris systems,
7343         when nohup.sh used the vendor /bin/sh, it would exit with status
7344         of `1' rather than the required 126 or 127 upon failure to exec
7345         the specified program.
7346
7347         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7348         (bin_PROGRAMS): Add nohup.
7349         (EXTRA_DIST): Remove nohup.sh.
7350         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7351         * src/nohup.sh: Remove file.
7352         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7353
7354         * tests/misc/nohup: Tests for the above.
7355         * tests/misc/Makefile.am (TESTS): Add nohup.
7356
7357         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7358         the macro, COPY_FD_DIAGNOSE.
7359         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7360         (head_file): Likewise.
7361
7362         * src/date.c: Include "quote.h".
7363         (batch_convert): Use the quote function rather than using literal `...'
7364         in a diagnostic.
7365
7366         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7367         * src/fmt.c (main): Likewise.
7368         * src/mknod.c (main): Likewise.
7369         * src/tac.c (tac_seekable): Likewise.
7370         * src/yes.c (main): Likewise.
7371         * src/od.c (main): Likewise.
7372         * src/install.c (change_attributes): Likewise.
7373
7374 2003-07-10  Jim Meyering  <jim@meyering.net>
7375
7376         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7377         * src/tail.c (usage): Likewise.
7378
7379         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7380         place of the kludge in this test.  Suggestion from Paul Jarc.
7381
7382         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7383         * src/setuidgid.c: New program, solely for testing (not installed).
7384
7385         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7386         when dereferencing symlinks.
7387
7388 2003-07-09  Jim Meyering  <jim@meyering.net>
7389
7390         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7391         * tests/du/Makefile.am (TESTS): Add slash
7392
7393         * src/tail.c (xlseek): Avoid warning about ``return without value
7394         from function returning non-void''.
7395
7396 2003-07-08  Jim Meyering  <jim@meyering.net>
7397
7398         * man/help2man: Update to version 1.29.
7399
7400         * man/help2man: Add END handler to close STDOUT and check for errors.
7401
7402 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7403
7404         Add support for a "[" that conforms to the GNU coding standards,
7405         i.e., that does not depend on its name.
7406         * src/lbracket.c: New file.
7407         * README: Add "[".
7408         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7409         a separate man page.
7410         * src/Makefile.am (bin_PROGRAMS): Add "[".
7411         (__SOURCES): New var.
7412         * src/test.c (LBRACKET): Define to 0 if not defined.
7413         (main): Use LBRACKET rather than argv[0].
7414
7415         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7416         Reported by Paul Jarc and Dan Jacobson.
7417
7418         * src/test.c (main): Do not recognize --help or --version if
7419         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7420         Do not bother testing that margv[margc] is non-null.
7421
7422 2003-07-04  Jim Meyering  <jim@meyering.net>
7423
7424         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7425         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7426
7427         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7428         option, and perform the +1600 invocations of head IFF the envvar
7429         RUN_EXPENSIVE_TESTS is set.
7430
7431 2003-07-03  Jim Meyering  <jim@meyering.net>
7432
7433         * src/cp.c (do_copy): Give a better diagnostic when failing due
7434         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7435         See http://bugs.debian.org/199730 for details.
7436
7437 2003-06-27  Jim Meyering  <jim@meyering.net>
7438
7439         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7440         * src/split.c (longopts): Use `1', not `0' as the value for
7441         for &verbose.  Reported by Keith Thompson.
7442
7443         Test for the above fix.
7444         * tests/misc/split-a: Also use --verbose and compare stderr
7445         output with what we'd expect.
7446
7447 2003-06-20  Jim Meyering  <jim@meyering.net>
7448
7449         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7450         Use `error_t' (rather than int) as type for local `err'.
7451         From Alfred M. Szmidt.
7452
7453 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7454
7455         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7456         Fix author preservation code.
7457
7458 2003-06-19  Jim Meyering  <jim@meyering.net>
7459
7460         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7461         (do_link): Don't warn about hard link to symlink.
7462
7463 2003-06-18  Jim Meyering  <jim@meyering.net>
7464
7465         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7466         Reflect renaming: getstr -> getdelim2.
7467
7468         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7469         readline -> readlinebuffer.
7470
7471 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7472
7473         * src/readlink.c: Include <sys/types.h> before system.h (because
7474         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7475
7476 2003-06-17  Jim Meyering  <jim@meyering.net>
7477
7478         * src/system.h (initialize_main): Define.
7479         Use it in every `main'.  Applied via this:
7480         p='initialize_main (&argc, &argv);'
7481         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7482           $(grep -l program_name.=.argv.0 *.c)
7483         test.c uses margc/margv, so I made the change manually for that file.
7484         Based on a patch from Bernard Giroud.
7485
7486 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7487
7488         Fix for build failure on Ultrix 4.3.
7489         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7490         Include sys/param.h and sys/mount.h on ultrix.
7491
7492 2003-06-16  Jim Meyering  <jim@meyering.net>
7493
7494         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7495         definitions.
7496         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7497         them here instead, but with one change: define EISDIR to -1, not 0.
7498
7499         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7500         guaranteed to be defined.
7501         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7502
7503         * README: Mention the CVS repository.
7504         Encourage addition of test cases.
7505
7506 2003-06-12  Jim Meyering  <jim@meyering.net>
7507
7508         * src/touch.c (touch): Call close only if necessary.
7509         From Bruno Haible.
7510
7511         * src/wc.c (usage): Correct wording: wc prints counts in the order
7512         `newline, word, byte'.  Reported by Keith M. Briggs.
7513         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7514
7515 2003-06-10  Jim Meyering  <jim@meyering.net>
7516
7517         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7518
7519 2003-06-07  Jim Meyering  <jim@meyering.net>
7520
7521         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7522         rule.
7523
7524 2003-06-06  Jim Meyering  <jim@meyering.net>
7525
7526         * src/extract-magic (main): Avoid newer 3-arg form of open,
7527         so this script works also with e.g., perl5.005_03.
7528         Patch by John David Anglin.
7529
7530 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7531
7532         * src/system.h: Include <stdbool.h> unconditionally.
7533
7534 2003-06-04  Jim Meyering  <jim@meyering.net>
7535
7536         * man/Makefile.am (check-programs-vs-x): Rename target
7537         from check-programs-vs-1.  Adjust rule to check for the
7538         primary (.x) file, not the generated one (.1).
7539
7540 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7541
7542         * man/kill.x: New file.
7543         * man/Makefile.am (dist_man_MANS): Add kill.1.
7544         (kill.1): New rule.
7545
7546 2003-06-04  Jim Meyering  <jim@meyering.net>
7547
7548         Ensure that the .x file for a new program is never forgotten again.
7549         * man/Makefile.am (programs): Define.
7550         (check-programs-vs-1): New phony target.
7551         (check-local): Depend on it.
7552
7553 2003-06-03  Jim Meyering  <jim@meyering.net>
7554
7555         Avoid unnecessary copying of environment.
7556         * src/env.c (main): Rather than clearing the environment and --
7557         unless told to ignore environment -- copying all settings from
7558         the saved, original environment, clear the environment only when
7559         that is requested.  Suggested by Jens Elkner.
7560
7561 2003-06-02  Jim Meyering  <jim@meyering.net>
7562
7563         * src/system.h: Always include <string.h>, since we assume C89.
7564         Include <limits.h> without checking for HAVE_LIMITS_H.
7565
7566         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7567         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7568
7569 2003-06-01  Jim Meyering  <jim@meyering.net>
7570
7571         Avoid a race condition in `tail -f' described by Ken Raeburn in
7572         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7573         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7574         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7575         (tail_bytes, tail_lines, tail): Likewise.
7576         (tail_file): Use the new `read_pos' value as the size,
7577         rather than stats.st_size from the fstat call.
7578
7579 2003-05-28  Jim Meyering  <jim@meyering.net>
7580
7581         * src/extract-magic: Allow expansion of `$file' in the here-
7582         document corresponding to the comment at the top of fs.h.
7583
7584 2003-05-26  Jim Meyering  <jim@meyering.net>
7585
7586         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7587         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7588         Use #if/#elif/... cascade so we get only one set of include files.
7589         Reported by Nelson Beebe.
7590
7591 2003-05-24  Jim Meyering  <jim@meyering.net>
7592
7593         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7594         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7595         accept the BSD format.
7596
7597 2003-03-28  Joe Orton  <jorton@redhat.com>
7598
7599         * src/md5sum.c (bsd_split_3): New function.
7600         (split_3): Detect checksums from BSD 'md5' command and handle them
7601         using bsd_split_3.
7602
7603         * tests/md5sum/basic-1: New tests for --check exit status, and for
7604         BSD-style checksum files.
7605
7606 2003-05-21  Jim Meyering  <jim@meyering.net>
7607
7608         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7609         This sort of thing is why it'd be *Really Good* to factor
7610         out the common code used here and in tail.c.
7611
7612 2003-05-14  Jim Meyering  <jim@meyering.net>
7613
7614         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7615
7616         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7617
7618         * tests/du/fd-leak: New file.  Test for the bug in du that
7619         was fixed by the 2003-05-12 change to lib/ftw.c.
7620         * tests/du/Makefile.am (TESTS): Add fd-leak.
7621
7622         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7623         includes a translatable word, `and'.
7624
7625         * src/dd.c (usage): Don't use `,' as the thousands separator
7626         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7627         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7628         * src/df.c (usage): Likewise.
7629         * src/du.c (usage): Likewise.
7630         * src/ls.c (usage): Likewise.
7631
7632         * Makefile.maint (syntax-check): Add another check.
7633
7634 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7635
7636         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7637         must output nothing.  Problem reported by Josh Hyman.
7638
7639         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7640         (output_unique, output_first_repeated, output_later_repeated):
7641         New vars.  All uses of "mode" changed to use these variables,
7642         which are not mutually exclusive as "mode" was.
7643         (writeline): New arg "match", used to control whether to
7644         obey output_first_repeated or output_later_repeated.
7645         All callers changed.
7646         (check_file, main): Adjust to above changes.
7647
7648         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7649
7650 2003-05-14  Jim Meyering  <jim@meyering.net>
7651
7652         * tests/rm/rm3: Use tr's \n notation rather than \012.
7653         This package can afford to do that, since its tests are guaranteed use
7654         GNU tr, which has accepted the more modern notation for 10 years.
7655         * tests/rm/rm5: Likewise.
7656         * tests/cp/same-file: Likewise.
7657         * tests/stty/row-col-1: Likewise.
7658         * tests/stty/basic-1: Likewise.
7659         * tests/rm/deep-1: Likewise.
7660         * tests/mv/part-symlink: Likewise.
7661         * tests/mkdir/perm: Likewise.
7662         * tests/misc/nice: Likewise.
7663
7664 2003-05-13  Jim Meyering  <jim@meyering.net>
7665
7666         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7667         (triple_free): Don't apply cast to argument of free.
7668         (seen_file): Add cast here instead.
7669
7670         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7671         (src_to_dest_free): Don't apply cast to argument of free.
7672
7673         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7674         * src/pr.c (init_fps, init_store_cols): Likewise.
7675         * src/join.c (delseq, freeline): Likewise.
7676         * src/expr.c (OLD): Likewise.
7677         * src/sort.c (sort): Likewise.
7678         * src/head.c (elide_tail_lines_pipe): Likewise.
7679
7680         * src/tail.c: Include "quote.h".
7681         Use quote in diagnostics.  Change many error format strings
7682         from just `%s' to e.g., `error reading %s'.
7683         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7684         Rewrite newline-counting loop to use memchr.
7685
7686         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7687         Now that assert is no longer used, don't include <assert.h>.
7688
7689 2003-05-12  Jim Meyering  <jim@meyering.net>
7690
7691         * src/head.c: Include <assert.h>.
7692         (AUTHORS): Add my name.
7693         (elide_tail_lines_pipe): New function.
7694
7695 2003-05-10  Jim Meyering  <jim@meyering.net>
7696
7697         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7698
7699         * src/readlink.c (main): Set program_name before first use.
7700         Remove that (redundant) first use.
7701         Don't exit successfully just because --verbose was specified.
7702         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7703         parameter is 0, error does not exit.
7704
7705         * src/uname.c (main): When failing due to too many arguments, also say
7706         that, rather than just "Try `uname --help' for more information.".
7707         * src/comm.c (main): Likewise, but for too few arguments.
7708         * src/logname.c: Include error.h.
7709         (main): Say why we're failing.
7710
7711         * src/uniq.c (main): Don't segfault when argc < optind.
7712         * src/who.c (main): Handle argc < optind.
7713         * src/df.c (main): Likewise.
7714         * src/install.c (main): Likewise.
7715         * src/mv.c (main): Likewise.
7716         * src/pwd.c (main): Likewise.
7717         * src/tty.c (main): Likewise.
7718         * src/chroot.c (main): Likewise.
7719         * src/hostname.c: Likewise.
7720         * src/du.c (main): Likewise.
7721         * src/expand.c (main): Likewise.
7722         * src/env.c (main): Likewise.
7723         * src/unexpand.c (main): Likewise.
7724         * src/printenv.c (main): Likewise.
7725         * src/sync.c (main): Handle argc == 0.
7726         * src/expr.c (main): Likewise.
7727         * src/printf.c (main): Likewise.
7728         * src/basename.c (main): Likewise.
7729         * src/ln.c (main): Test for `missing argument' before computing n_files.
7730         * src/tail.c (main): Test for the case of no arguments before
7731         computing n_files.
7732
7733         * src/kill.c (send_signals): Don't check command line arguments here.
7734         (main): Check them here instead.  Handle argc < optind.
7735
7736         * src/logname.c (main): Use error, rather than fprintf, for the sake
7737         of consistency.
7738
7739         * src/rm.c (main): Don't overrun array bound if argc is 0.
7740
7741 2003-05-09  Jim Meyering  <jim@meyering.net>
7742
7743         * src/sort.c (main): Don't overrun array bound if argc is 0.
7744         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7745         Reported by Wartan Hachaturow.
7746
7747 2003-05-07  Jim Meyering  <jim@meyering.net>
7748
7749         Implement support so that `head --lines=-N' works on seekable files.
7750         * src/head.c (enum Copy_fd_status): Define.
7751         (COPY_FD_DIAGNOSE): New macro.
7752         (elide_tail_lines_seekable): New funtion.
7753         (elide_tail_lines_file): Call it here.
7754
7755 2003-05-06  Jim Meyering  <jim@meyering.net>
7756
7757         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7758
7759 2003-05-04  Jim Meyering  <jim@meyering.net>
7760
7761         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7762         caused the addition of thousands of small files to the tar archive.
7763         * tests/misc/head-elide-tail: New file.  Add them here instead.
7764         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7765
7766 2003-05-04  Paul Eggert  <eggert@twinsun.com>
7767
7768         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7769         (IF_READDIR_NEEDS_REWINDDIR): Remove.
7770         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7771         which was a bit weird because it couldn't be emulated by a function.
7772
7773 2003-05-03  Jim Meyering  <jim@meyering.net>
7774
7775         Extend head to accept --lines=-N (--bytes=-N) and to print all
7776         but the N lines (bytes) at the end of the file.
7777         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7778         Use quote() in diagnostics, rather than literal `' marks.
7779         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7780         New functions.
7781         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7782         (head_file): Reorganize so as to call head from only one place.
7783         (main): Likewise, for head_file.
7784         Handle new, undocumented option, --presume-input-pipe.
7785         Handle negative line and byte counts.
7786         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7787
7788         * tests/du/8gb: Skip test if the file system of `.' doesn't support
7789         sparse files -- otherwise it'd create a file of size 8GB.
7790
7791 2003-05-02  Jim Meyering  <jim@meyering.net>
7792
7793         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7794         Instead explain about `-' and standard input.
7795         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7796         Reported by Keith Thompson.
7797         * tests/fmt/basic: Add test for the above fix.
7798
7799         * src/fmt.c: Include "quote.h".
7800         Use quote() in diagnostics, rather than literal `' marks.
7801         (main): Exit nonzero when unable to open an input file.
7802         * tests/fmt/basic: Add test for the above fix.
7803
7804         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7805         specifications like `-72x'.
7806         * tests/fmt/basic: Add test for the above fix.
7807
7808         Work around nasty readdir bug on Darwin6.5.
7809         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7810         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7811         returned NULL and there has been at least one successful unlink or
7812         rmdir call since the opendir or previous rewinddir, then call
7813         rewinddir and reiterate the loop.
7814
7815         Factor out common code.
7816         * src/remove.c (readdir_ignoring_dotdirs): New function.
7817         (is_empty_dir): Use it here.
7818         (remove_cwd_entries): Use it here.
7819
7820 2003-05-01  Jim Meyering  <jim@meyering.net>
7821
7822         * tests/rm/r-3: Create 500 rather than just 300 files.
7823         There's a bug in Darwin6.5's readdir that shows up only with
7824         338 or more files.
7825         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7826         has two components.
7827
7828         * src/tail.c:
7829         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7830         (dump_remainder): Move two declarations `down' into the scope
7831         where they are used.
7832         (xlseek): Return the resulting offset.
7833         (file_lines): Rename parameter, file_length, to end_pos.
7834         (pipe_lines): Don't coerce safe_read return value to `int'.
7835         Adapt tests accordingly.
7836         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7837         to `unsigned int'.
7838         Change type of `total_bytes' from `int' to `size_t',
7839         since the former wouldn't always be wide enough.
7840         Don't coerce safe_read return value to `int',
7841         and adapt tests accordingly.
7842         Now that testing for a read error no longer involves
7843         using `tmp', handle that case *after* freeing `tmp'.
7844         (start_bytes): Clean up.
7845         (tail_bytes): Now that `n_bytes' may be larger than
7846         OFF_T_MAX, test for that condition and, if it's true, don't
7847         use lseek optimizations.
7848         (parse_options): Don't fail just because N_UNITS is larger than
7849         the maximum size of a file -- tail may be applied to an input
7850         stream (e.g., a pipe) with more data than that.
7851
7852         * Makefile.maint (syntax-check): Rename from alloc-check.
7853         Also check for SPACE-TAB sequences.
7854         Also check for malloc/calloc/realloc casts.
7855
7856 2003-05-01  Jim Meyering  <jim@meyering.net>
7857
7858         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
7859
7860 2003-04-28  Jim Meyering  <jim@meyering.net>
7861
7862         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7863         make the now-more-picky tsort fail.
7864
7865 2003-04-24  Jim Meyering  <jim@meyering.net>
7866
7867         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7868         (main): Minor syntactic clean-up.
7869
7870         * src/tsort.c (tsort): Fail if the input contains an odd number of
7871         tokens.  Reported by junkio@cox.net.
7872
7873         * tests/tsort/basic-1: Test for the above fix.
7874
7875 2003-04-21  Jim Meyering  <jim@meyering.net>
7876
7877         * tests/misc/printf: Add tests for the printf fixes below.
7878
7879         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7880
7881 2003-04-20  Paul Eggert  <eggert@twinsun.com>
7882
7883         Fix printf POSIX compatibility bug reported by Ben Harris in
7884         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7885         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7886         \0NNN in the %b operand.
7887         * src/printf.c (usage): Likewise.
7888         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7889         is desired.  All uses changed.  Behave like Bash printf if %b
7890         operand uses \NNN where the initial N is not 0.
7891
7892 2003-04-17  Jim Meyering  <jim@meyering.net>
7893
7894         * src/stty.c: Remove uses of PROTOTYPE macro.
7895
7896 2003-04-15  Jim Meyering  <jim@meyering.net>
7897
7898         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7899         each sequence of spaces before a TAB character.
7900
7901 2003-04-13  Jim Meyering  <jim@meyering.net>
7902
7903         * src/remove.c (is_empty_dir): Don't closedir (NULL).
7904
7905 2003-04-12  Jim Meyering  <jim@meyering.net>
7906
7907         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7908         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7909         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7910         * src/nl.c (main): Fix those problems and remove literal quote marks
7911         (e.g., "`%s'") from format string; instead use "%s" in each format
7912         string and `quote (optarg)' as the corresponding argument.
7913         Also, diagnose all invalid command line options before failing.
7914
7915         * src/nl.c (proc_text): Fix a bug that would make nl output extra
7916         newlines in some cases.  Details here: http://bugs.debian.org/177256.
7917         This bug was introduced on 2001-11-10 for textutils-2.0.17.
7918         * tests/misc/nl: Add test for the above-fixed bug.
7919
7920         * tests/misc/readlink: New file.  Test the --canonicalize option.
7921         * tests/misc/Makefile.am (TESTS): Add readlink.
7922
7923 2003-04-11  Jim Meyering  <jim@meyering.net>
7924
7925         Clean up.
7926         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7927         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7928         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7929         retain alignment) each sequence of spaces before a TAB character.
7930
7931         * src/ls.c: Include <stdlib.h> unconditionally.
7932
7933         * Makefile.maint (xalloc-check): Rename from header-check.
7934
7935         * src/yes.c: Include error.h after system.h, not before.
7936
7937         Clean up.
7938         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7939         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7940         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7941         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7942         * src/tr.c: * src/unexpand.c, src/users.c:
7943         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7944         return values and of xrealloc's first argument.
7945         Fix the former with this:
7946         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7947
7948 2003-04-10  Jim Meyering  <jim@meyering.net>
7949
7950         * src/stty.c (wrapf): Declare with format attribute.
7951
7952         The S_MAGIC_... names shouldn't be maintained in two places (prior
7953         to this change, one would have to keep stat.c and fs.h in sync).
7954         This change makes it so those names and the corresponding
7955         hexadecimal constants all reside in stat.c.  fs.h is now generated.
7956         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7957         (BUILT_SOURCES): Add fs.h, now that it's generated.
7958         (EXTRA_DIST): Add extract-magic.
7959         * src/extract-magic: New script to extract fs.h definitions from stat.c.
7960         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7961         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7962
7963         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7964         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
7965
7966         * man/unexpand.x: Add `SEE ALSO' reference to expand.
7967         * man/expand.x: Add `SEE ALSO' reference to unexpand.
7968         Suggestion from Dan Jacobson.
7969
7970 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
7971
7972         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7973         * src/stat.c (human_fstype): Handle Linux's devpts.
7974
7975 2003-04-09  Paul Eggert  <eggert@twinsun.com>
7976
7977         * src/split.c (line_bytes_split): Arg is of type size_t, since
7978         that's all that is supported for now.
7979         (main): Check for overflow in obsolescent line count option.
7980
7981 2003-04-09  Jim Meyering  <jim@meyering.net>
7982
7983         * tests/misc/split-fail: Add a new test for the above fix.
7984
7985         * src/split.c (bytes_split): Use size_t temporary (rather than
7986         uintmax_t original) in remaining computations.  From Paul Eggert.
7987
7988         Handle command line option arguments larger than 2^31.
7989         This allows e.g., splitting into files of size 2GB and larger,
7990         and running split --lines=N with N=2^31 or more.
7991         But for --line-bytes=N, the restriction that N <= SIZE_MAX
7992         remains (for now), due to the way it is implemented.
7993
7994         * src/split.c: Include "inttostr.h".
7995         (bytes_split, lines_split, line_bytes_split, main):
7996         Use uintmax_t, not size_t, for file sizes.
7997         (main): Give a better diagnostic for option arguments == 0.
7998         Use umaxtostr to print file sizes.
7999         Reported by Luke Hassell.
8000
8001 2003-04-08  Jim Meyering  <jim@meyering.net>
8002
8003         * src/rm.c (usage): Mention that --directory (-d) works only
8004         on some systems.  Suggestion from Samuel Tardieu.
8005
8006         * tests/basename/basic: Run $PERL to see if it is available,
8007         rather than testing its value.
8008         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
8009         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
8010         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
8011         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
8012         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
8013         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
8014         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
8015         * tests/sum/basic-1, tests/seq/basic: Likewise.
8016
8017         * tests/misc/Makefile.am (TESTS): Add split-fail.
8018         * tests/misc/split-fail: New file.
8019
8020         * src/split.c: Rename local variables: nchars -> n_bytes.
8021         (lines_split): Rename local, nlines -> n_lines.
8022         (main): Rename local variable: s/accum/n_units/.
8023         (main): Use STDIN_FILENO, not literal `0'.
8024
8025 2003-04-07  Jim Meyering  <jim@meyering.net>
8026
8027         * src/stat.c: Add #include directives for Ultrix 4.4.
8028         Based on a suggested change from Bert Deknuydt.
8029
8030 2003-04-06  Jim Meyering  <jim@meyering.net>
8031
8032         * Makefile.maint (makefile-check): New rule.
8033         (local-check): Add it.
8034
8035 2003-04-05  Jim Meyering  <jim@meyering.net>
8036
8037         * Makefile.am (nearly all of them):
8038         Use $(VAR) rather than @VAR@, now that we can rely on automake to
8039         emit a definition for each substituted variable.
8040         * tests/Makefile.am.in: Likewise.
8041
8042         * tests/rm/rm5: Add a comment explaining why this test fails when
8043         using Tru64's broken sed.
8044         * tests/rm/rm3: Likewise.
8045
8046         Make `kill -t' output signal descriptions (not `?') on Tru64.
8047         * src/kill.c (sys_siglist): Also check for __sys_siglist.
8048         Patch by Tony Leneis.
8049         * configure.ac: Also check for declaration of __sys_siglist.
8050         Required for Tru64 4.0D, 4.0F, and 5.1.
8051         Reported by Tony Leneis.
8052
8053 2003-04-04  Jim Meyering  <jim@meyering.net>
8054
8055         * src/Makefile.am (PERL): Remove unnecessary definition.
8056
8057         Because of inappropriate (but POSIX-mandated) behavior of rename,
8058         `mv a b' would not remove `a' in some unusual cases.  Work around
8059         this by unlinking `a' when necessary.
8060
8061         * src/copy.c (same_file_ok): Add an output parameter.
8062         Set it in the offending case.
8063         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
8064         Reported by Ed Avis.
8065         * tests/mv/hard-4: New test for the above.
8066         * tests/mv/Makefile.am (TESTS): Add hard-4.
8067
8068         Clean up rules for automatically generated sources:
8069         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
8070         Make each generated file be read-only.
8071         Add each file name to BUILT_SOURCES separately.
8072         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8073
8074         Put LOCALEDIR macro definition in new file: localedir.h.
8075         * src/Makefile.am (DEFS): Remove definition.
8076         (localedir.h): New rule.
8077         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8078         * src/system.h: Include "localedir.h".
8079
8080 2003-04-02  Jim Meyering  <jim@meyering.net>
8081
8082         * Version 5.0.
8083
8084         * tests/misc/Makefile.am (TESTS): Add false.
8085
8086         * Makefile.maint (TMPDIR): Make sure it's defined.
8087         (my-distcheck): Build in $(TMPDIR), not `.'.
8088
8089         * src/Makefile.am (false.c): Change all occurrences of
8090         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8091         unsuccessfully also with --help.  Reported by Paul Jarc,
8092         * tests/misc/false: New test for the above.
8093
8094 2003-03-30  Jim Meyering  <jim@meyering.net>
8095
8096         * NEWS: Note the location of older NEWS files.
8097
8098         * src/remove.c (is_empty_dir): Don't let a failing closedir
8099         clobber errno.  Spotted by Arnold Robbins.
8100
8101         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8102
8103 2003-03-29  Jim Meyering  <jim@meyering.net>
8104
8105         * Version 4.5.12.
8106
8107         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8108         Note that there are some harmless test failures when running
8109         `make check' as root on some systems.
8110
8111 2003-03-28  Jim Meyering  <jim@meyering.net>
8112
8113         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8114         This happens when connecting to sparc-solaris5.7 via ssh from within
8115         emacs.  Reported by Karl Berry.
8116
8117         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8118         Otherwise, on systems (DJGPP) that emulate pipes using files,
8119         this test would never complete, waiting for `yes' to terminate.
8120         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8121         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8122         Reported by Rich Dawe.
8123
8124 2003-03-27  Jim Meyering  <jim@meyering.net>
8125
8126         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8127         from `written by...' comment, at his request.
8128
8129 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8130
8131         Fix buffer overrun problem reported by TAKAI Kousuke, along
8132         with some other POSIX incompatibilities.
8133
8134         * src/printf.c (print_esc): Do not treat \x specially if
8135         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8136         in backslash.  Treat incomplete escape sequences as strings
8137         of characters, as POSIX requires.
8138         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8139         if the format is incomplete.
8140
8141 2003-03-24  Jim Meyering  <jim@meyering.net>
8142
8143         * tests/misc/printf: Add tests for the above fixes and changes.
8144
8145 2003-03-26  Jim Meyering  <jim@meyering.net>
8146
8147         * src/copy.h (struct cp_options): Add a comment.
8148
8149 2003-03-23  Jim Meyering  <jim@meyering.net>
8150
8151         * README: Describe problem with 64-bit mode on HPUX 11.x,
8152         with patch for /usr/include/inttypes.h.
8153         * TODO: Plan to add an autoconf test to work around the bug.
8154
8155 2003-03-22  Jim Meyering  <jim@meyering.net>
8156
8157         * src/stat.c: Don't include <sys/sysmacros.h>.
8158         That is already done via system.h.  Otherwise, the multiple
8159         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8160         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8161         (human_fstype): Factor some directives `up', out of this function.
8162         Cast away `const' to avoid error from Cray's /bin/cc.
8163
8164 2003-03-20  Jim Meyering  <jim@meyering.net>
8165
8166         * announce-gen (print_changelog_deltas): Ensure that a newline
8167         precedes each row of `*'s.
8168
8169 2003-03-20  Jim Meyering  <jim@meyering.net>
8170
8171         * Version 4.5.11.
8172
8173         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8174         format flag characters.
8175         Do not require that a field width be specified.
8176         Do not fail when given a field width of `0'.
8177         Reported by Dan Jacobson.
8178         * tests/seq/basic: Add new tests for the above-fixed bug.
8179
8180         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8181         (install-root): Likewise.
8182         (install-exec-local): Likewise.
8183         Based on a patch from Richard Dawe.
8184
8185 2003-03-19  Jim Meyering  <jim@meyering.net>
8186
8187         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8188         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8189         Include $(EXEEXT) in program names.
8190         Since $(LN_S) may degenerate to `cp -p', be careful
8191         to invoke it from the destination directory.
8192         Mostly from Richard Dawe.
8193         * configure.ac: Use AC_PROG_LN_S.
8194
8195         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8196         CDPATH shell variable set could cause this test to fail.
8197         Reported by Karl Berry.
8198
8199 2003-03-18  Jim Meyering  <jim@meyering.net>
8200
8201         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8202         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8203         AIX 5.1's xlc could not compile the former.
8204         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8205
8206 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8207
8208         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8209         program names, since automake only adds $(EXEEXT) to programs
8210         in its *_PROGRAMS.
8211
8212 2003-03-16  Jim Meyering  <jim@meyering.net>
8213
8214         * src/remove.c (rm): Put two local variables in static storage,
8215         so they can't be clobbered by the potential longjmp.
8216
8217 2003-03-15  Jim Meyering  <jim@meyering.net>
8218
8219         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8220         so that a version number with a two-digit component can still count
8221         as an alpha release.  Reported by Richard A Downing.
8222         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8223
8224 2003-03-14  Jim Meyering  <jim@meyering.net>
8225
8226         * src/ansi2knr.c: Remove no-longer-used file.
8227         * src/ansi2knr.1: Likewise.
8228
8229         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8230         assignment, since it causes trouble with old versions of GNU make
8231         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8232         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8233         Patch from Alexandre Duret-Lutz.
8234
8235         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8236         subdirectories so that each includes a definition of ACLOCAL_M4.
8237
8238         * announce-gen (main): Label the compressed source URLs.
8239
8240         * Version 4.5.10.
8241
8242         * tests/du/slink: Relax the test for the `local'ness of a file system,
8243         so that now it works also for tmpfs.
8244
8245         * tests/du/hard-link: Transform output from first du, so that this
8246         test doesn't fail on file systems like tmpfs that order directory
8247         entries differently.
8248
8249 2003-03-13  Jim Meyering  <jim@meyering.net>
8250
8251         * tests/du/8gb: Work around what appears to be an NFS failure that
8252         would make this test fail on some systems.
8253
8254 2003-03-11  Jim Meyering  <jim@meyering.net>
8255
8256         * tests/du/basic: Make the test file exactly 4k bytes long.
8257
8258         * src/split.c (longopts): Don't hard-code `2' here.
8259         Instead, just specify `&verbose', and ...
8260         (main): ... remove the `case 2:' block for --verbose.
8261
8262         * tests/du/basic: Make the test file larger than 64 bytes, so that
8263         we don't immediately disqualify file systems (e.g., NetApp) on which
8264         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8265
8266 2003-03-10  Jim Meyering  <jim@meyering.net>
8267
8268         Don't segfault for a negative field width or precision in format string.
8269         Note that this is just a stopgap fix.  The longer term solution may
8270         involve adapting bash's builtins/printf.def.
8271
8272         * src/printf.c: (UNSPECIFIED): Define.
8273         (print_direc): Use the special value, UNSPECIFIED, to indicate
8274         that field_width or precision has not been specified.
8275         (print_formatted): Fail if field_width or precision is the
8276         special value, UNSPECIFIED.
8277         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8278
8279         * src/sys2.h (INT_MIN): Define, if necessary.
8280         * tests/misc/printf: Add a test for the above-fixed bug.
8281
8282 2003-03-09  Jim Meyering  <jim@meyering.net>
8283
8284         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8285         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8286         Reported by Bob Proulx.
8287         (pop_dir): Reverse order of sign change and cast, to be consistent
8288         with the above.
8289
8290 2003-03-08  Jim Meyering  <jim@meyering.net>
8291
8292         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8293         shell variable, but only in the environment.  With /bin/sh->bash, the
8294         shell variable is set to `y', and that would cause a spurious warning.
8295         Reported by Bob Proulx.
8296
8297         * tests/Makefile.am (check-root): Remove touch/fifo.
8298         It doesn't appear to have to be run as root.
8299
8300         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8301         user name, make sure that the selected user name has a usable shell.
8302         Reported by Paul Jarc.
8303
8304         Before, when using shred on a device, one had to specify --exact,
8305         or be careful to choose a size that would not be rounded up and
8306         exceed the maximum value;  that could result in a failure of
8307         the final write.
8308         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8309         files.  Suggestion from Ben Elliston.
8310         (usage): Say it.
8311
8312         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8313         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8314         Patch by Bob Proulx.
8315
8316         * src/Makefile.am (check-misc): Check for use of `defined' in
8317         #define directives.
8318         Change to $(srcdir) before running grep.
8319
8320         * src/sleep.c: Remove now-unused #include and #define directives.
8321
8322         * src/du.c (process_file): If a file's size is not being counted
8323         e.g., because it's a hard link to a file we've already counted,
8324         then don't print a line for it.
8325
8326         * tests/du/hard-link: New test for the above-fixed bug.
8327         * tests/du/Makefile.am (TESTS): Add hard-link.
8328
8329         `du -S' didn't work
8330         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8331         and make the two-array approach work.
8332
8333         * tests/du/basic: Correct/add tests for the above fix.
8334         Set LC_ALL, etc., now that we use sort.
8335         Check the block/size of a small file, too.
8336         Correct expected results for simple dir1/dir2/file case.
8337         Add another test of du -S.
8338
8339 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8340
8341         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8342         middle-end/9986).  As one of GCC's optimizations, it transforms a
8343         fputs_unlocked call to a fputc_unlocked call when the string is
8344         one character long.  However, hpux doesn't have fputc_unlocked.
8345
8346         * expr.c (usage): Use putchar, not fputs, to output a single character.
8347         * ls.c (dired_dump_obstack): Likewise.
8348         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8349         * stat.c (print_it): Likewise.
8350
8351 2003-03-07  Jim Meyering  <jim@meyering.net>
8352
8353         * src/cp.c: Remove everything associated with mmap-stack.c.
8354         This reverts the two changes of 2003-02-21.
8355         * src/du.c: Remove everything associated with mmap-stack.c.
8356         This reverts the change of 2003-02-19.
8357
8358 2003-03-06  Jim Meyering  <jim@meyering.net>
8359
8360         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8361         CDPATH shell variable set could cause this test to fail.
8362         Reported by Karl Berry.
8363
8364 2003-03-05  Jim Meyering  <jim@meyering.net>
8365
8366         * Version 4.5.9.
8367
8368         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8369         integer with zero, to avoid a warning from Intel's ecc.
8370         Reported by Nelson Beebe.
8371
8372         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8373         Otherwise, for files or totals that are too big, numbers would
8374         be truncated.  Patch mostly by Michael Stone.
8375         Reported by Ingo Saitz as Debian bug #183210.
8376
8377         * tests/du/8gb: New test for the above-fixed bug.
8378         * tests/du/Makefile.am (TESTS): Add 8gb.
8379
8380         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8381         rather than UTILS_OPEN_MAX - 10.
8382
8383 2003-03-04  Jim Meyering  <jim@meyering.net>
8384
8385         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8386         rather than bug-gnu-utils, now that the former is better known.
8387         Suggestion from Göran Uddeborg.
8388
8389         * src/stat.c (usage): Capitalize consistently.
8390         Reported by Göran Uddeborg.
8391
8392         * Makefile.maint (rel-files): Include $(signatures), so that
8393         those files are also copied into $(release_archive_dir).
8394
8395         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8396         no longer does it.
8397         * src/remove.c (AD_pop_and_chdir): Likewise.
8398
8399         * tests/Makefile.am (check-root): Add fail-2eperm.
8400
8401 2003-03-03  Jim Meyering  <jim@meyering.net>
8402
8403         * src/remove.c (remove_cwd_entries): Include the full filename of
8404         the offending file, not just the basename.
8405
8406         * tests/misc/tty-eof: Set $ME properly.
8407
8408         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8409         Remove now-unused variables.
8410         (tag-prev-version, prev-cvs-tag): Likewise.
8411
8412         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8413         accurate diagnostic when failing to remove a file owned by some other
8414         user.  Reported by Ivo Timmermans via Michael Stone.
8415         This fixes Debian bug# 178471.
8416
8417         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8418         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8419         Based on a report from Ivo Timmermans.
8420
8421 2003-03-02  Jim Meyering  <jim@meyering.net>
8422
8423         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8424         failure to create a hard link, do not remove the entry associating
8425         the source dev/ino with the destination file name.
8426         * tests/mv/Makefile.am (TESTS): Add hard-3.
8427         * tests/mv/hard-3: New test, for the above-fixed bug.
8428         Inspired by a report from Iida Yosiaki.
8429
8430 2003-03-01  Jim Meyering  <jim@meyering.net>
8431
8432         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8433         header string.  Instead, put `Filesystem' and `Type' headers in the
8434         same string, so translators can use horizontal space as needed.
8435         Reported by Jean Charles Delepine.
8436
8437 2003-02-28  Jim Meyering  <jim@meyering.net>
8438
8439         * src/copy.c (copy_internal): When link fails because of an
8440         existing destination file, unlink that file and try again.
8441         Reported by Iida Yosiaki.
8442
8443         * tests/mv/Makefile.am (TESTS): Add hard-2.
8444         * tests/mv/hard-2: New test for the above-fixed bug.
8445         Based on a test case from Iida Yosiaki.
8446
8447 2003-02-26  Jim Meyering  <jim@meyering.net>
8448
8449         * tests/du/basic: Don't test du's -b option here.  Directory byte
8450         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8451         and IBM AIX 4.2.  Reported by Nelson Beebe.
8452
8453 2003-02-25  Jim Meyering  <jim@meyering.net>
8454
8455         * Makefile.maint (announcement): Now that ChangeLog entries
8456         are output by announce-gen, don't do it here.
8457         * announce-gen (print_changelog_deltas): New function.
8458         (main): Use it.
8459
8460 2003-02-22  Jim Meyering  <jim@meyering.net>
8461
8462         * announce-gen: New option: --release-type=TYPE
8463         * Makefile.maint (beta, major): New targets.  Remove `release'.
8464         Put them all together on a line.
8465         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8466         invocation of `announcement'.
8467         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8468
8469         * announce-gen: New option: --news=NEWS_FILE.
8470         Extract NEWS entries here, not via rules in Makefile.maint.
8471         * Makefile.maint (announcement): Now that NEWS entries are
8472         extracted by announce-gen, don't do it here.
8473         (news-r1, news-r2): Remove now-unused definitions.
8474
8475 2003-02-21  Jim Meyering  <jim@meyering.net>
8476
8477         * Version 4.5.8.
8478
8479         Merge in changes from autoconf's version of this file.
8480         * Makefile.maint (www-gnu): Define.
8481         (standards.texi-url_prefix): Use $(www-gnu).
8482         (make-stds.texi-url_prefix): Likewise.
8483
8484         * src/cp.c: Include "mmap-stack.h".
8485         (main): Invoke `run' through a macro that (when possible) runs it
8486         with a large, mmap'd stack.
8487
8488         * src/cp.c (run): New function, preparing for the above.
8489         Exit from this function, not from main
8490         (main): Call run.
8491
8492         * src/du.c: New option: --apparent-size.
8493         (enum) [APPARENT_SIZE_OPTION]: New member.
8494         (long_options): Add it.
8495         (usage): Describe it.
8496         (main): Handle it.
8497         ['b']: Set apparent_size.
8498         David Eisner reported that the behavior of --bytes had changed.
8499         Paul Eggert proposed the use of a new option, --apparent-size.
8500
8501         * src/du.c (apparent_size): New global.
8502         (print_only_size): Reflect the fact that we're printing byte counts,
8503         not ST_NBLOCKSIZE-byte-block counts.
8504         (print_size): Call print_only_size rather than duplicating its code.
8505         (process_file): Accumulate byte counts, rather than block counts.
8506
8507         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8508         for --separate-dirs (-S).
8509
8510 2003-02-20  Jim Meyering  <jim@meyering.net>
8511
8512         * Use automake-1.7.3.  Regenerate dependent files.
8513
8514         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8515         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8516         (usage) [%B]: Describe it.
8517         [%b]: Refer to %B.
8518
8519         * src/du.c (process_file): Reorganize the code to use only
8520         one `sum' array, and change how -S works back to the way it was
8521         before 2003-01-31.  Patch by Bruno Haible.
8522
8523         * tests/du/basic: New test.
8524         * tests/du/Makefile.am (TESTS): Add basic.
8525
8526         * tests/envvar-check: Add checks for the following:
8527         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8528
8529         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8530         so as not to conflict with the distributed file by the same name.
8531
8532         * src/du.c (process_file): Set info->skip before any possible return.
8533
8534         Report correct usage for directories, not 0.
8535         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8536         _before_ recording the dev/ino of a directory.
8537         Reported by Bruno Haible.
8538
8539         Now, df always displays the device file name corresponding to the
8540         listed mount point under `Filesystem'.  Before, for an unmounted
8541         block- or character-special file argument, it would display the
8542         command-line argument instead.
8543         * src/df.c (show_disk): Return a value indicating whether
8544         there was a match.  Don't try to find a mount point here.
8545         (show_entry): If show_disk doesn't find a match, call show_point.
8546
8547 2003-02-19  Jim Meyering  <jim@meyering.net>
8548
8549         * src/du.c: Include "mmap-stack.h".
8550         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8551         Exit from this function, not from...
8552         (main): ...here.
8553         Instead, if possible, invoke du_files through a macro that
8554         runs it with a large, mmap'd stack.
8555
8556         * src/join.c (usage): Change wording in --help output:
8557         use FILENUM instead of `SIDE' and say what FILENUM means.
8558         Reported by Bernhard Gabler.
8559
8560         * src/df.c (print_header): Rather than using a hard-coded literal
8561         string of spaces matching the length of the English `...Type' header,
8562         output the right number of spaces to match the selected translation.
8563         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8564
8565         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8566         (lines_split): Likewise.  and correct misleading indentation.
8567
8568         * src/split.c: Include "full-read.h".
8569         (bytes_split, lines_split, line_bytes_split): Use full_read,
8570         not safe_read.   The way split was using the latter, a short read
8571         could cause split to terminate before EOF.
8572
8573         * tests/misc/tty-eof: Test all programs that can read stdin,
8574         requiring no arguments and that write to standard output.
8575
8576         * tests/misc/tty-eof: New file.  Renamed from ...
8577         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8578         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8579
8580 2003-02-18  Jim Meyering  <jim@meyering.net>
8581
8582         cksum would perform an extra read after encountering EOF
8583         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8584         Patch by Michael Bacarella.
8585
8586         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8587         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8588         cat, cksum, md5sum, and sha1sum all in the same loop.
8589
8590 2003-02-14  Jim Meyering  <jim@meyering.net>
8591
8592         * src/remove.c: Include "euidaccess.h".
8593         Remove declaration of euidaccess.
8594
8595 2003-02-12  Jim Meyering  <jim@meyering.net>
8596
8597         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8598         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8599
8600 2003-02-10  Jim Meyering  <jim@meyering.net>
8601
8602         * src/test.c: Don't include group-member.h.
8603         Include euidaccess.h.
8604         (eaccess): Rewrite function to set the real uid and gid temporarily
8605         to the effective uid and gid, then invoke 'access', and then set the
8606         real uid and gid back.  On systems that lack setreuid or setregid,
8607         fall back on the kludges in euidaccess.  Before, it would not work
8608         for e.g., files with ACLs, files that were marked immutable,
8609         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8610         Paul Eggert suggested the new implementation.
8611
8612 2003-02-09  Jim Meyering  <jim@meyering.net>
8613
8614         * src/test.c (test_stat): Remove function.  It's job is done (only
8615         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8616
8617 2003-02-08  Jim Meyering  <jim@meyering.net>
8618
8619         * Version 4.5.7.
8620
8621         * tests/mv/part-symlink: Don't assume that the file owner username
8622         length is less than 9 in ls output: instead, omit that field
8623         altogether.  Reported by, and suggested fix from, Ferdinand.
8624
8625         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8626         * tests/du/Makefile.am (TESTS): Add restore-wd.
8627
8628         * src/rm.c: Correct now-invalid comment about cycle-detection.
8629
8630 2003-02-06  Jim Meyering  <jim@meyering.net>
8631
8632         * NEWS: Add entries from old/*/NEWS
8633         from fileutils-4.1 through 4.1.11 and
8634         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8635
8636         * Version 4.5.6.
8637
8638         * src/du.c (process_file): Don't return early for excluded files
8639         or for files whose dev/inode we've already seen.
8640
8641 2003-02-05  Jim Meyering  <jim@meyering.net>
8642
8643         * tests/du/exclude: New file.
8644         * tests/du/Makefile.am (TESTS): Add exclude.
8645
8646 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8647
8648         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8649         Fix memory allocation arithmetic.
8650
8651 2003-02-04  Jim Meyering  <jim@meyering.net>
8652
8653         `df /dev/block-or-char-device-file--not-mounted' now reports
8654         the name of the file system on which the file resides, usually `/'.
8655         Before, it would leave the `Mounted on' field blank.
8656         * src/df.c (show_disk): Move function to precede find_mount_point.
8657         (show_disk): Add parameter: STATP.
8658         If we don't find a matching device name, then resort to calling
8659         find_mount_point.  Reported by Bob Proulx.
8660
8661 2003-02-03  Andreas Schwab  <schwab@suse.de>
8662
8663         * tests/rm/cycle: Require non-root.
8664         * tests/rm/isatty: Likewise.
8665
8666 2003-02-02  Jim Meyering  <jim@meyering.net>
8667
8668         * Version 4.5.5.
8669
8670         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8671
8672         Ensure that there are no offending uses of `:'.
8673         * Makefile.maint (makefile_path_separator_check): New rule.
8674         (local-check): Add it to the list.
8675
8676 2003-02-01  Jim Meyering  <jim@meyering.net>
8677
8678         * src/du.c (MAX_N_DESCRIPTORS): Define.
8679
8680         * src/stat.c (G_fail): New global.
8681         (human_time): Diagnose failed localtime, not failed nstrftime.
8682         (main): Fail if G_fail is set.
8683
8684 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8685
8686         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8687         hard-coding the path-separator.  Also double-quote the new PATH,
8688         to avoid problems when the path-separator is a semi-colon or when
8689         `pwd` contains e.g. a space.
8690         * tests/chgrp/Makefile.am: Likewise.
8691         * tests/chmod/Makefile.am: Likewise.
8692         * tests/chown/Makefile.am: Likewise.
8693         * tests/cp/Makefile.am: Likewise.
8694         * tests/dd/Makefile.am: Likewise.
8695         * tests/dircolors/Makefile.am: Likewise.
8696         * tests/du/Makefile.am: Likewise.
8697         * tests/expr/Makefile.am: Likewise.
8698         * tests/factor/Makefile.am: Likewise.
8699         * tests/fmt/Makefile.am: Likewise.
8700         * tests/install/Makefile.am: Likewise.
8701         * tests/ln/Makefile.am: Likewise.
8702         * tests/ls/Makefile.am: Likewise.
8703         * tests/ls-2/Makefile.am: Likewise.
8704         * tests/md5sum/Makefile.am: Likewise.
8705         * tests/misc/Makefile.am: Likewise.
8706         * tests/mkdir/Makefile.am: Likewise.
8707         * tests/mv/Makefile.am: Likewise.
8708         * tests/od/Makefile.am: Likewise.
8709         * tests/rm/Makefile.am: Likewise.
8710         * tests/rmdir/Makefile.am: Likewise.
8711         * tests/seq/Makefile.am: Likewise.
8712         * tests/sha1sum/Makefile.am: Likewise.
8713         * tests/shred/Makefile.am: Likewise.
8714         * tests/stty/Makefile.am: Likewise.
8715         * tests/sum/Makefile.am: Likewise.
8716         * tests/tail-2/Makefile.am: Likewise.
8717         * tests/touch/Makefile.am: Likewise.
8718         * tests/tsort/Makefile.am: Likewise.
8719         * tests/unexpand/Makefile.am: Likewise.
8720
8721 2003-01-31  Jim Meyering  <jim@meyering.net>
8722
8723         * src/stat.c: Include "file-type.h"
8724         (print_human_type): Remove function.
8725         (human_access): Rename from print_human_access.  Return a string.
8726         (human_time): Rename from print_human_time.  Return a string.
8727         (print_stat): Arrange so that field width and an alignment specifier
8728         are honored for the %A, %F, %x, %y, and %z formats.
8729         [%F]: Use file_type; this gives slightly different file type strings,
8730         e.g., `directory' instead of `Directory' and `regular file' or
8731         `regular empty file' instead of `Regular file'.
8732         Prompted by a report from Richard Dawe that the uses of
8733         S_IFSOCK and S_IFIFO in print_human_time were not portable
8734         to systems using e.g., DJGPP.
8735
8736 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8737
8738         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8739         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
8740
8741 2003-01-31  Jim Meyering  <jim@meyering.net>
8742
8743         * src/du.c (main): Upon processing an invalid option or an invalid
8744         --exclude-from or --max-depth option argument, don't exit right away,
8745         in case there are others.  Rather record the failure and exit after
8746         processing other options.
8747
8748         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8749         tar archive easier to reproduce.
8750
8751         Rewrite to perform directory traversal using nftw.
8752
8753         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8754         (AUTHORS): Add self.
8755         (opt_one_file_system): Move global into `main'.
8756         (path, xstat, exit_status): Remove declarations.
8757         (arg_length, suffix_length): New globals.
8758         (G_fail): New global, sort of like the old `exit_status'.
8759         (IS_FTW_DIR_TYPE): Define.
8760         (print_only_size): New function.
8761         (process_file): New function.
8762         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8763         (str_trunc, pop_dir, count_entry): Likewise.
8764         (du_files): Rewrite to use nftw.
8765
8766 2003-01-30  Jim Meyering  <jim@meyering.net>
8767
8768         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8769         symlink-to-directory with -L, even without the trailing slash.
8770
8771 2003-01-27  Jim Meyering  <jim@meyering.net>
8772
8773         * src/Makefile.am (check-misc): Check for st_blocks, too.
8774
8775         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8776         Reported by Richard Dawe.
8777
8778 2003-01-27  Andreas Schwab  <schwab@suse.de>
8779
8780         * src/ls.c (quote_name): Add fourth parameter, width, into which to
8781         store the screen columns, and return the number of bytes instead.
8782         (print_dir): Pass NULL as fourth parameter of quote_name.
8783         (print_name_with_quoting): Likewise.
8784         (length_of_file_name_and_frills): Get the width from the fourth
8785         parameter of quote_name instead of return value.
8786
8787 2003-01-27  Jim Meyering  <jim@meyering.net>
8788
8789         * src/ls.c (decode_switches): If `dired' is set without
8790         `format == long_format', then silently reset dired.  This doesn't
8791         change the behavior of ls (all prior uses of dired were protected
8792         by `&& format == long_format'), and lets us...
8793         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8794         (PUSH_CURRENT_DIRED_POS): Likewise.
8795         (main): Likewise.
8796
8797 2003-01-22  Jim Meyering  <jim@meyering.net>
8798
8799         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8800         * tests/du/Makefile.am (TESTS): Add no-x.
8801
8802 2003-01-21  Jim Meyering  <jim@meyering.net>
8803
8804         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8805         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8806         it may still be a directory -- or not (e.g., with FreeBSD on an
8807         NFS-mounted file system), so resort to calling lstat to find out.
8808         Based on a patch by Michael van Elst.
8809
8810         * tests/cp/same-file: Don't assume that the file owner username
8811         length is less than 9 in ls output: instead, omit that field
8812         altogether.  Reported by, and suggested fix from, Ferdinand.
8813
8814 2003-01-20  Jim Meyering  <jim@meyering.net>
8815
8816         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8817         large format widths no longer cause strftime to infloop.
8818
8819         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8820
8821 2003-01-19  Jim Meyering  <jim@meyering.net>
8822
8823         * src/readlink.c: Include "canonicalize.h".
8824
8825 2003-01-18  Jim Meyering  <jim@meyering.net>
8826
8827         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8828         New member.
8829         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8830         (long_options): Add option --dereference-command-line-symlink-to-dir.
8831         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8832         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8833         -d, -F, -l options is specified.
8834         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8835         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8836         Change --dereference-command-line (-H) to dereference *all*
8837         command line arguments, including broken symlinks.
8838
8839 2003-01-15  Paul Eggert  <eggert@twinsun.com>
8840
8841         Change ls -H back to the way it was yesterday, since this is
8842         compatible with FreeBSD and the POSIX spec is confusing
8843         and somewhat contradictory.
8844
8845         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8846         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8847         (long_options): Change the long option name back.
8848         (usage): Change the usage back.
8849         (gobble_file): When -H is specified, dereference a top-level
8850         arg even if it points to a non-directory.
8851
8852 2003-01-15  Jim Meyering  <jim@meyering.net>
8853
8854         * src/ls.c (gobble_file): Fall back on using lstat when required:
8855         when --dereference (-L) is not specified, and
8856         - when operating on a dangling symlink
8857         - when operating on command-line-symlink-to-directories
8858         This fixes numerous problems.  Here are examples:
8859         - `ls dangling-symlink' would fail with `no such file...'
8860         Now it prints `dangling-symlink'.
8861         - `ls -i symlink' would mistakenly print the inode of the referent.
8862         Now it prints the inode of the symlink.  Likewise for --size (-s).
8863         Based on a patch from Michael Stone.
8864         Reported by Deepak Goel as Debian bug #173793.
8865
8866         Rename ls's --dereference-command-line (-H)
8867         option to   --dereference-command-line-symlink-to-dir.
8868         * src/ls.c [enum Dereference_symlink]
8869         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8870         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
8871         (long_options): Rename the long option.
8872         (usage): Say that --dereference-... changes how ls treats
8873         only symlinks to directories specified on the command line.
8874
8875 2003-01-14  Jim Meyering  <jim@meyering.net>
8876
8877         * tests/ls/dangle: New file/test, for the above fix.
8878         * tests/ls/inode: Another new file/test, for the above fix.
8879         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8880
8881         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8882         so that ls --color would no longer highlight the names of files with
8883         the execute bit set when not specified on the command line.
8884         Patch by Michael Stone.  Reported by Stephen Depooter as
8885         Debian bug 175135.
8886
8887         * tests/ls-2/tests (color-exe): New test, for the above fix.
8888
8889 2003-01-13  Jim Meyering  <jim@meyering.net>
8890
8891         * tests/shred/exact: Also test for just fixed bug with --zero.
8892
8893         * src/shred.c (long_opts): --zero does not require an argument.
8894         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
8895
8896 2003-01-12  Jim Meyering  <jim@meyering.net>
8897
8898         * Makefile.maint (cvs-update): Skip any file with local modifications.
8899
8900         * src/unexpand.c (usage): Document --first-only and mention that
8901         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
8902
8903 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
8904
8905         * src/df.c: Include "canonicalize.h".
8906         Use canonicalize_file_name unconditionally.
8907
8908 2003-01-09  Jim Meyering  <jim@meyering.net>
8909
8910         * README: Add readlink.
8911
8912 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8913
8914         * src/df.c: Include "xgetcwd.h".
8915         * src/pwd.c: Likewise.
8916
8917 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8918
8919         * src/shred.c: Remove declaration of xstrdup.
8920         We already get it via xalloc.h which is included via system.h.
8921
8922 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
8923
8924         New program: readlink.
8925
8926         * src/Makefile.am (bin_PROGRAMS): Add readlink.
8927         * src/readlink.c: New file.
8928
8929         * man/readlink.x: New file.
8930         * man/Makefile.am (dist_man_MANS): Add readlink.1.
8931         (readlink.1): New rule.
8932
8933 2003-01-09  Jim Meyering  <jim@meyering.net>
8934
8935         When selecting ranges of byte offsets (as opposed to ranges of fields)
8936         and when --output-delimiter=STRING is specified, output STRING between
8937         ranges of selected bytes.
8938         * src/cut.c (RANGE_START_SENTINEL): Define.
8939         (output_delimiter_specified): New global.
8940         (print_kth): Add parameter.  Adjust all callers.
8941         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8942         (cut_bytes): When requested, output STRING between ranges of
8943         selected bytes.
8944         (main): Make a diagnostic a little clearer.
8945         Based on a patch from Jan Nieuwenhuizen.
8946
8947         * tests/cut/Test.pm: New tests for the above.
8948
8949         * src/cut.c (set_fields): Make code agree with comment:
8950         Don't merge abutting ranges like 4- and 2-3.  This makes no
8951         difference currently, but is required to support an upcoming change.
8952
8953 2003-01-07  Jim Meyering  <jim@meyering.net>
8954
8955         * src/cut.c (set_fields): Fix typo in comment.
8956
8957         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8958         * tests/touch/Makefile.am (TESTS): Add not-owner.
8959         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8960         Now, this tests only the nonexistent-directory diagnostic.
8961         Suggestion from Michael Stone.
8962
8963         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8964
8965 2003-01-04  Jim Meyering  <jim@meyering.net>
8966
8967         * src/copy.h: Remove use of PARAMS.
8968         * src/remove.h: Likewise.
8969         * src/chown-core.h: Likewise.
8970
8971         rm could be tricked into mistakenly reporting a cycle.
8972         * src/remove.c: [cycle_check_state]: New global.
8973         (remove_cwd_entries): Adapt to new semantics of cycle_check.
8974         (rm): Call cycle_check_init and cycle_check_free for each file.
8975         * tests/rm/cycle (rm): New test, for the above fix.
8976         * tests/rm/Makefile.am (TESTS): Add cycle.
8977
8978         When rm detects a cycle, don't abort the entire command,
8979         but rather just the affected command line argument.
8980         * src/remove.c: Include <setjmp.h>
8981         (struct dirstack_state) [current_arg_jumpbuf]: New member.
8982         (remove_cwd_entries): Call longjmp if we detect a cycle.
8983         (rm): Call setjmp here.
8984
8985         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8986         Instead, include cycle-check.h and use it.
8987
8988         * src/remove.h (struct dev_ino): Remove declaration.
8989
8990         * src/remove.c (remove_cwd_entries): Fix typos in comment.
8991
8992         Don't include trailing /. in diagnostics about directories.
8993         * src/remove.c (full_filename_): When FILENAME is just `.'
8994         and there is a nonempty directory-name part, don't append `/.'.
8995         * tests/rm/unread2: Remove trailing /. from diagnostic.
8996         * tests/rm/rm2: Likewise.
8997
8998         * src/remove.c (struct dirstack_state): Define.
8999         To be used in place of these file-scoped globals ...
9000         (dir_stack, len_stack, Active_dir): Remove globals.
9001         (ds_init, ds_free): New functions.
9002         (full_filename): Define.
9003         (full_filename_): Rename from full_filename.
9004
9005         Begin to make AD_* functions more generic.
9006         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9007         (AD_push): Likewise.
9008         (AD_INIT_OTHER_MEMBERS): Define.
9009         (remove_dir): Define the `status' member manually after each
9010         call to AD_push or AD_push_initial.
9011
9012         * src/Makefile.am (check-misc): New rule, to ensure that no more
9013         S_IS* macro definitions sneak into the code.
9014         (check): Depend on check-misc.
9015
9016         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
9017         * src/du.c (count_entry) [S_ISLNK]: Don't define.
9018         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
9019
9020 2003-01-03  Jim Meyering  <jim@meyering.net>
9021
9022         * src/true.c: Add copyright.
9023         (AUTHORS): I suppose I've written it.
9024
9025         * src/Makefile.am (false.c): Make the generated file be read-only.
9026
9027 2003-01-04  Jim Meyering  <jim@meyering.net>
9028
9029         * src/ls.c: Include "dev-ino.h".
9030         [struct dev_ino]: Remove declaration.
9031
9032 2003-01-02  Jim Meyering  <jim@meyering.net>
9033
9034         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
9035         from mv: s/missing file arguments/missing file argument/.
9036         With --target-directory=DIR, cp and mv work with a single file argument.
9037         Reported by Karl Berry.
9038
9039         * tests/rm/isatty: Enable this test.
9040
9041 2002-12-31  Jim Meyering  <jim@meyering.net>
9042
9043         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9044         (AD_push): Likewise.
9045         (AD_INIT_OTHER_MEMBERS): Define.
9046         (remove_dir): Define the `status' member manually after each
9047         call to AD_push or AD_push_initial.
9048
9049         * src/ls.c [struct dev_ino]: Remove definition.
9050         Include "dev-ino.h" instead.
9051
9052 2002-12-28  Jim Meyering  <jim@meyering.net>
9053
9054         * tests/du/Makefile.am (TESTS): Add no-deref.
9055         * tests/du/no-deref: New script.
9056
9057 2002-12-23  Jim Meyering  <jim@meyering.net>
9058
9059         * src/remove.c (remove_cwd_entries): Fix typo in comment.
9060
9061 2002-12-21  Jim Meyering  <jim@meyering.net>
9062
9063         * announce-gen: Generate MML-formatted announcement.
9064         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
9065
9066 2002-12-20  Jim Meyering  <jim@meyering.net>
9067
9068         * src/touch.c (touch): Change the wording of a diagnostic so
9069         that it makes sense both when the file exists and when it doesn't.
9070         Suggestion from Michael Stone.
9071
9072 2002-12-18  Jim Meyering  <jim@meyering.net>
9073
9074         * src/stty.c (valid_options): Declare to be static.
9075
9076 2002-12-15  Jim Meyering  <jim@meyering.net>
9077
9078         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9079
9080         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9081         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9082         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9083         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9084         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9085
9086         * src/remove.c (PARAMS): Remove definition.
9087         * src/sys2.h: Likewise.
9088
9089         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9090         Include strftime.h instead.
9091
9092 2002-12-14  Jim Meyering  <jim@meyering.net>
9093
9094         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9095
9096         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9097         This is necessary at least for Irix6.5 when using c89.
9098         Reported by Nelson Beebe.
9099
9100         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9101
9102         * tests/misc/cat-tty-eof: New test.
9103
9104         * src/mknod.c (usage): Specify how major and minor mode numbers
9105         are interpreted.  Report forwarded by Kristin E Thomas.
9106         * src/mknod.c: Remove now-redundant usage-specifying comment.
9107
9108 2002-12-13  Jim Meyering  <jim@meyering.net>
9109
9110         * Version 4.5.4.
9111
9112         * tests/du/trailing-slash: Allow for a directory of size `0'.
9113         That happens at least on file systems of type tmpfs on linux-2.4.18.
9114
9115         * announce-gen: New script to begin replacing the commands
9116         associated with the rule here...
9117         * Makefile.maint (announcement): Invoke announce-gen.
9118         * Makefile.am (EXTRA_DIST): Add announce-gen.
9119
9120         * tests/cp/preserve-2: New file/test, for latest fix.
9121         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9122
9123 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9124
9125         Fix a bug whereby cp would fail to parse an option like
9126         --preserve=mode,ownership.
9127         * src/cp.c (decode_preserve_arg): Advance `comma' to
9128         point the character following the comma.
9129
9130 2002-12-11  Jim Meyering  <jim@meyering.net>
9131
9132         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9133         in case it's already defined.
9134
9135 2002-12-09  Jim Meyering  <jim@meyering.net>
9136
9137         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9138         Instead, evoke a framework failure if /no-$$ exists.
9139         Reported by Michael Stone.
9140
9141 2002-12-08  Jim Meyering  <jim@meyering.net>
9142
9143         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9144         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9145         du honors (per POSIX) the trailing slash on an argument referring
9146         to a symlink-to-directory.
9147
9148 2002-12-06  Jim Meyering  <jim@meyering.net>
9149
9150         * Use autoconf-2.57.  Regenerate dependent files.
9151         * Use automake-1.7.2.  Regenerate dependent files.
9152
9153         * src/ls.c (gobble_file): Also stat the file if it's a
9154         regular file and --indicator-style=classify (aka -F).
9155         Thanks to Ed Santiago for opening my eyes.
9156
9157         * tests/ls/file-type: New file.  Test for the above.
9158         A test to contrast ls -F and ls --indicator-style=file-type.
9159         * tests/ls/Makefile.am (TESTS): Add file-type.
9160
9161 2002-12-04  Jim Meyering  <jim@meyering.net>
9162
9163         * tests/ls/follow-slink: Make sure the symlink was created.
9164         Richard Dawe reported that `ln -s link link' succeeds, but creates
9165         no file on systems running some version of the DJGPP libc.
9166
9167 2002-12-03  Jim Meyering  <jim@meyering.net>
9168
9169         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9170         since this package no longer panders to K&R compilers.
9171
9172 2002-12-02  Jim Meyering  <jim@meyering.net>
9173
9174         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9175
9176         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9177         something to replace.
9178
9179 2002-12-01  Jim Meyering  <jim@meyering.net>
9180
9181         * src/stat.c: Don't include <string.h> or <ctype.h>.
9182         That's already done via system.h.
9183         * src/dircolors.c: Don't include <ctype.h>.
9184
9185 2002-11-30  Jim Meyering  <jim@meyering.net>
9186
9187         * ls.c (gobble_file): Remove the block of code that caused
9188         `ls --color -F symlink-to-dir' to list the files in
9189         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9190         like `ls -F symlink-to-dir') but with the addition of highlighting.
9191         Similarly, `ls --color -dF symlink-to-dir' would print
9192         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9193         Reported by Jeff Sheinberg as Debian bug #168203.
9194         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9195
9196         ls is now more efficient: with certain options, it no longer needs
9197         to stat each directory entry on systems with valid dirent.d_type.
9198         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9199         (main): Make --recursive set format_needs_type, not format_needs_stat.
9200         (gobble_file): Remove a FIXME comment, now that it's fixed.
9201
9202 2002-11-24  Jim Meyering  <jim@meyering.net>
9203
9204         * src/du.c (du_files): Don't strip any trailing slash.
9205         Rewrite so that `/' is no longer represented internally as
9206         the empty string.
9207         (count_entry): When appending a file name component,
9208         account for the fact that the current path may end in `/'.
9209         François Pinard reported that `du symlink-to-dir/' was not
9210         equivalent to `du symlink-to-dir/.'.  Now it is.
9211         * tests/du/trailing-slash: New file/test, for the above fix.
9212         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9213
9214 2002-11-23  Jim Meyering  <jim@meyering.net>
9215
9216         * src/tac.c (output): Declare some local variables to be of type size_t,
9217         rather than `int' to avoid warnings from gcc.
9218
9219 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9220
9221         * src/ls.c (decode_switches): Use case-sensitive matching to
9222         decode the QUOTING_STYLE environment variable.  This is more
9223         consistent with the documentation, and with --quoting-style.
9224
9225 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9226
9227         * src/stty.c (struct speeds): Add support for all baud rates defined
9228         in linux-2.4.19.
9229
9230 2002-11-19  Jim Meyering  <jim@meyering.net>
9231
9232         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9233         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9234         * tests/fmt/basic: Likewise.
9235
9236 2002-11-17  Jim Meyering  <jim@meyering.net>
9237
9238         * configure.ac: Update via autoupdate.
9239         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9240
9241         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9242         Reported by Hans Ginzel.
9243
9244 2002-11-15  Jim Meyering  <jim@meyering.net>
9245
9246         * Makefile.cfg (gnu_rel_host): Define.
9247         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9248         on whether $(VERSION) looks like a major release number.
9249
9250         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9251         (release): Rename from `alpha'.
9252         (alpha): Depend on release.
9253
9254         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9255
9256 2002-11-14  Jim Meyering  <jim@meyering.net>
9257
9258         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9259         (announcement): Use the new variable.
9260
9261         * Makefile.maint: Sync with Bison, i.e.:
9262         (po-check): Scan .l and .y files instead of the
9263         .c and the .h files that they generate.  This fixes the bug
9264         reported by Tim Van Holder in:
9265         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9266         Look for N_ as well as for _.  Try to avoid matching #define for
9267         N_ and _.
9268         From Paul Eggert.
9269
9270 2002-11-12  Jim Meyering  <jim@meyering.net>
9271
9272         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9273         Replace sole use with equivalent `#ifdef S_ISLNK'.
9274         Inconsistency reported by Dmitry V. Levin.
9275
9276 2002-11-11  Jim Meyering  <jim@meyering.net>
9277
9278         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9279         so that help2man produces properly formatted man pages.
9280         Reported by Herbert Xu as Debian bug #168400.
9281
9282 2002-11-10  Jim Meyering  <jim@meyering.net>
9283
9284         * src/ls.c (sighandler): Handle SIGTSTP specially.
9285         Based on suggestions from Solar Designer and Dmitry V. Levin.
9286         Add comments.
9287
9288         * Makefile.cfg (cvs_files): Define.  From autoconf.
9289         (local_updates): Likewise.
9290
9291         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9292         Remove functions.
9293         (sighandler): New function, based on the one in sort.c.
9294         (main): Use sigaction, if possible; otherwise signal.
9295         Handle these signals:
9296         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9297         Don't register our handler if the signal is already being ignored.
9298
9299         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9300         * src/csplit.c (interrupt_handler): Likewise.
9301         * src/sort.c (sighandler): Likewise.
9302         (main): Declare `i' and `nsigs' to be unsigned, not int.
9303
9304 2002-11-09  Jim Meyering  <jim@meyering.net>
9305
9306         ls --color: restore terminal text color upon signal.
9307         * src/ls.c: Include "full-write.h" and <signal.h>.
9308         (restore_default_color, restore_default_color_handler): New functions.
9309         (sigtstp_handler, put_indicator_direct): New functions.
9310         (main) [print_with_color]: Register signal handlers.
9311         Patch mostly by Solar Designer and Stanislav Ievlev.
9312
9313         Update from autoconf.
9314         * Makefile.maint (AMTAR): Remove definition.
9315         (update, cvs-update, po-update, do-po-update): New rules.
9316         (wget-update): Update (thus renaming to cvs-update).
9317         (automake_repo): Use anoncvs@sources.redhat.com.
9318
9319 2002-11-06  Jim Meyering  <jim@meyering.net>
9320
9321         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9322
9323         * tests/misc/printf: Be careful to test the code in this package,
9324         not the shell built-in function.
9325
9326         * src/printf.c (print_esc): A hexadecimal escape sequence has
9327         at most two hex. digits, not three.  Reported by Padraig Brady.
9328         (usage): Update description.
9329         * tests/misc/printf-hex: New file/test, for the above fix.
9330
9331 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9332
9333         Add support for locale-specific size indications (e.g.,
9334         thousands-separators) and for explicit size suffixes on output.
9335
9336         * doc/coreutils.texi (Block size): Say that:
9337         This affects display format as well as block size.
9338         Fractional block counts are rounded up.
9339         ls file size blocksize defaults to 1.
9340         A block size spec preceded by ' generates thousands separators.
9341         A suffix without a preceding integer generates suffixes.
9342         (tail invocation): 32k -> 32 KiB.
9343         (What information is listed): ls -h is now equivalent to
9344         ls --block-size=human, and ls -H is now equivalent to
9345         ls --block-size=si.  Displayed file size is now always affected by
9346         --block-size.
9347
9348         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9349         lib/umaxtostr.c: New files, taken from GNU tar.
9350
9351         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9352         umaxtostr.c.
9353         (EXTRA_DIST): Add inttostr.c.
9354
9355         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9356         notations like thousands separators.
9357         Specify what includer of include.h must include beforehand.
9358         (human_group_digits, human_suppress_point_zero, human_autoscale,
9359         human_base_1024, human_SI, human_B): New enum values.
9360         (human_readable): Rename from human_readable_inexact; put the
9361         options before the sizes.  All uses changed.  The old human_readable
9362         function has been removed; use inttostr.h instead.
9363         (human_options): Renamed from human_block_size, with new signature
9364         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9365
9366         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9367         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9368         freestanding C89.  No need to check for stdlib.h or string.h since
9369         autoconf does this now.
9370
9371         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9372         human.h, to print large numbers simply.
9373         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9374         * src/dd.c (print_stats, main): Likewise.
9375         * src/df.c (print_header): Likewise.
9376         * src/factor.c (print_factors): Likewise.
9377         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9378         * src/shred.c (dopass): Likewise.
9379         * src/sort.c (checkfp): Likewise.
9380         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9381         * src/tail.c (xlseek): Likewise.
9382         * src/wc.c (write_counts, wc): Likewise.
9383
9384         * src/df.c (human_output_opts): New var.
9385         (output_block_size): Now uintmax_t, not int, to handle larger
9386         block sizes.  All uses changed.
9387         * src/du.c: Likewise.
9388         * src/ls.c: Likewise.
9389
9390         * src/df.c (print_header): In the header line, prefer SI to human
9391         representation if it's shorter; if neither is shorter, try to
9392         intuit what the user would prefer.
9393
9394         * src/expr.c (inttostr): Remove; use new imaxtostr library
9395         function instead.
9396
9397         * src/ls.c (file_output_block_size): New var, to distinguish
9398         file sizes from other sizes.
9399         (decode_switches): Set it.
9400
9401         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9402         (dopass): When printing progress, use floor for what has been done
9403         so far (since we should be conservative there), and ceiling for
9404         what needs to be done (since that's what other programs use).
9405
9406 2002-10-19  Jim Meyering  <jim@meyering.net>
9407
9408         * src/pinky.c (print_heading): Align TTY and Name headings.
9409         Reported by Karl Eichwalder.
9410
9411 2002-10-18  Jim Meyering  <jim@meyering.net>
9412
9413         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9414         Remove now-useless cast.
9415         (stdread): Remove function.
9416         (bytes_split): Use size_t instead of int.
9417         Use safe_read, not stdread.
9418         (lines_split): Likewise.
9419         Use memchr rather than a `while' loop.
9420         (line_bytes_split): Use size_t instead of int.
9421         Use safe_read, not stdread.
9422         (main): Add some FIXME comments to remind me to remove casts.
9423
9424         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9425         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9426
9427 2002-10-17  Jim Meyering  <jim@meyering.net>
9428
9429         Fix a problem that could make e.g., `cat' misbehave on systems which
9430         give invalid (unreasonably large) values for stat.st_blksize.
9431         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9432         Reported by Petter Reinholdtsen.
9433
9434 2002-10-14  Jim Meyering  <jim@meyering.net>
9435
9436         Specifying a printf conversion specifer as nl's separator string
9437         could cause nl to segfault.
9438         * src/nl.c (build_print_fmt): Don't include separator string
9439         in the printf format; it might contain `%'.
9440         Use a better bound on the length of the print_fmt buffer.
9441         (print_lineno): Print the separator here instead.
9442         Reported by Doug Coleman.
9443
9444         * tests/misc/nl: New file/tests, including a test for the above.
9445         * tests/misc/Makefile.am (TESTS): Add nl.
9446
9447         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9448         * tests/misc/Makefile.am (TESTS): Add split-l.
9449
9450 2002-10-13  Jim Meyering  <jim@meyering.net>
9451
9452         * Version 4.5.3.
9453
9454         * src/du.c (usage): Tweak description of --dereference-args/-D.
9455
9456         * src/du.c (count_entry): Also save cwd when dereferencing (via
9457         --dereference-args, -D) a command-line argument.
9458         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9459
9460         * src/Makefile.am (../AUTHORS): New target/rule.
9461
9462 2002-10-12  Jim Meyering  <jim@meyering.net>
9463
9464         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9465         of type size_t, since that's the way it's used and avoids a warning.
9466
9467         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9468         since that's how it's always used and avoids a new warning from gcc.
9469         (read_input): Adapt to new safe_read ABI.
9470
9471         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9472         to avoid warnings.
9473
9474         * src/pinky.c (print_long_entry): fread returns size_t.
9475         Declare local `bytes' accordingly, to avoid warning.
9476
9477         tail -c +N would perform an extra read after encountering EOF
9478         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9479         * src/tail.c (start_bytes): Detect EOF, inform caller.
9480         (tail_bytes): Upon EOF in start_bytes, return immediately.
9481         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9482         Adapt to new safe_read ABI.
9483
9484 2002-10-11  Jim Meyering  <jim@meyering.net>
9485
9486         * tests/du/deref: New file/test, for the above fix.
9487         * tests/du/Makefile.am (TESTS): Add deref.
9488
9489 2002-10-10  Jim Meyering  <jim@meyering.net>
9490
9491         * tests/ln/Makefile.am (TESTS): Add target-1.
9492         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9493
9494 2002-10-09  Jim Meyering  <jim@meyering.net>
9495
9496         * tests/cp/backup-is-src: Ensure that certain environment variables
9497         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9498
9499         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9500         consume 4GB of disk space on systems without support for sparse files.
9501         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9502
9503         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9504         Patch by steven@magelico.net, forwarded by Michael Stone.
9505
9506         * tests/ls/dired: Ensure that ls produces English messages.
9507         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9508
9509 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9510
9511         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9512
9513 2002-10-08  Jim Meyering  <jim@meyering.net>
9514
9515         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9516         Fix syntax in test: use =, not ==.
9517         Reported by Bob Proulx.
9518         Change all the rest like this: grep -lR "testing framework'" .\
9519         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9520
9521         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9522         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9523         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9524         * src/wc.c (wc): Likewise.
9525
9526 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9527
9528         * src/cat.c (cat):
9529         Don't advance the write pointer past the end of the write buffer.
9530         * src/sort.c (begfield, limfield): Likewise.
9531
9532 2002-10-07  Jim Meyering  <jim@meyering.net>
9533
9534         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9535         * src/head.c (head_bytes, head_lines): Likewise.
9536
9537 2002-10-06  Jim Meyering  <jim@meyering.net>
9538
9539         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9540         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9541         (skip, dd_copy): Adapt to new safe_read ABI.
9542
9543         * Makefile.maint (signatures): Define.
9544         (%.sig): New rule.
9545         (announcement): Depend on $(signatures).
9546
9547         * Makefile.maint (announcement): Output all URLs for detached
9548         signatures, not just the last one from the previous loop.
9549
9550 2002-10-05  Jim Meyering  <jim@meyering.net>
9551
9552         * Version 4.5.2.
9553
9554         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9555         don't recurse into directory, DIR.  Prompted by a report from
9556         Leonardo Milano.
9557
9558         * tests/rm/i-no-r: New file/test, for the above fix.
9559         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9560
9561         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9562         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9563
9564 2002-10-03  Jim Meyering  <jim@meyering.net>
9565
9566         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9567         * src/df.c (AUTHORS): Likewise.
9568         * src/du.c (AUTHORS): Likewise.
9569         * src/tail.c (AUTHORS): Likewise.
9570         * src/touch.c (AUTHORS): Likewise.
9571
9572 2002-10-02  Jim Meyering  <jim@meyering.net>
9573
9574         * Makefile.am (SUBDIRS): Remove `old'.
9575         (EXTRA_DIST): List the files in old/.
9576         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9577         Suggestion from Akim Demaille.
9578
9579 2002-10-01  Jim Meyering  <jim@meyering.net>
9580
9581         * src/sys2.h (SSIZE_MAX): Define.
9582
9583 2002-09-30  Jim Meyering  <jim@meyering.net>
9584
9585         * src/csplit.c: Don't include stdlib.h here.  It's already included
9586         via system.h.
9587
9588 2002-09-29  Jim Meyering  <jim@meyering.net>
9589
9590         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9591         expression to avoid bogus warning from gcc.
9592
9593         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9594         (cat): Declare insize and outsize to be of type size_t, not int.
9595         Rearrange pointer/integer expressions to avoid bogus warnings.
9596         (main): Declare insize and outsize to be of type size_t, not int.
9597
9598         * src/tail.c (parse_options): Give a sensible diagnostic for
9599         an invalid byte or line count.  Reported by Mikko Tuumanen.
9600
9601         * src/touch.c (main): Split a long line.
9602
9603         * tests/du/Makefile.am (TESTS): Add slink.
9604         * tests/du/slink: New test for system.h change of 2002-08-31.
9605
9606         In move mode, always first try to rename.  Before, upon failure to
9607         rename a directory, this code would never attempt to rename any
9608         other file in that directory, but would thenceforth always copy.
9609         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9610         may fail with EXDEV, yet renaming files within that directory to
9611         a newly-created destination directory succeeds.
9612         * src/copy.c (copy_internal): Remove local, move_mode;
9613         use x->move_mode instead.  Based on a patch from Tom Haynes.
9614
9615 2002-09-28  Jim Meyering  <jim@meyering.net>
9616
9617         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9618         Factor out some duplication.
9619         (main): Use it.
9620         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9621
9622         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9623         compiler warnings.
9624         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9625         to avoid compiler warnings.
9626
9627         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9628         compiler warnings.
9629
9630         Fix things so `mkdir -p' can create very deep directories, e.g.,
9631         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9632         * src/mkdir.c (main): For --parents (-p), call make_path with the
9633         entire directory name, so we don't ever require that file operations
9634         like stat or chmod be performed on the entire command line argument.
9635         * makepath.c (make_path): Restore umask *before* creating the final
9636         component.
9637
9638 2002-09-27  Andreas Schwab  <schwab@suse.de>
9639
9640         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9641         to avoid overflow.  Reported by Hans Lermen.
9642
9643 2002-09-26  Jim Meyering  <jim@meyering.net>
9644
9645         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9646
9647 2002-09-25  Jim Meyering  <jim@meyering.net>
9648
9649         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9650         and add a cast, to avoid a warning about `signed and unsigned type in
9651         conditional expression'.
9652
9653 2002-09-22  Jim Meyering  <jim@meyering.net>
9654
9655         * src/rmdir.c: Include "dirname.h", for declaration of
9656         strip_trailing_slashes.
9657
9658         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9659         Now they're defined through system.h.
9660
9661         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9662         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9663         since it's already included from sys2.h via system.h.
9664
9665         * Use automake-1.6f.  Regenerate dependent files.
9666
9667         * src/Makefile.am (PERL): Remove duplicate definition.
9668
9669         fmt's -s, -t, -c options didn't work properly for long lines.
9670         Since get_line may end up calling put_paragraph (for long lines),
9671         be sure to set global, `other_indent', before it is used there.
9672
9673         * src/fmt.c (set_other_indent): New function, factored out of...
9674         (get_paragraph): ... here.  Call it.
9675         (get_line): Call set_other_indent before calling flush_paragraph,
9676         which calls fmt_paragraph, which in turn calls put_paragraph,
9677         which uses other_indent.
9678
9679         * tests/fmt/Makefile.am (TESTS): Add long-line.
9680         * tests/fmt/long-line: New file/test, for the above fix.
9681
9682 2002-09-21  Jim Meyering  <jim@meyering.net>
9683
9684         * src/od.c: No longer include deprecated <values.h>.
9685         It was required solely for now-removed reference to BITSPERBYTE.
9686         * src/install.c: Likewise.
9687         Suggestion from Bruno Haible.
9688
9689 2002-09-06  Andreas Schwab  <schwab@suse.de>
9690
9691         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9692         * src/rmdir.c (remove_parents): Strip trailing slashes.
9693
9694 2002-09-20  Jim Meyering  <jim@meyering.net>
9695
9696         * tests/rmdir/t-slash: New file/test, for the above fix.
9697         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9698
9699         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9700         Add a URL for each detached signature file.
9701
9702 2002-09-07  Bruno Haible  <bruno@clisp.org>
9703
9704         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9705
9706 2002-09-18  Jim Meyering  <jim@meyering.net>
9707
9708         `od -t x8' used the wrong (`l'-prefixed) printf format.
9709         Likewise for the o8 and u8 formats.
9710         * src/od.c (ISPEC_TO_FORMAT): Define macro.
9711         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9712         Reported by Arun Sharma.
9713
9714 2002-09-17  Jim Meyering  <jim@meyering.net>
9715
9716         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9717         From gettext's intl/loadmsgcat.c.
9718
9719         * tests/od/x8: New file/test, for the above fix.
9720         * tests/od/Makefile.am (TESTS): Add x8.
9721
9722 2002-09-15  Jim Meyering  <jim@meyering.net>
9723
9724         * Use autoconf-2.54.  Regenerate dependent files.
9725
9726         * src/csplit.c (get_format_width): Add cast to avoid
9727         warning about `signed and unsigned type in conditional expression'.
9728
9729 2002-09-14  Jim Meyering  <jim@meyering.net>
9730
9731         * src/who.c (print_user): Change type of local to size_t
9732         to avoid warnings about `comparison between signed and unsigned'.
9733         * src/ptx.c (generate_all_output): Likewise.
9734
9735         * src/dd.c (main, skip): Add casts to avoid warnings about
9736         `comparison between signed and unsigned'.
9737
9738         * src/id.c (print_full_info, print_group_list): Add casts to avoid
9739         warnings about `signed and unsigned type in conditional expression'.
9740
9741         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9742         to avoid warnings about `comparison between signed and unsigned'.
9743         (split_3): Change parameter names to be readable and add comment.
9744         Clean up the test for whether a line may be ignored.
9745
9746 2002-09-13  Jim Meyering  <jim@meyering.net>
9747
9748         * src/printf.c (main): Handle leading command line argument of `--'.
9749         Reported by Raul: DervishD <raul@pleyades.net>
9750         * tests/misc/printf: New file: test for the above.
9751         * tests/misc/Makefile.am (TESTS): Add printf.
9752
9753         * src/date.c (usage): Explain that %S's range of [0..60] is required --
9754         rather than 0..59 -- to accommodate the occasional positive leap second.
9755         Reported by Richard Neill.
9756
9757 2002-09-12  Jim Meyering  <jim@meyering.net>
9758
9759         * src/Makefile.am (nanosec_libs): Define.
9760         (sleep_LDADD, tail_LDADD): Use it here.
9761
9762         Factor nanosleep-related code into ../lib/xnanosleep.c.
9763         * src/sleep.c: Include xnanosleep.h.
9764         Factor out fenv.h-related code.
9765         (timespec_subtract): Remove function.
9766         (main): Remove code that deals with computing start and stop times
9767         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
9768
9769         Allow S (in --sleep-interval=S) to be a floating point value.
9770         * src/tail.c: Include xnanosleep.h and xstrtod.h.
9771         Move declaration of global variable, sleep_interval, to ...
9772         (main): ...here.
9773         (usage): Update description of --sleep-interval option.
9774         (tail_forever): New parameter, sleep_interval.  Update caller.
9775         Use xnanosleep, rather than sleep.
9776         (parse_options): New parameter, sleep_interval.  Update caller.
9777         Use xstrtod, now that we accept floating point values.
9778         Prompted by a patch from Augey Mikus.
9779
9780 2002-09-06  Jim Meyering  <jim@meyering.net>
9781
9782         * src/remove.c (prompt): Change comment to give a better note to
9783         translators.  From Michael Piefel.
9784
9785 2002-09-02  Jim Meyering  <jim@meyering.net>
9786
9787         * README: A good problem report/patch includes diffs against
9788         the most recent test release.
9789
9790         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9791         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9792
9793         * src/kill.c (print_table_row): Use an unsigned type for widths
9794         to avoid warning about comparison between signed and unsigned.
9795         (list_signals): Likewise.
9796
9797         * src/od.c (skip): Add a cast to avoid warning about comparison
9798         between signed and unsigned.
9799         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
9800         comparisons to make them more readable.
9801
9802 2002-09-01  Jim Meyering  <jim@meyering.net>
9803
9804         * Version 4.5.1.
9805
9806 2002-08-31  Jim Meyering  <jim@meyering.net>
9807
9808         Symlinks were always reported as using 0 blocks.
9809         * src/system.h (ST_NBLOCKS): Don't depend on file type.
9810         This reverts the change of 2000-01-30.
9811         Based on a report and patch from Neil Brown via Michael Stone.
9812         This fixes Debian Bug#156358.
9813
9814         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9815         `exit (1)' to `exit (EXIT_FAILURE)', and
9816         `usage (1)' to `usage (EXIT_FAILURE)'.
9817
9818         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9819         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9820         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9821         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9822         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9823         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9824         error never exits successfully.
9825
9826 2002-08-29  Jim Meyering  <jim@meyering.net>
9827
9828         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9829         when ignoring any return value.
9830
9831         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9832         failures.  On some systems (at least EMC Celerra and Solaris5.8),
9833         this appears to be necessary.
9834         (is_empty_dir): Likewise.  Also, always close directory handle.
9835         * src/ls.c (print_dir): Likewise.
9836         (print_dir): Rename local variable: reading -> dirp.
9837         Reported by Mike Coleman.
9838
9839 2002-08-28  Jim Meyering  <jim@meyering.net>
9840
9841         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9842         Give a diagnostic and fail if closedir fails.
9843
9844 2002-08-26  Jim Meyering  <jim@meyering.net>
9845
9846         * Makefile.am (THANKS-to-translators): New rule.
9847         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9848         * THANKStt.in: New file.
9849
9850         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9851         file-scoped global.
9852         (main): Register it with atexit.
9853         Close STDOUT_FILENO, to avoid a problem when writing to
9854         /dev/audio on at least Solaris 5.7 and 5.8 systems.
9855         Reported by Shing-Shong Shei.
9856
9857 2002-08-25  Jim Meyering  <jim@meyering.net>
9858
9859         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9860         * src/tac.c (main): Likewise.
9861         * src/tail.c (main): Likewise.
9862         * src/tee.c (main): Likewise.
9863         * src/tr.c (main): Likewise.
9864         * src/wc.c (main): Likewise.
9865
9866 2002-08-20  Jim Meyering  <jim@meyering.net>
9867
9868         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9869
9870 2002-08-10  Paul Eggert  <eggert@twinsun.com>
9871
9872         * src/nohup.sh: Don't use "exec --"; it's not portable and
9873         shouldn't be needed.
9874
9875 2002-08-09  Jim Meyering  <jim@meyering.net>
9876
9877         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9878         (usage): Clarify help text for the -COLUMN option.
9879         Patch by Padraig Brady.
9880         * tests/pr/Test.pm [col-last]: New test for the above.
9881
9882         * configure.ac: Start with version 4.5.1, chosen so that it's larger
9883         than the latest version numbers of the component packages.
9884
9885         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9886         programs in ../src.
9887
9888 2002-08-08  Jim Meyering  <jim@meyering.net>
9889
9890         * src/date.c: Guard inclusion of <langinfo.h> with
9891         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9892         * src/sort.c: Likewise.
9893         Patch by GOTO Masanori.
9894
9895 2002-08-05  Paul Eggert  <eggert@twinsun.com>
9896
9897         Fix some minor time-related bugs with POSIX time arguments.
9898         Some valid time stamps were being rejected (notably -1, and
9899         time stamps before 1900 on 64-bit hosts).  And some invalid
9900         time stamps were being accepted, e.g. September 31.
9901
9902         * src/date.c (main): Adjust to posixtime signature change.
9903         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
9904         Use localtime, not posixtm, to warn about obsolete "touch".
9905
9906 2002-08-05  Jim Meyering  <jim@meyering.net>
9907
9908         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9909
9910 2002-08-04  Jim Meyering  <jim@meyering.net>
9911
9912         * src/Makefile.am (check-README): New target/rule.
9913         (check): Depend on it.
9914
9915         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9916
9917 2002-08-03  Jim Meyering  <jim@meyering.net>
9918
9919         * Makefile.am (SUBDIRS): Add old.
9920         * old/: New directory, containing legacy ChangeLog* and NEWS files
9921         from the fileutils, sh-utils, and textutils packages.
9922
9923         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9924
9925 2002-08-02  Paul Eggert  <eggert@twinsun.com>
9926
9927         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9928
9929         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9930         (hard_LC_COLLATE): New var.
9931         (different): Args are now char *, not const char *.
9932         Use xmemcoll instead of memcmp to compare lines, so that
9933         LC_COLLATE has effect.  However, use memcmp if it is an
9934         easy locale.
9935         (check_file): Do not include newline in comparison, so that
9936         xmemcoll has a byte to stomp on temporarily.
9937         (main): Set hard_LC_COLLATE.
9938
9939 2002-07-29  Jim Meyering  <jim@meyering.net>
9940
9941         * Makefile.am (SUBDIRS): Remove djgpp, for now.
9942
9943 2002-07-20  Jim Meyering  <jim@meyering.net>
9944
9945         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9946         into EXIT_FAILURE.  Otherwise, false --help and false --version
9947         would fail.
9948
9949 2002-07-08  Jim Meyering  <jim@meyering.net>
9950
9951         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9952         rather than the hard-coded `sh-utils'.
9953
9954 2002-07-01  Jim Meyering  <jim@meyering.net>
9955
9956         * configure.ac: Merge the three files from fileutils,
9957         textutils, and sh-utils.
9958         * Makefile.am: Likewise.
9959         * src/Makefile.am: Likewise.