*** empty log message ***
[platform/upstream/coreutils.git] / ChangeLog
1 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
2
3         * Version 5.3.1.
4
5         Act on the Austin Group's response yesterday to XCU ERN 63; see
6         <http://www.opengroup.org/austin/docs/austin_260.txt>.
7         * NEWS: ls no longer outputs an extra space between mode and link count.
8         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
9         * src/ls.c (any_has_acl): New var.
10         (clear_files): Clear it.
11         (gobble_file): Set it if a file has an ACL.
12         (print_long_format): Omit needless space unless some file has an ACL.
13
14 2005-06-10  Jim Meyering  <jim@meyering.net>
15
16         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
17
18 2005-06-02  Jim Meyering  <jim@meyering.net>
19
20         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
21
22 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
23
24         Use "file name" when talking about file names, instead of "filename"
25         or "path", as per the GNU coding standards.
26         * src/basename.c: Don't use "path" or "filename".
27         * src/copy.c: Likewise.
28         * src/copy.h: Likewise.
29         * src/cp-hash.c: Likewise.
30         * src/cp.c: Likewise.
31         * src/df.c: Likewise.
32         * src/install.c: Likewise.
33         * src/ls.c: Likewise.
34         * src/pinky.c: Likewise.
35         * src/pr.c: Likewise.
36         * src/pwd.c: Likewise.
37         * src/remove.c: Likewise.
38         * src/rmdir.c: Likewise.
39         * src/sort.c: Likewise.
40         * src/system.h: Likewise.
41         * src/tty.c: Likewise.
42         * src/who.c: Likewise.
43         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
44         (make_dir_parents_private): Renamed from make_path_private.
45         All uses changed.
46         * src/cp.c (usage): Don't use "path" to describe a file name.
47         * src/readlink.c (usage): Likewise.
48         * src/rmdir.c (usage): Likewise.
49         * src/df.c: Don't include "path-concat.h"; not needed.
50         * src/install.c (install_file_in_file_parents): Renamed from
51         install_file_to_path.  All uses changed.
52         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
53         All uses changed.
54         * src/ls.c (make_link_name): Renamed from make_link_path.
55         All uses changed.
56         * src/pwd.c (struct file_name): Renamed from struct Path.
57         All uses changed.
58         (file_name_free): Renamed from path_free.  All uses changed.
59         (file_name_init): Renamed from path_init.  All uses changed.
60         (file_name_prepend): Renamed from path_prepend.  All uses changed.
61         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
62         All uses changed.
63         (longopts): Add comment that --path is deprecated.
64
65 2005-05-31  Jim Meyering  <jim@meyering.net>
66
67         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
68         This is a crutch so that `make distcheck's sc_tight_scope rule
69         knows that they really are deliberately declared that way.
70
71 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
72
73         Port to Solaris 10's rules for whether programs can chown files.
74         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
75         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
76         changed.
77         (copy_internal): If chown failed, don't worry about what happened
78         to the mode bits; they can't have changed.
79         (chown_privileges, chown_failure_ok): New functions.
80         * src/copy.h: Add copyright notice.
81         (struct cp_options): Remove myeuid member.  Add chown_privileges
82         member.
83         (chown_privileges, chown_failure_ok): New function decls.
84         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
85         Use chown_failure_ok rather than our own code.
86         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
87         * src/install.c (cp_option_init): Likewise.
88         * src/mv.c (cp_option_init): Likewise.
89
90 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
91
92         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
93         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
94         Remove decls.
95         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
96         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
97         [!defined _POSIX_VERSION]: Remove decls.
98         * src/install.c (getpwnam, getgrnam): Remove decl.
99         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
100         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
101         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
102         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
103         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
104         isn't defined.
105         Don't include <sys/file.h>; no longer needed.
106         (getegid, geteuid): Remove no-longer-necessary decls.
107
108         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
109         Define to 256, not 255, as per modern POSIX.
110
111 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
112
113         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
114         * src/dd.c (skip): Return the number of records that were not
115         skipped due to encountering EOF.
116         (dd_copy): If the file wasn't seekable and EOF was encountered,
117         write zeros past EOF until the desired offset is reached.
118
119         * NEWS: expr and test now correctly compare integers of unlimited size.
120         (Also, correct a comment that claimed that expr detects integer
121         overflow; it does so only when converting from strings.)
122         * src/expr.c: Include strnumcmp.h, xstrtol.h.
123         (looks_like_integer): New function.
124         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
125         own diagnostics.
126         (eval2): Don't look for trouble if !evaluate; this simplifies things.
127         Compare numbers using string comparison, so that overflow is
128         not possible.
129         * src/sort.c: Refactor so that others can use large-integer
130         comparison functions.
131         Include "strnumcmp.h".
132         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
133         Remove; moved to strnumcmp.
134         (decimal_point): Now int, to simplify converison overhead with
135         new API.  All uses changed.
136         (thousands_sep): Now -1 if there isn't one, as per new API.
137         All uses changed.
138         (numcompare): Move contents to strnumcmp module, except for
139         skipping blanks.
140         * src/test.c: Include inttostr.h, strnumcmp.h.
141         (whitespace, digit, digit_value, integer_expected_error): Remove.
142         (is_int): Remove; replaced by...
143         (find_int): New function.
144         (binary_operator): Don't let integers overflow in comparisons;
145         return the correct answer instead.  Simplify the code.
146         (unary_operator): Convert the integer ourself, since find_int
147         no longer does so.
148         * tests/expr/basic (bigcmp): New test.
149         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
150
151 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
152
153         * NEWS: nohup now redirects a tty stdin to an unreadable fd
154         instead of closing it.
155         * doc/coreutils.texi (nohup invocation): Document this.
156         * src/nohup.c (main): Implement this.
157
158 2005-05-26  Jim Meyering  <jim@meyering.net>
159
160         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
161         Reported by David Alan Gilbert.
162         * tests/expr/basic: Add tests using arithmetic on negative integers.
163
164 2005-05-19  Jim Meyering  <jim@meyering.net>
165
166         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
167         Remove inaccurate-but-harmless `const' attributes.
168
169         * src/join.c (decode_field_spec): Add an abort after
170         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
171         about variables being used uninitialized.
172
173 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
174
175         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
176         * src/Makefile.am: Add copyright notice.
177         (factor_LDADD): Remove, as factor no longer needs sqrt.
178         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
179         it's always true now.
180
181 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
182
183         Fix Cygwin porting problem reported by Eric Blake.
184         * src/remove.c (DT_IS_DIR): Remove.
185         (DT_IS_KNOWN, DT_MUST_BE): New macros.
186         (remove_entry): Use them.
187
188 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
189
190         * src/remove.c: Include unlinkdir.h.
191         (UNLINK_CAN_UNLINK_DIRS): Remove.
192         (remove_entry): Use cannot_unlink_dirs () rather than
193         UNLINK_CAN_UNLINK_DIRS.
194
195 2005-05-14  Jim Meyering  <jim@meyering.net>
196
197         Update FSF postal mail address.
198         * Makefile.maint, Makefile.cfg, gnupload
199         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
200         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
201         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
202         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
203         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
204         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
205         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
206         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
207         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
208         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
209         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
210         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
211         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
212         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
213         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
214         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
215         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
216         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
217         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
218         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
219         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
220         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
221
222 2005-05-13  Jim Meyering  <jim@meyering.net>
223
224         * NEWS: `rm -r' now removes all of the files it should, even on
225         systems with a buggy readdir affecting file systems inaccessible
226         at configure time.
227
228         In some unusual circumstances `rm -r' would fail to remove --
229         or even consider -- all entries in a directory with more than 254
230         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
231         other types of systems when using an affected file system via e.g.,
232         NFS.  The underlying cause was a bug in readdir on those systems.
233         Coreutils-5.2.1 and earlier used a configure-time test designed
234         to detect precisely those problem systems, but it would detect
235         the problem and enable remove.c's work-around code only when its
236         configure-time test was run on a losing file system.  Obviously,
237         it couldn't detect a problem if the offending file system wasn't
238         tested or even mounted at coreutils configure time.  Now, rm itself
239         performs a minimal-cost run-time test to detect the problem.
240
241         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
242         (remove_cwd_entries):  When readdir returns NULL for a directory from
243         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
244         entries, call rewinddir and then resume the readdir/unlink loop.
245         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
246
247 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
248
249         * NEWS: nohup now closes stdin if it is a terminal, unless
250         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
251         <https://www.opengroup.org/sophocles/show_mail.tpl?
252         source=L&listname=austin-group-l&id=8341>.
253         * doc/coreutils.texi (nohup invocation): Document this.
254         * src/nohup.c (main): Implement this.
255
256 2005-05-12  Jim Meyering  <jim@meyering.net>
257
258         * src/date.c: Assume `free (NULL)' works.
259         * src/dd.c: Likewise.
260         * src/df.c:Likewise.
261         * src/dircolors.c:Likewise.
262         * src/head.c: Likewise.
263         * src/ls.c: Likewise.
264         * src/md5sum.c: Likewise.
265         * src/pr.c: Likewise.
266         * src/sort.c: Likewise.
267
268 2005-05-10  Jim Meyering  <jim@meyering.net>
269
270         * tests/touch/not-owner: Skip this test if the user running it
271         owns `/' or has write access to it.
272
273         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
274         This makes `mv -i --reply=no f1 f2' work as expected (in not
275         performing the move operation).  But note that specifying `-i'
276         after `--reply=no' does *not* work.
277         Tiny patch from Vlada Macek.
278         Correct a comment.
279         * tests/mv/reply-no: New file.  Test for the above fix.
280         * tests/mv/Makefile.am (TESTS): Add reply-no.
281
282         * tests/ls-2/tests: Don't print PATH to stderr.
283
284 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
285
286         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
287         responses.
288
289 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
290
291         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
292         * src/dd.c (flags, usage): Add support for "binary" and "text".
293
294 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
295
296         * NEWS: chmod -w now complains if it differs from chmod a-w.
297         * src/chmod.c: Include quotearg.h.
298         (diagnose_surprises): New var.
299         (process_file): Diagnose surprises.  Simplify the logic a bit,
300         while we're at it.
301         (main): Prepare to diagnose surprises.  Remove useless code for
302         '-' option.
303         * tests/chmod/Makefile.am (TESTS): Add umask-x.
304         * tests/chmod/umask-x: New file.
305
306 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
307
308         * NEWS: ls --indicator-style=directory renamed to ls
309         --indicator-style=slash, to avoid confusion with ls --directory.
310         * src/ls.c (usage): Likewise.
311         (slash): Renamed from directory_only.  All uses changed.
312
313 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
314
315         * NEWS: "chmod +1 foo" is now diagnosed.
316
317 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
318
319         * NEWS: ls -p now marks only directories.  New option
320         --indicator-style=directory equivalent to -p.
321         * doc/coreutils.texi (ls invocation): Document this.
322         Also, mention ">" is for doors.
323         * src/ls.c (enum indicator_style): New constant directory_only,
324         for -p.
325         (indicator_style_args, indicator_style_types): Set it appropriately.
326         (decode_switches, gobble_file, print_type_indicator):
327         (length_of_file_name_and_frills):
328         Implement the change described in NEWS.
329         (decode_switches): Quote ">", too.
330         (usage): Update to match the new behavior.  Describe ">".
331         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
332         The "ls --color" test wasn't being checked; add a check for
333         "ls --color=auto" instead.
334
335         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
336         * tests/misc/split-fail: Likewise.
337         * tests/pr/Test.pm: Likewise.
338         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
339         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
340         if they use file names starting with +.
341         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
342         * tests/uniq/Test.pm (tv, test_vector): Likewise.
343
344         The following was partly derived from a tiny change by Eric Blake:
345         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
346         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
347         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
348         Work even if the underyling system attaches ACLs to new dirs.
349         * tests/mv/part-hardlink: Don't use 'set -'.
350         * tests/stty/row-col-1: Don't use 'set -'.
351
352 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
353
354         * NEWS: Document fixes described below.
355         * src/chmod.c (change, umask_value): New static vars.
356         (reference_file): Move this static var to inside "main".
357         (process_file, process_files): Remove CHANGES arg; now taken from
358         static var.  All uses changed.
359         (usage): Fix incorrect description of MODE operand.
360         (main): For invalid mode usages, output a brief usage message.
361         Adjust to new modechange API.
362         * install.c (main): Adjust to new modechange API.
363         Also, free the mode_change object when done.
364         * mkdir.c (main): Likewise.
365         * mkfifo.c (main): Likewise.
366         * mknod.c (main): Likewise.
367         * tests/chmod/equal-X: Check for =xX bug.
368         * tests/chmod/equals: Check for =u bug.
369         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
370
371 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
372
373         Restore support for usages like "head -1" and "tail -1",
374         even when conforming to POSIX 1003.1-2001.
375         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
376         join now supports a NUL field separator, e.g., "join -t '\0'".
377         join now detects and reports incompatible options, e.g.,
378         "join -t x -t y",
379         * NEWS: Document this.
380         * src/date.c: Remove posixver.h and its uses.
381         (COMMON_SHORT_OPTIONS): Remove.
382         (short_options): New constant.
383         (short_options, usage): -I now always takes an optional arg.
384         * src/expand.c: Remove posixver.h and its uses.
385         (shortopts): New constant.  -DIGIT now always takes an optional arg.
386         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
387         Don't complain about -DIGIT.
388         * src/fold.c: Remove posixver.h and its uses.
389         (shortopts): New constant.  -DIGIT now always takes an optional arg.
390         (main): Don't preprocess arg list; that was buggy.  Use method
391         similar to expand.
392         * src/head.c: Remove posixver.h and its uses.
393         (header_mode_option): Remove.
394         (main): Don't complain about obsolete -NUM args.
395         * src/join.c: Remove posixver.h and its uses.
396         (obsolete_usage): Remove.
397         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
398         they haven't been set yet.
399         (tab): Now int, not char.  Initialize to -1 to indicate white space
400         separates columns, so that we can use NUL as a separator.
401         All uses changed.
402         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
403         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
404         suffices.  Use xstrtoul for sizes; it suffices.
405         (decode_field_spec): Report an error and exit on failure.  Return void,
406         not bool.
407         (add_field_list): Likewise.
408         (set_join_field): New function.
409         (enum operand_status): New enum.
410         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
411         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
412         possibilities with obsolete option parsing.
413         (main): Use it.  Do not depend on POSIX version.
414         Check for conflicting options.  Parse obsolete options -j1 and -j2
415         so that it is a pure extension to POSIX 1003.1-2001.
416         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
417         * src/nice.c: Remove posixver.h and its uses.
418         (main): Always support -NUM option.
419         * src/od.c: Remove posixver.h and its uses.
420         (short_options): New constant, which always supports -w[num].
421         (COMMON_SHORT_OPTIONS): Remove.
422         * src/pr.c: Remove posixver.h and its uses.
423         (short_options): New constant, which always supports -S[string].
424         (COMMON_SHORT_OPTIONS): Remove.
425         * src/sort.c: Remove posixver.h and its uses.
426         (short_options): New constant, which always supports -y arg.
427         (COMMON_SHORT_OPTIONS): Remove.
428         (main): Redo workaround for Solaris compatibility with -y.
429         This change isn't visible to the user; it just cleans up the
430         code so that we don't need posixver.h.
431         * src/split.c: Remove posixver.h and its uses.
432         (main): Don't complain about -NUM option.
433         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
434         * src/unexpand.c: Remove posixver.h and its uses.
435         (main): Don't complain about -TAB.
436         * src/uniq.c (main): Don't complain about -NUM.
437
438 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
439
440         * src/nohup.c (main): If getopt fails, exit with status 127,
441         not status 1.  POSIX requires this.
442         * NEWS: Document this.
443
444         * src/nice.c (main): Report proper program name when getopt finds
445         trouble.  Problem reported by Behdad Esfahbod.
446
447         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
448         when the "+x" was being evaluated.
449         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
450         * mkfifo.c (main): Likewise.
451         * mknod.c (main): Likewise.
452         * tests/mkdir/perm: Test for the above bug.
453
454 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
455
456         Port test cases to Microsoft-Windows-related environments,
457         following suggestions from Eric Blake.
458         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
459         * tests/install/basic-1: Undo previous change.
460         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
461         * tests/install/trap: Undo previous change.
462         (sig): New var.  Use it insted of "trap '' CHLD".
463         Append $EXEEXT to executable name.
464
465         "fetish" -> "coreutils" in more places.
466         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
467         (package Coreutils): Renamed from package Fetish.  All uses changed.
468         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
469         remove Fetish.pm.
470
471 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
472
473         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
474         directory is actually a symbolic link.  Problem reported by
475         Eric Blake.
476
477         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
478         than the (incorrect) test -f and the (inadequate) ls.  ls is
479         inadequate because on some hosts a buggy mv will create a file of
480         the wrong type (problem reported by Eric Blake).  Skip this test
481         if test -p doesn't work.
482
483         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
484         since the latter can have shell metacharacters in them (e.g., spaces).
485         This follows up to the 2005-01-17 patch, which missed this occurrence.
486
487 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
488
489         "fetish" -> "coreutils" in several places.
490         * Makefile.cfg (ftp): Remove fetish.sf.net.
491         * Makefile.maint (emit_upload_commands): Likewise.
492         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
493         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
494         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
495
496         * tests/install/basic-1: Use "cat", not "test", to test for
497         ../../src/dd.  Problem reported by Eric Blake.
498
499 2005-04-18  Jim Meyering  <jim@meyering.net>
500
501         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
502
503 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
504
505         Work around a couple of "make check" failures reported for Cygwin
506         and ash by Eric Blake.
507         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
508         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
509
510 2005-04-16  Jim Meyering  <jim@meyering.net>
511
512         * src/dd.c (S_TYPEISSHM): Remove definition.
513         Get the definition by including "stat-macros.h", instead.
514
515 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
516
517         Fix test suite problems reported by Eric Blake on Cygwin.
518         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
519         since POSIX doesn't require rename to fail across file systems.
520         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
521         it's more reliable.
522         (other_partition_tmpdir): Remove df from name as that would be
523         misleading now.
524
525 2005-04-14  Jim Meyering  <jim@meyering.net>
526
527         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
528
529 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
530
531         * src/ls.c (usage): "uid" -> "user ID".
532
533 2005-04-12  Jim Meyering  <jim@meyering.net>
534
535         * src/tsort.c (tsort): Use "%s" as the format string,
536         rather than a diagnostic or a file name.
537
538         * src/comm.c (compare_files): Remove declaration of unused local.
539
540         * src/chown-core.c (chopt_free): Mark parameter as unused.
541
542 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
543
544         * man/chown.x: Reword to match user manual.
545         * man/id.x: Likewise.
546         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
547         for "group ID".
548         * src/whoami.c (usage, main): Likewise.
549
550         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
551         * src/comm.c: Include stdio-safer.h.
552         (compare_files): Exit right away on I/O error rather than continuing
553         and producing confusing output and error messages.
554         Return void, not int; all callers changed.
555         Use fopen_safer to avoid confusion with file descriptors.
556         * src/copy.c: Include unistd-safer.h.
557         (copy_reg): Use fd_safer.
558         * src/csplit.c: Include stdio-safer.h.
559         (input_desc): Remove unnecessary static initialization.
560         (set_input_file): Use STDIN_FILENO, not 0.
561         (create_output_file): Use fopen_safer.
562         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
563         return stdin.
564         * src/head.c (head_file): Don't assume open does not return 0.
565         * src/join.c: Include stdio-safer.h.
566         (main): Use fopen_safer.  Simplify the resulting code.
567         * src/md5sum.c (digest_file, digest_check):
568         Don't assume that fopen does not return stdin.
569         * src/nohup.c: Include unistd-safer.h.
570         (main): Don't dup stderr to stdin or stdout by mistake.
571         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
572         * src/paste.c (paste_serial): Likewise.
573         * src/pr.c: Include stdio-safer.h.
574         (open_file): Use fopen_safer.
575         (close_file): Don't assume fopen does not return stdin.
576         * src/ptx.c (main): Don't assume fopen returns stdout after closing
577         stdout.  Use freopen instead.
578         * src/shred.c: Include unistd-safer.h.
579         (wipename): Use fd_safer on directory file descriptor.
580         (wipefile): Remove special case for /dev/fd/* on older hosts.
581         It didn't work in general, and wasn't documented.
582         Use fd_safer.
583         * src/sort.c: Include unistd-safer.h.
584         (create_temp_file): Use fd_safer.
585         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
586         * src/split.c: Include unistd-safer.h.
587         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
588         version, as POSIX requires.
589         * src/sum.c (bsd_sum_file, sysv_sym_file):
590         Use same pattern as elsewhere for checking for stdin.
591         * src/tac.c: Include unistd-safer.h.
592         (copy_to_temp): Use fd_safer.
593         (tac_file): Don't assume fopen cannot return stdin.
594         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
595         (recheck, tail_file): Use fd_safer rather than open_safer.
596         * src/tee.c: Include stdio-safer.h.
597         (tee): Use fopen_safer.
598         * src/touch.c: Include unistd-safer.h.
599         (touch): Use fd_safer.
600         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
601         removed.
602         (tsort): Do not assume fopen can't return stdin.
603         Close stdin before returning.  All uses changed.
604         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
605         * src/uniq.c: Include stdio_safer.h.
606         (check_file): Don't assume fopen cannot return stdin or stdout.
607
608 2005-04-09  Jim Meyering  <jim@meyering.net>
609
610         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
611
612         Now that close_stdout closes standard output unconditionally,
613         these workarounds for dd and cat are no longer necessary.
614         * src/dd.c (close_stdout_wrapper): Remove function.
615         (main): Call atexit with close_stdout, instead.
616         * src/cat.c (close_stdout_wrapper): Likewise.
617         Don't close STDOUT_FILENO explicitly; close_stdout does it.
618
619         * src/system.h (__attribute__): Readability nit:
620         Change this:
621         #  define __attribute__(x)
622         to this:
623         #  define __attribute__(x) /* empty */
624
625 2005-04-09  Jim Meyering  <jim@meyering.net>
626
627         * src/rm.c (usage): Mention that --recursive removes listed
628         directories too, not just their contents.
629         Say that by default, rm does not remove directories.
630
631         * src/pr.c: Don't include "timespec.h".  system.h does that.
632         * Makefile.maint (sc_system_h_headers): Propagate exit status
633         through trap.
634
635 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
636
637         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
638         and when conforming to POSIX no longer treats USR1 specially.
639         Document that dd no longer dumps core when handling signals.
640         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
641         replaced with void.
642         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
643         All uses changed.
644         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
645         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
646         behavior when called from a signal handler.  All uses changed.
647         (main) [!defined SA_NOCLDSTOP]:
648         Use siginterrupt to specify that system calls should be interrupted.
649         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
650         (process_signals): Add forward decl.
651         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
652         New macros.
653         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
654         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
655         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
656         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
657         New vars.
658         (usage): Mention -USR1 versus -INFO.
659         (cleanup): Don't invoke print_stats; the caller must do it now.
660         All callers changed.
661         (quit): Process signals just before exiting.
662         (interrupt_handler): Simply record the signal and return.
663         (siginfo_handler): Simply increment the signal counter and return.
664         (install_handler): Remove, replacing with:
665         (install_signal_handlers, process_signals, iread, iwrite):
666         New functions.  All callers to safe_read and full_write replaced
667         by iread and iwrite.  All callers to install_handler replaced by
668         install_handlers.
669         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
670         All uses changed.
671         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
672         (main) [! SA_NOCLDSTOP]: Use it.
673         * src/shred.c: Remove all uses of signals; modern hosts have
674         /dev/random and don't need this gorp.
675         Do not include signal.h.
676         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
677         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
678         All uses changed.
679         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
680         (main) [! SA_NOCLDSTOP]: Use it.
681
682         * src/dd.c: Do not include inttostr.h, no longer needed.
683         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
684         instead of umaxtostr.
685         (print_stats): Work even in languages that have special
686         forms for two of things, for r_truncate and w_bytes.  We can't
687         fix delta_s in this way, since ngettext doesn't support floating-point.
688         (main): Rewrite to avoid casts.
689
690 2005-04-07  Jim Meyering  <jim@meyering.net>
691
692         Placate gcc-4's -Wuninitialized.
693         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
694         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
695
696         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
697         be `const'.
698         (binop): Move function definition to precede first use so we can...
699         (binop): ...remove prototype.
700
701 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
702
703         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
704         * src/basename.c (usage): Add examples.
705         * src/cat.c (usage): Likewise.
706         * src/chgrp.c (usage): Likewise.
707         * src/chown.c (usage): Likewise.
708         * src/dirname.c (usage): Likewise.
709
710 2005-04-05  Jim Meyering  <jim@meyering.net>
711
712         * src/nice.c (usage): Mention that some shells provide a
713         built-in function by the same name.
714         * src/nohup.c (usage): Likewise.
715         * src/printenv.c (usage):Likewise.
716
717 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
718
719         * src/tee.c (tee): When closing files, do not close stdout,
720         leave this job to close_stdout() instead.
721         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
722         * tests/Makefile.am (SUBDIRS): Add tee.
723         * tests/tee/Makefile.am: New file.
724         * tests/tee/.cvsignore: Likewise.
725         * tests/tee/{basic,dash}: New tee tests.
726
727 2005-04-04  Jim Meyering  <jim@meyering.net>
728
729         * src/echo.c (usage): Mention that some shells provide a
730         built-in function by the same name.
731         * src/kill.c (usage): Likewise
732         * src/printf.c (usage): Likewise.
733         * src/pwd.c (usage): Likewise.
734         * src/stat.c (usage): Likewise.
735         * src/test.c (usage): Likewise.
736         * src/true.c (usage):
737         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
738
739         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
740         * man/printf.x: Likewise.
741         * man/pwd.x: Likewise.
742
743 2005-04-03  Jim Meyering  <jim@meyering.net>
744
745         * src/pr.c (main): Fix off-by-one error.
746         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
747         end of a malloc'd buffer.
748
749 2005-04-01  Jim Meyering  <jim@meyering.net>
750
751         * src/pr.c (main): Free column_count_string when done with it.
752
753         Don't let pr treat +1:-1 like +1:18446744073709551615.
754         * src/pr.c (strtoumax): Remove declaration.
755         (first_last_page): Use xstrtoumax in place of strtoumax,
756         so we don't interpret a negative page number (e.g., in an option
757         like --pages=1:-1) as valid.
758         * tests/pr/Test.pm (neg-page): Add a test for this.
759
760 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
761
762         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
763         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
764         * src/users.c (users): Likewise.
765         * src/who.c (who): Likewise.
766         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
767         * src/users.c (main): Likewise.
768         * src/who.c (main): Likewise.  Also with two arguments.
769         Omit duplicate code in 2-arg case.
770         (UT_PID): Moved to ../lib/readutmp.h.
771
772 2005-03-29  Jim Meyering  <jim@meyering.net>
773
774         * src/system.h (ptr_align): Declare `ptr' parameter to be a
775         `const' pointer, since this function never writes through it.
776
777         * src/uname.c: Indent cpp directives to reflect nesting.
778
779 2005-03-28  Jim Meyering  <jim@meyering.net>
780
781         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
782         Add `void' to make this an ANSI-style function declaration.
783         * src/remove.c (ds_init): Likewise.
784         * src/pr.c (print_sep_string): Likewise.
785
786         * src/stty.c (speeds): Declare this array to be static.
787         * src/Makefile.am (sc_tight_scope): Adjust to catch any
788         new declarations like that of stty.c's `speeds'.
789
790         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
791         (GETOPT_VERSION_OPTION_DECL): Likewise.
792         * src/chown.c (long_options): Likewise.
793         * src/chgrp.c (long_options): Likewise.
794         * src/chmod.c (long_options): Likewise.
795         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
796         Likewise.
797         * src/chown-core.c (chopt_init): Likewise.
798         * src/comm.c (long_options): Likewise.
799         * src/copy.c (copy_reg): Likewise.
800         * src/csplit.c (extract_regexp): Likewise.
801         * src/cut.c (longopts): Likewise.
802         * src/date.c (time_spec_string): Likewise.
803         * src/df.c (find_mount_point, show_point): Likewise.
804         * src/expr.c (docolon): Likewise.
805         * src/fmt.c (long_options): Likewise.
806         * src/ls.c (time_style_args, indicator_style_args, long_options)
807         (format_args, sort_args, time_args, decode_switches)
808         (gobble_file): Likewise.
809         * src/md5sum.c (long_options): Likewise.
810         * src/mv.c (reply_args): Likewise.
811         * src/paste.c (longopts): Likewise.
812         * src/pinky.c (print_entry): Likewise.
813         * src/pr.c (long_options): Likewise.
814         * src/ptx.c (long_options, format_args): Likewise.
815         * src/readlink.c (longopts): Likewise.
816         * src/sort.c (long_options, mergefps): Likewise.
817         * src/stat.c (long_options): Likewise.
818         * src/tac.c (main): Likewise.
819         * src/tail.c (follow_mode_string): Likewise.
820         * src/touch.c (longopts, time_args): Likewise.
821         * src/uniq.c (delimit_method_string): Likewise.
822         * src/uptime.c (print_uptime): Likewise.
823         * src/who.c (print_user): Likewise.
824
825 2005-03-27  Jim Meyering  <jim@meyering.net>
826
827         * src/dcgen: Simplify further, clean up.
828         Add a standard-output-closing global destructor.
829         Require perl-5.002.
830         * src/wheel-gen.pl: Use the same global destructor as dcgen.
831
832 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
833
834         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
835         array of adjacent strings rather than a more complicated data
836         structure; this saves space in the dircolors executable.
837         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
838         This avoids casts.
839         (dc_parse_stream, main): Avoid casts.
840         Adjust to simpler data structure generated by new dcgen.
841
842 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
843
844         * src/ls.c (usage): Document usage of LS_COLORS.
845
846 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
847
848         * src/dircolors.hin: Add "TERM cygwin".
849
850 2005-03-25  Jim Meyering  <jim@meyering.net>
851
852         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
853         the return value, and update callers:
854         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
855         * src/expand.c (parse_tab_stops, main): Likewise.
856         * src/split.c (main): Likewise.
857         * src/unexpand.c (parse_tab_stops, main): Likewise.
858         * src/uniq.c (main): Likewise.
859
860 2005-03-22  Jim Meyering  <jim@meyering.net>
861
862         * build-aux: New directory.  Renamed from config.
863         * configure.ac: Reflect renaming: config -> build-aux.
864         * Makefile.am (dist-hook): Likewise.
865         * Makefile.maint: Likewise.
866         * Makefile.cfg (cvs_files): Likewise.
867         * .x-sc_sun_os_names: Likewise.
868         * .x-sc_trailing_blank: Likewise.
869
870         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
871         portability to EBCDIC hosts.
872
873 2005-03-20  Jim Meyering  <jim@meyering.net>
874
875         * src/pr.c (init_header): Add missing `%' in new format string.
876         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
877
878 2005-03-19  Jim Meyering  <jim@meyering.net>
879
880         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
881         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
882
883 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
884
885         * NEWS: pr -D "FORMAT" now accepts the same formats that
886         date +"FORMAT" does.
887         * src/pr.c: Include strftime.h, timespec.h.
888         (init_header): Obtain and format nanosecond part of time stamp.
889
890         * NEWS: nohup now ignores the umask when creating nohup.out.
891         nohup now closes stderr if it is a terminal and stdout is closed.
892         * src/nohup.c (main): Likewise.  Be a little more paranoid about
893         return values; e.g., check for any negative return from open.
894         Assume free (NULL) works.
895         Close file descriptor leak when redirecting standard output to a file.
896
897 2005-03-17  Jim Meyering  <jim@meyering.net>
898
899         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
900         in place of functionally-equivalent code.
901         * src/expand.c (parse_tab_stops, main): Likewise.
902         * src/split.c (main): Likewise.
903         * src/unexpand.c (parse_tab_stops, main): Likewise.
904         * src/uniq.c (main): Likewise.
905         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
906         declaration.
907         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
908         New macros.
909
910         Before, this command would make uniq skip 11 fields and print
911         only the first line:
912         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
913         1 1
914         1 2
915         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
916         not like `uniq -f11'.
917
918 2005-03-15  Jim Meyering  <jim@meyering.net>
919
920         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
921         `pr -0' should give a better diagnostic and `pr -03' should be
922         equivalent to `pr -3'.
923         * src/pr.c (parse_column_count): Change return type to void.
924         Call error (EXIT_FAILURE, ... for an invalid string.
925         (main): Allocate space for column_count_string using malloc.
926         Accumulate all old-style column-count digits before converting.
927         When the number of columns is specified via both old-style,
928         (e.g., -3), and a long option (--columns=5), ensure that only
929         the last one specified takes effect.
930         * tests/pr/Test.pm: Add tests for the above.
931
932 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
933
934         * src/copy.c (copy_reg): Copy regular files in binary mode.
935
936 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
937
938         * NEWS: Restate why ls limits time stamp lengths.
939
940 2005-03-12  Jim Meyering  <jim@meyering.net>
941
942         Add a little infrastructure to help prevent future bugs like the
943         one fixed below.
944         * src/stat.c (xstrcat): New function.
945         (print_statfs, print_stat): Add buf_len parameter and convert all
946         uses of strcat to xstrcat.  Update callers.
947         (print_it): Call print_func with buf_len parameter.
948
949         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
950         could cause a buffer overrun error.
951         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
952         conversion of the stat %s format string to the longer printf %llu one.
953         Patch from Guochun Shi.
954
955 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
956
957         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
958         (long_time_expected_width, print_long_format): Use it, to avoid
959         some possible denial-of-service attacks.
960         * NEWS: Document this.
961
962 2005-03-11  Jim Meyering  <jim@meyering.net>
963
964         Prompt once again for `mv -i A B' when A and B are hard links
965         to the same file.  This fixes a bug introduced by my 2003-04-04
966         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
967         * src/copy.c (abandon_move): New function, factored out of
968         copy_internal, now that this code is being used from two places.
969         (copy_internal): Perform the same interactive-related test for
970         whether it's alright to proceed and (usually) overwrite the
971         destination file.
972         * tests/mv/i-4: Add tests for the above.
973
974         Don't segfault for a very long date format string, e.g.,
975         ls -ld --time-style=+%99999999H .
976         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
977         so format string abuse cannot provoke stack overflow.
978         (print_long_format): Likewise.
979
980         Don't segfault for a long header date string, e.g.,
981         echo a|pr -D +%9999999A
982         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
983         Don't bother with fixed-sized initial buffer;  always use x*alloc.
984
985         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
986         in place of equivalent INT_STRLEN_BOUND + 1.
987         * src/expr.c (tostring, printv): Likewise.
988
989 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
990
991         * src/system.h: Include intprops.h.
992         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
993         they are now defined in intprops.h.
994
995 2005-03-09  Jim Meyering  <jim@meyering.net>
996
997         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
998
999 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
1000
1001         * src/date.c (usage): Redo to match recent documentation changes.
1002         Don't bother documenting which usages are GNU extensions; the list
1003         wasn't correct, and is better left to the printed manual anyway.
1004
1005 2005-03-06  Jim Meyering  <jim@meyering.net>
1006
1007         Factor out column-count processing.
1008         * src/pr.c: Include "inttostr.h".
1009         (parse_column_count): New function.
1010         (main): Use the new function for both old-style, -9, and long,
1011         --columns=-9, options.
1012
1013         * src/cksum.c: Remove `register' keyword.
1014         * src/cut.c: Likewise.
1015         * src/dd.c: Likewise.
1016         * src/env.c: Likewise.
1017         * src/factor.c: Likewise.
1018         * src/fmt.c: Likewise.
1019         * src/fold.c: Likewise.
1020         * src/id.c: Likewise.
1021         * src/logname.c: Likewise.
1022         * src/ls.c: Likewise.
1023         * src/pr.c: Likewise.
1024         * src/printf.c: Likewise.
1025         * src/shred.c: Likewise.
1026         * src/sort.c: Likewise.
1027         * src/sum.c: Likewise.
1028         * src/test.c: Likewise.
1029         * src/tsort.c: Likewise.
1030         * src/uniq.c: Likewise.
1031         * src/wc.c: Likewise.
1032         * src/whoami.c: Likewise.
1033
1034 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1035
1036         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1037         longer needed.
1038
1039 2005-03-01  Jim Meyering  <jim@meyering.net>
1040
1041         * src/copy.c (copy_internal): Change test of source type from
1042         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1043         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1044
1045 2005-02-28  Jim Meyering  <jim@meyering.net>
1046
1047         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1048
1049 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1050
1051         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1052         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1053         hosts with clock_gettime.
1054
1055 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1056
1057         * NEWS: Describe user-visible change to dd.
1058         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1059         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1060         gethrxtime instead.
1061         * src/dd.c: Include gethrxtime.h, xtime.h.
1062         (start_time): Now of type xtime_t, not struct timespec.
1063         (print_stats, main): Use gethrxtime rather than gettime.
1064         * src/ls.c (time): Remove obsolete decl.
1065         (get_current_time): gettimeofday always returns 0, so don't
1066         check its result.
1067         * src/shred.c: Include gethrxtime.h.
1068         (isaac_seed): Use gethrxtime rather than a mishmash.
1069         * src/touch.c (time): Remove obsolete decl.
1070
1071         * tests/misc/split-fail: Don't assume that the current host
1072         supports integers wider than 32 bits.  Fix comment typo.
1073         * tests/od/x8: Likewise.
1074
1075         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1076         as it's not valid in standard C89.
1077
1078 2005-02-15  Jim Meyering  <jim@meyering.net>
1079
1080         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1081         so that file systems of type `xfs' are recognized as such.
1082         * src/fs.h: Regenerate.
1083         Reported by Bernd Eckenfels.
1084         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1085         * src/fs.h: Regenerate.
1086         Reported by Andreas Schwab.
1087
1088         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1089         to work around the invalid definition from Darwin 7.7.0.
1090         Test failure reported by Sébastien Maret.
1091
1092 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1093
1094         * src/sort.c (mergefps): Use binary search rather than linear one
1095         when comparing new line to lines already in main memory.
1096         Idea suggested by James Lemley.
1097
1098 2005-02-09  Jim Meyering  <jim@meyering.net>
1099
1100         * src/copy.c (valid_options): Add an assertion that
1101         not both hard_link and symbolic_link are set.
1102
1103 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1104
1105         * NEWS: Document stat -f -c %S, plus changes to default formats.
1106         * doc/coreutils.texi (stat invocation): Normalize terminology,
1107         capitalization, and sort order to match --help output.  Mention %c
1108         for file systems.  Add new -f -c format %S, and document %s versus %S;
1109         problem reported by Jeroen van Wolffelaar.
1110         * src/stat.c (usage): Likewise.
1111         (STATFS_FRSIZE): New macro.
1112         (print_statfs): Use it, for stat -f -c %S.
1113         (do_statfs): Change default formats to output %S.
1114
1115 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1116
1117         * src/system.h: Include "memrchr.h".
1118         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1119
1120 2005-02-02  Jim Meyering  <jim@meyering.net>
1121
1122         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1123         systems that don't support sparse files.
1124         Check for $2 -ge 128, rather than $2 = 128, in case
1125         there is a file system type that doesn't support sparse files,
1126         yet for which metadata takes up additional space.
1127         Both reported by Andreas Schwab.
1128
1129 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1130
1131         * tests/du/8gb: Create a larger test file, so we properly
1132         detect that sparse files can be created on NTFS under cygwin.
1133
1134 2005-01-30  Jim Meyering  <jim@meyering.net>
1135
1136         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1137
1138         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1139
1140 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1141
1142         * .cvsignore: Ignore config.cache and config.status.lineno.
1143         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1144         instead of VSWTCH, for use with CSWTCH.
1145
1146 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1147
1148         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1149         * tests/rwx-to-mode: Ignore ACL designation.
1150         * tests/setgid-check: Likewise.
1151         * tests/chown/separator: Quote user and group names.
1152
1153 2005-01-24  Jim Meyering  <jim@meyering.net>
1154
1155         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1156         Suggestion from Johan Boule.
1157
1158 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1159
1160         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1161         duplicates.
1162         * man/Makefile.am (all_programs): Revert previous patch; updated
1163         all_programs.list fixes this.
1164         (.x.1): No need to add $(EXEEXT).
1165
1166 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1167
1168         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1169         available.
1170
1171 2005-01-22  Jim Meyering  <jim@meyering.net>
1172
1173         * Makefile.maint (v_etc_file): The version string has moved to
1174         version-etc-fsf.c, search that new file, not version-etc.c.
1175
1176 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1177
1178         * tests/group-names: Use numeric group ids, not symbolic group names,
1179         since the latter can have shell metacharacters in them (e.g., spaces).
1180         Problem reported by Eric Blake.
1181         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1182         * tests/chgrp/deref: Likewise.
1183         * tests/chgrp/posix-H: Likewise.
1184         * tests/chgrp/recurse: Likewise.
1185
1186 2005-01-15  Jim Meyering  <jim@meyering.net>
1187
1188         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1189         because just calling gethrtime evokes an `illegal instruction'
1190         failure when compiled with Sun's c89 on Solaris 8 and 9.
1191         Reported by Nelson Beebe.
1192
1193         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1194         twice with the same value of `t'.
1195         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1196
1197 2005-01-14  Jim Meyering  <jim@meyering.net>
1198
1199         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1200         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1201         sockets, since that's what you get when reading from a command-line-
1202         supplied pipe on Darwin 7.7.
1203         (IS_PIPE_LIKE_FILE_TYPE): Define.
1204         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1205         Reported by Nelson Beebe.
1206         This same change is also required on NetBSD/sparc-1.5.
1207         Reported by Adrian Bunk.
1208
1209         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1210         rather than suffering silently.
1211         Before, expr would silently overflow and wrap around:
1212           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1213           1
1214         Now it detects the problem and exits nonzero:
1215           $ ./expr $(echo 2^63|bc) = 0
1216           ./expr: 9223372036854775808: integer is too large
1217
1218         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1219         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1220         reported that this test would fail with the diagnostic,
1221         `cannot find name for group ID 10', on one of his systems.
1222
1223 2005-01-13  Jim Meyering  <jim@meyering.net>
1224
1225         * src/test.c (is_int): Don't overflow when evaluating integer
1226         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1227         would print `FAIL'.
1228
1229         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1230         names of temporary files that would clash on 8.3 file systems.
1231         * tests/mk-script (validate): Likewise.
1232
1233 2005-01-12  Jim Meyering  <jim@meyering.net>
1234
1235         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1236
1237         * tests/tr/Test.pm (repeat-xC): Change test name from
1238         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1239         Reported by Eric Blake.
1240         (repeat-000): Rename to `repeat-zeros' for the same reason.
1241
1242 2005-01-11  Jim Meyering  <jim@meyering.net>
1243
1244         * configure.ac: Update version to 5.3.1.
1245
1246 2005-01-11  Eric Blake  <ebb9@byu.net>
1247
1248         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1249         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1250
1251 2005-01-11  Jim Meyering  <jim@meyering.net>
1252
1253         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1254         with decreasing values.
1255
1256         * src/expand.c (main): Likewise.
1257         * src/unexpand.c (main): Check for overflow in tabstop values
1258         specified via the obsolete form.  E.g., now this command fails:
1259         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1260         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1261         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1262
1263 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1264
1265         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1266         * NEWS: Document the changes.
1267         * doc/coreutils.texi (pathchk invocation): Likewise.
1268         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1269         (longopts, usage, main, validate_file_name):
1270         Add support for new -P option.
1271         Reject empty file names (unless -p is not specified and the
1272         current system allows empty file names).
1273         Change --portability so that is now equivalent to -p -P.
1274         Don't test whether file name is too long, if it is known to exist.
1275         (no_leading_hyphen): New function.
1276         * tests/misc/pathchk1: Add tests for empty file names and
1277         pathchk -P.
1278
1279 2005-01-08  Jim Meyering  <jim@meyering.net>
1280
1281         * Version 5.3.0.
1282
1283         `pr --columns=N' was not equivalent to `pr -N' when also using
1284         either -s or -w.
1285
1286         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1287         not just for -N.  This bug has existed since the introduction
1288         of the --columns=N option on 1998-08-15.
1289         * NEWS: Document this.
1290         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1291         create a new test vector using --columns=N.
1292
1293 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1294
1295         * src/pr.c (main): Check for column count overflow with
1296         usages like "pr -2147483648".
1297
1298 2005-01-07  Jim Meyering  <jim@meyering.net>
1299
1300         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1301
1302 2005-01-06  Jim Meyering  <jim@meyering.net>
1303
1304         * README: List the precise HP-UX version numbers that are affected.
1305         Suggestion from Bob Proulx.
1306
1307         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1308         predicate before `-name ChangeLog' to avoid a harmless warning
1309         from find-4.2.10.
1310
1311 2005-01-05  Jim Meyering  <jim@meyering.net>
1312
1313         * tests/help-version: Punt on the uptime test, since it fails when
1314         it can't get boot time, and I don't want that to stop `make check'.
1315
1316         * src/du.c (process_file): Evaluate exclusion rules against
1317         the entire file name, not just the last component.
1318         Reported by Robert Lindgren.
1319         * tests/du/exclude: Test for this.
1320         * NEWS: Document this.
1321
1322         Ensure that tests/Makefile.am's check-root actions stay up to date.
1323         * Makefile.maint (sc_root_tests): New rule.
1324         (syntax-check-rules): Add it to the list.
1325
1326 2005-01-04  Jim Meyering  <jim@meyering.net>
1327
1328         * man/shred.x: Change one-line summary to reflect that shred does
1329         not remove files by default.  Suggestion from Helen Faulkner in
1330         http://bugs.debian.org/288552
1331
1332         * README: Request VERBOSE=yes output when reporting test failures.
1333         Other minor changes.
1334
1335         * tests/Makefile.am (check-root): Update.
1336
1337 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1338
1339         * src/system.h: Undo previous change; we now use Autoconf.
1340
1341 2005-01-03  Jim Meyering  <jim@meyering.net>
1342
1343         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1344         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1345         either (or both) to zero would succeed, but subsequent `stty size'
1346         would say `no size information for this device' due to the ioctl
1347         failing with EINVAL.
1348
1349         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1350         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1351         then fail at compile-time rather than let tools like od produce
1352         invalid results at run time.
1353
1354 2004-12-21  Jim Meyering  <jim@meyering.net>
1355
1356         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1357         not `xx01, xx02, ...'.
1358         Reported by Matt Kraai in http://bugs.debian.org/286605
1359
1360         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1361         when using c89.
1362
1363 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1364
1365         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1366
1367 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1368
1369         * NEWS: Mention that one should eval "`dircolors`" rather than
1370         `dircolors`.
1371
1372 2004-12-17  Jim Meyering  <jim@meyering.net>
1373
1374         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1375         so temporary directories aren't left behind upon e.g., interrupt.
1376
1377 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1378
1379         * src/ls.c (print_dir): Use "%s: not listing already-listed
1380         directory", not "not listing already-listed directory: %s", to
1381         format already-listed directories, to be consistent with other
1382         diagnostics involving file names and colons.
1383
1384 2004-12-15  Jim Meyering  <jim@meyering.net>
1385
1386         * src/Makefile.am (__LDADD): Define, so that building `[' on
1387         Solaris still uses the -lgen library that it requires in order
1388         to get a definition of eaccess.
1389
1390 2004-12-14  Jim Meyering  <jim@meyering.net>
1391
1392         tac would exit immediately upon I/O or temp-file creation failure.
1393         Now it continues on, processing any remaining command line arguments.
1394
1395         * src/tac.c: Include quotearg.h.
1396         Use quotearg_colon in most diagnostics.
1397         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1398         failure.  Before, this command (with /full/tmp being a full partition)
1399           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1400         would exit immediately upon the write error while trying to copy
1401         non-seekable /proc/modules to the full partition.  Now it still
1402         reports the failure but continues on with the remaining file.
1403         (tac_nonseekable): Return false also if copy_to_temp fails.
1404         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1405         using atexit like this is wrong.
1406         * NEWS: Document this.
1407         * tests/misc/tac-continue: New test for this.
1408         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1409
1410         * tests/chown/basic: Add a few more tests.
1411
1412 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1413
1414         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1415         rather than explicit_arg, for consistency with copy.c.
1416         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1417         it is deducible from dirname arg.  All callers changed.
1418         (extract_dirs_from_files, print_dir, queue_directory):
1419         Add command_line_arg arg.  All callers changed.
1420         (struct pending): Add command_line_arg member.
1421         (main): Use NULL rather than 0 when appropriate.
1422         (set_exit_status, file_failure): New functions.
1423         (queue_directory): Store command_line_arg into new structure.
1424         (print_dir, gobble_file, get_link_name):
1425         Use file_failure to report problems in accessing files,
1426         so that the exit status is set consistently.
1427         (print_dir): Simplify readdir failure code yet again.
1428         If closedir fails, report "closing directory" rather than "reading
1429         directory" failure.
1430         (xstrcoll): Use set_exit_status to set status on failure.
1431         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1432         not status 1.
1433
1434 2004-12-11  Jim Meyering  <jim@meyering.net>
1435
1436         Avoid a race condition vulnerability in chown, when used with
1437         --from=O:G and without the (-h) --no-dereference option.
1438         * src/chown-core.c (restricted_chown): New function.
1439         (change_file_owner): Call it.
1440         Reported by Ulrich Drepper.
1441         * NEWS: Mention this.
1442
1443 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1444
1445         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1446         * NEWS: Document this.
1447         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1448         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1449         specified below.
1450         (main): Initialize exit failure to LS_FAILURE.
1451         (print_dir, gobble_file, get_link_name, xstrcoll):
1452         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1453         (print_dir): Do not give up on entire directory merely because readdir
1454         returns EOVERFLOW.
1455         (usage): Explain exit status.
1456         * tests/help-version: ls and variants now exit with status 2
1457         on serious trouble.
1458
1459 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1460
1461         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1462         together.
1463
1464 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1465
1466         * src/factor.c (factor): Don't list 1 as a factor of 1.
1467         Problem reported by Thomas Folz-Donahue.
1468
1469 2004-12-06  Jim Meyering  <jim@meyering.net>
1470
1471         * tests/du/files0-from: Sanitize environment.
1472         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1473         setting is the default (exported from /etc/profile) on at least one
1474         NetBSD 1.6 system.
1475         * tests/du/no-deref: Likewise.
1476         * tests/cp/symlink-slash: Likewise.
1477         * tests/ls/symlink-slash: Likewise
1478
1479 2004-12-05  Jim Meyering  <jim@meyering.net>
1480
1481         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1482         _POSIX2_VERSION=199209 is in the environment, or when building on
1483         e.g., OpenBSD 3.2.
1484
1485 2004-12-04  Jim Meyering  <jim@meyering.net>
1486
1487         * NEWS: Mention cut's new --complement option.
1488
1489 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1490
1491         * cut.c (complement, COMPLEMENT_OPTION): New.
1492         (longopts): Add --complement.
1493         (usage): Say not that -b, -c, and -f `print' fields,
1494         but rather that they `select' fields for printing.
1495         Describe the new --complement option.
1496         (mark_range_start): Extracted from set_fields.
1497         (print_kth): Support --complement.
1498         (compare_ranges): New function.
1499         (set_fields): Rewrite the part that populates range_start_ht,
1500         merging it with the part that populates printable_field.
1501         (main): Handle --complement.
1502
1503 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1504
1505         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1506         failed.  This works around an assertion failure reported by
1507         Roberto Nibali in:
1508         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1509
1510 2004-12-02  Jim Meyering  <jim@meyering.net>
1511
1512         With using --color and with LS_COLORS saying not to color
1513         executables, don't stat every file.
1514         * src/ls.c (is_colored): New function.
1515         (gobble_file): Use it.
1516         (main): Use it here, in place of too-strict tests against NULL:
1517         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1518         old test would fail.
1519
1520 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1521
1522         * src/comm.c (compare_files): Assume setlocale exists.
1523         * src/join.c (keycmp): Likewise.
1524         * src/seq.c (decimal_point): Treat like sort.  Now char.
1525         All uses changed.
1526         (main): Assume localeconv exists.  Use same code as sort.
1527         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1528         Assume setlocale exists.
1529         (thousands_sep): Renamed from th_sep.
1530         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1531         (NONZERO): Parenthesize use of arg.
1532         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1533         consistency.  Avoid unnecessary negation by reversing
1534         fraccompare args.
1535         (main): Rewrite localeconv call to match seq.c.
1536         * src/system.h: Assume locale.h exists.
1537         (HAVE_SETLOCALE): Remove.
1538         * src/uniq.c (different): Assume setlocale exists.
1539
1540         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1541         'volatile' on a local variable.  Rewrite to avoid unnecessary
1542         double-assignment to 'func' in the usual case where strcoll does
1543         not fail.
1544
1545 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1546
1547         * src/pinky.c (gethostname): Remove decl.
1548         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1549         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1550         UT_TYPE_BOOT_TIME instead of by-hand code.
1551         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1552         instead of by-hand code.
1553         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1554         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1555         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1556         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1557         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1558         (gethostname): Remove decl.
1559         (list_entries_who, scan_entries): Use the new macros defined above,
1560         for consistency with pinky, uptime, and users.
1561
1562 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1563
1564         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1565         HP's ANSI C compiler.  Declaring int functions causes warnings on
1566         some modern systems and shouldn't be needed to compile on ancient
1567         ones.
1568         * src/copy.h (stat, lstat, rename): Remove decls.
1569         * src/install.c (stat): Remove decl.
1570         * src/ln.c (link, symlink): Remove decls.
1571
1572 2004-11-25  Jim Meyering  <jim@meyering.net>
1573
1574         * man/help2man: Import help2man-1.35.1.
1575         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1576         locally-added --program-name=NAME option.  Now, help2man gets
1577         the name from the [NAME] section (i.e. from our .x file).
1578         * man/install.x: Use `install', not `ginstall' in the one-line
1579         description.  Reported by Brendan O'Dea.
1580         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1581
1582 2004-11-24  Jim Meyering  <jim@meyering.net>
1583
1584         Since the changes of 2004-05-22, the u.saved_cwd member at
1585         the bottom of the active-directory stack was no longer
1586         strictly necessary.  This change removes that member and uses
1587         the newer cwd_state parameter for the final restore_cwd.
1588
1589         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1590         [dev_ino]: Rename from `a'.
1591         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1592         bottom-of-stack cwd-state member.
1593         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1594         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1595
1596 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1597
1598         Minor performance improvements and cleanups for "touch".
1599         * src/touch.c (posix_date): Remove; not needed as a static var.
1600         All uses rewritten.
1601         (touch): Use new futimens function to operate more efficiently
1602         in some cases.  Don't stat/fstat existing file when
1603         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1604         old time stamps aren't needed in that case.
1605         (main): change_times is int, not bool.  Simplify test for
1606         change_times.
1607
1608 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1609
1610         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1611         translation.  Problem reported by Eric S. Raymond.
1612
1613         Restore dd's noctty flag, reverting the change of 2004-04-08.
1614         POSIX does not allow "dd" to use O_NOCTTY by default.
1615         * NEWS: Add noctty flag to dd.
1616         * doc/coreutils.texi (dd invocation): Likewise.
1617         * src/dd.c (flags, usage, main): Likewise.
1618
1619 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1620
1621         * src/ls.c (usage): Clarified description of --no-group (-G),
1622         --human-readable (-h), --inode (-i), --size (-s), --time,
1623         and --time-style.
1624
1625 2004-11-19  Jim Meyering  <jim@meyering.net>
1626
1627         * src/ls.c (usage): Clarify description of --author.
1628         Tweak indentation so that help2man creates better nroff.
1629         Reported by Dan Jacobson.
1630
1631         * src/uniq.c (check_file): Don't check stdout for errors here.
1632
1633         * src/pwd.c (find_dir_entry): Update comment to match reality.
1634
1635 2004-11-18  Jim Meyering  <jim@meyering.net>
1636
1637         * src/pwd.c (robust_getcwd): Correct the comment: this function
1638         constructs the directory name.  The caller prints it.
1639
1640 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
1641
1642         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1643         (do_statfs): Use it.
1644
1645         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1646         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1647         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1648         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1649         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1650         * src/readlink.c (main): argv is not const.
1651
1652         * src/cut.c (usage): Improve documentation along the lines suggested
1653         by Debian 5.2.1-2.
1654         * src/echo.c (usage): Likewise.
1655         * src/expr.c (usage): Likewise.
1656
1657         * src/dircolors.hin: Add putty, screen-bce.
1658
1659         * src/pinky.c (print_entry): Fix memory leak.
1660         * src/who.c (print_user): Likewise.
1661
1662 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1663
1664         * NEWS: New dd operand "status=noxfer".
1665         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1666         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1667         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1668         macros.
1669         (STATUS_NOXFER, statuses): New constants.
1670         (usage, print_stats, scanargs): Add support for status=noxfer.
1671         (usage): Update status output to match new behavior.
1672         (print_stats): Always output complete byte count.
1673         Put space between numbers and units, as SI requires.
1674         Use ngettext so that i18n can use plurals for "byte" and "second".
1675         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1676         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1677         the string.
1678         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1679         problems with regression testing.
1680
1681 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
1682
1683         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1684         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1685         * src/dd.c: Include "human.h".
1686         (w_bytes, start_time): New vars.
1687         (usage): Document new I/O statistics output
1688         (print_stats): Output new I/O statistics.
1689         (cleanup): Do statistics after closing stdin and stdout, so that
1690         the times are more accurate.
1691         (write_output, dd_copy): Count output bytes.
1692         (main): Get initial value of clock.
1693
1694 2004-11-14  Jim Meyering  <jim@meyering.net>
1695
1696         Backslash-escape `-'s in email addresses, so that they are
1697         rendered properly in UTF-locales.
1698         * man/help2man (escape_hyphens): New function.
1699         (main): Call it on email addresses.
1700
1701         * src/sort.c (zaptemp): Mark new diagnostic for translation.
1702
1703         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
1704         * tests/misc/Makefile.am (TESTS): Add close-stdout.
1705
1706 2004-11-13  Jim Meyering  <jim@meyering.net>
1707
1708         * src/test.c (usage): Put the description of `[-n] STRING'
1709         on two lines, one for `-n STRING' and one for `STRING' so that
1710         help2man properly escapes the `-'.  Otherwise, the hyphen is
1711         rendered inappropriately in UTF-8 locales.
1712         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1713
1714 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
1715
1716         * NEWS: Document the following changes.
1717
1718         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1719         files.
1720         (temptail): New variable, so that we can easily append to list.
1721         (create_temp_file): Create new files at end of list, so that
1722         searching the list has O(N*NMERGE) behavior instead of O(N**2).
1723         (zaptemp): Update temptail if needed.
1724         (mergefps, merge): Accept new arg that counts temp files, and keep it
1725         up to date as we create and remove temporaries.  This is for
1726         efficiency, so that we don't call zaptemp so often.
1727         All callers changed.
1728         (sort): Don't create array in reverse order, since the list of
1729         temporaries is now in the correct order.
1730
1731         (zaptemp): Protect against race condition: if 'sort' is
1732         interrupted in the middle of zaptemp, it might unlink the
1733         temporary file twice, and the second time this happens the file
1734         might already have been created by some other process.
1735
1736         (zaptemp): Warn if a temporary file is not removed.
1737
1738         (create_temp_file): Use offsetof for clarity.
1739         (die): Move it up earlier, to clean up the code a bit.
1740
1741         * src/pr.c (strtoumax): Declare if not declared.
1742         (skip_to_page, first_page_number, last_page_number, page_number,
1743         first_last_page, print_header):
1744         Use uintmax_t for page numbers.
1745         (first_last_page): Remove unnecessary forward declaration.
1746         Do not modify arg (it is now a const pointer).
1747         Return a true if successful, false (without print a diagnostic)
1748         otherwise.
1749         (main): If +XXX does not specify a valid page range, treat it
1750         as a file name.  This follows the response to Open Group XCU ERN 41
1751         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1752         which says the behavior is allowed.
1753         (skip_to_page): When starting page number exceeds page count,
1754         print both numbers in the diagnostic.
1755         (print_header): Detect page number overflow.
1756
1757 2004-11-07  Jim Meyering  <jim@meyering.net>
1758
1759         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1760         (main) [__APPLE__]: Get the processor type via syscall rather than
1761         hard-coding "powerpc".  From Toby Peterson.
1762
1763         * src/sort.c (merge): Remove declarations of now-unused variables.
1764
1765 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
1766
1767         * src/sort.c (first_same_file): Remove.  Move most of the code to....
1768         (avoid_trashing_input): New function.
1769         (merge): Avoid some silly merges, e.g., copying a single file to
1770         a temporary file when there are exactly 17 input files to merge.
1771         Take a count of temporary files rather than a max_merge arg.
1772         All uses changed.
1773
1774 2004-11-06  Jim Meyering  <jim@meyering.net>
1775
1776         * src/sort.c (xfclose): Don't close stdout here (just flush it),
1777         since close_stdout now closes stdout unconditionally.
1778
1779 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
1780
1781         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1782         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1783         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1784         temporary files).
1785         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1786         thus avoiding unchecked stack overflow in some cases.  As a side
1787         effect this improve the performance of "sort -M" by a factor of 4
1788         on my benchmarks.
1789
1790 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
1791
1792         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1793
1794         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1795         expression; it's not portable.  Problem reported by Albert Chin.
1796         Don't invoke a program more than once.
1797         * src/groups.sh (version): New variable, containing author info,
1798         for benefit of AUTHORS check.  Use it when acting on --version option.
1799         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
1800         in groups line.
1801
1802         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1803         as this breaks the new regime that does "#define getopt rpl_getopt".
1804         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1805         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1806         I suppose this may cause problems on ancient hosts with
1807         incompatible getopt declarations, but we'll cross that bridge if
1808         the problem gets reported to us by someone who can test the fix.
1809
1810 2004-11-03  Jim Meyering  <jim@meyering.net>
1811
1812         * src/tac.c: quote(...) file names in diagnostics.
1813
1814 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
1815
1816         * NEWS: Document getdate changes.
1817
1818 2004-10-29  Jim Meyering  <jim@meyering.net>
1819
1820         * src/tac.c (tac_file): Remove temporary prototype and move this
1821         function `down' so that it precedes definition of tac_nonseekable.
1822
1823         `tac /proc/modules' would print nothing
1824         Reported by Harald Dunkel in http://bugs.debian.org/278604.
1825
1826         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1827         now it copies a general file descriptor, not just stdin.
1828         (tac_nonseekable): Renamed/adapted from tac_stdin.
1829         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1830         since we never used the stream.  Perform "-" to stdin mapping here
1831         rather than in main.  Determine whether a file is seekable,
1832         by trying to `lseek' to its end, and dispatch to tac_seekable or
1833         tac_nonseekable accordingly.
1834         (main): Rewrite argument handling now that it uses only tac_file.
1835         * NEWS: Mention it here.
1836
1837 2004-10-21  Jim Meyering  <jim@meyering.net>
1838
1839         * tests/mv/leak-fd: New file.
1840         * tests/mv/Makefile.am (TESTS): Add it.
1841         * tests/rm/dot-rel: New file.
1842         * tests/rm/Makefile.am (TESTS): Add it.
1843
1844         Correct my patch of 2004-10-18.
1845         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1846         if necessary, not in remove_dir.  Otherwise, removing multiple
1847         `.'-relative nonempty directories no longer worked.
1848
1849 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
1850
1851         * src/fmt.c (usage): Improve description of --prefix.
1852         Problem reported by Edward Welbourne.
1853
1854         * man/uniq.x: Change summary so that it doesn't imply that
1855         uniq writes to its input file.  Problem reported by
1856         Dan Jacobson.
1857
1858 2004-10-18  Jim Meyering  <jim@meyering.net>
1859
1860         Plug a leak that would cause a cross-device mv to fail when
1861         operating on too many command-line-specified nonempty directories.
1862         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1863         top of the stack before returning.  This usually closes the file
1864         descriptor that was used to return to the original working directory.
1865         Reported by Cyril Bouthors in
1866         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1867         * NEWS: Mention it here.
1868
1869         * src/pathchk.c (validate_file_name): Give a more descriptive
1870         diagnostic when pathconf fails.  This also avoids an unwarranted
1871         warning from gcc-3.3.5 about a format not being a string literal.
1872
1873         * src/sleep.c (main): Remove declaration of unused local, c.
1874         * src/printenv.c (main): Likewise.
1875         * src/logname.c (main): Likewise.
1876         * src/uptime.c (main): Likewise, for optc.
1877         * src/tsort.c (main): Likewise, for opt.
1878
1879 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
1880
1881         * AUTHORS: Add self to pathchk.
1882         * src/pathchk.c (AUTHORS): Add self.
1883         Change "path" to "file name" whenever possible.
1884         Remove usage comment, as it was a duplication of the code or doc.
1885         Include <wchar.h> if available.
1886         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1887         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1888         pathconf_wrapper, portable_chars, dir_ok): Remove.
1889         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1890         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1891         (portable_chars_only): New arg FILELEN.
1892         Don't assume ASCII; we might be on an EBCDIC host.
1893         Don't assume unibyte locale in diagnostic.
1894         (component_start, component_len): New functions.
1895         (validate_file_name): Renamed from validate_path.  All uses changed.
1896         Pretty much a complete rewrite.
1897         Don't make copy of file arg.  Always append trailing slash to
1898         pathconf arg, just in case it's a symlink (this is pure paranoia;
1899         we don't know of any hosts where the trailing slash is required).
1900         Use size_t instead of long int when possible.
1901         Avoid need to call pathconf in most practical cases.
1902         Don't use euidaccess several times to test searchability;
1903         just use lstat once.  Reword diagnostic to put the (often very long)
1904         file names last.
1905
1906 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
1907
1908         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1909
1910 2004-10-13  Jim Meyering  <jim@meyering.net>
1911
1912         * NEWS: Mention today's fts.c fix.
1913
1914 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
1915
1916         * tests/stty/row-col-1: Set LC_ALL=C.
1917
1918 2004-10-12  Jim Meyering  <jim@meyering.net>
1919
1920         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
1921         From Jesus Climent in http://bugs.debian.org/276149.
1922
1923 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
1924
1925         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
1926         problems.  All uses changed.
1927
1928 2004-10-05  Jim Meyering  <jim@meyering.net>
1929
1930         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
1931         since Karl says its trailing blanks are there to stay :-)
1932
1933 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
1934
1935         * src/expr.c (NEW, OLD): Remove, partly to avoid
1936         reference to obsolescent macro XMALLOC.
1937         All uses replaced by xmalloc and free.
1938
1939 2004-09-28  Jim Meyering  <jim@meyering.net>
1940
1941         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
1942         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
1943
1944 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
1945
1946         * src/od.c (format_address_paren): c is optional, so don't output
1947         it if it's '\0'.
1948
1949 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
1950
1951         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
1952         * NEWS: Document this.
1953         * src/ls.c (file_ignored): Renamed from file_interesting, with
1954         inverted return value.  Accept the file name, not a struct dirent *.
1955         All uses changed.  Avoid the expense of calling fnmatch if the
1956         file is ignorable due to leading '.'.
1957         (all_files, really_all_files): Removed; replaced by:
1958         (ignore): New variable.  All uses changed.
1959         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
1960         New constants.
1961         (hide_patterns): New variable.
1962         (long_options, decode_switches, file_ignored, usage):
1963         Add support for --hide.
1964         (patterns_match): New function.
1965         (usage): Replace "hide" with "ignore" in explanation, to avoid
1966         confusion.
1967
1968 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
1969
1970         * src/ls.c (gobble_file, print_long_format): Don't assume that
1971         human-readable output has a byte count equal to its column width;
1972         this isn't always true in locales where the radix character is not
1973         '.' or ','.
1974         (format_user_or_group): Revamp code to match the above fix;
1975         this avoids the (very faint) possibility of integer overflow.
1976
1977 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
1978
1979         * NEWS: Mention that "chmod -r -w x" now works as expected.
1980         * src/chmod.c (main): Revamp option processing to support this.
1981         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
1982         * tests/chmod/usage: New set of tests for usage like that.
1983
1984 2004-09-24  Jim Meyering  <jim@meyering.net>
1985
1986         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
1987         it lists only cvs-controlled regular files.
1988
1989         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
1990         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
1991
1992 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
1993
1994         * Makefile.maint (CVS_LIST): New macro.
1995         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
1996         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
1997         sc_trailing_blank, po-check): Use it instead of the
1998         nonstandard "cvsu --list".
1999
2000         * src/tail.c (parse_obsolete_option): Bring back support
2001         for obsolete option followed by non-obsolete, or by more
2002         than one file.  When obsolete, conform to SUSv2 rather than
2003         original POSIX 1003.2-1992, as SUSv2 corrected the case of
2004         "tail -c".  Add support for the SUSv2 "b" modifier.
2005         * NEWS: Mention the above.
2006         * tests/tail/Test.pm: New test case obs-b to check the above.
2007         err-[134] no longer need _POSIX2_VERSION=199209.
2008         Fix comments to match revised behavior.
2009
2010 2004-09-22  Jim Meyering  <jim@meyering.net>
2011
2012         * Use automake-1.9.2.  Regenerate dependent files.
2013
2014         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2015         Improve the comment.
2016
2017         Clean up scoping etc. so that some make `distcheck' tests pass.
2018         * src/csplit.c (xalloc_die): Declare to be static.
2019         * src/chown-core.c (chown_files): Declare as `extern'.
2020         * src/cp-hash.c (remember_created): Likewise.
2021         * src/copy.c (copy): Likewise.
2022         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2023
2024         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2025         * src/unexpand.c: Likewise.
2026
2027         * src/Makefile.am (check-AUTHORS): New rule.
2028         (check): Depend on it.
2029         * AUTHORS: Update.
2030
2031         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2032         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2033
2034 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2035
2036         * src/ls.c (decode_switches): Don't compare a short value
2037         to SIZE_MAX: GCC sometimes complains.
2038
2039 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2040
2041         * NEWS: The following commands now reject unknown options:
2042         basename dirname factor hostname link nohup sync unlink yes
2043         Also, pathchk no longer accepts trailing options.
2044
2045         * src/basename.c: Include <getopt.h>.
2046         * src/chroot.c: Likewise.
2047         * src/dirname.c: Likewise.
2048         * src/factor.c: Likewise.
2049         * src/hostid.c: Likewise.
2050         * src/hostname.c: Likewise.
2051         * src/nohup.c: Likewise.
2052         * src/pwd.c: Likewise.
2053         * src/setuidgid.c: Likewise.
2054         * src/sync.c: Likewise.
2055
2056         * src/basename.c (main): Reject unknown options.
2057         * src/dirname.c (main): Likewise.
2058         * src/factor.c (main): Likewise.
2059         * src/hostid.c (main): Likewise.
2060         * src/hostname.c (main): Likewise.
2061         * src/link.c (main): Likewise.
2062         * src/nohup.c (main): Likewise.
2063         * src/pwd.c (main): Likewise.
2064         * src/setuidgid.c (main): Likewise.
2065         * src/sync.c (main): Likewise.
2066         * src/unlink.c (main): Likewise.
2067         * src/yes.c (main): Likewise.
2068
2069         * src/cat.c (main): Remove unused "case 0".
2070         * src/chgrp.c (main): Likewise.
2071         * src/chmod.c (main): Likewise.
2072         * src/chown.c (main): Likewise.
2073         * src/comm.c (main): Likewise.
2074         * src/cp.c (main): Likewise.
2075         * src/csplit.c (main): Likewise.
2076         * src/cut.c (main): Likewise.
2077         * src/date.c (main): Likewise.
2078         * src/df.c (main): Likewise.
2079         * src/du.c (main): Likewise.
2080         * src/env.c (main): Likewise.
2081         * src/expand.c (main): Likewise.
2082         * src/fold.c (main): Likewise.
2083         * src/head.c (main): Likewise.
2084         * src/id.c (main): Likewise.
2085         * src/install.c (main): Likewise.
2086         * src/join.c (main): Likewise.
2087         * src/ln.c (main): Likewise.
2088         * src/ls.c (decode_switches): Likewise.
2089         * src/mkdir.c (main): Likewise.
2090         * src/mkfifo.c (main): Likewise.
2091         * src/mknode.c (main): Likewise.
2092         * src/mv.c (main): Likewise.
2093         * src/nl.c (main): Likewise.
2094         * src/paste.c (main): Likewise.
2095         * src/pinky.c (main): Likewise.
2096         * src/pr.c (main): Likewise.
2097         * src/ptx.c (main): Likewise.
2098         * src/readlink.c (main): Likewise.
2099         * src/rm.c (main): Likewise.
2100         * src/rmdir.c (main): Likewise.
2101         * src/seq.c (main): Likewise.
2102         * src/shred.c (main): Likewise.
2103         * src/split.c (main): Likewise.
2104         * src/sum.c (main): Likewise.
2105         * src/tac.c (main): Likewise.
2106         * src/tail.c (main): Likewise.
2107         * src/tee.c (main): Likewise.
2108         * src/touch.c (main): Likewise.
2109         * src/tr.c (main): Likewise.
2110         * src/tty.c (main): Likewise.
2111         * src/uname.c (main): Likewise.
2112         * src/unexpand.c (main): Likewise.
2113         * src/wc.c (main): Likewise.
2114         * src/who.c (main): Likewise.
2115
2116         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2117         * src/cksum.c (main): Likewise.
2118         * src/dd.c (main): Likewise.
2119         * src/logname.c (main): Likewise.
2120         * src/printenv.c (main): Likewise.
2121         * src/sleep.c (main): Likewise.
2122         * src/tsort.c (main): Likewise.
2123         * src/uptime.c (main): Likewise.
2124         * src/users.c (main): Likewise.
2125         * src/whoami.c (main): Likewise.
2126
2127         * src/du.c (long_options): Standardize on NULL vs 0.
2128         * src/rm.c (long_opts): Likewise.
2129
2130         * src/logname.c (long_options): Remove.
2131         * src/printenv.c (long_options): Likewise.
2132         * src/sleep.c (long_options): Likewise.
2133         * src/tsort.c (long_options): Likewise.
2134         * src/uptime.c (longopts): Likewise.
2135         * src/users.c (longopts): Likewise.
2136         * src/whoami.c (long_options): Likewise.
2137
2138         * src/pathchk.c (longopts): Add --help, --version.
2139         (main): Use longopts rather than parse_long_options.
2140         * src/stty.c (longpts, main): Likewise.
2141
2142         * src/pathchk.c (main): Don't reorder arguments, so that
2143         we can check weird file names.
2144
2145         * src/readlink.c: Don't include "long-options.h".
2146         * src/sort.c: Likewise.
2147         * src/stty.c: Likewise.
2148
2149         * src/split.c (verbose): Now bool, not int.
2150         (VERBOSE_OPTION): New enum.
2151         (longopts, main): Use it.
2152
2153         * tests/factor/basic: Adjust to new wording in diagnostic
2154         that results from the above changes.
2155
2156 2004-09-21  Jim Meyering  <jim@meyering.net>
2157
2158         * man/rm.x: Say "the response is affirmative" rather than "the
2159         response begins with y or Y", so that the documentation is
2160         accurate in non-English locales.  Problem reported by Munzir Taha.
2161
2162 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2163
2164         * src/echo.c (main): Don't pass NULL to strcmp when
2165         POSIXLY_CORRECT and given no arguments.
2166
2167         * src/md5sum.c (STRING_OPTION): Remove.
2168         (long_options, main): Remove support for undocumented and
2169         obsolete --string option, as suggested in the 1996-09-26 patch.
2170         * NEWS: Document this.
2171
2172         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2173         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2174         you remove such files.  Problem reported by Bert Fischer in:
2175         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2176
2177 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2178
2179         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2180         (long_options, main): Use them instead of magic numbers 2 and 1.
2181         For --string, optarg can't possibly be NULL.
2182
2183         * src/dd.c (usage): Distinguish between options and operands.
2184         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2185         Say "operands" for operands, not "options".
2186         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2187         * tests/dd/misc: Check for "dd --".
2188
2189         * src/chroot.c (main): Reject unknown options instead of
2190         interpreting them as a directory to chroot to.
2191
2192         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2193         The current standard (POSIX 1003.1-2004) is correct.
2194         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2195         collision with builtin function.
2196         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2197         output the first 0 as 8 digits, to make it easier to compare to
2198         the text of the standard.  Output crctab to be a const array.
2199         (crctab): Use result of above changes.
2200         (long_options): Remove; not needed if empty.
2201         (main): getopt_long can't return 0 here, so simplify the code.
2202
2203 2004-09-13  Jim Meyering  <jim@meyering.net>
2204
2205         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2206
2207 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2208
2209         * src/id.c (print_full_info): Don't exit with failure status simply
2210         because a user or group number can't be turned into a name.
2211         Problem reported by Felipe Kellermann in:
2212         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2213
2214 2004-09-12  Jim Meyering  <jim@meyering.net>
2215
2216         * Makefile.maint (my-distcheck): When building with -Werror, also
2217         require -Wshadow.
2218
2219 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2220
2221         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2222         * src/tail.c (parse_obsolete_option): Renamed from
2223         parse_obsolescent_option, since the options are obsolete now.
2224         Remove bool *arg; just exit if there's an error.  Revamp to follow
2225         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2226         file" and "tail -10 -- file" correctly when we are conforming to
2227         the older standard.
2228         (main): Adjust to this change.
2229         * tests/tail/Test.pm (test_vector): minus-* requires
2230         _POSIX2_VERSION=199209 now, to work correctly if there is
2231         an input file.  err-1 and err-3 no longer errors if there
2232         is another file.
2233
2234 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2235
2236         * src/test.c (usage): Document -r, -w, -x more carefully.
2237
2238 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2239
2240         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2241         Document that -h and -L don't dereference.
2242
2243         * NEWS: Document that "tr xy -z" now works as per POSIX.
2244         Sort the descriptions.
2245         * src/tr.c (main): Don't reorder options.
2246         * tests/tr/Test.pm (fowler-1): New test case.
2247
2248 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2249
2250         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2251         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2252         conforming to pre-2001 POSIX.
2253         * NEWS: Document this.
2254         * tests/touch/obsolescent: Test for this bug.  Also, set
2255         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2256         a better test for obsolescent features.
2257
2258         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2259         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2260         plain "sort".
2261
2262         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2263         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2264         (long_options, main): --strings is now -S, not -s.
2265         (usage): Reflect the usage changes.
2266         (parse_old_offset): Do not issue a diagnostic on failure;
2267         callers now do this as necessary.
2268         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2269         Add support for new short options (many undocumented) for
2270         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2271         POSIX-compatible.  Default format is now oS, not o2.
2272         * NEWS: Describe the above.
2273
2274 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2275
2276         * src/stty.c (valid_options): Remove.
2277         (main): Fix some bugs in handling invalid option-combinations
2278         like "stty -F".
2279         (recover_mode): Arg is now char const *, not char *.
2280         (main): Use STDIN_FILENO, not 0.
2281         Simplify option-parsing code a tad.
2282         * tests/stty/basic-1: Check for the fixed bugs.
2283
2284 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2285
2286         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2287         it from ever being nonzero.  Reported by Pozsar Balazs in:
2288         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2289         (human_fstype): Add ramfs, squashfs, sysfs.
2290         Reported by Pozsar Balazs in:
2291         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2292         (human_fstype): Return char const *, not char *.
2293         Simplify internals a bit, and avoid casts.
2294
2295         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2296         (bit_count): Remove.  All uses changed to....
2297         (multiple_bits_set): New function.
2298         (scanargs): Use it, and check separately for each set of
2299         incompatible options, to improve diagnostics.
2300         (MX): Remove.
2301         (apply_translations): Move checks for incompatible options
2302         to scanargs, so that they're done consistently.
2303
2304 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2305
2306         Output correct errno-related diagnostic on "paste" I/O errors.
2307         * src/paste.c (write_error, xputchar): New functions.
2308         (paste_parallel): Use correct errno value after input error.
2309         (paste_parallel, paste_serial): Report errno value after output error.
2310
2311         Port to diet libc.  Problem reported by Felix von Leitner in:
2312         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2313         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2314         it's not portable C to assume FILE is a complete type.
2315         (paste_parallel): Use index test instead of ENDLIST, and NULL
2316         instead of CLOSED.
2317
2318 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2319
2320         POSIX-conformance fixes for "expand" and "unexpand".
2321         Also, consistently use "tab stop" rather than "tabstop".
2322         * NEWS: Document fixes.
2323         * src/expand.c: Revamp to resemble the new unexpand.c better.
2324         (usage): -i does not convert tabs after non-tabs.
2325         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2326         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2327         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2328         (next_file, main): Check fclose against 0, not EOF.
2329         (expand): Remove unnecessary casts.
2330         Add another loop nesting level, for lines, so that per-line variables
2331         are initialized cleanly.
2332         Revamp tab checking.  Check for write error immediately, rather
2333         than just once at the end of the program.
2334         * src/unexpand.c: Lkewise (for the expand.c changes).
2335         (TAB_STOP_SENTINEL): Remove.
2336         (tab_size): Now size_t, not uintmax_t, since we need to store
2337         the sequences of blanks.
2338         (max_column_width): New var.
2339         (usage): Say "blank" where POSIX requires this.
2340         (add_tab_stop): Calculate maximum column width.
2341         (unexpand): Store the pending blanks, instead of merely counting them.
2342         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2343         Get rid of internal label and goto.
2344         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2345         Add blanks-1 through blanks-13.
2346
2347 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2348
2349         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2350         succeed without changing the uid and gid, like FreeBSD.
2351         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2352         through a pointer.  Treat "chgrp '' file" as a no-op change,
2353         as FreeBSD does.
2354         (main): Set chopt.group_name to NULL if the group is the empty
2355         string.
2356         * src/chown-core.c (describe_change): Describe changes to -1:-1
2357         without using "to OWNERSHIP" phrase.
2358         * src/chown.c (usage): "chown '' file" is now allowed.
2359         (main): Do not set user name to the empty string if the group
2360         name is null.
2361         * tests/chgrp/basic: Test "chgrp '' file".
2362         * tests/chown/Makefile.am (TESTS): Add separator.
2363         * tests/chown/separator: New file, partly taken from
2364         Dmitry V. Levin's suggestion in
2365         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2366
2367 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2368
2369         * tests/install/basic-1: Test for the -d regression.
2370
2371 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2372
2373         * src/install.c (main): Fix -d regression introduced with
2374         --target-directory support at 2004-06-25.
2375
2376 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2377
2378         * src/copy.c (copy_internal): When preserving links, unlink
2379         a destination with link count greater than one.  This is so
2380         that commands like "cp -a" don't get confused when copying into
2381         a destination that already contains many hard links.  Problem
2382         reported by Tim Waugh in:
2383         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2384
2385 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2386
2387         Convert all files to UTF-8.
2388         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2389         * tests/sort/Test.pm (16a): Likewise.
2390         * tests/uniq/Test.pm (8): Likewise.
2391         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2392
2393         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2394         * src/shred.c (usage): "-" is an operand, not an option.
2395         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2396         A null file arg means standard output.
2397         (main): "-o -" means to write to a file named "-",
2398         not to standard output.
2399         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2400         to a file named "-".
2401
2402 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2403
2404         * src/install.c (change_timestamps): Fix int->bool conversion
2405         bugs introduced on 2004-07-29.
2406
2407 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2408
2409         * src/shred.c (wipename): Work even if the directory is writeable
2410         and not readable.  Prefer write access, since this should work
2411         better with fdatasync.
2412
2413         * src/csplit.c (xalloc_die): New function.
2414         (main): Remove now-obsolete initialization of xalloc_fail_func.
2415
2416         * src/md5sum.c: Adjust to sha->sha1 renaming.
2417
2418 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2419
2420         Minor code cleanup.
2421         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2422         (can_mode): Make variable local.
2423
2424 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2425
2426         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2427         Do not define, to avoid annoying compiler messages on QNX 6.3.
2428         Problem reported by Johan in:
2429         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2430
2431 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2432
2433         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2434         Define to a concatenation of string literals, not to an expression;
2435         needed for concatenation contexts.
2436         (INTMAX_MAX, INTMAX_MIN): New macros.
2437
2438         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2439         unsigned long; this isn't true for st_ino on Solaris 9.
2440
2441 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2442
2443         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2444         whether to include files.  Include <sys/param.h> if
2445         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2446         (main) [defined __POWERPC__]: Add a kludge to work around a
2447         Mac OS X bug, so that uname -p defaults to "powerpc" if
2448         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2449         fails.  Problem reported by Petter Reinholdtsen in:
2450         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2451
2452         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2453         main): Use bool for booleans.
2454         (writeline, check_file): Use uintmax_t for line counts.
2455         (check_file): Check for and report line number overflow,
2456         when that matters.
2457         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2458         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2459         have_read_stdin, wc, wc_file, main):
2460         Use bool for booleans.
2461         (exit_status): Remove.
2462         (wc, wc_file): Return bool status.  All callers changed.
2463         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2464         * src/whoami.c (main): Print uids using unsigned long int, not
2465         unsigned int.
2466
2467         * src/unexpand.c: Int cleanup and minor reorganization to be more
2468         like src/expand.c.
2469         Include quote.h, xstrndup.h.
2470         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2471         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2472         unexpand, main):
2473         Use bool for booleans.
2474         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2475         Use uintmax_t for column counts.
2476         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2477         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2478         as a tab stop.
2479         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2480         Detect overflow in tab stop string.
2481         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2482         (unexpand): Concatenate input files the same way expand does.
2483
2484         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2485         touch, main): Use bool for booleans.
2486         (main): Avoid integer overflow when given more than INT_MAX
2487         options.
2488         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2489         (have_read_stdin, count_items, scan_zeros, detect_loop,
2490         recurse_tree, walk_tree, tsort, main):
2491         Use bool for booleans.
2492         (exit_status): Remove.
2493         (tsort): Return a success flag instead of storing into a global.
2494         (main): Use it.
2495         * src/tty.c (silent, main): Use bool for booleans.
2496         (main): 0 -> STDIN_FILENO.
2497         * src/uname.c (print_element): Use bool for booleans.
2498
2499         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2500         Remove.  All uses replaced by C99 boolean primitives.
2501         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2502         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2503         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2504         one_argument, main): Use bool for booleans.
2505         (advance, unary_advance): Now inline procedures rather than a macros.
2506         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2507         (term, and, or): When it's easy, loop instead of recursing.
2508         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2509         (binary_operator, unary_operator): Simplify by systematically rewriting
2510         true==FOO to FOO (where FOO is a boolean).
2511         (unary_operator): Don't consider a file to be a regular file
2512         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2513         Remove unnecessary casts.  Remove ifdefs for things like
2514         S_ISSOCK that are no longer needed, since stat-macros.h always
2515         defines them now.
2516
2517         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2518         Use bool for booleans.
2519         (buf_init_from_stdin, buf_free, find_bol, print_line):
2520         Use size_t for sizes.
2521         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2522         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2523         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2524         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2525         Report an error if the result is out of range.
2526         (tac_seekable, main): Check for integer overflow in buffer size
2527         calculations.
2528         (main): Remove unnecessary casts.
2529
2530         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2531         the callee doesn't have to count 'em.  All callers changed.
2532         Don't allocate more space for the arg vector than we'll need.
2533         Use memcpy to copy the args rather than rolling our own loop.
2534         Use size_t for sizes.
2535         (fast_startup, simulate_login, change_environment, log_su,
2536         correct_password, restricted_shell, main): Use bool for booleans.
2537         (longopts): Don't assume change_environment is an int.
2538         Use NULL, not 0, for pointers.
2539         (xsetenv): New function, replacing xputenv and concat.
2540         All callers changed.
2541         (elements): Remove; no longer needed.
2542         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2543         (log_su): 2 -> STDERR_FILENO.
2544         (modify_environment, main): Don't assume that getenv's returned value
2545         has an indefinite lifetime.
2546         (modify_environment): Allocate a larger environ.
2547         (main): Remove an impossible 'case 0'; if it happens now, it'll
2548         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2549         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2550
2551         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2552         (_POSIX_VDISABLE): Remove unnecessary cast.
2553         (struct control_info, visible): Use cc_t for control chars.
2554         (struct control_info): Use size_t for sizes.
2555         (recover_mode, set_mode, display_speed, display_window_size,
2556         valid_options, main, display_changed):
2557         Use bool for booleans.
2558         (integer_arg): Return unsigned long int, not long int.
2559         Accept new max arg; all callers changed, to specify a maximum
2560         value for integer parameters instead of silently overflowing.
2561         (wrap): Do not overrun the stack buffer if the output contains
2562         more than 1024 bytes.  Instead, malloc a buffer.
2563         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2564         Remove unnecessary casts.
2565         (set_control_char): Allow int values only up to cc_t range.
2566         (screen_columns): Don't reject INT_MAX.
2567         (display_changed, display_all, display_speed, recover_mode):
2568         Don't assume cc_t fits in int.
2569
2570         * src/remove.h: Add copyright notice.
2571         (struct rm_options): Use bool for booleans.
2572         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2573         errno_rmdir_non_empty, remove_parents, main): Likewise.
2574         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2575         main): Likewise.
2576         (main): Don't dump core if invoked with argv[0]==NULL.
2577         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2578         Use bool for booleans.
2579         (tee): Use ssize_t for read returns.
2580
2581         * src/ptx.c: Add a FIXME mentioning that there are many
2582         unchecked integer overflows in this file.
2583         (gnu_extensions, auto_reference, input_reference, right_reference,
2584         ignore_case, initialize_regex, fix_output_parameters,
2585         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2586         Use bool for booleans.
2587         (SKIP_SOMETHING, compare_words, digest_break_file,
2588         find_occurs_in_text, fix_output_parameters):
2589         Use to_uchar instead of a caset.
2590         (print_field): Rewrite to avoid cast.
2591
2592         * src/printf.c (posixly_correct): Use bool for booleans.
2593         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2594         (STRTOX): Rewrite to avoid casts.
2595         (print_esc_char): Arg is char, not int.
2596         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2597         can_mode.
2598         (no_newline, verbose): Use bool for booleans.
2599         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2600         * src/shred.c (struct Options, main): Use bool for booleans.
2601         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2602         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2603         Use bool for booleans.
2604         * src/stat.c (G_fail): Remove.
2605         (print_statfs): Print various gotta-be-nonnegative values using
2606         unsigned long int, not long int or int.
2607         (do_statfs, do_stat): Return a boolean success flag.
2608         (do_stat, main): Use bool for booleans.
2609
2610         * src/pr.c: Add a FIXME mentioning that there are many
2611         unchecked integer overflows in this file.
2612         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2613         (struct COLUMN, read_line, print_page, print_stored, open_file,
2614         skip_to_page, init_fps, parallel_files, align_empty_cols,
2615         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2616         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2617         print_across_flag, storing_columns, balance_columns,
2618         truncate_lines, join_lines, untabify_input, failed_opens,
2619         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2620         double_space, ignore_failed_opens, use_col_separator,
2621         pad_vertically, last_line, main, init_parameters, skip_read,
2622         read_line, print_stored):
2623         Use bool for booleans.
2624         (struct COLUMN, char_to_clump, store_char, print_char):
2625         Use char for chars.
2626         (clump_buff, print_clump): Use char[], not int[], for an array whose
2627         elements are always chars.
2628         (first_last_page, main, getoptarg, balance, add_line_number,
2629         char_to_uclump): Remove unnecessary casts.
2630         (init_parameters): Allocate chars, not ints, for clump_buff.
2631         (print_char): Use to_uchar before invoking ISPRINT.
2632         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2633
2634         * src/nohup.c (main): Use bool for booleans.
2635         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2636         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2637         (portable_chars_only): Use to_uchar rather than a cast.
2638         * src/printenv.c (main): Use bool for booleans.
2639         Do not assume that the environ has at most one matching entry
2640         for each option (integer overflow was possible otherwise).
2641
2642         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2643         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
2644         less.
2645         (struct tspec): Use it.  fmt_string is now an array, not
2646         a pointer, as there's little point to the indirection here.
2647         (struct tspec, flag_dump_strings,
2648         traditional, flag_pseudo_start, limit_bytes_to_format,
2649         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2650         decode_one_format, open_next_file, check_and_close,
2651         decode_format_string, skip, write_block, read_char, read_block,
2652         parse_old_offset, dump, dump_strings, main):
2653         Use bool for booleans.
2654         (struct tspec): Use void *, not char *, for generic pointers.
2655         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2656         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2657         Use char, not unsigned int, since char suffices.
2658         (print_s_char, print_char, print_s_short, print_short,
2659         print_int, print_long, print_long_long, print_float,
2660         print_double, print_long_double): Rewrite to avoid casts.
2661         These now take void * arguments, instead of char *.
2662         Use the same body for all functions, except for the choice
2663         of type.  Assume C89 to simplify handling of signed char.
2664         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2665         Rewrite to avoid casts.
2666         (print_named_ascii, print_ascii): Now takes void *, not char *.
2667         (decode_one_format): Use int for printf field widths, not
2668         unsigned int.  Pass void * to subsidiary printers,
2669         not char *.  Simplify handling of floating-point formats
2670         by factoring out common code dealing with precision and field width.
2671         (decode_format_string): Avoid need for temporary copy of
2672         each decoded struct tspec.
2673         (get_lcm): Remove unnecessary cast.
2674         (main): Fix bug where more than INT_MAX failed decodes were ignored.
2675
2676 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
2677
2678         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2679         (enum number_format): Remove.
2680         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2681         not enum values.
2682         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2683         (section_del): Now const.
2684         (print_fmt): Remove.
2685         (starting_line_number, page_incr, blank_join, line_no,
2686         print_lineno, proc_text, main):
2687         Use intmax_t for line numbers.
2688         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2689         Use bool for booleans.
2690         (lineno_format): Now a string, not an enum value.
2691         (build_print_fmt): Remove.  All calls removed.  This work is
2692         now done within print_lineno.
2693         (build_type_arg): Use size_t for sizes.
2694         (print_lineno): Check for line number overflow.
2695         (proc_text, main): Remove unnecessary cast.
2696
2697         * src/ln.c (symbolic_link, interactive, remove_existing_files,
2698         verbose, hard_dir_link, dereference_dest_dir_symlinks,
2699         do_link, main): Use bool for booleans.
2700
2701         * src/ls.c (struct fileinfo, file_interesting,
2702         extract_dirs_from_files, color_symlink_as_referent,
2703         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2704         numeric_ids, print_block_size, dired, print_with_color,
2705         check_symlink_color, print_inode, recursive, immediate_dirs,
2706         all_files, really_all_files, qmark_funny_chars,
2707         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2708         main, decode_switches, parse_ls_color, print_dir, file_interesting,
2709         gobble_file, make_link_path, basename_is_dot_or_dotdot,
2710         extract_dirs_from_files, print_long_format):
2711         Use bool for booleans.
2712         (dir_defaulted): Remove; no longer needed.
2713         (main): Use int to count files, since it suffices for argv.
2714         Rewrite to avoid need for dir_defaulted.
2715         (main, print_dir, gobble_file, get_link_name,
2716         xstrcoll):
2717         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2718         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2719         Remove unnecessary cast to int.  Use int instead of unsigned
2720         int to count from 0 to 1.
2721         (get_funky_string, print_type_indicator): Use char for bytes, not int.
2722         (make_link_path): Use NULL for null pointers.
2723         (quote_name): Use to_uchar instead of cast.
2724
2725         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2726         print_full_info): Use bool for booleans.
2727         (problems): Remove, replacing with....
2728         (ok): New var (inverted from old sense).
2729         (print_user, print_group, print_full_info):
2730         Print uids/gids with %lu, not %u.
2731         (xgetgroups): Don't run out of memory if getgroups or getugroups
2732         returns -1.
2733         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2734
2735         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2736         int, since it suffices.
2737         (factor, print_factors): Use size_t for sizes.
2738         (print_factors, do_stdin, main): Use bool for booleans.
2739         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2740         (fold_file, main): Use bool for booleans.
2741         (fold_file, main): Use size_t for sizes.
2742         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2743         of prohibiting widths greater than INT_MAX.
2744         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2745         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2746         elide_tail_lines_pipe, elide_tail_lines_seekable,
2747         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2748         string_to_integer, main):
2749         Use bool for booleans.
2750         (main): Rewrite to avoid cast.
2751
2752         * src/csplit.c (struct line): Use size_t for sizes.
2753         (main): Remove unnecessary cast.
2754         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2755         * src/cut.c (cut_file, main): Use bool for booleans.
2756         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2757         * src/env.c (main): Likewise.
2758         * src/expr.c (nextarg): Likewise.
2759         * src/env.c (main): Remove unused and nonstandard envp arg.
2760
2761         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2762         fmt's arbitrary limits.
2763         (TRUE, FALSE): Remove; all uses changed to (true, false).
2764         (main): Use bool for booleans.
2765         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
2766         to parse width.
2767         (copy_rest): Remove unnecessary cast.
2768         (get_prefix): Rewrite to avoid cast.
2769         (check_punctuation): Use char *, not unsigned char *; C89 requires
2770         this.  Avoid off-by-one buffer read overrun when line is empty.
2771         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2772         Remove unnecessary casts.
2773         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2774         changes.
2775
2776         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2777         next_file, expand, main):
2778         Use bool for booleans.
2779         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2780         expand, main):
2781         Use uintmax_t for column counts.
2782         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2783         All callers changed.
2784         (parse_tabstops): Don't pass a negative char to isblank.
2785         Avoid memory leak with large tab stops.
2786         (validate_tabstops, expand): Don't assume number of tab stops is
2787         <= INT_MAX.
2788         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2789         storing values into exit_status.
2790         (expand): Use same pattern as unexpand for reading chars.
2791         Report an error when input line is too long, instead of silently
2792         screwing up.  Do not mishandle tab stops when backspacing left
2793         over start of line.
2794
2795         * src/dircolors.c (have_read_stdin, append_quoted,
2796         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2797         (dc_parse_stream): Use enum for state, rather than int.
2798         Use ssize_t to store getline result.
2799
2800         * src/dd.c (translation_needed, parse_integer, scanargs,
2801         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2802         Use bool for booleans.
2803         (translate_buffer): Use to_uchar rather than a cast.
2804         (swab_buffer, copy_simple, copy_with_unblock):
2805         Use size_t for sizes.
2806
2807         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2808         * src/sleep.c (apply_suffix): Likewise.
2809         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2810         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2811         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2812         tail_forever, tail_bytes, tail_lines, tail, tail_file,
2813         parse_obsolescent_option, parse_options, main): Likewise.
2814         * src/sleep.c (apply_suffix): Invert sense of result.
2815         Use int (not unsigned int) for multiplier, as this generates better
2816         code with some compilers.  Simplify code a bit.
2817         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2818         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2819         for state counters.
2820         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2821         make it a bit clearer.
2822
2823         * src/hostname.c: Include "xgethostname.h".
2824         (xgethostname): Remove decl; xgethostname.h has it.
2825         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2826         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2827         prototypes rather than K&R form.  Assume any negative value from
2828         sysinfo denotes failure, not just -1.
2829         (main): Simplify use of sethostname.
2830
2831         * src/pinky.c (include_idle, include_heading, include_fullname,
2832         include_project, include_plan, include_home_and_shell, do_short_format,
2833         include_where, main): Use bool for booleans.
2834         (count_ampersands, create_fullname, scan_entries, short_pinky):
2835         Use size_t for sizes.
2836         (create_fullname): Check for overflow in size calculations.
2837         (idle_string): Don't assume that the number of idle days
2838         is less than 10**8 and/or INT_MAX/(24*60*60).
2839         (main): No need to pass a non-NULL last arg to getopt_long.
2840         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2841         (print_uptime): Remove unused local variable.
2842         (main): No need to pass a non-NULL last arg to getopt_long.
2843         * src/users.c (list_entries_users, users): Use size_t for sizes.
2844         (list_entries_users): Use char for bytes.
2845         (main): No need to pass a non-NULL last arg to getopt_long.
2846         * src/who.c (do_lookup, short_list, short_output, include_idle,
2847         include_heading, include_mesg, include_exit, need_boottime,
2848         need_deadprocs, need_login, need_initspawn, need_clockchange,
2849         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2850         (print_runlevel): Use unsigned char for bytes.
2851         (list_entries_who, scan_entries, who): Use size_t for sizes.
2852         (main): No need to pass a non-NULL last arg to getopt_long.
2853
2854         * src/install.c (isdir): Remove decl.
2855         (install_file_to_path): Rely on make_path to fail if the destination
2856         is not a directory, by passing preserve_existing==true to it.
2857         Hence we no longer need to call isdir.
2858         Free dest_dir immediately when it's no longer needed, rather than
2859         waiting until the end of the function.
2860         (copy_file): Don't bother calling isdir, as copy will do the
2861         right thing if the destination is a directory.
2862
2863         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2864         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2865         Use bool for booleans.
2866         (max_depth): Now size_t, not int, to avoid an arbitrary limit
2867         of INT_MAX on depth.
2868         (G_fail): Remove: no longer needed, now that the relevant
2869         functions return bool.
2870         (process_file): Use return value to signal success rather than
2871         setting a global.  Remove first_call static var; not needed, since
2872         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
2873         about size_t casts, as it's now fixed.  Use xnrealloc rather
2874         than the obsolescent XREALLOC.  Don't bother to check whether
2875         reallocation is needed unless level > prev_level.
2876         (du_files): Invert sense of result, for consistency with
2877         other coreutils code.  All callers changed.
2878         (main): Allow --max-depth values up to SIZE_MAX.
2879
2880         * src/df.c (inode_format, show_all_fs, show_local_fs,
2881         show_listed_fs, posix_format, require_sync, print_type,
2882         selected_fstype, excluded_fstype, show_dev, show_point, main):
2883         Use bool for booleans.
2884         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2885         (show_dev, show_point, main):
2886         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2887         Don't assume disk name lengths are <= INT_MAX.
2888         Rewrite pct calculation to avoid cast.
2889         (show_point): Don't assume resolved length is <= SSIZE_MAX.
2890
2891         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2892         instead of uintptr_t.
2893         * src/shred.c (UINT_MAX_32_BITS): Remove.
2894         (word32): Remove.  All uses changed to uint32_t.
2895         (isaac_seed_data): Remove unnecessary cast.
2896         * src/system.h (ptr_align): Use size_t; in practice, this is just as
2897         good as uintptr_t in checking for alignments, and has fewer
2898         configuration hassles.
2899
2900         * src/Makefile.am (localedir.h): Make it readonly; this
2901         undoes part of the 2004-07-27 patch.
2902
2903 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
2904
2905         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2906         (IS_THOUSANDS_SEP): Use bool when appropriate.
2907         (numcompare, main): Use char, not int, when the value is always a char.
2908         (numcompare): Remove "register"; compilers are smart enough these days.
2909         * src/system.h (errno, CHAR_BIT): Remove decls;
2910         no longer needed now we assume C89 or better.
2911         Include <inttypes.h> before <stdint.h>, as it's the
2912         Autoconf-recommended pattern.
2913         (to_uchar): New inline function, moved here from tr.c.
2914         Use full names for int types, e.g. "long int" rather than "long".
2915         * src/tr.c (to_uchar): Remove; now in system.h.
2916         (is_char_class_member): Use bool when appropriate.
2917
2918         * src/mkdir.c (create_parents, main): Use bool when appropriate.
2919         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2920
2921 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
2922
2923         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
2924
2925         * src/chmod.c (recurse, force_silent, process_file, process_files,
2926         main): Use bool when appropriate.
2927         * src/cksum.c (cksum, main): Likewise.
2928         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
2929         compare_files, main): Likewise.
2930
2931         * src/copy.h (struct cp_options): Likewise.
2932         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
2933         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
2934         * src/cp-hash.h (remember_created): Likewise.
2935         * src/cp-hash.c (remember_created): Likewise.
2936         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
2937         re_protect, make_path_private, target_directory_operand, do_copy,
2938         cp_option_init, decode_preserve_arg, main): Likewise.
2939         * src/install.c (isdir, change_timestamps, change_attributes,
2940         copy_file, install_file_to_path, install_file_in_dir,
2941         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
2942         change_attributes, change_timestamps): Likewise.
2943         * src/mv.c (remove_trailing_slashes, rm_option_init,
2944         cp_option_init, do_move, movefile, main): Likewise.
2945         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
2946         AD_push, prompt, remove_dir): Likewise.
2947         * src/rm.c (rm_option_init, main): Likewise.
2948
2949         * src/remove.c (top_dir, pop_dir, full_filename_):
2950         Use size_t for sizes.
2951         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
2952         succeeds.  It's not necessary in that case, as *NEW_DST is always
2953         false already.
2954         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
2955         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
2956         * src/rm.c (main): Likewise.
2957
2958         md5sum, sha1sum integer cleanups.
2959
2960         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
2961         not needed.
2962         (ALG_UNSPECIFIED): Remove.
2963         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
2964         * src/md5.c: Don't include any files other than checksum.h.
2965         * src/sha1sum.c: Likewise.
2966         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
2967         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
2968         Use bool when appropriate.
2969         (digest_check): Increase limit of number of input lines to
2970         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
2971         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
2972
2973 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
2974
2975         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
2976         'ok' flag around.
2977         (simple_cat, cat): Return true if successful.  All callers changed.
2978         (simple_cat, cat, main): Use bool for booleans.
2979         (simple_cat): Use size_t for sizes.
2980         (cat, main): Use the same names for parameters that we use for
2981         long options, to avoid confusion.  This inverts the sense of the
2982         show_tabs (formerly output_tabs) and number_nonblank
2983         (formerly numbers_at_empty_lines) variables.
2984         (main): Don't mess up (due to integer overflow) if we are given
2985         INT_MAX - INT_MIN + 1 options.
2986         [O_BINARY]: Don't invoke isatty unless the other options require it.
2987         (main): When deciding whether to use simple_cat, don't worry
2988         about binary option; it's irrelevant.
2989
2990         * src/dcgen: Remove comments, trailing white space, and empty
2991         lines from the output strings, to save space.
2992         Use a narrower type like 'unsigned char' for line lengths, if
2993         that will do.
2994         Make the output variables static, not extern.
2995
2996         * src/chgrp.c (parse_group): Require base 10 when parsing
2997         groups as integers.
2998         (main): int -> bool when appropriate.
2999         * src/chown.c (main): Likewise.
3000         * src/chown-core.c: Include inttostr.h.
3001         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3002         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3003         instead of uint_to_string).
3004         (describe_change): Instead of an int flag, use a char *
3005         auxiliary; this avoids the need for casts.
3006         Assume free (NULL) works.
3007         (change_file_owner): Return true/false, not 0/-1, since
3008         we don't set errno.  All callers changed.
3009         Use bool when appropriate.
3010         (chown_files): Likewise.
3011         * src/chown-core.h (chown_files): Likewise.
3012
3013         * tests/chown/basic: Test for proper handling of uids like
3014         "010", which must be parsed as decimal.
3015
3016         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3017         pwd when there are multiple names for the working directory
3018         (which can happen with an automounter, sigh).
3019
3020         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3021         this causes Solaris 8 'make' to refuse to build "groups".
3022         (localedir.h): Don't depend on Makefile: this causes Solaris
3023         8 'make' to build localedir.h unnecessarily.  The dependence
3024         on Makefile is ineffective anyway, since $(localedir) might
3025         change even if Makefile hasn't.
3026
3027         * src/remove.c (remove_dir): If we can't save the state of the
3028         working directory, pretend we started from "/", not ".".
3029         This avoids a bug on hosts like Solaris that don't let you
3030         remove the working directory.
3031
3032 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3033
3034         * src/printf.c (strtiomax, strtoumax): Declare if not already
3035         declared: this fixes a portability bug with Solaris 8 + GCC.
3036         (STRTOX): Parenthesize use of macro arg as expression.
3037         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3038         parentheses.
3039         * configure.ac: Check for declaration of strtoumax, for
3040         src/printf.c.
3041
3042         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3043         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3044
3045         * tests/readlink/can-e: Don't assume that we can remove the
3046         working directory: this isn't possible under Solaris 8, say.
3047         * tests/readlink/can-f: Likewise.
3048         * tests/readlink/can-m: Likewise.
3049
3050         * src/copy.c (copy_internal): find_backup_file_name no longer
3051         returns NULL, so don't bother to check for this.
3052         * src/cp.c (do_copy): Likewise.
3053         * src/ln.c (do_link): Likewise.
3054
3055 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3056
3057         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3058         All uses changed.
3059         (NZERO): New macro, if system doesn't define it already.
3060         (usage): Distinguish priorities from nice values.
3061         Don't assume NZERO is 20.
3062         (main): Use bool instead of int where appropriate.
3063         If user specifies an adjustment out of range, always truncate it
3064         to an inrange value instead of sometimes giving an error message
3065         and sometimes not.
3066         Do not assume that -1 is an error return from "nice" or
3067         "getpriority", as it might be the current nice value minus NZERO.
3068         If nice/setpriority fails with errno == EPERM, go ahead and run
3069         the command anyway; POSIX requires this.
3070
3071         * src/pathchk.c: Include euidaccess.h.
3072         (dir_ok): Use euidaccess, not access.
3073         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3074         (eaccess): Remove.  All users changed to use euidaccess instead.
3075
3076 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3077
3078         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3079         Don't assume ut_line is null-terminated.
3080         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3081         since USER and LINE might not be null terminated.  All callers
3082         changed.
3083
3084 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3085
3086         Fix bug with "tail -f" reported by Rob Holland in
3087         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3088         Also, remove the undocumented and unsupported-since-2000
3089         --max-consecutive-size-changes options.  Fix another related bug:
3090         "tail" got confused if stdin, stdout, or stderr were closed.
3091         Also, use output buffering even with "tail -f".
3092
3093         * NEWS: Document this, plus yesterday's patch.
3094         * doc/coreutils.texi (tail invocation): "size has remained the same"
3095         -> "file has not changed", which is more accurate for fifos.
3096         * src/tail.c: Include fcntl-safer.h.
3097         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3098         (COPY_A_BUFFER): New macro.
3099         (struct File_spec): New members mtime, mode, blocking.
3100         Remove member n_consecutive_size_changes.
3101         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3102         max_n_consecutive_size_changes_between_opens,
3103         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3104         (long_options, tail_forever, parse_options):
3105         Remove (non-)support for --max-consecutive-size-changes.
3106         (record_open_fd): New function.
3107         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3108         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3109         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3110         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3111         All uses changed.
3112         (n_live_files): Remove, replacing with...
3113         (any_live_files): New function.  All uses changed.
3114         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3115         is safe; this avoids some hangs when reading from a fifo.
3116         Avoid invoking fstat or sleep when using blocking I/O.
3117         Do not check for changes to size if the file is not a regular file,
3118         as the size is undefined in that case.
3119         Check for changes to mtime or mode, too; this works for non-regular
3120         files.
3121         (tail_forever, main): Redo fflush strategy to work even when input
3122         is nonblocking.  Don't use unbuffered output; just flush when needed.
3123
3124 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3125
3126         * src/tail.c (main): Ignore -f if no file operand is specified
3127         and standard input is a pipe.
3128         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3129         all pipes, just for when standard input is a pipe and no
3130         file operand is specified.
3131         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3132         Add a new commented-out f-2 test, which we still fail.
3133         (test_vector): All f-* tests are special cases, not just f-1.
3134
3135 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3136
3137         * src/uptime.c: Include c-strtod.h.
3138         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3139         Use long int rather than int to count days (for 64-bit hosts),
3140         and check for arithmetic overflow when converting double to time_t.
3141
3142 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3143
3144         * src/printf.c (vstrtold): Renamed from vstrtod.
3145         Now returns long double.  All uses changed.
3146         (print_direc): Use "L" length modifier when printing floating point
3147         numbers, since we're now printing long double.
3148
3149 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3150
3151         printf cleanup, to avoid undefined behavior, to add support for
3152         formats that Bash supports, and to support wide integers like
3153         Bash does.
3154
3155         * NEWS: Document this.
3156         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3157         booleans, so that we don't reserve any values for precision or
3158         width (like Bash).
3159         (STRTOX): Use prototype, not K&R-style definition.
3160         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3161         in ../lib), with type change to intmax_t.
3162         All uses changed.
3163         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3164         All uses changed.
3165         (vstrtod): Renamed from xstrtod.  All uses changed.
3166         (print_direc): Use boolean arg instead of special value to indicate
3167         a missing precision or width.  LENGTH no longer includes
3168         length modifiers or conversion character.  New arg CONVERSION
3169         now specifies conversion character.
3170         Use intmax_t-width formatting for integers (like Bash).
3171         Add support for C99 %a, %A, %F (like Bash).
3172         Add support for field width with %c (POSIX requires this).
3173         Add a FIXME for lack of support for field width and precision
3174         for %b.
3175         Add support for '\'', '0' flags.
3176         Check for invalid combinations of flags, field width, precision,
3177         and conversion, to prevent use of undefined behavior.
3178         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3179         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3180         In error message, output entire invalid conversion specification,
3181         instead of merely outputting % followed by the conversion char.
3182         * tests/misc/printf: Add tests for the above.
3183
3184 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3185
3186         Change "readlink -f" to be more compatible with prior implementations.
3187         Add more canonicalize options, -e and -m.
3188         Add comprehensive tests for all readlink modes.
3189
3190         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3191         Do not add canonicalize.c here.
3192
3193         * src/readlink.c (longopts): Add new options.
3194         (usage): Document them.
3195         (canonicalize_fname): New proxy function.
3196         (main): Handle new options.
3197         * doc/coreutils.texi (readlink invocation): Document new
3198         "readlink -f" behaviour and new canonicalize options, -e and -m.
3199
3200         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3201         * tests/Makefile.am (SUBDIRS): Add readlink.
3202         * tests/readlink/Makefile.am: New file.
3203         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3204         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3205         * tests/misc/readlink: Remove file.
3206
3207 2004-07-04  Jim Meyering  <jim@meyering.net>
3208
3209         * src/copy.c (copy_internal): Add a FIXME comment.
3210
3211 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3212
3213         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3214         * src/cp.c (do_copy): Likewise.
3215         * src/mv.c (movefile): Likewise.
3216
3217         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3218         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3219
3220         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3221         This cleans up the semantics a bit, as we no longer try to open the
3222         same file twice.
3223
3224 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3225
3226         * NEWS: Add short names -t and -T for --target-directory
3227         and --no-target-directory options, respectively.
3228
3229         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3230         Remove.  All uses changed to 'T' and 't', respectively.
3231         * src/install.c, src/ln.c, src/mv.c: Likewise.
3232
3233         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3234         aliases for --target-directory and --no-target-directory,
3235         respectively.
3236         * src/install.c (long_options, main, usage): Likewise.
3237         * src/ln.c, src/mv.c: Likewise.
3238
3239 2004-07-01  Jim Meyering  <jim@meyering.net>
3240
3241         * Makefile.maint (sc_file_system): New target.
3242         (syntax-check-rules): Add it.
3243         .x-sc_file_system: New file.
3244         * Makefile.am (EXTRA_DIST): Add it.
3245
3246         * man/sync.x: Use "file system" rather than "filesystem".
3247         * man/stat.x, man/df.x: Likewise.
3248
3249 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3250
3251         * src/df.c (usage, main): Output "file system" rather than
3252         "filesystem".
3253         * src/du.c (usage): Likewise.
3254         * src/shred.c (usage): Likewise.
3255         * src/stat.c (usage): Likewise.
3256         * src/stat.c (long_options, usage): Rename "--filesystem" to
3257         "--file-system".  But keep the old name around, for compatibility
3258         reasons.
3259
3260 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3261
3262         Add support for --no-target-directory option.
3263
3264         * NEWS: Document it.
3265         * doc/coreutils.texi (Common options, Target directory, cp
3266         invocation, install invocation, mv invocation, ln invocation):
3267         Likewise.
3268         (link invocation): Explain how to rewrite link using ln now
3269         that we have --no-target-directory.
3270         (ln invocation): Explain that --no-target-directory subsumes
3271         --no-dereference.
3272         (unlink invocation): Modify wording to match new wording in
3273         link invocation.
3274
3275         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3276         (long_opts, usage, do_copy, main): Add support for
3277         --no-target-directory,
3278         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3279         usage): Likewise.
3280         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3281         main): Likewise.
3282         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3283         main): Likewise.
3284         * src/mv.c (enum): Sort values.
3285
3286 2004-06-29  Jim Meyering  <jim@meyering.net>
3287
3288         Don't let verbose-mode output from a subshell obscure actual differences.
3289         * tests/rm/inaccessible: Turn off command-echoing just before
3290         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3291
3292 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3293
3294         Add support for 'install --target-directory', an option
3295         that has been documented for years but not implemented (!).
3296         * doc/coreutils.texi (install invocation): Document
3297         --target-directory in synopsis, too.
3298         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3299         (long_options, main, usage): Add --target-directory.
3300         (target_directory_operand): New function, stolen from mv.c.
3301         (main): Use it.  Check for -d and --target-directory.
3302         Alter wording of diagnostics to match other programs.
3303
3304 2004-06-28  Jim Meyering  <jim@meyering.net>
3305
3306         * src/cp.c (usage): Fix copy+paste error in description of
3307         --target-directory: s/move/copy/.  From Paul Jarc.
3308
3309 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3310
3311         Use more-consistent rules among cp, ln, and mv when dealing with
3312         last operands that are (or look like) directories.
3313
3314         * src/cp.c (target_directory_operand): New, nearly-common function,
3315         It reports an error if the destination appears to be a directory
3316         (e.g., because it has a trailing slash) but is not.
3317         * src/ln.c, src/mv.c: Likewise.
3318         * src/cp.c (do_copy): Use it.
3319         * src/ln.c (main): Likewise.
3320         * src/mv.c (main): Likewise.
3321
3322         * src/cp.c (do_copy): Don't assume argc is positive.
3323         Don't bother to lstat dest, since copy() will do that for us.
3324         Use "const" to avoid the need for cast.
3325
3326         * src/cp.c (do_copy): Don't output a usage message because of file
3327         problems (e.g., an operand is not a directory).  Use it only for
3328         syntax.  Standardize on "target %s is not a directory" for the
3329         diagnostic.
3330         * src/ln.c (main): Likewise.
3331         * src/mv.c (main): Likewise.
3332
3333         * src/cp.c (do_copy): Remove test for trailing slash, since
3334         target_directory_operand now does this.
3335         * src/ln.c (main): Likewise.
3336         * src/mv.c (movefile): Likewise.
3337
3338         * src/cp.c (main): Reject multiple target directories.
3339         Check whether a specified target is a directory when parsing the
3340         options, using stat.  This gives more-accurate diagnostics.
3341         * src/ln.c (main): Likewise.
3342
3343         * src/ln.c (isdir): Remove decl; no longer needed.
3344         * src/mv.c (isdir, lstat): Likewise.
3345
3346         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3347         Don't check the destination ourself; rely on dest_is_dir.
3348         This way we can avoid lstatting the destination in the
3349         usual case, and in the worst case we lstat 1, not 3 times.
3350         Don't bother to unlink unless link failed; this saves a syscall.
3351         Remove unnecessary backup_succeeded flag;
3352         it was identical to "dest_backup != NULL".
3353
3354         * src/ln.c (main): Use int to count to argc, not unsigned int.
3355         This handles negative operand counts.
3356         * src/mv.c (main): Likewise.
3357
3358         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3359         do it, for consistency with cp.c and ln.c.  All callers changed.
3360         (movefile): dest_is_dir parameter is now bool, not int.
3361         (main): Standardize on "missing destination file operand after %s"
3362         for the diagnostic, for consistency with cp.c.
3363
3364         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3365         will complain about the arg count.
3366         Adjust to new (briefer) diagnostics.
3367         * tests/cp/fail-perm: Add a test to verify that we get the new
3368         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3369
3370 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3371
3372         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3373         d/" incorrectly created a link d/x/x.  It also saves some system
3374         calls.
3375
3376         * NEWS: Document the fix.
3377
3378         * src/ln.c (main): Don't append basename to dest if this
3379         results in an existing directory name.
3380         * tests/ln/misc: See whether a trailing slash is followed too far.
3381
3382 2004-06-26  Jim Meyering  <jim@meyering.net>
3383
3384         * src/printf.c (main): When given no arguments, print the standard
3385         "missing operand\nTry printf --help..." message -- to be consistent.
3386
3387 2004-06-26  Jim Meyering  <jim@meyering.net>
3388
3389         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3390
3391 2004-06-25  Jim Meyering  <jim@meyering.net>
3392
3393         * tests/ln/misc: Add test for ln subscript error.
3394
3395 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3396
3397         * src/ln.c (do_link): Remove unnecessary call to lstat.
3398         (main): Avoid subscript error when the destination is "".
3399
3400 2004-06-23  Jim Meyering  <jim@meyering.net>
3401
3402         * tests/*: Replace all occurrences of `(exit N); exit' with
3403         `(exit N); exit N'.  Otherwise, those many tests could exit with
3404         improper exit status when exiting via e.g., a trapped interrupt.
3405         Thanks to a report from Bob Proulx.
3406
3407 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3408
3409         * src/who.c (idle_string, print_user): New arg boottime,
3410         specifying the most recent boot time.  All uses changed.
3411         (idle_string) Consider a line to be "old" if it hasn't been used
3412         since the last boot time.  Watch out for overflow when computing
3413         times, and for times in the future.
3414         (idle_string): Record latest boot time.
3415
3416 2004-06-22  Jim Meyering  <jim@meyering.net>
3417
3418         * src/test.c (usage): Correct description of `-t FD'.  The file
3419         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3420
3421 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3422
3423         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3424         has undefined behavior if the year precedes -999 or follows 9999.
3425         Since we have to stop using ctime anyway, we might as well use
3426         strftime and fix the FIXME, and support internationalized dates.
3427
3428         * NEWS: Document the new behavior.
3429         * src/who.c: Include "hard-locale.h".
3430         (time_format, time_format_width): New vars.
3431         (time_string, print_line): Use them.
3432         (main): Set them.
3433         (time_string): Use localtime + strftime instead of
3434         ctime, to avoid problems with years before -999 or after 9999.
3435         * src/pinky.c: Likewise.
3436
3437 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3438
3439         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3440         names contained multibyte characters where the column count
3441         differed from the byte count.  This patch also corrects
3442         some comments.
3443
3444         * src/ls.c (format_user_or_group): New function, which counts
3445         columns correctly.
3446         (format_user, format_group): Use it.
3447         (format_user_or_group_width): New function, which counts columns
3448         correctly.
3449         (format_user_width, format_group_width): Use it.
3450
3451 2004-06-21  Jim Meyering  <jim@meyering.net>
3452
3453         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3454         Suggestion from Andreas Schwab.
3455
3456         * tests/priv-check: When running as root, be sure to propagate
3457         PATH through to the process we exec as non-root.
3458         Reported by michael@aplatform.com.
3459
3460         * src/mknod.c (main): Don't segfault when calculating the
3461         expected number of operands for `mknod NAME'.
3462
3463 2004-06-20  Jim Meyering  <jim@meyering.net>
3464
3465         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3466
3467 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3468
3469         * src/basename.c (main):
3470         Standardize on the diagnostics given when someone gives
3471         too few operands ("missing operand after `xxx'") or
3472         too many operands ("extra operand `xxx'").
3473         Include "quote.h" and/or "error.h" if it wasn't already being included.
3474         * src/chgrp.c (main): Likewise.
3475         * src/chmod.c (main): Likewise.
3476         * src/chown.c (main): Likewise.
3477         * src/chroot.c (main): Likewise.
3478         * src/comm.c (main): Likewise.
3479         * src/cp.c (do_copy): Likewise.
3480         * src/csplit.c (main): Likewise.
3481         * src/date.c (main): Likewise.
3482         * src/dircolors.c (main): Likewise.
3483         * src/dirname.c (main): Likewise.
3484         * src/du.c (main): Likewise.
3485         * src/expr.c (main): Likewise.
3486         * src/hostid.c (main): Likewise.
3487         * src/hostname.c (main): Likewise.
3488         * src/id.c (main): Likewise.
3489         * src/install.c (main): Likewise.
3490         * src/join.c (add_file_name, main): Likewise.
3491         * src/link.c (main): Likewise.
3492         * src/ln.c (main): Likewise.
3493         * src/logname.c (main): Likewise.
3494         * src/md5sum.c (main): Likewise.
3495         * src/mkdir.c (main): Likewise.
3496         * src/mkfifo.c (main): Likewise.
3497         * src/mknod.c (main): Likewise.
3498         * src/mv.c (main): Likewise.
3499         * src/nohup.c (main): Likewise.
3500         * src/od.c (main): Likewise.
3501         * src/pathchk.c (main): Likewise.
3502         * src/ptx.c (main): Likewise.
3503         * src/readlink.c (main): Likewise.
3504         * src/rm.c (main): Likewise.
3505         * src/rmdir.c (main): Likewise.
3506         * src/seq.c (main): Likewise.
3507         * src/setuidgid.c (main): Likewise.
3508         * src/shred.c (main): Likewise.
3509         * src/sleep.c (main): Likewise.
3510         * src/sort.c (main): Likewise.
3511         * src/split.c (main): Likewise.
3512         * src/stat.c (main): Likewise.
3513         * src/test.c (beyond, main): Likewise.
3514         * src/touch.c (main): Likewise.
3515         * src/tr.c (main): Likewise.
3516         * src/tsort.c (main): Likewise.
3517         * src/tty.c (main): Likewise.
3518         * src/uname.c (main): Likewise.
3519         * src/uniq.c (main): Likewise.
3520         * src/unlink.c (main): Likewise.
3521         * src/uptime.c (main): Likewise.
3522         * src/users.c (main): Likewise.
3523         * src/who.c (main): Likewise.
3524         * src/whoami.c (main): Likewise.
3525
3526         * tests/basename/basic: Adjust to new diagnostics.
3527         * tests/du/files0-from: Likewise.
3528         * tests/expr/basic: Likewise.
3529         * tests/mv/diag: Likewise.
3530         * tests/tsort/basic-1: Likewise.
3531
3532 2004-06-20  Jim Meyering  <jim@meyering.net>
3533
3534         * src/ln.c: Remove declaration of yesno.
3535         Instead, include yesno.h.
3536         * src/copy.c: Likewise.
3537
3538         * src/remove.c: Remove declaration of yesno.
3539         Instead, include yesno.h.
3540         (top_dir): Remove now-unnecessary cast of obstack_base.
3541         (pop_dir): Likewise.
3542         (full_filename_): Likewise.
3543
3544 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3545
3546         Don't dump core if ctime returns NULL; this is possible on
3547         hosts with 64-bit time_t and 32-bit int.
3548         * src/who.c: Include "inttostr.h".
3549         (time_string): If ctime fails, print the raw time as an integer
3550         instead of dumping core.
3551         * src/pinky.c: Likewise, as follows:
3552         Include "inttostr.h".
3553         (time_string): New function, copied from who.c.
3554         (print_entry): Use it.
3555
3556 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3557
3558         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3559         Problem reported by Guido Leenders in:
3560         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3561         * NEWS: document this.
3562
3563 2004-06-19  Jim Meyering  <jim@meyering.net>
3564
3565         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3566         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3567         `GNU' to the parenthesized package name in --version output.
3568         Before, the first argument from AC_INIT, `GNU coreutils', would
3569         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3570         Reported by Richard Stallman.
3571
3572 2004-06-17  Jim Meyering  <jim@meyering.net>
3573
3574         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3575         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3576
3577 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3578
3579         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3580         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3581         hosname, pwd, sync, yes.
3582         * doc/coreutils.texi (yes invocation, false invocation,
3583         true invocation): Document this.
3584         * src/chroot.c (main): Handle "--".
3585         * src/hostid.c (main): Likewise.
3586         * src/hostname.c (main): Likewise.
3587         * src/pwd.c (main): Likewise.
3588         * src/sync.c (main): Likewise.
3589         * src/yes.c (main): Likewise.
3590         * src/true.c (main): Recognize --help and --version even if
3591         POSIXLY_CORRECT is set.
3592         * src/yes.c (main): Likewise.
3593
3594 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3595
3596         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3597         the GNU behavior.
3598         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3599         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3600         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3601         variables to the implementation, so it's OK for ls to depend on
3602         TABSIZE.
3603         * src/pr.c: Include "hard-locale.h".
3604         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3605         POSIX specifies the behavior only in the POSIX locale.
3606         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3607         since POSIX says the behavior is unspecified here.
3608         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3609         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3610         * src/printf.c (main): Recognize --help, --version even if
3611         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3612         does not prohibit options either, so "printf" is like "expr" here.
3613         * src/unlink.c (main): Likewise.
3614         * tests/misc/printf: Adjust to the new semantics for \x if
3615         POSIXLY_CORRECT.
3616
3617 2004-06-14  Jim Meyering  <jim@meyering.net>
3618
3619         * tests/misc/pwd: New test, for fix of 2004-04-19.
3620         * tests/misc/Makefile.am (TESTS): Add pwd.
3621         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3622
3623         * src/copy.c: Remove declaration of euidaccess.
3624         Instead, include "euidaccess.h".
3625
3626 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
3627
3628         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3629         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3630         as (sizeof "??") reliably returns 3.
3631         (print_line): Guard against idle and pid being too long
3632         (which is possible when printing headers).
3633         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
3634         Avoid unnecessary cast of sizeof to int.
3635         (make_id_equals_comment): Do not assume that UT_ID returns
3636         a string; it might return a non-null-terminated array.
3637         Use strncat instead.  It's not very often where strncat is
3638         exactly what you want, but this is one of those rare cases.
3639
3640 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3641
3642         * src/who.c (list_entries_who): Don't output a trailing space.
3643
3644 2004-06-09  Jim Meyering  <jim@meyering.net>
3645
3646         * src/touch.c (usage): Improve wording in description of the
3647         --time=WORD option.  Reported by Dan Jacobson.
3648
3649         * src/chown-core.c (change_file_owner): Change names of parameters
3650         old_uid and old_gid to required_uid and required_gid respectively.
3651
3652         * src/chmod.c (mode_changed): Return false, not 0, now that the
3653         function returns `bool'.
3654
3655 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
3656
3657         Adjust chmod and chown to be similar if -c or -v are given.  In
3658         particular, a no-op chown is no longer reported as a change; this
3659         reverts to previous behavior.  Also, fix both commands so that -v
3660         report failures even if the failure is not due to the chmod or
3661         chown syscalls.
3662
3663         * src/chmod.c (CH_NOT_APPLIED): New constant.
3664         (describe_change): Handle it.
3665         (process_file): Use it, if a symlink wasn't changed.
3666         (mode_changed): Return bool, not int.  Accept new argument
3667         NEW_MODE; all callers changed.  This lets us avoid statting the
3668         file unless the new mode has unusual bits.
3669         (process_file): Return -1 on error.  With -v, report all errors
3670         verbosely, not just some.
3671
3672         * src/chown-core.c (change_file_owner): Return -1 on error, not
3673         1 sometimes and -1 on others.  Our caller ORs together our results,
3674         and (-1 | 1) == 0 on ones-complement hosts.
3675         With -v report all errors verbosely, not just some.
3676         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3677         file_stats wasn't set properly in that case.
3678
3679         * tests/chgrp/basic: Adjust to above changes.
3680
3681 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3682
3683         * tests/chgrp/basic: Test that chgrp -h does not fail on
3684         symlinks, even on hosts where that's not supported.
3685         Test that if -R is specified without -H or L, -h is assumed.
3686         Test that chown() is not optimized away.
3687
3688 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
3689
3690         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3691
3692           Check for incompatible options.  When -R and --dereference are
3693           both used, then either -H or -L must also be used.  When -R and -h
3694           are both used, then -P must be in effect.
3695
3696           -H, -L, and -P have no effect unless -R is also specified.
3697           If -P and -R are both specified, -h is assumed.
3698
3699           Do not optimize away the chown() system call when the file's owner
3700           and group already have the desired value.  This optimization was
3701           incorrect, as it failed to updated the last-changed time and reset
3702           special permission bits, as POSIX requires.
3703
3704           Do not report an error if the owner or group of a
3705           recursively-encountered symbolic link cannot be updated because
3706           the file system does not support it.
3707
3708         * NEWS: Document the above.
3709
3710         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
3711         requires either -H or -L, and -R -h requires -P.  If -H, specify
3712         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
3713         file as much like chown.c as possible.
3714         * src/chown.c (main): Likewise.
3715
3716         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3717         needed.  Chown a directory only after chowning its children; this
3718         avoids problems if the new directory ownership doesn't permit
3719         access to the children.  Dereference symlinks before doing
3720         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3721         Do not optimize away the chown() system call when the file's owner
3722         and group already have the desired value.  POSIX does not permit
3723         this optimization.  Rely on chown and lchown to do the right
3724         thing with symlinks and/or -1 arguments, now that we have wrappers
3725         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3726         errors, not just command-line errors.
3727         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3728
3729         * src/system.h (ENOTSUP): Remove.
3730
3731         * tests/chgrp/basic: Use chown --from to discover whether the
3732         group changed, since chgrp now changes unconditionally.  This
3733         complicates the sed script a bit.  Do not specify --dereference,
3734         since it's the default (and we want to test this).  Adjust output
3735         to match the fact that chgrp no longer optimizes the case of
3736         changing a file's group to the same value as before.
3737         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3738         options are incompatible, and their behavior is undefined with POSIX.
3739         (changed, not_changed): Adjust to match the fact that -h is no longer
3740         specified.  Sort names.
3741         * tests/chown/deref: Adjust error-diagnostic spelling to match new
3742         behavior.
3743
3744 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
3745
3746         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3747         prevented a diagnostic of any operands.
3748
3749 2004-06-08  Jim Meyering  <jim@meyering.net>
3750
3751         * src/shred.c (direct_mode): Turn it on/off with directio, too.
3752
3753 2004-06-07  Jim Meyering  <jim@meyering.net>
3754
3755         Enable direct-mode I/O (bypassing the buffer cache), if possible.
3756         Prompted by a suggestion from Kalle Olavi Niemitalo
3757         in http://bugs.debian.org/207035.
3758         * src/shred.c (direct_mode): New function.
3759         (do_wipefd): Turn on direct-mode I/O.
3760         (dopass): If a file's first write fails with EINVAL,
3761         turn off direct-mode I/O and retry the write.
3762
3763 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
3764
3765         * src/tr.c (main): "tr -d a b" is now a fatal error even if
3766         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
3767         option combination.
3768
3769 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
3770
3771         * src/shred.c (dopass): Don't subtract 1 from the offset after
3772         a write error.  Problem reported by Jon Peatfield in:
3773         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3774
3775 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
3776
3777         Fix bug reported by Buciuman Adrian in
3778         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3779         where 'dd' created a file that was too large.  The bug was that dd
3780         assumed that the input file offset does not advance after a failed
3781         read; but POSIX says that the input file offset is undefined after
3782         a failed read.
3783
3784         * src/dd.c (MAX_BLOCKSIZE): New macro.
3785         (input_seekable, input_seek_errno, input_offset,
3786         input_offset_overflow): New vars.
3787         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3788         (advance_input_offset): New function.
3789         (skip_via_lseek): Set errno to zero when reporting our failure,
3790         so that we don't report based on garbage errno.
3791         (skip): If fdesc is standard input, advance the input offset.
3792         Do not quit if reading, and if noerror was specified;
3793         POSIX seems to require this.
3794         If read fails on output file, report the earlier lseek failure
3795         instead; this fixes a FIXME in dd_copy.
3796         (advance_input_after_read_error): New function.
3797         (dd_copy): Use it, instead of assuming that failed reads
3798         do not advance the file pointer.  Advance input offset
3799         after nonfailed reads.  Advance only a partial block if
3800         the previous read (before the failed read) succeeded, and
3801         do not generate an output block of zeros in this case.
3802         (main): Determine initial input offset, seekability of input,
3803         and error if it wasn't seekable.
3804
3805 2004-06-02  Jim Meyering  <jim@meyering.net>
3806
3807         rm (without -f) could hang unnecessarily when attempting to
3808         remove a symlink to a file on an off-line NFS-mounted partition.
3809         Reported by David Howells in https://bugzilla.redhat.com/124699.
3810         * src/remove.c (write_protected_non_symlink): New function.
3811         Don't invoke euidaccess on symlinks.
3812         (prompt): Use write_protected_non_symlink rather than using
3813         euidaccess directly, being careful not to call lstat twice for a file.
3814
3815         Fix a bug in how the --output-delimiter=D option works with
3816         abutting byte or character ranges.  Reported by David Krider in
3817         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3818         * src/cut.c (print_kth): Remove special case for open-ended range.
3819         (set_fields): Record the range start index for an interval even
3820         when it abuts another interval on its low side.
3821         Also record the range start index of the longest right-open-interval.
3822         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3823         abutting and overlapping byte ranges.
3824
3825 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
3826
3827         Some POSIX-conformance cleanups for tr.
3828
3829         * src/tr.c (posix_pedantic): Remove; no longer needed since
3830         we need to test this in just one place now.
3831         (usage): Mention -C.
3832         (unquote): Note that \055, \n, etc are escaped.
3833         Do not worry about POSIXLY_CORRECT when warning about ambiguous
3834         escape sequences.
3835         \ at end of string stands for itself.
3836         Do not diagnose invalid backslash escapes: POSIX says the behavior
3837         is unspecified in this case, so we don't need to diagnose it.
3838         (main): Add support for -C (currently an alias for -c).
3839         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3840         a diagnostic here.
3841         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3842         Fix comment for range-a-a.
3843
3844 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
3845
3846         Improve the efficiency (and in one case, correctness) of code
3847         that reads symlinks.
3848
3849         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3850         royally if the link length is long (e.g., GNU/Hurd).  Use
3851         xreadlink instead, it's safer.  Don't bother to read the link if
3852         it's the wrong size.  Add a FIXME because this area is a bit murky
3853         and undocumented.
3854         * src/ls.c (get_link_name): Update use of xreadlink.
3855         * src/readlink.c (main): Likewise.
3856         * src/stat.c (print_stat): Likewise.
3857
3858 2004-06-01  Jim Meyering  <jim@meyering.net>
3859
3860         * src/env.c (main): Prefer the notation `STREQ (a, b)'
3861         over `!strcmp (a, b)'.
3862         * src/sort.c (main, sort_buffer_size): Prefer the notation
3863         `STREQ (a, b)' over `strcmp (a, b) == 0'.
3864         * src/date.c (batch_convert): Likewise.
3865         * src/expr.c (nextarg): Likewise.
3866         * src/su.c (correct_password, restricted_shell, main): Likewise.
3867         * src/ptx.c (swallow_file_in_memory, main): Likewise.
3868         * src/test.c (binary_operator, and, or, main): Likewise.
3869
3870 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
3871
3872         * NEWS: echo compatibility cleanup.
3873         * doc/coreutils.texi (echo invocation): Document the changes.
3874         * src/echo.c (V9_ECHO): Remove; always enabled.
3875         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3876         we use the same naming convention as bash.  Now an enum,
3877         not a macro.
3878         (usage): Reword to mention -e/-E more accurately.
3879         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3880         (hextobin): New function.
3881         (main): Use bool rather than int for local vars when appropriate.
3882         Do not allow options if POSIXLY_CORRECT, unless we are using
3883         BSD semantics and the first argument is "-n".
3884         Don't pass unnecessary extra arg to parse_long_options.
3885         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3886         Do not look for options if !allow_options.
3887         Use size_t rather than int when appropriate.
3888         Open-code option test rather than using strrchr.
3889         Use faster test for "-".
3890         Avoid redundant argc test.
3891         Add support for \x, for Bash compatibility.
3892         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3893         When '\c' is encountered, stop printing immediately, as POSIX
3894         requires.
3895         Add support for \xhh syntax.
3896         Add support for \0ooo syntax; POSIX requires this.
3897
3898 2004-06-01  Jim Meyering  <jim@meyering.net>
3899
3900         * Use automake-1.8b.  Regenerate dependent files.
3901
3902 2004-05-31  Jim Meyering  <jim@meyering.net>
3903
3904         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3905         the build src/ directory -- at the front.
3906         ($(srcdir)/$x-tests): Depend on Makefile.am.
3907         Use $x as the program name, except when it would be `test' (test is
3908         the sole program tested via mk-script that is also a shell built-in).
3909         In that case, use the old ../../src/$x.
3910
3911 2004-05-30  Jim Meyering  <jim@meyering.net>
3912
3913         Work around HPUX /bin/cc compiler bug that is exposed, now that
3914         sets are arrays of type `bool'.  More details here:
3915         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
3916         FIXME: verify that the above URL points to the right message
3917
3918         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
3919         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
3920         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
3921         system, those two expressions are not the same (256 vs. 1024).
3922         The effect of this problem was that `tr -c x y' would fail:
3923         tr: when not truncating set1, string2 must be non-empty
3924         (set_initialize): Remove unnecessary initialization of the `in_set'
3925         buffer; that initialization triggered the same compiler bug as above.
3926
3927 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
3928
3929         tr cleanup, mostly having to do with integer type ranges.
3930         Remove all casts.
3931
3932         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
3933         the test cases wouldn't be portable, or would take too much CPU
3934         time, or both.
3935
3936         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
3937         This is safe since the code already assumes N_CHARS fits in int.
3938         (Filter): Remove: we want to prototype everything.
3939         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
3940         (uchar): New function.  All places where a char must be converted
3941         to an unsigned char are now done this way, not by ad-hoc methods.
3942         (count): New type.  Use it whenever counts or states are needed.
3943         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
3944         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
3945         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
3946         whenever appropriate.
3947         (NOT_A_CHAR): Remove global macro; now a local enum.
3948         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
3949         the rest of the code no longer depends on them.
3950         (class_ok): Remove; all uses changed to use inline comparisons.
3951         (RE_NO_TYPE): Remove; wasn't used or needed.
3952         (struct List_element): normal_char and equiv_code are now unsigned
3953         char, not int.
3954         first_char, last_char, and the_repeated_char are now unsigned char,
3955         not unsigned int.  repeat_count is now count, not size_t.
3956         All uses changed.
3957         (struct Spec_list): state is now count, not unsigned int.
3958         lengthis now count, not size_t.
3959         n_indefinite_repeats is now size_t, not int.
3960         has_equiv_class, has_char_class, and has_restricted_char_class
3961         are now bool, not int.  All uses changed.
3962         (struct E_string): s is now char *, not unsigned char *.
3963         escaped is now bool *, not int *.  All uses changed.
3964         (ES_MATCH): Remove macro, replacing with:
3965         (es_match): New inline function.  All uses changed.
3966         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
3967         translating): Now bool, not int.
3968         (io_buf): Now char array, not unsigned char.
3969         (SET_TYPE): Remove.  All uses replaced with bool.
3970         (is_equiv_class_member, unquote, append_range, append_char_class,
3971         append_equiv_class, find_closing_delim, star_digits_closebracket,
3972         build_spec_list, parse_str, homogeneous_spec_list):
3973         Now returns bool, not int.  All uses changed.
3974         (is_equiv_class_member): Now inline.
3975         (is_equiv_class_member, is_char_class_member, make_printable_str,
3976         append_normal_char, append_range, append_repeated_char,
3977         get_s2_spec_stats):
3978         Args are now of proper integer type.
3979         (unquote, look_up_char_class, make_printable_str,
3980         append_equiv_class, build_spec_list, squeeze_filter):
3981         Avoid unsigned char *p; gently convert *p to unsigned char instead.
3982         (unquote, get_spec_stats): Do not jump past declarations and then
3983         use them; C doesn't allow this in portable programs.
3984         (make_printable_str): Check for overflow in size calculations.
3985         (xmemdup): Remove.  All uses rewritten.
3986         (find_bracketed_repeat): Args are now of proper pointer-to-integer
3987         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
3988         (find_bracketed_repeat, star_digits_closebracket): Check that the
3989         digits are not escaped.
3990         (build_spec_list): Don't bother to copy opnd_str; not needed.
3991         (build_spec_list, get_next): Simplify internal logic a bit.
3992         (card_of_complement): Fix bug due to char overflow.
3993         (get_spec_stats): Don't assume len fits into int.
3994         Check for integer overflow.  Use abort() rather than assert(0).
3995         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
3996         was being invoked.
3997         (squeeze_filter): READER is never null now; simplify code.
3998         READER arg now has a simpler type.  Remove unnecessary casts.
3999         (squeeze_filter, main): Calls to fwrite improperly checked result
4000         against zero, rather than against requested size.
4001         (plain_read): New function.
4002         (read_and_delete, read_and_xlate):
4003         Remove unused filter arg, and don't worry about hit_eof.
4004         Simplify by using plain_read.
4005         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4006         (main): Always pass a non-null procedure to squeeze_filter.
4007         Rewrite so that class_ok isn't needed.
4008
4009 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4010
4011         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4012         fdatasync reports EBADF when syncing (unwritable) directories.
4013         Problem reported by Albert Chin-A-Young in:
4014         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4015
4016 2004-05-29  Jim Meyering  <jim@meyering.net>
4017
4018         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4019         Patch from Albert Chin.
4020
4021         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4022
4023         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4024         into a single statement.
4025
4026 2004-05-28  Jim Meyering  <jim@meyering.net>
4027
4028         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4029
4030 2004-05-22  Jim Meyering  <jim@meyering.net>
4031
4032         rm -r would get a failed assertion when run from an inaccessible
4033         directory and with two or more command line arguments including an
4034         absolute-named directory followed by a relative-named directory.
4035
4036         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4037         * src/remove.c (struct cwd_state): Define.
4038         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4039         can be detected by the caller.  Instead of returning a malloc'd
4040         directory name, communicate it to caller via a new parameter, and
4041         return an indication of whether restore_cwd failed.  Update caller.
4042         Eliminate an unnecessary call to AC_stack_top.
4043         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4044         so we can now communicate to caller whether/how functions like
4045         restore_cwd have failed.  Update caller.
4046         (rm_1): Fail if we've failed to restore the working directory
4047         and the name of the next file to remove is `.'-relative.
4048         (rm): Fail if the require_restore_cwd flag is true and we've
4049         failed to restore the working directory.
4050         * src/mv.c (rm_option_init): Initialize new member,
4051         x->require_restore_cwd.
4052         * src/rm.c (rm_option_init): Likewise.
4053
4054 2004-05-21  Jim Meyering  <jim@meyering.net>
4055
4056         * tests/rm/inaccessible: New test for the above fix.
4057         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4058
4059         * src/remove.c (rm): Use free rather than XFREE.
4060         (remove_dir): Use xmalloc, not XMALLOC.
4061         (ds_init): Likewise.
4062
4063 2004-05-20  Jim Meyering  <jim@meyering.net>
4064
4065         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4066         diagnostics in shred.c have been fixed, don't exempt shred.c from
4067         this check.
4068
4069         * src/shred.c: Use translatable diagnostics, e.g.
4070         change "%s: remove" to _("%s: failed to remove") and
4071         change "%s: close"  to _("%s: failed to close").
4072
4073 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4074
4075         * src/shred.c (names): Bring back lower-case letters, "_", and
4076         ".".  But continue to omit +, =, %, @, #, as they're either
4077         shell metacharacters (for some shells) or are not in some
4078         character sets, or (in the case of '%') must be a
4079         metacharacter somewhere.
4080
4081 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4082
4083         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4084
4085 2004-05-17  Jim Meyering  <jim@meyering.net>
4086
4087         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4088
4089         chgrp and chown now dereference symlinks by default, per POSIX.
4090         Reported by Michal Politowski as http://bugs.debian.org/249177.
4091
4092         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4093         * src/chown.c (usage): Update to reflect this.
4094         * src/chgrp.c (usage): Likewise.
4095         * NEWS: Describe the change.
4096         Adapt tests accordingly.
4097         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4098         * tests/chgrp/deref: Likewise.
4099         * tests/chgrp/posix-H: Likewise.
4100
4101 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4102
4103         In shred, check for errors from fdatasync more carefully.  If
4104         fdatasync fails with errno==EINVAL, it means this implementation
4105         does not support synchronized I/O for this file.  Do not report
4106         this as an error, as (for example) AIX 5.2 fdatasync reports it
4107         for raw disk devices.  Problem reported by Albert Chin in
4108         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4109
4110         Check for write errors, though: the old code ignored them.
4111         Improve error checking in a few other cases, too (e.g., close of a
4112         directory).
4113
4114         Also, change several 'int' values to 'bool', so that the error
4115         checking is a bit clearer.  Similarly, change unsigned values
4116         to size_t where appropriate.
4117
4118         * src/shred.c: Include "dirname.h".
4119         (datasync) [!HAVE_FDATASYNC]: Remove.
4120         (dosync): New function.
4121         (dopass): Use it.  Return 1 on write error, -1 on other error.
4122         All callers changed.  Report write error if dosync does.
4123         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4124         not int (0/-1).  All callers changed.  Return false if there's a
4125         write error.
4126         (incname): Return bool (true/false), not int (0/1).  Accept
4127         size_t length, not unsigned.  All callers changed.  Do not
4128         bother checking for non-digits; it can't happen.  Replace
4129         recursion with iteration.
4130         (wipename): Use dir_name, base_name, etc. instead of assuming
4131         Unix file names.  Use size_t for length, not unsigned.
4132         Report error if unlink or close fails.
4133         (wipename, main): Use bool for booleans.
4134
4135         (names): Use only digits and uppercase letters, for greater
4136         portability.
4137
4138 2004-05-16  Jim Meyering  <jim@meyering.net>
4139
4140         * tests/chown/deref: New test for the yesterday's change.
4141         * tests/chown/Makefile.am (TESTS): Add deref.
4142
4143 2004-05-15  Jim Meyering  <jim@meyering.net>
4144
4145         chown --dereference did nothing when the owner/group of a
4146         symlink matched the desired owner/group.  Reported by David Malone.
4147         Also reported in 1999 as http://bugs.debian.org/39642.
4148
4149         * src/chown-core.c (change_file_owner): When --dereference has
4150         been specified, and when processing a symlink, stat it to get the
4151         owner and group of the referent.
4152
4153 2004-05-14  Jim Meyering  <jim@meyering.net>
4154
4155         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4156         s/supercede/supersede/ reported by Andrew Fabbro.
4157
4158 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4159
4160         Improve performance of `sort -m' on large files, at the cost of
4161         making some contrived examples unsafe.  POSIX allows this
4162         optimization.  Performance problem reported by Jonathan Baker in
4163         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4164
4165         * src/sort.c (first_same_file): Do not treat input pipes
4166         differently from other files.
4167         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4168         might write F before reading all the input.
4169         * NEWS: Likewise.
4170
4171 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4172
4173         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4174         '\007', for portability to EBCDIC hosts.
4175         * src/printf.c (print_esc_char): Likewise.
4176         * src/tr.c (unquote, make_printable_str): Likewise.
4177
4178 2004-05-12  Jim Meyering  <jim@meyering.net>
4179
4180         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4181         where the result is used.  This avoids one unnecessary lstat call
4182         per command line argument.
4183
4184 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4185
4186         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4187
4188         * src/Makefile.am (all_programs.list): New rule, copied from
4189         man/Makefile.am and tests/Makefile.am, except that we use the
4190         system tr rather than ./tr and we don't use tr -s.
4191         * tests/Makefile.am (all_programs): Use it.
4192         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4193         for consistency.  All uses changed.
4194
4195 2004-05-11  Jim Meyering  <jim@meyering.net>
4196
4197         * tests/rm/unread3: New test, for the above fix and today's
4198         lib/save-cwd.c improvement.
4199         * tests/rm/Makefile.am (TESTS): Add unread3.
4200
4201         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4202
4203 2004-05-10  Jim Meyering  <jim@meyering.net>
4204
4205         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4206         * tests/install/Makefile.am (TESTS): Add trap.
4207
4208         * src/remove.c (AD_push): Don't use errno in diagnostic about
4209         `changed dev/ino'.
4210
4211         Remove these generated files from CVS.
4212         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4213         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4214         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4215         * tests/tr/tr-tests, tests/wc/wc-tests:
4216
4217 2004-05-09  Jim Meyering  <jim@meyering.net>
4218
4219         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4220         a loop initializing the just-allocated memory to zero.
4221
4222 2004-05-08  Jim Meyering  <jim@meyering.net>
4223
4224         * tests/rm/no-give-up: New file; check for today's fix.
4225         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4226
4227 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4228
4229         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4230         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4231
4232         * src/remove.c (remove_entry): Check for errno values like ENOENT
4233         that show the file cannot be directory, instead of for errno
4234         values like EPERM that show the file might be a directory.  This
4235         is necessary because, when a single unlink() call has multiple
4236         reasons to fail, it can set errno to any of those reasons; it's
4237         only the rare errno value like ENOENT that excludes all the other
4238         possible reasons to fail even when the file is a directory.
4239         (remove_cwd_entries): Don't attempt chdir if the file is known
4240         to not be a directory.
4241         (remove_dir): Use the same method that remove_cwd_entries uses
4242         (for some reason they differed).  Don't assert that saved_errno
4243         must be EPERM; it might be just about anything.
4244
4245 2004-05-06  Jim Meyering  <jim@meyering.net>
4246
4247         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4248         Don't add `1' to the buffer size (it was to protect against malloc
4249         implementations that fail to allocate a buffer of size zero).
4250         That is no longer necessary, since we use a malloc wrapper
4251         on such systems.
4252
4253         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4254         * src/head.c (elide_tail_bytes_pipe): Likewise.
4255         * src/df.c (main): Likewise.
4256         * src/shred.c (do_wipefd): Likewise.
4257         * src/users.c (list_entries_users): Likewise.
4258         * src/tail.c (main): Likewise.
4259         * src/md5sum.c (main): Likewise.
4260
4261 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4262
4263         * src/df.c (show_disk, show_point): If several filesystems are
4264         mounted on the same mount point, prefer the last one, not the first.
4265         Problem reported by Christian Jones in
4266         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4267         (show_disk): Remove unused statp arg.  Return bool, not int.
4268         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4269         for lofs and dummies for each pass through the mount table,
4270         rather than subtly different algorithms (which are probably
4271         inadvertent).
4272
4273 2004-05-03  Jim Meyering  <jim@meyering.net>
4274
4275         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4276         have m4/Makefile*.
4277
4278 2004-05-01  Jim Meyering  <jim@meyering.net>
4279
4280         When chown or chgrp is modifying the referent of a symlink,
4281         use the chown(2) function, if possible.
4282         * src/chown-core.c (change_file_owner): Don't hard-code the
4283         open/fchown/close kludge here.  Use `chown' instead.
4284         The chown function works just fine on conforming systems.
4285         Other systems now go through the new chown wrapper that
4286         resorts to the old kludge.
4287
4288         * src/chown-core.c (change_file_owner): Add a comment.
4289
4290 2004-04-27  Jim Meyering  <jim@meyering.net>
4291
4292         * src/ptx.c: Make over 40 global extern variables `static'.
4293         (syntax_table, re_syntax_table): Remove declarations of two unused
4294         variables (they were exposed by the above change).
4295
4296         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4297         * src/ln.c (backup_type): Likewise.
4298
4299         * src/remove.c (rm): Add `extern' keyword.
4300         * src/cp-hash.c (forget_created, remember_created)
4301         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4302         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4303         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4304         (uid_to_name, chown_files): Likewise.
4305
4306         * src/Makefile.am (sc_tight_scope): New rule.
4307         * Makefile.maint (sc_tight_scope): New rule.
4308         (syntax-check-rules): Add it.
4309
4310 2004-04-26  Jim Meyering  <jim@meyering.net>
4311
4312         * Use automake-1.8.4.  Regenerate dependent files.
4313
4314         * src/sort.c (limfield): Make a comment clearer.
4315
4316 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4317
4318         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4319         leading blanks when computing the location of the field end;
4320         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4321         does conform to POSIX.  Also fix the documentation to clarify
4322         this and related issues.
4323
4324         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4325         that the options are in alphabetical order.  Describe how -b works
4326         more-accurately; this involves fixing some examples, too.  Mention
4327         what happens if the start field falls after an end field or after
4328         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4329         Add an example of how to sort IPv4 addresses and Apache Common
4330         Log Format dates.  Remove a duplicate example.
4331         (Putting the tools together): Use separate options rather
4332         than agglomerating them.
4333         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4334         decode whether to skip leading blanks.
4335         (trailing_blanks): Remove.
4336         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4337
4338         * tests/pr/Test.pm: Fix typo in env_default comment.
4339         * tests/sort/Test.pm: Likewise.
4340         (18c, 18d): Reverse the order of output lines, so that the
4341         test cases conform to POSIX.
4342
4343 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4344
4345         More signal-handling cleanup for ls.c.  Do not allow signals to
4346         happen between arbitrary output bytes, as the
4347         restore-default-color sequence can bollix up multibyte chars or
4348         color-change sequences in the ordinary output.  Instead, process
4349         signals only between printing a file name and changing the color
4350         back to non_filename_text color.  That way, if the signal handler
4351         changes the color (to the default), 'ls' will change it back when
4352         'ls' continues (after being suspended).
4353
4354         Also, do not bother with signal-handling unless stdout is a
4355         controlling terminal; this lets stdio buffer better when "ls
4356         --color" is piped or sent to a file.
4357
4358         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4359         Do not include "full-write.h"; no longer needed.
4360         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4361         (put_indicator_direct): Remove.  All callers changed to use
4362         put_indicator.
4363         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4364         (restore_default_color): Don't bother checking for put_indicator
4365         failure.
4366         (sighandler): Don't handle SIGTSTP; that's another handler now.
4367         Simply set interrupt_signal to the signal, then exit.
4368         (stophandler, process_signals): New functions.
4369         (main): Don't output any color changes until _after_ the signal
4370         handlers are set up.  This fixes a race condition where 'ls'
4371         could be interrupted while initializing colors, and leaving the
4372         terminal in an undesirable state.
4373         Don't mess with signal-handling if standard output is not a
4374         controlling terminal.
4375         When exiting, restore the default color, then restore the
4376         default signal handling, then act on any signals that weren't
4377         acted on yet.
4378         Do not print //DIRED// etc. in colors; this avoids the need
4379         to catch signals when printing them.
4380         (print_name_with_quoting): Process signals just before switching
4381         color back to non_filename_text.
4382
4383 2004-04-23  Jim Meyering  <jim@meyering.net>
4384
4385         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4386         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4387         of quotearg_buffer.  Patch by Mikulas Patocka.
4388
4389 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4390
4391         tee ignored SIGPIPE, but POSIX doesn't allow this.
4392
4393         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4394         does not allow this.  This undoes the 1996-10-24 patch.
4395
4396 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4397
4398         Signal-handling cleanup for coreutils.  Here are the highlights:
4399
4400          - csplit sometimes failed to remove files when interrupted.
4401          - csplit didn't clean up if two signals arrived nearly simultaneously.
4402          - install -s would infloop on System V if SIGCHLD was ignored.
4403          - ls could incorrectly restore color if multiple signals
4404            arrived nearly simultaneously.
4405
4406         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4407         Define.
4408         (filename_space, prefix, suffix, digits, files_created, remove_files):
4409         Now volatile.
4410         (caught_signals): New var.
4411         (cleanup): Block signals while deleting all files.
4412         (cleanup_fatal, handle_line_error, regexp_error):
4413         Mark with ATTRIBUTE_NORETURN.
4414         (create_output_file, close_output_file, interrupt_handler):
4415         Block signals while changing the number of output files,
4416         to fix some race conditions.
4417         (delete_all_files): Do nothing if remove_files is zero.
4418         Clear files_created.
4419         (main): Don't mess with signals until after argument processing
4420         is done.
4421
4422         * src/csplit.c (main): Rewrite signal-catching code to make it
4423         similar to other coreutils programs.  When processing signals,
4424         block all signals that we catch, but do not block signals that we
4425         don't catch.  Avoid problems with unsigned int warnings.
4426         * src/ls.c (main): Likewise.
4427         * src/sort.c (main): Likewise.
4428
4429         * src/csplit.c (interrupt_handler):
4430         Use void, not (obsolete) RETSIGTYPE.
4431         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4432
4433         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4434         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4435         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4436         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4437         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4438         for SIG_IGN.
4439         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4440
4441         * src/install.c: Include <signal.h>.
4442         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4443         given, since System V fork+wait does not work if SIGCHLD is ignored.
4444
4445         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4446         handler to self, not to SIG_IGN, since SIGTSTP can be received
4447         more than once.
4448         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4449         failures all over the place.
4450
4451 2004-04-20  Jim Meyering  <jim@meyering.net>
4452
4453         * src/remove.c (is_empty_dir): Clarify comment.
4454
4455         * man/help2man: Accept new option: --program-name=NAME, so that we
4456         can override the one in --version output.  This is needed solely
4457         so that test.1 doesn't refer to `[' as the program name.
4458         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4459         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4460
4461         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4462
4463         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4464
4465 2004-04-19  Jim Meyering  <jim@meyering.net>
4466
4467         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4468         Initialize a buffer to avoid warnings from tools like valgrind.
4469
4470         * Makefile.maint (sc_trailing_blank): New rule.
4471         (syntax-check-rules): Add it.
4472         * .x-sc_trailing_blank: New file.
4473
4474         Make pwd work even if the resulting name is so long that getcwd fails.
4475         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4476         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4477         (main): First try getcwd, then, upon failure, robust_getcwd.
4478
4479 2004-04-18  Jim Meyering  <jim@meyering.net>
4480
4481         * src/who.c (print_user): Use xrealloc here, rather than
4482         unchecked realloc.  Remove anachronistic casts.
4483
4484         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4485
4486         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4487         from remove.c.
4488         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4489         renaming it.  Update uses.
4490
4491 2004-04-17  Jim Meyering  <jim@meyering.net>
4492
4493         * configure.ac: Depend on automake-1.8.3.
4494
4495         * src/join.c (add_file_name): Declare function to be `static'.
4496         (string_to_join_field): Likewise.
4497         * src/remove.c (ds_init, ds_free): Likewise.
4498
4499         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4500         (syntax-check-rules): Add to the list.
4501
4502 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4503
4504         Use page-aligned buffers whenever we bother to do I/O using buffer
4505         sizes that are tailored for the files.
4506
4507         * src/cat.c: Include getpagesize.h.
4508         * src/copy.c: Likewise.
4509         * src/shred.c: Likewise.
4510         * src/split.c: Likewise.
4511         * src/cat.c (main): Align I/O buffers to page boundaries.
4512         * src/copy.c (copy_reg): Likewise.
4513         * src/shred.c (dopass): Likewise.
4514         * src/split.c (main): Likewise.
4515         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4516         All uses replaced by ptr_align.
4517         * src/od.c (gcd, lcm): Remove; now in system.h.
4518         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4519
4520 2004-04-14  Jim Meyering  <jim@meyering.net>
4521
4522         Remove m4/Makefile.am: it's no longer needed, with newer automake
4523         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4524         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4525
4526 2004-04-13  Jim Meyering  <jim@meyering.net>
4527
4528         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4529
4530 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4531
4532         * NEWS: cp -pu and mv -u (when copying) now take the destination
4533         file system time stamp resolution into account.
4534         * doc/coreutils.texi (mv invocation): Document this.
4535         (cp invocation): Document -u (it was missing!) with new behavior.
4536
4537         * src/copy.c: Include "utimecmp.h".
4538         (copy_internal): Compare time stamps using utimecmp rather than
4539         MTIME_CMP.
4540
4541 2004-04-09  Jim Meyering  <jim@meyering.net>
4542
4543         * Makefile.maint (.re-list): New rule/file, to replace
4544         hard-coded list of header file names.
4545         (sc_system_h_headers): Use the new file.
4546         Don't look for sys2.h anymore.
4547
4548         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4549         all of its macro definitions -- the list was slightly out of date.
4550         Suggestion from Dmitry V. Levin.
4551
4552 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4553
4554         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4555         * doc/coreutils.texi (dd invocation): Likewise.
4556         * src/shred.c (O_NOCTTY): Remove redundant decl.
4557         * src/dd.c (flags, usage): Remove noctty flag.
4558         (main): Always use O_NOCTTY when opening files.
4559
4560 2004-04-08  Jim Meyering  <jim@meyering.net>
4561
4562         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4563         (set_fd_flags): Undo part of today's change: it's a little
4564         cleaner -- and more efficient in the common case -- to go
4565         ahead and OR in the -1 when fcntl fails.
4566
4567         * Makefile.maint (sc_dd_max_sym_length): New target.
4568         (syntax-check-rules): Add it.
4569
4570         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4571         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4572
4573         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4574         Rename parameter, flags, to avoid shadowing global.
4575         (LONGEST_SYMBOL): Tweak comment.
4576
4577 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4578
4579         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4580         and new dd options iflag= and oflag=.
4581         * src/dd.c (usage): Likewise.
4582         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4583         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4584         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4585         (input_flags, output_flags): New vars.
4586         (LONGEST_SYMBOL): New macro.
4587         (struct symbol_value): Renamed from struct conversion.  Members
4588         symbol and value renamed from convname and conversion.  The
4589         symbol value is now an array instead of a pointer; this saves
4590         a bit of space and time in practice.  All uses changed.
4591         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4592         (flags): New constant array.
4593         (iflag_error_msgid, oflag_error_msgid): New constants.
4594         (parse_symbols): Renamed from parse_conversion and generalized
4595         to handle either conversion or flag symbols.
4596         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4597         support for iflag= and oflag=.  Reject attempts to use
4598         both excl and nocreat.
4599         (set_fd_flags): New function.
4600         (dd_copy): Just return X rather than calling quit (X), since our
4601         caller invokes quit with the returned value.  Add support for
4602         fdatasync and fsync.
4603         (main): Add support for iflag=, oflag=, and new conv= symbols.
4604         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4605         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4606
4607         * NEWS: Remove duplicate mention of BLOCKSIZE.
4608
4609 2004-04-02  Andreas Schwab  <schwab@suse.de>
4610
4611         * src/stty.c: Add support for IUTF8 input flag.
4612
4613 2004-04-06  Jim Meyering  <jim@meyering.net>
4614
4615         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4616         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4617
4618 2004-04-04  Jim Meyering  <jim@meyering.net>
4619
4620         A specified format is no longer automatically newline terminated.
4621         If you want a newline at the end of your format, use `\n'.
4622         * src/stat.c (print_it): Don't print a newline at the end of
4623         every format.
4624         (do_statfs): Add a newline at end of each default format string.
4625
4626 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4627
4628         * src/nohup.c (main): Adjust to new calling convention
4629         for set_cloexec_flag.
4630
4631 2004-03-31  Jim Meyering  <jim@meyering.net>
4632
4633         * tests/Fetish.pm (run_tests): Remove `.orig' file.
4634         Remove debugging diagnostic.
4635
4636         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4637         would not elicit an error.
4638         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4639         (main): Don't use atoi.  Use xstrtoul instead.
4640
4641 2004-03-30  Jim Meyering  <jim@meyering.net>
4642
4643         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4644         (syntax-check-rules): Add it.
4645         * .x-sc_prohibit_atoi_atof: New file.
4646
4647 2004-03-29  Jim Meyering  <jim@meyering.net>
4648
4649         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4650         test is not sensitive to system-dependent block size differences.
4651         Prompted by a report of Solaris 8 differences from Paul Eggert.
4652
4653         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4654         Rename `%tmp' to `%actual'.  Reverse order of last two args to
4655         _compare_files (to $actual, $expected) so as to match declaration.
4656
4657 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4658
4659         Fix some gotchas encountered when porting to Solaris 8, using
4660         the Forte 6u2 compiler.
4661
4662         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4663         Declare sethostname, since no Solaris header does it.
4664         * src/who.c: Include "vasprintf.h", for asprintf.
4665
4666 2004-03-28  Jim Meyering  <jim@meyering.net>
4667
4668         Minor optimization:
4669         * src/du.c (process_file): Don't record dev/inode for directories.
4670
4671         Under some circumstances, without -c, du would mistakenly count the
4672         space of hard-linked files, not just the first one it encountered.
4673         Reported by Anthony Thyssen.
4674         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4675
4676         * src/du.c: Rename global `print_totals' to `print_grand_total'.
4677
4678         * src/du.c (main): Rearrange filtering loop to be a tiny bit
4679         more efficient.
4680
4681         * src/chown-core.c: Don't include savedir.h -- no longer needed.
4682         * src/chmod.c: Likewise.
4683
4684 2004-03-25  Jim Meyering  <jim@meyering.net>
4685
4686         * src/du.c (main): Remove now-unused declaration of `i'.
4687
4688 2004-03-24  Paul Eggert  <eggert@twinsun.com>
4689
4690         * src/du.c (main): Filter out file names of length zero before
4691         invoking fts, so that they don't cause fatal errors.
4692
4693 2004-03-25  Jim Meyering  <jim@meyering.net>
4694
4695         * tests/du/files0-from (zero-len): Add a test for the above.
4696
4697 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4698
4699         * NEWS: New environment var BLOCKSIZE.
4700         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4701         * tests/envvar-check: Test for it.  Factor the code to simplify it.
4702
4703 2004-03-23  Paul Eggert  <eggert@twinsun.com>
4704
4705         * NEWS: Shorten the du --files0-from announcement, and say
4706         "NUL-terminated" rather than "NUL-separated".
4707         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4708         Remove: not used.
4709         (usage): Say "NUL-terminated", not "NUL-separated".
4710         (main): Check for I/O error when istream is closed.
4711         Allow --files0-from=F even if F is empty; this specifies no files.
4712         (du_files): Now that we allow the list of files to be empty,
4713         handle that case.
4714         * tests/du/files0-from: Adjust to above changes to src/du.c.
4715
4716 2004-03-24  Jim Meyering  <jim@meyering.net>
4717
4718         * tests/tail-2/assert: Avoid race condition that could cause
4719         spurious failure.  Based on a patch from Andreas Schwab.
4720
4721 2004-03-23  Jim Meyering  <jim@meyering.net>
4722
4723         * src/du.c (main): Free the hash table, too.
4724
4725 2004-03-22  Jim Meyering  <jim@meyering.net>
4726
4727         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4728         the change of 2004-01-22.  I can no longer reproduce the problem
4729         that prompted that change, and `info coreutils pr' would display the
4730         `printing text' section of the manual, not the one on `pr invocation'.
4731
4732         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4733         to match corrected output.
4734
4735         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4736         (main): Use readtoken0 functions rather than readtokens.
4737         Don't use errno when diagnosing readtokens0 failure.
4738         Fix off-by-one error in the token number reported in a diagnostic.
4739         (du_files): Return bool, rather than int.
4740         (main): Call readtokens0_free.
4741
4742 2004-03-21  Jim Meyering  <jim@meyering.net>
4743
4744         * src/remove.c (ds_free): Plug a small leak.
4745
4746         * tests/Fetish.pm: Fix typo in comment.
4747
4748 2004-03-07  Jim Meyering  <jim@meyering.net>
4749
4750         * NEWS: du accepts a new option --files0-from=FILE, where FILE
4751         contains a list of NUL-separated file names.
4752
4753         * src/du.c: Include "readtokens.h".
4754         (usage): Describe the new option, and adjust the `Usage':
4755         with this option, no FILE may be specified on the command line.
4756         (main): Handle the new option.
4757
4758         * tests/du/files0-from: New tests, for the above.
4759         * tests/du/Makefile.am (TESTS): Add files0-from.
4760
4761         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4762         * src/tsort.c (tsort): Likewise.
4763
4764 2004-02-29  Paul Eggert  <eggert@twinsun.com>
4765
4766         * NEWS: Add support for a new notation @N to get_date to represent
4767         the time stamp with numeric value N.  Improve support for
4768         fractional time stamps.  date's -d and -f options now accept them.
4769         Likewise for touch -t.  date has a new option --iso-8601=ns.
4770
4771         * doc/coreutils.texi (touch invocation):
4772         Describe use of fractional seconds.
4773         (date invocation, Options for date): Likewise.
4774         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4775         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4776         (Options for date): Describe new --iso-8601=ns option.
4777
4778         * doc/getdate.texi: Add copyright notice.  Change getdate to
4779         get_date when talking about the function name.
4780         (Seconds since the Epoch): New section, containing the time_t
4781         info moved from Date input formats section, along with new
4782         info about the @ syntax.  Mention negative time stamps,
4783         fractional time stamps, and leap seconds.
4784         (General date syntax): Modernize examples a bit to reflect new
4785         features.
4786         (General date syntax, Relative items in date strings):
4787         Use ' rather than " to quote formats.
4788         (Time of day items): Add an example with fractional seconds.
4789         Describe fractional-second syntax.
4790
4791         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4792         needs clock_gettime.
4793
4794         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4795         (time_spec_string, time_spec, show_date): Support it.
4796         (usage): Remove description of -ITIMESPEC, as it's obsolete and
4797         confusing.  Mention --iso-8601=ns.
4798         (batch_convert): getline returns ssize_t, not int.
4799
4800         * src/touch.c (newtime): Now an array of two timespecs, one
4801         for access and one for modification.
4802         (ref_stats): Remove.
4803         (get_reldate): Use get_date's parameter profile.
4804         (touch, main): Adjust to above changes.
4805         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4806         Use gettime instead of gettimeofday, for new get_date signature.
4807
4808         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4809         ns-relative.
4810
4811 2004-03-15  Jim Meyering  <jim@meyering.net>
4812
4813         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4814         target before updating $(prev_version_file).
4815
4816         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4817         See today's change in lib/getdate.y.
4818         * tests/misc/Makefile.am (TESTS): Add date-sec.
4819
4820 2004-03-14  Jim Meyering  <jim@meyering.net>
4821
4822         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4823         signature files, not `.asc'.  Reported by angico@yahoo.com.
4824
4825 2004-03-13  Jim Meyering  <jim@meyering.net>
4826
4827         * src/cp.c (do_copy): Tweak wording in a diagnostic.
4828         Suggestion from Karl Berry.
4829         Include "quoatearg.h".
4830         (do_copy): Use quotearg_colon (not quote) for diagnostics
4831         that begin with `"%s:'.
4832
4833         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4834         Suggestion from Dan Jacobson.
4835
4836 2004-03-12  Jim Meyering  <jim@meyering.net>
4837
4838         * Version 5.2.1.
4839
4840         Sometimes, when source and destination partition are different,
4841         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
4842
4843         * src/copy.c: When moving a set of N hard-linked files between
4844         partitions, via two or more command line arguments where the
4845         command line argument containing the Nth link contains no other
4846         link to that same file, mv would mistakenly copy the file, rather
4847         than hard-linking it to the other(s).  That happens because when the
4848         final link is processed, its link count has been reduced to 1 since
4849         the other links have been `copied' to the destination partition
4850         and the source links have been removed.
4851         (copy_internal): When in move mode, use the source dev/inode
4852         pair to look up destination name even when st_nlink == 1.
4853         * src/cp-hash.c (src_to_dest_lookup): New function.
4854         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4855         * tests/mv/part-hardlink: New file.  Test for the above fix.
4856         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4857
4858         * announce-gen: Sync with autoconf.
4859
4860         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4861         This was triggered on a Linux-2.2.19 system using a file system
4862         NFS-mounted from some sort of Sun.
4863
4864 2004-03-11  Jim Meyering  <jim@meyering.net>
4865
4866         * Use automake-1.8.3.  Regenerate dependent files.
4867
4868 2004-03-10  Jim Meyering  <jim@meyering.net>
4869
4870         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4871         so that this test works with SELinux-enabled systems.
4872         Based on a patch from Tim Waugh.
4873
4874         `join -1 x' would give a misleading diagnostic
4875         * src/join.c (string_to_join_field): Report that a non-numeric field
4876         number is invalid, rather than `so large that it is not representable'.
4877         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4878
4879 2004-03-06  Jim Meyering  <jim@meyering.net>
4880
4881         cp --sparse=always sparse-image-file.img /dev/hda1 could
4882         produce an invalid copy on the destination device.
4883
4884         * src/copy.c (copy_reg): Even with --sparse=always, try to
4885         make `holes' only if the destination is a regular file.
4886         Reported by Szakacsits Szabolcs.
4887
4888 2004-03-03  Paul Eggert  <eggert@twinsun.com>
4889
4890         * src/nohup.c (main): Don't invoke set_cloexec_flag with
4891         a file descriptor of -1.
4892
4893 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
4894
4895         * src/nohup.c: Include "cloexec.h".
4896         (main): Set the copy of stderr to close on exec.
4897
4898 2004-03-01  Paul Eggert  <eggert@twinsun.com>
4899
4900         * configure.ac: Include <signal.h> when checking for strsignal,
4901         sys_siglist, and friends.  Problem reported by Tony Leneis in
4902         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4903
4904 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4905
4906         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4907         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4908         etc. are set.
4909
4910 2004-02-23  Paul Eggert  <eggert@twinsun.com>
4911
4912         * NEWS: Document how chown's USER.GROUP argument is now parsed.
4913
4914 2004-02-23  Jim Meyering  <jim@meyering.net>
4915
4916         * src/seq.c (usage): Remove stray space after \n in --help output.
4917
4918 2004-02-22  Jim Meyering  <jim@meyering.net>
4919
4920         * src/du.c (usage): Separate -H and --si.  Say that the meaning
4921         of -H will soon change to that of --dereference-args (-D).
4922
4923 2004-02-21  Jim Meyering  <jim@meyering.net>
4924
4925         * src/comm.c (usage): Tell what comm does when there are no options.
4926         Reword in terms of FILE1 and FILE2 rather than `left file' and
4927         `right file'.  Suggestion from Dan Jacobson.
4928
4929 2004-02-15  Paul Eggert  <eggert@twinsun.com>
4930
4931         Fix some POSIX-conformance bugs in expr.
4932
4933         * NEWS: document the following changes to src/expr.c.
4934         * doc/coreutils.texi (expr invocation): Likewise.
4935         Document what forms integers may take, and say "integer"
4936         consistently instead of "number".  Warn about operands
4937         that "expr" can misinterpret, and how to work around the
4938         problem.
4939         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
4940         Accept a bool argument specifying whether to evaluate the
4941         expression.  This is to allow short-circuit evaluation.  All
4942         callers changed.
4943         (null): Report that a string is zero even if it has
4944         a form like "-0" or "00".
4945         (eval1, eval): Use short-circuit evaluation for | and &.
4946         (eval): Return 0 if both arguments are null or zero, instead
4947         of returning the first argument.
4948         * tests/expr/basic: Add some tests for the above.
4949
4950 2004-02-17  Jim Meyering  <jim@meyering.net>
4951
4952         * Version 5.2.0.
4953
4954         `make check' from a build inside a chroot environment would fail
4955         * tests/help-version: Specify an argument (`/') for df, in the
4956         unusual event that there is no valid entry in /etc/mtab.
4957         Likewise for id: add the -u option, so we don't get spurious
4958         failures when there are no user or group names.
4959         Patch by Tim Waugh.
4960
4961         * src/sort.c (usage) [-u]: Add punctuation so that the description in
4962         the help2man-generated (line-joined) man page is more readable.
4963         Reported by Tim Waugh.
4964         [-T]: Add a semicolon, for the same reason.
4965
4966 2004-02-15  Jim Meyering  <jim@meyering.net>
4967
4968         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
4969
4970 2004-02-11  Jim Meyering  <jim@meyering.net>
4971
4972         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
4973         $(srcdir)/../Makefile.am.in, rather than $<.
4974         Suggestion from Michael Elizabeth Chastain.
4975
4976 2004-02-10  Jim Meyering  <jim@meyering.net>
4977
4978         * config/install-sh: Make this script executable.
4979         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
4980         is executable.  Otherwise, on systems that lack a suitable install
4981         binary, `make install' would fail, because of the way this script
4982         is invoked (without `$SHELL ' prefix).
4983         Reported by Bob Proulx.
4984
4985 2004-02-08  Jim Meyering  <jim@meyering.net>
4986
4987         * Version 5.1.3.
4988
4989         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
4990         that would cause an unwarranted test failure.
4991         * tests/rm/rm3: Likewise.
4992
4993 2004-02-07  Jim Meyering  <jim@meyering.net>
4994
4995         Remove xstat function pointer member.  The way it was used was not
4996         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
4997         inline `stat' and `lstat' functions, thus making the tests of
4998         `xstat == lstat' in copy.c always fail.
4999         * src/copy.h (struct cp_options) [xstat]: Remove member.
5000         (XSTAT): New macro.
5001         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5002         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5003         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5004         (valid_options): Remove now-obsolete FIXME comments.
5005
5006         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5007         `*(x->xstat) (...)'.
5008         (do_copy): Declare/use local xstat rather than x->xstat.
5009         (main): Remove code that set x.xstat.
5010         * src/mv.c (cp_option_init): Don't initialize xstat member.
5011         * src/install.c (cp_option_init): Likewise.
5012
5013         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5014         so that emit_upload_commands can use these variables, too.
5015
5016 2004-02-06  Jim Meyering  <jim@meyering.net>
5017
5018         * tests/rm/deep-1: Remove `du' stack space test.
5019         Apparently, `ulimit -s N' isn't portable enough.
5020         This test will be restored (with a guard against losing ulimit)
5021         in its own file later.
5022
5023         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5024         since this test doesn't take long enough to merit them.
5025         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5026
5027         * Makefile.maint (signatures): Remove definition.
5028         Now, automake's gnupload handles this.
5029         (%.sig: %): Remove now-unused rule.
5030         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5031         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5032         (emit-upload-commands): Adjust to use gnupload.
5033
5034 2004-02-05  Jim Meyering  <jim@meyering.net>
5035
5036         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5037         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5038         Now, those are all defined in timespec.h.
5039         Include timespec.h.
5040
5041         * src/date.c: Don't include timespec.h, now that system.h does it.
5042
5043 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5044
5045         Don't dump core if localtime returns NULL (possible on
5046         hosts with 64-bit time_t and 32-bit int).
5047         * src/date.c: Include "inttostr.h".
5048         (batch_convert, main):
5049         If time conversion fails, exit with nonzero status.
5050         (show_date): Return int to report conversion failure.
5051         Print the time as an int if localtime fails.
5052         * src/uptime.c: Print "??" if the current clock can't
5053         be converted by localtime.  This won't happen until the year
5054         2*31 + 1900, but we don't want to dump core even if the current
5055         clock has the wrong value.
5056
5057         * src/stat.c: Include "inttostr.h".
5058         (human_time): Print the date/time as a number of seconds since the
5059         epoch if it can't be converted by localtime.  This is better than
5060         just saying "invalid", and is consistent with what "ls" does.
5061         Don't dump core if the year has more than 48 digits; this isn't
5062         possible on any contemporary host, but we might as well do it right.
5063
5064 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5065
5066         * src/stat.c (human_time): Accept time rather than
5067         pointer-to-const-time parameter, for clarity.  All callers changed.
5068
5069 2004-02-02  Jim Meyering  <jim@meyering.net>
5070
5071         * src/stat.c (do_stat): Remove extra trailing newline from
5072         default formats.  Reported by Nelson H. F. Beebe.
5073
5074         Print actual fractional seconds in time stamps, not just `.00000000'.
5075         * src/stat.c (human_time): Add and use new parameter, t_ns.
5076         (print_stat): Update callers.
5077         * src/ls.c (TIMESPEC_NS): Remove definition.
5078         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5079         also uses this macro.
5080         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5081         fractional seconds for files on an XFS file system, but that stat's
5082         fractional seconds were always zero.
5083
5084 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5085
5086         * src/seq.c (print_numbers): Use 'double' for loop index, not
5087         'int', to avoid problems with integer overflow.  On almost all
5088         machines 'double' works in every case where 'int' works, and
5089         it works on other cases besides.
5090
5091 2004-01-27  Jim Meyering  <jim@meyering.net>
5092
5093         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5094         it defaults to 1, even when FIRST is larger than LAST.
5095         Reword so as not to exclude the possibility that INCREMENT be zero.
5096
5097 2004-01-25  Jim Meyering  <jim@meyering.net>
5098
5099         * Version 5.1.2.
5100
5101         * Makefile.maint (signatures): Comment out definition.
5102
5103 2004-01-23  Jim Meyering  <jim@meyering.net>
5104
5105         * Makefile.maint (header_regexp): Add exitfail.
5106
5107         * man/Makefile.am (EXTRA_DIST): Add help2man.
5108         Reported by Nelson H. F. Beebe.
5109
5110         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5111         so it works on systems with Perl installed somewhere other than in
5112         /usr/bin.
5113
5114         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5115         `int', not `char', since it must hold EOF.  This bug would make
5116         paste infloop on some systems.  Test failures reported by
5117         Nelson H. F. Beebe and Christian Krackowizer.
5118
5119 2004-01-22  Jim Meyering  <jim@meyering.net>
5120
5121         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5122         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5123
5124         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5125         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5126         Use --info-page='coreutils PROG' option.
5127         Now, readlink.1 refers the user to `info coreutils readlink'
5128         rather than to `info readlink'.  Reported by Matt Swift.
5129
5130 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5131
5132         Exit status cleanup.
5133
5134         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5135         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5136         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5137         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5138         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5139         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5140         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5141         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5142         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5143         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5144         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5145         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5146         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5147         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5148         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5149         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5150         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5151
5152         * src/cat.c (usage): Don't bother normalizing exit status
5153         since the arg is already the correct exit status now.
5154         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5155         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5156         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5157         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5158         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5159
5160         * src/chown.c (main): Removed unused local 'fail'.
5161
5162         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5163         Remove.
5164
5165         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5166         * src/env.c, src/nice.c, src/su.c: Likewise.
5167         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5168         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5169         * src/expr.c (main): Use initialize_exit_failure rather than
5170         setting exit_failure directly; this optimizes away redundant
5171         assignments.
5172         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5173
5174         * src/chroot.c (main): Exit with status 1 rather than 127
5175         if chroot itself fails, as per documentation.
5176
5177         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5178         rather than roll-your-own symbols or integers.
5179         * src/env.c (main): Likewise.
5180         * src/nohup.c (main): Likewise.
5181         * src/su.c (run_shell): Likewise.
5182
5183         * src/cp.c (exit_status): Remove static var....
5184         (main): Making it local here instead.  Use =, not |=, to set it.
5185
5186         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5187         not 2, on errors.
5188         * src/date.c (batch_convert, main): Likewise.
5189         * src/dd.c (dd_copy): Likewise.
5190         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5191         * src/tr.c (main): Likewise.
5192         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5193         POSIX doesn't require it.
5194         * src/dd.c (write_output, skip, dd_copy): Likewise.
5195         * src/df.c (main): Likewise.
5196         * src/id.c (main): Likewise.
5197         * src/install.c (main): Likewise.
5198         * src/ln.c (main): Likewise.
5199         * src/ls.c (main): Likewise.
5200         * src/mv.c (main): Likewise.
5201         * src/shred.c (main): Likewise.
5202
5203         * src/env.c (main): Exit with status 1, not 2, on errors detected
5204         by env proper.
5205         * src/hostname.c (main): Likewise.
5206         * src/nl.c (main): Likewise.
5207         * src/stty.c (main): Likewise.
5208
5209         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5210         consistency with the other programs' naming conventions.
5211         All uses changed.
5212
5213         * src/factor.c (main): Do not report a usage error simply
5214         because stdin has bad numbers.
5215
5216         * src/id.c (problems): Now a boolean int, not a counter,
5217         so that we don't have to worry about int overflow.  All uses changed.
5218         * src/touch.c (err): Likewise.
5219
5220         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5221
5222         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5223         * src/mknod.c: Likewise.
5224
5225         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5226         on error; this is in case EXIT_FAILURE is unusual.
5227         * src/su.c (main): Likewise.
5228
5229         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5230         changed to EXIT_CANNOT_INVOKE.
5231
5232         * src/printenv.c (PRINTENV_FAILURE): New constant.
5233         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5234         command-line syntax problems.
5235
5236         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5237         (main): Avoid integer overflow when seeing whether errors occurred.
5238
5239         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5240         All callers changed.
5241         (main): Remove unused local variable 'errs'.  Always exit successfully
5242         if we reach the end.
5243
5244         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5245         for consistency with other programs here.  All uses changed.
5246         (main): Use 'error' to exit rather than invoking 'exit' here.
5247
5248         * src/sort.c: Don't include <assert.h>.
5249         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5250         (usage): Don't use 'assert'.
5251         (main): Remove redundant assignment to exit_failure.
5252
5253         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5254         New enum values.
5255         (initialize_exit_failure): New inline function.
5256         Include exitfail.h here, since we refer to exit_failure.
5257         All callers changed to not include exitfail.h.
5258
5259         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5260         substitute them for the corresponding integer constants.
5261
5262         * tests/help-version (expected_failure_status_date): Remove, as
5263         'date' is now normal.
5264         (expected_failure_status_nohup): New var.
5265
5266 2004-01-21  Jim Meyering  <jim@meyering.net>
5267
5268         * tests/touch/relative: Remove `command' syntax.
5269         Thanks to Nelson H. F. Beebe and Paul Eggert.
5270
5271         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5272         so as to avoid problems with systems using TAI clocks.
5273         Although it's no longer necessary, set TZ=UTC0 also for the
5274         initial touch command.  Reported by Paul Jarc here:
5275         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5276
5277 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5278
5279         * src/dircolors.hin: Add .mov to the list of media files.
5280
5281 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5282
5283         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5284         portable).  Problem reported by Christian Krackowizer.  Also, use
5285         +0000 rather than +0 to specify a time zone, as the documentation
5286         requires four digits.
5287
5288 2004-01-19  Jim Meyering  <jim@meyering.net>
5289
5290         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5291         * tests/mv/backup-is-src: Likewise.
5292         Problem reported by Peter Horst
5293
5294 2004-01-17  Jim Meyering  <jim@meyering.net>
5295
5296         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5297
5298         * Version 5.1.1.
5299
5300 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5301
5302         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5303         with -r specifying the origin for -d.
5304         * src/touch.c (flexible_date): Remove static var.
5305         (get_reldate): New function.
5306         (main): Use it, to implement this new behavior.
5307
5308 2004-01-16  Jim Meyering  <jim@meyering.net>
5309
5310         * tests/touch/relative: New test for the above.
5311         * tests/touch/Makefile.am (TESTS): Add relative.
5312
5313 2004-01-13  Jim Meyering  <jim@meyering.net>
5314
5315         * src/system.h: Include contents of sys2.h.
5316         * src/sys2.h: Remove file.
5317         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5318
5319         * Use automake-1.8.2.  Regenerate dependent files.
5320
5321         * Update to gettext-0.13.1.
5322         * configure.ac: Use gettext-0.13.1.
5323         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5324
5325 2004-01-12  Jim Meyering  <jim@meyering.net>
5326
5327         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5328
5329         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5330         Reported by Alexandre Duret-Lutz.
5331
5332         * src/tail.c (main): Warn about following stdin only when it's a tty.
5333
5334         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5335
5336 2004-01-10  Jim Meyering  <jim@meyering.net>
5337
5338         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5339
5340 2004-01-09  Jim Meyering  <jim@meyering.net>
5341
5342         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5343
5344 2004-01-08  Jim Meyering  <jim@meyering.net>
5345
5346         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5347         From Andreas Schwab.
5348
5349         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5350         remnant) from PATH component.  That would cause tests in this directory
5351         not to run the just-built binaries, but rather whatever happened
5352         to be in one's PATH.  Reported by Christian Krackowizer.
5353
5354 2004-01-04  Jim Meyering  <jim@meyering.net>
5355
5356         * src/csplit.c (new_control_record): Use x2nrealloc
5357         rather than xrealloc.
5358
5359         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5360         alloca and strcpy.
5361         (make_path_private): Likewise.
5362
5363 2004-01-03  Jim Meyering  <jim@meyering.net>
5364
5365         * src/paste.c: Use `bool' (not int) as the type for a few
5366         global variables.
5367         (collapse_escapes): Rewrite to set globals rather than modifying
5368         its parameter.
5369         Use size_t (not int) for all counters and related index variables.
5370         (paste_parallel): Remove needless complexity of
5371         using xrealloc in the loop;  just allocate the buffers up front.
5372         Free the two temporary buffers.
5373         Move declarations of locals `down' into scope where used.
5374         (paste_serial): Remove `register' attributes.
5375         (main): Simplify delim-related code.
5376         Free `delims', now that it's malloc'd.
5377
5378 2004-01-02  Jim Meyering  <jim@meyering.net>
5379
5380         * src/chroot.c: Include "quote.h".
5381         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5382         (main): Exit with status of 127, not 1, for too-few-args,
5383         chroot failure, or chdir failure.
5384         Give a better diagnostic upon execvp failure.
5385
5386         * src/du.c (usage): Mention that, with its current meaning,
5387         -H is deprecated.
5388
5389         * src/tail.c (main): Warn about following stdin when it's a tty.
5390         Fail when following by name but no names are specified.
5391
5392 2003-12-30  Jim Meyering  <jim@meyering.net>
5393
5394         * src/fold.c (main): Use memcpy, not strcpy.
5395
5396         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5397         alloca and strcpy.
5398
5399 2003-12-28  Jim Meyering  <jim@meyering.net>
5400
5401         * src/unexpand.c (n_tabs_allocated): New global.
5402         (add_tabstop): Use x2nrealloc rather than xrealloc.
5403         * src/expand.c: Likewise.
5404
5405         * tests/misc/expand: New file.
5406         * tests/misc/Makefile.am (TESTS): Add expand.
5407
5408         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5409         (fillbuf): Use x2nrealloc rather than xrealloc.
5410         (sort): Use xnmalloc rather than xmalloc.
5411         (main): Likewise.
5412
5413 2003-12-27  Jim Meyering  <jim@meyering.net>
5414
5415         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5416
5417 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5418
5419         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5420         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5421
5422         * doc/coreutils.texi (join invocation): Remove documentation
5423         accordingly.  Document that -t makes all separators significant.
5424
5425         * src/join.c: Include posixver.h.
5426         (obsolete_usage): New var.
5427         (longopts): Put obsolete options first.
5428         (OBSOLETE_LONG_OPTIONS): New constant.
5429         (get_option, add_file_name): New functions.
5430         (main): Use them to support new behavior.
5431         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5432         Do not mark -j FIELD as obsolescent; it is longstanding
5433         UNIX tradition and is a valid extension to POSIX.
5434
5435         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5436
5437 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5438
5439         * src/join.c (add_field_list): Don't use alloca with unbounded
5440         size; just modify the argument, which is no longer const *.
5441
5442         Various other minor cleanups, mostly to avoid the need for casts.
5443
5444         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5445
5446         (struct field.beg): Now char *, not unsigned char const *.  All
5447         uses changed.  It shouldn't be const since xmemcoll writes on its
5448         arguments.
5449         (extract_field): Likewise, for 2nd arg.
5450         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5451
5452         (is_blank): New function, to avoid need to cast arg to unsigned char.
5453         (extract_field): Use it.
5454
5455         (xfields): Rewrite pretty much from scratch.
5456
5457         (hard_LC_COLLATE): Now bool, not int.
5458         (get_line, getseq, add_field_list): Now returns bool, not int.
5459         (decode_field_spec, add_field_list): Return true on success (not
5460         false), for consistency with the rest of the code.  All uses changed.
5461
5462         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5463         but is slightly cleaner.
5464         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5465
5466         (empty_filler): Now const *.
5467
5468         (make_blank): Remove; wasn't needed.  Remove all calls.
5469         (main): Don't set uni_blank.nfields; zero is fine.
5470
5471 2003-12-27  Jim Meyering  <jim@meyering.net>
5472
5473         * src/join.c: Include "quote.h".
5474         (min, max): Remove definitions.
5475         Make a few function parameters and corresponding
5476         locals `const'.  Use bool for boolean variables.
5477         Use size_t (not int) for all counters and related index variables.
5478         (prjoin): Remove now-useless assertion.
5479         (string_to_join_field): New function.
5480         (main): Accept join fields as large as SIZE_MAX.
5481         (keycmp): Rename `min' to MIN and max to MAX.
5482
5483 2003-12-26  Jim Meyering  <jim@meyering.net>
5484
5485         fold -s didn't work on e.g., alpha-based systems.
5486         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5487         x2nrealloc works properly on systems with differing sizes for int
5488         and size_t.  Reported by Nelson Beebe.
5489
5490         * src/fold.c: Use `bool' (not int) as the type for a few
5491         global variables.
5492
5493 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5494
5495         * src/ls.c (length_of_file_names_and_frills):
5496         Remove forward decl; not needed.
5497         (print_file_name_and_frills, length_of_file_name_and_frills):
5498         With -m, don't output spaces before inum or size.
5499         (print_with_commas): Don't output space just before newline.
5500
5501 2003-12-24  Jim Meyering  <jim@meyering.net>
5502
5503         * tests/ls/Makefile.am (TESTS): Add m-option.
5504         * tests/ls/m-option: New file.  Test for above fixes.
5505
5506 2003-12-20  Jim Meyering  <jim@meyering.net>
5507
5508         * Version 5.1.0.
5509
5510         * src/pr.c: Change type of global, buff_allocated, to size_t.
5511
5512         * src/join.c [struct seq]: Change types of members count and alloc
5513         from `int' to `size_t'.
5514
5515         * tests/Makefile.am (root-hint): Tweak wording.
5516
5517         * src/du.c: Accept new option (-0, --null) that makes it so each
5518         output line is NUL-terminated rather than newline-terminated.
5519
5520         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5521         Reported by Volker Paul.
5522         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5523         * tests/dd/unblock-sync: New test for the above.
5524
5525 2003-12-19  Jim Meyering  <jim@meyering.net>
5526
5527         * tests/misc/nohup: Double quote back-ticked expression,
5528         in case it ends up having an unexpected value.
5529
5530         * tests/ls/no-arg: Use ls's -1 option in both runs.
5531
5532         * src/du.c (fts_debug): New global.
5533         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5534         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5535         (main) [DU_DEBUG]: Accept -d option.
5536
5537 2003-12-18  Jim Meyering  <jim@meyering.net>
5538
5539         * src/ls.c (format_user): Increment dired_pos via two statements,
5540         `dired_pos += width; dired_pos++;' rather than one,
5541         `dired_pos += width + 1;' since the latter could conceivably overflow.
5542         (format_group): Likewise.
5543         From Paul Eggert.
5544
5545         * configure.ac: Require automake-1.8.
5546
5547 2003-12-12  Jim Meyering  <jim@meyering.net>
5548
5549         * Use automake-1.8.  Regenerate dependent files.
5550
5551 2003-12-08  Jim Meyering  <jim@meyering.net>
5552
5553         * Makefile.maint (news-date-check): New rule.
5554         (alpha beta major): Depend on it.
5555
5556 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5557
5558         * NEWS: ls -l (and similar options) now adjust all columns to
5559         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5560         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5561         (format_user_width, format_group_width, unsigned_file_size,
5562         format_group): New functions.
5563         (block_size_width): Renamed from block_size_size.
5564         (inode_number_width, nlink_width, owner_width, group_width,
5565         author_width, major_device_number_width, minor_device_number_width,
5566         file_size_width): New vars.
5567         (clear_files): Initialize them.
5568         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5569         (print_long_file): Use them.
5570         (gobble_file): Use a new local variable 'f' to make the code
5571         smaller and more consistent with other functions.
5572         (format_user): Output to stdout, not to a buffer, so that we
5573         don't have to worry about buffer overrun.  Update dired_pos.
5574         (print_long_file): Don't put owner, group, author into buffer;
5575         just print them directly.  Don't assume link counts and
5576         major and minor numbers fit into unsigned long int.
5577         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5578         'ls' output is fixed-width.
5579
5580 2003-12-02  Jim Meyering  <jim@meyering.net>
5581
5582         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5583
5584 2003-11-27  Jim Meyering  <jim@meyering.net>
5585
5586         * Use automake-1.7f.  Regenerate dependent files.
5587
5588 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5589
5590         Parse floating-point operands and options in the C locale.
5591         POSIX requires this for printf, and we might as well be
5592         consistent elsewhere (tail, sleep, seq).
5593
5594         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5595         needed now that we assume C89.  Include "c-strtod.h".
5596         (xstrtod): Call c_strtod, not strtod.
5597         * src/sleep.c: Include "c-strtod.h".
5598         (main): Update xstrtod call to include new argument, c_strtod.
5599         * src/seq.c (scan_double_arg): Likewise.
5600         * src/tail.c (parse_options): Likewise.
5601
5602 2003-11-24  Jim Meyering  <jim@meyering.net>
5603
5604         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5605         Reported by Mark Conty.
5606
5607 2003-11-22  Jim Meyering  <jim@meyering.net>
5608
5609         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5610         (sc_system_h_headers): Do this test only if sys2.h exists.
5611
5612 2003-11-20  Jim Meyering  <jim@meyering.net>
5613
5614         * tests/help-version: Ensure that the bug-reporting address is
5615         included in the --help output for every program.
5616         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5617
5618         * src/ptx.c (usage): Output bug-reporting address.
5619         Reported by Dan Jacobson.
5620
5621 2003-11-19  Jim Meyering  <jim@meyering.net>
5622
5623         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5624         on the join fields.  Suggestion from Bruce Robertson.
5625
5626 2003-11-18  Jim Meyering  <jim@meyering.net>
5627
5628         `od -c -w9999999' could segfault
5629         * src/od.c (dump): Use xnmalloc/free, not alloca.
5630
5631 2003-11-16  Jim Meyering  <jim@meyering.net>
5632
5633         * Use autoconf-2.59.  Regenerate dependent files.
5634
5635         * tests/du/hard-link: Minor tweak: use mkdir -p.
5636
5637         Fix read-from-free'd-buffer error detected by valgrind.
5638         * src/csplit.c (remove_line): Don't return a pointer to data in
5639         a freed buffer.  Instead, arrange to free the buffer on the
5640         subsequent call.
5641
5642         * tests/misc/csplit: New test for above fix.
5643
5644 2003-11-11  Jim Meyering  <jim@meyering.net>
5645
5646         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5647         This avoids a warning from valgrind about memcpy with overlapping
5648         source and destination.
5649
5650         * configure.ac: Require automake-1.7.8.
5651
5652 2003-11-09  Jim Meyering  <jim@meyering.net>
5653
5654         * Use automake-1.7.9.  Regenerate dependent files.
5655
5656         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5657         * src/chown.c: Likewise.
5658
5659         * src/chown-core.c: Include "root-dev-ino.h".
5660         (chopt_init): Initialize new member.
5661         (change_file_owner): Support rm's new --preserve-root option.
5662
5663         * src/remove.c: Include "root-dev-ino.h".
5664         (remove_cwd_entries): Remove now-obsolete FIXME comment.
5665         (remove_dir): Support rm's new --preserve-root option.
5666
5667         * src/chown.c: Include "root-dev-ino.h".
5668         Add new options: --preserve-root and --no-preserve-root.
5669
5670         * src/chmod.c: Include "root-dev-ino.h".
5671         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5672         ROOT_DEV_INO_WARN macros.
5673         (get_root_dev_ino): Remove function definition, now that it's
5674         been moved to a separate file.
5675         (usage): Describe new options.
5676
5677         * src/mv.c (rm_option_init): Initialized new member.
5678
5679         * src/remove.h: Include "dev-ino.h".
5680         (struct rm_options): Add new member: root_dev_ino.
5681         * src/chown-core.h: Include "dev-ino.h".
5682         (struct Chown_option): Add new member: root_dev_ino.
5683
5684 2003-11-06  Jim Meyering  <jim@meyering.net>
5685
5686         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5687         hard-coding `sizeof FILE*'.
5688
5689 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
5690
5691         * src/wc.c (main): Free `fstatus' so there is no confusion about
5692         whether it's leaked or not.
5693         * src/who.c (who): Likewise for `utmp_buf'.
5694
5695 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5696
5697         Fix 'cut' problems with size_t overflow and unsigned int.
5698         More generally, resize integer variables to fit use more precisely.
5699         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5700         (struct range_pair): Make members to be of type size_t, not unsigned.
5701         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5702         (suppress_non_delimited, output_delimiter_specified,
5703         have_read_stdin, print_kth, set_fields): Now bool, nt int.
5704         (delim): Now unsigned char, not int.
5705         (mark_printable_field, is_printable_field, is_range_start_index,
5706         set_fields, set_fields, cut_bytes, cut_fields):
5707         Use size_t, not unsigned, for field and byte counts.
5708         (hash_int): Use uintptr_t, not unsigned, for pointers converted
5709         to integers.  This squeezes more info out of them.
5710         (set_fields, cut_bytes, cut_fields, main):
5711         Use bool, not int, for booleans.
5712         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5713
5714 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5715
5716         * man/Makefile.am (check-programs-vs-x):
5717         Work even if $(programs) contains '$'.
5718         Work even if 'missing=1' in environment.
5719         Don't report an error simply because $(programs) outputs nothing.
5720
5721 2003-11-05  Jim Meyering  <jim@meyering.net>
5722
5723         * Use autoconf-2.58.  Regenerate dependent files.
5724
5725         * src/tr.c (spec_init): Fix typo in last change.
5726
5727         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5728         call to variadic version_etc function, so that it works even on systems
5729         for which sizeof char* != sizeof int.
5730         * src/true.c (main): Likewise.
5731         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5732         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5733         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5734         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5735         Similarly, cast NULL to `(char *)' in call to variadic function,
5736         parse_long_options, so that it works even on systems for which
5737         sizeof char* != sizeof int.
5738         A similar problem was reported by Harti Brandt in
5739         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5740
5741         * src/users.c (users): Free `utmp_buf' explicitly so that people
5742         don't mistake this for a real leak.
5743         Patch by Dennis Smit <ds@nerds-incorporated.org.
5744
5745 2003-11-04  Paul Eggert  <eggert@twinsun.com>
5746
5747         * README: Document _POSIX2_VERSION.
5748
5749 2003-11-04  Jim Meyering  <jim@meyering.net>
5750
5751         * src/tac.c (memrchr): Remove #if-0'd function.
5752         (tac_stdin_to_mem): Clean up #if-0'd code.
5753
5754         * src/od.c (decode_format_string): Remove unnecessary casts.
5755         Use more maintainable `sizeof *var'.
5756         (main): Call decode_format_string rather than decode_one_format,
5757         now that `spec' may be NULL.
5758
5759         * src/chmod.c (AUTHORS): Add my name.
5760
5761         * src/split.c (next_file_name): Use `sizeof *var' rather than
5762         hard-coding `sizeof size_t'.
5763
5764         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5765
5766         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5767         to avoid potential overflow in pointer arithmetic.
5768         (set_fields): Use not `1', but rather `sizeof *printable_field' as
5769         second argument to xcalloc.
5770         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5771         rather than xrealloc.
5772         * src/date.c (show_date): Likewise.
5773         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5774         * src/pr.c (store_char): Likewise.
5775         * src/fold.c (fold_file): Likewise.
5776
5777         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5778         type changes (unsigned int -> size_t) in hash.c.
5779         * src/cp-hash.c (src_to_dest_hash): Likewise.
5780         * src/du.c (entry_hash): Likewise.
5781         * src/ls.c (dev_ino_hash): Likewise.
5782         * src/cut.c (hash_int): Likewise.  Declare function as static.
5783
5784 2003-11-03  Jim Meyering  <jim@meyering.net>
5785
5786         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5787         * tests/misc/fold: Fail the test immediately if we're not running
5788         the expected version of fold.
5789
5790 2003-11-02  Jim Meyering  <jim@meyering.net>
5791
5792         * src/tr.c (append_normal_char, append_range, append_char_class)
5793         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5794         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
5795         and usually shorter.
5796         * src/copy.c (copy_internal): Likewise.
5797         * src/join.c (initseq, add_field, make_blank): Likewise.
5798         * src/od.c (main): Likewise.
5799         * src/cp.c (make_path_private): Likewise.
5800         * src/tsort.c (new_item, record_relation): Likewise.
5801
5802         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5803         (main): Also remove anachronistic cast of xmalloc return value.
5804         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5805         (main): Also remove anachronistic cast of xmalloc return value.
5806         * src/sort.c (inittables): Likewise.
5807         (sort): Also Split a long line.
5808
5809 2003-10-25  Jim Meyering  <jim@meyering.net>
5810
5811         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5812         type changes (unsigned int -> size_t) in hash.c.
5813         * src/cp-hash.c (src_to_dest_hash): Likewise.
5814         * src/du.c (entry_hash): Likewise.
5815         * src/ls.c (dev_ino_hash): Likewise.
5816         * src/cut.c (hash_int): Likewise.  Declare function as static.
5817
5818 2003-10-21  Jim Meyering  <jim@meyering.net>
5819
5820         Don't fail when run with VERBOSE=yes.
5821         * tests/chgrp/basic: Do `set +x' before starting the subshell
5822         from which we invoke chgrp.  Otherwise, the output from the
5823         VERBOSE=yes-induced `set -x' would result in spurious differences.
5824         Reported by Russel Coker via Michael Stone.
5825
5826 2003-10-19  Jim Meyering  <jim@meyering.net>
5827
5828         chmod now uses fts to perform a directory traversal when -R is
5829         specified.  Before, it operated on full path names, and as such
5830         would encounter the PATH_MAX (often 4096) limit.
5831
5832         * src/chmod.c: Include "xfts.h".
5833         (process_file): Rename from change_file_mode.
5834         Adapt to be used with fts.
5835         (process_files): New function.
5836
5837 2003-10-18  Jim Meyering  <jim@meyering.net>
5838
5839         * tests/du/deref-args: Ensure that du -D now dereferences all
5840         symlinks specified on the command line, not just those that
5841         reference directories.
5842
5843         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5844         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5845         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5846         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5847         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5848         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5849         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5850         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5851         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
5852         Update the call to parse_long_options so that `AUTHORS, NULL' are the
5853         last parameters.
5854         * src/true.c (main): Append NULL to version_etc argument list.
5855         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5856
5857 2003-10-17  Andreas Schwab  <schwab@suse.de>
5858
5859         * tests/mk-script: Get $srcdir from first parameter instead of
5860         hardcoding it.
5861         (main): Update usage.
5862
5863         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5864         first argument of mk-script.
5865         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
5866
5867 2003-10-17  Jim Meyering  <jim@meyering.net>
5868
5869         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5870         generated `man' page is more readable.  Suggestion from Dan Jacobson.
5871
5872         * src/chown-core.c (change_file_owner): Handle the cases in
5873         which fts_info indicates an error with the given entry.
5874
5875         * src/du.c (main): Simply assign to bit_flags.
5876         Don't bother with bit arithmetic.
5877
5878         * tests/chmod/no-x: New file.
5879         * tests/chgrp/no-x: New file.
5880         * tests/chmod/Makefile.am (TESTS): Add no-x.
5881         * tests/chgrp/Makefile.am (TESTS): Likewise.
5882
5883         * src/du.c: Include "xfts.h".
5884         (du_files): Use xfts_open, rather than fts_open.
5885         * src/chown-core.c (chown_files): Likewise.
5886
5887 2003-10-16  Jim Meyering  <jim@meyering.net>
5888
5889         * src/chgrp.c (main): Simply assign to bit_flags.
5890         Don't bother with bit arithmetic.
5891         * src/chown.c (main): Likewise.
5892         Rename a couple of local variables.
5893         Remove unnecessary casts.
5894
5895         * src/tail.c (start_bytes): Rename local, remainder, to avoid
5896         gcc's warning about shadowing a global.
5897
5898 2003-10-15  Jim Meyering  <jim@meyering.net>
5899
5900         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5901         use fts to perform a directory traversal when -R is specified.
5902         Before, they operated on full path names, and as such would
5903         encounter the PATH_MAX (often 4096) limit.
5904         They are more efficient.  For example, before, chgrp -R would
5905         take almost 5 seconds to change about 2000 directories and fail
5906         (with `File name too long'), while now it succeeds on a hierarchy
5907         of depth 20,000 in 1/10 the time.
5908
5909         * src/chown.c: Include "userspec.h" and "fts_.h".
5910         (WRITTEN_BY): Add my name.
5911         (getpwnam, getgrnam, getgrgid): Remove declarations.
5912         (endpwent): Remove definition.
5913         (usage): Update.
5914         (main): Handle new options.
5915         Call new function, chown_files rather than change_file_owner.
5916
5917         * src/chgrp.c: Include "fts_.h".
5918         (WRITTEN_BY): Add my name.
5919         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
5920         the latter.
5921         (usage): Update.
5922         (main): Handle new options.
5923         Call new function, chown_files rather than change_file_owner.
5924
5925         Rewrite to iterate through hierarchies using fts rather than
5926         via explicit recursion.
5927         * src/chown-core.c: Include "fts_.h"
5928         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
5929         on a single file at a time.
5930         (chown_files): New function.
5931         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
5932         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
5933         [struct Chown_option] (dereference): Remove member with ambiguous name.
5934         [struct Chown_option] (affect_symlink_referent): New member.
5935         (chown_files): New prototype.
5936
5937         * tests/chgrp/recurse: Update tests accordingly.
5938         * tests/chgrp/posix-H: New tests for the above.
5939         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
5940
5941         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
5942         work even for superuser.  Suggestion from Dan Jacobson.
5943
5944 2003-10-14  Paul Eggert  <eggert@twinsun.com>
5945
5946         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
5947         properly diagnosed.
5948         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
5949         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
5950         * src/sort.c (parse_field_count): Handle the case where overflow
5951         and invalid suffix char are both reported.
5952
5953 2003-10-14  Jim Meyering  <jim@meyering.net>
5954
5955         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
5956         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
5957         true on Linux.
5958
5959 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5960
5961         Fix to avoid a denial-of-service attack if the display width is
5962         enormous.  Also, clean up the code a bit by removing duplicate code.
5963
5964         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
5965         (calculate_columns): New function, that contains code that used
5966         to be common to print_many_per_line and print_horizontal.
5967         (print_many_per_line, print_horizontal): Use it.
5968         (decode_switches): Set max_idx here, not in calculate_columns.
5969         (print_current_files): Don't call init_column_info; calculate_columns
5970         now does that.
5971         (init_column_info): Don't allocate a lot more space than is needed
5972         to represent the current set of files.  Allocate all the new
5973         size_t cells in one call to xnmalloc, rather than a row at a time.
5974
5975 2003-10-13  Jim Meyering  <jim@meyering.net>
5976
5977         * src/ls.c (init_column_info): Add another FIXME comment.
5978
5979 2003-10-13  Paul Eggert  <eggert@twinsun.com>
5980
5981         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
5982         Remove several arbitrary limits on hosts where int cannot represent
5983         all size_t values.
5984
5985         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
5986         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
5987         struct column_info.col_arr[0], max_idx):
5988         Now size_t, not int.
5989         (get_funky_string): Return bool indicating success, instead of
5990         a negative count to indicate failure.  Store number of columns
5991         through new parameter OUTPUT_COUNT; that way, they can never
5992         go negative.  Change equals_end from int to bool.  All uses
5993         changed.
5994         (struct column_info.valid_len): Now bool, not int.  All uses changed.
5995         (dired_dump_obstack, get_funky_string, clear_files,
5996         extract_dirs_from_files, print_current_files,
5997         print_many_per_line, print_horizontal, init_column_info,
5998         put_indicator, length_of_file_name_and_frills,
5999         print_with_commas): Use size_t, not int, for local variables
6000         that count sizes.
6001         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6002         Check for TIOCGWINSZ returing negative values (or values greater
6003         than SIZE_MAX!).
6004         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6005         init_column_info):
6006         Use xmalloc and xnmalloc, not XMALLOC.
6007         (gobble_file): Use xnrealloc, not XREALLOC.
6008         (print_color_indicator): Remove now-unnecessary cast to size_t.
6009
6010 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6011
6012         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6013         * tests/sort/sort-tests: Remove from CVS; assume that people
6014         brave enough to check coreutils out from CVS can rebuild it.
6015
6016 2003-10-12  Jim Meyering  <jim@meyering.net>
6017
6018         New options: --preserve-root and --no-preserve-root.
6019         * src/chmod.c (change_file_mode): Honor new option.
6020         (change_file_mode): Strip trailing slashes on directory
6021         argument passed to change_dir_mode.
6022         (get_root_dev_ino): New function.
6023         (main): Initialize global, root_dev_ino.
6024
6025         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6026         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6027         via system.h.
6028         * src/chmod.c (change_file_mode): Likewise.
6029
6030 2003-10-08  Jim Meyering  <jim@meyering.net>
6031
6032         * src/csplit.c (main): Remove obsolete FIXME.
6033
6034 2003-10-07  Jim Meyering  <jim@meyering.net>
6035
6036         * Use automake-1.7.8.  Regenerate dependent files.
6037
6038 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6039
6040         csplit cleanup.
6041
6042         * doc/coreutils.texi (csplit invocation):
6043         The regexp offset need not have a sign; POSIX requires support
6044         for signless offets.
6045
6046         Be more careful about int widths.  For example, remove some
6047         arbitrary limits by replacing 'unsigned' with 'size_t',
6048         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6049         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6050         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6051         to <stdbool.h> usage.
6052         (struct control): offset is now intmax_t, not int.
6053         repeat_forever is now bool, not int.
6054         (struct cstring): len is now size_t, not unsigned int.
6055         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6056         size_t, not unsigned.  start_line, first_available are now
6057         uintmax_t, not unsigned.
6058         (hold_count, control_used): Now size_t, not unsigned.
6059         (last_line_number, current_line, bytes_written):
6060         Now uintmax_t, not unsigned.
6061         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6062         create_new_buffer, get_new_buffer, load_buffer, find_line,
6063         process_regexp, split_file, new_control_record, extract_regexp,
6064         get_format_width, get_format_prec, max_out):
6065         size args, locals, and returned values are now size_t, not unsigned
6066         or int.
6067         (get_first_line_in_buffer, find_line, write_to_file,
6068         handle_line_error, process_line_count, regexp_error, process_regexp,
6069         split_file):
6070         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6071         (check_for_offset): Don't require a sign before the offset.
6072         Use xstrtoimax to do the real work.
6073         (extract_regexp): Remove harmful cast of size to unsigned.
6074         256 -> 1<<CHAR_BIT, for clarity.
6075         (get_format_flags): Return at most 3, to avoid worries about overflow.
6076
6077         (bytes_to_octal_digits): Remove.
6078
6079         (cleanup): Don't check whether output_stream is NULL, since
6080         close_output_file does that for us.
6081
6082         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6083         (sizeof *p);" instead of the more long-winded alternatives.
6084
6085         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6086         to a much larger size, instead of an O(N) algorithm.
6087
6088         (process_regexp): Use plain NULL rather than casted 0.
6089
6090         (make_filename): Use %u, not %d, to format unsigned file number.
6091
6092         (new_control_record): Use xrealloc exclusively, since it handles
6093         NULL reliably.
6094
6095         (extract_regexp): Change misspelled word in diagnostic.
6096
6097         (get_format_width): Even if a minimum field width is specified,
6098         allow room for enough octal digits to represent the value of
6099         the maximum representible integer.  This fixes a potential
6100         buffer overrun.  Calculate this room at compile-time, not
6101         at run-time; this removes the need for bytes_to_octal_digits.
6102         Check for overflow; this removes a FIXME.
6103
6104         (get_format_prec): Don't allow precision to be signed; it's
6105         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6106         default precision; this fixes a potential buffer overrun
6107         on hosts with wider size_t.
6108
6109         (get_format_conv_type): Change local variable to be of type
6110         unsigned char, not int; this removes a potential subscript
6111         violation on hosts where char is signed.
6112
6113         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6114         Allow "%%" in format.  Don't overflow when
6115         counting lots of percents.
6116
6117         (usage): Default sprintf format is %02u, not %d.
6118
6119 2003-10-05  Jim Meyering  <jim@meyering.net>
6120
6121         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6122
6123         * src/du.c (du_files): Mark diagnostic for translation.
6124
6125 2003-10-04  Jim Meyering  <jim@meyering.net>
6126
6127         * src/du.c (du_files): Ignore any failure of fts_close.
6128         Give better diagnostics for failed fts_open.
6129
6130         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6131
6132         Deprecate existing use of -H (aka --si).
6133         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6134         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6135         (main): Warn that the meaning of -H will soon change to be
6136         POSIX compliant.
6137
6138 2003-10-03  Jim Meyering  <jim@meyering.net>
6139
6140         * src/du.c: Accept --no-dereference (-P).
6141
6142 2003-10-02  Jim Meyering  <jim@meyering.net>
6143
6144         * tests/du/trailing-slash: Adjust for slightly different output.
6145
6146         Rewrite du.c to use fts.
6147         * src/du.c: Include "fts_.h", not ftw.h.
6148         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6149         (IS_FTW_DIR_TYPE): Remove definition.
6150         (IS_DIR_TYPE): Define.
6151         (is_symlink_to_dir): Remove now-unnecessary function.
6152         (process_file, du_files): Rewrite to use fts.
6153
6154         * tests/du/inaccessible-cwd: Ensure that even when run from an
6155         inaccessible directory, du can still operate on accessible
6156         directories elsewhere.
6157         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6158
6159         * tests/rm/deep-1: Ensure that du can process a hierarchy
6160         of depth 400 while using no more than 50KB of stack space.
6161
6162 2003-10-01  Akim Demaille  <akim@epita.fr>
6163
6164         * announce-gen (print_news_deltas): New function, extracted from main.
6165         (main): Make `news_file' an array.
6166         Use '...=s' => \@var for --news and --url-directory specs.
6167         Before there were a couple of portability problems.
6168
6169 2003-09-28  Jim Meyering  <jim@meyering.net>
6170
6171         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6172         (syntax-check-rules): Add it.
6173
6174         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6175         guaranteed to be (void *).
6176         * src/cp.c: Likewise.
6177         * src/join.c: Likewise.
6178         * src/ln.c: Likewise.
6179         * src/ls.c: Likewise.
6180         * src/od.c: Likewise.
6181         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6182
6183 2003-09-27  Jim Meyering  <jim@meyering.net>
6184
6185         Don't exhaust virtual memory when processing large inputs.
6186         Fix this by removing csplit's internal free-list management;
6187         instead rely on malloc for that.
6188
6189         * src/csplit.c (free_list): Remove global.
6190         (clear_all_line_control): Remove function.
6191         (get_new_buffer): Always use create_new_buffer to obtain a
6192         new buffer, rather than searching free_list.
6193         (free_buffer): Just call free.
6194         Reported by Nikola Milutinovic.
6195
6196 2003-09-26  Jim Meyering  <jim@meyering.net>
6197
6198         * man/rm.x: Also list `chattr' in SEE ALSO section.
6199         Suggestion from Mark Hubbart.
6200
6201 2003-09-25  Jim Meyering  <jim@meyering.net>
6202
6203         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6204         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6205
6206         * Use autoconf-2.57d.  Regenerate dependent files.
6207
6208 2003-09-24  Jim Meyering  <jim@meyering.net>
6209
6210         Minor efficiency tweak.
6211         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6212         (do_link): Likewise.
6213
6214 2003-09-23  Jim Meyering  <jim@meyering.net>
6215
6216         * src/paste.c (paste_serial): Save errno after input error,
6217         to report proper errno value.
6218         Based on a patch from Paul Eggert.
6219
6220         * src/tee.c (tee): Adjust fwrite arguments so that the return
6221         value is the number of bytes written.
6222
6223 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6224
6225         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6226
6227         * src/comm.c (compare_files): Save errno after input error,
6228         to report proper errno value.
6229         * src/fold.c (fold_file): Likewise.
6230         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6231         * src/unexpand.c (unexpand): Likewise.
6232
6233         * src/csplit.c (close_output_file): Don't report bogus errno value
6234         after ferror discovers an output error.  We don't know the proper
6235         errno value, since it might have been caused by any of a whole
6236         bunch of calls, and it might have been trashed in the meantime.
6237         Fixing this problem will require much more extensive changes;
6238         in the meantime just say "write error".
6239         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6240         * src/uniq.c (check_file): Likewise.
6241
6242         * src/join.c (get_line): Report error right away if I/O fails,
6243         so that the proper errno value is used.
6244         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6245         * src/tee.c (tee): Likewise.
6246         * src/uniq.c (check_file): Likewise.
6247
6248         * src/od.c (skip): If a read fails, don't retry it later, so
6249         that we report the proper errno.
6250
6251         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6252
6253         * src/tee.c (tee): Once a write failure has occurred, don't bother
6254         writing anything more to that stream.
6255
6256         * src/uniq.c (check_file): Check for ferror (stdout) even if
6257         ostream == stdout.
6258
6259         * src/yes.c (UNROLL): Remove.
6260         (main): Exit immediately when write failure is detected.
6261         Simplify code by assigning to argv when argc == 1.
6262
6263 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6264
6265         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6266         (WRITTEN_BY): Change "Franc,ois" (actually using
6267         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6268         xgettext requires.
6269
6270 2003-09-19  Jim Meyering  <jim@meyering.net>
6271
6272         `du -D symlink-to-dir' would mistakenly omit the slash in
6273         lines like this: 24     symlink-to-dir/subdir
6274         * src/du.c (process_file): Fix offset calculation.
6275         Reported by Jeff Sheinberg as Debian bug #211591;
6276         http://bugs.debian.org/205251
6277
6278         * tests/du/deref-args: New file/test for the above.
6279         * tests/du/Makefile.am (TESTS): Add deref-args.
6280
6281         * src/du.c (process_file): Remove useless disjunct.
6282
6283         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6284         to Written_by.
6285         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6286         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6287         Mark each WRITTEN_BY string as translatable.
6288
6289         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6290         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6291         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6292         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6293         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6294         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6295         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6296         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6297         Instead, a subsequent change will embed `Written by ' in
6298         each string along with the author names.
6299
6300         * src/true.c: Revert yesterday's changes.
6301         * src/sys2.h: Likewise.
6302
6303 2003-09-18  Jim Meyering  <jim@meyering.net>
6304
6305         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6306         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6307         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6308         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6309         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6310         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6311         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6312         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6313         comma-separated list of strings and/or update the call to
6314         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6315         * src/true.c (main): Append NULL to version_etc argument list.
6316         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6317
6318         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6319         shadowing the math function name.  Also rename loga to log_a.
6320
6321 2003-09-14  Jim Meyering  <jim@meyering.net>
6322
6323         * src/factor.c (print_factors): Give a separate diagnostic
6324         for numbers that are too large, but otherwise valid.
6325         Reported by Dániel Varga.
6326
6327 2003-09-10  Jim Meyering  <jim@meyering.net>
6328
6329         * Use automake-1.7.7.  Regenerate dependent files.
6330
6331         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6332         of `fmt -1'.  Using the just-built tr is a little cleaner.
6333         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6334         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6335
6336 2003-09-09  Jim Meyering  <jim@meyering.net>
6337
6338         * src/copy.c: Alphabetize includes.
6339         Remove duplicate inclusion of "same.h".
6340
6341 2003-09-08  Jim Meyering  <jim@meyering.net>
6342
6343         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6344         Didn't give enough of a benefit, mainly because it's not yet
6345         in wide enough use.
6346
6347         * Version 5.0.91.
6348
6349         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6350         (check-programs-vs-x): Fail if $(programs) is empty.
6351
6352         * src/remove.c: Add a comment.
6353
6354 2003-09-07  Jim Meyering  <jim@meyering.net>
6355
6356         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6357         Don't define.  These symbols are no longer used.
6358
6359         * tests/misc/tty-eof: Write ^D as \cD.
6360         Complete the change of 2003-08-02.
6361
6362         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6363         file in lib/ or src/ doesn't induce an unwarranted failure.
6364         Add a kludge to filter out the sole generated source file that
6365         also has translatable messages: src/false.c.
6366
6367 2003-09-06  Jim Meyering  <jim@meyering.net>
6368
6369         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6370         (parse_options): Give a diagnostic for (but still accept) the
6371         deprecated --allow-missing option.
6372
6373 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6374
6375         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6376         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6377
6378         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6379         size_bound ourselves. if an input file is a pipe and the user
6380         specified a size, use that size instead of trying to guess the
6381         pipe size.  This has the beneficial side effect of avoiding the
6382         overhead of default_sort_size in that case.  All callers changed.
6383         (sort): Remove static var size; now done by sort_buffer_size.
6384
6385 2003-09-05  Jim Meyering  <jim@meyering.net>
6386
6387         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6388
6389         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6390         to start, rather than just .1.  Upon failure, print unexpected state.
6391
6392 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6393
6394         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6395         SAFE_READ_ERROR to tmp->nbytes.
6396         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6397
6398         * src/head.c (struct linebuffer): Change nbytes and nlines
6399         from unsigned int to size_t.  unsigned int is safe (after the
6400         2003-09-03 patch) but size_t is cleaner.
6401         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6402         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6403
6404         Standardize on BUFSIZ as opposed to other macro names and values.
6405         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6406         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6407         stdio.h has always defined it,
6408         and other code already assumes it's defined.
6409         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6410         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6411         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6412
6413 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6414
6415         * src/seq.c (step): Default to 1.
6416         (print_numbers): Allow the output to be empty.
6417         (main): The default step is 1, even if LAST < FIRST;
6418         as per documentation.
6419         * tests/seq/basic (onearg-2): Output should be empty.
6420
6421 2003-09-05  Jim Meyering  <jim@meyering.net>
6422
6423         * Makefile.cfg (wget_files): Temporarily disable, until master
6424         versions are restored to ftp.gnu.org.
6425
6426         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6427
6428         Make seq's --width (-w) option work properly even when the
6429         endpoint requiring the larger width is negative and smaller than
6430         the other endpoint.
6431         * src/seq.c (get_width_format): Include `-' in the set of bytes
6432         allowed in a `simple' number (no decimal point, no exponent).
6433         Reported by Patrick Mauritz.
6434
6435 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6436
6437         * NEWS: sort -t '\0' now uses a NUL tab.
6438         sort option order no longer matters, unless POSIX requires it.
6439         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6440         Similar fixes for many comments.
6441         (TAB_DEFAULT): New constant, so that we can support NUL as
6442         the field separator.
6443         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6444         (specify_sort_size): If multiple sizes are specified, use the largest.
6445         (begfield, limfield): Support NUL tab char.
6446         (set_ordering): Do not let -i override -d.
6447         (main): Report an error if incompatible -o or -t options are given.
6448         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6449
6450 2003-09-05  Jim Meyering  <jim@meyering.net>
6451
6452         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6453
6454 2003-09-03  Andreas Schwab  <schwab@suse.de>
6455
6456         Bug report and patch here:
6457         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6458         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6459         * src/head.c (elide_tail_lines_pipe): Likewise.
6460
6461 2003-09-03  Jim Meyering  <jim@meyering.net>
6462
6463         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6464         small amount of code from him was first moved to lib/human.c, and was
6465         subsequently rewritten entirely.
6466         * src/df.c (AUTHORS): Likewise.
6467
6468 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6469
6470         * src/md5sum.c (split_3): Accept the BSD format for generic
6471         message digest modes.  Currently works with BSD's MD5 and SHA1
6472         formats since these are the two algorithms presently used in
6473         coreutils.  Updated comments to reflect this change.
6474         (bsd_split_3): Updated comments.
6475
6476         * tests/md5sum/basic-1: New test to make sure that
6477         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6478         from `check-bsd' test in tests/sha1sum/basic-1).
6479
6480         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6481         --check exit status and BSD SHA1 format (adapted from tests
6482         in tests/md5sum/basic-1).
6483
6484 2003-08-30  Jim Meyering  <jim@meyering.net>
6485
6486         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6487
6488         When source and destination arguments refer to the same file, reside
6489         on a partition (e.g. VFAT) on which distinct names may refer to the
6490         same directory entry (often due to variations in case), and when the
6491         link count for the file is 1, mv no longer unlinks the file.  Instead,
6492         it gives the expected diagnostic that the source and destination are
6493         the same.  WARNING: this is an incomplete fix.  If the file happens
6494         to have a link count of 2 or greater, such an erroneous mv command
6495         will still unlink it.
6496         Although that is not possible on vfat or umsdos, it is possible on
6497         other file system types, e.g., ntfs, and hpfs.
6498         * src/copy.c (same_file_ok): Invoke same_name (which might still
6499         return false for names that refer to the same directory entry)
6500         only if the link count is 2 or more.
6501         * tests/mv/vfat: Show how to demonstrate the above problem.
6502         This test is not run.
6503         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6504
6505 2003-08-27  Jim Meyering  <jim@meyering.net>
6506
6507         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6508         who's -l option has been eliciting an unconditional warning about
6509         this impending change since sh-utils-2.0.12 (April 2002).
6510
6511         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6512         This would happen for nonempty files not ending with a newline.
6513         Reported by Dan Jacobson.
6514         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6515         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6516
6517         * src/stat.c (print_it): Avoid buffer overrun that would
6518         occur when the user-specified format string ends with `%'.
6519         Patch by Tommi Kyntola.
6520         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6521         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6522
6523 2003-08-26  Jim Meyering  <jim@meyering.net>
6524
6525         Apply changes from bison.
6526         * GNUmakefile (SHELL): Define to `sh', if necessary.
6527         Add copyright.
6528         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6529         Update all uses of $(WGET).
6530
6531 2003-08-22  Akim Demaille  <akim@epita.fr>
6532
6533         * Makefile.cfg (local-checks-to-skip): New.
6534         * Makefile.maint (local-check): Rename as...
6535         (local-checks-available): this.
6536         (local-check): New.
6537
6538 2003-08-26  Akim Demaille  <akim@epita.fr>
6539
6540         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6541         "<\#" to avoid magic from Gnus when posting parts of this script.
6542
6543 2003-08-25  Jim Meyering  <jim@meyering.net>
6544
6545         * src/stat.c (main): Warn about use of deprecated `-l' option.
6546
6547 2003-08-22  Jim Meyering  <jim@meyering.net>
6548
6549         * src/stat.c (do_stat): For link count at end of line, use %h format,
6550         instead of %-5h.  The latter would make stat emit trailing spaces.
6551         Reported by Dan Jacobson.
6552
6553 2003-08-20  Jim Meyering  <jim@meyering.net>
6554
6555         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6556
6557 2003-08-19  Jim Meyering  <jim@meyering.net>
6558
6559         * src/system.h: Include stdlib.h unconditionally,
6560         as we're now assuming that part of hosted C89.
6561
6562 2003-08-18  Jim Meyering  <jim@meyering.net>
6563
6564         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6565         to avoid warnings from gcc.
6566
6567 2003-08-17  Jim Meyering  <jim@meyering.net>
6568
6569         Avoid unnecessary and sometimes time-consuming hostname lookups.
6570         * src/who.c (print_user): Use strchr, not strrchr.
6571         * src/pinky.c (print_entry): Likewise.
6572         Patch by Michael Stone.
6573         This fixes a typo I introduced in who-users.c on 1996-02-23.
6574
6575         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6576         disallowed between `@...@'.
6577
6578 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6579
6580         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6581         done by gnulib .m4 files.
6582         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6583         * src/sys2.h (strtoull): Remove unused declaration.
6584
6585 2003-08-16  Jim Meyering  <jim@meyering.net>
6586
6587         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6588         are read-only.
6589
6590         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6591         race condition bug.  The bug would be triggered when tailing a file
6592         with file pointer not at beginning of file, and where the file was
6593         truncated to have a length of less than the initial offset at just
6594         the right moment (between the two lseek calls in this function).
6595
6596         An invalid initial value for *read_pos would result in
6597         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6598         busy-wait rather than sleeping between iterations.  The bug manifests
6599         itself only when tailing regular files that are initially nonempty.
6600         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6601         each xlseek call.
6602         (tail_lines): Likewise, after lseek calls.
6603         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6604         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6605         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6606
6607 2003-08-15  Jim Meyering  <jim@meyering.net>
6608
6609         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6610         (sc_sun_os_names): Likewise.
6611         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6612
6613         * man/help2man: Remove some SPACEs before TAB.
6614
6615 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6616
6617         * Makefile.maint (LC_ALL): Set to C.
6618         * man/Makefile.am (ASSORT): New var.
6619         (check-x-vs-1, programs): Use it.
6620         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6621         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6622
6623 2003-08-11  Jim Meyering  <jim@meyering.net>
6624
6625         fold -s -wN would infloop for N < 8 with TABs in the input.
6626         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6627         * src/fold.c (fold_file): Move contents of `else'-block
6628         out of conditional so it's used also for --spaces (-s).
6629         * tests/misc/fold: Test for the above fix.
6630         * tests/misc/Makefile.am (TESTS): Add fold.
6631
6632 2003-08-10  Jim Meyering  <jim@meyering.net>
6633
6634         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6635         system.h so the types from time.h and sys/time.h are available.
6636         It appears that this is necessary for OpenBSD, NetBSD, and
6637         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
6638
6639 2003-08-06  Paul Eggert  <eggert@twinsun.com>
6640
6641         * NEWS: Add support for setting file timestamps to microsecond
6642         resolution, on hosts that support this.
6643         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6644         * src/copy.c (copy_internal):
6645         Set file timestamps with utimens, not utime.
6646         * src/cp.c (re_protect): Likewise.
6647         * src/install.c (change_timestamps): Likewise.
6648         * src/touch.c (newtime, touch, main): Likewise.
6649
6650 2003-08-09  Jim Meyering  <jim@meyering.net>
6651
6652         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6653         from Paul Eggert.
6654         (syntax-check-rules): Add it.
6655
6656         * src/tail.c (main): Tweak Solaris OS version number in comment.
6657         * src/wc.c (wc): Likewise
6658         * tests/tail-2/fflush: Likewise.
6659
6660         * src/tail.c: Add new undocumented option, --presume-input-pipe.
6661         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6662
6663 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6664
6665         Use new gnulib 'extensions' module.
6666         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6667         AC_GNU_SOURCE.
6668
6669 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6670
6671         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6672
6673 2003-08-09  Jim Meyering  <jim@meyering.net>
6674
6675         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6676         For tests of obsolete behavior, don't presume that unsetting
6677         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6678
6679 2003-08-07  Paul Eggert  <eggert@twinsun.com>
6680
6681         * doc/coreutils.texi (split invocation):
6682         Add -d or --numeric-suffixes option to 'split'.
6683         From a suggestion by Jesse Kornblum.
6684         * src/split.c (suffix_alphabet): New var.
6685         (longopts, usage, next_file_name, main): Support -d.
6686         (next_file_name, main): Allow -a0, as POSIX requires.
6687         (next_file_name): Don't assume ASCII-like encoding;
6688         'a' through 'z' are not contiguous in EBCDIC.
6689
6690 2003-08-05  Paul Eggert  <eggert@twinsun.com>
6691
6692         Merge getline from gnulib.
6693         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6694         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6695         New files, from gnulib.
6696         * lib/getdelim2.c, lib/getdelim2.h: Remove.
6697         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6698         getdelim2.h to getndelim2.c and getndelim2.h.
6699         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6700         checking for getdelim.
6701         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6702         than rolling our own.
6703         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6704         (cut_fields): Invoke getndelim2 rather than getdelim2.
6705
6706 2003-08-04  Jim Meyering  <jim@meyering.net>
6707
6708         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6709         and for the indices to iterate through nsigs.
6710
6711 2003-08-02  Paul Eggert  <eggert@twinsun.com>
6712
6713         * src/sort.c: Minor code cleanups, mostly to use more accurate
6714         types and to remove unnecessary casts.
6715         (min, max): Remove.  All uses changed to MIN and MAX.
6716         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6717         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6718         keyfield.numeric, struct keyfield.general_numeric, struct
6719         keyfield.month, struct keyfield.reverse, reverse, unique,
6720         have_read_stdin): Now bool, not int.  All uses changed.
6721         (eolchar): Now char, not int.
6722         (struct keyfield.ignore): Now bool const *, not int *.
6723         (struct keyfield.translate): Now char const *, not char *.
6724         (struct month.name): Likewise.
6725         (blanks, nonprinting, nondictionary): Now bool[], not int[].
6726         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6727         check, sort, main): Use const * pointers when possible.
6728         (month_cmp): Rewrite to avoid casts.
6729         (inittables): Initialize tables unconditionally, to avoid branches.
6730         (fillbuf): Return bool, not int.  All uses changed.
6731         (fillbuf, keycompare, new_key, main):
6732         Use SIZE_MAX rather than (size_t) -1.
6733         (trailing_blanks): Renamed from trim_trailing_blanks.
6734         Return the number of blanks to trim.  All uses changed.
6735         (getmonth): Use trailing_blanks rather than open code.
6736         (keycompare): Do not cast char * to unsigned char *; not needed.
6737         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6738         ourselves.
6739         (compare, main): Use | rather than || to avoid jumps.
6740         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6741         be nonzero there.
6742         (check, first_same_file, sort, main):
6743         Use bool instead of int local vars when possible.
6744         (check): Merge the old 'checkfp' and 'check' into a single function,
6745         that returns a boolean (true if the file was ordered).
6746         All uses changed.
6747         (main): Use int instead of unsigned for iterating through nsigs.
6748         Rename local var "posix_pedantic" to "posixly_correct".
6749
6750 2003-08-02  Jim Meyering  <jim@meyering.net>
6751
6752         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6753         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6754
6755         * src/cut.c (cut_fields): Don't read again after encountering an
6756         initial EOF.  E.g., `cut -f2' would do so.
6757         * tests/misc/tty-eof: Add a test for the above fix.
6758
6759         * src/sort.c (sortlines): Add description and references.
6760         From Paul Eggert.
6761
6762         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6763         the tests in help-version will use the just-built binaries.
6764         Reported by Christian Krackowizer.
6765
6766 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6767
6768         * NEWS: Add --rfc-2822 option to GNU date.
6769         * doc/coreutils.texi (Time directives, Options for date, Examples
6770         of date): Likewise.
6771         * src/date.c (long_options, usage, main): Likewise.
6772         * doc/getdate.texi (General date syntax): Likewise.
6773         * doc/coreutils.texi (Options for date): Fix a typo in format:
6774         it's now %d not %_d.  Add URLs.
6775
6776 2003-08-01  Jim Meyering  <jim@meyering.net>
6777
6778         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6779         Otherwise, with at least the /bin/sh from HPUX 10.20,
6780         the trap code would end up converting that to exit 1 and thus an
6781         unexpected test failure.  Reported by Christian Krackowizer.
6782
6783 2003-07-31  Paul Eggert  <eggert@twinsun.com>
6784
6785         * src/ptx.c: Do not include bumpalloc.h.
6786         (WORD_TABLE): New member alloc.
6787         (ALLOC_NEW_WORD): Remove.
6788         (occurs_alloc): New var.
6789         (digest_word_file, find_occurs_in_text): Check for arithmetic
6790         overflow when computing table size.  Use xrealloc rather than
6791         bumpalloc primitives.
6792
6793 2003-07-29  Jim Meyering  <jim@meyering.net>
6794
6795         * Version 5.0.90.
6796
6797         * README: When running tests as root, suggest using
6798         sudo with NON_ROOT_USERNAME=$USER.
6799
6800         * tests/Makefile.am (all_programs): Makefile is in ../src, not
6801         $(srcdir)/../src.
6802
6803 2003-07-28  Jim Meyering  <jim@meyering.net>
6804
6805         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6806
6807 2003-07-28  Paul Eggert  <eggert@twinsun.com>
6808
6809         * lib/stdbool.hin (_Bool): Make it signed char, instead of
6810         an enum type, so that it's guaranteed to promote to int.
6811         * src/sort.c (sortlines_temp): Undo previous change.
6812
6813 2003-07-28  Jim Meyering  <jim@meyering.net>
6814
6815         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6816         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6817         would cause lines[-1 - swap] (with swap = false) to evaluate to
6818         lines[4294967295].
6819
6820 2003-07-27  Jim Meyering  <jim@meyering.net>
6821
6822         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6823         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6824
6825         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6826         directories, as required by POSIX.   Reported by Karl Berry.
6827         * tests/rm/dir-no-w: New file.  Test for the above fix.
6828         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6829
6830         * tests/mk-script: Emit `$xx', not its expansion.
6831
6832 2003-07-27  Paul Eggert  <eggert@twinsun.com>
6833
6834         This change was inspired by a similar proposal by Stepan Kasal.
6835         * src/sort.c (mergelines, sortlines_temp): New functions.
6836         (sortlines): Use them, to reduce the number of times that
6837         we need to copy 'struct line' values.  This improved CPU
6838         performance by about 30% on one 18 MB test.
6839         (sort): Don't invoke sortlines unless we have 2 or more lines.
6840
6841 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
6842
6843         * src/sort.c (sort): Don't require two `struct line's per text line,
6844         the new sort algorithm requires just 1.5.
6845
6846 2003-07-27  Jim Meyering  <jim@meyering.net>
6847
6848         * src/pathchk.c (validate_path): Use %lu, not %ld.
6849         From Paul Eggert.
6850         * src/cut.c (is_printable_field): Simplify bit arithmetic.
6851         From Paul Eggert.
6852         * src/ls.c (sort_files): Put `volatile' in the right place.
6853         From Paul Eggert.
6854
6855 2003-07-26  Jim Meyering  <jim@meyering.net>
6856
6857         Use only one bit per field/offset in array, not one `int'.
6858         * src/cut.c (printable_field): Change type to `unsigned char'.
6859         (mark_printable_field, is_printable_field): New functions.
6860         Use them in place of all direct accesses of `printable_field'.
6861
6862         * src/expand.c (parse_tabstops): Detect overflow properly.
6863         * src/cut.c (set_fields): Likewise.
6864
6865         * src/rm.c: Include "dirname.h".
6866         (usage): Use base_name (program_name) in body of --help output.
6867         This lets me...
6868         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6869         Idea from Brendan O'Dea, who suggested using
6870         `program_name = basename (argv[0]);' everywhere --
6871         can't do that, but using base_name works just fine here.
6872
6873         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6874
6875 2003-07-24  Paul Eggert  <eggert@twinsun.com>
6876
6877         Fix some POSIX-compliance problems with 'test'.  This makes
6878         'test' more compatible with Bash.
6879
6880         * NEWS, doc/coreutils.texi: Document the following.
6881         * src/test.c: Include exitfail.h.
6882         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6883         (test-syntax_error): Use it.
6884         (binary_operator): Now takes bool arg specifying whether left operand
6885         is -l ARG, so that caller determines this rather than us.
6886         All uses changed.
6887         (term): Use posixtest to evaluate parenthesized subexpressions.
6888         (unary_operator, one_argument): Remove support for -t without operand.
6889         (one_argument): Take argument from argv[pos].
6890         (one_argument, two_arguments, three_arguments): Advance pos.
6891         All callers changed.
6892         (three_arguments): Look for binary ops before "!".  Then look
6893         for parenthesized one_argument expressions, instead of trusting
6894         expr () to do the right thing.
6895         (posixtest): Now takes number of args.  All callers changed.
6896         Treat "( A B )" like "A B".
6897         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
6898         POSIXLY_CORRECT, as we now conform to POSIX by default.
6899         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6900         * tests/test/Test.pm (test_vector): Add several tests to check
6901         the above.  Syntax errors now exit with status 2, not 1.
6902         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6903
6904 2003-07-26  Jim Meyering  <jim@meyering.net>
6905
6906         * tests/help-version: Adjust for above change in test behavior:
6907         `[' exits with 2, not 1, and test doesn't accept --help or --version.
6908
6909         * Makefile.maint (ME): Don't use trick suggested in Make manual.
6910         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
6911
6912         * Makefile.maint (sc_system_h_headers): Another syntax check.
6913         (syntax-check-rules): Add it to the list.
6914
6915         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
6916         so it matches `%ld' format even on 32-bit systems.
6917
6918         * src/fmt.c (flush_paragraph): Cast field width to `int' to
6919         avoid warning on 64-bit systems.
6920
6921         * src/ls.c (sort_files): Make `func' volatile, so it can't be
6922         clobbered by a `longjmp' into this function.
6923
6924 2003-07-25  Jim Meyering  <jim@meyering.net>
6925
6926         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
6927         value.
6928
6929         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
6930         because it'd evoke spurious failure on 64-bit systems.
6931
6932 2003-07-24  Jim Meyering  <jim@meyering.net>
6933
6934         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
6935         output its current record counts.  Reported by Jurriaan.
6936
6937         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
6938         `wc' with no options.  This goes along with the change of 2003-07-20.
6939
6940 2003-07-23  Jim Meyering  <jim@meyering.net>
6941
6942         Don't include headers already included by system.h:
6943         * src/tr.c: Don't include errno.h.
6944         * src/true.c: Don't include version-etc.h.
6945         * src/test.c: Don't include limits.h or error.h.
6946         * src/stat.c: Don't include unistd.h or time.h.
6947         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
6948         * src/pr.c: Don't include time.h.
6949         * src/pathchk.c: Don't include errno.h.
6950         * src/nice.c: Don't include sys/time.h.
6951         * src/ls.c: Don't include stdlib.h.
6952
6953         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
6954         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
6955         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
6956         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
6957         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
6958         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
6959         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
6960         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
6961         Don't include closeout.h.
6962
6963         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
6964         can access the required version of rm.
6965         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6966
6967         * tests/cut/Test.pm (out-delim3a): New test.
6968
6969         * man/help2man: Update to version 1.33.
6970
6971         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
6972
6973         * src/dircolors.c: Include xstrndup.h.
6974         (xstrndup): Remove function, now that it's been factored out into
6975         it's own file.
6976
6977 2003-07-22  Paul Eggert  <eggert@twinsun.com>
6978
6979         * src/wc.c (wc): Fix typo in computation of file from file_x,
6980         which caused the former to be used uninitialized if file_x was
6981         nonzero.
6982
6983 2003-07-22  Jim Meyering  <jim@meyering.net>
6984
6985         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
6986
6987         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
6988         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
6989         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
6990
6991         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
6992
6993         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
6994
6995         * src/cut.c (set_fields): Mark all selected indices before trying to
6996         determine range endpoints.
6997         * tests/cut/Test.pm: New test for the above fix.
6998
6999         Begin to address this comment: What if someone wants to
7000         extract the 1,000,000-th field of some huge input file?
7001         The first step is to rearrange things so that the values
7002         in the printable_field array are all 0/1 rather than 0/1/2.
7003         * src/cut.c (RANGE_START_SENTINEL): Remove.
7004         Store range-start indices in a hash table, rather than
7005         overloading the `printable_field' array.
7006         (range_start_ht): New global.
7007         (hash_int, hash_compare_ints, is_range_start_index): New functions.
7008         (print_kth): Use is_range_start_index; don't test printable_field.
7009         (set_fields): Detect overflow.
7010         (set_fields): Insert each range-start index into range_start_ht.
7011         (main): Call set_fields only once, and only after
7012         output_delimiter_specified and (if required) range_start_ht have
7013         been defined.
7014
7015 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7016
7017         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7018         invoked with a null pointer when there were no file arguments.
7019
7020 2003-07-20  Jim Meyering  <jim@meyering.net>
7021
7022         * Makefile.maint (sc_changelog): Add another nit-picky check.
7023
7024         * src/wc.c (write_counts): Add a comment.
7025         (wc): Rename `file' parameter.
7026         Set new local, `file', to be the file name, or (when it's NULL)
7027         _("standard output") so that all uses of `file' use the proper value.
7028         Use STREQ, not strcmp.
7029
7030 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7031
7032         wc count field widths now are heuristically adjusted depending
7033         on the input size, if known.  If only one count is printed, it
7034         is guaranteed to be printed without leading spaces.
7035
7036         Previously, wc did not align the count fields if
7037         POSIXLY_CORRECT was set, but POSIX did not actually require
7038         this undesirable behavior, so it has been removed.
7039
7040         * NEWS: Document this.
7041         * doc/coreutils.texi (wc invocation): Likewise.
7042
7043         * src/wc.c (number_width): New var.
7044         (posixly_correct): Remove.
7045         (struct fstatus): New struct.
7046         (write_counts): Output fields of width number_width.
7047         Do not worry about POSIXLY_CORRECT.
7048         Use null file, not empty-string file, to denote stdin,
7049         since "" is a valid file name on some hosts.
7050         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7051         if possible.
7052         (wc):  Avoid problems if end_pos - current_pos overflows.
7053         Do not print odd message if stdin has a read error.
7054         (get_input_fstatus, compute_number_width): New functions.
7055         (main): Use them to implement the new behavior.
7056         Ignore POSIXLY_CORRECT.
7057
7058         * tests/wc/Test.pm: Adjust to the new output widths.
7059
7060 2003-07-19  Jim Meyering  <jim@meyering.net>
7061
7062         * tests/rm/fail-eperm: Don't create temporary directory --
7063         we don't use it.
7064
7065         * tests/shred/remove: Don't open-code test for UID != 0.
7066         Use priv-check's require-non-root instead.
7067         Update to use newer framework.
7068
7069         * tests/help-version (expected_failure_status_expr): Record that
7070         expr exits with status of 3 for e.g., a write error.
7071
7072         * tests/priv-check: Use `id -u' to see if we're running as root,
7073         rather than trying go write to an write-protected file.
7074         When running as root, ensure $NON_ROOT_USERNAME is valid.
7075         When running as root with `require-non-root', ensure that `.'
7076         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7077         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7078
7079         * src/printenv.c: Include "exitfail.h".
7080         (main): Set exit_failure rather than calling close_stdout_set_status.
7081         * src/date.c: Likewise.
7082         * src/sort.c: Likewise.
7083         * src/tty.c: Likewise.
7084
7085 2003-07-18  Jim Meyering  <jim@meyering.net>
7086
7087         * tests/touch/not-owner: Update to use newer framework.
7088
7089         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7090         directory, and remove Perl-coded `you may not run as root' test.
7091         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7092         hard-coding something not quite equivalent.
7093         Paul Jarc reported the inconsistent diagnostics.
7094
7095         * src/sort.c (main): Use close_stdout via atexit.
7096         Now `sort --version' and `sort --help' fail, as they should
7097         when their output is redirected to /dev/full.
7098
7099         * src/su.c (usage): Don't call close_stdout here.
7100         (main): Use close_stdout via atexit.
7101         Now `su --version > /dev/full' fails, as it should.
7102         Somehow, the change of 2000-05-07 that purports to fix this
7103         was not checked in.
7104
7105         * tests/help-version (--help/--version vs. /dev/full): Special-case
7106         `[' to protect it from expected_failure_status-`eval'.
7107
7108         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7109         count and the corresponding line, as required by POSIX.
7110         Reported by Clement Wang.
7111         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7112
7113         * tests/expr/basic: Add tests for when exit status is 2.
7114
7115         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7116         Use an anonymous `enum', rather than #define.
7117
7118 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7119
7120         * src/expr.c: Include "exitfail.h", "quotearg.h".
7121         (EXPR_INVALID, EXPR_ERROR): New constants.
7122         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7123         (syntax_error): New function, exiting with status 2.  Use it
7124         insteading of printing "syntax error" ourselves.
7125         (main): Initialize exit_failure to EXPR_ERROR.
7126         Exit with EXPR_INVALID on syntax error (too few arguments).
7127         (nextarg): Use strcmp, not strcoll; strcoll might return
7128         an undesirable 0, or might fail.
7129         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7130         or other such error.
7131         (eval2): Report an error if strcoll fails in a string comparison.
7132         * src/sort.c: Include "exitfail.h".
7133         (main): Set exit_failure, not xalloc_exit_failure and
7134         xmemcoll_exit_failure.
7135         * tests/expr/basic: Invalid value exits with status 3, not 2.
7136
7137 2003-07-16  Jim Meyering  <jim@meyering.net>
7138
7139         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7140         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7141
7142         This script would have caught at least two recent bugs:
7143         those in [ and kill.
7144         * tests/help-version: Revive this script.
7145         It wasn't doing anything useful, since $all_programs wasn't being
7146         defined by the invoking Makefile.am.
7147         Reflect that nohup is no longer a script, so don't exclude it.
7148         Add framework to handle the programs added since it was last run:
7149         kill, stat, unlink, [, link, readlink.
7150         Fix path-related problems deriving from the move of this script
7151         from src/ to its present location.
7152         * tests/Makefile.am (all_programs): Define.
7153         (TESTS_ENVIRONMENT): Use it.
7154
7155         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7156         whereby kill would always attempt to operate on argv[0] and fail.
7157
7158         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7159         it also matches the one from bash's builtin test.
7160         (binary_operator): Add \n at end of diagnostic.
7161
7162         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7163         * tests/priv-check: Move setuidgid-related and
7164         NON_ROOT_USERNAME-checking code to this file.
7165
7166         * README: Update section on testing as `root'.
7167         Suggestion from Paul Jarc.
7168
7169         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7170         names of authors that I just found in bash's builtins/test.def.
7171
7172         Running `[' with no arguments would evoke a segfault.
7173         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7174         precede potential use via test_syntax_error.
7175
7176         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7177         warning from automake -Wall.
7178
7179 2003-07-15  Jim Meyering  <jim@meyering.net>
7180
7181         * Version 5.0.1.
7182
7183         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7184         prompt us about it.
7185
7186         * announce-gen (print_changelog_deltas): Relax tests for matching
7187         version-number line in NEWS.
7188         Change the .sig suffix to .asc here, too.
7189
7190 2003-07-14  Jim Meyering  <jim@meyering.net>
7191
7192         * Makefile.maint (%.asc): Renamed from %.sig.
7193         Generate and use ascii-armored signatures.
7194         Use gpg's -o option.
7195
7196 2003-07-13  Jim Meyering  <jim@meyering.net>
7197
7198         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7199         (main): Use them.
7200
7201         * Makefile.maint (syntax-check): Move each individual check into
7202         its own target.
7203         (syntax-check-rules): This is the list of syntax-check targets.
7204         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7205         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7206         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7207
7208 2003-07-12  Jim Meyering  <jim@meyering.net>
7209
7210         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7211         traces of the nohup script.
7212
7213         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7214         $(OPTIONAL_BIN_ZCRIPTS).
7215
7216         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7217         target, not before the `>'.
7218
7219         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7220         now that that function no longer calls `error'.
7221
7222         * src/df.c (find_mount_point): Emit a diagnostic for each
7223         failed syscall, rather than relying on caller to do that.
7224         The caller couldn't do a good job, anyhow -- too many different
7225         ways to fail (each with a different referent).
7226         Give a diagnostic upon failed save_cwd, now that that function
7227         no longer calls `error'.
7228         (show_point): Don't diagnose find_mount_point's errors, now that
7229         it handles them itself.
7230
7231         * src/df.c (find_mount_point): Don't let free clobber errno upon
7232         failed chdir.
7233
7234         * src/sys2.h: Remove alloca-related block.
7235         * src/system.h: Include <alloca.h> here, instead.
7236
7237         It appears that the `#pragma alloca' included via "system.h" is
7238         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7239         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7240         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7241
7242         * src/chown-core.c (change_file_owner): Do not restore any special
7243         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7244         by chown(2) on some systems.  Suggestion and insistence :-) from
7245         Michael Stone.
7246
7247         * tests/input-tty: Also check `test -t 1'.
7248         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7249         test would block when run in the background.
7250
7251 2003-07-11  Jim Meyering  <jim@meyering.net>
7252
7253         * tests/sample-test: Also fail if cat-to-create-expected-output
7254         fails.  Otherwise, if both `exp' and `out' were to end up empty
7255         because of e.g., a full disk, they would mistakenly compare equal.
7256
7257         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7258         This solves a portability problem: on at least Solaris systems,
7259         when nohup.sh used the vendor /bin/sh, it would exit with status
7260         of `1' rather than the required 126 or 127 upon failure to exec
7261         the specified program.
7262
7263         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7264         (bin_PROGRAMS): Add nohup.
7265         (EXTRA_DIST): Remove nohup.sh.
7266         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7267         * src/nohup.sh: Remove file.
7268         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7269
7270         * tests/misc/nohup: Tests for the above.
7271         * tests/misc/Makefile.am (TESTS): Add nohup.
7272
7273         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7274         the macro, COPY_FD_DIAGNOSE.
7275         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7276         (head_file): Likewise.
7277
7278         * src/date.c: Include "quote.h".
7279         (batch_convert): Use the quote function rather than using literal `...'
7280         in a diagnostic.
7281
7282         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7283         * src/fmt.c (main): Likewise.
7284         * src/mknod.c (main): Likewise.
7285         * src/tac.c (tac_seekable): Likewise.
7286         * src/yes.c (main): Likewise.
7287         * src/od.c (main): Likewise.
7288         * src/install.c (change_attributes): Likewise.
7289
7290 2003-07-10  Jim Meyering  <jim@meyering.net>
7291
7292         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7293         * src/tail.c (usage): Likewise.
7294
7295         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7296         place of the kludge in this test.  Suggestion from Paul Jarc.
7297
7298         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7299         * src/setuidgid.c: New program, solely for testing (not installed).
7300
7301         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7302         when dereferencing symlinks.
7303
7304 2003-07-09  Jim Meyering  <jim@meyering.net>
7305
7306         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7307         * tests/du/Makefile.am (TESTS): Add slash
7308
7309         * src/tail.c (xlseek): Avoid warning about ``return without value
7310         from function returning non-void''.
7311
7312 2003-07-08  Jim Meyering  <jim@meyering.net>
7313
7314         * man/help2man: Update to version 1.29.
7315
7316         * man/help2man: Add END handler to close STDOUT and check for errors.
7317
7318 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7319
7320         Add support for a "[" that conforms to the GNU coding standards,
7321         i.e., that does not depend on its name.
7322         * src/lbracket.c: New file.
7323         * README: Add "[".
7324         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7325         a separate man page.
7326         * src/Makefile.am (bin_PROGRAMS): Add "[".
7327         (__SOURCES): New var.
7328         * src/test.c (LBRACKET): Define to 0 if not defined.
7329         (main): Use LBRACKET rather than argv[0].
7330
7331         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7332         Reported by Paul Jarc and Dan Jacobson.
7333
7334         * src/test.c (main): Do not recognize --help or --version if
7335         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7336         Do not bother testing that margv[margc] is non-null.
7337
7338 2003-07-04  Jim Meyering  <jim@meyering.net>
7339
7340         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7341         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7342
7343         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7344         option, and perform the +1600 invocations of head IFF the envvar
7345         RUN_EXPENSIVE_TESTS is set.
7346
7347 2003-07-03  Jim Meyering  <jim@meyering.net>
7348
7349         * src/cp.c (do_copy): Give a better diagnostic when failing due
7350         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7351         See http://bugs.debian.org/199730 for details.
7352
7353 2003-06-27  Jim Meyering  <jim@meyering.net>
7354
7355         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7356         * src/split.c (longopts): Use `1', not `0' as the value for
7357         for &verbose.  Reported by Keith Thompson.
7358
7359         Test for the above fix.
7360         * tests/misc/split-a: Also use --verbose and compare stderr
7361         output with what we'd expect.
7362
7363 2003-06-20  Jim Meyering  <jim@meyering.net>
7364
7365         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7366         Use `error_t' (rather than int) as type for local `err'.
7367         From Alfred M. Szmidt.
7368
7369 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7370
7371         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7372         Fix author preservation code.
7373
7374 2003-06-19  Jim Meyering  <jim@meyering.net>
7375
7376         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7377         (do_link): Don't warn about hard link to symlink.
7378
7379 2003-06-18  Jim Meyering  <jim@meyering.net>
7380
7381         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7382         Reflect renaming: getstr -> getdelim2.
7383
7384         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7385         readline -> readlinebuffer.
7386
7387 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7388
7389         * src/readlink.c: Include <sys/types.h> before system.h (because
7390         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7391
7392 2003-06-17  Jim Meyering  <jim@meyering.net>
7393
7394         * src/system.h (initialize_main): Define.
7395         Use it in every `main'.  Applied via this:
7396         p='initialize_main (&argc, &argv);'
7397         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7398           $(grep -l program_name.=.argv.0 *.c)
7399         test.c uses margc/margv, so I made the change manually for that file.
7400         Based on a patch from Bernard Giroud.
7401
7402 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7403
7404         Fix for build failure on Ultrix 4.3.
7405         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7406         Include sys/param.h and sys/mount.h on ultrix.
7407
7408 2003-06-16  Jim Meyering  <jim@meyering.net>
7409
7410         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7411         definitions.
7412         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7413         them here instead, but with one change: define EISDIR to -1, not 0.
7414
7415         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7416         guaranteed to be defined.
7417         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7418
7419         * README: Mention the CVS repository.
7420         Encourage addition of test cases.
7421
7422 2003-06-12  Jim Meyering  <jim@meyering.net>
7423
7424         * src/touch.c (touch): Call close only if necessary.
7425         From Bruno Haible.
7426
7427         * src/wc.c (usage): Correct wording: wc prints counts in the order
7428         `newline, word, byte'.  Reported by Keith M. Briggs.
7429         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7430
7431 2003-06-10  Jim Meyering  <jim@meyering.net>
7432
7433         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7434
7435 2003-06-07  Jim Meyering  <jim@meyering.net>
7436
7437         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7438         rule.
7439
7440 2003-06-06  Jim Meyering  <jim@meyering.net>
7441
7442         * src/extract-magic (main): Avoid newer 3-arg form of open,
7443         so this script works also with e.g., perl5.005_03.
7444         Patch by John David Anglin.
7445
7446 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7447
7448         * src/system.h: Include <stdbool.h> unconditionally.
7449
7450 2003-06-04  Jim Meyering  <jim@meyering.net>
7451
7452         * man/Makefile.am (check-programs-vs-x): Rename target
7453         from check-programs-vs-1.  Adjust rule to check for the
7454         primary (.x) file, not the generated one (.1).
7455
7456 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7457
7458         * man/kill.x: New file.
7459         * man/Makefile.am (dist_man_MANS): Add kill.1.
7460         (kill.1): New rule.
7461
7462 2003-06-04  Jim Meyering  <jim@meyering.net>
7463
7464         Ensure that the .x file for a new program is never forgotten again.
7465         * man/Makefile.am (programs): Define.
7466         (check-programs-vs-1): New phony target.
7467         (check-local): Depend on it.
7468
7469 2003-06-03  Jim Meyering  <jim@meyering.net>
7470
7471         Avoid unnecessary copying of environment.
7472         * src/env.c (main): Rather than clearing the environment and --
7473         unless told to ignore environment -- copying all settings from
7474         the saved, original environment, clear the environment only when
7475         that is requested.  Suggested by Jens Elkner.
7476
7477 2003-06-02  Jim Meyering  <jim@meyering.net>
7478
7479         * src/system.h: Always include <string.h>, since we assume C89.
7480         Include <limits.h> without checking for HAVE_LIMITS_H.
7481
7482         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7483         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7484
7485 2003-06-01  Jim Meyering  <jim@meyering.net>
7486
7487         Avoid a race condition in `tail -f' described by Ken Raeburn in
7488         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7489         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7490         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7491         (tail_bytes, tail_lines, tail): Likewise.
7492         (tail_file): Use the new `read_pos' value as the size,
7493         rather than stats.st_size from the fstat call.
7494
7495 2003-05-28  Jim Meyering  <jim@meyering.net>
7496
7497         * src/extract-magic: Allow expansion of `$file' in the here-
7498         document corresponding to the comment at the top of fs.h.
7499
7500 2003-05-26  Jim Meyering  <jim@meyering.net>
7501
7502         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7503         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7504         Use #if/#elif/... cascade so we get only one set of include files.
7505         Reported by Nelson Beebe.
7506
7507 2003-05-24  Jim Meyering  <jim@meyering.net>
7508
7509         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7510         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7511         accept the BSD format.
7512
7513 2003-03-28  Joe Orton  <jorton@redhat.com>
7514
7515         * src/md5sum.c (bsd_split_3): New function.
7516         (split_3): Detect checksums from BSD 'md5' command and handle them
7517         using bsd_split_3.
7518
7519         * tests/md5sum/basic-1: New tests for --check exit status, and for
7520         BSD-style checksum files.
7521
7522 2003-05-21  Jim Meyering  <jim@meyering.net>
7523
7524         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7525         This sort of thing is why it'd be *Really Good* to factor
7526         out the common code used here and in tail.c.
7527
7528 2003-05-14  Jim Meyering  <jim@meyering.net>
7529
7530         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7531
7532         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7533
7534         * tests/du/fd-leak: New file.  Test for the bug in du that
7535         was fixed by the 2003-05-12 change to lib/ftw.c.
7536         * tests/du/Makefile.am (TESTS): Add fd-leak.
7537
7538         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7539         includes a translatable word, `and'.
7540
7541         * src/dd.c (usage): Don't use `,' as the thousands separator
7542         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7543         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7544         * src/df.c (usage): Likewise.
7545         * src/du.c (usage): Likewise.
7546         * src/ls.c (usage): Likewise.
7547
7548         * Makefile.maint (syntax-check): Add another check.
7549
7550 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7551
7552         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7553         must output nothing.  Problem reported by Josh Hyman.
7554
7555         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7556         (output_unique, output_first_repeated, output_later_repeated):
7557         New vars.  All uses of "mode" changed to use these variables,
7558         which are not mutually exclusive as "mode" was.
7559         (writeline): New arg "match", used to control whether to
7560         obey output_first_repeated or output_later_repeated.
7561         All callers changed.
7562         (check_file, main): Adjust to above changes.
7563
7564         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7565
7566 2003-05-14  Jim Meyering  <jim@meyering.net>
7567
7568         * tests/rm/rm3: Use tr's \n notation rather than \012.
7569         This package can afford to do that, since its tests are guaranteed use
7570         GNU tr, which has accepted the more modern notation for 10 years.
7571         * tests/rm/rm5: Likewise.
7572         * tests/cp/same-file: Likewise.
7573         * tests/stty/row-col-1: Likewise.
7574         * tests/stty/basic-1: Likewise.
7575         * tests/rm/deep-1: Likewise.
7576         * tests/mv/part-symlink: Likewise.
7577         * tests/mkdir/perm: Likewise.
7578         * tests/misc/nice: Likewise.
7579
7580 2003-05-13  Jim Meyering  <jim@meyering.net>
7581
7582         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7583         (triple_free): Don't apply cast to argument of free.
7584         (seen_file): Add cast here instead.
7585
7586         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7587         (src_to_dest_free): Don't apply cast to argument of free.
7588
7589         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7590         * src/pr.c (init_fps, init_store_cols): Likewise.
7591         * src/join.c (delseq, freeline): Likewise.
7592         * src/expr.c (OLD): Likewise.
7593         * src/sort.c (sort): Likewise.
7594         * src/head.c (elide_tail_lines_pipe): Likewise.
7595
7596         * src/tail.c: Include "quote.h".
7597         Use quote in diagnostics.  Change many error format strings
7598         from just `%s' to e.g., `error reading %s'.
7599         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7600         Rewrite newline-counting loop to use memchr.
7601
7602         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7603         Now that assert is no longer used, don't include <assert.h>.
7604
7605 2003-05-12  Jim Meyering  <jim@meyering.net>
7606
7607         * src/head.c: Include <assert.h>.
7608         (AUTHORS): Add my name.
7609         (elide_tail_lines_pipe): New function.
7610
7611 2003-05-10  Jim Meyering  <jim@meyering.net>
7612
7613         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7614
7615         * src/readlink.c (main): Set program_name before first use.
7616         Remove that (redundant) first use.
7617         Don't exit successfully just because --verbose was specified.
7618         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7619         parameter is 0, error does not exit.
7620
7621         * src/uname.c (main): When failing due to too many arguments, also say
7622         that, rather than just "Try `uname --help' for more information.".
7623         * src/comm.c (main): Likewise, but for too few arguments.
7624         * src/logname.c: Include error.h.
7625         (main): Say why we're failing.
7626
7627         * src/uniq.c (main): Don't segfault when argc < optind.
7628         * src/who.c (main): Handle argc < optind.
7629         * src/df.c (main): Likewise.
7630         * src/install.c (main): Likewise.
7631         * src/mv.c (main): Likewise.
7632         * src/pwd.c (main): Likewise.
7633         * src/tty.c (main): Likewise.
7634         * src/chroot.c (main): Likewise.
7635         * src/hostname.c: Likewise.
7636         * src/du.c (main): Likewise.
7637         * src/expand.c (main): Likewise.
7638         * src/env.c (main): Likewise.
7639         * src/unexpand.c (main): Likewise.
7640         * src/printenv.c (main): Likewise.
7641         * src/sync.c (main): Handle argc == 0.
7642         * src/expr.c (main): Likewise.
7643         * src/printf.c (main): Likewise.
7644         * src/basename.c (main): Likewise.
7645         * src/ln.c (main): Test for `missing argument' before computing n_files.
7646         * src/tail.c (main): Test for the case of no arguments before
7647         computing n_files.
7648
7649         * src/kill.c (send_signals): Don't check command line arguments here.
7650         (main): Check them here instead.  Handle argc < optind.
7651
7652         * src/logname.c (main): Use error, rather than fprintf, for the sake
7653         of consistency.
7654
7655         * src/rm.c (main): Don't overrun array bound if argc is 0.
7656
7657 2003-05-09  Jim Meyering  <jim@meyering.net>
7658
7659         * src/sort.c (main): Don't overrun array bound if argc is 0.
7660         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7661         Reported by Wartan Hachaturow.
7662
7663 2003-05-07  Jim Meyering  <jim@meyering.net>
7664
7665         Implement support so that `head --lines=-N' works on seekable files.
7666         * src/head.c (enum Copy_fd_status): Define.
7667         (COPY_FD_DIAGNOSE): New macro.
7668         (elide_tail_lines_seekable): New funtion.
7669         (elide_tail_lines_file): Call it here.
7670
7671 2003-05-06  Jim Meyering  <jim@meyering.net>
7672
7673         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7674
7675 2003-05-04  Jim Meyering  <jim@meyering.net>
7676
7677         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7678         caused the addition of thousands of small files to the tar archive.
7679         * tests/misc/head-elide-tail: New file.  Add them here instead.
7680         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7681
7682 2003-05-04  Paul Eggert  <eggert@twinsun.com>
7683
7684         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7685         (IF_READDIR_NEEDS_REWINDDIR): Remove.
7686         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7687         which was a bit weird because it couldn't be emulated by a function.
7688
7689 2003-05-03  Jim Meyering  <jim@meyering.net>
7690
7691         Extend head to accept --lines=-N (--bytes=-N) and to print all
7692         but the N lines (bytes) at the end of the file.
7693         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7694         Use quote() in diagnostics, rather than literal `' marks.
7695         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7696         New functions.
7697         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7698         (head_file): Reorganize so as to call head from only one place.
7699         (main): Likewise, for head_file.
7700         Handle new, undocumented option, --presume-input-pipe.
7701         Handle negative line and byte counts.
7702         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7703
7704         * tests/du/8gb: Skip test if the file system of `.' doesn't support
7705         sparse files -- otherwise it'd create a file of size 8GB.
7706
7707 2003-05-02  Jim Meyering  <jim@meyering.net>
7708
7709         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7710         Instead explain about `-' and standard input.
7711         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7712         Reported by Keith Thompson.
7713         * tests/fmt/basic: Add test for the above fix.
7714
7715         * src/fmt.c: Include "quote.h".
7716         Use quote() in diagnostics, rather than literal `' marks.
7717         (main): Exit nonzero when unable to open an input file.
7718         * tests/fmt/basic: Add test for the above fix.
7719
7720         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7721         specifications like `-72x'.
7722         * tests/fmt/basic: Add test for the above fix.
7723
7724         Work around nasty readdir bug on Darwin6.5.
7725         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7726         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7727         returned NULL and there has been at least one successful unlink or
7728         rmdir call since the opendir or previous rewinddir, then call
7729         rewinddir and reiterate the loop.
7730
7731         Factor out common code.
7732         * src/remove.c (readdir_ignoring_dotdirs): New function.
7733         (is_empty_dir): Use it here.
7734         (remove_cwd_entries): Use it here.
7735
7736 2003-05-01  Jim Meyering  <jim@meyering.net>
7737
7738         * tests/rm/r-3: Create 500 rather than just 300 files.
7739         There's a bug in Darwin6.5's readdir that shows up only with
7740         338 or more files.
7741         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7742         has two components.
7743
7744         * src/tail.c:
7745         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7746         (dump_remainder): Move two declarations `down' into the scope
7747         where they are used.
7748         (xlseek): Return the resulting offset.
7749         (file_lines): Rename parameter, file_length, to end_pos.
7750         (pipe_lines): Don't coerce safe_read return value to `int'.
7751         Adapt tests accordingly.
7752         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7753         to `unsigned int'.
7754         Change type of `total_bytes' from `int' to `size_t',
7755         since the former wouldn't always be wide enough.
7756         Don't coerce safe_read return value to `int',
7757         and adapt tests accordingly.
7758         Now that testing for a read error no longer involves
7759         using `tmp', handle that case *after* freeing `tmp'.
7760         (start_bytes): Clean up.
7761         (tail_bytes): Now that `n_bytes' may be larger than
7762         OFF_T_MAX, test for that condition and, if it's true, don't
7763         use lseek optimizations.
7764         (parse_options): Don't fail just because N_UNITS is larger than
7765         the maximum size of a file -- tail may be applied to an input
7766         stream (e.g., a pipe) with more data than that.
7767
7768         * Makefile.maint (syntax-check): Rename from alloc-check.
7769         Also check for SPACE-TAB sequences.
7770         Also check for malloc/calloc/realloc casts.
7771
7772 2003-05-01  Jim Meyering  <jim@meyering.net>
7773
7774         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
7775
7776 2003-04-28  Jim Meyering  <jim@meyering.net>
7777
7778         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7779         make the now-more-picky tsort fail.
7780
7781 2003-04-24  Jim Meyering  <jim@meyering.net>
7782
7783         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7784         (main): Minor syntactic clean-up.
7785
7786         * src/tsort.c (tsort): Fail if the input contains an odd number of
7787         tokens.  Reported by junkio@cox.net.
7788
7789         * tests/tsort/basic-1: Test for the above fix.
7790
7791 2003-04-21  Jim Meyering  <jim@meyering.net>
7792
7793         * tests/misc/printf: Add tests for the printf fixes below.
7794
7795         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7796
7797 2003-04-20  Paul Eggert  <eggert@twinsun.com>
7798
7799         Fix printf POSIX compatibility bug reported by Ben Harris in
7800         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7801         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7802         \0NNN in the %b operand.
7803         * src/printf.c (usage): Likewise.
7804         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7805         is desired.  All uses changed.  Behave like Bash printf if %b
7806         operand uses \NNN where the initial N is not 0.
7807
7808 2003-04-17  Jim Meyering  <jim@meyering.net>
7809
7810         * src/stty.c: Remove uses of PROTOTYPE macro.
7811
7812 2003-04-15  Jim Meyering  <jim@meyering.net>
7813
7814         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7815         each sequence of spaces before a TAB character.
7816
7817 2003-04-13  Jim Meyering  <jim@meyering.net>
7818
7819         * src/remove.c (is_empty_dir): Don't closedir (NULL).
7820
7821 2003-04-12  Jim Meyering  <jim@meyering.net>
7822
7823         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7824         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7825         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7826         * src/nl.c (main): Fix those problems and remove literal quote marks
7827         (e.g., "`%s'") from format string; instead use "%s" in each format
7828         string and `quote (optarg)' as the corresponding argument.
7829         Also, diagnose all invalid command line options before failing.
7830
7831         * src/nl.c (proc_text): Fix a bug that would make nl output extra
7832         newlines in some cases.  Details here: http://bugs.debian.org/177256.
7833         This bug was introduced on 2001-11-10 for textutils-2.0.17.
7834         * tests/misc/nl: Add test for the above-fixed bug.
7835
7836         * tests/misc/readlink: New file.  Test the --canonicalize option.
7837         * tests/misc/Makefile.am (TESTS): Add readlink.
7838
7839 2003-04-11  Jim Meyering  <jim@meyering.net>
7840
7841         Clean up.
7842         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7843         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7844         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7845         retain alignment) each sequence of spaces before a TAB character.
7846
7847         * src/ls.c: Include <stdlib.h> unconditionally.
7848
7849         * Makefile.maint (xalloc-check): Rename from header-check.
7850
7851         * src/yes.c: Include error.h after system.h, not before.
7852
7853         Clean up.
7854         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7855         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7856         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7857         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7858         * src/tr.c: * src/unexpand.c, src/users.c:
7859         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7860         return values and of xrealloc's first argument.
7861         Fix the former with this:
7862         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7863
7864 2003-04-10  Jim Meyering  <jim@meyering.net>
7865
7866         * src/stty.c (wrapf): Declare with format attribute.
7867
7868         The S_MAGIC_... names shouldn't be maintained in two places (prior
7869         to this change, one would have to keep stat.c and fs.h in sync).
7870         This change makes it so those names and the corresponding
7871         hexadecimal constants all reside in stat.c.  fs.h is now generated.
7872         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7873         (BUILT_SOURCES): Add fs.h, now that it's generated.
7874         (EXTRA_DIST): Add extract-magic.
7875         * src/extract-magic: New script to extract fs.h definitions from stat.c.
7876         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7877         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7878
7879         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7880         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
7881
7882         * man/unexpand.x: Add `SEE ALSO' reference to expand.
7883         * man/expand.x: Add `SEE ALSO' reference to unexpand.
7884         Suggestion from Dan Jacobson.
7885
7886 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
7887
7888         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7889         * src/stat.c (human_fstype): Handle Linux's devpts.
7890
7891 2003-04-09  Paul Eggert  <eggert@twinsun.com>
7892
7893         * src/split.c (line_bytes_split): Arg is of type size_t, since
7894         that's all that is supported for now.
7895         (main): Check for overflow in obsolescent line count option.
7896
7897 2003-04-09  Jim Meyering  <jim@meyering.net>
7898
7899         * tests/misc/split-fail: Add a new test for the above fix.
7900
7901         * src/split.c (bytes_split): Use size_t temporary (rather than
7902         uintmax_t original) in remaining computations.  From Paul Eggert.
7903
7904         Handle command line option arguments larger than 2^31.
7905         This allows e.g., splitting into files of size 2GB and larger,
7906         and running split --lines=N with N=2^31 or more.
7907         But for --line-bytes=N, the restriction that N <= SIZE_MAX
7908         remains (for now), due to the way it is implemented.
7909
7910         * src/split.c: Include "inttostr.h".
7911         (bytes_split, lines_split, line_bytes_split, main):
7912         Use uintmax_t, not size_t, for file sizes.
7913         (main): Give a better diagnostic for option arguments == 0.
7914         Use umaxtostr to print file sizes.
7915         Reported by Luke Hassell.
7916
7917 2003-04-08  Jim Meyering  <jim@meyering.net>
7918
7919         * src/rm.c (usage): Mention that --directory (-d) works only
7920         on some systems.  Suggestion from Samuel Tardieu.
7921
7922         * tests/basename/basic: Run $PERL to see if it is available,
7923         rather than testing its value.
7924         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
7925         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
7926         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
7927         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
7928         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
7929         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
7930         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
7931         * tests/sum/basic-1, tests/seq/basic: Likewise.
7932
7933         * tests/misc/Makefile.am (TESTS): Add split-fail.
7934         * tests/misc/split-fail: New file.
7935
7936         * src/split.c: Rename local variables: nchars -> n_bytes.
7937         (lines_split): Rename local, nlines -> n_lines.
7938         (main): Rename local variable: s/accum/n_units/.
7939         (main): Use STDIN_FILENO, not literal `0'.
7940
7941 2003-04-07  Jim Meyering  <jim@meyering.net>
7942
7943         * src/stat.c: Add #include directives for Ultrix 4.4.
7944         Based on a suggested change from Bert Deknuydt.
7945
7946 2003-04-06  Jim Meyering  <jim@meyering.net>
7947
7948         * Makefile.maint (makefile-check): New rule.
7949         (local-check): Add it.
7950
7951 2003-04-05  Jim Meyering  <jim@meyering.net>
7952
7953         * Makefile.am (nearly all of them):
7954         Use $(VAR) rather than @VAR@, now that we can rely on automake to
7955         emit a definition for each substituted variable.
7956         * tests/Makefile.am.in: Likewise.
7957
7958         * tests/rm/rm5: Add a comment explaining why this test fails when
7959         using Tru64's broken sed.
7960         * tests/rm/rm3: Likewise.
7961
7962         Make `kill -t' output signal descriptions (not `?') on Tru64.
7963         * src/kill.c (sys_siglist): Also check for __sys_siglist.
7964         Patch by Tony Leneis.
7965         * configure.ac: Also check for declaration of __sys_siglist.
7966         Required for Tru64 4.0D, 4.0F, and 5.1.
7967         Reported by Tony Leneis.
7968
7969 2003-04-04  Jim Meyering  <jim@meyering.net>
7970
7971         * src/Makefile.am (PERL): Remove unnecessary definition.
7972
7973         Because of inappropriate (but POSIX-mandated) behavior of rename,
7974         `mv a b' would not remove `a' in some unusual cases.  Work around
7975         this by unlinking `a' when necessary.
7976
7977         * src/copy.c (same_file_ok): Add an output parameter.
7978         Set it in the offending case.
7979         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
7980         Reported by Ed Avis.
7981         * tests/mv/hard-4: New test for the above.
7982         * tests/mv/Makefile.am (TESTS): Add hard-4.
7983
7984         Clean up rules for automatically generated sources:
7985         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
7986         Make each generated file be read-only.
7987         Add each file name to BUILT_SOURCES separately.
7988         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
7989
7990         Put LOCALEDIR macro definition in new file: localedir.h.
7991         * src/Makefile.am (DEFS): Remove definition.
7992         (localedir.h): New rule.
7993         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
7994         * src/system.h: Include "localedir.h".
7995
7996 2003-04-02  Jim Meyering  <jim@meyering.net>
7997
7998         * Version 5.0.
7999
8000         * tests/misc/Makefile.am (TESTS): Add false.
8001
8002         * Makefile.maint (TMPDIR): Make sure it's defined.
8003         (my-distcheck): Build in $(TMPDIR), not `.'.
8004
8005         * src/Makefile.am (false.c): Change all occurrences of
8006         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8007         unsuccessfully also with --help.  Reported by Paul Jarc,
8008         * tests/misc/false: New test for the above.
8009
8010 2003-03-30  Jim Meyering  <jim@meyering.net>
8011
8012         * NEWS: Note the location of older NEWS files.
8013
8014         * src/remove.c (is_empty_dir): Don't let a failing closedir
8015         clobber errno.  Spotted by Arnold Robbins.
8016
8017         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8018
8019 2003-03-29  Jim Meyering  <jim@meyering.net>
8020
8021         * Version 4.5.12.
8022
8023         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8024         Note that there are some harmless test failures when running
8025         `make check' as root on some systems.
8026
8027 2003-03-28  Jim Meyering  <jim@meyering.net>
8028
8029         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8030         This happens when connecting to sparc-solaris5.7 via ssh from within
8031         emacs.  Reported by Karl Berry.
8032
8033         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8034         Otherwise, on systems (DJGPP) that emulate pipes using files,
8035         this test would never complete, waiting for `yes' to terminate.
8036         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8037         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8038         Reported by Rich Dawe.
8039
8040 2003-03-27  Jim Meyering  <jim@meyering.net>
8041
8042         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8043         from `written by...' comment, at his request.
8044
8045 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8046
8047         Fix buffer overrun problem reported by TAKAI Kousuke, along
8048         with some other POSIX incompatibilities.
8049
8050         * src/printf.c (print_esc): Do not treat \x specially if
8051         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8052         in backslash.  Treat incomplete escape sequences as strings
8053         of characters, as POSIX requires.
8054         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8055         if the format is incomplete.
8056
8057 2003-03-24  Jim Meyering  <jim@meyering.net>
8058
8059         * tests/misc/printf: Add tests for the above fixes and changes.
8060
8061 2003-03-26  Jim Meyering  <jim@meyering.net>
8062
8063         * src/copy.h (struct cp_options): Add a comment.
8064
8065 2003-03-23  Jim Meyering  <jim@meyering.net>
8066
8067         * README: Describe problem with 64-bit mode on HPUX 11.x,
8068         with patch for /usr/include/inttypes.h.
8069         * TODO: Plan to add an autoconf test to work around the bug.
8070
8071 2003-03-22  Jim Meyering  <jim@meyering.net>
8072
8073         * src/stat.c: Don't include <sys/sysmacros.h>.
8074         That is already done via system.h.  Otherwise, the multiple
8075         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8076         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8077         (human_fstype): Factor some directives `up', out of this function.
8078         Cast away `const' to avoid error from Cray's /bin/cc.
8079
8080 2003-03-20  Jim Meyering  <jim@meyering.net>
8081
8082         * announce-gen (print_changelog_deltas): Ensure that a newline
8083         precedes each row of `*'s.
8084
8085 2003-03-20  Jim Meyering  <jim@meyering.net>
8086
8087         * Version 4.5.11.
8088
8089         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8090         format flag characters.
8091         Do not require that a field width be specified.
8092         Do not fail when given a field width of `0'.
8093         Reported by Dan Jacobson.
8094         * tests/seq/basic: Add new tests for the above-fixed bug.
8095
8096         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8097         (install-root): Likewise.
8098         (install-exec-local): Likewise.
8099         Based on a patch from Richard Dawe.
8100
8101 2003-03-19  Jim Meyering  <jim@meyering.net>
8102
8103         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8104         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8105         Include $(EXEEXT) in program names.
8106         Since $(LN_S) may degenerate to `cp -p', be careful
8107         to invoke it from the destination directory.
8108         Mostly from Richard Dawe.
8109         * configure.ac: Use AC_PROG_LN_S.
8110
8111         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8112         CDPATH shell variable set could cause this test to fail.
8113         Reported by Karl Berry.
8114
8115 2003-03-18  Jim Meyering  <jim@meyering.net>
8116
8117         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8118         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8119         AIX 5.1's xlc could not compile the former.
8120         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8121
8122 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8123
8124         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8125         program names, since automake only adds $(EXEEXT) to programs
8126         in its *_PROGRAMS.
8127
8128 2003-03-16  Jim Meyering  <jim@meyering.net>
8129
8130         * src/remove.c (rm): Put two local variables in static storage,
8131         so they can't be clobbered by the potential longjmp.
8132
8133 2003-03-15  Jim Meyering  <jim@meyering.net>
8134
8135         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8136         so that a version number with a two-digit component can still count
8137         as an alpha release.  Reported by Richard A Downing.
8138         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8139
8140 2003-03-14  Jim Meyering  <jim@meyering.net>
8141
8142         * src/ansi2knr.c: Remove no-longer-used file.
8143         * src/ansi2knr.1: Likewise.
8144
8145         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8146         assignment, since it causes trouble with old versions of GNU make
8147         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8148         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8149         Patch from Alexandre Duret-Lutz.
8150
8151         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8152         subdirectories so that each includes a definition of ACLOCAL_M4.
8153
8154         * announce-gen (main): Label the compressed source URLs.
8155
8156         * Version 4.5.10.
8157
8158         * tests/du/slink: Relax the test for the `local'ness of a file system,
8159         so that now it works also for tmpfs.
8160
8161         * tests/du/hard-link: Transform output from first du, so that this
8162         test doesn't fail on file systems like tmpfs that order directory
8163         entries differently.
8164
8165 2003-03-13  Jim Meyering  <jim@meyering.net>
8166
8167         * tests/du/8gb: Work around what appears to be an NFS failure that
8168         would make this test fail on some systems.
8169
8170 2003-03-11  Jim Meyering  <jim@meyering.net>
8171
8172         * tests/du/basic: Make the test file exactly 4k bytes long.
8173
8174         * src/split.c (longopts): Don't hard-code `2' here.
8175         Instead, just specify `&verbose', and ...
8176         (main): ... remove the `case 2:' block for --verbose.
8177
8178         * tests/du/basic: Make the test file larger than 64 bytes, so that
8179         we don't immediately disqualify file systems (e.g., NetApp) on which
8180         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8181
8182 2003-03-10  Jim Meyering  <jim@meyering.net>
8183
8184         Don't segfault for a negative field width or precision in format string.
8185         Note that this is just a stopgap fix.  The longer term solution may
8186         involve adapting bash's builtins/printf.def.
8187
8188         * src/printf.c: (UNSPECIFIED): Define.
8189         (print_direc): Use the special value, UNSPECIFIED, to indicate
8190         that field_width or precision has not been specified.
8191         (print_formatted): Fail if field_width or precision is the
8192         special value, UNSPECIFIED.
8193         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8194
8195         * src/sys2.h (INT_MIN): Define, if necessary.
8196         * tests/misc/printf: Add a test for the above-fixed bug.
8197
8198 2003-03-09  Jim Meyering  <jim@meyering.net>
8199
8200         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8201         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8202         Reported by Bob Proulx.
8203         (pop_dir): Reverse order of sign change and cast, to be consistent
8204         with the above.
8205
8206 2003-03-08  Jim Meyering  <jim@meyering.net>
8207
8208         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8209         shell variable, but only in the environment.  With /bin/sh->bash, the
8210         shell variable is set to `y', and that would cause a spurious warning.
8211         Reported by Bob Proulx.
8212
8213         * tests/Makefile.am (check-root): Remove touch/fifo.
8214         It doesn't appear to have to be run as root.
8215
8216         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8217         user name, make sure that the selected user name has a usable shell.
8218         Reported by Paul Jarc.
8219
8220         Before, when using shred on a device, one had to specify --exact,
8221         or be careful to choose a size that would not be rounded up and
8222         exceed the maximum value;  that could result in a failure of
8223         the final write.
8224         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8225         files.  Suggestion from Ben Elliston.
8226         (usage): Say it.
8227
8228         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8229         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8230         Patch by Bob Proulx.
8231
8232         * src/Makefile.am (check-misc): Check for use of `defined' in
8233         #define directives.
8234         Change to $(srcdir) before running grep.
8235
8236         * src/sleep.c: Remove now-unused #include and #define directives.
8237
8238         * src/du.c (process_file): If a file's size is not being counted
8239         e.g., because it's a hard link to a file we've already counted,
8240         then don't print a line for it.
8241
8242         * tests/du/hard-link: New test for the above-fixed bug.
8243         * tests/du/Makefile.am (TESTS): Add hard-link.
8244
8245         `du -S' didn't work
8246         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8247         and make the two-array approach work.
8248
8249         * tests/du/basic: Correct/add tests for the above fix.
8250         Set LC_ALL, etc., now that we use sort.
8251         Check the block/size of a small file, too.
8252         Correct expected results for simple dir1/dir2/file case.
8253         Add another test of du -S.
8254
8255 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8256
8257         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8258         middle-end/9986).  As one of GCC's optimizations, it transforms a
8259         fputs_unlocked call to a fputc_unlocked call when the string is
8260         one character long.  However, hpux doesn't have fputc_unlocked.
8261
8262         * expr.c (usage): Use putchar, not fputs, to output a single character.
8263         * ls.c (dired_dump_obstack): Likewise.
8264         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8265         * stat.c (print_it): Likewise.
8266
8267 2003-03-07  Jim Meyering  <jim@meyering.net>
8268
8269         * src/cp.c: Remove everything associated with mmap-stack.c.
8270         This reverts the two changes of 2003-02-21.
8271         * src/du.c: Remove everything associated with mmap-stack.c.
8272         This reverts the change of 2003-02-19.
8273
8274 2003-03-06  Jim Meyering  <jim@meyering.net>
8275
8276         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8277         CDPATH shell variable set could cause this test to fail.
8278         Reported by Karl Berry.
8279
8280 2003-03-05  Jim Meyering  <jim@meyering.net>
8281
8282         * Version 4.5.9.
8283
8284         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8285         integer with zero, to avoid a warning from Intel's ecc.
8286         Reported by Nelson Beebe.
8287
8288         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8289         Otherwise, for files or totals that are too big, numbers would
8290         be truncated.  Patch mostly by Michael Stone.
8291         Reported by Ingo Saitz as Debian bug #183210.
8292
8293         * tests/du/8gb: New test for the above-fixed bug.
8294         * tests/du/Makefile.am (TESTS): Add 8gb.
8295
8296         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8297         rather than UTILS_OPEN_MAX - 10.
8298
8299 2003-03-04  Jim Meyering  <jim@meyering.net>
8300
8301         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8302         rather than bug-gnu-utils, now that the former is better known.
8303         Suggestion from Göran Uddeborg.
8304
8305         * src/stat.c (usage): Capitalize consistently.
8306         Reported by Göran Uddeborg.
8307
8308         * Makefile.maint (rel-files): Include $(signatures), so that
8309         those files are also copied into $(release_archive_dir).
8310
8311         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8312         no longer does it.
8313         * src/remove.c (AD_pop_and_chdir): Likewise.
8314
8315         * tests/Makefile.am (check-root): Add fail-2eperm.
8316
8317 2003-03-03  Jim Meyering  <jim@meyering.net>
8318
8319         * src/remove.c (remove_cwd_entries): Include the full filename of
8320         the offending file, not just the basename.
8321
8322         * tests/misc/tty-eof: Set $ME properly.
8323
8324         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8325         Remove now-unused variables.
8326         (tag-prev-version, prev-cvs-tag): Likewise.
8327
8328         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8329         accurate diagnostic when failing to remove a file owned by some other
8330         user.  Reported by Ivo Timmermans via Michael Stone.
8331         This fixes Debian bug# 178471.
8332
8333         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8334         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8335         Based on a report from Ivo Timmermans.
8336
8337 2003-03-02  Jim Meyering  <jim@meyering.net>
8338
8339         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8340         failure to create a hard link, do not remove the entry associating
8341         the source dev/ino with the destination file name.
8342         * tests/mv/Makefile.am (TESTS): Add hard-3.
8343         * tests/mv/hard-3: New test, for the above-fixed bug.
8344         Inspired by a report from Iida Yosiaki.
8345
8346 2003-03-01  Jim Meyering  <jim@meyering.net>
8347
8348         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8349         header string.  Instead, put `Filesystem' and `Type' headers in the
8350         same string, so translators can use horizontal space as needed.
8351         Reported by Jean Charles Delepine.
8352
8353 2003-02-28  Jim Meyering  <jim@meyering.net>
8354
8355         * src/copy.c (copy_internal): When link fails because of an
8356         existing destination file, unlink that file and try again.
8357         Reported by Iida Yosiaki.
8358
8359         * tests/mv/Makefile.am (TESTS): Add hard-2.
8360         * tests/mv/hard-2: New test for the above-fixed bug.
8361         Based on a test case from Iida Yosiaki.
8362
8363 2003-02-26  Jim Meyering  <jim@meyering.net>
8364
8365         * tests/du/basic: Don't test du's -b option here.  Directory byte
8366         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8367         and IBM AIX 4.2.  Reported by Nelson Beebe.
8368
8369 2003-02-25  Jim Meyering  <jim@meyering.net>
8370
8371         * Makefile.maint (announcement): Now that ChangeLog entries
8372         are output by announce-gen, don't do it here.
8373         * announce-gen (print_changelog_deltas): New function.
8374         (main): Use it.
8375
8376 2003-02-22  Jim Meyering  <jim@meyering.net>
8377
8378         * announce-gen: New option: --release-type=TYPE
8379         * Makefile.maint (beta, major): New targets.  Remove `release'.
8380         Put them all together on a line.
8381         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8382         invocation of `announcement'.
8383         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8384
8385         * announce-gen: New option: --news=NEWS_FILE.
8386         Extract NEWS entries here, not via rules in Makefile.maint.
8387         * Makefile.maint (announcement): Now that NEWS entries are
8388         extracted by announce-gen, don't do it here.
8389         (news-r1, news-r2): Remove now-unused definitions.
8390
8391 2003-02-21  Jim Meyering  <jim@meyering.net>
8392
8393         * Version 4.5.8.
8394
8395         Merge in changes from autoconf's version of this file.
8396         * Makefile.maint (www-gnu): Define.
8397         (standards.texi-url_prefix): Use $(www-gnu).
8398         (make-stds.texi-url_prefix): Likewise.
8399
8400         * src/cp.c: Include "mmap-stack.h".
8401         (main): Invoke `run' through a macro that (when possible) runs it
8402         with a large, mmap'd stack.
8403
8404         * src/cp.c (run): New function, preparing for the above.
8405         Exit from this function, not from main
8406         (main): Call run.
8407
8408         * src/du.c: New option: --apparent-size.
8409         (enum) [APPARENT_SIZE_OPTION]: New member.
8410         (long_options): Add it.
8411         (usage): Describe it.
8412         (main): Handle it.
8413         ['b']: Set apparent_size.
8414         David Eisner reported that the behavior of --bytes had changed.
8415         Paul Eggert proposed the use of a new option, --apparent-size.
8416
8417         * src/du.c (apparent_size): New global.
8418         (print_only_size): Reflect the fact that we're printing byte counts,
8419         not ST_NBLOCKSIZE-byte-block counts.
8420         (print_size): Call print_only_size rather than duplicating its code.
8421         (process_file): Accumulate byte counts, rather than block counts.
8422
8423         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8424         for --separate-dirs (-S).
8425
8426 2003-02-20  Jim Meyering  <jim@meyering.net>
8427
8428         * Use automake-1.7.3.  Regenerate dependent files.
8429
8430         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8431         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8432         (usage) [%B]: Describe it.
8433         [%b]: Refer to %B.
8434
8435         * src/du.c (process_file): Reorganize the code to use only
8436         one `sum' array, and change how -S works back to the way it was
8437         before 2003-01-31.  Patch by Bruno Haible.
8438
8439         * tests/du/basic: New test.
8440         * tests/du/Makefile.am (TESTS): Add basic.
8441
8442         * tests/envvar-check: Add checks for the following:
8443         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8444
8445         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8446         so as not to conflict with the distributed file by the same name.
8447
8448         * src/du.c (process_file): Set info->skip before any possible return.
8449
8450         Report correct usage for directories, not 0.
8451         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8452         _before_ recording the dev/ino of a directory.
8453         Reported by Bruno Haible.
8454
8455         Now, df always displays the device file name corresponding to the
8456         listed mount point under `Filesystem'.  Before, for an unmounted
8457         block- or character-special file argument, it would display the
8458         command-line argument instead.
8459         * src/df.c (show_disk): Return a value indicating whether
8460         there was a match.  Don't try to find a mount point here.
8461         (show_entry): If show_disk doesn't find a match, call show_point.
8462
8463 2003-02-19  Jim Meyering  <jim@meyering.net>
8464
8465         * src/du.c: Include "mmap-stack.h".
8466         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8467         Exit from this function, not from...
8468         (main): ...here.
8469         Instead, if possible, invoke du_files through a macro that
8470         runs it with a large, mmap'd stack.
8471
8472         * src/join.c (usage): Change wording in --help output:
8473         use FILENUM instead of `SIDE' and say what FILENUM means.
8474         Reported by Bernhard Gabler.
8475
8476         * src/df.c (print_header): Rather than using a hard-coded literal
8477         string of spaces matching the length of the English `...Type' header,
8478         output the right number of spaces to match the selected translation.
8479         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8480
8481         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8482         (lines_split): Likewise.  and correct misleading indentation.
8483
8484         * src/split.c: Include "full-read.h".
8485         (bytes_split, lines_split, line_bytes_split): Use full_read,
8486         not safe_read.   The way split was using the latter, a short read
8487         could cause split to terminate before EOF.
8488
8489         * tests/misc/tty-eof: Test all programs that can read stdin,
8490         requiring no arguments and that write to standard output.
8491
8492         * tests/misc/tty-eof: New file.  Renamed from ...
8493         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8494         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8495
8496 2003-02-18  Jim Meyering  <jim@meyering.net>
8497
8498         cksum would perform an extra read after encountering EOF
8499         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8500         Patch by Michael Bacarella.
8501
8502         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8503         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8504         cat, cksum, md5sum, and sha1sum all in the same loop.
8505
8506 2003-02-14  Jim Meyering  <jim@meyering.net>
8507
8508         * src/remove.c: Include "euidaccess.h".
8509         Remove declaration of euidaccess.
8510
8511 2003-02-12  Jim Meyering  <jim@meyering.net>
8512
8513         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8514         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8515
8516 2003-02-10  Jim Meyering  <jim@meyering.net>
8517
8518         * src/test.c: Don't include group-member.h.
8519         Include euidaccess.h.
8520         (eaccess): Rewrite function to set the real uid and gid temporarily
8521         to the effective uid and gid, then invoke 'access', and then set the
8522         real uid and gid back.  On systems that lack setreuid or setregid,
8523         fall back on the kludges in euidaccess.  Before, it would not work
8524         for e.g., files with ACLs, files that were marked immutable,
8525         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8526         Paul Eggert suggested the new implementation.
8527
8528 2003-02-09  Jim Meyering  <jim@meyering.net>
8529
8530         * src/test.c (test_stat): Remove function.  It's job is done (only
8531         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8532
8533 2003-02-08  Jim Meyering  <jim@meyering.net>
8534
8535         * Version 4.5.7.
8536
8537         * tests/mv/part-symlink: Don't assume that the file owner username
8538         length is less than 9 in ls output: instead, omit that field
8539         altogether.  Reported by, and suggested fix from, Ferdinand.
8540
8541         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8542         * tests/du/Makefile.am (TESTS): Add restore-wd.
8543
8544         * src/rm.c: Correct now-invalid comment about cycle-detection.
8545
8546 2003-02-06  Jim Meyering  <jim@meyering.net>
8547
8548         * NEWS: Add entries from old/*/NEWS
8549         from fileutils-4.1 through 4.1.11 and
8550         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8551
8552         * Version 4.5.6.
8553
8554         * src/du.c (process_file): Don't return early for excluded files
8555         or for files whose dev/inode we've already seen.
8556
8557 2003-02-05  Jim Meyering  <jim@meyering.net>
8558
8559         * tests/du/exclude: New file.
8560         * tests/du/Makefile.am (TESTS): Add exclude.
8561
8562 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8563
8564         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8565         Fix memory allocation arithmetic.
8566
8567 2003-02-04  Jim Meyering  <jim@meyering.net>
8568
8569         `df /dev/block-or-char-device-file--not-mounted' now reports
8570         the name of the file system on which the file resides, usually `/'.
8571         Before, it would leave the `Mounted on' field blank.
8572         * src/df.c (show_disk): Move function to precede find_mount_point.
8573         (show_disk): Add parameter: STATP.
8574         If we don't find a matching device name, then resort to calling
8575         find_mount_point.  Reported by Bob Proulx.
8576
8577 2003-02-03  Andreas Schwab  <schwab@suse.de>
8578
8579         * tests/rm/cycle: Require non-root.
8580         * tests/rm/isatty: Likewise.
8581
8582 2003-02-02  Jim Meyering  <jim@meyering.net>
8583
8584         * Version 4.5.5.
8585
8586         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8587
8588         Ensure that there are no offending uses of `:'.
8589         * Makefile.maint (makefile_path_separator_check): New rule.
8590         (local-check): Add it to the list.
8591
8592 2003-02-01  Jim Meyering  <jim@meyering.net>
8593
8594         * src/du.c (MAX_N_DESCRIPTORS): Define.
8595
8596         * src/stat.c (G_fail): New global.
8597         (human_time): Diagnose failed localtime, not failed nstrftime.
8598         (main): Fail if G_fail is set.
8599
8600 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8601
8602         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8603         hard-coding the path-separator.  Also double-quote the new PATH,
8604         to avoid problems when the path-separator is a semi-colon or when
8605         `pwd` contains e.g. a space.
8606         * tests/chgrp/Makefile.am: Likewise.
8607         * tests/chmod/Makefile.am: Likewise.
8608         * tests/chown/Makefile.am: Likewise.
8609         * tests/cp/Makefile.am: Likewise.
8610         * tests/dd/Makefile.am: Likewise.
8611         * tests/dircolors/Makefile.am: Likewise.
8612         * tests/du/Makefile.am: Likewise.
8613         * tests/expr/Makefile.am: Likewise.
8614         * tests/factor/Makefile.am: Likewise.
8615         * tests/fmt/Makefile.am: Likewise.
8616         * tests/install/Makefile.am: Likewise.
8617         * tests/ln/Makefile.am: Likewise.
8618         * tests/ls/Makefile.am: Likewise.
8619         * tests/ls-2/Makefile.am: Likewise.
8620         * tests/md5sum/Makefile.am: Likewise.
8621         * tests/misc/Makefile.am: Likewise.
8622         * tests/mkdir/Makefile.am: Likewise.
8623         * tests/mv/Makefile.am: Likewise.
8624         * tests/od/Makefile.am: Likewise.
8625         * tests/rm/Makefile.am: Likewise.
8626         * tests/rmdir/Makefile.am: Likewise.
8627         * tests/seq/Makefile.am: Likewise.
8628         * tests/sha1sum/Makefile.am: Likewise.
8629         * tests/shred/Makefile.am: Likewise.
8630         * tests/stty/Makefile.am: Likewise.
8631         * tests/sum/Makefile.am: Likewise.
8632         * tests/tail-2/Makefile.am: Likewise.
8633         * tests/touch/Makefile.am: Likewise.
8634         * tests/tsort/Makefile.am: Likewise.
8635         * tests/unexpand/Makefile.am: Likewise.
8636
8637 2003-01-31  Jim Meyering  <jim@meyering.net>
8638
8639         * src/stat.c: Include "file-type.h"
8640         (print_human_type): Remove function.
8641         (human_access): Rename from print_human_access.  Return a string.
8642         (human_time): Rename from print_human_time.  Return a string.
8643         (print_stat): Arrange so that field width and an alignment specifier
8644         are honored for the %A, %F, %x, %y, and %z formats.
8645         [%F]: Use file_type; this gives slightly different file type strings,
8646         e.g., `directory' instead of `Directory' and `regular file' or
8647         `regular empty file' instead of `Regular file'.
8648         Prompted by a report from Richard Dawe that the uses of
8649         S_IFSOCK and S_IFIFO in print_human_time were not portable
8650         to systems using e.g., DJGPP.
8651
8652 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8653
8654         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8655         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
8656
8657 2003-01-31  Jim Meyering  <jim@meyering.net>
8658
8659         * src/du.c (main): Upon processing an invalid option or an invalid
8660         --exclude-from or --max-depth option argument, don't exit right away,
8661         in case there are others.  Rather record the failure and exit after
8662         processing other options.
8663
8664         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8665         tar archive easier to reproduce.
8666
8667         Rewrite to perform directory traversal using nftw.
8668
8669         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8670         (AUTHORS): Add self.
8671         (opt_one_file_system): Move global into `main'.
8672         (path, xstat, exit_status): Remove declarations.
8673         (arg_length, suffix_length): New globals.
8674         (G_fail): New global, sort of like the old `exit_status'.
8675         (IS_FTW_DIR_TYPE): Define.
8676         (print_only_size): New function.
8677         (process_file): New function.
8678         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8679         (str_trunc, pop_dir, count_entry): Likewise.
8680         (du_files): Rewrite to use nftw.
8681
8682 2003-01-30  Jim Meyering  <jim@meyering.net>
8683
8684         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8685         symlink-to-directory with -L, even without the trailing slash.
8686
8687 2003-01-27  Jim Meyering  <jim@meyering.net>
8688
8689         * src/Makefile.am (check-misc): Check for st_blocks, too.
8690
8691         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8692         Reported by Richard Dawe.
8693
8694 2003-01-27  Andreas Schwab  <schwab@suse.de>
8695
8696         * src/ls.c (quote_name): Add fourth parameter, width, into which to
8697         store the screen columns, and return the number of bytes instead.
8698         (print_dir): Pass NULL as fourth parameter of quote_name.
8699         (print_name_with_quoting): Likewise.
8700         (length_of_file_name_and_frills): Get the width from the fourth
8701         parameter of quote_name instead of return value.
8702
8703 2003-01-27  Jim Meyering  <jim@meyering.net>
8704
8705         * src/ls.c (decode_switches): If `dired' is set without
8706         `format == long_format', then silently reset dired.  This doesn't
8707         change the behavior of ls (all prior uses of dired were protected
8708         by `&& format == long_format'), and lets us...
8709         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8710         (PUSH_CURRENT_DIRED_POS): Likewise.
8711         (main): Likewise.
8712
8713 2003-01-22  Jim Meyering  <jim@meyering.net>
8714
8715         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8716         * tests/du/Makefile.am (TESTS): Add no-x.
8717
8718 2003-01-21  Jim Meyering  <jim@meyering.net>
8719
8720         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8721         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8722         it may still be a directory -- or not (e.g., with FreeBSD on an
8723         NFS-mounted file system), so resort to calling lstat to find out.
8724         Based on a patch by Michael van Elst.
8725
8726         * tests/cp/same-file: Don't assume that the file owner username
8727         length is less than 9 in ls output: instead, omit that field
8728         altogether.  Reported by, and suggested fix from, Ferdinand.
8729
8730 2003-01-20  Jim Meyering  <jim@meyering.net>
8731
8732         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8733         large format widths no longer cause strftime to infloop.
8734
8735         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8736
8737 2003-01-19  Jim Meyering  <jim@meyering.net>
8738
8739         * src/readlink.c: Include "canonicalize.h".
8740
8741 2003-01-18  Jim Meyering  <jim@meyering.net>
8742
8743         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8744         New member.
8745         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8746         (long_options): Add option --dereference-command-line-symlink-to-dir.
8747         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8748         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8749         -d, -F, -l options is specified.
8750         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8751         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8752         Change --dereference-command-line (-H) to dereference *all*
8753         command line arguments, including broken symlinks.
8754
8755 2003-01-15  Paul Eggert  <eggert@twinsun.com>
8756
8757         Change ls -H back to the way it was yesterday, since this is
8758         compatible with FreeBSD and the POSIX spec is confusing
8759         and somewhat contradictory.
8760
8761         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8762         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8763         (long_options): Change the long option name back.
8764         (usage): Change the usage back.
8765         (gobble_file): When -H is specified, dereference a top-level
8766         arg even if it points to a non-directory.
8767
8768 2003-01-15  Jim Meyering  <jim@meyering.net>
8769
8770         * src/ls.c (gobble_file): Fall back on using lstat when required:
8771         when --dereference (-L) is not specified, and
8772         - when operating on a dangling symlink
8773         - when operating on command-line-symlink-to-directories
8774         This fixes numerous problems.  Here are examples:
8775         - `ls dangling-symlink' would fail with `no such file...'
8776         Now it prints `dangling-symlink'.
8777         - `ls -i symlink' would mistakenly print the inode of the referent.
8778         Now it prints the inode of the symlink.  Likewise for --size (-s).
8779         Based on a patch from Michael Stone.
8780         Reported by Deepak Goel as Debian bug #173793.
8781
8782         Rename ls's --dereference-command-line (-H)
8783         option to   --dereference-command-line-symlink-to-dir.
8784         * src/ls.c [enum Dereference_symlink]
8785         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8786         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
8787         (long_options): Rename the long option.
8788         (usage): Say that --dereference-... changes how ls treats
8789         only symlinks to directories specified on the command line.
8790
8791 2003-01-14  Jim Meyering  <jim@meyering.net>
8792
8793         * tests/ls/dangle: New file/test, for the above fix.
8794         * tests/ls/inode: Another new file/test, for the above fix.
8795         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8796
8797         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8798         so that ls --color would no longer highlight the names of files with
8799         the execute bit set when not specified on the command line.
8800         Patch by Michael Stone.  Reported by Stephen Depooter as
8801         Debian bug 175135.
8802
8803         * tests/ls-2/tests (color-exe): New test, for the above fix.
8804
8805 2003-01-13  Jim Meyering  <jim@meyering.net>
8806
8807         * tests/shred/exact: Also test for just fixed bug with --zero.
8808
8809         * src/shred.c (long_opts): --zero does not require an argument.
8810         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
8811
8812 2003-01-12  Jim Meyering  <jim@meyering.net>
8813
8814         * Makefile.maint (cvs-update): Skip any file with local modifications.
8815
8816         * src/unexpand.c (usage): Document --first-only and mention that
8817         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
8818
8819 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
8820
8821         * src/df.c: Include "canonicalize.h".
8822         Use canonicalize_file_name unconditionally.
8823
8824 2003-01-09  Jim Meyering  <jim@meyering.net>
8825
8826         * README: Add readlink.
8827
8828 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8829
8830         * src/df.c: Include "xgetcwd.h".
8831         * src/pwd.c: Likewise.
8832
8833 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
8834
8835         * src/shred.c: Remove declaration of xstrdup.
8836         We already get it via xalloc.h which is included via system.h.
8837
8838 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
8839
8840         New program: readlink.
8841
8842         * src/Makefile.am (bin_PROGRAMS): Add readlink.
8843         * src/readlink.c: New file.
8844
8845         * man/readlink.x: New file.
8846         * man/Makefile.am (dist_man_MANS): Add readlink.1.
8847         (readlink.1): New rule.
8848
8849 2003-01-09  Jim Meyering  <jim@meyering.net>
8850
8851         When selecting ranges of byte offsets (as opposed to ranges of fields)
8852         and when --output-delimiter=STRING is specified, output STRING between
8853         ranges of selected bytes.
8854         * src/cut.c (RANGE_START_SENTINEL): Define.
8855         (output_delimiter_specified): New global.
8856         (print_kth): Add parameter.  Adjust all callers.
8857         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8858         (cut_bytes): When requested, output STRING between ranges of
8859         selected bytes.
8860         (main): Make a diagnostic a little clearer.
8861         Based on a patch from Jan Nieuwenhuizen.
8862
8863         * tests/cut/Test.pm: New tests for the above.
8864
8865         * src/cut.c (set_fields): Make code agree with comment:
8866         Don't merge abutting ranges like 4- and 2-3.  This makes no
8867         difference currently, but is required to support an upcoming change.
8868
8869 2003-01-07  Jim Meyering  <jim@meyering.net>
8870
8871         * src/cut.c (set_fields): Fix typo in comment.
8872
8873         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8874         * tests/touch/Makefile.am (TESTS): Add not-owner.
8875         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8876         Now, this tests only the nonexistent-directory diagnostic.
8877         Suggestion from Michael Stone.
8878
8879         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8880
8881 2003-01-04  Jim Meyering  <jim@meyering.net>
8882
8883         * src/copy.h: Remove use of PARAMS.
8884         * src/remove.h: Likewise.
8885         * src/chown-core.h: Likewise.
8886
8887         rm could be tricked into mistakenly reporting a cycle.
8888         * src/remove.c: [cycle_check_state]: New global.
8889         (remove_cwd_entries): Adapt to new semantics of cycle_check.
8890         (rm): Call cycle_check_init and cycle_check_free for each file.
8891         * tests/rm/cycle (rm): New test, for the above fix.
8892         * tests/rm/Makefile.am (TESTS): Add cycle.
8893
8894         When rm detects a cycle, don't abort the entire command,
8895         but rather just the affected command line argument.
8896         * src/remove.c: Include <setjmp.h>
8897         (struct dirstack_state) [current_arg_jumpbuf]: New member.
8898         (remove_cwd_entries): Call longjmp if we detect a cycle.
8899         (rm): Call setjmp here.
8900
8901         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8902         Instead, include cycle-check.h and use it.
8903
8904         * src/remove.h (struct dev_ino): Remove declaration.
8905
8906         * src/remove.c (remove_cwd_entries): Fix typos in comment.
8907
8908         Don't include trailing /. in diagnostics about directories.
8909         * src/remove.c (full_filename_): When FILENAME is just `.'
8910         and there is a nonempty directory-name part, don't append `/.'.
8911         * tests/rm/unread2: Remove trailing /. from diagnostic.
8912         * tests/rm/rm2: Likewise.
8913
8914         * src/remove.c (struct dirstack_state): Define.
8915         To be used in place of these file-scoped globals ...
8916         (dir_stack, len_stack, Active_dir): Remove globals.
8917         (ds_init, ds_free): New functions.
8918         (full_filename): Define.
8919         (full_filename_): Rename from full_filename.
8920
8921         Begin to make AD_* functions more generic.
8922         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8923         (AD_push): Likewise.
8924         (AD_INIT_OTHER_MEMBERS): Define.
8925         (remove_dir): Define the `status' member manually after each
8926         call to AD_push or AD_push_initial.
8927
8928         * src/Makefile.am (check-misc): New rule, to ensure that no more
8929         S_IS* macro definitions sneak into the code.
8930         (check): Depend on check-misc.
8931
8932         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
8933         * src/du.c (count_entry) [S_ISLNK]: Don't define.
8934         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
8935
8936 2003-01-03  Jim Meyering  <jim@meyering.net>
8937
8938         * src/true.c: Add copyright.
8939         (AUTHORS): I suppose I've written it.
8940
8941         * src/Makefile.am (false.c): Make the generated file be read-only.
8942
8943 2003-01-04  Jim Meyering  <jim@meyering.net>
8944
8945         * src/ls.c: Include "dev-ino.h".
8946         [struct dev_ino]: Remove declaration.
8947
8948 2003-01-02  Jim Meyering  <jim@meyering.net>
8949
8950         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
8951         from mv: s/missing file arguments/missing file argument/.
8952         With --target-directory=DIR, cp and mv work with a single file argument.
8953         Reported by Karl Berry.
8954
8955         * tests/rm/isatty: Enable this test.
8956
8957 2002-12-31  Jim Meyering  <jim@meyering.net>
8958
8959         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8960         (AD_push): Likewise.
8961         (AD_INIT_OTHER_MEMBERS): Define.
8962         (remove_dir): Define the `status' member manually after each
8963         call to AD_push or AD_push_initial.
8964
8965         * src/ls.c [struct dev_ino]: Remove definition.
8966         Include "dev-ino.h" instead.
8967
8968 2002-12-28  Jim Meyering  <jim@meyering.net>
8969
8970         * tests/du/Makefile.am (TESTS): Add no-deref.
8971         * tests/du/no-deref: New script.
8972
8973 2002-12-23  Jim Meyering  <jim@meyering.net>
8974
8975         * src/remove.c (remove_cwd_entries): Fix typo in comment.
8976
8977 2002-12-21  Jim Meyering  <jim@meyering.net>
8978
8979         * announce-gen: Generate MML-formatted announcement.
8980         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
8981
8982 2002-12-20  Jim Meyering  <jim@meyering.net>
8983
8984         * src/touch.c (touch): Change the wording of a diagnostic so
8985         that it makes sense both when the file exists and when it doesn't.
8986         Suggestion from Michael Stone.
8987
8988 2002-12-18  Jim Meyering  <jim@meyering.net>
8989
8990         * src/stty.c (valid_options): Declare to be static.
8991
8992 2002-12-15  Jim Meyering  <jim@meyering.net>
8993
8994         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
8995
8996         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
8997         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
8998         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
8999         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9000         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9001
9002         * src/remove.c (PARAMS): Remove definition.
9003         * src/sys2.h: Likewise.
9004
9005         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9006         Include strftime.h instead.
9007
9008 2002-12-14  Jim Meyering  <jim@meyering.net>
9009
9010         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9011
9012         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9013         This is necessary at least for Irix6.5 when using c89.
9014         Reported by Nelson Beebe.
9015
9016         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9017
9018         * tests/misc/cat-tty-eof: New test.
9019
9020         * src/mknod.c (usage): Specify how major and minor mode numbers
9021         are interpreted.  Report forwarded by Kristin E Thomas.
9022         * src/mknod.c: Remove now-redundant usage-specifying comment.
9023
9024 2002-12-13  Jim Meyering  <jim@meyering.net>
9025
9026         * Version 4.5.4.
9027
9028         * tests/du/trailing-slash: Allow for a directory of size `0'.
9029         That happens at least on file systems of type tmpfs on linux-2.4.18.
9030
9031         * announce-gen: New script to begin replacing the commands
9032         associated with the rule here...
9033         * Makefile.maint (announcement): Invoke announce-gen.
9034         * Makefile.am (EXTRA_DIST): Add announce-gen.
9035
9036         * tests/cp/preserve-2: New file/test, for latest fix.
9037         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9038
9039 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9040
9041         Fix a bug whereby cp would fail to parse an option like
9042         --preserve=mode,ownership.
9043         * src/cp.c (decode_preserve_arg): Advance `comma' to
9044         point the character following the comma.
9045
9046 2002-12-11  Jim Meyering  <jim@meyering.net>
9047
9048         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9049         in case it's already defined.
9050
9051 2002-12-09  Jim Meyering  <jim@meyering.net>
9052
9053         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9054         Instead, evoke a framework failure if /no-$$ exists.
9055         Reported by Michael Stone.
9056
9057 2002-12-08  Jim Meyering  <jim@meyering.net>
9058
9059         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9060         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9061         du honors (per POSIX) the trailing slash on an argument referring
9062         to a symlink-to-directory.
9063
9064 2002-12-06  Jim Meyering  <jim@meyering.net>
9065
9066         * Use autoconf-2.57.  Regenerate dependent files.
9067         * Use automake-1.7.2.  Regenerate dependent files.
9068
9069         * src/ls.c (gobble_file): Also stat the file if it's a
9070         regular file and --indicator-style=classify (aka -F).
9071         Thanks to Ed Santiago for opening my eyes.
9072
9073         * tests/ls/file-type: New file.  Test for the above.
9074         A test to contrast ls -F and ls --indicator-style=file-type.
9075         * tests/ls/Makefile.am (TESTS): Add file-type.
9076
9077 2002-12-04  Jim Meyering  <jim@meyering.net>
9078
9079         * tests/ls/follow-slink: Make sure the symlink was created.
9080         Richard Dawe reported that `ln -s link link' succeeds, but creates
9081         no file on systems running some version of the DJGPP libc.
9082
9083 2002-12-03  Jim Meyering  <jim@meyering.net>
9084
9085         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9086         since this package no longer panders to K&R compilers.
9087
9088 2002-12-02  Jim Meyering  <jim@meyering.net>
9089
9090         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9091
9092         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9093         something to replace.
9094
9095 2002-12-01  Jim Meyering  <jim@meyering.net>
9096
9097         * src/stat.c: Don't include <string.h> or <ctype.h>.
9098         That's already done via system.h.
9099         * src/dircolors.c: Don't include <ctype.h>.
9100
9101 2002-11-30  Jim Meyering  <jim@meyering.net>
9102
9103         * ls.c (gobble_file): Remove the block of code that caused
9104         `ls --color -F symlink-to-dir' to list the files in
9105         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9106         like `ls -F symlink-to-dir') but with the addition of highlighting.
9107         Similarly, `ls --color -dF symlink-to-dir' would print
9108         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9109         Reported by Jeff Sheinberg as Debian bug #168203.
9110         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9111
9112         ls is now more efficient: with certain options, it no longer needs
9113         to stat each directory entry on systems with valid dirent.d_type.
9114         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9115         (main): Make --recursive set format_needs_type, not format_needs_stat.
9116         (gobble_file): Remove a FIXME comment, now that it's fixed.
9117
9118 2002-11-24  Jim Meyering  <jim@meyering.net>
9119
9120         * src/du.c (du_files): Don't strip any trailing slash.
9121         Rewrite so that `/' is no longer represented internally as
9122         the empty string.
9123         (count_entry): When appending a file name component,
9124         account for the fact that the current path may end in `/'.
9125         François Pinard reported that `du symlink-to-dir/' was not
9126         equivalent to `du symlink-to-dir/.'.  Now it is.
9127         * tests/du/trailing-slash: New file/test, for the above fix.
9128         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9129
9130 2002-11-23  Jim Meyering  <jim@meyering.net>
9131
9132         * src/tac.c (output): Declare some local variables to be of type size_t,
9133         rather than `int' to avoid warnings from gcc.
9134
9135 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9136
9137         * src/ls.c (decode_switches): Use case-sensitive matching to
9138         decode the QUOTING_STYLE environment variable.  This is more
9139         consistent with the documentation, and with --quoting-style.
9140
9141 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9142
9143         * src/stty.c (struct speeds): Add support for all baud rates defined
9144         in linux-2.4.19.
9145
9146 2002-11-19  Jim Meyering  <jim@meyering.net>
9147
9148         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9149         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9150         * tests/fmt/basic: Likewise.
9151
9152 2002-11-17  Jim Meyering  <jim@meyering.net>
9153
9154         * configure.ac: Update via autoupdate.
9155         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9156
9157         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9158         Reported by Hans Ginzel.
9159
9160 2002-11-15  Jim Meyering  <jim@meyering.net>
9161
9162         * Makefile.cfg (gnu_rel_host): Define.
9163         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9164         on whether $(VERSION) looks like a major release number.
9165
9166         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9167         (release): Rename from `alpha'.
9168         (alpha): Depend on release.
9169
9170         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9171
9172 2002-11-14  Jim Meyering  <jim@meyering.net>
9173
9174         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9175         (announcement): Use the new variable.
9176
9177         * Makefile.maint: Sync with Bison, i.e.:
9178         (po-check): Scan .l and .y files instead of the
9179         .c and the .h files that they generate.  This fixes the bug
9180         reported by Tim Van Holder in:
9181         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9182         Look for N_ as well as for _.  Try to avoid matching #define for
9183         N_ and _.
9184         From Paul Eggert.
9185
9186 2002-11-12  Jim Meyering  <jim@meyering.net>
9187
9188         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9189         Replace sole use with equivalent `#ifdef S_ISLNK'.
9190         Inconsistency reported by Dmitry V. Levin.
9191
9192 2002-11-11  Jim Meyering  <jim@meyering.net>
9193
9194         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9195         so that help2man produces properly formatted man pages.
9196         Reported by Herbert Xu as Debian bug #168400.
9197
9198 2002-11-10  Jim Meyering  <jim@meyering.net>
9199
9200         * src/ls.c (sighandler): Handle SIGTSTP specially.
9201         Based on suggestions from Solar Designer and Dmitry V. Levin.
9202         Add comments.
9203
9204         * Makefile.cfg (cvs_files): Define.  From autoconf.
9205         (local_updates): Likewise.
9206
9207         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9208         Remove functions.
9209         (sighandler): New function, based on the one in sort.c.
9210         (main): Use sigaction, if possible; otherwise signal.
9211         Handle these signals:
9212         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9213         Don't register our handler if the signal is already being ignored.
9214
9215         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9216         * src/csplit.c (interrupt_handler): Likewise.
9217         * src/sort.c (sighandler): Likewise.
9218         (main): Declare `i' and `nsigs' to be unsigned, not int.
9219
9220 2002-11-09  Jim Meyering  <jim@meyering.net>
9221
9222         ls --color: restore terminal text color upon signal.
9223         * src/ls.c: Include "full-write.h" and <signal.h>.
9224         (restore_default_color, restore_default_color_handler): New functions.
9225         (sigtstp_handler, put_indicator_direct): New functions.
9226         (main) [print_with_color]: Register signal handlers.
9227         Patch mostly by Solar Designer and Stanislav Ievlev.
9228
9229         Update from autoconf.
9230         * Makefile.maint (AMTAR): Remove definition.
9231         (update, cvs-update, po-update, do-po-update): New rules.
9232         (wget-update): Update (thus renaming to cvs-update).
9233         (automake_repo): Use anoncvs@sources.redhat.com.
9234
9235 2002-11-06  Jim Meyering  <jim@meyering.net>
9236
9237         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9238
9239         * tests/misc/printf: Be careful to test the code in this package,
9240         not the shell built-in function.
9241
9242         * src/printf.c (print_esc): A hexadecimal escape sequence has
9243         at most two hex. digits, not three.  Reported by Padraig Brady.
9244         (usage): Update description.
9245         * tests/misc/printf-hex: New file/test, for the above fix.
9246
9247 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9248
9249         Add support for locale-specific size indications (e.g.,
9250         thousands-separators) and for explicit size suffixes on output.
9251
9252         * doc/coreutils.texi (Block size): Say that:
9253         This affects display format as well as block size.
9254         Fractional block counts are rounded up.
9255         ls file size blocksize defaults to 1.
9256         A block size spec preceded by ' generates thousands separators.
9257         A suffix without a preceding integer generates suffixes.
9258         (tail invocation): 32k -> 32 KiB.
9259         (What information is listed): ls -h is now equivalent to
9260         ls --block-size=human, and ls -H is now equivalent to
9261         ls --block-size=si.  Displayed file size is now always affected by
9262         --block-size.
9263
9264         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9265         lib/umaxtostr.c: New files, taken from GNU tar.
9266
9267         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9268         umaxtostr.c.
9269         (EXTRA_DIST): Add inttostr.c.
9270
9271         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9272         notations like thousands separators.
9273         Specify what includer of include.h must include beforehand.
9274         (human_group_digits, human_suppress_point_zero, human_autoscale,
9275         human_base_1024, human_SI, human_B): New enum values.
9276         (human_readable): Rename from human_readable_inexact; put the
9277         options before the sizes.  All uses changed.  The old human_readable
9278         function has been removed; use inttostr.h instead.
9279         (human_options): Renamed from human_block_size, with new signature
9280         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9281
9282         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9283         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9284         freestanding C89.  No need to check for stdlib.h or string.h since
9285         autoconf does this now.
9286
9287         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9288         human.h, to print large numbers simply.
9289         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9290         * src/dd.c (print_stats, main): Likewise.
9291         * src/df.c (print_header): Likewise.
9292         * src/factor.c (print_factors): Likewise.
9293         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9294         * src/shred.c (dopass): Likewise.
9295         * src/sort.c (checkfp): Likewise.
9296         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9297         * src/tail.c (xlseek): Likewise.
9298         * src/wc.c (write_counts, wc): Likewise.
9299
9300         * src/df.c (human_output_opts): New var.
9301         (output_block_size): Now uintmax_t, not int, to handle larger
9302         block sizes.  All uses changed.
9303         * src/du.c: Likewise.
9304         * src/ls.c: Likewise.
9305
9306         * src/df.c (print_header): In the header line, prefer SI to human
9307         representation if it's shorter; if neither is shorter, try to
9308         intuit what the user would prefer.
9309
9310         * src/expr.c (inttostr): Remove; use new imaxtostr library
9311         function instead.
9312
9313         * src/ls.c (file_output_block_size): New var, to distinguish
9314         file sizes from other sizes.
9315         (decode_switches): Set it.
9316
9317         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9318         (dopass): When printing progress, use floor for what has been done
9319         so far (since we should be conservative there), and ceiling for
9320         what needs to be done (since that's what other programs use).
9321
9322 2002-10-19  Jim Meyering  <jim@meyering.net>
9323
9324         * src/pinky.c (print_heading): Align TTY and Name headings.
9325         Reported by Karl Eichwalder.
9326
9327 2002-10-18  Jim Meyering  <jim@meyering.net>
9328
9329         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9330         Remove now-useless cast.
9331         (stdread): Remove function.
9332         (bytes_split): Use size_t instead of int.
9333         Use safe_read, not stdread.
9334         (lines_split): Likewise.
9335         Use memchr rather than a `while' loop.
9336         (line_bytes_split): Use size_t instead of int.
9337         Use safe_read, not stdread.
9338         (main): Add some FIXME comments to remind me to remove casts.
9339
9340         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9341         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9342
9343 2002-10-17  Jim Meyering  <jim@meyering.net>
9344
9345         Fix a problem that could make e.g., `cat' misbehave on systems which
9346         give invalid (unreasonably large) values for stat.st_blksize.
9347         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9348         Reported by Petter Reinholdtsen.
9349
9350 2002-10-14  Jim Meyering  <jim@meyering.net>
9351
9352         Specifying a printf conversion specifer as nl's separator string
9353         could cause nl to segfault.
9354         * src/nl.c (build_print_fmt): Don't include separator string
9355         in the printf format; it might contain `%'.
9356         Use a better bound on the length of the print_fmt buffer.
9357         (print_lineno): Print the separator here instead.
9358         Reported by Doug Coleman.
9359
9360         * tests/misc/nl: New file/tests, including a test for the above.
9361         * tests/misc/Makefile.am (TESTS): Add nl.
9362
9363         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9364         * tests/misc/Makefile.am (TESTS): Add split-l.
9365
9366 2002-10-13  Jim Meyering  <jim@meyering.net>
9367
9368         * Version 4.5.3.
9369
9370         * src/du.c (usage): Tweak description of --dereference-args/-D.
9371
9372         * src/du.c (count_entry): Also save cwd when dereferencing (via
9373         --dereference-args, -D) a command-line argument.
9374         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9375
9376         * src/Makefile.am (../AUTHORS): New target/rule.
9377
9378 2002-10-12  Jim Meyering  <jim@meyering.net>
9379
9380         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9381         of type size_t, since that's the way it's used and avoids a warning.
9382
9383         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9384         since that's how it's always used and avoids a new warning from gcc.
9385         (read_input): Adapt to new safe_read ABI.
9386
9387         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9388         to avoid warnings.
9389
9390         * src/pinky.c (print_long_entry): fread returns size_t.
9391         Declare local `bytes' accordingly, to avoid warning.
9392
9393         tail -c +N would perform an extra read after encountering EOF
9394         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9395         * src/tail.c (start_bytes): Detect EOF, inform caller.
9396         (tail_bytes): Upon EOF in start_bytes, return immediately.
9397         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9398         Adapt to new safe_read ABI.
9399
9400 2002-10-11  Jim Meyering  <jim@meyering.net>
9401
9402         * tests/du/deref: New file/test, for the above fix.
9403         * tests/du/Makefile.am (TESTS): Add deref.
9404
9405 2002-10-10  Jim Meyering  <jim@meyering.net>
9406
9407         * tests/ln/Makefile.am (TESTS): Add target-1.
9408         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9409
9410 2002-10-09  Jim Meyering  <jim@meyering.net>
9411
9412         * tests/cp/backup-is-src: Ensure that certain environment variables
9413         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9414
9415         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9416         consume 4GB of disk space on systems without support for sparse files.
9417         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9418
9419         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9420         Patch by steven@magelico.net, forwarded by Michael Stone.
9421
9422         * tests/ls/dired: Ensure that ls produces English messages.
9423         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9424
9425 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9426
9427         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9428
9429 2002-10-08  Jim Meyering  <jim@meyering.net>
9430
9431         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9432         Fix syntax in test: use =, not ==.
9433         Reported by Bob Proulx.
9434         Change all the rest like this: grep -lR "testing framework'" .\
9435         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9436
9437         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9438         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9439         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9440         * src/wc.c (wc): Likewise.
9441
9442 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9443
9444         * src/cat.c (cat):
9445         Don't advance the write pointer past the end of the write buffer.
9446         * src/sort.c (begfield, limfield): Likewise.
9447
9448 2002-10-07  Jim Meyering  <jim@meyering.net>
9449
9450         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9451         * src/head.c (head_bytes, head_lines): Likewise.
9452
9453 2002-10-06  Jim Meyering  <jim@meyering.net>
9454
9455         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9456         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9457         (skip, dd_copy): Adapt to new safe_read ABI.
9458
9459         * Makefile.maint (signatures): Define.
9460         (%.sig): New rule.
9461         (announcement): Depend on $(signatures).
9462
9463         * Makefile.maint (announcement): Output all URLs for detached
9464         signatures, not just the last one from the previous loop.
9465
9466 2002-10-05  Jim Meyering  <jim@meyering.net>
9467
9468         * Version 4.5.2.
9469
9470         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9471         don't recurse into directory, DIR.  Prompted by a report from
9472         Leonardo Milano.
9473
9474         * tests/rm/i-no-r: New file/test, for the above fix.
9475         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9476
9477         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9478         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9479
9480 2002-10-03  Jim Meyering  <jim@meyering.net>
9481
9482         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9483         * src/df.c (AUTHORS): Likewise.
9484         * src/du.c (AUTHORS): Likewise.
9485         * src/tail.c (AUTHORS): Likewise.
9486         * src/touch.c (AUTHORS): Likewise.
9487
9488 2002-10-02  Jim Meyering  <jim@meyering.net>
9489
9490         * Makefile.am (SUBDIRS): Remove `old'.
9491         (EXTRA_DIST): List the files in old/.
9492         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9493         Suggestion from Akim Demaille.
9494
9495 2002-10-01  Jim Meyering  <jim@meyering.net>
9496
9497         * src/sys2.h (SSIZE_MAX): Define.
9498
9499 2002-09-30  Jim Meyering  <jim@meyering.net>
9500
9501         * src/csplit.c: Don't include stdlib.h here.  It's already included
9502         via system.h.
9503
9504 2002-09-29  Jim Meyering  <jim@meyering.net>
9505
9506         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9507         expression to avoid bogus warning from gcc.
9508
9509         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9510         (cat): Declare insize and outsize to be of type size_t, not int.
9511         Rearrange pointer/integer expressions to avoid bogus warnings.
9512         (main): Declare insize and outsize to be of type size_t, not int.
9513
9514         * src/tail.c (parse_options): Give a sensible diagnostic for
9515         an invalid byte or line count.  Reported by Mikko Tuumanen.
9516
9517         * src/touch.c (main): Split a long line.
9518
9519         * tests/du/Makefile.am (TESTS): Add slink.
9520         * tests/du/slink: New test for system.h change of 2002-08-31.
9521
9522         In move mode, always first try to rename.  Before, upon failure to
9523         rename a directory, this code would never attempt to rename any
9524         other file in that directory, but would thenceforth always copy.
9525         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9526         may fail with EXDEV, yet renaming files within that directory to
9527         a newly-created destination directory succeeds.
9528         * src/copy.c (copy_internal): Remove local, move_mode;
9529         use x->move_mode instead.  Based on a patch from Tom Haynes.
9530
9531 2002-09-28  Jim Meyering  <jim@meyering.net>
9532
9533         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9534         Factor out some duplication.
9535         (main): Use it.
9536         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9537
9538         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9539         compiler warnings.
9540         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9541         to avoid compiler warnings.
9542
9543         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9544         compiler warnings.
9545
9546         Fix things so `mkdir -p' can create very deep directories, e.g.,
9547         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9548         * src/mkdir.c (main): For --parents (-p), call make_path with the
9549         entire directory name, so we don't ever require that file operations
9550         like stat or chmod be performed on the entire command line argument.
9551         * makepath.c (make_path): Restore umask *before* creating the final
9552         component.
9553
9554 2002-09-27  Andreas Schwab  <schwab@suse.de>
9555
9556         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9557         to avoid overflow.  Reported by Hans Lermen.
9558
9559 2002-09-26  Jim Meyering  <jim@meyering.net>
9560
9561         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9562
9563 2002-09-25  Jim Meyering  <jim@meyering.net>
9564
9565         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9566         and add a cast, to avoid a warning about `signed and unsigned type in
9567         conditional expression'.
9568
9569 2002-09-22  Jim Meyering  <jim@meyering.net>
9570
9571         * src/rmdir.c: Include "dirname.h", for declaration of
9572         strip_trailing_slashes.
9573
9574         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9575         Now they're defined through system.h.
9576
9577         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9578         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9579         since it's already included from sys2.h via system.h.
9580
9581         * Use automake-1.6f.  Regenerate dependent files.
9582
9583         * src/Makefile.am (PERL): Remove duplicate definition.
9584
9585         fmt's -s, -t, -c options didn't work properly for long lines.
9586         Since get_line may end up calling put_paragraph (for long lines),
9587         be sure to set global, `other_indent', before it is used there.
9588
9589         * src/fmt.c (set_other_indent): New function, factored out of...
9590         (get_paragraph): ... here.  Call it.
9591         (get_line): Call set_other_indent before calling flush_paragraph,
9592         which calls fmt_paragraph, which in turn calls put_paragraph,
9593         which uses other_indent.
9594
9595         * tests/fmt/Makefile.am (TESTS): Add long-line.
9596         * tests/fmt/long-line: New file/test, for the above fix.
9597
9598 2002-09-21  Jim Meyering  <jim@meyering.net>
9599
9600         * src/od.c: No longer include deprecated <values.h>.
9601         It was required solely for now-removed reference to BITSPERBYTE.
9602         * src/install.c: Likewise.
9603         Suggestion from Bruno Haible.
9604
9605 2002-09-06  Andreas Schwab  <schwab@suse.de>
9606
9607         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9608         * src/rmdir.c (remove_parents): Strip trailing slashes.
9609
9610 2002-09-20  Jim Meyering  <jim@meyering.net>
9611
9612         * tests/rmdir/t-slash: New file/test, for the above fix.
9613         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9614
9615         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9616         Add a URL for each detached signature file.
9617
9618 2002-09-07  Bruno Haible  <bruno@clisp.org>
9619
9620         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9621
9622 2002-09-18  Jim Meyering  <jim@meyering.net>
9623
9624         `od -t x8' used the wrong (`l'-prefixed) printf format.
9625         Likewise for the o8 and u8 formats.
9626         * src/od.c (ISPEC_TO_FORMAT): Define macro.
9627         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9628         Reported by Arun Sharma.
9629
9630 2002-09-17  Jim Meyering  <jim@meyering.net>
9631
9632         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9633         From gettext's intl/loadmsgcat.c.
9634
9635         * tests/od/x8: New file/test, for the above fix.
9636         * tests/od/Makefile.am (TESTS): Add x8.
9637
9638 2002-09-15  Jim Meyering  <jim@meyering.net>
9639
9640         * Use autoconf-2.54.  Regenerate dependent files.
9641
9642         * src/csplit.c (get_format_width): Add cast to avoid
9643         warning about `signed and unsigned type in conditional expression'.
9644
9645 2002-09-14  Jim Meyering  <jim@meyering.net>
9646
9647         * src/who.c (print_user): Change type of local to size_t
9648         to avoid warnings about `comparison between signed and unsigned'.
9649         * src/ptx.c (generate_all_output): Likewise.
9650
9651         * src/dd.c (main, skip): Add casts to avoid warnings about
9652         `comparison between signed and unsigned'.
9653
9654         * src/id.c (print_full_info, print_group_list): Add casts to avoid
9655         warnings about `signed and unsigned type in conditional expression'.
9656
9657         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9658         to avoid warnings about `comparison between signed and unsigned'.
9659         (split_3): Change parameter names to be readable and add comment.
9660         Clean up the test for whether a line may be ignored.
9661
9662 2002-09-13  Jim Meyering  <jim@meyering.net>
9663
9664         * src/printf.c (main): Handle leading command line argument of `--'.
9665         Reported by Raul: DervishD <raul@pleyades.net>
9666         * tests/misc/printf: New file: test for the above.
9667         * tests/misc/Makefile.am (TESTS): Add printf.
9668
9669         * src/date.c (usage): Explain that %S's range of [0..60] is required --
9670         rather than 0..59 -- to accommodate the occasional positive leap second.
9671         Reported by Richard Neill.
9672
9673 2002-09-12  Jim Meyering  <jim@meyering.net>
9674
9675         * src/Makefile.am (nanosec_libs): Define.
9676         (sleep_LDADD, tail_LDADD): Use it here.
9677
9678         Factor nanosleep-related code into ../lib/xnanosleep.c.
9679         * src/sleep.c: Include xnanosleep.h.
9680         Factor out fenv.h-related code.
9681         (timespec_subtract): Remove function.
9682         (main): Remove code that deals with computing start and stop times
9683         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
9684
9685         Allow S (in --sleep-interval=S) to be a floating point value.
9686         * src/tail.c: Include xnanosleep.h and xstrtod.h.
9687         Move declaration of global variable, sleep_interval, to ...
9688         (main): ...here.
9689         (usage): Update description of --sleep-interval option.
9690         (tail_forever): New parameter, sleep_interval.  Update caller.
9691         Use xnanosleep, rather than sleep.
9692         (parse_options): New parameter, sleep_interval.  Update caller.
9693         Use xstrtod, now that we accept floating point values.
9694         Prompted by a patch from Augey Mikus.
9695
9696 2002-09-06  Jim Meyering  <jim@meyering.net>
9697
9698         * src/remove.c (prompt): Change comment to give a better note to
9699         translators.  From Michael Piefel.
9700
9701 2002-09-02  Jim Meyering  <jim@meyering.net>
9702
9703         * README: A good problem report/patch includes diffs against
9704         the most recent test release.
9705
9706         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9707         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9708
9709         * src/kill.c (print_table_row): Use an unsigned type for widths
9710         to avoid warning about comparison between signed and unsigned.
9711         (list_signals): Likewise.
9712
9713         * src/od.c (skip): Add a cast to avoid warning about comparison
9714         between signed and unsigned.
9715         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
9716         comparisons to make them more readable.
9717
9718 2002-09-01  Jim Meyering  <jim@meyering.net>
9719
9720         * Version 4.5.1.
9721
9722 2002-08-31  Jim Meyering  <jim@meyering.net>
9723
9724         Symlinks were always reported as using 0 blocks.
9725         * src/system.h (ST_NBLOCKS): Don't depend on file type.
9726         This reverts the change of 2000-01-30.
9727         Based on a report and patch from Neil Brown via Michael Stone.
9728         This fixes Debian Bug#156358.
9729
9730         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9731         `exit (1)' to `exit (EXIT_FAILURE)', and
9732         `usage (1)' to `usage (EXIT_FAILURE)'.
9733
9734         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9735         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9736         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9737         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9738         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9739         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9740         error never exits successfully.
9741
9742 2002-08-29  Jim Meyering  <jim@meyering.net>
9743
9744         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9745         when ignoring any return value.
9746
9747         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9748         failures.  On some systems (at least EMC Celerra and Solaris5.8),
9749         this appears to be necessary.
9750         (is_empty_dir): Likewise.  Also, always close directory handle.
9751         * src/ls.c (print_dir): Likewise.
9752         (print_dir): Rename local variable: reading -> dirp.
9753         Reported by Mike Coleman.
9754
9755 2002-08-28  Jim Meyering  <jim@meyering.net>
9756
9757         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9758         Give a diagnostic and fail if closedir fails.
9759
9760 2002-08-26  Jim Meyering  <jim@meyering.net>
9761
9762         * Makefile.am (THANKS-to-translators): New rule.
9763         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9764         * THANKStt.in: New file.
9765
9766         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9767         file-scoped global.
9768         (main): Register it with atexit.
9769         Close STDOUT_FILENO, to avoid a problem when writing to
9770         /dev/audio on at least Solaris 5.7 and 5.8 systems.
9771         Reported by Shing-Shong Shei.
9772
9773 2002-08-25  Jim Meyering  <jim@meyering.net>
9774
9775         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9776         * src/tac.c (main): Likewise.
9777         * src/tail.c (main): Likewise.
9778         * src/tee.c (main): Likewise.
9779         * src/tr.c (main): Likewise.
9780         * src/wc.c (main): Likewise.
9781
9782 2002-08-20  Jim Meyering  <jim@meyering.net>
9783
9784         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9785
9786 2002-08-10  Paul Eggert  <eggert@twinsun.com>
9787
9788         * src/nohup.sh: Don't use "exec --"; it's not portable and
9789         shouldn't be needed.
9790
9791 2002-08-09  Jim Meyering  <jim@meyering.net>
9792
9793         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9794         (usage): Clarify help text for the -COLUMN option.
9795         Patch by Padraig Brady.
9796         * tests/pr/Test.pm [col-last]: New test for the above.
9797
9798         * configure.ac: Start with version 4.5.1, chosen so that it's larger
9799         than the latest version numbers of the component packages.
9800
9801         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9802         programs in ../src.
9803
9804 2002-08-08  Jim Meyering  <jim@meyering.net>
9805
9806         * src/date.c: Guard inclusion of <langinfo.h> with
9807         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9808         * src/sort.c: Likewise.
9809         Patch by GOTO Masanori.
9810
9811 2002-08-05  Paul Eggert  <eggert@twinsun.com>
9812
9813         Fix some minor time-related bugs with POSIX time arguments.
9814         Some valid time stamps were being rejected (notably -1, and
9815         time stamps before 1900 on 64-bit hosts).  And some invalid
9816         time stamps were being accepted, e.g. September 31.
9817
9818         * src/date.c (main): Adjust to posixtime signature change.
9819         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
9820         Use localtime, not posixtm, to warn about obsolete "touch".
9821
9822 2002-08-05  Jim Meyering  <jim@meyering.net>
9823
9824         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9825
9826 2002-08-04  Jim Meyering  <jim@meyering.net>
9827
9828         * src/Makefile.am (check-README): New target/rule.
9829         (check): Depend on it.
9830
9831         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9832
9833 2002-08-03  Jim Meyering  <jim@meyering.net>
9834
9835         * Makefile.am (SUBDIRS): Add old.
9836         * old/: New directory, containing legacy ChangeLog* and NEWS files
9837         from the fileutils, sh-utils, and textutils packages.
9838
9839         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9840
9841 2002-08-02  Paul Eggert  <eggert@twinsun.com>
9842
9843         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9844
9845         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9846         (hard_LC_COLLATE): New var.
9847         (different): Args are now char *, not const char *.
9848         Use xmemcoll instead of memcmp to compare lines, so that
9849         LC_COLLATE has effect.  However, use memcmp if it is an
9850         easy locale.
9851         (check_file): Do not include newline in comparison, so that
9852         xmemcoll has a byte to stomp on temporarily.
9853         (main): Set hard_LC_COLLATE.
9854
9855 2002-07-29  Jim Meyering  <jim@meyering.net>
9856
9857         * Makefile.am (SUBDIRS): Remove djgpp, for now.
9858
9859 2002-07-20  Jim Meyering  <jim@meyering.net>
9860
9861         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9862         into EXIT_FAILURE.  Otherwise, false --help and false --version
9863         would fail.
9864
9865 2002-07-08  Jim Meyering  <jim@meyering.net>
9866
9867         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9868         rather than the hard-coded `sh-utils'.
9869
9870 2002-07-01  Jim Meyering  <jim@meyering.net>
9871
9872         * configure.ac: Merge the three files from fileutils,
9873         textutils, and sh-utils.
9874         * Makefile.am: Likewise.
9875         * src/Makefile.am: Likewise.