Include stdio--.h, not stdio-safer.h.
[platform/upstream/coreutils.git] / ChangeLog
1 2005-07-02  Jim Meyering  <jim@meyering.net>
2
3         * Version 5.3.1.
4
5         * Makefile.maint (sc_obsolete_symbols): New rule.
6         (syntax-check-rules): Add it to the list.
7         * Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols.
8         * .x-sc_obsolete_symbols: New file.
9
10 2005-07-01  Jim Meyering  <jim@meyering.net>
11
12         * src/system.h: Assume HAVE_FCNTL_H (i.e., include <fcntl.h>
13         unconditionally, and don't include <sys/file.h>).
14         * src/system.h: Likewise for HAVE_UNISTD_H.
15
16 2005-06-30  Jim Meyering  <jim@meyering.net>
17
18         * src/cp.c: Add uses of ARGMATCH_VERIFY to ensure that
19         corresponding option string and value arrays are consistent.
20         * src/date.c: Likewise.
21         * src/du.c: Likewise.
22         * src/ls.c: Likewise.
23         cp.c and date.c each had a harmless trailing `, 0' (now-removed)
24         in a value list.
25
26         * src/system.h (VERIFY): Guard definition with #ifndef.
27         (VERIFY_EXPR): Undef before defining.
28
29 2005-06-29  Jim Meyering  <jim@meyering.net>
30
31         * src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
32         * src/du.c (show_date): Likewise.
33         * src/date.c (show_date): Likewise.
34         * src/od.c (dump_strings): Likewise.
35         * src/sort.c (fillbuf): Likewise.
36         * src/chmod.c (main): Likewise.
37
38         * src/system.h (VERIFY): Rewrite to use string-concatenation
39         and __LINE__ so as not to require a struct name parameter.
40         (GL_CONCAT, GL_CONCAT2): Define helper macros.
41         * src/od.c: Update sole use.
42
43         * src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
44         when computing the --author column width.  This bug might have
45         resulted in misaligned columns when using the --author option
46         on the Hurd.  Spotted by Arnold Robbins.
47
48 2005-06-28  Jim Meyering  <jim@meyering.net>
49
50         * src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
51         not x2nrealloc.  The former is a little more concise and readable.
52         N.B. this sort of transformation is ok only when the base type is
53         unlikely ever to change to a multibyte type.
54         * src/du.c (show_date): Likewise.
55         * src/date.c (show_date): Likewise.
56         * src/od.c (dump_strings): Likewise.
57         * src/sort.c (fillbuf): Likewise.
58
59 2005-06-24  Jim Meyering  <jim@meyering.net>
60
61         * src/mv.c (usage): Clarify how --reply=no works.
62
63 2005-06-23  Paul Eggert  <eggert@cs.ucla.edu>
64
65         Address the following "du" issues:
66
67         - The option name "--last-time=TYPE" is different from the ls's option
68           "--time=TYPE" with a similar meaning.  I assume this wasn't intended.
69
70         - --time-style implies --time, but this is not true for "ls".  It's
71           better to be consistent.
72
73         - Since we don't have POSIX compatibility concerns, there's no need
74           for the "posix-" styles, or for support of styles with newlines, or
75           for the "locale" style, except for parsing the TIME_STYLE
76           environment variable.
77
78         - It's cleaner (and these days, no less efficient) to use functions
79           rather than macros when possible.
80
81         - struct duinfo doesn't need a 'valid' flag; you can simply use a time
82           stamp that is less than all valid time stamps.
83
84         - The code needs a bit of reformatting to fit the usual GNU style.
85
86         * NEWS: du's --last-time option is now --time.
87         * doc/coreutils.texi (ls invocation): Fix typo: --time=use is
88         equivalent to --time=atime, not --time=ctime.
89         (ls invocation, du invocation): Fix typo: --time-style=long-iso
90         is equivalent to a time style with a leading "+".
91         (du invocation): --last-time is now --time.
92         --time-style no longer implies --time.
93         The locale and posix- stuff now works only for TIME_STYLE, not
94         for --time-style.  Give equivalent format for --time-style=iso.
95         * src/du.c: Do not include hard-locale.h.
96         (struct duinfo): Remove 'valid' member.  All uses changed to use
97         negative nsec instead.
98         (DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
99         (duinfo_init, duinfo_set, duinfo_add): New functions, taking the
100         role of the removed macros.
101         (opt_time): Renamed from opt_last_time.  All uses changed.
102         (TIME_OPTION): Renamed from LAST_TIME_OPTION.  All uses changed.
103         (long_options, usage): Rename --last-time to --time.
104         (locale_time_style): Remove.
105         (time_style_args, time_style_types, usage): Remove support for
106         --time-style=locale.
107         (show_date): Now returns void, since nobody looked at the result.
108         Assume FORMAT is not null.  An empty FORMAT now outputs an empty time.
109         Simplify nstrftime invocation.
110         (main): Put in ls compatibility workarounds only for TIME_STYLE,
111         not for --time-style.  Omit unnecessary space in iso time style.
112
113 2005-06-23  Jim Meyering  <jim@meyering.net>
114
115         * src/du.c (time_format): Add `const' attribute.
116
117         * src/date.c (show_date): Use puts rather than printf ("%s\n",.
118
119         * src/du.c (show_date): Rename local `time_format' so as not to
120         shadow the file-scoped global by that name.
121         (show_date): Add a FIXME comment.
122
123         * src/du.c: Include hard-locale.h and strftime.h.
124         (DUINFO_INI, DUINFO_SET, DUINFO_ADD):
125         Enclose body in `do {...} while (0)', not just `{...}'.
126         Adjust uses (add semicolons).
127         Adjust formatting, indentation.
128         (usage): Tweak formatting to maintain more or less constant indentation.
129
130 2005-06-14  William Brendling  <wbrendling@gmail.com>
131
132         * src/du.c: Add --last-time and --time-style options.
133
134 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
135
136         * tests/umask-check: New file.
137         * tests/Makefile.am (EXTRA_DIST): Add umask-check.
138         * tests/mkdir/perm: Use umask-check.
139         * tests/cp/cp-parents: Likewise, instead of using chmod
140         as described below.  Problem reported by Kevin Mudrick.
141
142 2005-06-22  Jim Meyering  <jim@meyering.net>
143
144         Make rmdir produce diagnostics like this:
145         rmdir: /tmp: Permission denied
146         not like this:
147         rmdir: `/tmp': Permission denied
148
149         * src/rmdir.c: Include "quotearg.h", not "quote.h".
150         (remove_parents, main): Use quotearg_colon, not quote.
151
152 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
153
154         * tests/cp/cp-parents: Use chmod to work around some hosts with
155         ACL problems.  Problem reported by Kevin Mudrick.
156
157 2005-06-21  Jim Meyering  <jim@meyering.net>
158
159         * tests/du/deref-args: Use --apparent-size to avoid the vagaries
160         of counting blocks.  Kevin Mudrick reported that this test would
161         fail on an nfs-mounted directory where attribute-caching is
162         turned on.
163
164 2005-06-19  Jim Meyering  <jim@meyering.net>
165
166         * src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
167
168         * src/shred.c (usage): Use `file system', not `filesystem'.
169
170 2005-06-18  Jim Meyering  <jim@meyering.net>
171
172         * src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
173
174 2005-06-17  Jim Meyering  <jim@meyering.net>
175
176         * src/shred.c (usage): Clarify that shred works on an ext3 file
177         system as long as it's not in data=journal mode.
178         Tiny change by Mark Melahn.
179
180 2005-06-16  Paul Eggert  <eggert@cs.ucla.edu>
181
182         * src/hostid.c (main): Don't print fewer than 8 digits, or spurious
183         leading "f"s.  "f" problem reported by Tim Waugh.
184         * NEWS: Document this.
185
186 2005-06-16  Jim Meyering  <jim@meyering.net>
187
188         Don't embed `this'-style quotes in format strings.
189         * src/tr.c: Rather than this: error (..., "...`%s'...", arg);
190         do this:                      error (..., "...%s...", quote (arg));
191         * src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
192         * src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
193         * src/split.c, src/tail.c: Likewise.
194
195         * src/sleep.c: Include "quote.h".  Remove hard-coded quotes, as above.
196         * src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
197         * src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
198
199         * src/mv.c: Finally remove support for --version-control=S (-V).
200         It was deprecated nearly 6 years ago and has been warning
201         users to switch to --backup=S since fileutils-4.0j.
202         * src/cp.c, src/install.c, src/ln.c: Likewise.
203
204 2005-06-15  Jim Meyering  <jim@meyering.net>
205
206         * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
207         * tests/install/basic-1: Ensure that each `-d'-specified directory
208         is created.  Ensure that rel-named dirs are not created when
209         chdir($PWD) fails.
210
211         * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
212
213 2005-06-14  Paul Eggert  <eggert@cs.ucla.edu>
214
215         Improve diagnostics for restore_cwd failure.
216         * src/install.c (main): Standardize on a diagnostic for
217         restore_cwd failure, and report errno.
218         (install_file_in_file_parents): Fail if restore_cwd fails and
219         one of the files is relative.  This fixes a bug (albeit unlikely).
220         * src/mkdir.c (create_parents): Remove static var (now local to 'main').
221         (main): Standardize on a diagnostic for restore_cwd failure,
222         and report errno.
223         Don't bother to check cwd_errno unless create_parents.
224         Use mkdir rather than make_dir; it's simpler.
225
226         * src/install.c (main): Adjust to new make_dir_parents convention.
227         * src/mkdir.c (main): Likewise.
228
229 2005-06-14  Jim Meyering  <jim@meyering.net>
230
231         * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
232         is an absolute directory name.
233
234         * Makefile.maint (my-distcheck): Add -Wall to the list of options that
235         are used with -Werror.  This target is not intended for general use.
236
237 2005-06-13  Jim Meyering  <jim@meyering.net>
238
239         * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
240         relative directory name after make_dir_parents fails to restore
241         the working directory.  Before, `mkdir -p' could create directories
242         in the wrong place in unusual circumstances.
243         * src/install.c (main): Likewise.
244         (install_file_in_file_parents): Update make_dir_parents caller.
245         * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
246         * tests/mkdir/Makefile.am (TESTS): Add p-3.
247
248 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
249
250         Act on the Austin Group's response yesterday to XCU ERN 63; see
251         <http://www.opengroup.org/austin/docs/austin_260.txt>.
252         * NEWS: ls no longer outputs an extra space between mode and link count.
253         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
254         * src/ls.c (any_has_acl): New var.
255         (clear_files): Clear it.
256         (gobble_file): Set it if a file has an ACL.
257         (print_long_format): Omit needless space unless some file has an ACL.
258
259 2005-06-10  Jim Meyering  <jim@meyering.net>
260
261         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
262
263 2005-06-02  Jim Meyering  <jim@meyering.net>
264
265         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
266
267 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
268
269         Use "file name" when talking about file names, instead of "filename"
270         or "path", as per the GNU coding standards.
271         * src/basename.c: Don't use "path" or "filename".
272         * src/copy.c: Likewise.
273         * src/copy.h: Likewise.
274         * src/cp-hash.c: Likewise.
275         * src/cp.c: Likewise.
276         * src/df.c: Likewise.
277         * src/install.c: Likewise.
278         * src/ls.c: Likewise.
279         * src/pinky.c: Likewise.
280         * src/pr.c: Likewise.
281         * src/pwd.c: Likewise.
282         * src/remove.c: Likewise.
283         * src/rmdir.c: Likewise.
284         * src/sort.c: Likewise.
285         * src/system.h: Likewise.
286         * src/tty.c: Likewise.
287         * src/who.c: Likewise.
288         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
289         (make_dir_parents_private): Renamed from make_path_private.
290         All uses changed.
291         * src/cp.c (usage): Don't use "path" to describe a file name.
292         * src/readlink.c (usage): Likewise.
293         * src/rmdir.c (usage): Likewise.
294         * src/df.c: Don't include "path-concat.h"; not needed.
295         * src/install.c (install_file_in_file_parents): Renamed from
296         install_file_to_path.  All uses changed.
297         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
298         All uses changed.
299         * src/ls.c (make_link_name): Renamed from make_link_path.
300         All uses changed.
301         * src/pwd.c (struct file_name): Renamed from struct Path.
302         All uses changed.
303         (file_name_free): Renamed from path_free.  All uses changed.
304         (file_name_init): Renamed from path_init.  All uses changed.
305         (file_name_prepend): Renamed from path_prepend.  All uses changed.
306         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
307         All uses changed.
308         (longopts): Add comment that --path is deprecated.
309
310 2005-05-31  Jim Meyering  <jim@meyering.net>
311
312         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
313         This is a crutch so that `make distcheck's sc_tight_scope rule
314         knows that they really are deliberately declared that way.
315
316 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
317
318         Port to Solaris 10's rules for whether programs can chown files.
319         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
320         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
321         changed.
322         (copy_internal): If chown failed, don't worry about what happened
323         to the mode bits; they can't have changed.
324         (chown_privileges, chown_failure_ok): New functions.
325         * src/copy.h: Add copyright notice.
326         (struct cp_options): Remove myeuid member.  Add chown_privileges
327         member.
328         (chown_privileges, chown_failure_ok): New function decls.
329         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
330         Use chown_failure_ok rather than our own code.
331         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
332         * src/install.c (cp_option_init): Likewise.
333         * src/mv.c (cp_option_init): Likewise.
334
335 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
336
337         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
338         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
339         Remove decls.
340         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
341         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
342         [!defined _POSIX_VERSION]: Remove decls.
343         * src/install.c (getpwnam, getgrnam): Remove decl.
344         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
345         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
346         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
347         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
348         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
349         isn't defined.
350         Don't include <sys/file.h>; no longer needed.
351         (getegid, geteuid): Remove no-longer-necessary decls.
352
353         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
354         Define to 256, not 255, as per modern POSIX.
355
356 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
357
358         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
359         * src/dd.c (skip): Return the number of records that were not
360         skipped due to encountering EOF.
361         (dd_copy): If the file wasn't seekable and EOF was encountered,
362         write zeros past EOF until the desired offset is reached.
363
364         * NEWS: expr and test now correctly compare integers of unlimited size.
365         (Also, correct a comment that claimed that expr detects integer
366         overflow; it does so only when converting from strings.)
367         * src/expr.c: Include strnumcmp.h, xstrtol.h.
368         (looks_like_integer): New function.
369         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
370         own diagnostics.
371         (eval2): Don't look for trouble if !evaluate; this simplifies things.
372         Compare numbers using string comparison, so that overflow is
373         not possible.
374         * src/sort.c: Refactor so that others can use large-integer
375         comparison functions.
376         Include "strnumcmp.h".
377         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
378         Remove; moved to strnumcmp.
379         (decimal_point): Now int, to simplify converison overhead with
380         new API.  All uses changed.
381         (thousands_sep): Now -1 if there isn't one, as per new API.
382         All uses changed.
383         (numcompare): Move contents to strnumcmp module, except for
384         skipping blanks.
385         * src/test.c: Include inttostr.h, strnumcmp.h.
386         (whitespace, digit, digit_value, integer_expected_error): Remove.
387         (is_int): Remove; replaced by...
388         (find_int): New function.
389         (binary_operator): Don't let integers overflow in comparisons;
390         return the correct answer instead.  Simplify the code.
391         (unary_operator): Convert the integer ourself, since find_int
392         no longer does so.
393         * tests/expr/basic (bigcmp): New test.
394         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
395
396 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
397
398         * NEWS: nohup now redirects a tty stdin to an unreadable fd
399         instead of closing it.
400         * doc/coreutils.texi (nohup invocation): Document this.
401         * src/nohup.c (main): Implement this.
402
403 2005-05-26  Jim Meyering  <jim@meyering.net>
404
405         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
406         Reported by David Alan Gilbert.
407         * tests/expr/basic: Add tests using arithmetic on negative integers.
408
409 2005-05-19  Jim Meyering  <jim@meyering.net>
410
411         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
412         Remove inaccurate-but-harmless `const' attributes.
413
414         * src/join.c (decode_field_spec): Add an abort after
415         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
416         about variables being used uninitialized.
417
418 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
419
420         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
421         * src/Makefile.am: Add copyright notice.
422         (factor_LDADD): Remove, as factor no longer needs sqrt.
423         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
424         it's always true now.
425
426 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
427
428         Fix Cygwin porting problem reported by Eric Blake.
429         * src/remove.c (DT_IS_DIR): Remove.
430         (DT_IS_KNOWN, DT_MUST_BE): New macros.
431         (remove_entry): Use them.
432
433 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
434
435         * src/remove.c: Include unlinkdir.h.
436         (UNLINK_CAN_UNLINK_DIRS): Remove.
437         (remove_entry): Use cannot_unlink_dirs () rather than
438         UNLINK_CAN_UNLINK_DIRS.
439
440 2005-05-14  Jim Meyering  <jim@meyering.net>
441
442         Update FSF postal mail address.
443         * Makefile.maint, Makefile.cfg, gnupload
444         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
445         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
446         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
447         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
448         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
449         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
450         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
451         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
452         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
453         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
454         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
455         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
456         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
457         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
458         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
459         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
460         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
461         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
462         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
463         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
464         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
465         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
466
467 2005-05-13  Jim Meyering  <jim@meyering.net>
468
469         * NEWS: `rm -r' now removes all of the files it should, even on
470         systems with a buggy readdir affecting file systems inaccessible
471         at configure time.
472
473         In some unusual circumstances `rm -r' would fail to remove --
474         or even consider -- all entries in a directory with more than 254
475         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
476         other types of systems when using an affected file system via e.g.,
477         NFS.  The underlying cause was a bug in readdir on those systems.
478         Coreutils-5.2.1 and earlier used a configure-time test designed
479         to detect precisely those problem systems, but it would detect
480         the problem and enable remove.c's work-around code only when its
481         configure-time test was run on a losing file system.  Obviously,
482         it couldn't detect a problem if the offending file system wasn't
483         tested or even mounted at coreutils configure time.  Now, rm itself
484         performs a minimal-cost run-time test to detect the problem.
485
486         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
487         (remove_cwd_entries):  When readdir returns NULL for a directory from
488         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
489         entries, call rewinddir and then resume the readdir/unlink loop.
490         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
491
492 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
493
494         * NEWS: nohup now closes stdin if it is a terminal, unless
495         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
496         <https://www.opengroup.org/sophocles/show_mail.tpl?
497         source=L&listname=austin-group-l&id=8341>.
498         * doc/coreutils.texi (nohup invocation): Document this.
499         * src/nohup.c (main): Implement this.
500
501 2005-05-12  Jim Meyering  <jim@meyering.net>
502
503         * src/date.c: Assume `free (NULL)' works.
504         * src/dd.c: Likewise.
505         * src/df.c:Likewise.
506         * src/dircolors.c:Likewise.
507         * src/head.c: Likewise.
508         * src/ls.c: Likewise.
509         * src/md5sum.c: Likewise.
510         * src/pr.c: Likewise.
511         * src/sort.c: Likewise.
512
513 2005-05-10  Jim Meyering  <jim@meyering.net>
514
515         * tests/touch/not-owner: Skip this test if the user running it
516         owns `/' or has write access to it.
517
518         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
519         This makes `mv -i --reply=no f1 f2' work as expected (in not
520         performing the move operation).  But note that specifying `-i'
521         after `--reply=no' does *not* work.
522         Tiny patch from Vlada Macek.
523         Correct a comment.
524         * tests/mv/reply-no: New file.  Test for the above fix.
525         * tests/mv/Makefile.am (TESTS): Add reply-no.
526
527         * tests/ls-2/tests: Don't print PATH to stderr.
528
529 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
530
531         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
532         responses.
533
534 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
535
536         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
537         * src/dd.c (flags, usage): Add support for "binary" and "text".
538
539 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
540
541         * NEWS: chmod -w now complains if it differs from chmod a-w.
542         * src/chmod.c: Include quotearg.h.
543         (diagnose_surprises): New var.
544         (process_file): Diagnose surprises.  Simplify the logic a bit,
545         while we're at it.
546         (main): Prepare to diagnose surprises.  Remove useless code for
547         '-' option.
548         * tests/chmod/Makefile.am (TESTS): Add umask-x.
549         * tests/chmod/umask-x: New file.
550
551 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
552
553         * NEWS: ls --indicator-style=directory renamed to ls
554         --indicator-style=slash, to avoid confusion with ls --directory.
555         * src/ls.c (usage): Likewise.
556         (slash): Renamed from directory_only.  All uses changed.
557
558 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
559
560         * NEWS: "chmod +1 foo" is now diagnosed.
561
562 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
563
564         * NEWS: ls -p now marks only directories.  New option
565         --indicator-style=directory equivalent to -p.
566         * doc/coreutils.texi (ls invocation): Document this.
567         Also, mention ">" is for doors.
568         * src/ls.c (enum indicator_style): New constant directory_only,
569         for -p.
570         (indicator_style_args, indicator_style_types): Set it appropriately.
571         (decode_switches, gobble_file, print_type_indicator):
572         (length_of_file_name_and_frills):
573         Implement the change described in NEWS.
574         (decode_switches): Quote ">", too.
575         (usage): Update to match the new behavior.  Describe ">".
576         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
577         The "ls --color" test wasn't being checked; add a check for
578         "ls --color=auto" instead.
579
580         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
581         * tests/misc/split-fail: Likewise.
582         * tests/pr/Test.pm: Likewise.
583         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
584         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
585         if they use file names starting with +.
586         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
587         * tests/uniq/Test.pm (tv, test_vector): Likewise.
588
589         The following was partly derived from a tiny change by Eric Blake:
590         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
591         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
592         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
593         Work even if the underyling system attaches ACLs to new dirs.
594         * tests/mv/part-hardlink: Don't use 'set -'.
595         * tests/stty/row-col-1: Don't use 'set -'.
596
597 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
598
599         * NEWS: Document fixes described below.
600         * src/chmod.c (change, umask_value): New static vars.
601         (reference_file): Move this static var to inside "main".
602         (process_file, process_files): Remove CHANGES arg; now taken from
603         static var.  All uses changed.
604         (usage): Fix incorrect description of MODE operand.
605         (main): For invalid mode usages, output a brief usage message.
606         Adjust to new modechange API.
607         * install.c (main): Adjust to new modechange API.
608         Also, free the mode_change object when done.
609         * mkdir.c (main): Likewise.
610         * mkfifo.c (main): Likewise.
611         * mknod.c (main): Likewise.
612         * tests/chmod/equal-X: Check for =xX bug.
613         * tests/chmod/equals: Check for =u bug.
614         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
615
616 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
617
618         Restore support for usages like "head -1" and "tail -1",
619         even when conforming to POSIX 1003.1-2001.
620         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
621         join now supports a NUL field separator, e.g., "join -t '\0'".
622         join now detects and reports incompatible options, e.g.,
623         "join -t x -t y",
624         * NEWS: Document this.
625         * src/date.c: Remove posixver.h and its uses.
626         (COMMON_SHORT_OPTIONS): Remove.
627         (short_options): New constant.
628         (short_options, usage): -I now always takes an optional arg.
629         * src/expand.c: Remove posixver.h and its uses.
630         (shortopts): New constant.  -DIGIT now always takes an optional arg.
631         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
632         Don't complain about -DIGIT.
633         * src/fold.c: Remove posixver.h and its uses.
634         (shortopts): New constant.  -DIGIT now always takes an optional arg.
635         (main): Don't preprocess arg list; that was buggy.  Use method
636         similar to expand.
637         * src/head.c: Remove posixver.h and its uses.
638         (header_mode_option): Remove.
639         (main): Don't complain about obsolete -NUM args.
640         * src/join.c: Remove posixver.h and its uses.
641         (obsolete_usage): Remove.
642         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
643         they haven't been set yet.
644         (tab): Now int, not char.  Initialize to -1 to indicate white space
645         separates columns, so that we can use NUL as a separator.
646         All uses changed.
647         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
648         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
649         suffices.  Use xstrtoul for sizes; it suffices.
650         (decode_field_spec): Report an error and exit on failure.  Return void,
651         not bool.
652         (add_field_list): Likewise.
653         (set_join_field): New function.
654         (enum operand_status): New enum.
655         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
656         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
657         possibilities with obsolete option parsing.
658         (main): Use it.  Do not depend on POSIX version.
659         Check for conflicting options.  Parse obsolete options -j1 and -j2
660         so that it is a pure extension to POSIX 1003.1-2001.
661         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
662         * src/nice.c: Remove posixver.h and its uses.
663         (main): Always support -NUM option.
664         * src/od.c: Remove posixver.h and its uses.
665         (short_options): New constant, which always supports -w[num].
666         (COMMON_SHORT_OPTIONS): Remove.
667         * src/pr.c: Remove posixver.h and its uses.
668         (short_options): New constant, which always supports -S[string].
669         (COMMON_SHORT_OPTIONS): Remove.
670         * src/sort.c: Remove posixver.h and its uses.
671         (short_options): New constant, which always supports -y arg.
672         (COMMON_SHORT_OPTIONS): Remove.
673         (main): Redo workaround for Solaris compatibility with -y.
674         This change isn't visible to the user; it just cleans up the
675         code so that we don't need posixver.h.
676         * src/split.c: Remove posixver.h and its uses.
677         (main): Don't complain about -NUM option.
678         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
679         * src/unexpand.c: Remove posixver.h and its uses.
680         (main): Don't complain about -TAB.
681         * src/uniq.c (main): Don't complain about -NUM.
682
683 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
684
685         * src/nohup.c (main): If getopt fails, exit with status 127,
686         not status 1.  POSIX requires this.
687         * NEWS: Document this.
688
689         * src/nice.c (main): Report proper program name when getopt finds
690         trouble.  Problem reported by Behdad Esfahbod.
691
692         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
693         when the "+x" was being evaluated.
694         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
695         * mkfifo.c (main): Likewise.
696         * mknod.c (main): Likewise.
697         * tests/mkdir/perm: Test for the above bug.
698
699 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
700
701         Port test cases to Microsoft-Windows-related environments,
702         following suggestions from Eric Blake.
703         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
704         * tests/install/basic-1: Undo previous change.
705         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
706         * tests/install/trap: Undo previous change.
707         (sig): New var.  Use it insted of "trap '' CHLD".
708         Append $EXEEXT to executable name.
709
710         "fetish" -> "coreutils" in more places.
711         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
712         (package Coreutils): Renamed from package Fetish.  All uses changed.
713         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
714         remove Fetish.pm.
715
716 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
717
718         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
719         directory is actually a symbolic link.  Problem reported by
720         Eric Blake.
721
722         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
723         than the (incorrect) test -f and the (inadequate) ls.  ls is
724         inadequate because on some hosts a buggy mv will create a file of
725         the wrong type (problem reported by Eric Blake).  Skip this test
726         if test -p doesn't work.
727
728         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
729         since the latter can have shell metacharacters in them (e.g., spaces).
730         This follows up to the 2005-01-17 patch, which missed this occurrence.
731
732 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
733
734         "fetish" -> "coreutils" in several places.
735         * Makefile.cfg (ftp): Remove fetish.sf.net.
736         * Makefile.maint (emit_upload_commands): Likewise.
737         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
738         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
739         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
740
741         * tests/install/basic-1: Use "cat", not "test", to test for
742         ../../src/dd.  Problem reported by Eric Blake.
743
744 2005-04-18  Jim Meyering  <jim@meyering.net>
745
746         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
747
748 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
749
750         Work around a couple of "make check" failures reported for Cygwin
751         and ash by Eric Blake.
752         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
753         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
754
755 2005-04-16  Jim Meyering  <jim@meyering.net>
756
757         * src/dd.c (S_TYPEISSHM): Remove definition.
758         Get the definition by including "stat-macros.h", instead.
759
760 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
761
762         Fix test suite problems reported by Eric Blake on Cygwin.
763         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
764         since POSIX doesn't require rename to fail across file systems.
765         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
766         it's more reliable.
767         (other_partition_tmpdir): Remove df from name as that would be
768         misleading now.
769
770 2005-04-14  Jim Meyering  <jim@meyering.net>
771
772         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
773
774 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
775
776         * src/ls.c (usage): "uid" -> "user ID".
777
778 2005-04-12  Jim Meyering  <jim@meyering.net>
779
780         * src/tsort.c (tsort): Use "%s" as the format string,
781         rather than a diagnostic or a file name.
782
783         * src/comm.c (compare_files): Remove declaration of unused local.
784
785         * src/chown-core.c (chopt_free): Mark parameter as unused.
786
787 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
788
789         * man/chown.x: Reword to match user manual.
790         * man/id.x: Likewise.
791         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
792         for "group ID".
793         * src/whoami.c (usage, main): Likewise.
794
795         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
796         * src/comm.c: Include stdio-safer.h.
797         (compare_files): Exit right away on I/O error rather than continuing
798         and producing confusing output and error messages.
799         Return void, not int; all callers changed.
800         Use fopen_safer to avoid confusion with file descriptors.
801         * src/copy.c: Include unistd-safer.h.
802         (copy_reg): Use fd_safer.
803         * src/csplit.c: Include stdio-safer.h.
804         (input_desc): Remove unnecessary static initialization.
805         (set_input_file): Use STDIN_FILENO, not 0.
806         (create_output_file): Use fopen_safer.
807         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
808         return stdin.
809         * src/head.c (head_file): Don't assume open does not return 0.
810         * src/join.c: Include stdio-safer.h.
811         (main): Use fopen_safer.  Simplify the resulting code.
812         * src/md5sum.c (digest_file, digest_check):
813         Don't assume that fopen does not return stdin.
814         * src/nohup.c: Include unistd-safer.h.
815         (main): Don't dup stderr to stdin or stdout by mistake.
816         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
817         * src/paste.c (paste_serial): Likewise.
818         * src/pr.c: Include stdio-safer.h.
819         (open_file): Use fopen_safer.
820         (close_file): Don't assume fopen does not return stdin.
821         * src/ptx.c (main): Don't assume fopen returns stdout after closing
822         stdout.  Use freopen instead.
823         * src/shred.c: Include unistd-safer.h.
824         (wipename): Use fd_safer on directory file descriptor.
825         (wipefile): Remove special case for /dev/fd/* on older hosts.
826         It didn't work in general, and wasn't documented.
827         Use fd_safer.
828         * src/sort.c: Include unistd-safer.h.
829         (create_temp_file): Use fd_safer.
830         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
831         * src/split.c: Include unistd-safer.h.
832         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
833         version, as POSIX requires.
834         * src/sum.c (bsd_sum_file, sysv_sym_file):
835         Use same pattern as elsewhere for checking for stdin.
836         * src/tac.c: Include unistd-safer.h.
837         (copy_to_temp): Use fd_safer.
838         (tac_file): Don't assume fopen cannot return stdin.
839         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
840         (recheck, tail_file): Use fd_safer rather than open_safer.
841         * src/tee.c: Include stdio-safer.h.
842         (tee): Use fopen_safer.
843         * src/touch.c: Include unistd-safer.h.
844         (touch): Use fd_safer.
845         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
846         removed.
847         (tsort): Do not assume fopen can't return stdin.
848         Close stdin before returning.  All uses changed.
849         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
850         * src/uniq.c: Include stdio_safer.h.
851         (check_file): Don't assume fopen cannot return stdin or stdout.
852
853 2005-04-09  Jim Meyering  <jim@meyering.net>
854
855         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
856
857         Now that close_stdout closes standard output unconditionally,
858         these workarounds for dd and cat are no longer necessary.
859         * src/dd.c (close_stdout_wrapper): Remove function.
860         (main): Call atexit with close_stdout, instead.
861         * src/cat.c (close_stdout_wrapper): Likewise.
862         Don't close STDOUT_FILENO explicitly; close_stdout does it.
863
864         * src/system.h (__attribute__): Readability nit:
865         Change this:
866         #  define __attribute__(x)
867         to this:
868         #  define __attribute__(x) /* empty */
869
870 2005-04-09  Jim Meyering  <jim@meyering.net>
871
872         * src/rm.c (usage): Mention that --recursive removes listed
873         directories too, not just their contents.
874         Say that by default, rm does not remove directories.
875
876         * src/pr.c: Don't include "timespec.h".  system.h does that.
877         * Makefile.maint (sc_system_h_headers): Propagate exit status
878         through trap.
879
880 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
881
882         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
883         and when conforming to POSIX no longer treats USR1 specially.
884         Document that dd no longer dumps core when handling signals.
885         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
886         replaced with void.
887         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
888         All uses changed.
889         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
890         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
891         behavior when called from a signal handler.  All uses changed.
892         (main) [!defined SA_NOCLDSTOP]:
893         Use siginterrupt to specify that system calls should be interrupted.
894         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
895         (process_signals): Add forward decl.
896         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
897         New macros.
898         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
899         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
900         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
901         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
902         New vars.
903         (usage): Mention -USR1 versus -INFO.
904         (cleanup): Don't invoke print_stats; the caller must do it now.
905         All callers changed.
906         (quit): Process signals just before exiting.
907         (interrupt_handler): Simply record the signal and return.
908         (siginfo_handler): Simply increment the signal counter and return.
909         (install_handler): Remove, replacing with:
910         (install_signal_handlers, process_signals, iread, iwrite):
911         New functions.  All callers to safe_read and full_write replaced
912         by iread and iwrite.  All callers to install_handler replaced by
913         install_handlers.
914         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
915         All uses changed.
916         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
917         (main) [! SA_NOCLDSTOP]: Use it.
918         * src/shred.c: Remove all uses of signals; modern hosts have
919         /dev/random and don't need this gorp.
920         Do not include signal.h.
921         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
922         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
923         All uses changed.
924         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
925         (main) [! SA_NOCLDSTOP]: Use it.
926
927         * src/dd.c: Do not include inttostr.h, no longer needed.
928         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
929         instead of umaxtostr.
930         (print_stats): Work even in languages that have special
931         forms for two of things, for r_truncate and w_bytes.  We can't
932         fix delta_s in this way, since ngettext doesn't support floating-point.
933         (main): Rewrite to avoid casts.
934
935 2005-04-07  Jim Meyering  <jim@meyering.net>
936
937         Placate gcc-4's -Wuninitialized.
938         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
939         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
940
941         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
942         be `const'.
943         (binop): Move function definition to precede first use so we can...
944         (binop): ...remove prototype.
945
946 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
947
948         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
949         * src/basename.c (usage): Add examples.
950         * src/cat.c (usage): Likewise.
951         * src/chgrp.c (usage): Likewise.
952         * src/chown.c (usage): Likewise.
953         * src/dirname.c (usage): Likewise.
954
955 2005-04-05  Jim Meyering  <jim@meyering.net>
956
957         * src/nice.c (usage): Mention that some shells provide a
958         built-in function by the same name.
959         * src/nohup.c (usage): Likewise.
960         * src/printenv.c (usage):Likewise.
961
962 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
963
964         * src/tee.c (tee): When closing files, do not close stdout,
965         leave this job to close_stdout() instead.
966         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
967         * tests/Makefile.am (SUBDIRS): Add tee.
968         * tests/tee/Makefile.am: New file.
969         * tests/tee/.cvsignore: Likewise.
970         * tests/tee/{basic,dash}: New tee tests.
971
972 2005-04-04  Jim Meyering  <jim@meyering.net>
973
974         * src/echo.c (usage): Mention that some shells provide a
975         built-in function by the same name.
976         * src/kill.c (usage): Likewise
977         * src/printf.c (usage): Likewise.
978         * src/pwd.c (usage): Likewise.
979         * src/stat.c (usage): Likewise.
980         * src/test.c (usage): Likewise.
981         * src/true.c (usage):
982         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
983
984         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
985         * man/printf.x: Likewise.
986         * man/pwd.x: Likewise.
987
988 2005-04-03  Jim Meyering  <jim@meyering.net>
989
990         * src/pr.c (main): Fix off-by-one error.
991         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
992         end of a malloc'd buffer.
993
994 2005-04-01  Jim Meyering  <jim@meyering.net>
995
996         * src/pr.c (main): Free column_count_string when done with it.
997
998         Don't let pr treat +1:-1 like +1:18446744073709551615.
999         * src/pr.c (strtoumax): Remove declaration.
1000         (first_last_page): Use xstrtoumax in place of strtoumax,
1001         so we don't interpret a negative page number (e.g., in an option
1002         like --pages=1:-1) as valid.
1003         * tests/pr/Test.pm (neg-page): Add a test for this.
1004
1005 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
1006
1007         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
1008         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
1009         * src/users.c (users): Likewise.
1010         * src/who.c (who): Likewise.
1011         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
1012         * src/users.c (main): Likewise.
1013         * src/who.c (main): Likewise.  Also with two arguments.
1014         Omit duplicate code in 2-arg case.
1015         (UT_PID): Moved to ../lib/readutmp.h.
1016
1017 2005-03-29  Jim Meyering  <jim@meyering.net>
1018
1019         * src/system.h (ptr_align): Declare `ptr' parameter to be a
1020         `const' pointer, since this function never writes through it.
1021
1022         * src/uname.c: Indent cpp directives to reflect nesting.
1023
1024 2005-03-28  Jim Meyering  <jim@meyering.net>
1025
1026         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
1027         Add `void' to make this an ANSI-style function declaration.
1028         * src/remove.c (ds_init): Likewise.
1029         * src/pr.c (print_sep_string): Likewise.
1030
1031         * src/stty.c (speeds): Declare this array to be static.
1032         * src/Makefile.am (sc_tight_scope): Adjust to catch any
1033         new declarations like that of stty.c's `speeds'.
1034
1035         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
1036         (GETOPT_VERSION_OPTION_DECL): Likewise.
1037         * src/chown.c (long_options): Likewise.
1038         * src/chgrp.c (long_options): Likewise.
1039         * src/chmod.c (long_options): Likewise.
1040         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
1041         Likewise.
1042         * src/chown-core.c (chopt_init): Likewise.
1043         * src/comm.c (long_options): Likewise.
1044         * src/copy.c (copy_reg): Likewise.
1045         * src/csplit.c (extract_regexp): Likewise.
1046         * src/cut.c (longopts): Likewise.
1047         * src/date.c (time_spec_string): Likewise.
1048         * src/df.c (find_mount_point, show_point): Likewise.
1049         * src/expr.c (docolon): Likewise.
1050         * src/fmt.c (long_options): Likewise.
1051         * src/ls.c (time_style_args, indicator_style_args, long_options)
1052         (format_args, sort_args, time_args, decode_switches)
1053         (gobble_file): Likewise.
1054         * src/md5sum.c (long_options): Likewise.
1055         * src/mv.c (reply_args): Likewise.
1056         * src/paste.c (longopts): Likewise.
1057         * src/pinky.c (print_entry): Likewise.
1058         * src/pr.c (long_options): Likewise.
1059         * src/ptx.c (long_options, format_args): Likewise.
1060         * src/readlink.c (longopts): Likewise.
1061         * src/sort.c (long_options, mergefps): Likewise.
1062         * src/stat.c (long_options): Likewise.
1063         * src/tac.c (main): Likewise.
1064         * src/tail.c (follow_mode_string): Likewise.
1065         * src/touch.c (longopts, time_args): Likewise.
1066         * src/uniq.c (delimit_method_string): Likewise.
1067         * src/uptime.c (print_uptime): Likewise.
1068         * src/who.c (print_user): Likewise.
1069
1070 2005-03-27  Jim Meyering  <jim@meyering.net>
1071
1072         * src/dcgen: Simplify further, clean up.
1073         Add a standard-output-closing global destructor.
1074         Require perl-5.002.
1075         * src/wheel-gen.pl: Use the same global destructor as dcgen.
1076
1077 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
1078
1079         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
1080         array of adjacent strings rather than a more complicated data
1081         structure; this saves space in the dircolors executable.
1082         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
1083         This avoids casts.
1084         (dc_parse_stream, main): Avoid casts.
1085         Adjust to simpler data structure generated by new dcgen.
1086
1087 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
1088
1089         * src/ls.c (usage): Document usage of LS_COLORS.
1090
1091 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
1092
1093         * src/dircolors.hin: Add "TERM cygwin".
1094
1095 2005-03-25  Jim Meyering  <jim@meyering.net>
1096
1097         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
1098         the return value, and update callers:
1099         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
1100         * src/expand.c (parse_tab_stops, main): Likewise.
1101         * src/split.c (main): Likewise.
1102         * src/unexpand.c (parse_tab_stops, main): Likewise.
1103         * src/uniq.c (main): Likewise.
1104
1105 2005-03-22  Jim Meyering  <jim@meyering.net>
1106
1107         * build-aux: New directory.  Renamed from config.
1108         * configure.ac: Reflect renaming: config -> build-aux.
1109         * Makefile.am (dist-hook): Likewise.
1110         * Makefile.maint: Likewise.
1111         * Makefile.cfg (cvs_files): Likewise.
1112         * .x-sc_sun_os_names: Likewise.
1113         * .x-sc_trailing_blank: Likewise.
1114
1115         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
1116         portability to EBCDIC hosts.
1117
1118 2005-03-20  Jim Meyering  <jim@meyering.net>
1119
1120         * src/pr.c (init_header): Add missing `%' in new format string.
1121         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
1122
1123 2005-03-19  Jim Meyering  <jim@meyering.net>
1124
1125         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
1126         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
1127
1128 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
1129
1130         * NEWS: pr -D "FORMAT" now accepts the same formats that
1131         date +"FORMAT" does.
1132         * src/pr.c: Include strftime.h, timespec.h.
1133         (init_header): Obtain and format nanosecond part of time stamp.
1134
1135         * NEWS: nohup now ignores the umask when creating nohup.out.
1136         nohup now closes stderr if it is a terminal and stdout is closed.
1137         * src/nohup.c (main): Likewise.  Be a little more paranoid about
1138         return values; e.g., check for any negative return from open.
1139         Assume free (NULL) works.
1140         Close file descriptor leak when redirecting standard output to a file.
1141
1142 2005-03-17  Jim Meyering  <jim@meyering.net>
1143
1144         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
1145         in place of functionally-equivalent code.
1146         * src/expand.c (parse_tab_stops, main): Likewise.
1147         * src/split.c (main): Likewise.
1148         * src/unexpand.c (parse_tab_stops, main): Likewise.
1149         * src/uniq.c (main): Likewise.
1150         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
1151         declaration.
1152         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
1153         New macros.
1154
1155         Before, this command would make uniq skip 11 fields and print
1156         only the first line:
1157         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
1158         1 1
1159         1 2
1160         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
1161         not like `uniq -f11'.
1162
1163 2005-03-15  Jim Meyering  <jim@meyering.net>
1164
1165         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
1166         `pr -0' should give a better diagnostic and `pr -03' should be
1167         equivalent to `pr -3'.
1168         * src/pr.c (parse_column_count): Change return type to void.
1169         Call error (EXIT_FAILURE, ... for an invalid string.
1170         (main): Allocate space for column_count_string using malloc.
1171         Accumulate all old-style column-count digits before converting.
1172         When the number of columns is specified via both old-style,
1173         (e.g., -3), and a long option (--columns=5), ensure that only
1174         the last one specified takes effect.
1175         * tests/pr/Test.pm: Add tests for the above.
1176
1177 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1178
1179         * src/copy.c (copy_reg): Copy regular files in binary mode.
1180
1181 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
1182
1183         * NEWS: Restate why ls limits time stamp lengths.
1184
1185 2005-03-12  Jim Meyering  <jim@meyering.net>
1186
1187         Add a little infrastructure to help prevent future bugs like the
1188         one fixed below.
1189         * src/stat.c (xstrcat): New function.
1190         (print_statfs, print_stat): Add buf_len parameter and convert all
1191         uses of strcat to xstrcat.  Update callers.
1192         (print_it): Call print_func with buf_len parameter.
1193
1194         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
1195         could cause a buffer overrun error.
1196         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
1197         conversion of the stat %s format string to the longer printf %llu one.
1198         Patch from Guochun Shi.
1199
1200 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
1201
1202         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
1203         (long_time_expected_width, print_long_format): Use it, to avoid
1204         some possible denial-of-service attacks.
1205         * NEWS: Document this.
1206
1207 2005-03-11  Jim Meyering  <jim@meyering.net>
1208
1209         Prompt once again for `mv -i A B' when A and B are hard links
1210         to the same file.  This fixes a bug introduced by my 2003-04-04
1211         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
1212         * src/copy.c (abandon_move): New function, factored out of
1213         copy_internal, now that this code is being used from two places.
1214         (copy_internal): Perform the same interactive-related test for
1215         whether it's alright to proceed and (usually) overwrite the
1216         destination file.
1217         * tests/mv/i-4: Add tests for the above.
1218
1219         Don't segfault for a very long date format string, e.g.,
1220         ls -ld --time-style=+%99999999H .
1221         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
1222         so format string abuse cannot provoke stack overflow.
1223         (print_long_format): Likewise.
1224
1225         Don't segfault for a long header date string, e.g.,
1226         echo a|pr -D +%9999999A
1227         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
1228         Don't bother with fixed-sized initial buffer;  always use x*alloc.
1229
1230         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
1231         in place of equivalent INT_STRLEN_BOUND + 1.
1232         * src/expr.c (tostring, printv): Likewise.
1233
1234 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
1235
1236         * src/system.h: Include intprops.h.
1237         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1238         they are now defined in intprops.h.
1239
1240 2005-03-09  Jim Meyering  <jim@meyering.net>
1241
1242         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
1243
1244 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
1245
1246         * src/date.c (usage): Redo to match recent documentation changes.
1247         Don't bother documenting which usages are GNU extensions; the list
1248         wasn't correct, and is better left to the printed manual anyway.
1249
1250 2005-03-06  Jim Meyering  <jim@meyering.net>
1251
1252         Factor out column-count processing.
1253         * src/pr.c: Include "inttostr.h".
1254         (parse_column_count): New function.
1255         (main): Use the new function for both old-style, -9, and long,
1256         --columns=-9, options.
1257
1258         * src/cksum.c: Remove `register' keyword.
1259         * src/cut.c: Likewise.
1260         * src/dd.c: Likewise.
1261         * src/env.c: Likewise.
1262         * src/factor.c: Likewise.
1263         * src/fmt.c: Likewise.
1264         * src/fold.c: Likewise.
1265         * src/id.c: Likewise.
1266         * src/logname.c: Likewise.
1267         * src/ls.c: Likewise.
1268         * src/pr.c: Likewise.
1269         * src/printf.c: Likewise.
1270         * src/shred.c: Likewise.
1271         * src/sort.c: Likewise.
1272         * src/sum.c: Likewise.
1273         * src/test.c: Likewise.
1274         * src/tsort.c: Likewise.
1275         * src/uniq.c: Likewise.
1276         * src/wc.c: Likewise.
1277         * src/whoami.c: Likewise.
1278
1279 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1280
1281         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1282         longer needed.
1283
1284 2005-03-01  Jim Meyering  <jim@meyering.net>
1285
1286         * src/copy.c (copy_internal): Change test of source type from
1287         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1288         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1289
1290 2005-02-28  Jim Meyering  <jim@meyering.net>
1291
1292         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1293
1294 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1295
1296         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1297         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1298         hosts with clock_gettime.
1299
1300 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1301
1302         * NEWS: Describe user-visible change to dd.
1303         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1304         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1305         gethrxtime instead.
1306         * src/dd.c: Include gethrxtime.h, xtime.h.
1307         (start_time): Now of type xtime_t, not struct timespec.
1308         (print_stats, main): Use gethrxtime rather than gettime.
1309         * src/ls.c (time): Remove obsolete decl.
1310         (get_current_time): gettimeofday always returns 0, so don't
1311         check its result.
1312         * src/shred.c: Include gethrxtime.h.
1313         (isaac_seed): Use gethrxtime rather than a mishmash.
1314         * src/touch.c (time): Remove obsolete decl.
1315
1316         * tests/misc/split-fail: Don't assume that the current host
1317         supports integers wider than 32 bits.  Fix comment typo.
1318         * tests/od/x8: Likewise.
1319
1320         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1321         as it's not valid in standard C89.
1322
1323 2005-02-15  Jim Meyering  <jim@meyering.net>
1324
1325         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1326         so that file systems of type `xfs' are recognized as such.
1327         * src/fs.h: Regenerate.
1328         Reported by Bernd Eckenfels.
1329         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1330         * src/fs.h: Regenerate.
1331         Reported by Andreas Schwab.
1332
1333         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1334         to work around the invalid definition from Darwin 7.7.0.
1335         Test failure reported by Sébastien Maret.
1336
1337 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1338
1339         * src/sort.c (mergefps): Use binary search rather than linear one
1340         when comparing new line to lines already in main memory.
1341         Idea suggested by James Lemley.
1342
1343 2005-02-09  Jim Meyering  <jim@meyering.net>
1344
1345         * src/copy.c (valid_options): Add an assertion that
1346         not both hard_link and symbolic_link are set.
1347
1348 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1349
1350         * NEWS: Document stat -f -c %S, plus changes to default formats.
1351         * doc/coreutils.texi (stat invocation): Normalize terminology,
1352         capitalization, and sort order to match --help output.  Mention %c
1353         for file systems.  Add new -f -c format %S, and document %s versus %S;
1354         problem reported by Jeroen van Wolffelaar.
1355         * src/stat.c (usage): Likewise.
1356         (STATFS_FRSIZE): New macro.
1357         (print_statfs): Use it, for stat -f -c %S.
1358         (do_statfs): Change default formats to output %S.
1359
1360 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1361
1362         * src/system.h: Include "memrchr.h".
1363         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1364
1365 2005-02-02  Jim Meyering  <jim@meyering.net>
1366
1367         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1368         systems that don't support sparse files.
1369         Check for $2 -ge 128, rather than $2 = 128, in case
1370         there is a file system type that doesn't support sparse files,
1371         yet for which metadata takes up additional space.
1372         Both reported by Andreas Schwab.
1373
1374 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1375
1376         * tests/du/8gb: Create a larger test file, so we properly
1377         detect that sparse files can be created on NTFS under cygwin.
1378
1379 2005-01-30  Jim Meyering  <jim@meyering.net>
1380
1381         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1382
1383         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1384
1385 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1386
1387         * .cvsignore: Ignore config.cache and config.status.lineno.
1388         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1389         instead of VSWTCH, for use with CSWTCH.
1390
1391 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1392
1393         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1394         * tests/rwx-to-mode: Ignore ACL designation.
1395         * tests/setgid-check: Likewise.
1396         * tests/chown/separator: Quote user and group names.
1397
1398 2005-01-24  Jim Meyering  <jim@meyering.net>
1399
1400         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1401         Suggestion from Johan Boule.
1402
1403 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1404
1405         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1406         duplicates.
1407         * man/Makefile.am (all_programs): Revert previous patch; updated
1408         all_programs.list fixes this.
1409         (.x.1): No need to add $(EXEEXT).
1410
1411 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1412
1413         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1414         available.
1415
1416 2005-01-22  Jim Meyering  <jim@meyering.net>
1417
1418         * Makefile.maint (v_etc_file): The version string has moved to
1419         version-etc-fsf.c, search that new file, not version-etc.c.
1420
1421 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1422
1423         * tests/group-names: Use numeric group ids, not symbolic group names,
1424         since the latter can have shell metacharacters in them (e.g., spaces).
1425         Problem reported by Eric Blake.
1426         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1427         * tests/chgrp/deref: Likewise.
1428         * tests/chgrp/posix-H: Likewise.
1429         * tests/chgrp/recurse: Likewise.
1430
1431 2005-01-15  Jim Meyering  <jim@meyering.net>
1432
1433         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1434         because just calling gethrtime evokes an `illegal instruction'
1435         failure when compiled with Sun's c89 on Solaris 8 and 9.
1436         Reported by Nelson Beebe.
1437
1438         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1439         twice with the same value of `t'.
1440         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1441
1442 2005-01-14  Jim Meyering  <jim@meyering.net>
1443
1444         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1445         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1446         sockets, since that's what you get when reading from a command-line-
1447         supplied pipe on Darwin 7.7.
1448         (IS_PIPE_LIKE_FILE_TYPE): Define.
1449         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1450         Reported by Nelson Beebe.
1451         This same change is also required on NetBSD/sparc-1.5.
1452         Reported by Adrian Bunk.
1453
1454         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1455         rather than suffering silently.
1456         Before, expr would silently overflow and wrap around:
1457           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1458           1
1459         Now it detects the problem and exits nonzero:
1460           $ ./expr $(echo 2^63|bc) = 0
1461           ./expr: 9223372036854775808: integer is too large
1462
1463         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1464         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1465         reported that this test would fail with the diagnostic,
1466         `cannot find name for group ID 10', on one of his systems.
1467
1468 2005-01-13  Jim Meyering  <jim@meyering.net>
1469
1470         * src/test.c (is_int): Don't overflow when evaluating integer
1471         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1472         would print `FAIL'.
1473
1474         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1475         names of temporary files that would clash on 8.3 file systems.
1476         * tests/mk-script (validate): Likewise.
1477
1478 2005-01-12  Jim Meyering  <jim@meyering.net>
1479
1480         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1481
1482         * tests/tr/Test.pm (repeat-xC): Change test name from
1483         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1484         Reported by Eric Blake.
1485         (repeat-000): Rename to `repeat-zeros' for the same reason.
1486
1487 2005-01-11  Jim Meyering  <jim@meyering.net>
1488
1489         * configure.ac: Update version to 5.3.1.
1490
1491 2005-01-11  Eric Blake  <ebb9@byu.net>
1492
1493         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1494         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1495
1496 2005-01-11  Jim Meyering  <jim@meyering.net>
1497
1498         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1499         with decreasing values.
1500
1501         * src/expand.c (main): Likewise.
1502         * src/unexpand.c (main): Check for overflow in tabstop values
1503         specified via the obsolete form.  E.g., now this command fails:
1504         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1505         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1506         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1507
1508 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1509
1510         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1511         * NEWS: Document the changes.
1512         * doc/coreutils.texi (pathchk invocation): Likewise.
1513         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1514         (longopts, usage, main, validate_file_name):
1515         Add support for new -P option.
1516         Reject empty file names (unless -p is not specified and the
1517         current system allows empty file names).
1518         Change --portability so that is now equivalent to -p -P.
1519         Don't test whether file name is too long, if it is known to exist.
1520         (no_leading_hyphen): New function.
1521         * tests/misc/pathchk1: Add tests for empty file names and
1522         pathchk -P.
1523
1524 2005-01-08  Jim Meyering  <jim@meyering.net>
1525
1526         * Version 5.3.0.
1527
1528         `pr --columns=N' was not equivalent to `pr -N' when also using
1529         either -s or -w.
1530
1531         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1532         not just for -N.  This bug has existed since the introduction
1533         of the --columns=N option on 1998-08-15.
1534         * NEWS: Document this.
1535         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1536         create a new test vector using --columns=N.
1537
1538 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1539
1540         * src/pr.c (main): Check for column count overflow with
1541         usages like "pr -2147483648".
1542
1543 2005-01-07  Jim Meyering  <jim@meyering.net>
1544
1545         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1546
1547 2005-01-06  Jim Meyering  <jim@meyering.net>
1548
1549         * README: List the precise HP-UX version numbers that are affected.
1550         Suggestion from Bob Proulx.
1551
1552         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1553         predicate before `-name ChangeLog' to avoid a harmless warning
1554         from find-4.2.10.
1555
1556 2005-01-05  Jim Meyering  <jim@meyering.net>
1557
1558         * tests/help-version: Punt on the uptime test, since it fails when
1559         it can't get boot time, and I don't want that to stop `make check'.
1560
1561         * src/du.c (process_file): Evaluate exclusion rules against
1562         the entire file name, not just the last component.
1563         Reported by Robert Lindgren.
1564         * tests/du/exclude: Test for this.
1565         * NEWS: Document this.
1566
1567         Ensure that tests/Makefile.am's check-root actions stay up to date.
1568         * Makefile.maint (sc_root_tests): New rule.
1569         (syntax-check-rules): Add it to the list.
1570
1571 2005-01-04  Jim Meyering  <jim@meyering.net>
1572
1573         * man/shred.x: Change one-line summary to reflect that shred does
1574         not remove files by default.  Suggestion from Helen Faulkner in
1575         http://bugs.debian.org/288552
1576
1577         * README: Request VERBOSE=yes output when reporting test failures.
1578         Other minor changes.
1579
1580         * tests/Makefile.am (check-root): Update.
1581
1582 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1583
1584         * src/system.h: Undo previous change; we now use Autoconf.
1585
1586 2005-01-03  Jim Meyering  <jim@meyering.net>
1587
1588         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1589         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1590         either (or both) to zero would succeed, but subsequent `stty size'
1591         would say `no size information for this device' due to the ioctl
1592         failing with EINVAL.
1593
1594         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1595         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1596         then fail at compile-time rather than let tools like od produce
1597         invalid results at run time.
1598
1599 2004-12-21  Jim Meyering  <jim@meyering.net>
1600
1601         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1602         not `xx01, xx02, ...'.
1603         Reported by Matt Kraai in http://bugs.debian.org/286605
1604
1605         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1606         when using c89.
1607
1608 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1609
1610         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1611
1612 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1613
1614         * NEWS: Mention that one should eval "`dircolors`" rather than
1615         `dircolors`.
1616
1617 2004-12-17  Jim Meyering  <jim@meyering.net>
1618
1619         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1620         so temporary directories aren't left behind upon e.g., interrupt.
1621
1622 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1623
1624         * src/ls.c (print_dir): Use "%s: not listing already-listed
1625         directory", not "not listing already-listed directory: %s", to
1626         format already-listed directories, to be consistent with other
1627         diagnostics involving file names and colons.
1628
1629 2004-12-15  Jim Meyering  <jim@meyering.net>
1630
1631         * src/Makefile.am (__LDADD): Define, so that building `[' on
1632         Solaris still uses the -lgen library that it requires in order
1633         to get a definition of eaccess.
1634
1635 2004-12-14  Jim Meyering  <jim@meyering.net>
1636
1637         tac would exit immediately upon I/O or temp-file creation failure.
1638         Now it continues on, processing any remaining command line arguments.
1639
1640         * src/tac.c: Include quotearg.h.
1641         Use quotearg_colon in most diagnostics.
1642         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1643         failure.  Before, this command (with /full/tmp being a full partition)
1644           TMPDIR=/full/tmp ./tac /proc/modules tac.c
1645         would exit immediately upon the write error while trying to copy
1646         non-seekable /proc/modules to the full partition.  Now it still
1647         reports the failure but continues on with the remaining file.
1648         (tac_nonseekable): Return false also if copy_to_temp fails.
1649         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1650         using atexit like this is wrong.
1651         * NEWS: Document this.
1652         * tests/misc/tac-continue: New test for this.
1653         * tests/misc/Makefile.am (TESTS): Add tac-continue.
1654
1655         * tests/chown/basic: Add a few more tests.
1656
1657 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
1658
1659         * src/ls.c (gobble_file): Change arg name to be command_line_arg
1660         rather than explicit_arg, for consistency with copy.c.
1661         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1662         it is deducible from dirname arg.  All callers changed.
1663         (extract_dirs_from_files, print_dir, queue_directory):
1664         Add command_line_arg arg.  All callers changed.
1665         (struct pending): Add command_line_arg member.
1666         (main): Use NULL rather than 0 when appropriate.
1667         (set_exit_status, file_failure): New functions.
1668         (queue_directory): Store command_line_arg into new structure.
1669         (print_dir, gobble_file, get_link_name):
1670         Use file_failure to report problems in accessing files,
1671         so that the exit status is set consistently.
1672         (print_dir): Simplify readdir failure code yet again.
1673         If closedir fails, report "closing directory" rather than "reading
1674         directory" failure.
1675         (xstrcoll): Use set_exit_status to set status on failure.
1676         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1677         not status 1.
1678
1679 2004-12-11  Jim Meyering  <jim@meyering.net>
1680
1681         Avoid a race condition vulnerability in chown, when used with
1682         --from=O:G and without the (-h) --no-dereference option.
1683         * src/chown-core.c (restricted_chown): New function.
1684         (change_file_owner): Call it.
1685         Reported by Ulrich Drepper.
1686         * NEWS: Mention this.
1687
1688 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
1689
1690         * ls now exits with status 1 on minor problems, 2 if serious trouble.
1691         * NEWS: Document this.
1692         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1693         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1694         specified below.
1695         (main): Initialize exit failure to LS_FAILURE.
1696         (print_dir, gobble_file, get_link_name, xstrcoll):
1697         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1698         (print_dir): Do not give up on entire directory merely because readdir
1699         returns EOVERFLOW.
1700         (usage): Explain exit status.
1701         * tests/help-version: ls and variants now exit with status 2
1702         on serious trouble.
1703
1704 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
1705
1706         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1707         together.
1708
1709 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
1710
1711         * src/factor.c (factor): Don't list 1 as a factor of 1.
1712         Problem reported by Thomas Folz-Donahue.
1713
1714 2004-12-06  Jim Meyering  <jim@meyering.net>
1715
1716         * tests/du/files0-from: Sanitize environment.
1717         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1718         setting is the default (exported from /etc/profile) on at least one
1719         NetBSD 1.6 system.
1720         * tests/du/no-deref: Likewise.
1721         * tests/cp/symlink-slash: Likewise.
1722         * tests/ls/symlink-slash: Likewise
1723
1724 2004-12-05  Jim Meyering  <jim@meyering.net>
1725
1726         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1727         _POSIX2_VERSION=199209 is in the environment, or when building on
1728         e.g., OpenBSD 3.2.
1729
1730 2004-12-04  Jim Meyering  <jim@meyering.net>
1731
1732         * NEWS: Mention cut's new --complement option.
1733
1734 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
1735
1736         * cut.c (complement, COMPLEMENT_OPTION): New.
1737         (longopts): Add --complement.
1738         (usage): Say not that -b, -c, and -f `print' fields,
1739         but rather that they `select' fields for printing.
1740         Describe the new --complement option.
1741         (mark_range_start): Extracted from set_fields.
1742         (print_kth): Support --complement.
1743         (compare_ranges): New function.
1744         (set_fields): Rewrite the part that populates range_start_ht,
1745         merging it with the part that populates printable_field.
1746         (main): Handle --complement.
1747
1748 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
1749
1750         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1751         failed.  This works around an assertion failure reported by
1752         Roberto Nibali in:
1753         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1754
1755 2004-12-02  Jim Meyering  <jim@meyering.net>
1756
1757         With using --color and with LS_COLORS saying not to color
1758         executables, don't stat every file.
1759         * src/ls.c (is_colored): New function.
1760         (gobble_file): Use it.
1761         (main): Use it here, in place of too-strict tests against NULL:
1762         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1763         old test would fail.
1764
1765 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
1766
1767         * src/comm.c (compare_files): Assume setlocale exists.
1768         * src/join.c (keycmp): Likewise.
1769         * src/seq.c (decimal_point): Treat like sort.  Now char.
1770         All uses changed.
1771         (main): Assume localeconv exists.  Use same code as sort.
1772         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
1773         Assume setlocale exists.
1774         (thousands_sep): Renamed from th_sep.
1775         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
1776         (NONZERO): Parenthesize use of arg.
1777         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
1778         consistency.  Avoid unnecessary negation by reversing
1779         fraccompare args.
1780         (main): Rewrite localeconv call to match seq.c.
1781         * src/system.h: Assume locale.h exists.
1782         (HAVE_SETLOCALE): Remove.
1783         * src/uniq.c (different): Assume setlocale exists.
1784
1785         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
1786         'volatile' on a local variable.  Rewrite to avoid unnecessary
1787         double-assignment to 'func' in the usual case where strcoll does
1788         not fail.
1789
1790 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
1791
1792         * src/pinky.c (gethostname): Remove decl.
1793         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1794         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1795         UT_TYPE_BOOT_TIME instead of by-hand code.
1796         * src/users.c (list_entries_users): Use IS_USER_PROCESS
1797         instead of by-hand code.
1798         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1799         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1800         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1801         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1802         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1803         (gethostname): Remove decl.
1804         (list_entries_who, scan_entries): Use the new macros defined above,
1805         for consistency with pinky, uptime, and users.
1806
1807 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
1808
1809         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1810         HP's ANSI C compiler.  Declaring int functions causes warnings on
1811         some modern systems and shouldn't be needed to compile on ancient
1812         ones.
1813         * src/copy.h (stat, lstat, rename): Remove decls.
1814         * src/install.c (stat): Remove decl.
1815         * src/ln.c (link, symlink): Remove decls.
1816
1817 2004-11-25  Jim Meyering  <jim@meyering.net>
1818
1819         * man/help2man: Import help2man-1.35.1.
1820         * man/Makefile.am (.x.1): Remove now-unnecessary use of
1821         locally-added --program-name=NAME option.  Now, help2man gets
1822         the name from the [NAME] section (i.e. from our .x file).
1823         * man/install.x: Use `install', not `ginstall' in the one-line
1824         description.  Reported by Brendan O'Dea.
1825         * man/sha1sum.x: Use `sha1sum', not `shasum'.
1826
1827 2004-11-24  Jim Meyering  <jim@meyering.net>
1828
1829         Since the changes of 2004-05-22, the u.saved_cwd member at
1830         the bottom of the active-directory stack was no longer
1831         strictly necessary.  This change removes that member and uses
1832         the newer cwd_state parameter for the final restore_cwd.
1833
1834         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1835         [dev_ino]: Rename from `a'.
1836         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1837         bottom-of-stack cwd-state member.
1838         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
1839         (AD_push_initial): Remove CWD parameter.  Adjust caller.
1840
1841 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
1842
1843         Minor performance improvements and cleanups for "touch".
1844         * src/touch.c (posix_date): Remove; not needed as a static var.
1845         All uses rewritten.
1846         (touch): Use new futimens function to operate more efficiently
1847         in some cases.  Don't stat/fstat existing file when
1848         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1849         old time stamps aren't needed in that case.
1850         (main): change_times is int, not bool.  Simplify test for
1851         change_times.
1852
1853 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
1854
1855         * src/install.c (usage): Avoid usage that runs afoul of Docbook
1856         translation.  Problem reported by Eric S. Raymond.
1857
1858         Restore dd's noctty flag, reverting the change of 2004-04-08.
1859         POSIX does not allow "dd" to use O_NOCTTY by default.
1860         * NEWS: Add noctty flag to dd.
1861         * doc/coreutils.texi (dd invocation): Likewise.
1862         * src/dd.c (flags, usage, main): Likewise.
1863
1864 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
1865
1866         * src/ls.c (usage): Clarified description of --no-group (-G),
1867         --human-readable (-h), --inode (-i), --size (-s), --time,
1868         and --time-style.
1869
1870 2004-11-19  Jim Meyering  <jim@meyering.net>
1871
1872         * src/ls.c (usage): Clarify description of --author.
1873         Tweak indentation so that help2man creates better nroff.
1874         Reported by Dan Jacobson.
1875
1876         * src/uniq.c (check_file): Don't check stdout for errors here.
1877
1878         * src/pwd.c (find_dir_entry): Update comment to match reality.
1879
1880 2004-11-18  Jim Meyering  <jim@meyering.net>
1881
1882         * src/pwd.c (robust_getcwd): Correct the comment: this function
1883         constructs the directory name.  The caller prints it.
1884
1885 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
1886
1887         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1888         (do_statfs): Use it.
1889
1890         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1891         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1892         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1893         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1894         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1895         * src/readlink.c (main): argv is not const.
1896
1897         * src/cut.c (usage): Improve documentation along the lines suggested
1898         by Debian 5.2.1-2.
1899         * src/echo.c (usage): Likewise.
1900         * src/expr.c (usage): Likewise.
1901
1902         * src/dircolors.hin: Add putty, screen-bce.
1903
1904         * src/pinky.c (print_entry): Fix memory leak.
1905         * src/who.c (print_user): Likewise.
1906
1907 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
1908
1909         * NEWS: New dd operand "status=noxfer".
1910         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1911         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1912         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1913         macros.
1914         (STATUS_NOXFER, statuses): New constants.
1915         (usage, print_stats, scanargs): Add support for status=noxfer.
1916         (usage): Update status output to match new behavior.
1917         (print_stats): Always output complete byte count.
1918         Put space between numbers and units, as SI requires.
1919         Use ngettext so that i18n can use plurals for "byte" and "second".
1920         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1921         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1922         the string.
1923         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1924         problems with regression testing.
1925
1926 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
1927
1928         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1929         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1930         * src/dd.c: Include "human.h".
1931         (w_bytes, start_time): New vars.
1932         (usage): Document new I/O statistics output
1933         (print_stats): Output new I/O statistics.
1934         (cleanup): Do statistics after closing stdin and stdout, so that
1935         the times are more accurate.
1936         (write_output, dd_copy): Count output bytes.
1937         (main): Get initial value of clock.
1938
1939 2004-11-14  Jim Meyering  <jim@meyering.net>
1940
1941         Backslash-escape `-'s in email addresses, so that they are
1942         rendered properly in UTF-locales.
1943         * man/help2man (escape_hyphens): New function.
1944         (main): Call it on email addresses.
1945
1946         * src/sort.c (zaptemp): Mark new diagnostic for translation.
1947
1948         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
1949         * tests/misc/Makefile.am (TESTS): Add close-stdout.
1950
1951 2004-11-13  Jim Meyering  <jim@meyering.net>
1952
1953         * src/test.c (usage): Put the description of `[-n] STRING'
1954         on two lines, one for `-n STRING' and one for `STRING' so that
1955         help2man properly escapes the `-'.  Otherwise, the hyphen is
1956         rendered inappropriately in UTF-8 locales.
1957         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1958
1959 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
1960
1961         * NEWS: Document the following changes.
1962
1963         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1964         files.
1965         (temptail): New variable, so that we can easily append to list.
1966         (create_temp_file): Create new files at end of list, so that
1967         searching the list has O(N*NMERGE) behavior instead of O(N**2).
1968         (zaptemp): Update temptail if needed.
1969         (mergefps, merge): Accept new arg that counts temp files, and keep it
1970         up to date as we create and remove temporaries.  This is for
1971         efficiency, so that we don't call zaptemp so often.
1972         All callers changed.
1973         (sort): Don't create array in reverse order, since the list of
1974         temporaries is now in the correct order.
1975
1976         (zaptemp): Protect against race condition: if 'sort' is
1977         interrupted in the middle of zaptemp, it might unlink the
1978         temporary file twice, and the second time this happens the file
1979         might already have been created by some other process.
1980
1981         (zaptemp): Warn if a temporary file is not removed.
1982
1983         (create_temp_file): Use offsetof for clarity.
1984         (die): Move it up earlier, to clean up the code a bit.
1985
1986         * src/pr.c (strtoumax): Declare if not declared.
1987         (skip_to_page, first_page_number, last_page_number, page_number,
1988         first_last_page, print_header):
1989         Use uintmax_t for page numbers.
1990         (first_last_page): Remove unnecessary forward declaration.
1991         Do not modify arg (it is now a const pointer).
1992         Return a true if successful, false (without print a diagnostic)
1993         otherwise.
1994         (main): If +XXX does not specify a valid page range, treat it
1995         as a file name.  This follows the response to Open Group XCU ERN 41
1996         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1997         which says the behavior is allowed.
1998         (skip_to_page): When starting page number exceeds page count,
1999         print both numbers in the diagnostic.
2000         (print_header): Detect page number overflow.
2001
2002 2004-11-07  Jim Meyering  <jim@meyering.net>
2003
2004         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
2005         (main) [__APPLE__]: Get the processor type via syscall rather than
2006         hard-coding "powerpc".  From Toby Peterson.
2007
2008         * src/sort.c (merge): Remove declarations of now-unused variables.
2009
2010 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
2011
2012         * src/sort.c (first_same_file): Remove.  Move most of the code to....
2013         (avoid_trashing_input): New function.
2014         (merge): Avoid some silly merges, e.g., copying a single file to
2015         a temporary file when there are exactly 17 input files to merge.
2016         Take a count of temporary files rather than a max_merge arg.
2017         All uses changed.
2018
2019 2004-11-06  Jim Meyering  <jim@meyering.net>
2020
2021         * src/sort.c (xfclose): Don't close stdout here (just flush it),
2022         since close_stdout now closes stdout unconditionally.
2023
2024 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
2025
2026         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
2027         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
2028         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
2029         temporary files).
2030         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
2031         thus avoiding unchecked stack overflow in some cases.  As a side
2032         effect this improve the performance of "sort -M" by a factor of 4
2033         on my benchmarks.
2034
2035 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
2036
2037         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
2038
2039         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
2040         expression; it's not portable.  Problem reported by Albert Chin.
2041         Don't invoke a program more than once.
2042         * src/groups.sh (version): New variable, containing author info,
2043         for benefit of AUTHORS check.  Use it when acting on --version option.
2044         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
2045         in groups line.
2046
2047         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
2048         as this breaks the new regime that does "#define getopt rpl_getopt".
2049         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
2050         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
2051         I suppose this may cause problems on ancient hosts with
2052         incompatible getopt declarations, but we'll cross that bridge if
2053         the problem gets reported to us by someone who can test the fix.
2054
2055 2004-11-03  Jim Meyering  <jim@meyering.net>
2056
2057         * src/tac.c: quote(...) file names in diagnostics.
2058
2059 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
2060
2061         * NEWS: Document getdate changes.
2062
2063 2004-10-29  Jim Meyering  <jim@meyering.net>
2064
2065         * src/tac.c (tac_file): Remove temporary prototype and move this
2066         function `down' so that it precedes definition of tac_nonseekable.
2067
2068         `tac /proc/modules' would print nothing
2069         Reported by Harald Dunkel in http://bugs.debian.org/278604.
2070
2071         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
2072         now it copies a general file descriptor, not just stdin.
2073         (tac_nonseekable): Renamed/adapted from tac_stdin.
2074         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
2075         since we never used the stream.  Perform "-" to stdin mapping here
2076         rather than in main.  Determine whether a file is seekable,
2077         by trying to `lseek' to its end, and dispatch to tac_seekable or
2078         tac_nonseekable accordingly.
2079         (main): Rewrite argument handling now that it uses only tac_file.
2080         * NEWS: Mention it here.
2081
2082 2004-10-21  Jim Meyering  <jim@meyering.net>
2083
2084         * tests/mv/leak-fd: New file.
2085         * tests/mv/Makefile.am (TESTS): Add it.
2086         * tests/rm/dot-rel: New file.
2087         * tests/rm/Makefile.am (TESTS): Add it.
2088
2089         Correct my patch of 2004-10-18.
2090         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
2091         if necessary, not in remove_dir.  Otherwise, removing multiple
2092         `.'-relative nonempty directories no longer worked.
2093
2094 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
2095
2096         * src/fmt.c (usage): Improve description of --prefix.
2097         Problem reported by Edward Welbourne.
2098
2099         * man/uniq.x: Change summary so that it doesn't imply that
2100         uniq writes to its input file.  Problem reported by
2101         Dan Jacobson.
2102
2103 2004-10-18  Jim Meyering  <jim@meyering.net>
2104
2105         Plug a leak that would cause a cross-device mv to fail when
2106         operating on too many command-line-specified nonempty directories.
2107         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
2108         top of the stack before returning.  This usually closes the file
2109         descriptor that was used to return to the original working directory.
2110         Reported by Cyril Bouthors in
2111         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
2112         * NEWS: Mention it here.
2113
2114         * src/pathchk.c (validate_file_name): Give a more descriptive
2115         diagnostic when pathconf fails.  This also avoids an unwarranted
2116         warning from gcc-3.3.5 about a format not being a string literal.
2117
2118         * src/sleep.c (main): Remove declaration of unused local, c.
2119         * src/printenv.c (main): Likewise.
2120         * src/logname.c (main): Likewise.
2121         * src/uptime.c (main): Likewise, for optc.
2122         * src/tsort.c (main): Likewise, for opt.
2123
2124 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
2125
2126         * AUTHORS: Add self to pathchk.
2127         * src/pathchk.c (AUTHORS): Add self.
2128         Change "path" to "file name" whenever possible.
2129         Remove usage comment, as it was a duplication of the code or doc.
2130         Include <wchar.h> if available.
2131         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
2132         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
2133         pathconf_wrapper, portable_chars, dir_ok): Remove.
2134         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
2135         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
2136         (portable_chars_only): New arg FILELEN.
2137         Don't assume ASCII; we might be on an EBCDIC host.
2138         Don't assume unibyte locale in diagnostic.
2139         (component_start, component_len): New functions.
2140         (validate_file_name): Renamed from validate_path.  All uses changed.
2141         Pretty much a complete rewrite.
2142         Don't make copy of file arg.  Always append trailing slash to
2143         pathconf arg, just in case it's a symlink (this is pure paranoia;
2144         we don't know of any hosts where the trailing slash is required).
2145         Use size_t instead of long int when possible.
2146         Avoid need to call pathconf in most practical cases.
2147         Don't use euidaccess several times to test searchability;
2148         just use lstat once.  Reword diagnostic to put the (often very long)
2149         file names last.
2150
2151 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
2152
2153         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
2154
2155 2004-10-13  Jim Meyering  <jim@meyering.net>
2156
2157         * NEWS: Mention today's fts.c fix.
2158
2159 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
2160
2161         * tests/stty/row-col-1: Set LC_ALL=C.
2162
2163 2004-10-12  Jim Meyering  <jim@meyering.net>
2164
2165         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
2166         From Jesus Climent in http://bugs.debian.org/276149.
2167
2168 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
2169
2170         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
2171         problems.  All uses changed.
2172
2173 2004-10-05  Jim Meyering  <jim@meyering.net>
2174
2175         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
2176         since Karl says its trailing blanks are there to stay :-)
2177
2178 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
2179
2180         * src/expr.c (NEW, OLD): Remove, partly to avoid
2181         reference to obsolescent macro XMALLOC.
2182         All uses replaced by xmalloc and free.
2183
2184 2004-09-28  Jim Meyering  <jim@meyering.net>
2185
2186         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
2187         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2188
2189 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
2190
2191         * src/od.c (format_address_paren): c is optional, so don't output
2192         it if it's '\0'.
2193
2194 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
2195
2196         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
2197         * NEWS: Document this.
2198         * src/ls.c (file_ignored): Renamed from file_interesting, with
2199         inverted return value.  Accept the file name, not a struct dirent *.
2200         All uses changed.  Avoid the expense of calling fnmatch if the
2201         file is ignorable due to leading '.'.
2202         (all_files, really_all_files): Removed; replaced by:
2203         (ignore): New variable.  All uses changed.
2204         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
2205         New constants.
2206         (hide_patterns): New variable.
2207         (long_options, decode_switches, file_ignored, usage):
2208         Add support for --hide.
2209         (patterns_match): New function.
2210         (usage): Replace "hide" with "ignore" in explanation, to avoid
2211         confusion.
2212
2213 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
2214
2215         * src/ls.c (gobble_file, print_long_format): Don't assume that
2216         human-readable output has a byte count equal to its column width;
2217         this isn't always true in locales where the radix character is not
2218         '.' or ','.
2219         (format_user_or_group): Revamp code to match the above fix;
2220         this avoids the (very faint) possibility of integer overflow.
2221
2222 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
2223
2224         * NEWS: Mention that "chmod -r -w x" now works as expected.
2225         * src/chmod.c (main): Revamp option processing to support this.
2226         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
2227         * tests/chmod/usage: New set of tests for usage like that.
2228
2229 2004-09-24  Jim Meyering  <jim@meyering.net>
2230
2231         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
2232         it lists only cvs-controlled regular files.
2233
2234         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2235         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
2236
2237 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
2238
2239         * Makefile.maint (CVS_LIST): New macro.
2240         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2241         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2242         sc_trailing_blank, po-check): Use it instead of the
2243         nonstandard "cvsu --list".
2244
2245         * src/tail.c (parse_obsolete_option): Bring back support
2246         for obsolete option followed by non-obsolete, or by more
2247         than one file.  When obsolete, conform to SUSv2 rather than
2248         original POSIX 1003.2-1992, as SUSv2 corrected the case of
2249         "tail -c".  Add support for the SUSv2 "b" modifier.
2250         * NEWS: Mention the above.
2251         * tests/tail/Test.pm: New test case obs-b to check the above.
2252         err-[134] no longer need _POSIX2_VERSION=199209.
2253         Fix comments to match revised behavior.
2254
2255 2004-09-22  Jim Meyering  <jim@meyering.net>
2256
2257         * Use automake-1.9.2.  Regenerate dependent files.
2258
2259         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2260         Improve the comment.
2261
2262         Clean up scoping etc. so that some make `distcheck' tests pass.
2263         * src/csplit.c (xalloc_die): Declare to be static.
2264         * src/chown-core.c (chown_files): Declare as `extern'.
2265         * src/cp-hash.c (remember_created): Likewise.
2266         * src/copy.c (copy): Likewise.
2267         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2268
2269         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2270         * src/unexpand.c: Likewise.
2271
2272         * src/Makefile.am (check-AUTHORS): New rule.
2273         (check): Depend on it.
2274         * AUTHORS: Update.
2275
2276         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2277         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2278
2279 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2280
2281         * src/ls.c (decode_switches): Don't compare a short value
2282         to SIZE_MAX: GCC sometimes complains.
2283
2284 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2285
2286         * NEWS: The following commands now reject unknown options:
2287         basename dirname factor hostname link nohup sync unlink yes
2288         Also, pathchk no longer accepts trailing options.
2289
2290         * src/basename.c: Include <getopt.h>.
2291         * src/chroot.c: Likewise.
2292         * src/dirname.c: Likewise.
2293         * src/factor.c: Likewise.
2294         * src/hostid.c: Likewise.
2295         * src/hostname.c: Likewise.
2296         * src/nohup.c: Likewise.
2297         * src/pwd.c: Likewise.
2298         * src/setuidgid.c: Likewise.
2299         * src/sync.c: Likewise.
2300
2301         * src/basename.c (main): Reject unknown options.
2302         * src/dirname.c (main): Likewise.
2303         * src/factor.c (main): Likewise.
2304         * src/hostid.c (main): Likewise.
2305         * src/hostname.c (main): Likewise.
2306         * src/link.c (main): Likewise.
2307         * src/nohup.c (main): Likewise.
2308         * src/pwd.c (main): Likewise.
2309         * src/setuidgid.c (main): Likewise.
2310         * src/sync.c (main): Likewise.
2311         * src/unlink.c (main): Likewise.
2312         * src/yes.c (main): Likewise.
2313
2314         * src/cat.c (main): Remove unused "case 0".
2315         * src/chgrp.c (main): Likewise.
2316         * src/chmod.c (main): Likewise.
2317         * src/chown.c (main): Likewise.
2318         * src/comm.c (main): Likewise.
2319         * src/cp.c (main): Likewise.
2320         * src/csplit.c (main): Likewise.
2321         * src/cut.c (main): Likewise.
2322         * src/date.c (main): Likewise.
2323         * src/df.c (main): Likewise.
2324         * src/du.c (main): Likewise.
2325         * src/env.c (main): Likewise.
2326         * src/expand.c (main): Likewise.
2327         * src/fold.c (main): Likewise.
2328         * src/head.c (main): Likewise.
2329         * src/id.c (main): Likewise.
2330         * src/install.c (main): Likewise.
2331         * src/join.c (main): Likewise.
2332         * src/ln.c (main): Likewise.
2333         * src/ls.c (decode_switches): Likewise.
2334         * src/mkdir.c (main): Likewise.
2335         * src/mkfifo.c (main): Likewise.
2336         * src/mknode.c (main): Likewise.
2337         * src/mv.c (main): Likewise.
2338         * src/nl.c (main): Likewise.
2339         * src/paste.c (main): Likewise.
2340         * src/pinky.c (main): Likewise.
2341         * src/pr.c (main): Likewise.
2342         * src/ptx.c (main): Likewise.
2343         * src/readlink.c (main): Likewise.
2344         * src/rm.c (main): Likewise.
2345         * src/rmdir.c (main): Likewise.
2346         * src/seq.c (main): Likewise.
2347         * src/shred.c (main): Likewise.
2348         * src/split.c (main): Likewise.
2349         * src/sum.c (main): Likewise.
2350         * src/tac.c (main): Likewise.
2351         * src/tail.c (main): Likewise.
2352         * src/tee.c (main): Likewise.
2353         * src/touch.c (main): Likewise.
2354         * src/tr.c (main): Likewise.
2355         * src/tty.c (main): Likewise.
2356         * src/uname.c (main): Likewise.
2357         * src/unexpand.c (main): Likewise.
2358         * src/wc.c (main): Likewise.
2359         * src/who.c (main): Likewise.
2360
2361         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2362         * src/cksum.c (main): Likewise.
2363         * src/dd.c (main): Likewise.
2364         * src/logname.c (main): Likewise.
2365         * src/printenv.c (main): Likewise.
2366         * src/sleep.c (main): Likewise.
2367         * src/tsort.c (main): Likewise.
2368         * src/uptime.c (main): Likewise.
2369         * src/users.c (main): Likewise.
2370         * src/whoami.c (main): Likewise.
2371
2372         * src/du.c (long_options): Standardize on NULL vs 0.
2373         * src/rm.c (long_opts): Likewise.
2374
2375         * src/logname.c (long_options): Remove.
2376         * src/printenv.c (long_options): Likewise.
2377         * src/sleep.c (long_options): Likewise.
2378         * src/tsort.c (long_options): Likewise.
2379         * src/uptime.c (longopts): Likewise.
2380         * src/users.c (longopts): Likewise.
2381         * src/whoami.c (long_options): Likewise.
2382
2383         * src/pathchk.c (longopts): Add --help, --version.
2384         (main): Use longopts rather than parse_long_options.
2385         * src/stty.c (longpts, main): Likewise.
2386
2387         * src/pathchk.c (main): Don't reorder arguments, so that
2388         we can check weird file names.
2389
2390         * src/readlink.c: Don't include "long-options.h".
2391         * src/sort.c: Likewise.
2392         * src/stty.c: Likewise.
2393
2394         * src/split.c (verbose): Now bool, not int.
2395         (VERBOSE_OPTION): New enum.
2396         (longopts, main): Use it.
2397
2398         * tests/factor/basic: Adjust to new wording in diagnostic
2399         that results from the above changes.
2400
2401 2004-09-21  Jim Meyering  <jim@meyering.net>
2402
2403         * man/rm.x: Say "the response is affirmative" rather than "the
2404         response begins with y or Y", so that the documentation is
2405         accurate in non-English locales.  Problem reported by Munzir Taha.
2406
2407 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2408
2409         * src/echo.c (main): Don't pass NULL to strcmp when
2410         POSIXLY_CORRECT and given no arguments.
2411
2412         * src/md5sum.c (STRING_OPTION): Remove.
2413         (long_options, main): Remove support for undocumented and
2414         obsolete --string option, as suggested in the 1996-09-26 patch.
2415         * NEWS: Document this.
2416
2417         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2418         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2419         you remove such files.  Problem reported by Bert Fischer in:
2420         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2421
2422 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2423
2424         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2425         (long_options, main): Use them instead of magic numbers 2 and 1.
2426         For --string, optarg can't possibly be NULL.
2427
2428         * src/dd.c (usage): Distinguish between options and operands.
2429         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2430         Say "operands" for operands, not "options".
2431         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2432         * tests/dd/misc: Check for "dd --".
2433
2434         * src/chroot.c (main): Reject unknown options instead of
2435         interpreting them as a directory to chroot to.
2436
2437         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2438         The current standard (POSIX 1003.1-2004) is correct.
2439         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2440         collision with builtin function.
2441         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2442         output the first 0 as 8 digits, to make it easier to compare to
2443         the text of the standard.  Output crctab to be a const array.
2444         (crctab): Use result of above changes.
2445         (long_options): Remove; not needed if empty.
2446         (main): getopt_long can't return 0 here, so simplify the code.
2447
2448 2004-09-13  Jim Meyering  <jim@meyering.net>
2449
2450         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2451
2452 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2453
2454         * src/id.c (print_full_info): Don't exit with failure status simply
2455         because a user or group number can't be turned into a name.
2456         Problem reported by Felipe Kellermann in:
2457         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2458
2459 2004-09-12  Jim Meyering  <jim@meyering.net>
2460
2461         * Makefile.maint (my-distcheck): When building with -Werror, also
2462         require -Wshadow.
2463
2464 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2465
2466         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2467         * src/tail.c (parse_obsolete_option): Renamed from
2468         parse_obsolescent_option, since the options are obsolete now.
2469         Remove bool *arg; just exit if there's an error.  Revamp to follow
2470         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2471         file" and "tail -10 -- file" correctly when we are conforming to
2472         the older standard.
2473         (main): Adjust to this change.
2474         * tests/tail/Test.pm (test_vector): minus-* requires
2475         _POSIX2_VERSION=199209 now, to work correctly if there is
2476         an input file.  err-1 and err-3 no longer errors if there
2477         is another file.
2478
2479 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2480
2481         * src/test.c (usage): Document -r, -w, -x more carefully.
2482
2483 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2484
2485         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2486         Document that -h and -L don't dereference.
2487
2488         * NEWS: Document that "tr xy -z" now works as per POSIX.
2489         Sort the descriptions.
2490         * src/tr.c (main): Don't reorder options.
2491         * tests/tr/Test.pm (fowler-1): New test case.
2492
2493 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2494
2495         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2496         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2497         conforming to pre-2001 POSIX.
2498         * NEWS: Document this.
2499         * tests/touch/obsolescent: Test for this bug.  Also, set
2500         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2501         a better test for obsolescent features.
2502
2503         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2504         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2505         plain "sort".
2506
2507         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2508         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2509         (long_options, main): --strings is now -S, not -s.
2510         (usage): Reflect the usage changes.
2511         (parse_old_offset): Do not issue a diagnostic on failure;
2512         callers now do this as necessary.
2513         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2514         Add support for new short options (many undocumented) for
2515         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2516         POSIX-compatible.  Default format is now oS, not o2.
2517         * NEWS: Describe the above.
2518
2519 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2520
2521         * src/stty.c (valid_options): Remove.
2522         (main): Fix some bugs in handling invalid option-combinations
2523         like "stty -F".
2524         (recover_mode): Arg is now char const *, not char *.
2525         (main): Use STDIN_FILENO, not 0.
2526         Simplify option-parsing code a tad.
2527         * tests/stty/basic-1: Check for the fixed bugs.
2528
2529 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2530
2531         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2532         it from ever being nonzero.  Reported by Pozsar Balazs in:
2533         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2534         (human_fstype): Add ramfs, squashfs, sysfs.
2535         Reported by Pozsar Balazs in:
2536         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2537         (human_fstype): Return char const *, not char *.
2538         Simplify internals a bit, and avoid casts.
2539
2540         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2541         (bit_count): Remove.  All uses changed to....
2542         (multiple_bits_set): New function.
2543         (scanargs): Use it, and check separately for each set of
2544         incompatible options, to improve diagnostics.
2545         (MX): Remove.
2546         (apply_translations): Move checks for incompatible options
2547         to scanargs, so that they're done consistently.
2548
2549 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2550
2551         Output correct errno-related diagnostic on "paste" I/O errors.
2552         * src/paste.c (write_error, xputchar): New functions.
2553         (paste_parallel): Use correct errno value after input error.
2554         (paste_parallel, paste_serial): Report errno value after output error.
2555
2556         Port to diet libc.  Problem reported by Felix von Leitner in:
2557         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2558         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2559         it's not portable C to assume FILE is a complete type.
2560         (paste_parallel): Use index test instead of ENDLIST, and NULL
2561         instead of CLOSED.
2562
2563 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2564
2565         POSIX-conformance fixes for "expand" and "unexpand".
2566         Also, consistently use "tab stop" rather than "tabstop".
2567         * NEWS: Document fixes.
2568         * src/expand.c: Revamp to resemble the new unexpand.c better.
2569         (usage): -i does not convert tabs after non-tabs.
2570         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2571         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2572         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2573         (next_file, main): Check fclose against 0, not EOF.
2574         (expand): Remove unnecessary casts.
2575         Add another loop nesting level, for lines, so that per-line variables
2576         are initialized cleanly.
2577         Revamp tab checking.  Check for write error immediately, rather
2578         than just once at the end of the program.
2579         * src/unexpand.c: Lkewise (for the expand.c changes).
2580         (TAB_STOP_SENTINEL): Remove.
2581         (tab_size): Now size_t, not uintmax_t, since we need to store
2582         the sequences of blanks.
2583         (max_column_width): New var.
2584         (usage): Say "blank" where POSIX requires this.
2585         (add_tab_stop): Calculate maximum column width.
2586         (unexpand): Store the pending blanks, instead of merely counting them.
2587         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2588         Get rid of internal label and goto.
2589         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2590         Add blanks-1 through blanks-13.
2591
2592 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2593
2594         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2595         succeed without changing the uid and gid, like FreeBSD.
2596         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2597         through a pointer.  Treat "chgrp '' file" as a no-op change,
2598         as FreeBSD does.
2599         (main): Set chopt.group_name to NULL if the group is the empty
2600         string.
2601         * src/chown-core.c (describe_change): Describe changes to -1:-1
2602         without using "to OWNERSHIP" phrase.
2603         * src/chown.c (usage): "chown '' file" is now allowed.
2604         (main): Do not set user name to the empty string if the group
2605         name is null.
2606         * tests/chgrp/basic: Test "chgrp '' file".
2607         * tests/chown/Makefile.am (TESTS): Add separator.
2608         * tests/chown/separator: New file, partly taken from
2609         Dmitry V. Levin's suggestion in
2610         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2611
2612 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2613
2614         * tests/install/basic-1: Test for the -d regression.
2615
2616 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2617
2618         * src/install.c (main): Fix -d regression introduced with
2619         --target-directory support at 2004-06-25.
2620
2621 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2622
2623         * src/copy.c (copy_internal): When preserving links, unlink
2624         a destination with link count greater than one.  This is so
2625         that commands like "cp -a" don't get confused when copying into
2626         a destination that already contains many hard links.  Problem
2627         reported by Tim Waugh in:
2628         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2629
2630 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
2631
2632         Convert all files to UTF-8.
2633         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2634         * tests/sort/Test.pm (16a): Likewise.
2635         * tests/uniq/Test.pm (8): Likewise.
2636         * tests/misc/printf-hex: Use ASCII, not Latin-1.
2637
2638         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2639         * src/shred.c (usage): "-" is an operand, not an option.
2640         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2641         A null file arg means standard output.
2642         (main): "-o -" means to write to a file named "-",
2643         not to standard output.
2644         * src/tee.c (usage, tee): "tee -" writes to standard output, not
2645         to a file named "-".
2646
2647 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
2648
2649         * src/install.c (change_timestamps): Fix int->bool conversion
2650         bugs introduced on 2004-07-29.
2651
2652 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
2653
2654         * src/shred.c (wipename): Work even if the directory is writeable
2655         and not readable.  Prefer write access, since this should work
2656         better with fdatasync.
2657
2658         * src/csplit.c (xalloc_die): New function.
2659         (main): Remove now-obsolete initialization of xalloc_fail_func.
2660
2661         * src/md5sum.c: Adjust to sha->sha1 renaming.
2662
2663 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
2664
2665         Minor code cleanup.
2666         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2667         (can_mode): Make variable local.
2668
2669 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
2670
2671         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2672         Do not define, to avoid annoying compiler messages on QNX 6.3.
2673         Problem reported by Johan in:
2674         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2675
2676 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
2677
2678         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2679         Define to a concatenation of string literals, not to an expression;
2680         needed for concatenation contexts.
2681         (INTMAX_MAX, INTMAX_MIN): New macros.
2682
2683         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2684         unsigned long; this isn't true for st_ino on Solaris 9.
2685
2686 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
2687
2688         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2689         whether to include files.  Include <sys/param.h> if
2690         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2691         (main) [defined __POWERPC__]: Add a kludge to work around a
2692         Mac OS X bug, so that uname -p defaults to "powerpc" if
2693         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2694         fails.  Problem reported by Petter Reinholdtsen in:
2695         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2696
2697         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2698         main): Use bool for booleans.
2699         (writeline, check_file): Use uintmax_t for line counts.
2700         (check_file): Check for and report line number overflow,
2701         when that matters.
2702         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2703         (print_lines, print_words, print_chars, print_bytes, print_linelength,
2704         have_read_stdin, wc, wc_file, main):
2705         Use bool for booleans.
2706         (exit_status): Remove.
2707         (wc, wc_file): Return bool status.  All callers changed.
2708         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2709         * src/whoami.c (main): Print uids using unsigned long int, not
2710         unsigned int.
2711
2712         * src/unexpand.c: Int cleanup and minor reorganization to be more
2713         like src/expand.c.
2714         Include quote.h, xstrndup.h.
2715         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2716         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2717         unexpand, main):
2718         Use bool for booleans.
2719         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2720         Use uintmax_t for column counts.
2721         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2722         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2723         as a tab stop.
2724         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2725         Detect overflow in tab stop string.
2726         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2727         (unexpand): Concatenate input files the same way expand does.
2728
2729         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2730         touch, main): Use bool for booleans.
2731         (main): Avoid integer overflow when given more than INT_MAX
2732         options.
2733         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2734         (have_read_stdin, count_items, scan_zeros, detect_loop,
2735         recurse_tree, walk_tree, tsort, main):
2736         Use bool for booleans.
2737         (exit_status): Remove.
2738         (tsort): Return a success flag instead of storing into a global.
2739         (main): Use it.
2740         * src/tty.c (silent, main): Use bool for booleans.
2741         (main): 0 -> STDIN_FILENO.
2742         * src/uname.c (print_element): Use bool for booleans.
2743
2744         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2745         Remove.  All uses replaced by C99 boolean primitives.
2746         (TEST_TRUE, TEST_FALSE): New constants, for readability.
2747         (test_unop, binop, unary_operator, binary_operator, two_arguments,
2748         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2749         one_argument, main): Use bool for booleans.
2750         (advance, unary_advance): Now inline procedures rather than a macros.
2751         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2752         (term, and, or): When it's easy, loop instead of recursing.
2753         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2754         (binary_operator, unary_operator): Simplify by systematically rewriting
2755         true==FOO to FOO (where FOO is a boolean).
2756         (unary_operator): Don't consider a file to be a regular file
2757         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
2758         Remove unnecessary casts.  Remove ifdefs for things like
2759         S_ISSOCK that are no longer needed, since stat-macros.h always
2760         defines them now.
2761
2762         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2763         Use bool for booleans.
2764         (buf_init_from_stdin, buf_free, find_bol, print_line):
2765         Use size_t for sizes.
2766         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2767         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2768         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2769         (tac_seekable): Use ptrdiff_t for pointer subtraction.
2770         Report an error if the result is out of range.
2771         (tac_seekable, main): Check for integer overflow in buffer size
2772         calculations.
2773         (main): Remove unnecessary casts.
2774
2775         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2776         the callee doesn't have to count 'em.  All callers changed.
2777         Don't allocate more space for the arg vector than we'll need.
2778         Use memcpy to copy the args rather than rolling our own loop.
2779         Use size_t for sizes.
2780         (fast_startup, simulate_login, change_environment, log_su,
2781         correct_password, restricted_shell, main): Use bool for booleans.
2782         (longopts): Don't assume change_environment is an int.
2783         Use NULL, not 0, for pointers.
2784         (xsetenv): New function, replacing xputenv and concat.
2785         All callers changed.
2786         (elements): Remove; no longer needed.
2787         (log_su, correct_passwd, main): Prefer !x to x==NULL.
2788         (log_su): 2 -> STDERR_FILENO.
2789         (modify_environment, main): Don't assume that getenv's returned value
2790         has an indefinite lifetime.
2791         (modify_environment): Allocate a larger environ.
2792         (main): Remove an impossible 'case 0'; if it happens now, it'll
2793         get diagnosed.  Don't assume getpwnam results outlive endpwent.
2794         Check for null or empty pw_name, pw_dir and for null pw_passwd.
2795
2796         * src/stty.c (VA_START): Remove.  All callers now use va_start.
2797         (_POSIX_VDISABLE): Remove unnecessary cast.
2798         (struct control_info, visible): Use cc_t for control chars.
2799         (struct control_info): Use size_t for sizes.
2800         (recover_mode, set_mode, display_speed, display_window_size,
2801         valid_options, main, display_changed):
2802         Use bool for booleans.
2803         (integer_arg): Return unsigned long int, not long int.
2804         Accept new max arg; all callers changed, to specify a maximum
2805         value for integer parameters instead of silently overflowing.
2806         (wrap): Do not overrun the stack buffer if the output contains
2807         more than 1024 bytes.  Instead, malloc a buffer.
2808         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
2809         Remove unnecessary casts.
2810         (set_control_char): Allow int values only up to cc_t range.
2811         (screen_columns): Don't reject INT_MAX.
2812         (display_changed, display_all, display_speed, recover_mode):
2813         Don't assume cc_t fits in int.
2814
2815         * src/remove.h: Add copyright notice.
2816         (struct rm_options): Use bool for booleans.
2817         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2818         errno_rmdir_non_empty, remove_parents, main): Likewise.
2819         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2820         main): Likewise.
2821         (main): Don't dump core if invoked with argv[0]==NULL.
2822         * src/tee.c (tee, append, ignore_interrupts, main, tee):
2823         Use bool for booleans.
2824         (tee): Use ssize_t for read returns.
2825
2826         * src/ptx.c: Add a FIXME mentioning that there are many
2827         unchecked integer overflows in this file.
2828         (gnu_extensions, auto_reference, input_reference, right_reference,
2829         ignore_case, initialize_regex, fix_output_parameters,
2830         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2831         Use bool for booleans.
2832         (SKIP_SOMETHING, compare_words, digest_break_file,
2833         find_occurs_in_text, fix_output_parameters):
2834         Use to_uchar instead of a caset.
2835         (print_field): Rewrite to avoid cast.
2836
2837         * src/printf.c (posixly_correct): Use bool for booleans.
2838         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2839         (STRTOX): Rewrite to avoid casts.
2840         (print_esc_char): Arg is char, not int.
2841         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
2842         can_mode.
2843         (no_newline, verbose): Use bool for booleans.
2844         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2845         * src/shred.c (struct Options, main): Use bool for booleans.
2846         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2847         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2848         Use bool for booleans.
2849         * src/stat.c (G_fail): Remove.
2850         (print_statfs): Print various gotta-be-nonnegative values using
2851         unsigned long int, not long int or int.
2852         (do_statfs, do_stat): Return a boolean success flag.
2853         (do_stat, main): Use bool for booleans.
2854
2855         * src/pr.c: Add a FIXME mentioning that there are many
2856         unchecked integer overflows in this file.
2857         (TRUE, FALSE): Remove.  All uses replaced by true and false.
2858         (struct COLUMN, read_line, print_page, print_stored, open_file,
2859         skip_to_page, init_fps, parallel_files, align_empty_cols,
2860         empty_line, FF_only, explicit_columns, extremities, keep_FF,
2861         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2862         print_across_flag, storing_columns, balance_columns,
2863         truncate_lines, join_lines, untabify_input, failed_opens,
2864         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2865         double_space, ignore_failed_opens, use_col_separator,
2866         pad_vertically, last_line, main, init_parameters, skip_read,
2867         read_line, print_stored):
2868         Use bool for booleans.
2869         (struct COLUMN, char_to_clump, store_char, print_char):
2870         Use char for chars.
2871         (clump_buff, print_clump): Use char[], not int[], for an array whose
2872         elements are always chars.
2873         (first_last_page, main, getoptarg, balance, add_line_number,
2874         char_to_uclump): Remove unnecessary casts.
2875         (init_parameters): Allocate chars, not ints, for clump_buff.
2876         (print_char): Use to_uchar before invoking ISPRINT.
2877         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2878
2879         * src/nohup.c (main): Use bool for booleans.
2880         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2881         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2882         (portable_chars_only): Use to_uchar rather than a cast.
2883         * src/printenv.c (main): Use bool for booleans.
2884         Do not assume that the environ has at most one matching entry
2885         for each option (integer overflow was possible otherwise).
2886
2887         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2888         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
2889         less.
2890         (struct tspec): Use it.  fmt_string is now an array, not
2891         a pointer, as there's little point to the indirection here.
2892         (struct tspec, flag_dump_strings,
2893         traditional, flag_pseudo_start, limit_bytes_to_format,
2894         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2895         decode_one_format, open_next_file, check_and_close,
2896         decode_format_string, skip, write_block, read_char, read_block,
2897         parse_old_offset, dump, dump_strings, main):
2898         Use bool for booleans.
2899         (struct tspec): Use void *, not char *, for generic pointers.
2900         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2901         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2902         Use char, not unsigned int, since char suffices.
2903         (print_s_char, print_char, print_s_short, print_short,
2904         print_int, print_long, print_long_long, print_float,
2905         print_double, print_long_double): Rewrite to avoid casts.
2906         These now take void * arguments, instead of char *.
2907         Use the same body for all functions, except for the choice
2908         of type.  Assume C89 to simplify handling of signed char.
2909         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2910         Rewrite to avoid casts.
2911         (print_named_ascii, print_ascii): Now takes void *, not char *.
2912         (decode_one_format): Use int for printf field widths, not
2913         unsigned int.  Pass void * to subsidiary printers,
2914         not char *.  Simplify handling of floating-point formats
2915         by factoring out common code dealing with precision and field width.
2916         (decode_format_string): Avoid need for temporary copy of
2917         each decoded struct tspec.
2918         (get_lcm): Remove unnecessary cast.
2919         (main): Fix bug where more than INT_MAX failed decodes were ignored.
2920
2921 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
2922
2923         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2924         (enum number_format): Remove.
2925         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2926         not enum values.
2927         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2928         (section_del): Now const.
2929         (print_fmt): Remove.
2930         (starting_line_number, page_incr, blank_join, line_no,
2931         print_lineno, proc_text, main):
2932         Use intmax_t for line numbers.
2933         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2934         Use bool for booleans.
2935         (lineno_format): Now a string, not an enum value.
2936         (build_print_fmt): Remove.  All calls removed.  This work is
2937         now done within print_lineno.
2938         (build_type_arg): Use size_t for sizes.
2939         (print_lineno): Check for line number overflow.
2940         (proc_text, main): Remove unnecessary cast.
2941
2942         * src/ln.c (symbolic_link, interactive, remove_existing_files,
2943         verbose, hard_dir_link, dereference_dest_dir_symlinks,
2944         do_link, main): Use bool for booleans.
2945
2946         * src/ls.c (struct fileinfo, file_interesting,
2947         extract_dirs_from_files, color_symlink_as_referent,
2948         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2949         numeric_ids, print_block_size, dired, print_with_color,
2950         check_symlink_color, print_inode, recursive, immediate_dirs,
2951         all_files, really_all_files, qmark_funny_chars,
2952         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2953         main, decode_switches, parse_ls_color, print_dir, file_interesting,
2954         gobble_file, make_link_path, basename_is_dot_or_dotdot,
2955         extract_dirs_from_files, print_long_format):
2956         Use bool for booleans.
2957         (dir_defaulted): Remove; no longer needed.
2958         (main): Use int to count files, since it suffices for argv.
2959         Rewrite to avoid need for dir_defaulted.
2960         (main, print_dir, gobble_file, get_link_name,
2961         xstrcoll):
2962         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2963         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2964         Remove unnecessary cast to int.  Use int instead of unsigned
2965         int to count from 0 to 1.
2966         (get_funky_string, print_type_indicator): Use char for bytes, not int.
2967         (make_link_path): Use NULL for null pointers.
2968         (quote_name): Use to_uchar instead of cast.
2969
2970         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2971         print_full_info): Use bool for booleans.
2972         (problems): Remove, replacing with....
2973         (ok): New var (inverted from old sense).
2974         (print_user, print_group, print_full_info):
2975         Print uids/gids with %lu, not %u.
2976         (xgetgroups): Don't run out of memory if getgroups or getugroups
2977         returns -1.
2978         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2979
2980         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2981         int, since it suffices.
2982         (factor, print_factors): Use size_t for sizes.
2983         (print_factors, do_stdin, main): Use bool for booleans.
2984         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2985         (fold_file, main): Use bool for booleans.
2986         (fold_file, main): Use size_t for sizes.
2987         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2988         of prohibiting widths greater than INT_MAX.
2989         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2990         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2991         elide_tail_lines_pipe, elide_tail_lines_seekable,
2992         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2993         string_to_integer, main):
2994         Use bool for booleans.
2995         (main): Rewrite to avoid cast.
2996
2997         * src/csplit.c (struct line): Use size_t for sizes.
2998         (main): Remove unnecessary cast.
2999         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
3000         * src/cut.c (cut_file, main): Use bool for booleans.
3001         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
3002         * src/env.c (main): Likewise.
3003         * src/expr.c (nextarg): Likewise.
3004         * src/env.c (main): Remove unused and nonstandard envp arg.
3005
3006         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
3007         fmt's arbitrary limits.
3008         (TRUE, FALSE): Remove; all uses changed to (true, false).
3009         (main): Use bool for booleans.
3010         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
3011         to parse width.
3012         (copy_rest): Remove unnecessary cast.
3013         (get_prefix): Rewrite to avoid cast.
3014         (check_punctuation): Use char *, not unsigned char *; C89 requires
3015         this.  Avoid off-by-one buffer read overrun when line is empty.
3016         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
3017         Remove unnecessary casts.
3018         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
3019         changes.
3020
3021         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
3022         next_file, expand, main):
3023         Use bool for booleans.
3024         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
3025         expand, main):
3026         Use uintmax_t for column counts.
3027         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
3028         All callers changed.
3029         (parse_tabstops): Don't pass a negative char to isblank.
3030         Avoid memory leak with large tab stops.
3031         (validate_tabstops, expand): Don't assume number of tab stops is
3032         <= INT_MAX.
3033         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
3034         storing values into exit_status.
3035         (expand): Use same pattern as unexpand for reading chars.
3036         Report an error when input line is too long, instead of silently
3037         screwing up.  Do not mishandle tab stops when backspacing left
3038         over start of line.
3039
3040         * src/dircolors.c (have_read_stdin, append_quoted,
3041         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
3042         (dc_parse_stream): Use enum for state, rather than int.
3043         Use ssize_t to store getline result.
3044
3045         * src/dd.c (translation_needed, parse_integer, scanargs,
3046         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
3047         Use bool for booleans.
3048         (translate_buffer): Use to_uchar rather than a cast.
3049         (swab_buffer, copy_simple, copy_with_unblock):
3050         Use size_t for sizes.
3051
3052         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
3053         * src/sleep.c (apply_suffix): Likewise.
3054         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
3055         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
3056         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
3057         tail_forever, tail_bytes, tail_lines, tail, tail_file,
3058         parse_obsolescent_option, parse_options, main): Likewise.
3059         * src/sleep.c (apply_suffix): Invert sense of result.
3060         Use int (not unsigned int) for multiplier, as this generates better
3061         code with some compilers.  Simplify code a bit.
3062         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
3063         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
3064         for state counters.
3065         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
3066         make it a bit clearer.
3067
3068         * src/hostname.c: Include "xgethostname.h".
3069         (xgethostname): Remove decl; xgethostname.h has it.
3070         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
3071         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
3072         prototypes rather than K&R form.  Assume any negative value from
3073         sysinfo denotes failure, not just -1.
3074         (main): Simplify use of sethostname.
3075
3076         * src/pinky.c (include_idle, include_heading, include_fullname,
3077         include_project, include_plan, include_home_and_shell, do_short_format,
3078         include_where, main): Use bool for booleans.
3079         (count_ampersands, create_fullname, scan_entries, short_pinky):
3080         Use size_t for sizes.
3081         (create_fullname): Check for overflow in size calculations.
3082         (idle_string): Don't assume that the number of idle days
3083         is less than 10**8 and/or INT_MAX/(24*60*60).
3084         (main): No need to pass a non-NULL last arg to getopt_long.
3085         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
3086         (print_uptime): Remove unused local variable.
3087         (main): No need to pass a non-NULL last arg to getopt_long.
3088         * src/users.c (list_entries_users, users): Use size_t for sizes.
3089         (list_entries_users): Use char for bytes.
3090         (main): No need to pass a non-NULL last arg to getopt_long.
3091         * src/who.c (do_lookup, short_list, short_output, include_idle,
3092         include_heading, include_mesg, include_exit, need_boottime,
3093         need_deadprocs, need_login, need_initspawn, need_clockchange,
3094         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
3095         (print_runlevel): Use unsigned char for bytes.
3096         (list_entries_who, scan_entries, who): Use size_t for sizes.
3097         (main): No need to pass a non-NULL last arg to getopt_long.
3098
3099         * src/install.c (isdir): Remove decl.
3100         (install_file_to_path): Rely on make_path to fail if the destination
3101         is not a directory, by passing preserve_existing==true to it.
3102         Hence we no longer need to call isdir.
3103         Free dest_dir immediately when it's no longer needed, rather than
3104         waiting until the end of the function.
3105         (copy_file): Don't bother calling isdir, as copy will do the
3106         right thing if the destination is a directory.
3107
3108         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
3109         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
3110         Use bool for booleans.
3111         (max_depth): Now size_t, not int, to avoid an arbitrary limit
3112         of INT_MAX on depth.
3113         (G_fail): Remove: no longer needed, now that the relevant
3114         functions return bool.
3115         (process_file): Use return value to signal success rather than
3116         setting a global.  Remove first_call static var; not needed, since
3117         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
3118         about size_t casts, as it's now fixed.  Use xnrealloc rather
3119         than the obsolescent XREALLOC.  Don't bother to check whether
3120         reallocation is needed unless level > prev_level.
3121         (du_files): Invert sense of result, for consistency with
3122         other coreutils code.  All callers changed.
3123         (main): Allow --max-depth values up to SIZE_MAX.
3124
3125         * src/df.c (inode_format, show_all_fs, show_local_fs,
3126         show_listed_fs, posix_format, require_sync, print_type,
3127         selected_fstype, excluded_fstype, show_dev, show_point, main):
3128         Use bool for booleans.
3129         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
3130         (show_dev, show_point, main):
3131         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3132         Don't assume disk name lengths are <= INT_MAX.
3133         Rewrite pct calculation to avoid cast.
3134         (show_point): Don't assume resolved length is <= SSIZE_MAX.
3135
3136         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
3137         instead of uintptr_t.
3138         * src/shred.c (UINT_MAX_32_BITS): Remove.
3139         (word32): Remove.  All uses changed to uint32_t.
3140         (isaac_seed_data): Remove unnecessary cast.
3141         * src/system.h (ptr_align): Use size_t; in practice, this is just as
3142         good as uintptr_t in checking for alignments, and has fewer
3143         configuration hassles.
3144
3145         * src/Makefile.am (localedir.h): Make it readonly; this
3146         undoes part of the 2004-07-27 patch.
3147
3148 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
3149
3150         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
3151         (IS_THOUSANDS_SEP): Use bool when appropriate.
3152         (numcompare, main): Use char, not int, when the value is always a char.
3153         (numcompare): Remove "register"; compilers are smart enough these days.
3154         * src/system.h (errno, CHAR_BIT): Remove decls;
3155         no longer needed now we assume C89 or better.
3156         Include <inttypes.h> before <stdint.h>, as it's the
3157         Autoconf-recommended pattern.
3158         (to_uchar): New inline function, moved here from tr.c.
3159         Use full names for int types, e.g. "long int" rather than "long".
3160         * src/tr.c (to_uchar): Remove; now in system.h.
3161         (is_char_class_member): Use bool when appropriate.
3162
3163         * src/mkdir.c (create_parents, main): Use bool when appropriate.
3164         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3165
3166 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
3167
3168         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
3169
3170         * src/chmod.c (recurse, force_silent, process_file, process_files,
3171         main): Use bool when appropriate.
3172         * src/cksum.c (cksum, main): Likewise.
3173         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
3174         compare_files, main): Likewise.
3175
3176         * src/copy.h (struct cp_options): Likewise.
3177         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
3178         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
3179         * src/cp-hash.h (remember_created): Likewise.
3180         * src/cp-hash.c (remember_created): Likewise.
3181         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
3182         re_protect, make_path_private, target_directory_operand, do_copy,
3183         cp_option_init, decode_preserve_arg, main): Likewise.
3184         * src/install.c (isdir, change_timestamps, change_attributes,
3185         copy_file, install_file_to_path, install_file_in_dir,
3186         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
3187         change_attributes, change_timestamps): Likewise.
3188         * src/mv.c (remove_trailing_slashes, rm_option_init,
3189         cp_option_init, do_move, movefile, main): Likewise.
3190         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
3191         AD_push, prompt, remove_dir): Likewise.
3192         * src/rm.c (rm_option_init, main): Likewise.
3193
3194         * src/remove.c (top_dir, pop_dir, full_filename_):
3195         Use size_t for sizes.
3196         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
3197         succeeds.  It's not necessary in that case, as *NEW_DST is always
3198         false already.
3199         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
3200         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
3201         * src/rm.c (main): Likewise.
3202
3203         md5sum, sha1sum integer cleanups.
3204
3205         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
3206         not needed.
3207         (ALG_UNSPECIFIED): Remove.
3208         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
3209         * src/md5.c: Don't include any files other than checksum.h.
3210         * src/sha1sum.c: Likewise.
3211         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
3212         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
3213         Use bool when appropriate.
3214         (digest_check): Increase limit of number of input lines to
3215         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
3216         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
3217
3218 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
3219
3220         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
3221         'ok' flag around.
3222         (simple_cat, cat): Return true if successful.  All callers changed.
3223         (simple_cat, cat, main): Use bool for booleans.
3224         (simple_cat): Use size_t for sizes.
3225         (cat, main): Use the same names for parameters that we use for
3226         long options, to avoid confusion.  This inverts the sense of the
3227         show_tabs (formerly output_tabs) and number_nonblank
3228         (formerly numbers_at_empty_lines) variables.
3229         (main): Don't mess up (due to integer overflow) if we are given
3230         INT_MAX - INT_MIN + 1 options.
3231         [O_BINARY]: Don't invoke isatty unless the other options require it.
3232         (main): When deciding whether to use simple_cat, don't worry
3233         about binary option; it's irrelevant.
3234
3235         * src/dcgen: Remove comments, trailing white space, and empty
3236         lines from the output strings, to save space.
3237         Use a narrower type like 'unsigned char' for line lengths, if
3238         that will do.
3239         Make the output variables static, not extern.
3240
3241         * src/chgrp.c (parse_group): Require base 10 when parsing
3242         groups as integers.
3243         (main): int -> bool when appropriate.
3244         * src/chown.c (main): Likewise.
3245         * src/chown-core.c: Include inttostr.h.
3246         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3247         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3248         instead of uint_to_string).
3249         (describe_change): Instead of an int flag, use a char *
3250         auxiliary; this avoids the need for casts.
3251         Assume free (NULL) works.
3252         (change_file_owner): Return true/false, not 0/-1, since
3253         we don't set errno.  All callers changed.
3254         Use bool when appropriate.
3255         (chown_files): Likewise.
3256         * src/chown-core.h (chown_files): Likewise.
3257
3258         * tests/chown/basic: Test for proper handling of uids like
3259         "010", which must be parsed as decimal.
3260
3261         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3262         pwd when there are multiple names for the working directory
3263         (which can happen with an automounter, sigh).
3264
3265         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3266         this causes Solaris 8 'make' to refuse to build "groups".
3267         (localedir.h): Don't depend on Makefile: this causes Solaris
3268         8 'make' to build localedir.h unnecessarily.  The dependence
3269         on Makefile is ineffective anyway, since $(localedir) might
3270         change even if Makefile hasn't.
3271
3272         * src/remove.c (remove_dir): If we can't save the state of the
3273         working directory, pretend we started from "/", not ".".
3274         This avoids a bug on hosts like Solaris that don't let you
3275         remove the working directory.
3276
3277 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3278
3279         * src/printf.c (strtiomax, strtoumax): Declare if not already
3280         declared: this fixes a portability bug with Solaris 8 + GCC.
3281         (STRTOX): Parenthesize use of macro arg as expression.
3282         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3283         parentheses.
3284         * configure.ac: Check for declaration of strtoumax, for
3285         src/printf.c.
3286
3287         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3288         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3289
3290         * tests/readlink/can-e: Don't assume that we can remove the
3291         working directory: this isn't possible under Solaris 8, say.
3292         * tests/readlink/can-f: Likewise.
3293         * tests/readlink/can-m: Likewise.
3294
3295         * src/copy.c (copy_internal): find_backup_file_name no longer
3296         returns NULL, so don't bother to check for this.
3297         * src/cp.c (do_copy): Likewise.
3298         * src/ln.c (do_link): Likewise.
3299
3300 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3301
3302         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3303         All uses changed.
3304         (NZERO): New macro, if system doesn't define it already.
3305         (usage): Distinguish priorities from nice values.
3306         Don't assume NZERO is 20.
3307         (main): Use bool instead of int where appropriate.
3308         If user specifies an adjustment out of range, always truncate it
3309         to an inrange value instead of sometimes giving an error message
3310         and sometimes not.
3311         Do not assume that -1 is an error return from "nice" or
3312         "getpriority", as it might be the current nice value minus NZERO.
3313         If nice/setpriority fails with errno == EPERM, go ahead and run
3314         the command anyway; POSIX requires this.
3315
3316         * src/pathchk.c: Include euidaccess.h.
3317         (dir_ok): Use euidaccess, not access.
3318         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3319         (eaccess): Remove.  All users changed to use euidaccess instead.
3320
3321 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3322
3323         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3324         Don't assume ut_line is null-terminated.
3325         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3326         since USER and LINE might not be null terminated.  All callers
3327         changed.
3328
3329 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3330
3331         Fix bug with "tail -f" reported by Rob Holland in
3332         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3333         Also, remove the undocumented and unsupported-since-2000
3334         --max-consecutive-size-changes options.  Fix another related bug:
3335         "tail" got confused if stdin, stdout, or stderr were closed.
3336         Also, use output buffering even with "tail -f".
3337
3338         * NEWS: Document this, plus yesterday's patch.
3339         * doc/coreutils.texi (tail invocation): "size has remained the same"
3340         -> "file has not changed", which is more accurate for fifos.
3341         * src/tail.c: Include fcntl-safer.h.
3342         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3343         (COPY_A_BUFFER): New macro.
3344         (struct File_spec): New members mtime, mode, blocking.
3345         Remove member n_consecutive_size_changes.
3346         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3347         max_n_consecutive_size_changes_between_opens,
3348         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3349         (long_options, tail_forever, parse_options):
3350         Remove (non-)support for --max-consecutive-size-changes.
3351         (record_open_fd): New function.
3352         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3353         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3354         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3355         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3356         All uses changed.
3357         (n_live_files): Remove, replacing with...
3358         (any_live_files): New function.  All uses changed.
3359         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3360         is safe; this avoids some hangs when reading from a fifo.
3361         Avoid invoking fstat or sleep when using blocking I/O.
3362         Do not check for changes to size if the file is not a regular file,
3363         as the size is undefined in that case.
3364         Check for changes to mtime or mode, too; this works for non-regular
3365         files.
3366         (tail_forever, main): Redo fflush strategy to work even when input
3367         is nonblocking.  Don't use unbuffered output; just flush when needed.
3368
3369 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3370
3371         * src/tail.c (main): Ignore -f if no file operand is specified
3372         and standard input is a pipe.
3373         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3374         all pipes, just for when standard input is a pipe and no
3375         file operand is specified.
3376         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3377         Add a new commented-out f-2 test, which we still fail.
3378         (test_vector): All f-* tests are special cases, not just f-1.
3379
3380 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3381
3382         * src/uptime.c: Include c-strtod.h.
3383         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3384         Use long int rather than int to count days (for 64-bit hosts),
3385         and check for arithmetic overflow when converting double to time_t.
3386
3387 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3388
3389         * src/printf.c (vstrtold): Renamed from vstrtod.
3390         Now returns long double.  All uses changed.
3391         (print_direc): Use "L" length modifier when printing floating point
3392         numbers, since we're now printing long double.
3393
3394 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3395
3396         printf cleanup, to avoid undefined behavior, to add support for
3397         formats that Bash supports, and to support wide integers like
3398         Bash does.
3399
3400         * NEWS: Document this.
3401         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3402         booleans, so that we don't reserve any values for precision or
3403         width (like Bash).
3404         (STRTOX): Use prototype, not K&R-style definition.
3405         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3406         in ../lib), with type change to intmax_t.
3407         All uses changed.
3408         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3409         All uses changed.
3410         (vstrtod): Renamed from xstrtod.  All uses changed.
3411         (print_direc): Use boolean arg instead of special value to indicate
3412         a missing precision or width.  LENGTH no longer includes
3413         length modifiers or conversion character.  New arg CONVERSION
3414         now specifies conversion character.
3415         Use intmax_t-width formatting for integers (like Bash).
3416         Add support for C99 %a, %A, %F (like Bash).
3417         Add support for field width with %c (POSIX requires this).
3418         Add a FIXME for lack of support for field width and precision
3419         for %b.
3420         Add support for '\'', '0' flags.
3421         Check for invalid combinations of flags, field width, precision,
3422         and conversion, to prevent use of undefined behavior.
3423         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3424         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3425         In error message, output entire invalid conversion specification,
3426         instead of merely outputting % followed by the conversion char.
3427         * tests/misc/printf: Add tests for the above.
3428
3429 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3430
3431         Change "readlink -f" to be more compatible with prior implementations.
3432         Add more canonicalize options, -e and -m.
3433         Add comprehensive tests for all readlink modes.
3434
3435         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3436         Do not add canonicalize.c here.
3437
3438         * src/readlink.c (longopts): Add new options.
3439         (usage): Document them.
3440         (canonicalize_fname): New proxy function.
3441         (main): Handle new options.
3442         * doc/coreutils.texi (readlink invocation): Document new
3443         "readlink -f" behaviour and new canonicalize options, -e and -m.
3444
3445         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3446         * tests/Makefile.am (SUBDIRS): Add readlink.
3447         * tests/readlink/Makefile.am: New file.
3448         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3449         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3450         * tests/misc/readlink: Remove file.
3451
3452 2004-07-04  Jim Meyering  <jim@meyering.net>
3453
3454         * src/copy.c (copy_internal): Add a FIXME comment.
3455
3456 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3457
3458         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3459         * src/cp.c (do_copy): Likewise.
3460         * src/mv.c (movefile): Likewise.
3461
3462         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3463         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3464
3465         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3466         This cleans up the semantics a bit, as we no longer try to open the
3467         same file twice.
3468
3469 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3470
3471         * NEWS: Add short names -t and -T for --target-directory
3472         and --no-target-directory options, respectively.
3473
3474         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3475         Remove.  All uses changed to 'T' and 't', respectively.
3476         * src/install.c, src/ln.c, src/mv.c: Likewise.
3477
3478         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3479         aliases for --target-directory and --no-target-directory,
3480         respectively.
3481         * src/install.c (long_options, main, usage): Likewise.
3482         * src/ln.c, src/mv.c: Likewise.
3483
3484 2004-07-01  Jim Meyering  <jim@meyering.net>
3485
3486         * Makefile.maint (sc_file_system): New target.
3487         (syntax-check-rules): Add it.
3488         .x-sc_file_system: New file.
3489         * Makefile.am (EXTRA_DIST): Add it.
3490
3491         * man/sync.x: Use "file system" rather than "filesystem".
3492         * man/stat.x, man/df.x: Likewise.
3493
3494 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3495
3496         * src/df.c (usage, main): Output "file system" rather than
3497         "filesystem".
3498         * src/du.c (usage): Likewise.
3499         * src/shred.c (usage): Likewise.
3500         * src/stat.c (usage): Likewise.
3501         * src/stat.c (long_options, usage): Rename "--filesystem" to
3502         "--file-system".  But keep the old name around, for compatibility
3503         reasons.
3504
3505 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3506
3507         Add support for --no-target-directory option.
3508
3509         * NEWS: Document it.
3510         * doc/coreutils.texi (Common options, Target directory, cp
3511         invocation, install invocation, mv invocation, ln invocation):
3512         Likewise.
3513         (link invocation): Explain how to rewrite link using ln now
3514         that we have --no-target-directory.
3515         (ln invocation): Explain that --no-target-directory subsumes
3516         --no-dereference.
3517         (unlink invocation): Modify wording to match new wording in
3518         link invocation.
3519
3520         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3521         (long_opts, usage, do_copy, main): Add support for
3522         --no-target-directory,
3523         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3524         usage): Likewise.
3525         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3526         main): Likewise.
3527         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3528         main): Likewise.
3529         * src/mv.c (enum): Sort values.
3530
3531 2004-06-29  Jim Meyering  <jim@meyering.net>
3532
3533         Don't let verbose-mode output from a subshell obscure actual differences.
3534         * tests/rm/inaccessible: Turn off command-echoing just before
3535         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3536
3537 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3538
3539         Add support for 'install --target-directory', an option
3540         that has been documented for years but not implemented (!).
3541         * doc/coreutils.texi (install invocation): Document
3542         --target-directory in synopsis, too.
3543         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3544         (long_options, main, usage): Add --target-directory.
3545         (target_directory_operand): New function, stolen from mv.c.
3546         (main): Use it.  Check for -d and --target-directory.
3547         Alter wording of diagnostics to match other programs.
3548
3549 2004-06-28  Jim Meyering  <jim@meyering.net>
3550
3551         * src/cp.c (usage): Fix copy+paste error in description of
3552         --target-directory: s/move/copy/.  From Paul Jarc.
3553
3554 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3555
3556         Use more-consistent rules among cp, ln, and mv when dealing with
3557         last operands that are (or look like) directories.
3558
3559         * src/cp.c (target_directory_operand): New, nearly-common function,
3560         It reports an error if the destination appears to be a directory
3561         (e.g., because it has a trailing slash) but is not.
3562         * src/ln.c, src/mv.c: Likewise.
3563         * src/cp.c (do_copy): Use it.
3564         * src/ln.c (main): Likewise.
3565         * src/mv.c (main): Likewise.
3566
3567         * src/cp.c (do_copy): Don't assume argc is positive.
3568         Don't bother to lstat dest, since copy() will do that for us.
3569         Use "const" to avoid the need for cast.
3570
3571         * src/cp.c (do_copy): Don't output a usage message because of file
3572         problems (e.g., an operand is not a directory).  Use it only for
3573         syntax.  Standardize on "target %s is not a directory" for the
3574         diagnostic.
3575         * src/ln.c (main): Likewise.
3576         * src/mv.c (main): Likewise.
3577
3578         * src/cp.c (do_copy): Remove test for trailing slash, since
3579         target_directory_operand now does this.
3580         * src/ln.c (main): Likewise.
3581         * src/mv.c (movefile): Likewise.
3582
3583         * src/cp.c (main): Reject multiple target directories.
3584         Check whether a specified target is a directory when parsing the
3585         options, using stat.  This gives more-accurate diagnostics.
3586         * src/ln.c (main): Likewise.
3587
3588         * src/ln.c (isdir): Remove decl; no longer needed.
3589         * src/mv.c (isdir, lstat): Likewise.
3590
3591         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3592         Don't check the destination ourself; rely on dest_is_dir.
3593         This way we can avoid lstatting the destination in the
3594         usual case, and in the worst case we lstat 1, not 3 times.
3595         Don't bother to unlink unless link failed; this saves a syscall.
3596         Remove unnecessary backup_succeeded flag;
3597         it was identical to "dest_backup != NULL".
3598
3599         * src/ln.c (main): Use int to count to argc, not unsigned int.
3600         This handles negative operand counts.
3601         * src/mv.c (main): Likewise.
3602
3603         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3604         do it, for consistency with cp.c and ln.c.  All callers changed.
3605         (movefile): dest_is_dir parameter is now bool, not int.
3606         (main): Standardize on "missing destination file operand after %s"
3607         for the diagnostic, for consistency with cp.c.
3608
3609         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3610         will complain about the arg count.
3611         Adjust to new (briefer) diagnostics.
3612         * tests/cp/fail-perm: Add a test to verify that we get the new
3613         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3614
3615 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3616
3617         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3618         d/" incorrectly created a link d/x/x.  It also saves some system
3619         calls.
3620
3621         * NEWS: Document the fix.
3622
3623         * src/ln.c (main): Don't append basename to dest if this
3624         results in an existing directory name.
3625         * tests/ln/misc: See whether a trailing slash is followed too far.
3626
3627 2004-06-26  Jim Meyering  <jim@meyering.net>
3628
3629         * src/printf.c (main): When given no arguments, print the standard
3630         "missing operand\nTry printf --help..." message -- to be consistent.
3631
3632 2004-06-26  Jim Meyering  <jim@meyering.net>
3633
3634         * src/mknod.c (main): Add \n at the end of message output via fprintf.
3635
3636 2004-06-25  Jim Meyering  <jim@meyering.net>
3637
3638         * tests/ln/misc: Add test for ln subscript error.
3639
3640 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
3641
3642         * src/ln.c (do_link): Remove unnecessary call to lstat.
3643         (main): Avoid subscript error when the destination is "".
3644
3645 2004-06-23  Jim Meyering  <jim@meyering.net>
3646
3647         * tests/*: Replace all occurrences of `(exit N); exit' with
3648         `(exit N); exit N'.  Otherwise, those many tests could exit with
3649         improper exit status when exiting via e.g., a trapped interrupt.
3650         Thanks to a report from Bob Proulx.
3651
3652 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
3653
3654         * src/who.c (idle_string, print_user): New arg boottime,
3655         specifying the most recent boot time.  All uses changed.
3656         (idle_string) Consider a line to be "old" if it hasn't been used
3657         since the last boot time.  Watch out for overflow when computing
3658         times, and for times in the future.
3659         (idle_string): Record latest boot time.
3660
3661 2004-06-22  Jim Meyering  <jim@meyering.net>
3662
3663         * src/test.c (usage): Correct description of `-t FD'.  The file
3664         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
3665
3666 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3667
3668         The 2004-06-19 fix for who and pinky was incomplete, as ctime
3669         has undefined behavior if the year precedes -999 or follows 9999.
3670         Since we have to stop using ctime anyway, we might as well use
3671         strftime and fix the FIXME, and support internationalized dates.
3672
3673         * NEWS: Document the new behavior.
3674         * src/who.c: Include "hard-locale.h".
3675         (time_format, time_format_width): New vars.
3676         (time_string, print_line): Use them.
3677         (main): Set them.
3678         (time_string): Use localtime + strftime instead of
3679         ctime, to avoid problems with years before -999 or after 9999.
3680         * src/pinky.c: Likewise.
3681
3682 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
3683
3684         Fix bug: GNU 'ls' didn't count columns correctly if user or group
3685         names contained multibyte characters where the column count
3686         differed from the byte count.  This patch also corrects
3687         some comments.
3688
3689         * src/ls.c (format_user_or_group): New function, which counts
3690         columns correctly.
3691         (format_user, format_group): Use it.
3692         (format_user_or_group_width): New function, which counts columns
3693         correctly.
3694         (format_user_width, format_group_width): Use it.
3695
3696 2004-06-21  Jim Meyering  <jim@meyering.net>
3697
3698         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3699         Suggestion from Andreas Schwab.
3700
3701         * tests/priv-check: When running as root, be sure to propagate
3702         PATH through to the process we exec as non-root.
3703         Reported by michael@aplatform.com.
3704
3705         * src/mknod.c (main): Don't segfault when calculating the
3706         expected number of operands for `mknod NAME'.
3707
3708 2004-06-20  Jim Meyering  <jim@meyering.net>
3709
3710         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3711
3712 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
3713
3714         * src/basename.c (main):
3715         Standardize on the diagnostics given when someone gives
3716         too few operands ("missing operand after `xxx'") or
3717         too many operands ("extra operand `xxx'").
3718         Include "quote.h" and/or "error.h" if it wasn't already being included.
3719         * src/chgrp.c (main): Likewise.
3720         * src/chmod.c (main): Likewise.
3721         * src/chown.c (main): Likewise.
3722         * src/chroot.c (main): Likewise.
3723         * src/comm.c (main): Likewise.
3724         * src/cp.c (do_copy): Likewise.
3725         * src/csplit.c (main): Likewise.
3726         * src/date.c (main): Likewise.
3727         * src/dircolors.c (main): Likewise.
3728         * src/dirname.c (main): Likewise.
3729         * src/du.c (main): Likewise.
3730         * src/expr.c (main): Likewise.
3731         * src/hostid.c (main): Likewise.
3732         * src/hostname.c (main): Likewise.
3733         * src/id.c (main): Likewise.
3734         * src/install.c (main): Likewise.
3735         * src/join.c (add_file_name, main): Likewise.
3736         * src/link.c (main): Likewise.
3737         * src/ln.c (main): Likewise.
3738         * src/logname.c (main): Likewise.
3739         * src/md5sum.c (main): Likewise.
3740         * src/mkdir.c (main): Likewise.
3741         * src/mkfifo.c (main): Likewise.
3742         * src/mknod.c (main): Likewise.
3743         * src/mv.c (main): Likewise.
3744         * src/nohup.c (main): Likewise.
3745         * src/od.c (main): Likewise.
3746         * src/pathchk.c (main): Likewise.
3747         * src/ptx.c (main): Likewise.
3748         * src/readlink.c (main): Likewise.
3749         * src/rm.c (main): Likewise.
3750         * src/rmdir.c (main): Likewise.
3751         * src/seq.c (main): Likewise.
3752         * src/setuidgid.c (main): Likewise.
3753         * src/shred.c (main): Likewise.
3754         * src/sleep.c (main): Likewise.
3755         * src/sort.c (main): Likewise.
3756         * src/split.c (main): Likewise.
3757         * src/stat.c (main): Likewise.
3758         * src/test.c (beyond, main): Likewise.
3759         * src/touch.c (main): Likewise.
3760         * src/tr.c (main): Likewise.
3761         * src/tsort.c (main): Likewise.
3762         * src/tty.c (main): Likewise.
3763         * src/uname.c (main): Likewise.
3764         * src/uniq.c (main): Likewise.
3765         * src/unlink.c (main): Likewise.
3766         * src/uptime.c (main): Likewise.
3767         * src/users.c (main): Likewise.
3768         * src/who.c (main): Likewise.
3769         * src/whoami.c (main): Likewise.
3770
3771         * tests/basename/basic: Adjust to new diagnostics.
3772         * tests/du/files0-from: Likewise.
3773         * tests/expr/basic: Likewise.
3774         * tests/mv/diag: Likewise.
3775         * tests/tsort/basic-1: Likewise.
3776
3777 2004-06-20  Jim Meyering  <jim@meyering.net>
3778
3779         * src/ln.c: Remove declaration of yesno.
3780         Instead, include yesno.h.
3781         * src/copy.c: Likewise.
3782
3783         * src/remove.c: Remove declaration of yesno.
3784         Instead, include yesno.h.
3785         (top_dir): Remove now-unnecessary cast of obstack_base.
3786         (pop_dir): Likewise.
3787         (full_filename_): Likewise.
3788
3789 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3790
3791         Don't dump core if ctime returns NULL; this is possible on
3792         hosts with 64-bit time_t and 32-bit int.
3793         * src/who.c: Include "inttostr.h".
3794         (time_string): If ctime fails, print the raw time as an integer
3795         instead of dumping core.
3796         * src/pinky.c: Likewise, as follows:
3797         Include "inttostr.h".
3798         (time_string): New function, copied from who.c.
3799         (print_entry): Use it.
3800
3801 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
3802
3803         * src/who.c (print_line): Don't truncate user names at 8 bytes.
3804         Problem reported by Guido Leenders in:
3805         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3806         * NEWS: document this.
3807
3808 2004-06-19  Jim Meyering  <jim@meyering.net>
3809
3810         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3811         using GNU_PACKAGE (from PACKAGE) once again.  This restores
3812         `GNU' to the parenthesized package name in --version output.
3813         Before, the first argument from AC_INIT, `GNU coreutils', would
3814         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
3815         Reported by Richard Stallman.
3816
3817 2004-06-17  Jim Meyering  <jim@meyering.net>
3818
3819         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
3820         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
3821
3822 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
3823
3824         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3825         allows the GNU behavior.  "--" is now supported by chroot, hostid,
3826         hosname, pwd, sync, yes.
3827         * doc/coreutils.texi (yes invocation, false invocation,
3828         true invocation): Document this.
3829         * src/chroot.c (main): Handle "--".
3830         * src/hostid.c (main): Likewise.
3831         * src/hostname.c (main): Likewise.
3832         * src/pwd.c (main): Likewise.
3833         * src/sync.c (main): Likewise.
3834         * src/yes.c (main): Likewise.
3835         * src/true.c (main): Recognize --help and --version even if
3836         POSIXLY_CORRECT is set.
3837         * src/yes.c (main): Likewise.
3838
3839 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
3840
3841         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3842         the GNU behavior.
3843         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3844         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3845         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
3846         variables to the implementation, so it's OK for ls to depend on
3847         TABSIZE.
3848         * src/pr.c: Include "hard-locale.h".
3849         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3850         POSIX specifies the behavior only in the POSIX locale.
3851         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3852         since POSIX says the behavior is unspecified here.
3853         * src/tail.c (parse_obsolescent_option): Support multiple file operands
3854         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3855         * src/printf.c (main): Recognize --help, --version even if
3856         POSIXLY_CORRECT.  POSIX does not specify any options, but it
3857         does not prohibit options either, so "printf" is like "expr" here.
3858         * src/unlink.c (main): Likewise.
3859         * tests/misc/printf: Adjust to the new semantics for \x if
3860         POSIXLY_CORRECT.
3861
3862 2004-06-14  Jim Meyering  <jim@meyering.net>
3863
3864         * tests/misc/pwd: New test, for fix of 2004-04-19.
3865         * tests/misc/Makefile.am (TESTS): Add pwd.
3866         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3867
3868         * src/copy.c: Remove declaration of euidaccess.
3869         Instead, include "euidaccess.h".
3870
3871 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
3872
3873         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3874         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3875         as (sizeof "??") reliably returns 3.
3876         (print_line): Guard against idle and pid being too long
3877         (which is possible when printing headers).
3878         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
3879         Avoid unnecessary cast of sizeof to int.
3880         (make_id_equals_comment): Do not assume that UT_ID returns
3881         a string; it might return a non-null-terminated array.
3882         Use strncat instead.  It's not very often where strncat is
3883         exactly what you want, but this is one of those rare cases.
3884
3885 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
3886
3887         * src/who.c (list_entries_who): Don't output a trailing space.
3888
3889 2004-06-09  Jim Meyering  <jim@meyering.net>
3890
3891         * src/touch.c (usage): Improve wording in description of the
3892         --time=WORD option.  Reported by Dan Jacobson.
3893
3894         * src/chown-core.c (change_file_owner): Change names of parameters
3895         old_uid and old_gid to required_uid and required_gid respectively.
3896
3897         * src/chmod.c (mode_changed): Return false, not 0, now that the
3898         function returns `bool'.
3899
3900 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
3901
3902         Adjust chmod and chown to be similar if -c or -v are given.  In
3903         particular, a no-op chown is no longer reported as a change; this
3904         reverts to previous behavior.  Also, fix both commands so that -v
3905         report failures even if the failure is not due to the chmod or
3906         chown syscalls.
3907
3908         * src/chmod.c (CH_NOT_APPLIED): New constant.
3909         (describe_change): Handle it.
3910         (process_file): Use it, if a symlink wasn't changed.
3911         (mode_changed): Return bool, not int.  Accept new argument
3912         NEW_MODE; all callers changed.  This lets us avoid statting the
3913         file unless the new mode has unusual bits.
3914         (process_file): Return -1 on error.  With -v, report all errors
3915         verbosely, not just some.
3916
3917         * src/chown-core.c (change_file_owner): Return -1 on error, not
3918         1 sometimes and -1 on others.  Our caller ORs together our results,
3919         and (-1 | 1) == 0 on ones-complement hosts.
3920         With -v report all errors verbosely, not just some.
3921         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3922         file_stats wasn't set properly in that case.
3923
3924         * tests/chgrp/basic: Adjust to above changes.
3925
3926 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
3927
3928         * tests/chgrp/basic: Test that chgrp -h does not fail on
3929         symlinks, even on hosts where that's not supported.
3930         Test that if -R is specified without -H or L, -h is assumed.
3931         Test that chown() is not optimized away.
3932
3933 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
3934
3935         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3936
3937           Check for incompatible options.  When -R and --dereference are
3938           both used, then either -H or -L must also be used.  When -R and -h
3939           are both used, then -P must be in effect.
3940
3941           -H, -L, and -P have no effect unless -R is also specified.
3942           If -P and -R are both specified, -h is assumed.
3943
3944           Do not optimize away the chown() system call when the file's owner
3945           and group already have the desired value.  This optimization was
3946           incorrect, as it failed to updated the last-changed time and reset
3947           special permission bits, as POSIX requires.
3948
3949           Do not report an error if the owner or group of a
3950           recursively-encountered symbolic link cannot be updated because
3951           the file system does not support it.
3952
3953         * NEWS: Document the above.
3954
3955         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
3956         requires either -H or -L, and -R -h requires -P.  If -H, specify
3957         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
3958         file as much like chown.c as possible.
3959         * src/chown.c (main): Likewise.
3960
3961         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3962         needed.  Chown a directory only after chowning its children; this
3963         avoids problems if the new directory ownership doesn't permit
3964         access to the children.  Dereference symlinks before doing
3965         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3966         Do not optimize away the chown() system call when the file's owner
3967         and group already have the desired value.  POSIX does not permit
3968         this optimization.  Rely on chown and lchown to do the right
3969         thing with symlinks and/or -1 arguments, now that we have wrappers
3970         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3971         errors, not just command-line errors.
3972         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3973
3974         * src/system.h (ENOTSUP): Remove.
3975
3976         * tests/chgrp/basic: Use chown --from to discover whether the
3977         group changed, since chgrp now changes unconditionally.  This
3978         complicates the sed script a bit.  Do not specify --dereference,
3979         since it's the default (and we want to test this).  Adjust output
3980         to match the fact that chgrp no longer optimizes the case of
3981         changing a file's group to the same value as before.
3982         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3983         options are incompatible, and their behavior is undefined with POSIX.
3984         (changed, not_changed): Adjust to match the fact that -h is no longer
3985         specified.  Sort names.
3986         * tests/chown/deref: Adjust error-diagnostic spelling to match new
3987         behavior.
3988
3989 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
3990
3991         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3992         prevented a diagnostic of any operands.
3993
3994 2004-06-08  Jim Meyering  <jim@meyering.net>
3995
3996         * src/shred.c (direct_mode): Turn it on/off with directio, too.
3997
3998 2004-06-07  Jim Meyering  <jim@meyering.net>
3999
4000         Enable direct-mode I/O (bypassing the buffer cache), if possible.
4001         Prompted by a suggestion from Kalle Olavi Niemitalo
4002         in http://bugs.debian.org/207035.
4003         * src/shred.c (direct_mode): New function.
4004         (do_wipefd): Turn on direct-mode I/O.
4005         (dopass): If a file's first write fails with EINVAL,
4006         turn off direct-mode I/O and retry the write.
4007
4008 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
4009
4010         * src/tr.c (main): "tr -d a b" is now a fatal error even if
4011         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
4012         option combination.
4013
4014 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
4015
4016         * src/shred.c (dopass): Don't subtract 1 from the offset after
4017         a write error.  Problem reported by Jon Peatfield in:
4018         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
4019
4020 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
4021
4022         Fix bug reported by Buciuman Adrian in
4023         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
4024         where 'dd' created a file that was too large.  The bug was that dd
4025         assumed that the input file offset does not advance after a failed
4026         read; but POSIX says that the input file offset is undefined after
4027         a failed read.
4028
4029         * src/dd.c (MAX_BLOCKSIZE): New macro.
4030         (input_seekable, input_seek_errno, input_offset,
4031         input_offset_overflow): New vars.
4032         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
4033         (advance_input_offset): New function.
4034         (skip_via_lseek): Set errno to zero when reporting our failure,
4035         so that we don't report based on garbage errno.
4036         (skip): If fdesc is standard input, advance the input offset.
4037         Do not quit if reading, and if noerror was specified;
4038         POSIX seems to require this.
4039         If read fails on output file, report the earlier lseek failure
4040         instead; this fixes a FIXME in dd_copy.
4041         (advance_input_after_read_error): New function.
4042         (dd_copy): Use it, instead of assuming that failed reads
4043         do not advance the file pointer.  Advance input offset
4044         after nonfailed reads.  Advance only a partial block if
4045         the previous read (before the failed read) succeeded, and
4046         do not generate an output block of zeros in this case.
4047         (main): Determine initial input offset, seekability of input,
4048         and error if it wasn't seekable.
4049
4050 2004-06-02  Jim Meyering  <jim@meyering.net>
4051
4052         rm (without -f) could hang unnecessarily when attempting to
4053         remove a symlink to a file on an off-line NFS-mounted partition.
4054         Reported by David Howells in https://bugzilla.redhat.com/124699.
4055         * src/remove.c (write_protected_non_symlink): New function.
4056         Don't invoke euidaccess on symlinks.
4057         (prompt): Use write_protected_non_symlink rather than using
4058         euidaccess directly, being careful not to call lstat twice for a file.
4059
4060         Fix a bug in how the --output-delimiter=D option works with
4061         abutting byte or character ranges.  Reported by David Krider in
4062         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
4063         * src/cut.c (print_kth): Remove special case for open-ended range.
4064         (set_fields): Record the range start index for an interval even
4065         when it abuts another interval on its low side.
4066         Also record the range start index of the longest right-open-interval.
4067         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
4068         abutting and overlapping byte ranges.
4069
4070 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
4071
4072         Some POSIX-conformance cleanups for tr.
4073
4074         * src/tr.c (posix_pedantic): Remove; no longer needed since
4075         we need to test this in just one place now.
4076         (usage): Mention -C.
4077         (unquote): Note that \055, \n, etc are escaped.
4078         Do not worry about POSIXLY_CORRECT when warning about ambiguous
4079         escape sequences.
4080         \ at end of string stands for itself.
4081         Do not diagnose invalid backslash escapes: POSIX says the behavior
4082         is unspecified in this case, so we don't need to diagnose it.
4083         (main): Add support for -C (currently an alias for -c).
4084         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
4085         a diagnostic here.
4086         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
4087         Fix comment for range-a-a.
4088
4089 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
4090
4091         Improve the efficiency (and in one case, correctness) of code
4092         that reads symlinks.
4093
4094         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
4095         royally if the link length is long (e.g., GNU/Hurd).  Use
4096         xreadlink instead, it's safer.  Don't bother to read the link if
4097         it's the wrong size.  Add a FIXME because this area is a bit murky
4098         and undocumented.
4099         * src/ls.c (get_link_name): Update use of xreadlink.
4100         * src/readlink.c (main): Likewise.
4101         * src/stat.c (print_stat): Likewise.
4102
4103 2004-06-01  Jim Meyering  <jim@meyering.net>
4104
4105         * src/env.c (main): Prefer the notation `STREQ (a, b)'
4106         over `!strcmp (a, b)'.
4107         * src/sort.c (main, sort_buffer_size): Prefer the notation
4108         `STREQ (a, b)' over `strcmp (a, b) == 0'.
4109         * src/date.c (batch_convert): Likewise.
4110         * src/expr.c (nextarg): Likewise.
4111         * src/su.c (correct_password, restricted_shell, main): Likewise.
4112         * src/ptx.c (swallow_file_in_memory, main): Likewise.
4113         * src/test.c (binary_operator, and, or, main): Likewise.
4114
4115 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4116
4117         * NEWS: echo compatibility cleanup.
4118         * doc/coreutils.texi (echo invocation): Document the changes.
4119         * src/echo.c (V9_ECHO): Remove; always enabled.
4120         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
4121         we use the same naming convention as bash.  Now an enum,
4122         not a macro.
4123         (usage): Reword to mention -e/-E more accurately.
4124         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
4125         (hextobin): New function.
4126         (main): Use bool rather than int for local vars when appropriate.
4127         Do not allow options if POSIXLY_CORRECT, unless we are using
4128         BSD semantics and the first argument is "-n".
4129         Don't pass unnecessary extra arg to parse_long_options.
4130         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
4131         Do not look for options if !allow_options.
4132         Use size_t rather than int when appropriate.
4133         Open-code option test rather than using strrchr.
4134         Use faster test for "-".
4135         Avoid redundant argc test.
4136         Add support for \x, for Bash compatibility.
4137         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
4138         When '\c' is encountered, stop printing immediately, as POSIX
4139         requires.
4140         Add support for \xhh syntax.
4141         Add support for \0ooo syntax; POSIX requires this.
4142
4143 2004-06-01  Jim Meyering  <jim@meyering.net>
4144
4145         * Use automake-1.8b.  Regenerate dependent files.
4146
4147 2004-05-31  Jim Meyering  <jim@meyering.net>
4148
4149         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
4150         the build src/ directory -- at the front.
4151         ($(srcdir)/$x-tests): Depend on Makefile.am.
4152         Use $x as the program name, except when it would be `test' (test is
4153         the sole program tested via mk-script that is also a shell built-in).
4154         In that case, use the old ../../src/$x.
4155
4156 2004-05-30  Jim Meyering  <jim@meyering.net>
4157
4158         Work around HPUX /bin/cc compiler bug that is exposed, now that
4159         sets are arrays of type `bool'.  More details here:
4160         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
4161         FIXME: verify that the above URL points to the right message
4162
4163         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
4164         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
4165         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
4166         system, those two expressions are not the same (256 vs. 1024).
4167         The effect of this problem was that `tr -c x y' would fail:
4168         tr: when not truncating set1, string2 must be non-empty
4169         (set_initialize): Remove unnecessary initialization of the `in_set'
4170         buffer; that initialization triggered the same compiler bug as above.
4171
4172 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4173
4174         tr cleanup, mostly having to do with integer type ranges.
4175         Remove all casts.
4176
4177         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
4178         the test cases wouldn't be portable, or would take too much CPU
4179         time, or both.
4180
4181         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
4182         This is safe since the code already assumes N_CHARS fits in int.
4183         (Filter): Remove: we want to prototype everything.
4184         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
4185         (uchar): New function.  All places where a char must be converted
4186         to an unsigned char are now done this way, not by ad-hoc methods.
4187         (count): New type.  Use it whenever counts or states are needed.
4188         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
4189         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
4190         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
4191         whenever appropriate.
4192         (NOT_A_CHAR): Remove global macro; now a local enum.
4193         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
4194         the rest of the code no longer depends on them.
4195         (class_ok): Remove; all uses changed to use inline comparisons.
4196         (RE_NO_TYPE): Remove; wasn't used or needed.
4197         (struct List_element): normal_char and equiv_code are now unsigned
4198         char, not int.
4199         first_char, last_char, and the_repeated_char are now unsigned char,
4200         not unsigned int.  repeat_count is now count, not size_t.
4201         All uses changed.
4202         (struct Spec_list): state is now count, not unsigned int.
4203         lengthis now count, not size_t.
4204         n_indefinite_repeats is now size_t, not int.
4205         has_equiv_class, has_char_class, and has_restricted_char_class
4206         are now bool, not int.  All uses changed.
4207         (struct E_string): s is now char *, not unsigned char *.
4208         escaped is now bool *, not int *.  All uses changed.
4209         (ES_MATCH): Remove macro, replacing with:
4210         (es_match): New inline function.  All uses changed.
4211         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
4212         translating): Now bool, not int.
4213         (io_buf): Now char array, not unsigned char.
4214         (SET_TYPE): Remove.  All uses replaced with bool.
4215         (is_equiv_class_member, unquote, append_range, append_char_class,
4216         append_equiv_class, find_closing_delim, star_digits_closebracket,
4217         build_spec_list, parse_str, homogeneous_spec_list):
4218         Now returns bool, not int.  All uses changed.
4219         (is_equiv_class_member): Now inline.
4220         (is_equiv_class_member, is_char_class_member, make_printable_str,
4221         append_normal_char, append_range, append_repeated_char,
4222         get_s2_spec_stats):
4223         Args are now of proper integer type.
4224         (unquote, look_up_char_class, make_printable_str,
4225         append_equiv_class, build_spec_list, squeeze_filter):
4226         Avoid unsigned char *p; gently convert *p to unsigned char instead.
4227         (unquote, get_spec_stats): Do not jump past declarations and then
4228         use them; C doesn't allow this in portable programs.
4229         (make_printable_str): Check for overflow in size calculations.
4230         (xmemdup): Remove.  All uses rewritten.
4231         (find_bracketed_repeat): Args are now of proper pointer-to-integer
4232         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
4233         (find_bracketed_repeat, star_digits_closebracket): Check that the
4234         digits are not escaped.
4235         (build_spec_list): Don't bother to copy opnd_str; not needed.
4236         (build_spec_list, get_next): Simplify internal logic a bit.
4237         (card_of_complement): Fix bug due to char overflow.
4238         (get_spec_stats): Don't assume len fits into int.
4239         Check for integer overflow.  Use abort() rather than assert(0).
4240         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4241         was being invoked.
4242         (squeeze_filter): READER is never null now; simplify code.
4243         READER arg now has a simpler type.  Remove unnecessary casts.
4244         (squeeze_filter, main): Calls to fwrite improperly checked result
4245         against zero, rather than against requested size.
4246         (plain_read): New function.
4247         (read_and_delete, read_and_xlate):
4248         Remove unused filter arg, and don't worry about hit_eof.
4249         Simplify by using plain_read.
4250         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4251         (main): Always pass a non-null procedure to squeeze_filter.
4252         Rewrite so that class_ok isn't needed.
4253
4254 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4255
4256         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4257         fdatasync reports EBADF when syncing (unwritable) directories.
4258         Problem reported by Albert Chin-A-Young in:
4259         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4260
4261 2004-05-29  Jim Meyering  <jim@meyering.net>
4262
4263         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4264         Patch from Albert Chin.
4265
4266         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4267
4268         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4269         into a single statement.
4270
4271 2004-05-28  Jim Meyering  <jim@meyering.net>
4272
4273         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4274
4275 2004-05-22  Jim Meyering  <jim@meyering.net>
4276
4277         rm -r would get a failed assertion when run from an inaccessible
4278         directory and with two or more command line arguments including an
4279         absolute-named directory followed by a relative-named directory.
4280
4281         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4282         * src/remove.c (struct cwd_state): Define.
4283         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4284         can be detected by the caller.  Instead of returning a malloc'd
4285         directory name, communicate it to caller via a new parameter, and
4286         return an indication of whether restore_cwd failed.  Update caller.
4287         Eliminate an unnecessary call to AC_stack_top.
4288         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4289         so we can now communicate to caller whether/how functions like
4290         restore_cwd have failed.  Update caller.
4291         (rm_1): Fail if we've failed to restore the working directory
4292         and the name of the next file to remove is `.'-relative.
4293         (rm): Fail if the require_restore_cwd flag is true and we've
4294         failed to restore the working directory.
4295         * src/mv.c (rm_option_init): Initialize new member,
4296         x->require_restore_cwd.
4297         * src/rm.c (rm_option_init): Likewise.
4298
4299 2004-05-21  Jim Meyering  <jim@meyering.net>
4300
4301         * tests/rm/inaccessible: New test for the above fix.
4302         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4303
4304         * src/remove.c (rm): Use free rather than XFREE.
4305         (remove_dir): Use xmalloc, not XMALLOC.
4306         (ds_init): Likewise.
4307
4308 2004-05-20  Jim Meyering  <jim@meyering.net>
4309
4310         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4311         diagnostics in shred.c have been fixed, don't exempt shred.c from
4312         this check.
4313
4314         * src/shred.c: Use translatable diagnostics, e.g.
4315         change "%s: remove" to _("%s: failed to remove") and
4316         change "%s: close"  to _("%s: failed to close").
4317
4318 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4319
4320         * src/shred.c (names): Bring back lower-case letters, "_", and
4321         ".".  But continue to omit +, =, %, @, #, as they're either
4322         shell metacharacters (for some shells) or are not in some
4323         character sets, or (in the case of '%') must be a
4324         metacharacter somewhere.
4325
4326 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4327
4328         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4329
4330 2004-05-17  Jim Meyering  <jim@meyering.net>
4331
4332         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4333
4334         chgrp and chown now dereference symlinks by default, per POSIX.
4335         Reported by Michal Politowski as http://bugs.debian.org/249177.
4336
4337         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4338         * src/chown.c (usage): Update to reflect this.
4339         * src/chgrp.c (usage): Likewise.
4340         * NEWS: Describe the change.
4341         Adapt tests accordingly.
4342         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4343         * tests/chgrp/deref: Likewise.
4344         * tests/chgrp/posix-H: Likewise.
4345
4346 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4347
4348         In shred, check for errors from fdatasync more carefully.  If
4349         fdatasync fails with errno==EINVAL, it means this implementation
4350         does not support synchronized I/O for this file.  Do not report
4351         this as an error, as (for example) AIX 5.2 fdatasync reports it
4352         for raw disk devices.  Problem reported by Albert Chin in
4353         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4354
4355         Check for write errors, though: the old code ignored them.
4356         Improve error checking in a few other cases, too (e.g., close of a
4357         directory).
4358
4359         Also, change several 'int' values to 'bool', so that the error
4360         checking is a bit clearer.  Similarly, change unsigned values
4361         to size_t where appropriate.
4362
4363         * src/shred.c: Include "dirname.h".
4364         (datasync) [!HAVE_FDATASYNC]: Remove.
4365         (dosync): New function.
4366         (dopass): Use it.  Return 1 on write error, -1 on other error.
4367         All callers changed.  Report write error if dosync does.
4368         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4369         not int (0/-1).  All callers changed.  Return false if there's a
4370         write error.
4371         (incname): Return bool (true/false), not int (0/1).  Accept
4372         size_t length, not unsigned.  All callers changed.  Do not
4373         bother checking for non-digits; it can't happen.  Replace
4374         recursion with iteration.
4375         (wipename): Use dir_name, base_name, etc. instead of assuming
4376         Unix file names.  Use size_t for length, not unsigned.
4377         Report error if unlink or close fails.
4378         (wipename, main): Use bool for booleans.
4379
4380         (names): Use only digits and uppercase letters, for greater
4381         portability.
4382
4383 2004-05-16  Jim Meyering  <jim@meyering.net>
4384
4385         * tests/chown/deref: New test for the yesterday's change.
4386         * tests/chown/Makefile.am (TESTS): Add deref.
4387
4388 2004-05-15  Jim Meyering  <jim@meyering.net>
4389
4390         chown --dereference did nothing when the owner/group of a
4391         symlink matched the desired owner/group.  Reported by David Malone.
4392         Also reported in 1999 as http://bugs.debian.org/39642.
4393
4394         * src/chown-core.c (change_file_owner): When --dereference has
4395         been specified, and when processing a symlink, stat it to get the
4396         owner and group of the referent.
4397
4398 2004-05-14  Jim Meyering  <jim@meyering.net>
4399
4400         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4401         s/supercede/supersede/ reported by Andrew Fabbro.
4402
4403 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4404
4405         Improve performance of `sort -m' on large files, at the cost of
4406         making some contrived examples unsafe.  POSIX allows this
4407         optimization.  Performance problem reported by Jonathan Baker in
4408         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4409
4410         * src/sort.c (first_same_file): Do not treat input pipes
4411         differently from other files.
4412         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4413         might write F before reading all the input.
4414         * NEWS: Likewise.
4415
4416 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4417
4418         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4419         '\007', for portability to EBCDIC hosts.
4420         * src/printf.c (print_esc_char): Likewise.
4421         * src/tr.c (unquote, make_printable_str): Likewise.
4422
4423 2004-05-12  Jim Meyering  <jim@meyering.net>
4424
4425         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4426         where the result is used.  This avoids one unnecessary lstat call
4427         per command line argument.
4428
4429 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4430
4431         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4432
4433         * src/Makefile.am (all_programs.list): New rule, copied from
4434         man/Makefile.am and tests/Makefile.am, except that we use the
4435         system tr rather than ./tr and we don't use tr -s.
4436         * tests/Makefile.am (all_programs): Use it.
4437         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4438         for consistency.  All uses changed.
4439
4440 2004-05-11  Jim Meyering  <jim@meyering.net>
4441
4442         * tests/rm/unread3: New test, for the above fix and today's
4443         lib/save-cwd.c improvement.
4444         * tests/rm/Makefile.am (TESTS): Add unread3.
4445
4446         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4447
4448 2004-05-10  Jim Meyering  <jim@meyering.net>
4449
4450         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4451         * tests/install/Makefile.am (TESTS): Add trap.
4452
4453         * src/remove.c (AD_push): Don't use errno in diagnostic about
4454         `changed dev/ino'.
4455
4456         Remove these generated files from CVS.
4457         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4458         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4459         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4460         * tests/tr/tr-tests, tests/wc/wc-tests:
4461
4462 2004-05-09  Jim Meyering  <jim@meyering.net>
4463
4464         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4465         a loop initializing the just-allocated memory to zero.
4466
4467 2004-05-08  Jim Meyering  <jim@meyering.net>
4468
4469         * tests/rm/no-give-up: New file; check for today's fix.
4470         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4471
4472 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4473
4474         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4475         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4476
4477         * src/remove.c (remove_entry): Check for errno values like ENOENT
4478         that show the file cannot be directory, instead of for errno
4479         values like EPERM that show the file might be a directory.  This
4480         is necessary because, when a single unlink() call has multiple
4481         reasons to fail, it can set errno to any of those reasons; it's
4482         only the rare errno value like ENOENT that excludes all the other
4483         possible reasons to fail even when the file is a directory.
4484         (remove_cwd_entries): Don't attempt chdir if the file is known
4485         to not be a directory.
4486         (remove_dir): Use the same method that remove_cwd_entries uses
4487         (for some reason they differed).  Don't assert that saved_errno
4488         must be EPERM; it might be just about anything.
4489
4490 2004-05-06  Jim Meyering  <jim@meyering.net>
4491
4492         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4493         Don't add `1' to the buffer size (it was to protect against malloc
4494         implementations that fail to allocate a buffer of size zero).
4495         That is no longer necessary, since we use a malloc wrapper
4496         on such systems.
4497
4498         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4499         * src/head.c (elide_tail_bytes_pipe): Likewise.
4500         * src/df.c (main): Likewise.
4501         * src/shred.c (do_wipefd): Likewise.
4502         * src/users.c (list_entries_users): Likewise.
4503         * src/tail.c (main): Likewise.
4504         * src/md5sum.c (main): Likewise.
4505
4506 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4507
4508         * src/df.c (show_disk, show_point): If several filesystems are
4509         mounted on the same mount point, prefer the last one, not the first.
4510         Problem reported by Christian Jones in
4511         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4512         (show_disk): Remove unused statp arg.  Return bool, not int.
4513         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4514         for lofs and dummies for each pass through the mount table,
4515         rather than subtly different algorithms (which are probably
4516         inadvertent).
4517
4518 2004-05-03  Jim Meyering  <jim@meyering.net>
4519
4520         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4521         have m4/Makefile*.
4522
4523 2004-05-01  Jim Meyering  <jim@meyering.net>
4524
4525         When chown or chgrp is modifying the referent of a symlink,
4526         use the chown(2) function, if possible.
4527         * src/chown-core.c (change_file_owner): Don't hard-code the
4528         open/fchown/close kludge here.  Use `chown' instead.
4529         The chown function works just fine on conforming systems.
4530         Other systems now go through the new chown wrapper that
4531         resorts to the old kludge.
4532
4533         * src/chown-core.c (change_file_owner): Add a comment.
4534
4535 2004-04-27  Jim Meyering  <jim@meyering.net>
4536
4537         * src/ptx.c: Make over 40 global extern variables `static'.
4538         (syntax_table, re_syntax_table): Remove declarations of two unused
4539         variables (they were exposed by the above change).
4540
4541         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4542         * src/ln.c (backup_type): Likewise.
4543
4544         * src/remove.c (rm): Add `extern' keyword.
4545         * src/cp-hash.c (forget_created, remember_created)
4546         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4547         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4548         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4549         (uid_to_name, chown_files): Likewise.
4550
4551         * src/Makefile.am (sc_tight_scope): New rule.
4552         * Makefile.maint (sc_tight_scope): New rule.
4553         (syntax-check-rules): Add it.
4554
4555 2004-04-26  Jim Meyering  <jim@meyering.net>
4556
4557         * Use automake-1.8.4.  Regenerate dependent files.
4558
4559         * src/sort.c (limfield): Make a comment clearer.
4560
4561 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4562
4563         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4564         leading blanks when computing the location of the field end;
4565         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4566         does conform to POSIX.  Also fix the documentation to clarify
4567         this and related issues.
4568
4569         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4570         that the options are in alphabetical order.  Describe how -b works
4571         more-accurately; this involves fixing some examples, too.  Mention
4572         what happens if the start field falls after an end field or after
4573         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4574         Add an example of how to sort IPv4 addresses and Apache Common
4575         Log Format dates.  Remove a duplicate example.
4576         (Putting the tools together): Use separate options rather
4577         than agglomerating them.
4578         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4579         decode whether to skip leading blanks.
4580         (trailing_blanks): Remove.
4581         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4582
4583         * tests/pr/Test.pm: Fix typo in env_default comment.
4584         * tests/sort/Test.pm: Likewise.
4585         (18c, 18d): Reverse the order of output lines, so that the
4586         test cases conform to POSIX.
4587
4588 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4589
4590         More signal-handling cleanup for ls.c.  Do not allow signals to
4591         happen between arbitrary output bytes, as the
4592         restore-default-color sequence can bollix up multibyte chars or
4593         color-change sequences in the ordinary output.  Instead, process
4594         signals only between printing a file name and changing the color
4595         back to non_filename_text color.  That way, if the signal handler
4596         changes the color (to the default), 'ls' will change it back when
4597         'ls' continues (after being suspended).
4598
4599         Also, do not bother with signal-handling unless stdout is a
4600         controlling terminal; this lets stdio buffer better when "ls
4601         --color" is piped or sent to a file.
4602
4603         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4604         Do not include "full-write.h"; no longer needed.
4605         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4606         (put_indicator_direct): Remove.  All callers changed to use
4607         put_indicator.
4608         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4609         (restore_default_color): Don't bother checking for put_indicator
4610         failure.
4611         (sighandler): Don't handle SIGTSTP; that's another handler now.
4612         Simply set interrupt_signal to the signal, then exit.
4613         (stophandler, process_signals): New functions.
4614         (main): Don't output any color changes until _after_ the signal
4615         handlers are set up.  This fixes a race condition where 'ls'
4616         could be interrupted while initializing colors, and leaving the
4617         terminal in an undesirable state.
4618         Don't mess with signal-handling if standard output is not a
4619         controlling terminal.
4620         When exiting, restore the default color, then restore the
4621         default signal handling, then act on any signals that weren't
4622         acted on yet.
4623         Do not print //DIRED// etc. in colors; this avoids the need
4624         to catch signals when printing them.
4625         (print_name_with_quoting): Process signals just before switching
4626         color back to non_filename_text.
4627
4628 2004-04-23  Jim Meyering  <jim@meyering.net>
4629
4630         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4631         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4632         of quotearg_buffer.  Patch by Mikulas Patocka.
4633
4634 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4635
4636         tee ignored SIGPIPE, but POSIX doesn't allow this.
4637
4638         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4639         does not allow this.  This undoes the 1996-10-24 patch.
4640
4641 2004-04-18  Paul Eggert  <eggert@twinsun.com>
4642
4643         Signal-handling cleanup for coreutils.  Here are the highlights:
4644
4645          - csplit sometimes failed to remove files when interrupted.
4646          - csplit didn't clean up if two signals arrived nearly simultaneously.
4647          - install -s would infloop on System V if SIGCHLD was ignored.
4648          - ls could incorrectly restore color if multiple signals
4649            arrived nearly simultaneously.
4650
4651         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4652         Define.
4653         (filename_space, prefix, suffix, digits, files_created, remove_files):
4654         Now volatile.
4655         (caught_signals): New var.
4656         (cleanup): Block signals while deleting all files.
4657         (cleanup_fatal, handle_line_error, regexp_error):
4658         Mark with ATTRIBUTE_NORETURN.
4659         (create_output_file, close_output_file, interrupt_handler):
4660         Block signals while changing the number of output files,
4661         to fix some race conditions.
4662         (delete_all_files): Do nothing if remove_files is zero.
4663         Clear files_created.
4664         (main): Don't mess with signals until after argument processing
4665         is done.
4666
4667         * src/csplit.c (main): Rewrite signal-catching code to make it
4668         similar to other coreutils programs.  When processing signals,
4669         block all signals that we catch, but do not block signals that we
4670         don't catch.  Avoid problems with unsigned int warnings.
4671         * src/ls.c (main): Likewise.
4672         * src/sort.c (main): Likewise.
4673
4674         * src/csplit.c (interrupt_handler):
4675         Use void, not (obsolete) RETSIGTYPE.
4676         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4677
4678         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4679         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4680         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4681         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4682         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4683         for SIG_IGN.
4684         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4685
4686         * src/install.c: Include <signal.h>.
4687         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4688         given, since System V fork+wait does not work if SIGCHLD is ignored.
4689
4690         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4691         handler to self, not to SIG_IGN, since SIGTSTP can be received
4692         more than once.
4693         (main): Use SA_RESTART, as that is simpler than checking for EINTR
4694         failures all over the place.
4695
4696 2004-04-20  Jim Meyering  <jim@meyering.net>
4697
4698         * src/remove.c (is_empty_dir): Clarify comment.
4699
4700         * man/help2man: Accept new option: --program-name=NAME, so that we
4701         can override the one in --version output.  This is needed solely
4702         so that test.1 doesn't refer to `[' as the program name.
4703         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4704         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4705
4706         * src/pwd.c: Don't include pathmax.h; system.h already does it.
4707
4708         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4709
4710 2004-04-19  Jim Meyering  <jim@meyering.net>
4711
4712         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4713         Initialize a buffer to avoid warnings from tools like valgrind.
4714
4715         * Makefile.maint (sc_trailing_blank): New rule.
4716         (syntax-check-rules): Add it.
4717         * .x-sc_trailing_blank: New file.
4718
4719         Make pwd work even if the resulting name is so long that getcwd fails.
4720         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4721         (nth_parent, find_dir_entry, robust_getcwd): New functions.
4722         (main): First try getcwd, then, upon failure, robust_getcwd.
4723
4724 2004-04-18  Jim Meyering  <jim@meyering.net>
4725
4726         * src/who.c (print_user): Use xrealloc here, rather than
4727         unchecked realloc.  Remove anachronistic casts.
4728
4729         * src/remove.c (full_filename_): Don't leak upon failed realloc.
4730
4731         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4732         from remove.c.
4733         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4734         renaming it.  Update uses.
4735
4736 2004-04-17  Jim Meyering  <jim@meyering.net>
4737
4738         * configure.ac: Depend on automake-1.8.3.
4739
4740         * src/join.c (add_file_name): Declare function to be `static'.
4741         (string_to_join_field): Likewise.
4742         * src/remove.c (ds_init, ds_free): Likewise.
4743
4744         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4745         (syntax-check-rules): Add to the list.
4746
4747 2004-04-13  Paul Eggert  <eggert@twinsun.com>
4748
4749         Use page-aligned buffers whenever we bother to do I/O using buffer
4750         sizes that are tailored for the files.
4751
4752         * src/cat.c: Include getpagesize.h.
4753         * src/copy.c: Likewise.
4754         * src/shred.c: Likewise.
4755         * src/split.c: Likewise.
4756         * src/cat.c (main): Align I/O buffers to page boundaries.
4757         * src/copy.c (copy_reg): Likewise.
4758         * src/shred.c (dopass): Likewise.
4759         * src/split.c (main): Likewise.
4760         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4761         All uses replaced by ptr_align.
4762         * src/od.c (gcd, lcm): Remove; now in system.h.
4763         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4764
4765 2004-04-14  Jim Meyering  <jim@meyering.net>
4766
4767         Remove m4/Makefile.am: it's no longer needed, with newer automake
4768         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4769         * Makefile.am (SUBDIRS): Remove `m4' from the list.
4770
4771 2004-04-13  Jim Meyering  <jim@meyering.net>
4772
4773         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4774
4775 2004-03-27  Paul Eggert  <eggert@twinsun.com>
4776
4777         * NEWS: cp -pu and mv -u (when copying) now take the destination
4778         file system time stamp resolution into account.
4779         * doc/coreutils.texi (mv invocation): Document this.
4780         (cp invocation): Document -u (it was missing!) with new behavior.
4781
4782         * src/copy.c: Include "utimecmp.h".
4783         (copy_internal): Compare time stamps using utimecmp rather than
4784         MTIME_CMP.
4785
4786 2004-04-09  Jim Meyering  <jim@meyering.net>
4787
4788         * Makefile.maint (.re-list): New rule/file, to replace
4789         hard-coded list of header file names.
4790         (sc_system_h_headers): Use the new file.
4791         Don't look for sys2.h anymore.
4792
4793         * src/system.h: Include new "stat-macros.h" rather than hard-coding
4794         all of its macro definitions -- the list was slightly out of date.
4795         Suggestion from Dmitry V. Levin.
4796
4797 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
4798
4799         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
4800         * doc/coreutils.texi (dd invocation): Likewise.
4801         * src/shred.c (O_NOCTTY): Remove redundant decl.
4802         * src/dd.c (flags, usage): Remove noctty flag.
4803         (main): Always use O_NOCTTY when opening files.
4804
4805 2004-04-08  Jim Meyering  <jim@meyering.net>
4806
4807         * src/dd.c (dd_copy): Mark two diagnostics for translations.
4808         (set_fd_flags): Undo part of today's change: it's a little
4809         cleaner -- and more efficient in the common case -- to go
4810         ahead and OR in the -1 when fcntl fails.
4811
4812         * Makefile.maint (sc_dd_max_sym_length): New target.
4813         (syntax-check-rules): Add it.
4814
4815         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4816         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
4817
4818         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4819         Rename parameter, flags, to avoid shadowing global.
4820         (LONGEST_SYMBOL): Tweak comment.
4821
4822 2004-04-07  Paul Eggert  <eggert@twinsun.com>
4823
4824         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4825         and new dd options iflag= and oflag=.
4826         * src/dd.c (usage): Likewise.
4827         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4828         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4829         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4830         (input_flags, output_flags): New vars.
4831         (LONGEST_SYMBOL): New macro.
4832         (struct symbol_value): Renamed from struct conversion.  Members
4833         symbol and value renamed from convname and conversion.  The
4834         symbol value is now an array instead of a pointer; this saves
4835         a bit of space and time in practice.  All uses changed.
4836         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
4837         (flags): New constant array.
4838         (iflag_error_msgid, oflag_error_msgid): New constants.
4839         (parse_symbols): Renamed from parse_conversion and generalized
4840         to handle either conversion or flag symbols.
4841         (scanargs): Adjust uses of parse_symbols accodingly.  Add
4842         support for iflag= and oflag=.  Reject attempts to use
4843         both excl and nocreat.
4844         (set_fd_flags): New function.
4845         (dd_copy): Just return X rather than calling quit (X), since our
4846         caller invokes quit with the returned value.  Add support for
4847         fdatasync and fsync.
4848         (main): Add support for iflag=, oflag=, and new conv= symbols.
4849         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4850         O_RSYNC, O_SYNC): Define to 0 if not already defined.
4851
4852         * NEWS: Remove duplicate mention of BLOCKSIZE.
4853
4854 2004-04-02  Andreas Schwab  <schwab@suse.de>
4855
4856         * src/stty.c: Add support for IUTF8 input flag.
4857
4858 2004-04-06  Jim Meyering  <jim@meyering.net>
4859
4860         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4861         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
4862
4863 2004-04-04  Jim Meyering  <jim@meyering.net>
4864
4865         A specified format is no longer automatically newline terminated.
4866         If you want a newline at the end of your format, use `\n'.
4867         * src/stat.c (print_it): Don't print a newline at the end of
4868         every format.
4869         (do_statfs): Add a newline at end of each default format string.
4870
4871 2004-03-30  Paul Eggert  <eggert@twinsun.com>
4872
4873         * src/nohup.c (main): Adjust to new calling convention
4874         for set_cloexec_flag.
4875
4876 2004-03-31  Jim Meyering  <jim@meyering.net>
4877
4878         * tests/Fetish.pm (run_tests): Remove `.orig' file.
4879         Remove debugging diagnostic.
4880
4881         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4882         would not elicit an error.
4883         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4884         (main): Don't use atoi.  Use xstrtoul instead.
4885
4886 2004-03-30  Jim Meyering  <jim@meyering.net>
4887
4888         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4889         (syntax-check-rules): Add it.
4890         * .x-sc_prohibit_atoi_atof: New file.
4891
4892 2004-03-29  Jim Meyering  <jim@meyering.net>
4893
4894         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4895         test is not sensitive to system-dependent block size differences.
4896         Prompted by a report of Solaris 8 differences from Paul Eggert.
4897
4898         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4899         Rename `%tmp' to `%actual'.  Reverse order of last two args to
4900         _compare_files (to $actual, $expected) so as to match declaration.
4901
4902 2004-03-28  Paul Eggert  <eggert@twinsun.com>
4903
4904         Fix some gotchas encountered when porting to Solaris 8, using
4905         the Forte 6u2 compiler.
4906
4907         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4908         Declare sethostname, since no Solaris header does it.
4909         * src/who.c: Include "vasprintf.h", for asprintf.
4910
4911 2004-03-28  Jim Meyering  <jim@meyering.net>
4912
4913         Minor optimization:
4914         * src/du.c (process_file): Don't record dev/inode for directories.
4915
4916         Under some circumstances, without -c, du would mistakenly count the
4917         space of hard-linked files, not just the first one it encountered.
4918         Reported by Anthony Thyssen.
4919         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4920
4921         * src/du.c: Rename global `print_totals' to `print_grand_total'.
4922
4923         * src/du.c (main): Rearrange filtering loop to be a tiny bit
4924         more efficient.
4925
4926         * src/chown-core.c: Don't include savedir.h -- no longer needed.
4927         * src/chmod.c: Likewise.
4928
4929 2004-03-25  Jim Meyering  <jim@meyering.net>
4930
4931         * src/du.c (main): Remove now-unused declaration of `i'.
4932
4933 2004-03-24  Paul Eggert  <eggert@twinsun.com>
4934
4935         * src/du.c (main): Filter out file names of length zero before
4936         invoking fts, so that they don't cause fatal errors.
4937
4938 2004-03-25  Jim Meyering  <jim@meyering.net>
4939
4940         * tests/du/files0-from (zero-len): Add a test for the above.
4941
4942 2004-02-25  Paul Eggert  <eggert@twinsun.com>
4943
4944         * NEWS: New environment var BLOCKSIZE.
4945         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4946         * tests/envvar-check: Test for it.  Factor the code to simplify it.
4947
4948 2004-03-23  Paul Eggert  <eggert@twinsun.com>
4949
4950         * NEWS: Shorten the du --files0-from announcement, and say
4951         "NUL-terminated" rather than "NUL-separated".
4952         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4953         Remove: not used.
4954         (usage): Say "NUL-terminated", not "NUL-separated".
4955         (main): Check for I/O error when istream is closed.
4956         Allow --files0-from=F even if F is empty; this specifies no files.
4957         (du_files): Now that we allow the list of files to be empty,
4958         handle that case.
4959         * tests/du/files0-from: Adjust to above changes to src/du.c.
4960
4961 2004-03-24  Jim Meyering  <jim@meyering.net>
4962
4963         * tests/tail-2/assert: Avoid race condition that could cause
4964         spurious failure.  Based on a patch from Andreas Schwab.
4965
4966 2004-03-23  Jim Meyering  <jim@meyering.net>
4967
4968         * src/du.c (main): Free the hash table, too.
4969
4970 2004-03-22  Jim Meyering  <jim@meyering.net>
4971
4972         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4973         the change of 2004-01-22.  I can no longer reproduce the problem
4974         that prompted that change, and `info coreutils pr' would display the
4975         `printing text' section of the manual, not the one on `pr invocation'.
4976
4977         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4978         to match corrected output.
4979
4980         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4981         (main): Use readtoken0 functions rather than readtokens.
4982         Don't use errno when diagnosing readtokens0 failure.
4983         Fix off-by-one error in the token number reported in a diagnostic.
4984         (du_files): Return bool, rather than int.
4985         (main): Call readtokens0_free.
4986
4987 2004-03-21  Jim Meyering  <jim@meyering.net>
4988
4989         * src/remove.c (ds_free): Plug a small leak.
4990
4991         * tests/Fetish.pm: Fix typo in comment.
4992
4993 2004-03-07  Jim Meyering  <jim@meyering.net>
4994
4995         * NEWS: du accepts a new option --files0-from=FILE, where FILE
4996         contains a list of NUL-separated file names.
4997
4998         * src/du.c: Include "readtokens.h".
4999         (usage): Describe the new option, and adjust the `Usage':
5000         with this option, no FILE may be specified on the command line.
5001         (main): Handle the new option.
5002
5003         * tests/du/files0-from: New tests, for the above.
5004         * tests/du/Makefile.am (TESTS): Add files0-from.
5005
5006         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
5007         * src/tsort.c (tsort): Likewise.
5008
5009 2004-02-29  Paul Eggert  <eggert@twinsun.com>
5010
5011         * NEWS: Add support for a new notation @N to get_date to represent
5012         the time stamp with numeric value N.  Improve support for
5013         fractional time stamps.  date's -d and -f options now accept them.
5014         Likewise for touch -t.  date has a new option --iso-8601=ns.
5015
5016         * doc/coreutils.texi (touch invocation):
5017         Describe use of fractional seconds.
5018         (date invocation, Options for date): Likewise.
5019         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
5020         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
5021         (Options for date): Describe new --iso-8601=ns option.
5022
5023         * doc/getdate.texi: Add copyright notice.  Change getdate to
5024         get_date when talking about the function name.
5025         (Seconds since the Epoch): New section, containing the time_t
5026         info moved from Date input formats section, along with new
5027         info about the @ syntax.  Mention negative time stamps,
5028         fractional time stamps, and leap seconds.
5029         (General date syntax): Modernize examples a bit to reflect new
5030         features.
5031         (General date syntax, Relative items in date strings):
5032         Use ' rather than " to quote formats.
5033         (Time of day items): Add an example with fractional seconds.
5034         Describe fractional-second syntax.
5035
5036         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
5037         needs clock_gettime.
5038
5039         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
5040         (time_spec_string, time_spec, show_date): Support it.
5041         (usage): Remove description of -ITIMESPEC, as it's obsolete and
5042         confusing.  Mention --iso-8601=ns.
5043         (batch_convert): getline returns ssize_t, not int.
5044
5045         * src/touch.c (newtime): Now an array of two timespecs, one
5046         for access and one for modification.
5047         (ref_stats): Remove.
5048         (get_reldate): Use get_date's parameter profile.
5049         (touch, main): Adjust to above changes.
5050         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
5051         Use gettime instead of gettimeofday, for new get_date signature.
5052
5053         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
5054         ns-relative.
5055
5056 2004-03-15  Jim Meyering  <jim@meyering.net>
5057
5058         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
5059         target before updating $(prev_version_file).
5060
5061         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
5062         See today's change in lib/getdate.y.
5063         * tests/misc/Makefile.am (TESTS): Add date-sec.
5064
5065 2004-03-14  Jim Meyering  <jim@meyering.net>
5066
5067         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
5068         signature files, not `.asc'.  Reported by angico@yahoo.com.
5069
5070 2004-03-13  Jim Meyering  <jim@meyering.net>
5071
5072         * src/cp.c (do_copy): Tweak wording in a diagnostic.
5073         Suggestion from Karl Berry.
5074         Include "quoatearg.h".
5075         (do_copy): Use quotearg_colon (not quote) for diagnostics
5076         that begin with `"%s:'.
5077
5078         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
5079         Suggestion from Dan Jacobson.
5080
5081 2004-03-12  Jim Meyering  <jim@meyering.net>
5082
5083         * Version 5.2.1.
5084
5085         Sometimes, when source and destination partition are different,
5086         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
5087
5088         * src/copy.c: When moving a set of N hard-linked files between
5089         partitions, via two or more command line arguments where the
5090         command line argument containing the Nth link contains no other
5091         link to that same file, mv would mistakenly copy the file, rather
5092         than hard-linking it to the other(s).  That happens because when the
5093         final link is processed, its link count has been reduced to 1 since
5094         the other links have been `copied' to the destination partition
5095         and the source links have been removed.
5096         (copy_internal): When in move mode, use the source dev/inode
5097         pair to look up destination name even when st_nlink == 1.
5098         * src/cp-hash.c (src_to_dest_lookup): New function.
5099         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
5100         * tests/mv/part-hardlink: New file.  Test for the above fix.
5101         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
5102
5103         * announce-gen: Sync with autoconf.
5104
5105         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
5106         This was triggered on a Linux-2.2.19 system using a file system
5107         NFS-mounted from some sort of Sun.
5108
5109 2004-03-11  Jim Meyering  <jim@meyering.net>
5110
5111         * Use automake-1.8.3.  Regenerate dependent files.
5112
5113 2004-03-10  Jim Meyering  <jim@meyering.net>
5114
5115         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
5116         so that this test works with SELinux-enabled systems.
5117         Based on a patch from Tim Waugh.
5118
5119         `join -1 x' would give a misleading diagnostic
5120         * src/join.c (string_to_join_field): Report that a non-numeric field
5121         number is invalid, rather than `so large that it is not representable'.
5122         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
5123
5124 2004-03-06  Jim Meyering  <jim@meyering.net>
5125
5126         cp --sparse=always sparse-image-file.img /dev/hda1 could
5127         produce an invalid copy on the destination device.
5128
5129         * src/copy.c (copy_reg): Even with --sparse=always, try to
5130         make `holes' only if the destination is a regular file.
5131         Reported by Szakacsits Szabolcs.
5132
5133 2004-03-03  Paul Eggert  <eggert@twinsun.com>
5134
5135         * src/nohup.c (main): Don't invoke set_cloexec_flag with
5136         a file descriptor of -1.
5137
5138 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
5139
5140         * src/nohup.c: Include "cloexec.h".
5141         (main): Set the copy of stderr to close on exec.
5142
5143 2004-03-01  Paul Eggert  <eggert@twinsun.com>
5144
5145         * configure.ac: Include <signal.h> when checking for strsignal,
5146         sys_siglist, and friends.  Problem reported by Tony Leneis in
5147         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
5148
5149 2004-02-25  Paul Eggert  <eggert@twinsun.com>
5150
5151         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
5152         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
5153         etc. are set.
5154
5155 2004-02-23  Paul Eggert  <eggert@twinsun.com>
5156
5157         * NEWS: Document how chown's USER.GROUP argument is now parsed.
5158
5159 2004-02-23  Jim Meyering  <jim@meyering.net>
5160
5161         * src/seq.c (usage): Remove stray space after \n in --help output.
5162
5163 2004-02-22  Jim Meyering  <jim@meyering.net>
5164
5165         * src/du.c (usage): Separate -H and --si.  Say that the meaning
5166         of -H will soon change to that of --dereference-args (-D).
5167
5168 2004-02-21  Jim Meyering  <jim@meyering.net>
5169
5170         * src/comm.c (usage): Tell what comm does when there are no options.
5171         Reword in terms of FILE1 and FILE2 rather than `left file' and
5172         `right file'.  Suggestion from Dan Jacobson.
5173
5174 2004-02-15  Paul Eggert  <eggert@twinsun.com>
5175
5176         Fix some POSIX-conformance bugs in expr.
5177
5178         * NEWS: document the following changes to src/expr.c.
5179         * doc/coreutils.texi (expr invocation): Likewise.
5180         Document what forms integers may take, and say "integer"
5181         consistently instead of "number".  Warn about operands
5182         that "expr" can misinterpret, and how to work around the
5183         problem.
5184         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
5185         Accept a bool argument specifying whether to evaluate the
5186         expression.  This is to allow short-circuit evaluation.  All
5187         callers changed.
5188         (null): Report that a string is zero even if it has
5189         a form like "-0" or "00".
5190         (eval1, eval): Use short-circuit evaluation for | and &.
5191         (eval): Return 0 if both arguments are null or zero, instead
5192         of returning the first argument.
5193         * tests/expr/basic: Add some tests for the above.
5194
5195 2004-02-17  Jim Meyering  <jim@meyering.net>
5196
5197         * Version 5.2.0.
5198
5199         `make check' from a build inside a chroot environment would fail
5200         * tests/help-version: Specify an argument (`/') for df, in the
5201         unusual event that there is no valid entry in /etc/mtab.
5202         Likewise for id: add the -u option, so we don't get spurious
5203         failures when there are no user or group names.
5204         Patch by Tim Waugh.
5205
5206         * src/sort.c (usage) [-u]: Add punctuation so that the description in
5207         the help2man-generated (line-joined) man page is more readable.
5208         Reported by Tim Waugh.
5209         [-T]: Add a semicolon, for the same reason.
5210
5211 2004-02-15  Jim Meyering  <jim@meyering.net>
5212
5213         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
5214
5215 2004-02-11  Jim Meyering  <jim@meyering.net>
5216
5217         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
5218         $(srcdir)/../Makefile.am.in, rather than $<.
5219         Suggestion from Michael Elizabeth Chastain.
5220
5221 2004-02-10  Jim Meyering  <jim@meyering.net>
5222
5223         * config/install-sh: Make this script executable.
5224         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
5225         is executable.  Otherwise, on systems that lack a suitable install
5226         binary, `make install' would fail, because of the way this script
5227         is invoked (without `$SHELL ' prefix).
5228         Reported by Bob Proulx.
5229
5230 2004-02-08  Jim Meyering  <jim@meyering.net>
5231
5232         * Version 5.1.3.
5233
5234         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5235         that would cause an unwarranted test failure.
5236         * tests/rm/rm3: Likewise.
5237
5238 2004-02-07  Jim Meyering  <jim@meyering.net>
5239
5240         Remove xstat function pointer member.  The way it was used was not
5241         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5242         inline `stat' and `lstat' functions, thus making the tests of
5243         `xstat == lstat' in copy.c always fail.
5244         * src/copy.h (struct cp_options) [xstat]: Remove member.
5245         (XSTAT): New macro.
5246         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5247         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5248         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5249         (valid_options): Remove now-obsolete FIXME comments.
5250
5251         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5252         `*(x->xstat) (...)'.
5253         (do_copy): Declare/use local xstat rather than x->xstat.
5254         (main): Remove code that set x.xstat.
5255         * src/mv.c (cp_option_init): Don't initialize xstat member.
5256         * src/install.c (cp_option_init): Likewise.
5257
5258         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5259         so that emit_upload_commands can use these variables, too.
5260
5261 2004-02-06  Jim Meyering  <jim@meyering.net>
5262
5263         * tests/rm/deep-1: Remove `du' stack space test.
5264         Apparently, `ulimit -s N' isn't portable enough.
5265         This test will be restored (with a guard against losing ulimit)
5266         in its own file later.
5267
5268         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5269         since this test doesn't take long enough to merit them.
5270         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5271
5272         * Makefile.maint (signatures): Remove definition.
5273         Now, automake's gnupload handles this.
5274         (%.sig: %): Remove now-unused rule.
5275         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5276         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5277         (emit-upload-commands): Adjust to use gnupload.
5278
5279 2004-02-05  Jim Meyering  <jim@meyering.net>
5280
5281         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5282         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5283         Now, those are all defined in timespec.h.
5284         Include timespec.h.
5285
5286         * src/date.c: Don't include timespec.h, now that system.h does it.
5287
5288 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5289
5290         Don't dump core if localtime returns NULL (possible on
5291         hosts with 64-bit time_t and 32-bit int).
5292         * src/date.c: Include "inttostr.h".
5293         (batch_convert, main):
5294         If time conversion fails, exit with nonzero status.
5295         (show_date): Return int to report conversion failure.
5296         Print the time as an int if localtime fails.
5297         * src/uptime.c: Print "??" if the current clock can't
5298         be converted by localtime.  This won't happen until the year
5299         2*31 + 1900, but we don't want to dump core even if the current
5300         clock has the wrong value.
5301
5302         * src/stat.c: Include "inttostr.h".
5303         (human_time): Print the date/time as a number of seconds since the
5304         epoch if it can't be converted by localtime.  This is better than
5305         just saying "invalid", and is consistent with what "ls" does.
5306         Don't dump core if the year has more than 48 digits; this isn't
5307         possible on any contemporary host, but we might as well do it right.
5308
5309 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5310
5311         * src/stat.c (human_time): Accept time rather than
5312         pointer-to-const-time parameter, for clarity.  All callers changed.
5313
5314 2004-02-02  Jim Meyering  <jim@meyering.net>
5315
5316         * src/stat.c (do_stat): Remove extra trailing newline from
5317         default formats.  Reported by Nelson H. F. Beebe.
5318
5319         Print actual fractional seconds in time stamps, not just `.00000000'.
5320         * src/stat.c (human_time): Add and use new parameter, t_ns.
5321         (print_stat): Update callers.
5322         * src/ls.c (TIMESPEC_NS): Remove definition.
5323         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5324         also uses this macro.
5325         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5326         fractional seconds for files on an XFS file system, but that stat's
5327         fractional seconds were always zero.
5328
5329 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5330
5331         * src/seq.c (print_numbers): Use 'double' for loop index, not
5332         'int', to avoid problems with integer overflow.  On almost all
5333         machines 'double' works in every case where 'int' works, and
5334         it works on other cases besides.
5335
5336 2004-01-27  Jim Meyering  <jim@meyering.net>
5337
5338         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5339         it defaults to 1, even when FIRST is larger than LAST.
5340         Reword so as not to exclude the possibility that INCREMENT be zero.
5341
5342 2004-01-25  Jim Meyering  <jim@meyering.net>
5343
5344         * Version 5.1.2.
5345
5346         * Makefile.maint (signatures): Comment out definition.
5347
5348 2004-01-23  Jim Meyering  <jim@meyering.net>
5349
5350         * Makefile.maint (header_regexp): Add exitfail.
5351
5352         * man/Makefile.am (EXTRA_DIST): Add help2man.
5353         Reported by Nelson H. F. Beebe.
5354
5355         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5356         so it works on systems with Perl installed somewhere other than in
5357         /usr/bin.
5358
5359         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5360         `int', not `char', since it must hold EOF.  This bug would make
5361         paste infloop on some systems.  Test failures reported by
5362         Nelson H. F. Beebe and Christian Krackowizer.
5363
5364 2004-01-22  Jim Meyering  <jim@meyering.net>
5365
5366         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5367         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5368
5369         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5370         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5371         Use --info-page='coreutils PROG' option.
5372         Now, readlink.1 refers the user to `info coreutils readlink'
5373         rather than to `info readlink'.  Reported by Matt Swift.
5374
5375 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5376
5377         Exit status cleanup.
5378
5379         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5380         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5381         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5382         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5383         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5384         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5385         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5386         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5387         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5388         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5389         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5390         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5391         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5392         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5393         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5394         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5395         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5396
5397         * src/cat.c (usage): Don't bother normalizing exit status
5398         since the arg is already the correct exit status now.
5399         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5400         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5401         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5402         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5403         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5404
5405         * src/chown.c (main): Removed unused local 'fail'.
5406
5407         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5408         Remove.
5409
5410         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5411         * src/env.c, src/nice.c, src/su.c: Likewise.
5412         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5413         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5414         * src/expr.c (main): Use initialize_exit_failure rather than
5415         setting exit_failure directly; this optimizes away redundant
5416         assignments.
5417         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5418
5419         * src/chroot.c (main): Exit with status 1 rather than 127
5420         if chroot itself fails, as per documentation.
5421
5422         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5423         rather than roll-your-own symbols or integers.
5424         * src/env.c (main): Likewise.
5425         * src/nohup.c (main): Likewise.
5426         * src/su.c (run_shell): Likewise.
5427
5428         * src/cp.c (exit_status): Remove static var....
5429         (main): Making it local here instead.  Use =, not |=, to set it.
5430
5431         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5432         not 2, on errors.
5433         * src/date.c (batch_convert, main): Likewise.
5434         * src/dd.c (dd_copy): Likewise.
5435         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5436         * src/tr.c (main): Likewise.
5437         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5438         POSIX doesn't require it.
5439         * src/dd.c (write_output, skip, dd_copy): Likewise.
5440         * src/df.c (main): Likewise.
5441         * src/id.c (main): Likewise.
5442         * src/install.c (main): Likewise.
5443         * src/ln.c (main): Likewise.
5444         * src/ls.c (main): Likewise.
5445         * src/mv.c (main): Likewise.
5446         * src/shred.c (main): Likewise.
5447
5448         * src/env.c (main): Exit with status 1, not 2, on errors detected
5449         by env proper.
5450         * src/hostname.c (main): Likewise.
5451         * src/nl.c (main): Likewise.
5452         * src/stty.c (main): Likewise.
5453
5454         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5455         consistency with the other programs' naming conventions.
5456         All uses changed.
5457
5458         * src/factor.c (main): Do not report a usage error simply
5459         because stdin has bad numbers.
5460
5461         * src/id.c (problems): Now a boolean int, not a counter,
5462         so that we don't have to worry about int overflow.  All uses changed.
5463         * src/touch.c (err): Likewise.
5464
5465         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5466
5467         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5468         * src/mknod.c: Likewise.
5469
5470         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5471         on error; this is in case EXIT_FAILURE is unusual.
5472         * src/su.c (main): Likewise.
5473
5474         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5475         changed to EXIT_CANNOT_INVOKE.
5476
5477         * src/printenv.c (PRINTENV_FAILURE): New constant.
5478         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5479         command-line syntax problems.
5480
5481         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5482         (main): Avoid integer overflow when seeing whether errors occurred.
5483
5484         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5485         All callers changed.
5486         (main): Remove unused local variable 'errs'.  Always exit successfully
5487         if we reach the end.
5488
5489         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5490         for consistency with other programs here.  All uses changed.
5491         (main): Use 'error' to exit rather than invoking 'exit' here.
5492
5493         * src/sort.c: Don't include <assert.h>.
5494         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5495         (usage): Don't use 'assert'.
5496         (main): Remove redundant assignment to exit_failure.
5497
5498         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5499         New enum values.
5500         (initialize_exit_failure): New inline function.
5501         Include exitfail.h here, since we refer to exit_failure.
5502         All callers changed to not include exitfail.h.
5503
5504         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5505         substitute them for the corresponding integer constants.
5506
5507         * tests/help-version (expected_failure_status_date): Remove, as
5508         'date' is now normal.
5509         (expected_failure_status_nohup): New var.
5510
5511 2004-01-21  Jim Meyering  <jim@meyering.net>
5512
5513         * tests/touch/relative: Remove `command' syntax.
5514         Thanks to Nelson H. F. Beebe and Paul Eggert.
5515
5516         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5517         so as to avoid problems with systems using TAI clocks.
5518         Although it's no longer necessary, set TZ=UTC0 also for the
5519         initial touch command.  Reported by Paul Jarc here:
5520         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5521
5522 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5523
5524         * src/dircolors.hin: Add .mov to the list of media files.
5525
5526 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5527
5528         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5529         portable).  Problem reported by Christian Krackowizer.  Also, use
5530         +0000 rather than +0 to specify a time zone, as the documentation
5531         requires four digits.
5532
5533 2004-01-19  Jim Meyering  <jim@meyering.net>
5534
5535         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5536         * tests/mv/backup-is-src: Likewise.
5537         Problem reported by Peter Horst
5538
5539 2004-01-17  Jim Meyering  <jim@meyering.net>
5540
5541         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5542
5543         * Version 5.1.1.
5544
5545 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5546
5547         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5548         with -r specifying the origin for -d.
5549         * src/touch.c (flexible_date): Remove static var.
5550         (get_reldate): New function.
5551         (main): Use it, to implement this new behavior.
5552
5553 2004-01-16  Jim Meyering  <jim@meyering.net>
5554
5555         * tests/touch/relative: New test for the above.
5556         * tests/touch/Makefile.am (TESTS): Add relative.
5557
5558 2004-01-13  Jim Meyering  <jim@meyering.net>
5559
5560         * src/system.h: Include contents of sys2.h.
5561         * src/sys2.h: Remove file.
5562         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5563
5564         * Use automake-1.8.2.  Regenerate dependent files.
5565
5566         * Update to gettext-0.13.1.
5567         * configure.ac: Use gettext-0.13.1.
5568         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5569
5570 2004-01-12  Jim Meyering  <jim@meyering.net>
5571
5572         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5573
5574         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5575         Reported by Alexandre Duret-Lutz.
5576
5577         * src/tail.c (main): Warn about following stdin only when it's a tty.
5578
5579         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5580
5581 2004-01-10  Jim Meyering  <jim@meyering.net>
5582
5583         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5584
5585 2004-01-09  Jim Meyering  <jim@meyering.net>
5586
5587         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5588
5589 2004-01-08  Jim Meyering  <jim@meyering.net>
5590
5591         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5592         From Andreas Schwab.
5593
5594         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5595         remnant) from PATH component.  That would cause tests in this directory
5596         not to run the just-built binaries, but rather whatever happened
5597         to be in one's PATH.  Reported by Christian Krackowizer.
5598
5599 2004-01-04  Jim Meyering  <jim@meyering.net>
5600
5601         * src/csplit.c (new_control_record): Use x2nrealloc
5602         rather than xrealloc.
5603
5604         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5605         alloca and strcpy.
5606         (make_path_private): Likewise.
5607
5608 2004-01-03  Jim Meyering  <jim@meyering.net>
5609
5610         * src/paste.c: Use `bool' (not int) as the type for a few
5611         global variables.
5612         (collapse_escapes): Rewrite to set globals rather than modifying
5613         its parameter.
5614         Use size_t (not int) for all counters and related index variables.
5615         (paste_parallel): Remove needless complexity of
5616         using xrealloc in the loop;  just allocate the buffers up front.
5617         Free the two temporary buffers.
5618         Move declarations of locals `down' into scope where used.
5619         (paste_serial): Remove `register' attributes.
5620         (main): Simplify delim-related code.
5621         Free `delims', now that it's malloc'd.
5622
5623 2004-01-02  Jim Meyering  <jim@meyering.net>
5624
5625         * src/chroot.c: Include "quote.h".
5626         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5627         (main): Exit with status of 127, not 1, for too-few-args,
5628         chroot failure, or chdir failure.
5629         Give a better diagnostic upon execvp failure.
5630
5631         * src/du.c (usage): Mention that, with its current meaning,
5632         -H is deprecated.
5633
5634         * src/tail.c (main): Warn about following stdin when it's a tty.
5635         Fail when following by name but no names are specified.
5636
5637 2003-12-30  Jim Meyering  <jim@meyering.net>
5638
5639         * src/fold.c (main): Use memcpy, not strcpy.
5640
5641         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5642         alloca and strcpy.
5643
5644 2003-12-28  Jim Meyering  <jim@meyering.net>
5645
5646         * src/unexpand.c (n_tabs_allocated): New global.
5647         (add_tabstop): Use x2nrealloc rather than xrealloc.
5648         * src/expand.c: Likewise.
5649
5650         * tests/misc/expand: New file.
5651         * tests/misc/Makefile.am (TESTS): Add expand.
5652
5653         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5654         (fillbuf): Use x2nrealloc rather than xrealloc.
5655         (sort): Use xnmalloc rather than xmalloc.
5656         (main): Likewise.
5657
5658 2003-12-27  Jim Meyering  <jim@meyering.net>
5659
5660         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5661
5662 2003-12-29  Paul Eggert  <eggert@twinsun.com>
5663
5664         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5665         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5666
5667         * doc/coreutils.texi (join invocation): Remove documentation
5668         accordingly.  Document that -t makes all separators significant.
5669
5670         * src/join.c: Include posixver.h.
5671         (obsolete_usage): New var.
5672         (longopts): Put obsolete options first.
5673         (OBSOLETE_LONG_OPTIONS): New constant.
5674         (get_option, add_file_name): New functions.
5675         (main): Use them to support new behavior.
5676         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5677         Do not mark -j FIELD as obsolescent; it is longstanding
5678         UNIX tradition and is a valid extension to POSIX.
5679
5680         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5681
5682 2003-12-28  Paul Eggert  <eggert@twinsun.com>
5683
5684         * src/join.c (add_field_list): Don't use alloca with unbounded
5685         size; just modify the argument, which is no longer const *.
5686
5687         Various other minor cleanups, mostly to avoid the need for casts.
5688
5689         (extract_field): Renamed from ADD_FIELD, as it's now a function.
5690
5691         (struct field.beg): Now char *, not unsigned char const *.  All
5692         uses changed.  It shouldn't be const since xmemcoll writes on its
5693         arguments.
5694         (extract_field): Likewise, for 2nd arg.
5695         (keycmp): Remove now-unnecessary cast of xmemcoll args.
5696
5697         (is_blank): New function, to avoid need to cast arg to unsigned char.
5698         (extract_field): Use it.
5699
5700         (xfields): Rewrite pretty much from scratch.
5701
5702         (hard_LC_COLLATE): Now bool, not int.
5703         (get_line, getseq, add_field_list): Now returns bool, not int.
5704         (decode_field_spec, add_field_list): Return true on success (not
5705         false), for consistency with the rest of the code.  All uses changed.
5706
5707         (tab): Now char, not unsigned char.  This wasn't 100% necessary
5708         but is slightly cleaner.
5709         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5710
5711         (empty_filler): Now const *.
5712
5713         (make_blank): Remove; wasn't needed.  Remove all calls.
5714         (main): Don't set uni_blank.nfields; zero is fine.
5715
5716 2003-12-27  Jim Meyering  <jim@meyering.net>
5717
5718         * src/join.c: Include "quote.h".
5719         (min, max): Remove definitions.
5720         Make a few function parameters and corresponding
5721         locals `const'.  Use bool for boolean variables.
5722         Use size_t (not int) for all counters and related index variables.
5723         (prjoin): Remove now-useless assertion.
5724         (string_to_join_field): New function.
5725         (main): Accept join fields as large as SIZE_MAX.
5726         (keycmp): Rename `min' to MIN and max to MAX.
5727
5728 2003-12-26  Jim Meyering  <jim@meyering.net>
5729
5730         fold -s didn't work on e.g., alpha-based systems.
5731         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5732         x2nrealloc works properly on systems with differing sizes for int
5733         and size_t.  Reported by Nelson Beebe.
5734
5735         * src/fold.c: Use `bool' (not int) as the type for a few
5736         global variables.
5737
5738 2003-12-23  Paul Eggert  <eggert@twinsun.com>
5739
5740         * src/ls.c (length_of_file_names_and_frills):
5741         Remove forward decl; not needed.
5742         (print_file_name_and_frills, length_of_file_name_and_frills):
5743         With -m, don't output spaces before inum or size.
5744         (print_with_commas): Don't output space just before newline.
5745
5746 2003-12-24  Jim Meyering  <jim@meyering.net>
5747
5748         * tests/ls/Makefile.am (TESTS): Add m-option.
5749         * tests/ls/m-option: New file.  Test for above fixes.
5750
5751 2003-12-20  Jim Meyering  <jim@meyering.net>
5752
5753         * Version 5.1.0.
5754
5755         * src/pr.c: Change type of global, buff_allocated, to size_t.
5756
5757         * src/join.c [struct seq]: Change types of members count and alloc
5758         from `int' to `size_t'.
5759
5760         * tests/Makefile.am (root-hint): Tweak wording.
5761
5762         * src/du.c: Accept new option (-0, --null) that makes it so each
5763         output line is NUL-terminated rather than newline-terminated.
5764
5765         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5766         Reported by Volker Paul.
5767         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5768         * tests/dd/unblock-sync: New test for the above.
5769
5770 2003-12-19  Jim Meyering  <jim@meyering.net>
5771
5772         * tests/misc/nohup: Double quote back-ticked expression,
5773         in case it ends up having an unexpected value.
5774
5775         * tests/ls/no-arg: Use ls's -1 option in both runs.
5776
5777         * src/du.c (fts_debug): New global.
5778         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5779         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5780         (main) [DU_DEBUG]: Accept -d option.
5781
5782 2003-12-18  Jim Meyering  <jim@meyering.net>
5783
5784         * src/ls.c (format_user): Increment dired_pos via two statements,
5785         `dired_pos += width; dired_pos++;' rather than one,
5786         `dired_pos += width + 1;' since the latter could conceivably overflow.
5787         (format_group): Likewise.
5788         From Paul Eggert.
5789
5790         * configure.ac: Require automake-1.8.
5791
5792 2003-12-12  Jim Meyering  <jim@meyering.net>
5793
5794         * Use automake-1.8.  Regenerate dependent files.
5795
5796 2003-12-08  Jim Meyering  <jim@meyering.net>
5797
5798         * Makefile.maint (news-date-check): New rule.
5799         (alpha beta major): Depend on it.
5800
5801 2003-12-03  Paul Eggert  <eggert@twinsun.com>
5802
5803         * NEWS: ls -l (and similar options) now adjust all columns to
5804         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
5805         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5806         (format_user_width, format_group_width, unsigned_file_size,
5807         format_group): New functions.
5808         (block_size_width): Renamed from block_size_size.
5809         (inode_number_width, nlink_width, owner_width, group_width,
5810         author_width, major_device_number_width, minor_device_number_width,
5811         file_size_width): New vars.
5812         (clear_files): Initialize them.
5813         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
5814         (print_long_file): Use them.
5815         (gobble_file): Use a new local variable 'f' to make the code
5816         smaller and more consistent with other functions.
5817         (format_user): Output to stdout, not to a buffer, so that we
5818         don't have to worry about buffer overrun.  Update dired_pos.
5819         (print_long_file): Don't put owner, group, author into buffer;
5820         just print them directly.  Don't assume link counts and
5821         major and minor numbers fit into unsigned long int.
5822         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5823         'ls' output is fixed-width.
5824
5825 2003-12-02  Jim Meyering  <jim@meyering.net>
5826
5827         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5828
5829 2003-11-27  Jim Meyering  <jim@meyering.net>
5830
5831         * Use automake-1.7f.  Regenerate dependent files.
5832
5833 2003-11-24  Paul Eggert  <eggert@twinsun.com>
5834
5835         Parse floating-point operands and options in the C locale.
5836         POSIX requires this for printf, and we might as well be
5837         consistent elsewhere (tail, sleep, seq).
5838
5839         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5840         needed now that we assume C89.  Include "c-strtod.h".
5841         (xstrtod): Call c_strtod, not strtod.
5842         * src/sleep.c: Include "c-strtod.h".
5843         (main): Update xstrtod call to include new argument, c_strtod.
5844         * src/seq.c (scan_double_arg): Likewise.
5845         * src/tail.c (parse_options): Likewise.
5846
5847 2003-11-24  Jim Meyering  <jim@meyering.net>
5848
5849         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5850         Reported by Mark Conty.
5851
5852 2003-11-22  Jim Meyering  <jim@meyering.net>
5853
5854         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
5855         (sc_system_h_headers): Do this test only if sys2.h exists.
5856
5857 2003-11-20  Jim Meyering  <jim@meyering.net>
5858
5859         * tests/help-version: Ensure that the bug-reporting address is
5860         included in the --help output for every program.
5861         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5862
5863         * src/ptx.c (usage): Output bug-reporting address.
5864         Reported by Dan Jacobson.
5865
5866 2003-11-19  Jim Meyering  <jim@meyering.net>
5867
5868         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5869         on the join fields.  Suggestion from Bruce Robertson.
5870
5871 2003-11-18  Jim Meyering  <jim@meyering.net>
5872
5873         `od -c -w9999999' could segfault
5874         * src/od.c (dump): Use xnmalloc/free, not alloca.
5875
5876 2003-11-16  Jim Meyering  <jim@meyering.net>
5877
5878         * Use autoconf-2.59.  Regenerate dependent files.
5879
5880         * tests/du/hard-link: Minor tweak: use mkdir -p.
5881
5882         Fix read-from-free'd-buffer error detected by valgrind.
5883         * src/csplit.c (remove_line): Don't return a pointer to data in
5884         a freed buffer.  Instead, arrange to free the buffer on the
5885         subsequent call.
5886
5887         * tests/misc/csplit: New test for above fix.
5888
5889 2003-11-11  Jim Meyering  <jim@meyering.net>
5890
5891         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5892         This avoids a warning from valgrind about memcpy with overlapping
5893         source and destination.
5894
5895         * configure.ac: Require automake-1.7.8.
5896
5897 2003-11-09  Jim Meyering  <jim@meyering.net>
5898
5899         * Use automake-1.7.9.  Regenerate dependent files.
5900
5901         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5902         * src/chown.c: Likewise.
5903
5904         * src/chown-core.c: Include "root-dev-ino.h".
5905         (chopt_init): Initialize new member.
5906         (change_file_owner): Support rm's new --preserve-root option.
5907
5908         * src/remove.c: Include "root-dev-ino.h".
5909         (remove_cwd_entries): Remove now-obsolete FIXME comment.
5910         (remove_dir): Support rm's new --preserve-root option.
5911
5912         * src/chown.c: Include "root-dev-ino.h".
5913         Add new options: --preserve-root and --no-preserve-root.
5914
5915         * src/chmod.c: Include "root-dev-ino.h".
5916         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5917         ROOT_DEV_INO_WARN macros.
5918         (get_root_dev_ino): Remove function definition, now that it's
5919         been moved to a separate file.
5920         (usage): Describe new options.
5921
5922         * src/mv.c (rm_option_init): Initialized new member.
5923
5924         * src/remove.h: Include "dev-ino.h".
5925         (struct rm_options): Add new member: root_dev_ino.
5926         * src/chown-core.h: Include "dev-ino.h".
5927         (struct Chown_option): Add new member: root_dev_ino.
5928
5929 2003-11-06  Jim Meyering  <jim@meyering.net>
5930
5931         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5932         hard-coding `sizeof FILE*'.
5933
5934 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
5935
5936         * src/wc.c (main): Free `fstatus' so there is no confusion about
5937         whether it's leaked or not.
5938         * src/who.c (who): Likewise for `utmp_buf'.
5939
5940 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5941
5942         Fix 'cut' problems with size_t overflow and unsigned int.
5943         More generally, resize integer variables to fit use more precisely.
5944         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5945         (struct range_pair): Make members to be of type size_t, not unsigned.
5946         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5947         (suppress_non_delimited, output_delimiter_specified,
5948         have_read_stdin, print_kth, set_fields): Now bool, nt int.
5949         (delim): Now unsigned char, not int.
5950         (mark_printable_field, is_printable_field, is_range_start_index,
5951         set_fields, set_fields, cut_bytes, cut_fields):
5952         Use size_t, not unsigned, for field and byte counts.
5953         (hash_int): Use uintptr_t, not unsigned, for pointers converted
5954         to integers.  This squeezes more info out of them.
5955         (set_fields, cut_bytes, cut_fields, main):
5956         Use bool, not int, for booleans.
5957         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5958
5959 2003-11-05  Paul Eggert  <eggert@twinsun.com>
5960
5961         * man/Makefile.am (check-programs-vs-x):
5962         Work even if $(programs) contains '$'.
5963         Work even if 'missing=1' in environment.
5964         Don't report an error simply because $(programs) outputs nothing.
5965
5966 2003-11-05  Jim Meyering  <jim@meyering.net>
5967
5968         * Use autoconf-2.58.  Regenerate dependent files.
5969
5970         * src/tr.c (spec_init): Fix typo in last change.
5971
5972         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5973         call to variadic version_etc function, so that it works even on systems
5974         for which sizeof char* != sizeof int.
5975         * src/true.c (main): Likewise.
5976         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5977         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5978         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5979         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5980         Similarly, cast NULL to `(char *)' in call to variadic function,
5981         parse_long_options, so that it works even on systems for which
5982         sizeof char* != sizeof int.
5983         A similar problem was reported by Harti Brandt in
5984         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5985
5986         * src/users.c (users): Free `utmp_buf' explicitly so that people
5987         don't mistake this for a real leak.
5988         Patch by Dennis Smit <ds@nerds-incorporated.org.
5989
5990 2003-11-04  Paul Eggert  <eggert@twinsun.com>
5991
5992         * README: Document _POSIX2_VERSION.
5993
5994 2003-11-04  Jim Meyering  <jim@meyering.net>
5995
5996         * src/tac.c (memrchr): Remove #if-0'd function.
5997         (tac_stdin_to_mem): Clean up #if-0'd code.
5998
5999         * src/od.c (decode_format_string): Remove unnecessary casts.
6000         Use more maintainable `sizeof *var'.
6001         (main): Call decode_format_string rather than decode_one_format,
6002         now that `spec' may be NULL.
6003
6004         * src/chmod.c (AUTHORS): Add my name.
6005
6006         * src/split.c (next_file_name): Use `sizeof *var' rather than
6007         hard-coding `sizeof size_t'.
6008
6009         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
6010
6011         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
6012         to avoid potential overflow in pointer arithmetic.
6013         (set_fields): Use not `1', but rather `sizeof *printable_field' as
6014         second argument to xcalloc.
6015         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
6016         rather than xrealloc.
6017         * src/date.c (show_date): Likewise.
6018         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
6019         * src/pr.c (store_char): Likewise.
6020         * src/fold.c (fold_file): Likewise.
6021
6022         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6023         type changes (unsigned int -> size_t) in hash.c.
6024         * src/cp-hash.c (src_to_dest_hash): Likewise.
6025         * src/du.c (entry_hash): Likewise.
6026         * src/ls.c (dev_ino_hash): Likewise.
6027         * src/cut.c (hash_int): Likewise.  Declare function as static.
6028
6029 2003-11-03  Jim Meyering  <jim@meyering.net>
6030
6031         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6032         * tests/misc/fold: Fail the test immediately if we're not running
6033         the expected version of fold.
6034
6035 2003-11-02  Jim Meyering  <jim@meyering.net>
6036
6037         * src/tr.c (append_normal_char, append_range, append_char_class)
6038         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
6039         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
6040         and usually shorter.
6041         * src/copy.c (copy_internal): Likewise.
6042         * src/join.c (initseq, add_field, make_blank): Likewise.
6043         * src/od.c (main): Likewise.
6044         * src/cp.c (make_path_private): Likewise.
6045         * src/tsort.c (new_item, record_relation): Likewise.
6046
6047         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
6048         (main): Also remove anachronistic cast of xmalloc return value.
6049         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
6050         (main): Also remove anachronistic cast of xmalloc return value.
6051         * src/sort.c (inittables): Likewise.
6052         (sort): Also Split a long line.
6053
6054 2003-10-25  Jim Meyering  <jim@meyering.net>
6055
6056         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6057         type changes (unsigned int -> size_t) in hash.c.
6058         * src/cp-hash.c (src_to_dest_hash): Likewise.
6059         * src/du.c (entry_hash): Likewise.
6060         * src/ls.c (dev_ino_hash): Likewise.
6061         * src/cut.c (hash_int): Likewise.  Declare function as static.
6062
6063 2003-10-21  Jim Meyering  <jim@meyering.net>
6064
6065         Don't fail when run with VERBOSE=yes.
6066         * tests/chgrp/basic: Do `set +x' before starting the subshell
6067         from which we invoke chgrp.  Otherwise, the output from the
6068         VERBOSE=yes-induced `set -x' would result in spurious differences.
6069         Reported by Russel Coker via Michael Stone.
6070
6071 2003-10-19  Jim Meyering  <jim@meyering.net>
6072
6073         chmod now uses fts to perform a directory traversal when -R is
6074         specified.  Before, it operated on full path names, and as such
6075         would encounter the PATH_MAX (often 4096) limit.
6076
6077         * src/chmod.c: Include "xfts.h".
6078         (process_file): Rename from change_file_mode.
6079         Adapt to be used with fts.
6080         (process_files): New function.
6081
6082 2003-10-18  Jim Meyering  <jim@meyering.net>
6083
6084         * tests/du/deref-args: Ensure that du -D now dereferences all
6085         symlinks specified on the command line, not just those that
6086         reference directories.
6087
6088         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6089         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6090         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6091         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6092         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6093         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6094         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6095         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
6096         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
6097         Update the call to parse_long_options so that `AUTHORS, NULL' are the
6098         last parameters.
6099         * src/true.c (main): Append NULL to version_etc argument list.
6100         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6101
6102 2003-10-17  Andreas Schwab  <schwab@suse.de>
6103
6104         * tests/mk-script: Get $srcdir from first parameter instead of
6105         hardcoding it.
6106         (main): Update usage.
6107
6108         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
6109         first argument of mk-script.
6110         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
6111
6112 2003-10-17  Jim Meyering  <jim@meyering.net>
6113
6114         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
6115         generated `man' page is more readable.  Suggestion from Dan Jacobson.
6116
6117         * src/chown-core.c (change_file_owner): Handle the cases in
6118         which fts_info indicates an error with the given entry.
6119
6120         * src/du.c (main): Simply assign to bit_flags.
6121         Don't bother with bit arithmetic.
6122
6123         * tests/chmod/no-x: New file.
6124         * tests/chgrp/no-x: New file.
6125         * tests/chmod/Makefile.am (TESTS): Add no-x.
6126         * tests/chgrp/Makefile.am (TESTS): Likewise.
6127
6128         * src/du.c: Include "xfts.h".
6129         (du_files): Use xfts_open, rather than fts_open.
6130         * src/chown-core.c (chown_files): Likewise.
6131
6132 2003-10-16  Jim Meyering  <jim@meyering.net>
6133
6134         * src/chgrp.c (main): Simply assign to bit_flags.
6135         Don't bother with bit arithmetic.
6136         * src/chown.c (main): Likewise.
6137         Rename a couple of local variables.
6138         Remove unnecessary casts.
6139
6140         * src/tail.c (start_bytes): Rename local, remainder, to avoid
6141         gcc's warning about shadowing a global.
6142
6143 2003-10-15  Jim Meyering  <jim@meyering.net>
6144
6145         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
6146         use fts to perform a directory traversal when -R is specified.
6147         Before, they operated on full path names, and as such would
6148         encounter the PATH_MAX (often 4096) limit.
6149         They are more efficient.  For example, before, chgrp -R would
6150         take almost 5 seconds to change about 2000 directories and fail
6151         (with `File name too long'), while now it succeeds on a hierarchy
6152         of depth 20,000 in 1/10 the time.
6153
6154         * src/chown.c: Include "userspec.h" and "fts_.h".
6155         (WRITTEN_BY): Add my name.
6156         (getpwnam, getgrnam, getgrgid): Remove declarations.
6157         (endpwent): Remove definition.
6158         (usage): Update.
6159         (main): Handle new options.
6160         Call new function, chown_files rather than change_file_owner.
6161
6162         * src/chgrp.c: Include "fts_.h".
6163         (WRITTEN_BY): Add my name.
6164         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
6165         the latter.
6166         (usage): Update.
6167         (main): Handle new options.
6168         Call new function, chown_files rather than change_file_owner.
6169
6170         Rewrite to iterate through hierarchies using fts rather than
6171         via explicit recursion.
6172         * src/chown-core.c: Include "fts_.h"
6173         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
6174         on a single file at a time.
6175         (chown_files): New function.
6176         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
6177         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
6178         [struct Chown_option] (dereference): Remove member with ambiguous name.
6179         [struct Chown_option] (affect_symlink_referent): New member.
6180         (chown_files): New prototype.
6181
6182         * tests/chgrp/recurse: Update tests accordingly.
6183         * tests/chgrp/posix-H: New tests for the above.
6184         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
6185
6186         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
6187         work even for superuser.  Suggestion from Dan Jacobson.
6188
6189 2003-10-14  Paul Eggert  <eggert@twinsun.com>
6190
6191         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
6192         properly diagnosed.
6193         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
6194         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
6195         * src/sort.c (parse_field_count): Handle the case where overflow
6196         and invalid suffix char are both reported.
6197
6198 2003-10-14  Jim Meyering  <jim@meyering.net>
6199
6200         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
6201         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
6202         true on Linux.
6203
6204 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6205
6206         Fix to avoid a denial-of-service attack if the display width is
6207         enormous.  Also, clean up the code a bit by removing duplicate code.
6208
6209         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
6210         (calculate_columns): New function, that contains code that used
6211         to be common to print_many_per_line and print_horizontal.
6212         (print_many_per_line, print_horizontal): Use it.
6213         (decode_switches): Set max_idx here, not in calculate_columns.
6214         (print_current_files): Don't call init_column_info; calculate_columns
6215         now does that.
6216         (init_column_info): Don't allocate a lot more space than is needed
6217         to represent the current set of files.  Allocate all the new
6218         size_t cells in one call to xnmalloc, rather than a row at a time.
6219
6220 2003-10-13  Jim Meyering  <jim@meyering.net>
6221
6222         * src/ls.c (init_column_info): Add another FIXME comment.
6223
6224 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6225
6226         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
6227         Remove several arbitrary limits on hosts where int cannot represent
6228         all size_t values.
6229
6230         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
6231         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
6232         struct column_info.col_arr[0], max_idx):
6233         Now size_t, not int.
6234         (get_funky_string): Return bool indicating success, instead of
6235         a negative count to indicate failure.  Store number of columns
6236         through new parameter OUTPUT_COUNT; that way, they can never
6237         go negative.  Change equals_end from int to bool.  All uses
6238         changed.
6239         (struct column_info.valid_len): Now bool, not int.  All uses changed.
6240         (dired_dump_obstack, get_funky_string, clear_files,
6241         extract_dirs_from_files, print_current_files,
6242         print_many_per_line, print_horizontal, init_column_info,
6243         put_indicator, length_of_file_name_and_frills,
6244         print_with_commas): Use size_t, not int, for local variables
6245         that count sizes.
6246         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6247         Check for TIOCGWINSZ returing negative values (or values greater
6248         than SIZE_MAX!).
6249         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6250         init_column_info):
6251         Use xmalloc and xnmalloc, not XMALLOC.
6252         (gobble_file): Use xnrealloc, not XREALLOC.
6253         (print_color_indicator): Remove now-unnecessary cast to size_t.
6254
6255 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6256
6257         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6258         * tests/sort/sort-tests: Remove from CVS; assume that people
6259         brave enough to check coreutils out from CVS can rebuild it.
6260
6261 2003-10-12  Jim Meyering  <jim@meyering.net>
6262
6263         New options: --preserve-root and --no-preserve-root.
6264         * src/chmod.c (change_file_mode): Honor new option.
6265         (change_file_mode): Strip trailing slashes on directory
6266         argument passed to change_dir_mode.
6267         (get_root_dev_ino): New function.
6268         (main): Initialize global, root_dev_ino.
6269
6270         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6271         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6272         via system.h.
6273         * src/chmod.c (change_file_mode): Likewise.
6274
6275 2003-10-08  Jim Meyering  <jim@meyering.net>
6276
6277         * src/csplit.c (main): Remove obsolete FIXME.
6278
6279 2003-10-07  Jim Meyering  <jim@meyering.net>
6280
6281         * Use automake-1.7.8.  Regenerate dependent files.
6282
6283 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6284
6285         csplit cleanup.
6286
6287         * doc/coreutils.texi (csplit invocation):
6288         The regexp offset need not have a sign; POSIX requires support
6289         for signless offets.
6290
6291         Be more careful about int widths.  For example, remove some
6292         arbitrary limits by replacing 'unsigned' with 'size_t',
6293         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6294         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6295         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6296         to <stdbool.h> usage.
6297         (struct control): offset is now intmax_t, not int.
6298         repeat_forever is now bool, not int.
6299         (struct cstring): len is now size_t, not unsigned int.
6300         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6301         size_t, not unsigned.  start_line, first_available are now
6302         uintmax_t, not unsigned.
6303         (hold_count, control_used): Now size_t, not unsigned.
6304         (last_line_number, current_line, bytes_written):
6305         Now uintmax_t, not unsigned.
6306         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6307         create_new_buffer, get_new_buffer, load_buffer, find_line,
6308         process_regexp, split_file, new_control_record, extract_regexp,
6309         get_format_width, get_format_prec, max_out):
6310         size args, locals, and returned values are now size_t, not unsigned
6311         or int.
6312         (get_first_line_in_buffer, find_line, write_to_file,
6313         handle_line_error, process_line_count, regexp_error, process_regexp,
6314         split_file):
6315         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6316         (check_for_offset): Don't require a sign before the offset.
6317         Use xstrtoimax to do the real work.
6318         (extract_regexp): Remove harmful cast of size to unsigned.
6319         256 -> 1<<CHAR_BIT, for clarity.
6320         (get_format_flags): Return at most 3, to avoid worries about overflow.
6321
6322         (bytes_to_octal_digits): Remove.
6323
6324         (cleanup): Don't check whether output_stream is NULL, since
6325         close_output_file does that for us.
6326
6327         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6328         (sizeof *p);" instead of the more long-winded alternatives.
6329
6330         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6331         to a much larger size, instead of an O(N) algorithm.
6332
6333         (process_regexp): Use plain NULL rather than casted 0.
6334
6335         (make_filename): Use %u, not %d, to format unsigned file number.
6336
6337         (new_control_record): Use xrealloc exclusively, since it handles
6338         NULL reliably.
6339
6340         (extract_regexp): Change misspelled word in diagnostic.
6341
6342         (get_format_width): Even if a minimum field width is specified,
6343         allow room for enough octal digits to represent the value of
6344         the maximum representible integer.  This fixes a potential
6345         buffer overrun.  Calculate this room at compile-time, not
6346         at run-time; this removes the need for bytes_to_octal_digits.
6347         Check for overflow; this removes a FIXME.
6348
6349         (get_format_prec): Don't allow precision to be signed; it's
6350         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6351         default precision; this fixes a potential buffer overrun
6352         on hosts with wider size_t.
6353
6354         (get_format_conv_type): Change local variable to be of type
6355         unsigned char, not int; this removes a potential subscript
6356         violation on hosts where char is signed.
6357
6358         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6359         Allow "%%" in format.  Don't overflow when
6360         counting lots of percents.
6361
6362         (usage): Default sprintf format is %02u, not %d.
6363
6364 2003-10-05  Jim Meyering  <jim@meyering.net>
6365
6366         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6367
6368         * src/du.c (du_files): Mark diagnostic for translation.
6369
6370 2003-10-04  Jim Meyering  <jim@meyering.net>
6371
6372         * src/du.c (du_files): Ignore any failure of fts_close.
6373         Give better diagnostics for failed fts_open.
6374
6375         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6376
6377         Deprecate existing use of -H (aka --si).
6378         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6379         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6380         (main): Warn that the meaning of -H will soon change to be
6381         POSIX compliant.
6382
6383 2003-10-03  Jim Meyering  <jim@meyering.net>
6384
6385         * src/du.c: Accept --no-dereference (-P).
6386
6387 2003-10-02  Jim Meyering  <jim@meyering.net>
6388
6389         * tests/du/trailing-slash: Adjust for slightly different output.
6390
6391         Rewrite du.c to use fts.
6392         * src/du.c: Include "fts_.h", not ftw.h.
6393         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6394         (IS_FTW_DIR_TYPE): Remove definition.
6395         (IS_DIR_TYPE): Define.
6396         (is_symlink_to_dir): Remove now-unnecessary function.
6397         (process_file, du_files): Rewrite to use fts.
6398
6399         * tests/du/inaccessible-cwd: Ensure that even when run from an
6400         inaccessible directory, du can still operate on accessible
6401         directories elsewhere.
6402         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6403
6404         * tests/rm/deep-1: Ensure that du can process a hierarchy
6405         of depth 400 while using no more than 50KB of stack space.
6406
6407 2003-10-01  Akim Demaille  <akim@epita.fr>
6408
6409         * announce-gen (print_news_deltas): New function, extracted from main.
6410         (main): Make `news_file' an array.
6411         Use '...=s' => \@var for --news and --url-directory specs.
6412         Before there were a couple of portability problems.
6413
6414 2003-09-28  Jim Meyering  <jim@meyering.net>
6415
6416         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6417         (syntax-check-rules): Add it.
6418
6419         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6420         guaranteed to be (void *).
6421         * src/cp.c: Likewise.
6422         * src/join.c: Likewise.
6423         * src/ln.c: Likewise.
6424         * src/ls.c: Likewise.
6425         * src/od.c: Likewise.
6426         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6427
6428 2003-09-27  Jim Meyering  <jim@meyering.net>
6429
6430         Don't exhaust virtual memory when processing large inputs.
6431         Fix this by removing csplit's internal free-list management;
6432         instead rely on malloc for that.
6433
6434         * src/csplit.c (free_list): Remove global.
6435         (clear_all_line_control): Remove function.
6436         (get_new_buffer): Always use create_new_buffer to obtain a
6437         new buffer, rather than searching free_list.
6438         (free_buffer): Just call free.
6439         Reported by Nikola Milutinovic.
6440
6441 2003-09-26  Jim Meyering  <jim@meyering.net>
6442
6443         * man/rm.x: Also list `chattr' in SEE ALSO section.
6444         Suggestion from Mark Hubbart.
6445
6446 2003-09-25  Jim Meyering  <jim@meyering.net>
6447
6448         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6449         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6450
6451         * Use autoconf-2.57d.  Regenerate dependent files.
6452
6453 2003-09-24  Jim Meyering  <jim@meyering.net>
6454
6455         Minor efficiency tweak.
6456         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6457         (do_link): Likewise.
6458
6459 2003-09-23  Jim Meyering  <jim@meyering.net>
6460
6461         * src/paste.c (paste_serial): Save errno after input error,
6462         to report proper errno value.
6463         Based on a patch from Paul Eggert.
6464
6465         * src/tee.c (tee): Adjust fwrite arguments so that the return
6466         value is the number of bytes written.
6467
6468 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6469
6470         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6471
6472         * src/comm.c (compare_files): Save errno after input error,
6473         to report proper errno value.
6474         * src/fold.c (fold_file): Likewise.
6475         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6476         * src/unexpand.c (unexpand): Likewise.
6477
6478         * src/csplit.c (close_output_file): Don't report bogus errno value
6479         after ferror discovers an output error.  We don't know the proper
6480         errno value, since it might have been caused by any of a whole
6481         bunch of calls, and it might have been trashed in the meantime.
6482         Fixing this problem will require much more extensive changes;
6483         in the meantime just say "write error".
6484         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6485         * src/uniq.c (check_file): Likewise.
6486
6487         * src/join.c (get_line): Report error right away if I/O fails,
6488         so that the proper errno value is used.
6489         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6490         * src/tee.c (tee): Likewise.
6491         * src/uniq.c (check_file): Likewise.
6492
6493         * src/od.c (skip): If a read fails, don't retry it later, so
6494         that we report the proper errno.
6495
6496         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6497
6498         * src/tee.c (tee): Once a write failure has occurred, don't bother
6499         writing anything more to that stream.
6500
6501         * src/uniq.c (check_file): Check for ferror (stdout) even if
6502         ostream == stdout.
6503
6504         * src/yes.c (UNROLL): Remove.
6505         (main): Exit immediately when write failure is detected.
6506         Simplify code by assigning to argv when argc == 1.
6507
6508 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6509
6510         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6511         (WRITTEN_BY): Change "Franc,ois" (actually using
6512         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6513         xgettext requires.
6514
6515 2003-09-19  Jim Meyering  <jim@meyering.net>
6516
6517         `du -D symlink-to-dir' would mistakenly omit the slash in
6518         lines like this: 24     symlink-to-dir/subdir
6519         * src/du.c (process_file): Fix offset calculation.
6520         Reported by Jeff Sheinberg as Debian bug #211591;
6521         http://bugs.debian.org/205251
6522
6523         * tests/du/deref-args: New file/test for the above.
6524         * tests/du/Makefile.am (TESTS): Add deref-args.
6525
6526         * src/du.c (process_file): Remove useless disjunct.
6527
6528         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6529         to Written_by.
6530         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6531         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6532         Mark each WRITTEN_BY string as translatable.
6533
6534         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6535         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6536         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6537         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6538         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6539         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6540         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6541         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6542         Instead, a subsequent change will embed `Written by ' in
6543         each string along with the author names.
6544
6545         * src/true.c: Revert yesterday's changes.
6546         * src/sys2.h: Likewise.
6547
6548 2003-09-18  Jim Meyering  <jim@meyering.net>
6549
6550         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6551         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6552         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6553         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6554         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6555         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6556         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6557         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6558         comma-separated list of strings and/or update the call to
6559         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6560         * src/true.c (main): Append NULL to version_etc argument list.
6561         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6562
6563         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6564         shadowing the math function name.  Also rename loga to log_a.
6565
6566 2003-09-14  Jim Meyering  <jim@meyering.net>
6567
6568         * src/factor.c (print_factors): Give a separate diagnostic
6569         for numbers that are too large, but otherwise valid.
6570         Reported by Dániel Varga.
6571
6572 2003-09-10  Jim Meyering  <jim@meyering.net>
6573
6574         * Use automake-1.7.7.  Regenerate dependent files.
6575
6576         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6577         of `fmt -1'.  Using the just-built tr is a little cleaner.
6578         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6579         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6580
6581 2003-09-09  Jim Meyering  <jim@meyering.net>
6582
6583         * src/copy.c: Alphabetize includes.
6584         Remove duplicate inclusion of "same.h".
6585
6586 2003-09-08  Jim Meyering  <jim@meyering.net>
6587
6588         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6589         Didn't give enough of a benefit, mainly because it's not yet
6590         in wide enough use.
6591
6592         * Version 5.0.91.
6593
6594         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6595         (check-programs-vs-x): Fail if $(programs) is empty.
6596
6597         * src/remove.c: Add a comment.
6598
6599 2003-09-07  Jim Meyering  <jim@meyering.net>
6600
6601         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6602         Don't define.  These symbols are no longer used.
6603
6604         * tests/misc/tty-eof: Write ^D as \cD.
6605         Complete the change of 2003-08-02.
6606
6607         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6608         file in lib/ or src/ doesn't induce an unwarranted failure.
6609         Add a kludge to filter out the sole generated source file that
6610         also has translatable messages: src/false.c.
6611
6612 2003-09-06  Jim Meyering  <jim@meyering.net>
6613
6614         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6615         (parse_options): Give a diagnostic for (but still accept) the
6616         deprecated --allow-missing option.
6617
6618 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6619
6620         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6621         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6622
6623         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
6624         size_bound ourselves. if an input file is a pipe and the user
6625         specified a size, use that size instead of trying to guess the
6626         pipe size.  This has the beneficial side effect of avoiding the
6627         overhead of default_sort_size in that case.  All callers changed.
6628         (sort): Remove static var size; now done by sort_buffer_size.
6629
6630 2003-09-05  Jim Meyering  <jim@meyering.net>
6631
6632         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
6633
6634         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6635         to start, rather than just .1.  Upon failure, print unexpected state.
6636
6637 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6638
6639         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6640         SAFE_READ_ERROR to tmp->nbytes.
6641         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6642
6643         * src/head.c (struct linebuffer): Change nbytes and nlines
6644         from unsigned int to size_t.  unsigned int is safe (after the
6645         2003-09-03 patch) but size_t is cleaner.
6646         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6647         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6648
6649         Standardize on BUFSIZ as opposed to other macro names and values.
6650         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
6651         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6652         stdio.h has always defined it,
6653         and other code already assumes it's defined.
6654         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6655         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6656         (io_buf): IO_BUF_SIZE -> BUFSIZ.
6657
6658 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6659
6660         * src/seq.c (step): Default to 1.
6661         (print_numbers): Allow the output to be empty.
6662         (main): The default step is 1, even if LAST < FIRST;
6663         as per documentation.
6664         * tests/seq/basic (onearg-2): Output should be empty.
6665
6666 2003-09-05  Jim Meyering  <jim@meyering.net>
6667
6668         * Makefile.cfg (wget_files): Temporarily disable, until master
6669         versions are restored to ftp.gnu.org.
6670
6671         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6672
6673         Make seq's --width (-w) option work properly even when the
6674         endpoint requiring the larger width is negative and smaller than
6675         the other endpoint.
6676         * src/seq.c (get_width_format): Include `-' in the set of bytes
6677         allowed in a `simple' number (no decimal point, no exponent).
6678         Reported by Patrick Mauritz.
6679
6680 2003-09-02  Paul Eggert  <eggert@twinsun.com>
6681
6682         * NEWS: sort -t '\0' now uses a NUL tab.
6683         sort option order no longer matters, unless POSIX requires it.
6684         * src/sort.c (usage): Say "blanks" instead of "whitespace",
6685         Similar fixes for many comments.
6686         (TAB_DEFAULT): New constant, so that we can support NUL as
6687         the field separator.
6688         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
6689         (specify_sort_size): If multiple sizes are specified, use the largest.
6690         (begfield, limfield): Support NUL tab char.
6691         (set_ordering): Do not let -i override -d.
6692         (main): Report an error if incompatible -o or -t options are given.
6693         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
6694
6695 2003-09-05  Jim Meyering  <jim@meyering.net>
6696
6697         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6698
6699 2003-09-03  Andreas Schwab  <schwab@suse.de>
6700
6701         Bug report and patch here:
6702         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6703         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6704         * src/head.c (elide_tail_lines_pipe): Likewise.
6705
6706 2003-09-03  Jim Meyering  <jim@meyering.net>
6707
6708         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6709         small amount of code from him was first moved to lib/human.c, and was
6710         subsequently rewritten entirely.
6711         * src/df.c (AUTHORS): Likewise.
6712
6713 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
6714
6715         * src/md5sum.c (split_3): Accept the BSD format for generic
6716         message digest modes.  Currently works with BSD's MD5 and SHA1
6717         formats since these are the two algorithms presently used in
6718         coreutils.  Updated comments to reflect this change.
6719         (bsd_split_3): Updated comments.
6720
6721         * tests/md5sum/basic-1: New test to make sure that
6722         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6723         from `check-bsd' test in tests/sha1sum/basic-1).
6724
6725         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6726         --check exit status and BSD SHA1 format (adapted from tests
6727         in tests/md5sum/basic-1).
6728
6729 2003-08-30  Jim Meyering  <jim@meyering.net>
6730
6731         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6732
6733         When source and destination arguments refer to the same file, reside
6734         on a partition (e.g. VFAT) on which distinct names may refer to the
6735         same directory entry (often due to variations in case), and when the
6736         link count for the file is 1, mv no longer unlinks the file.  Instead,
6737         it gives the expected diagnostic that the source and destination are
6738         the same.  WARNING: this is an incomplete fix.  If the file happens
6739         to have a link count of 2 or greater, such an erroneous mv command
6740         will still unlink it.
6741         Although that is not possible on vfat or umsdos, it is possible on
6742         other file system types, e.g., ntfs, and hpfs.
6743         * src/copy.c (same_file_ok): Invoke same_name (which might still
6744         return false for names that refer to the same directory entry)
6745         only if the link count is 2 or more.
6746         * tests/mv/vfat: Show how to demonstrate the above problem.
6747         This test is not run.
6748         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6749
6750 2003-08-27  Jim Meyering  <jim@meyering.net>
6751
6752         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6753         who's -l option has been eliciting an unconditional warning about
6754         this impending change since sh-utils-2.0.12 (April 2002).
6755
6756         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6757         This would happen for nonempty files not ending with a newline.
6758         Reported by Dan Jacobson.
6759         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
6760         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6761
6762         * src/stat.c (print_it): Avoid buffer overrun that would
6763         occur when the user-specified format string ends with `%'.
6764         Patch by Tommi Kyntola.
6765         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
6766         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6767
6768 2003-08-26  Jim Meyering  <jim@meyering.net>
6769
6770         Apply changes from bison.
6771         * GNUmakefile (SHELL): Define to `sh', if necessary.
6772         Add copyright.
6773         * Makefile.maint (WGETFLAGS): Define to `-C off'.
6774         Update all uses of $(WGET).
6775
6776 2003-08-22  Akim Demaille  <akim@epita.fr>
6777
6778         * Makefile.cfg (local-checks-to-skip): New.
6779         * Makefile.maint (local-check): Rename as...
6780         (local-checks-available): this.
6781         (local-check): New.
6782
6783 2003-08-26  Akim Demaille  <akim@epita.fr>
6784
6785         * announce-gen (print_changelog_deltas): Neutralize "<#" as
6786         "<\#" to avoid magic from Gnus when posting parts of this script.
6787
6788 2003-08-25  Jim Meyering  <jim@meyering.net>
6789
6790         * src/stat.c (main): Warn about use of deprecated `-l' option.
6791
6792 2003-08-22  Jim Meyering  <jim@meyering.net>
6793
6794         * src/stat.c (do_stat): For link count at end of line, use %h format,
6795         instead of %-5h.  The latter would make stat emit trailing spaces.
6796         Reported by Dan Jacobson.
6797
6798 2003-08-20  Jim Meyering  <jim@meyering.net>
6799
6800         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6801
6802 2003-08-19  Jim Meyering  <jim@meyering.net>
6803
6804         * src/system.h: Include stdlib.h unconditionally,
6805         as we're now assuming that part of hosted C89.
6806
6807 2003-08-18  Jim Meyering  <jim@meyering.net>
6808
6809         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6810         to avoid warnings from gcc.
6811
6812 2003-08-17  Jim Meyering  <jim@meyering.net>
6813
6814         Avoid unnecessary and sometimes time-consuming hostname lookups.
6815         * src/who.c (print_user): Use strchr, not strrchr.
6816         * src/pinky.c (print_entry): Likewise.
6817         Patch by Michael Stone.
6818         This fixes a typo I introduced in who-users.c on 1996-02-23.
6819
6820         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6821         disallowed between `@...@'.
6822
6823 2003-08-16  Paul Eggert  <eggert@twinsun.com>
6824
6825         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6826         done by gnulib .m4 files.
6827         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6828         * src/sys2.h (strtoull): Remove unused declaration.
6829
6830 2003-08-16  Jim Meyering  <jim@meyering.net>
6831
6832         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6833         are read-only.
6834
6835         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6836         race condition bug.  The bug would be triggered when tailing a file
6837         with file pointer not at beginning of file, and where the file was
6838         truncated to have a length of less than the initial offset at just
6839         the right moment (between the two lseek calls in this function).
6840
6841         An invalid initial value for *read_pos would result in
6842         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6843         busy-wait rather than sleeping between iterations.  The bug manifests
6844         itself only when tailing regular files that are initially nonempty.
6845         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6846         each xlseek call.
6847         (tail_lines): Likewise, after lseek calls.
6848         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
6849         * tests/tail-2/tail-n0f: New file.  Test for above fix.
6850         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6851
6852 2003-08-15  Jim Meyering  <jim@meyering.net>
6853
6854         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6855         (sc_sun_os_names): Likewise.
6856         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6857
6858         * man/help2man: Remove some SPACEs before TAB.
6859
6860 2003-08-14  Paul Eggert  <eggert@twinsun.com>
6861
6862         * Makefile.maint (LC_ALL): Set to C.
6863         * man/Makefile.am (ASSORT): New var.
6864         (check-x-vs-1, programs): Use it.
6865         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6866         * tests/Makefile.am (ASSORT, all_programs): Likewise.
6867
6868 2003-08-11  Jim Meyering  <jim@meyering.net>
6869
6870         fold -s -wN would infloop for N < 8 with TABs in the input.
6871         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6872         * src/fold.c (fold_file): Move contents of `else'-block
6873         out of conditional so it's used also for --spaces (-s).
6874         * tests/misc/fold: Test for the above fix.
6875         * tests/misc/Makefile.am (TESTS): Add fold.
6876
6877 2003-08-10  Jim Meyering  <jim@meyering.net>
6878
6879         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6880         system.h so the types from time.h and sys/time.h are available.
6881         It appears that this is necessary for OpenBSD, NetBSD, and
6882         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
6883
6884 2003-08-06  Paul Eggert  <eggert@twinsun.com>
6885
6886         * NEWS: Add support for setting file timestamps to microsecond
6887         resolution, on hosts that support this.
6888         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6889         * src/copy.c (copy_internal):
6890         Set file timestamps with utimens, not utime.
6891         * src/cp.c (re_protect): Likewise.
6892         * src/install.c (change_timestamps): Likewise.
6893         * src/touch.c (newtime, touch, main): Likewise.
6894
6895 2003-08-09  Jim Meyering  <jim@meyering.net>
6896
6897         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6898         from Paul Eggert.
6899         (syntax-check-rules): Add it.
6900
6901         * src/tail.c (main): Tweak Solaris OS version number in comment.
6902         * src/wc.c (wc): Likewise
6903         * tests/tail-2/fflush: Likewise.
6904
6905         * src/tail.c: Add new undocumented option, --presume-input-pipe.
6906         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6907
6908 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6909
6910         Use new gnulib 'extensions' module.
6911         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6912         AC_GNU_SOURCE.
6913
6914 2003-08-08  Paul Eggert  <eggert@twinsun.com>
6915
6916         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6917
6918 2003-08-09  Jim Meyering  <jim@meyering.net>
6919
6920         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6921         For tests of obsolete behavior, don't presume that unsetting
6922         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6923
6924 2003-08-07  Paul Eggert  <eggert@twinsun.com>
6925
6926         * doc/coreutils.texi (split invocation):
6927         Add -d or --numeric-suffixes option to 'split'.
6928         From a suggestion by Jesse Kornblum.
6929         * src/split.c (suffix_alphabet): New var.
6930         (longopts, usage, next_file_name, main): Support -d.
6931         (next_file_name, main): Allow -a0, as POSIX requires.
6932         (next_file_name): Don't assume ASCII-like encoding;
6933         'a' through 'z' are not contiguous in EBCDIC.
6934
6935 2003-08-05  Paul Eggert  <eggert@twinsun.com>
6936
6937         Merge getline from gnulib.
6938         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6939         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6940         New files, from gnulib.
6941         * lib/getdelim2.c, lib/getdelim2.h: Remove.
6942         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6943         getdelim2.h to getndelim2.c and getndelim2.h.
6944         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6945         checking for getdelim.
6946         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6947         than rolling our own.
6948         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6949         (cut_fields): Invoke getndelim2 rather than getdelim2.
6950
6951 2003-08-04  Jim Meyering  <jim@meyering.net>
6952
6953         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6954         and for the indices to iterate through nsigs.
6955
6956 2003-08-02  Paul Eggert  <eggert@twinsun.com>
6957
6958         * src/sort.c: Minor code cleanups, mostly to use more accurate
6959         types and to remove unnecessary casts.
6960         (min, max): Remove.  All uses changed to MIN and MAX.
6961         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6962         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6963         keyfield.numeric, struct keyfield.general_numeric, struct
6964         keyfield.month, struct keyfield.reverse, reverse, unique,
6965         have_read_stdin): Now bool, not int.  All uses changed.
6966         (eolchar): Now char, not int.
6967         (struct keyfield.ignore): Now bool const *, not int *.
6968         (struct keyfield.translate): Now char const *, not char *.
6969         (struct month.name): Likewise.
6970         (blanks, nonprinting, nondictionary): Now bool[], not int[].
6971         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6972         check, sort, main): Use const * pointers when possible.
6973         (month_cmp): Rewrite to avoid casts.
6974         (inittables): Initialize tables unconditionally, to avoid branches.
6975         (fillbuf): Return bool, not int.  All uses changed.
6976         (fillbuf, keycompare, new_key, main):
6977         Use SIZE_MAX rather than (size_t) -1.
6978         (trailing_blanks): Renamed from trim_trailing_blanks.
6979         Return the number of blanks to trim.  All uses changed.
6980         (getmonth): Use trailing_blanks rather than open code.
6981         (keycompare): Do not cast char * to unsigned char *; not needed.
6982         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6983         ourselves.
6984         (compare, main): Use | rather than || to avoid jumps.
6985         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6986         be nonzero there.
6987         (check, first_same_file, sort, main):
6988         Use bool instead of int local vars when possible.
6989         (check): Merge the old 'checkfp' and 'check' into a single function,
6990         that returns a boolean (true if the file was ordered).
6991         All uses changed.
6992         (main): Use int instead of unsigned for iterating through nsigs.
6993         Rename local var "posix_pedantic" to "posixly_correct".
6994
6995 2003-08-02  Jim Meyering  <jim@meyering.net>
6996
6997         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6998         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6999
7000         * src/cut.c (cut_fields): Don't read again after encountering an
7001         initial EOF.  E.g., `cut -f2' would do so.
7002         * tests/misc/tty-eof: Add a test for the above fix.
7003
7004         * src/sort.c (sortlines): Add description and references.
7005         From Paul Eggert.
7006
7007         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
7008         the tests in help-version will use the just-built binaries.
7009         Reported by Christian Krackowizer.
7010
7011 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7012
7013         * NEWS: Add --rfc-2822 option to GNU date.
7014         * doc/coreutils.texi (Time directives, Options for date, Examples
7015         of date): Likewise.
7016         * src/date.c (long_options, usage, main): Likewise.
7017         * doc/getdate.texi (General date syntax): Likewise.
7018         * doc/coreutils.texi (Options for date): Fix a typo in format:
7019         it's now %d not %_d.  Add URLs.
7020
7021 2003-08-01  Jim Meyering  <jim@meyering.net>
7022
7023         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
7024         Otherwise, with at least the /bin/sh from HPUX 10.20,
7025         the trap code would end up converting that to exit 1 and thus an
7026         unexpected test failure.  Reported by Christian Krackowizer.
7027
7028 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7029
7030         * src/ptx.c: Do not include bumpalloc.h.
7031         (WORD_TABLE): New member alloc.
7032         (ALLOC_NEW_WORD): Remove.
7033         (occurs_alloc): New var.
7034         (digest_word_file, find_occurs_in_text): Check for arithmetic
7035         overflow when computing table size.  Use xrealloc rather than
7036         bumpalloc primitives.
7037
7038 2003-07-29  Jim Meyering  <jim@meyering.net>
7039
7040         * Version 5.0.90.
7041
7042         * README: When running tests as root, suggest using
7043         sudo with NON_ROOT_USERNAME=$USER.
7044
7045         * tests/Makefile.am (all_programs): Makefile is in ../src, not
7046         $(srcdir)/../src.
7047
7048 2003-07-28  Jim Meyering  <jim@meyering.net>
7049
7050         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
7051
7052 2003-07-28  Paul Eggert  <eggert@twinsun.com>
7053
7054         * lib/stdbool.hin (_Bool): Make it signed char, instead of
7055         an enum type, so that it's guaranteed to promote to int.
7056         * src/sort.c (sortlines_temp): Undo previous change.
7057
7058 2003-07-28  Jim Meyering  <jim@meyering.net>
7059
7060         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
7061         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
7062         would cause lines[-1 - swap] (with swap = false) to evaluate to
7063         lines[4294967295].
7064
7065 2003-07-27  Jim Meyering  <jim@meyering.net>
7066
7067         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
7068         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
7069
7070         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
7071         directories, as required by POSIX.   Reported by Karl Berry.
7072         * tests/rm/dir-no-w: New file.  Test for the above fix.
7073         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
7074
7075         * tests/mk-script: Emit `$xx', not its expansion.
7076
7077 2003-07-27  Paul Eggert  <eggert@twinsun.com>
7078
7079         This change was inspired by a similar proposal by Stepan Kasal.
7080         * src/sort.c (mergelines, sortlines_temp): New functions.
7081         (sortlines): Use them, to reduce the number of times that
7082         we need to copy 'struct line' values.  This improved CPU
7083         performance by about 30% on one 18 MB test.
7084         (sort): Don't invoke sortlines unless we have 2 or more lines.
7085
7086 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
7087
7088         * src/sort.c (sort): Don't require two `struct line's per text line,
7089         the new sort algorithm requires just 1.5.
7090
7091 2003-07-27  Jim Meyering  <jim@meyering.net>
7092
7093         * src/pathchk.c (validate_path): Use %lu, not %ld.
7094         From Paul Eggert.
7095         * src/cut.c (is_printable_field): Simplify bit arithmetic.
7096         From Paul Eggert.
7097         * src/ls.c (sort_files): Put `volatile' in the right place.
7098         From Paul Eggert.
7099
7100 2003-07-26  Jim Meyering  <jim@meyering.net>
7101
7102         Use only one bit per field/offset in array, not one `int'.
7103         * src/cut.c (printable_field): Change type to `unsigned char'.
7104         (mark_printable_field, is_printable_field): New functions.
7105         Use them in place of all direct accesses of `printable_field'.
7106
7107         * src/expand.c (parse_tabstops): Detect overflow properly.
7108         * src/cut.c (set_fields): Likewise.
7109
7110         * src/rm.c: Include "dirname.h".
7111         (usage): Use base_name (program_name) in body of --help output.
7112         This lets me...
7113         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
7114         Idea from Brendan O'Dea, who suggested using
7115         `program_name = basename (argv[0]);' everywhere --
7116         can't do that, but using base_name works just fine here.
7117
7118         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
7119
7120 2003-07-24  Paul Eggert  <eggert@twinsun.com>
7121
7122         Fix some POSIX-compliance problems with 'test'.  This makes
7123         'test' more compatible with Bash.
7124
7125         * NEWS, doc/coreutils.texi: Document the following.
7126         * src/test.c: Include exitfail.h.
7127         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
7128         (test-syntax_error): Use it.
7129         (binary_operator): Now takes bool arg specifying whether left operand
7130         is -l ARG, so that caller determines this rather than us.
7131         All uses changed.
7132         (term): Use posixtest to evaluate parenthesized subexpressions.
7133         (unary_operator, one_argument): Remove support for -t without operand.
7134         (one_argument): Take argument from argv[pos].
7135         (one_argument, two_arguments, three_arguments): Advance pos.
7136         All callers changed.
7137         (three_arguments): Look for binary ops before "!".  Then look
7138         for parenthesized one_argument expressions, instead of trusting
7139         expr () to do the right thing.
7140         (posixtest): Now takes number of args.  All callers changed.
7141         Treat "( A B )" like "A B".
7142         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
7143         POSIXLY_CORRECT, as we now conform to POSIX by default.
7144         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
7145         * tests/test/Test.pm (test_vector): Add several tests to check
7146         the above.  Syntax errors now exit with status 2, not 1.
7147         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
7148
7149 2003-07-26  Jim Meyering  <jim@meyering.net>
7150
7151         * tests/help-version: Adjust for above change in test behavior:
7152         `[' exits with 2, not 1, and test doesn't accept --help or --version.
7153
7154         * Makefile.maint (ME): Don't use trick suggested in Make manual.
7155         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
7156
7157         * Makefile.maint (sc_system_h_headers): Another syntax check.
7158         (syntax-check-rules): Add it to the list.
7159
7160         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
7161         so it matches `%ld' format even on 32-bit systems.
7162
7163         * src/fmt.c (flush_paragraph): Cast field width to `int' to
7164         avoid warning on 64-bit systems.
7165
7166         * src/ls.c (sort_files): Make `func' volatile, so it can't be
7167         clobbered by a `longjmp' into this function.
7168
7169 2003-07-25  Jim Meyering  <jim@meyering.net>
7170
7171         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
7172         value.
7173
7174         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
7175         because it'd evoke spurious failure on 64-bit systems.
7176
7177 2003-07-24  Jim Meyering  <jim@meyering.net>
7178
7179         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
7180         output its current record counts.  Reported by Jurriaan.
7181
7182         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
7183         `wc' with no options.  This goes along with the change of 2003-07-20.
7184
7185 2003-07-23  Jim Meyering  <jim@meyering.net>
7186
7187         Don't include headers already included by system.h:
7188         * src/tr.c: Don't include errno.h.
7189         * src/true.c: Don't include version-etc.h.
7190         * src/test.c: Don't include limits.h or error.h.
7191         * src/stat.c: Don't include unistd.h or time.h.
7192         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
7193         * src/pr.c: Don't include time.h.
7194         * src/pathchk.c: Don't include errno.h.
7195         * src/nice.c: Don't include sys/time.h.
7196         * src/ls.c: Don't include stdlib.h.
7197
7198         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
7199         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
7200         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
7201         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
7202         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
7203         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
7204         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
7205         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
7206         Don't include closeout.h.
7207
7208         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
7209         can access the required version of rm.
7210         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
7211
7212         * tests/cut/Test.pm (out-delim3a): New test.
7213
7214         * man/help2man: Update to version 1.33.
7215
7216         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
7217
7218         * src/dircolors.c: Include xstrndup.h.
7219         (xstrndup): Remove function, now that it's been factored out into
7220         it's own file.
7221
7222 2003-07-22  Paul Eggert  <eggert@twinsun.com>
7223
7224         * src/wc.c (wc): Fix typo in computation of file from file_x,
7225         which caused the former to be used uninitialized if file_x was
7226         nonzero.
7227
7228 2003-07-22  Jim Meyering  <jim@meyering.net>
7229
7230         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
7231
7232         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
7233         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
7234         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
7235
7236         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7237
7238         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
7239
7240         * src/cut.c (set_fields): Mark all selected indices before trying to
7241         determine range endpoints.
7242         * tests/cut/Test.pm: New test for the above fix.
7243
7244         Begin to address this comment: What if someone wants to
7245         extract the 1,000,000-th field of some huge input file?
7246         The first step is to rearrange things so that the values
7247         in the printable_field array are all 0/1 rather than 0/1/2.
7248         * src/cut.c (RANGE_START_SENTINEL): Remove.
7249         Store range-start indices in a hash table, rather than
7250         overloading the `printable_field' array.
7251         (range_start_ht): New global.
7252         (hash_int, hash_compare_ints, is_range_start_index): New functions.
7253         (print_kth): Use is_range_start_index; don't test printable_field.
7254         (set_fields): Detect overflow.
7255         (set_fields): Insert each range-start index into range_start_ht.
7256         (main): Call set_fields only once, and only after
7257         output_delimiter_specified and (if required) range_start_ht have
7258         been defined.
7259
7260 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7261
7262         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7263         invoked with a null pointer when there were no file arguments.
7264
7265 2003-07-20  Jim Meyering  <jim@meyering.net>
7266
7267         * Makefile.maint (sc_changelog): Add another nit-picky check.
7268
7269         * src/wc.c (write_counts): Add a comment.
7270         (wc): Rename `file' parameter.
7271         Set new local, `file', to be the file name, or (when it's NULL)
7272         _("standard output") so that all uses of `file' use the proper value.
7273         Use STREQ, not strcmp.
7274
7275 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7276
7277         wc count field widths now are heuristically adjusted depending
7278         on the input size, if known.  If only one count is printed, it
7279         is guaranteed to be printed without leading spaces.
7280
7281         Previously, wc did not align the count fields if
7282         POSIXLY_CORRECT was set, but POSIX did not actually require
7283         this undesirable behavior, so it has been removed.
7284
7285         * NEWS: Document this.
7286         * doc/coreutils.texi (wc invocation): Likewise.
7287
7288         * src/wc.c (number_width): New var.
7289         (posixly_correct): Remove.
7290         (struct fstatus): New struct.
7291         (write_counts): Output fields of width number_width.
7292         Do not worry about POSIXLY_CORRECT.
7293         Use null file, not empty-string file, to denote stdin,
7294         since "" is a valid file name on some hosts.
7295         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7296         if possible.
7297         (wc):  Avoid problems if end_pos - current_pos overflows.
7298         Do not print odd message if stdin has a read error.
7299         (get_input_fstatus, compute_number_width): New functions.
7300         (main): Use them to implement the new behavior.
7301         Ignore POSIXLY_CORRECT.
7302
7303         * tests/wc/Test.pm: Adjust to the new output widths.
7304
7305 2003-07-19  Jim Meyering  <jim@meyering.net>
7306
7307         * tests/rm/fail-eperm: Don't create temporary directory --
7308         we don't use it.
7309
7310         * tests/shred/remove: Don't open-code test for UID != 0.
7311         Use priv-check's require-non-root instead.
7312         Update to use newer framework.
7313
7314         * tests/help-version (expected_failure_status_expr): Record that
7315         expr exits with status of 3 for e.g., a write error.
7316
7317         * tests/priv-check: Use `id -u' to see if we're running as root,
7318         rather than trying go write to an write-protected file.
7319         When running as root, ensure $NON_ROOT_USERNAME is valid.
7320         When running as root with `require-non-root', ensure that `.'
7321         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7322         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7323
7324         * src/printenv.c: Include "exitfail.h".
7325         (main): Set exit_failure rather than calling close_stdout_set_status.
7326         * src/date.c: Likewise.
7327         * src/sort.c: Likewise.
7328         * src/tty.c: Likewise.
7329
7330 2003-07-18  Jim Meyering  <jim@meyering.net>
7331
7332         * tests/touch/not-owner: Update to use newer framework.
7333
7334         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7335         directory, and remove Perl-coded `you may not run as root' test.
7336         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7337         hard-coding something not quite equivalent.
7338         Paul Jarc reported the inconsistent diagnostics.
7339
7340         * src/sort.c (main): Use close_stdout via atexit.
7341         Now `sort --version' and `sort --help' fail, as they should
7342         when their output is redirected to /dev/full.
7343
7344         * src/su.c (usage): Don't call close_stdout here.
7345         (main): Use close_stdout via atexit.
7346         Now `su --version > /dev/full' fails, as it should.
7347         Somehow, the change of 2000-05-07 that purports to fix this
7348         was not checked in.
7349
7350         * tests/help-version (--help/--version vs. /dev/full): Special-case
7351         `[' to protect it from expected_failure_status-`eval'.
7352
7353         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7354         count and the corresponding line, as required by POSIX.
7355         Reported by Clement Wang.
7356         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7357
7358         * tests/expr/basic: Add tests for when exit status is 2.
7359
7360         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7361         Use an anonymous `enum', rather than #define.
7362
7363 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7364
7365         * src/expr.c: Include "exitfail.h", "quotearg.h".
7366         (EXPR_INVALID, EXPR_ERROR): New constants.
7367         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7368         (syntax_error): New function, exiting with status 2.  Use it
7369         insteading of printing "syntax error" ourselves.
7370         (main): Initialize exit_failure to EXPR_ERROR.
7371         Exit with EXPR_INVALID on syntax error (too few arguments).
7372         (nextarg): Use strcmp, not strcoll; strcoll might return
7373         an undesirable 0, or might fail.
7374         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7375         or other such error.
7376         (eval2): Report an error if strcoll fails in a string comparison.
7377         * src/sort.c: Include "exitfail.h".
7378         (main): Set exit_failure, not xalloc_exit_failure and
7379         xmemcoll_exit_failure.
7380         * tests/expr/basic: Invalid value exits with status 3, not 2.
7381
7382 2003-07-16  Jim Meyering  <jim@meyering.net>
7383
7384         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7385         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7386
7387         This script would have caught at least two recent bugs:
7388         those in [ and kill.
7389         * tests/help-version: Revive this script.
7390         It wasn't doing anything useful, since $all_programs wasn't being
7391         defined by the invoking Makefile.am.
7392         Reflect that nohup is no longer a script, so don't exclude it.
7393         Add framework to handle the programs added since it was last run:
7394         kill, stat, unlink, [, link, readlink.
7395         Fix path-related problems deriving from the move of this script
7396         from src/ to its present location.
7397         * tests/Makefile.am (all_programs): Define.
7398         (TESTS_ENVIRONMENT): Use it.
7399
7400         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7401         whereby kill would always attempt to operate on argv[0] and fail.
7402
7403         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7404         it also matches the one from bash's builtin test.
7405         (binary_operator): Add \n at end of diagnostic.
7406
7407         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7408         * tests/priv-check: Move setuidgid-related and
7409         NON_ROOT_USERNAME-checking code to this file.
7410
7411         * README: Update section on testing as `root'.
7412         Suggestion from Paul Jarc.
7413
7414         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7415         names of authors that I just found in bash's builtins/test.def.
7416
7417         Running `[' with no arguments would evoke a segfault.
7418         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7419         precede potential use via test_syntax_error.
7420
7421         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7422         warning from automake -Wall.
7423
7424 2003-07-15  Jim Meyering  <jim@meyering.net>
7425
7426         * Version 5.0.1.
7427
7428         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7429         prompt us about it.
7430
7431         * announce-gen (print_changelog_deltas): Relax tests for matching
7432         version-number line in NEWS.
7433         Change the .sig suffix to .asc here, too.
7434
7435 2003-07-14  Jim Meyering  <jim@meyering.net>
7436
7437         * Makefile.maint (%.asc): Renamed from %.sig.
7438         Generate and use ascii-armored signatures.
7439         Use gpg's -o option.
7440
7441 2003-07-13  Jim Meyering  <jim@meyering.net>
7442
7443         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7444         (main): Use them.
7445
7446         * Makefile.maint (syntax-check): Move each individual check into
7447         its own target.
7448         (syntax-check-rules): This is the list of syntax-check targets.
7449         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7450         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7451         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7452
7453 2003-07-12  Jim Meyering  <jim@meyering.net>
7454
7455         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7456         traces of the nohup script.
7457
7458         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7459         $(OPTIONAL_BIN_ZCRIPTS).
7460
7461         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7462         target, not before the `>'.
7463
7464         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7465         now that that function no longer calls `error'.
7466
7467         * src/df.c (find_mount_point): Emit a diagnostic for each
7468         failed syscall, rather than relying on caller to do that.
7469         The caller couldn't do a good job, anyhow -- too many different
7470         ways to fail (each with a different referent).
7471         Give a diagnostic upon failed save_cwd, now that that function
7472         no longer calls `error'.
7473         (show_point): Don't diagnose find_mount_point's errors, now that
7474         it handles them itself.
7475
7476         * src/df.c (find_mount_point): Don't let free clobber errno upon
7477         failed chdir.
7478
7479         * src/sys2.h: Remove alloca-related block.
7480         * src/system.h: Include <alloca.h> here, instead.
7481
7482         It appears that the `#pragma alloca' included via "system.h" is
7483         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7484         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7485         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7486
7487         * src/chown-core.c (change_file_owner): Do not restore any special
7488         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7489         by chown(2) on some systems.  Suggestion and insistence :-) from
7490         Michael Stone.
7491
7492         * tests/input-tty: Also check `test -t 1'.
7493         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7494         test would block when run in the background.
7495
7496 2003-07-11  Jim Meyering  <jim@meyering.net>
7497
7498         * tests/sample-test: Also fail if cat-to-create-expected-output
7499         fails.  Otherwise, if both `exp' and `out' were to end up empty
7500         because of e.g., a full disk, they would mistakenly compare equal.
7501
7502         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7503         This solves a portability problem: on at least Solaris systems,
7504         when nohup.sh used the vendor /bin/sh, it would exit with status
7505         of `1' rather than the required 126 or 127 upon failure to exec
7506         the specified program.
7507
7508         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7509         (bin_PROGRAMS): Add nohup.
7510         (EXTRA_DIST): Remove nohup.sh.
7511         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7512         * src/nohup.sh: Remove file.
7513         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7514
7515         * tests/misc/nohup: Tests for the above.
7516         * tests/misc/Makefile.am (TESTS): Add nohup.
7517
7518         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7519         the macro, COPY_FD_DIAGNOSE.
7520         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7521         (head_file): Likewise.
7522
7523         * src/date.c: Include "quote.h".
7524         (batch_convert): Use the quote function rather than using literal `...'
7525         in a diagnostic.
7526
7527         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7528         * src/fmt.c (main): Likewise.
7529         * src/mknod.c (main): Likewise.
7530         * src/tac.c (tac_seekable): Likewise.
7531         * src/yes.c (main): Likewise.
7532         * src/od.c (main): Likewise.
7533         * src/install.c (change_attributes): Likewise.
7534
7535 2003-07-10  Jim Meyering  <jim@meyering.net>
7536
7537         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7538         * src/tail.c (usage): Likewise.
7539
7540         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7541         place of the kludge in this test.  Suggestion from Paul Jarc.
7542
7543         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7544         * src/setuidgid.c: New program, solely for testing (not installed).
7545
7546         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7547         when dereferencing symlinks.
7548
7549 2003-07-09  Jim Meyering  <jim@meyering.net>
7550
7551         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7552         * tests/du/Makefile.am (TESTS): Add slash
7553
7554         * src/tail.c (xlseek): Avoid warning about ``return without value
7555         from function returning non-void''.
7556
7557 2003-07-08  Jim Meyering  <jim@meyering.net>
7558
7559         * man/help2man: Update to version 1.29.
7560
7561         * man/help2man: Add END handler to close STDOUT and check for errors.
7562
7563 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7564
7565         Add support for a "[" that conforms to the GNU coding standards,
7566         i.e., that does not depend on its name.
7567         * src/lbracket.c: New file.
7568         * README: Add "[".
7569         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7570         a separate man page.
7571         * src/Makefile.am (bin_PROGRAMS): Add "[".
7572         (__SOURCES): New var.
7573         * src/test.c (LBRACKET): Define to 0 if not defined.
7574         (main): Use LBRACKET rather than argv[0].
7575
7576         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7577         Reported by Paul Jarc and Dan Jacobson.
7578
7579         * src/test.c (main): Do not recognize --help or --version if
7580         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7581         Do not bother testing that margv[margc] is non-null.
7582
7583 2003-07-04  Jim Meyering  <jim@meyering.net>
7584
7585         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7586         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7587
7588         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7589         option, and perform the +1600 invocations of head IFF the envvar
7590         RUN_EXPENSIVE_TESTS is set.
7591
7592 2003-07-03  Jim Meyering  <jim@meyering.net>
7593
7594         * src/cp.c (do_copy): Give a better diagnostic when failing due
7595         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7596         See http://bugs.debian.org/199730 for details.
7597
7598 2003-06-27  Jim Meyering  <jim@meyering.net>
7599
7600         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7601         * src/split.c (longopts): Use `1', not `0' as the value for
7602         for &verbose.  Reported by Keith Thompson.
7603
7604         Test for the above fix.
7605         * tests/misc/split-a: Also use --verbose and compare stderr
7606         output with what we'd expect.
7607
7608 2003-06-20  Jim Meyering  <jim@meyering.net>
7609
7610         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7611         Use `error_t' (rather than int) as type for local `err'.
7612         From Alfred M. Szmidt.
7613
7614 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7615
7616         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7617         Fix author preservation code.
7618
7619 2003-06-19  Jim Meyering  <jim@meyering.net>
7620
7621         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7622         (do_link): Don't warn about hard link to symlink.
7623
7624 2003-06-18  Jim Meyering  <jim@meyering.net>
7625
7626         * src/cut.c: Include "getdelim2.h", not "getstr.h".
7627         Reflect renaming: getstr -> getdelim2.
7628
7629         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7630         readline -> readlinebuffer.
7631
7632 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7633
7634         * src/readlink.c: Include <sys/types.h> before system.h (because
7635         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
7636
7637 2003-06-17  Jim Meyering  <jim@meyering.net>
7638
7639         * src/system.h (initialize_main): Define.
7640         Use it in every `main'.  Applied via this:
7641         p='initialize_main (&argc, &argv);'
7642         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
7643           $(grep -l program_name.=.argv.0 *.c)
7644         test.c uses margc/margv, so I made the change manually for that file.
7645         Based on a patch from Bernard Giroud.
7646
7647 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
7648
7649         Fix for build failure on Ultrix 4.3.
7650         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7651         Include sys/param.h and sys/mount.h on ultrix.
7652
7653 2003-06-16  Jim Meyering  <jim@meyering.net>
7654
7655         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7656         definitions.
7657         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7658         them here instead, but with one change: define EISDIR to -1, not 0.
7659
7660         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7661         guaranteed to be defined.
7662         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7663
7664         * README: Mention the CVS repository.
7665         Encourage addition of test cases.
7666
7667 2003-06-12  Jim Meyering  <jim@meyering.net>
7668
7669         * src/touch.c (touch): Call close only if necessary.
7670         From Bruno Haible.
7671
7672         * src/wc.c (usage): Correct wording: wc prints counts in the order
7673         `newline, word, byte'.  Reported by Keith M. Briggs.
7674         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
7675
7676 2003-06-10  Jim Meyering  <jim@meyering.net>
7677
7678         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7679
7680 2003-06-07  Jim Meyering  <jim@meyering.net>
7681
7682         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7683         rule.
7684
7685 2003-06-06  Jim Meyering  <jim@meyering.net>
7686
7687         * src/extract-magic (main): Avoid newer 3-arg form of open,
7688         so this script works also with e.g., perl5.005_03.
7689         Patch by John David Anglin.
7690
7691 2003-06-04  Paul Eggert  <eggert@twinsun.com>
7692
7693         * src/system.h: Include <stdbool.h> unconditionally.
7694
7695 2003-06-04  Jim Meyering  <jim@meyering.net>
7696
7697         * man/Makefile.am (check-programs-vs-x): Rename target
7698         from check-programs-vs-1.  Adjust rule to check for the
7699         primary (.x) file, not the generated one (.1).
7700
7701 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7702
7703         * man/kill.x: New file.
7704         * man/Makefile.am (dist_man_MANS): Add kill.1.
7705         (kill.1): New rule.
7706
7707 2003-06-04  Jim Meyering  <jim@meyering.net>
7708
7709         Ensure that the .x file for a new program is never forgotten again.
7710         * man/Makefile.am (programs): Define.
7711         (check-programs-vs-1): New phony target.
7712         (check-local): Depend on it.
7713
7714 2003-06-03  Jim Meyering  <jim@meyering.net>
7715
7716         Avoid unnecessary copying of environment.
7717         * src/env.c (main): Rather than clearing the environment and --
7718         unless told to ignore environment -- copying all settings from
7719         the saved, original environment, clear the environment only when
7720         that is requested.  Suggested by Jens Elkner.
7721
7722 2003-06-02  Jim Meyering  <jim@meyering.net>
7723
7724         * src/system.h: Always include <string.h>, since we assume C89.
7725         Include <limits.h> without checking for HAVE_LIMITS_H.
7726
7727         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7728         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7729
7730 2003-06-01  Jim Meyering  <jim@meyering.net>
7731
7732         Avoid a race condition in `tail -f' described by Ken Raeburn in
7733         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7734         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7735         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7736         (tail_bytes, tail_lines, tail): Likewise.
7737         (tail_file): Use the new `read_pos' value as the size,
7738         rather than stats.st_size from the fstat call.
7739
7740 2003-05-28  Jim Meyering  <jim@meyering.net>
7741
7742         * src/extract-magic: Allow expansion of `$file' in the here-
7743         document corresponding to the comment at the top of fs.h.
7744
7745 2003-05-26  Jim Meyering  <jim@meyering.net>
7746
7747         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7748         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7749         Use #if/#elif/... cascade so we get only one set of include files.
7750         Reported by Nelson Beebe.
7751
7752 2003-05-24  Jim Meyering  <jim@meyering.net>
7753
7754         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7755         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7756         accept the BSD format.
7757
7758 2003-03-28  Joe Orton  <jorton@redhat.com>
7759
7760         * src/md5sum.c (bsd_split_3): New function.
7761         (split_3): Detect checksums from BSD 'md5' command and handle them
7762         using bsd_split_3.
7763
7764         * tests/md5sum/basic-1: New tests for --check exit status, and for
7765         BSD-style checksum files.
7766
7767 2003-05-21  Jim Meyering  <jim@meyering.net>
7768
7769         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7770         This sort of thing is why it'd be *Really Good* to factor
7771         out the common code used here and in tail.c.
7772
7773 2003-05-14  Jim Meyering  <jim@meyering.net>
7774
7775         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7776
7777         * tests/du/slink: Skip this test if `.' is on an XFS file system.
7778
7779         * tests/du/fd-leak: New file.  Test for the bug in du that
7780         was fixed by the 2003-05-12 change to lib/ftw.c.
7781         * tests/du/Makefile.am (TESTS): Add fd-leak.
7782
7783         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7784         includes a translatable word, `and'.
7785
7786         * src/dd.c (usage): Don't use `,' as the thousands separator
7787         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
7788         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7789         * src/df.c (usage): Likewise.
7790         * src/du.c (usage): Likewise.
7791         * src/ls.c (usage): Likewise.
7792
7793         * Makefile.maint (syntax-check): Add another check.
7794
7795 2003-05-13  Paul Eggert  <eggert@twinsun.com>
7796
7797         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7798         must output nothing.  Problem reported by Josh Hyman.
7799
7800         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7801         (output_unique, output_first_repeated, output_later_repeated):
7802         New vars.  All uses of "mode" changed to use these variables,
7803         which are not mutually exclusive as "mode" was.
7804         (writeline): New arg "match", used to control whether to
7805         obey output_first_repeated or output_later_repeated.
7806         All callers changed.
7807         (check_file, main): Adjust to above changes.
7808
7809         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7810
7811 2003-05-14  Jim Meyering  <jim@meyering.net>
7812
7813         * tests/rm/rm3: Use tr's \n notation rather than \012.
7814         This package can afford to do that, since its tests are guaranteed use
7815         GNU tr, which has accepted the more modern notation for 10 years.
7816         * tests/rm/rm5: Likewise.
7817         * tests/cp/same-file: Likewise.
7818         * tests/stty/row-col-1: Likewise.
7819         * tests/stty/basic-1: Likewise.
7820         * tests/rm/deep-1: Likewise.
7821         * tests/mv/part-symlink: Likewise.
7822         * tests/mkdir/perm: Likewise.
7823         * tests/misc/nice: Likewise.
7824
7825 2003-05-13  Jim Meyering  <jim@meyering.net>
7826
7827         * src/copy.c (struct F_triple) [name]: Remove const attribute.
7828         (triple_free): Don't apply cast to argument of free.
7829         (seen_file): Add cast here instead.
7830
7831         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7832         (src_to_dest_free): Don't apply cast to argument of free.
7833
7834         * src/sort.c (zaptemp): Don't apply cast to argument of free.
7835         * src/pr.c (init_fps, init_store_cols): Likewise.
7836         * src/join.c (delseq, freeline): Likewise.
7837         * src/expr.c (OLD): Likewise.
7838         * src/sort.c (sort): Likewise.
7839         * src/head.c (elide_tail_lines_pipe): Likewise.
7840
7841         * src/tail.c: Include "quote.h".
7842         Use quote in diagnostics.  Change many error format strings
7843         from just `%s' to e.g., `error reading %s'.
7844         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7845         Rewrite newline-counting loop to use memchr.
7846
7847         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7848         Now that assert is no longer used, don't include <assert.h>.
7849
7850 2003-05-12  Jim Meyering  <jim@meyering.net>
7851
7852         * src/head.c: Include <assert.h>.
7853         (AUTHORS): Add my name.
7854         (elide_tail_lines_pipe): New function.
7855
7856 2003-05-10  Jim Meyering  <jim@meyering.net>
7857
7858         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7859
7860         * src/readlink.c (main): Set program_name before first use.
7861         Remove that (redundant) first use.
7862         Don't exit successfully just because --verbose was specified.
7863         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7864         parameter is 0, error does not exit.
7865
7866         * src/uname.c (main): When failing due to too many arguments, also say
7867         that, rather than just "Try `uname --help' for more information.".
7868         * src/comm.c (main): Likewise, but for too few arguments.
7869         * src/logname.c: Include error.h.
7870         (main): Say why we're failing.
7871
7872         * src/uniq.c (main): Don't segfault when argc < optind.
7873         * src/who.c (main): Handle argc < optind.
7874         * src/df.c (main): Likewise.
7875         * src/install.c (main): Likewise.
7876         * src/mv.c (main): Likewise.
7877         * src/pwd.c (main): Likewise.
7878         * src/tty.c (main): Likewise.
7879         * src/chroot.c (main): Likewise.
7880         * src/hostname.c: Likewise.
7881         * src/du.c (main): Likewise.
7882         * src/expand.c (main): Likewise.
7883         * src/env.c (main): Likewise.
7884         * src/unexpand.c (main): Likewise.
7885         * src/printenv.c (main): Likewise.
7886         * src/sync.c (main): Handle argc == 0.
7887         * src/expr.c (main): Likewise.
7888         * src/printf.c (main): Likewise.
7889         * src/basename.c (main): Likewise.
7890         * src/ln.c (main): Test for `missing argument' before computing n_files.
7891         * src/tail.c (main): Test for the case of no arguments before
7892         computing n_files.
7893
7894         * src/kill.c (send_signals): Don't check command line arguments here.
7895         (main): Check them here instead.  Handle argc < optind.
7896
7897         * src/logname.c (main): Use error, rather than fprintf, for the sake
7898         of consistency.
7899
7900         * src/rm.c (main): Don't overrun array bound if argc is 0.
7901
7902 2003-05-09  Jim Meyering  <jim@meyering.net>
7903
7904         * src/sort.c (main): Don't overrun array bound if argc is 0.
7905         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7906         Reported by Wartan Hachaturow.
7907
7908 2003-05-07  Jim Meyering  <jim@meyering.net>
7909
7910         Implement support so that `head --lines=-N' works on seekable files.
7911         * src/head.c (enum Copy_fd_status): Define.
7912         (COPY_FD_DIAGNOSE): New macro.
7913         (elide_tail_lines_seekable): New funtion.
7914         (elide_tail_lines_file): Call it here.
7915
7916 2003-05-06  Jim Meyering  <jim@meyering.net>
7917
7918         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7919
7920 2003-05-04  Jim Meyering  <jim@meyering.net>
7921
7922         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7923         caused the addition of thousands of small files to the tar archive.
7924         * tests/misc/head-elide-tail: New file.  Add them here instead.
7925         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7926
7927 2003-05-04  Paul Eggert  <eggert@twinsun.com>
7928
7929         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7930         (IF_READDIR_NEEDS_REWINDDIR): Remove.
7931         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7932         which was a bit weird because it couldn't be emulated by a function.
7933
7934 2003-05-03  Jim Meyering  <jim@meyering.net>
7935
7936         Extend head to accept --lines=-N (--bytes=-N) and to print all
7937         but the N lines (bytes) at the end of the file.
7938         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7939         Use quote() in diagnostics, rather than literal `' marks.
7940         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7941         New functions.
7942         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7943         (head_file): Reorganize so as to call head from only one place.
7944         (main): Likewise, for head_file.
7945         Handle new, undocumented option, --presume-input-pipe.
7946         Handle negative line and byte counts.
7947         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7948
7949         * tests/du/8gb: Skip test if the file system of `.' doesn't support
7950         sparse files -- otherwise it'd create a file of size 8GB.
7951
7952 2003-05-02  Jim Meyering  <jim@meyering.net>
7953
7954         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7955         Instead explain about `-' and standard input.
7956         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7957         Reported by Keith Thompson.
7958         * tests/fmt/basic: Add test for the above fix.
7959
7960         * src/fmt.c: Include "quote.h".
7961         Use quote() in diagnostics, rather than literal `' marks.
7962         (main): Exit nonzero when unable to open an input file.
7963         * tests/fmt/basic: Add test for the above fix.
7964
7965         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7966         specifications like `-72x'.
7967         * tests/fmt/basic: Add test for the above fix.
7968
7969         Work around nasty readdir bug on Darwin6.5.
7970         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7971         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7972         returned NULL and there has been at least one successful unlink or
7973         rmdir call since the opendir or previous rewinddir, then call
7974         rewinddir and reiterate the loop.
7975
7976         Factor out common code.
7977         * src/remove.c (readdir_ignoring_dotdirs): New function.
7978         (is_empty_dir): Use it here.
7979         (remove_cwd_entries): Use it here.
7980
7981 2003-05-01  Jim Meyering  <jim@meyering.net>
7982
7983         * tests/rm/r-3: Create 500 rather than just 300 files.
7984         There's a bug in Darwin6.5's readdir that shows up only with
7985         338 or more files.
7986         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7987         has two components.
7988
7989         * src/tail.c:
7990         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7991         (dump_remainder): Move two declarations `down' into the scope
7992         where they are used.
7993         (xlseek): Return the resulting offset.
7994         (file_lines): Rename parameter, file_length, to end_pos.
7995         (pipe_lines): Don't coerce safe_read return value to `int'.
7996         Adapt tests accordingly.
7997         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7998         to `unsigned int'.
7999         Change type of `total_bytes' from `int' to `size_t',
8000         since the former wouldn't always be wide enough.
8001         Don't coerce safe_read return value to `int',
8002         and adapt tests accordingly.
8003         Now that testing for a read error no longer involves
8004         using `tmp', handle that case *after* freeing `tmp'.
8005         (start_bytes): Clean up.
8006         (tail_bytes): Now that `n_bytes' may be larger than
8007         OFF_T_MAX, test for that condition and, if it's true, don't
8008         use lseek optimizations.
8009         (parse_options): Don't fail just because N_UNITS is larger than
8010         the maximum size of a file -- tail may be applied to an input
8011         stream (e.g., a pipe) with more data than that.
8012
8013         * Makefile.maint (syntax-check): Rename from alloc-check.
8014         Also check for SPACE-TAB sequences.
8015         Also check for malloc/calloc/realloc casts.
8016
8017 2003-05-01  Jim Meyering  <jim@meyering.net>
8018
8019         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
8020
8021 2003-04-28  Jim Meyering  <jim@meyering.net>
8022
8023         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
8024         make the now-more-picky tsort fail.
8025
8026 2003-04-24  Jim Meyering  <jim@meyering.net>
8027
8028         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
8029         (main): Minor syntactic clean-up.
8030
8031         * src/tsort.c (tsort): Fail if the input contains an odd number of
8032         tokens.  Reported by junkio@cox.net.
8033
8034         * tests/tsort/basic-1: Test for the above fix.
8035
8036 2003-04-21  Jim Meyering  <jim@meyering.net>
8037
8038         * tests/misc/printf: Add tests for the printf fixes below.
8039
8040         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
8041
8042 2003-04-20  Paul Eggert  <eggert@twinsun.com>
8043
8044         Fix printf POSIX compatibility bug reported by Ben Harris in
8045         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
8046         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
8047         \0NNN in the %b operand.
8048         * src/printf.c (usage): Likewise.
8049         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
8050         is desired.  All uses changed.  Behave like Bash printf if %b
8051         operand uses \NNN where the initial N is not 0.
8052
8053 2003-04-17  Jim Meyering  <jim@meyering.net>
8054
8055         * src/stty.c: Remove uses of PROTOTYPE macro.
8056
8057 2003-04-15  Jim Meyering  <jim@meyering.net>
8058
8059         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
8060         each sequence of spaces before a TAB character.
8061
8062 2003-04-13  Jim Meyering  <jim@meyering.net>
8063
8064         * src/remove.c (is_empty_dir): Don't closedir (NULL).
8065
8066 2003-04-12  Jim Meyering  <jim@meyering.net>
8067
8068         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
8069         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
8070         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
8071         * src/nl.c (main): Fix those problems and remove literal quote marks
8072         (e.g., "`%s'") from format string; instead use "%s" in each format
8073         string and `quote (optarg)' as the corresponding argument.
8074         Also, diagnose all invalid command line options before failing.
8075
8076         * src/nl.c (proc_text): Fix a bug that would make nl output extra
8077         newlines in some cases.  Details here: http://bugs.debian.org/177256.
8078         This bug was introduced on 2001-11-10 for textutils-2.0.17.
8079         * tests/misc/nl: Add test for the above-fixed bug.
8080
8081         * tests/misc/readlink: New file.  Test the --canonicalize option.
8082         * tests/misc/Makefile.am (TESTS): Add readlink.
8083
8084 2003-04-11  Jim Meyering  <jim@meyering.net>
8085
8086         Clean up.
8087         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
8088         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
8089         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
8090         retain alignment) each sequence of spaces before a TAB character.
8091
8092         * src/ls.c: Include <stdlib.h> unconditionally.
8093
8094         * Makefile.maint (xalloc-check): Rename from header-check.
8095
8096         * src/yes.c: Include error.h after system.h, not before.
8097
8098         Clean up.
8099         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
8100         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
8101         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
8102         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
8103         * src/tr.c: * src/unexpand.c, src/users.c:
8104         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
8105         return values and of xrealloc's first argument.
8106         Fix the former with this:
8107         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
8108
8109 2003-04-10  Jim Meyering  <jim@meyering.net>
8110
8111         * src/stty.c (wrapf): Declare with format attribute.
8112
8113         The S_MAGIC_... names shouldn't be maintained in two places (prior
8114         to this change, one would have to keep stat.c and fs.h in sync).
8115         This change makes it so those names and the corresponding
8116         hexadecimal constants all reside in stat.c.  fs.h is now generated.
8117         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
8118         (BUILT_SOURCES): Add fs.h, now that it's generated.
8119         (EXTRA_DIST): Add extract-magic.
8120         * src/extract-magic: New script to extract fs.h definitions from stat.c.
8121         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
8122         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
8123
8124         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
8125         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
8126
8127         * man/unexpand.x: Add `SEE ALSO' reference to expand.
8128         * man/expand.x: Add `SEE ALSO' reference to unexpand.
8129         Suggestion from Dan Jacobson.
8130
8131 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
8132
8133         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
8134         * src/stat.c (human_fstype): Handle Linux's devpts.
8135
8136 2003-04-09  Paul Eggert  <eggert@twinsun.com>
8137
8138         * src/split.c (line_bytes_split): Arg is of type size_t, since
8139         that's all that is supported for now.
8140         (main): Check for overflow in obsolescent line count option.
8141
8142 2003-04-09  Jim Meyering  <jim@meyering.net>
8143
8144         * tests/misc/split-fail: Add a new test for the above fix.
8145
8146         * src/split.c (bytes_split): Use size_t temporary (rather than
8147         uintmax_t original) in remaining computations.  From Paul Eggert.
8148
8149         Handle command line option arguments larger than 2^31.
8150         This allows e.g., splitting into files of size 2GB and larger,
8151         and running split --lines=N with N=2^31 or more.
8152         But for --line-bytes=N, the restriction that N <= SIZE_MAX
8153         remains (for now), due to the way it is implemented.
8154
8155         * src/split.c: Include "inttostr.h".
8156         (bytes_split, lines_split, line_bytes_split, main):
8157         Use uintmax_t, not size_t, for file sizes.
8158         (main): Give a better diagnostic for option arguments == 0.
8159         Use umaxtostr to print file sizes.
8160         Reported by Luke Hassell.
8161
8162 2003-04-08  Jim Meyering  <jim@meyering.net>
8163
8164         * src/rm.c (usage): Mention that --directory (-d) works only
8165         on some systems.  Suggestion from Samuel Tardieu.
8166
8167         * tests/basename/basic: Run $PERL to see if it is available,
8168         rather than testing its value.
8169         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
8170         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
8171         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
8172         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
8173         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
8174         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
8175         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
8176         * tests/sum/basic-1, tests/seq/basic: Likewise.
8177
8178         * tests/misc/Makefile.am (TESTS): Add split-fail.
8179         * tests/misc/split-fail: New file.
8180
8181         * src/split.c: Rename local variables: nchars -> n_bytes.
8182         (lines_split): Rename local, nlines -> n_lines.
8183         (main): Rename local variable: s/accum/n_units/.
8184         (main): Use STDIN_FILENO, not literal `0'.
8185
8186 2003-04-07  Jim Meyering  <jim@meyering.net>
8187
8188         * src/stat.c: Add #include directives for Ultrix 4.4.
8189         Based on a suggested change from Bert Deknuydt.
8190
8191 2003-04-06  Jim Meyering  <jim@meyering.net>
8192
8193         * Makefile.maint (makefile-check): New rule.
8194         (local-check): Add it.
8195
8196 2003-04-05  Jim Meyering  <jim@meyering.net>
8197
8198         * Makefile.am (nearly all of them):
8199         Use $(VAR) rather than @VAR@, now that we can rely on automake to
8200         emit a definition for each substituted variable.
8201         * tests/Makefile.am.in: Likewise.
8202
8203         * tests/rm/rm5: Add a comment explaining why this test fails when
8204         using Tru64's broken sed.
8205         * tests/rm/rm3: Likewise.
8206
8207         Make `kill -t' output signal descriptions (not `?') on Tru64.
8208         * src/kill.c (sys_siglist): Also check for __sys_siglist.
8209         Patch by Tony Leneis.
8210         * configure.ac: Also check for declaration of __sys_siglist.
8211         Required for Tru64 4.0D, 4.0F, and 5.1.
8212         Reported by Tony Leneis.
8213
8214 2003-04-04  Jim Meyering  <jim@meyering.net>
8215
8216         * src/Makefile.am (PERL): Remove unnecessary definition.
8217
8218         Because of inappropriate (but POSIX-mandated) behavior of rename,
8219         `mv a b' would not remove `a' in some unusual cases.  Work around
8220         this by unlinking `a' when necessary.
8221
8222         * src/copy.c (same_file_ok): Add an output parameter.
8223         Set it in the offending case.
8224         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
8225         Reported by Ed Avis.
8226         * tests/mv/hard-4: New test for the above.
8227         * tests/mv/Makefile.am (TESTS): Add hard-4.
8228
8229         Clean up rules for automatically generated sources:
8230         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
8231         Make each generated file be read-only.
8232         Add each file name to BUILT_SOURCES separately.
8233         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8234
8235         Put LOCALEDIR macro definition in new file: localedir.h.
8236         * src/Makefile.am (DEFS): Remove definition.
8237         (localedir.h): New rule.
8238         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8239         * src/system.h: Include "localedir.h".
8240
8241 2003-04-02  Jim Meyering  <jim@meyering.net>
8242
8243         * Version 5.0.
8244
8245         * tests/misc/Makefile.am (TESTS): Add false.
8246
8247         * Makefile.maint (TMPDIR): Make sure it's defined.
8248         (my-distcheck): Build in $(TMPDIR), not `.'.
8249
8250         * src/Makefile.am (false.c): Change all occurrences of
8251         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8252         unsuccessfully also with --help.  Reported by Paul Jarc,
8253         * tests/misc/false: New test for the above.
8254
8255 2003-03-30  Jim Meyering  <jim@meyering.net>
8256
8257         * NEWS: Note the location of older NEWS files.
8258
8259         * src/remove.c (is_empty_dir): Don't let a failing closedir
8260         clobber errno.  Spotted by Arnold Robbins.
8261
8262         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8263
8264 2003-03-29  Jim Meyering  <jim@meyering.net>
8265
8266         * Version 4.5.12.
8267
8268         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8269         Note that there are some harmless test failures when running
8270         `make check' as root on some systems.
8271
8272 2003-03-28  Jim Meyering  <jim@meyering.net>
8273
8274         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8275         This happens when connecting to sparc-solaris5.7 via ssh from within
8276         emacs.  Reported by Karl Berry.
8277
8278         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8279         Otherwise, on systems (DJGPP) that emulate pipes using files,
8280         this test would never complete, waiting for `yes' to terminate.
8281         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8282         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8283         Reported by Rich Dawe.
8284
8285 2003-03-27  Jim Meyering  <jim@meyering.net>
8286
8287         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8288         from `written by...' comment, at his request.
8289
8290 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8291
8292         Fix buffer overrun problem reported by TAKAI Kousuke, along
8293         with some other POSIX incompatibilities.
8294
8295         * src/printf.c (print_esc): Do not treat \x specially if
8296         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8297         in backslash.  Treat incomplete escape sequences as strings
8298         of characters, as POSIX requires.
8299         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8300         if the format is incomplete.
8301
8302 2003-03-24  Jim Meyering  <jim@meyering.net>
8303
8304         * tests/misc/printf: Add tests for the above fixes and changes.
8305
8306 2003-03-26  Jim Meyering  <jim@meyering.net>
8307
8308         * src/copy.h (struct cp_options): Add a comment.
8309
8310 2003-03-23  Jim Meyering  <jim@meyering.net>
8311
8312         * README: Describe problem with 64-bit mode on HPUX 11.x,
8313         with patch for /usr/include/inttypes.h.
8314         * TODO: Plan to add an autoconf test to work around the bug.
8315
8316 2003-03-22  Jim Meyering  <jim@meyering.net>
8317
8318         * src/stat.c: Don't include <sys/sysmacros.h>.
8319         That is already done via system.h.  Otherwise, the multiple
8320         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8321         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8322         (human_fstype): Factor some directives `up', out of this function.
8323         Cast away `const' to avoid error from Cray's /bin/cc.
8324
8325 2003-03-20  Jim Meyering  <jim@meyering.net>
8326
8327         * announce-gen (print_changelog_deltas): Ensure that a newline
8328         precedes each row of `*'s.
8329
8330 2003-03-20  Jim Meyering  <jim@meyering.net>
8331
8332         * Version 4.5.11.
8333
8334         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8335         format flag characters.
8336         Do not require that a field width be specified.
8337         Do not fail when given a field width of `0'.
8338         Reported by Dan Jacobson.
8339         * tests/seq/basic: Add new tests for the above-fixed bug.
8340
8341         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8342         (install-root): Likewise.
8343         (install-exec-local): Likewise.
8344         Based on a patch from Richard Dawe.
8345
8346 2003-03-19  Jim Meyering  <jim@meyering.net>
8347
8348         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8349         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8350         Include $(EXEEXT) in program names.
8351         Since $(LN_S) may degenerate to `cp -p', be careful
8352         to invoke it from the destination directory.
8353         Mostly from Richard Dawe.
8354         * configure.ac: Use AC_PROG_LN_S.
8355
8356         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8357         CDPATH shell variable set could cause this test to fail.
8358         Reported by Karl Berry.
8359
8360 2003-03-18  Jim Meyering  <jim@meyering.net>
8361
8362         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8363         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8364         AIX 5.1's xlc could not compile the former.
8365         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8366
8367 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8368
8369         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8370         program names, since automake only adds $(EXEEXT) to programs
8371         in its *_PROGRAMS.
8372
8373 2003-03-16  Jim Meyering  <jim@meyering.net>
8374
8375         * src/remove.c (rm): Put two local variables in static storage,
8376         so they can't be clobbered by the potential longjmp.
8377
8378 2003-03-15  Jim Meyering  <jim@meyering.net>
8379
8380         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8381         so that a version number with a two-digit component can still count
8382         as an alpha release.  Reported by Richard A Downing.
8383         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8384
8385 2003-03-14  Jim Meyering  <jim@meyering.net>
8386
8387         * src/ansi2knr.c: Remove no-longer-used file.
8388         * src/ansi2knr.1: Likewise.
8389
8390         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8391         assignment, since it causes trouble with old versions of GNU make
8392         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8393         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8394         Patch from Alexandre Duret-Lutz.
8395
8396         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8397         subdirectories so that each includes a definition of ACLOCAL_M4.
8398
8399         * announce-gen (main): Label the compressed source URLs.
8400
8401         * Version 4.5.10.
8402
8403         * tests/du/slink: Relax the test for the `local'ness of a file system,
8404         so that now it works also for tmpfs.
8405
8406         * tests/du/hard-link: Transform output from first du, so that this
8407         test doesn't fail on file systems like tmpfs that order directory
8408         entries differently.
8409
8410 2003-03-13  Jim Meyering  <jim@meyering.net>
8411
8412         * tests/du/8gb: Work around what appears to be an NFS failure that
8413         would make this test fail on some systems.
8414
8415 2003-03-11  Jim Meyering  <jim@meyering.net>
8416
8417         * tests/du/basic: Make the test file exactly 4k bytes long.
8418
8419         * src/split.c (longopts): Don't hard-code `2' here.
8420         Instead, just specify `&verbose', and ...
8421         (main): ... remove the `case 2:' block for --verbose.
8422
8423         * tests/du/basic: Make the test file larger than 64 bytes, so that
8424         we don't immediately disqualify file systems (e.g., NetApp) on which
8425         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8426
8427 2003-03-10  Jim Meyering  <jim@meyering.net>
8428
8429         Don't segfault for a negative field width or precision in format string.
8430         Note that this is just a stopgap fix.  The longer term solution may
8431         involve adapting bash's builtins/printf.def.
8432
8433         * src/printf.c: (UNSPECIFIED): Define.
8434         (print_direc): Use the special value, UNSPECIFIED, to indicate
8435         that field_width or precision has not been specified.
8436         (print_formatted): Fail if field_width or precision is the
8437         special value, UNSPECIFIED.
8438         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8439
8440         * src/sys2.h (INT_MIN): Define, if necessary.
8441         * tests/misc/printf: Add a test for the above-fixed bug.
8442
8443 2003-03-09  Jim Meyering  <jim@meyering.net>
8444
8445         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8446         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8447         Reported by Bob Proulx.
8448         (pop_dir): Reverse order of sign change and cast, to be consistent
8449         with the above.
8450
8451 2003-03-08  Jim Meyering  <jim@meyering.net>
8452
8453         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8454         shell variable, but only in the environment.  With /bin/sh->bash, the
8455         shell variable is set to `y', and that would cause a spurious warning.
8456         Reported by Bob Proulx.
8457
8458         * tests/Makefile.am (check-root): Remove touch/fifo.
8459         It doesn't appear to have to be run as root.
8460
8461         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8462         user name, make sure that the selected user name has a usable shell.
8463         Reported by Paul Jarc.
8464
8465         Before, when using shred on a device, one had to specify --exact,
8466         or be careful to choose a size that would not be rounded up and
8467         exceed the maximum value;  that could result in a failure of
8468         the final write.
8469         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8470         files.  Suggestion from Ben Elliston.
8471         (usage): Say it.
8472
8473         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8474         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8475         Patch by Bob Proulx.
8476
8477         * src/Makefile.am (check-misc): Check for use of `defined' in
8478         #define directives.
8479         Change to $(srcdir) before running grep.
8480
8481         * src/sleep.c: Remove now-unused #include and #define directives.
8482
8483         * src/du.c (process_file): If a file's size is not being counted
8484         e.g., because it's a hard link to a file we've already counted,
8485         then don't print a line for it.
8486
8487         * tests/du/hard-link: New test for the above-fixed bug.
8488         * tests/du/Makefile.am (TESTS): Add hard-link.
8489
8490         `du -S' didn't work
8491         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8492         and make the two-array approach work.
8493
8494         * tests/du/basic: Correct/add tests for the above fix.
8495         Set LC_ALL, etc., now that we use sort.
8496         Check the block/size of a small file, too.
8497         Correct expected results for simple dir1/dir2/file case.
8498         Add another test of du -S.
8499
8500 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8501
8502         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8503         middle-end/9986).  As one of GCC's optimizations, it transforms a
8504         fputs_unlocked call to a fputc_unlocked call when the string is
8505         one character long.  However, hpux doesn't have fputc_unlocked.
8506
8507         * expr.c (usage): Use putchar, not fputs, to output a single character.
8508         * ls.c (dired_dump_obstack): Likewise.
8509         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8510         * stat.c (print_it): Likewise.
8511
8512 2003-03-07  Jim Meyering  <jim@meyering.net>
8513
8514         * src/cp.c: Remove everything associated with mmap-stack.c.
8515         This reverts the two changes of 2003-02-21.
8516         * src/du.c: Remove everything associated with mmap-stack.c.
8517         This reverts the change of 2003-02-19.
8518
8519 2003-03-06  Jim Meyering  <jim@meyering.net>
8520
8521         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8522         CDPATH shell variable set could cause this test to fail.
8523         Reported by Karl Berry.
8524
8525 2003-03-05  Jim Meyering  <jim@meyering.net>
8526
8527         * Version 4.5.9.
8528
8529         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8530         integer with zero, to avoid a warning from Intel's ecc.
8531         Reported by Nelson Beebe.
8532
8533         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8534         Otherwise, for files or totals that are too big, numbers would
8535         be truncated.  Patch mostly by Michael Stone.
8536         Reported by Ingo Saitz as Debian bug #183210.
8537
8538         * tests/du/8gb: New test for the above-fixed bug.
8539         * tests/du/Makefile.am (TESTS): Add 8gb.
8540
8541         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8542         rather than UTILS_OPEN_MAX - 10.
8543
8544 2003-03-04  Jim Meyering  <jim@meyering.net>
8545
8546         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8547         rather than bug-gnu-utils, now that the former is better known.
8548         Suggestion from Göran Uddeborg.
8549
8550         * src/stat.c (usage): Capitalize consistently.
8551         Reported by Göran Uddeborg.
8552
8553         * Makefile.maint (rel-files): Include $(signatures), so that
8554         those files are also copied into $(release_archive_dir).
8555
8556         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8557         no longer does it.
8558         * src/remove.c (AD_pop_and_chdir): Likewise.
8559
8560         * tests/Makefile.am (check-root): Add fail-2eperm.
8561
8562 2003-03-03  Jim Meyering  <jim@meyering.net>
8563
8564         * src/remove.c (remove_cwd_entries): Include the full filename of
8565         the offending file, not just the basename.
8566
8567         * tests/misc/tty-eof: Set $ME properly.
8568
8569         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8570         Remove now-unused variables.
8571         (tag-prev-version, prev-cvs-tag): Likewise.
8572
8573         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8574         accurate diagnostic when failing to remove a file owned by some other
8575         user.  Reported by Ivo Timmermans via Michael Stone.
8576         This fixes Debian bug# 178471.
8577
8578         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8579         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8580         Based on a report from Ivo Timmermans.
8581
8582 2003-03-02  Jim Meyering  <jim@meyering.net>
8583
8584         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8585         failure to create a hard link, do not remove the entry associating
8586         the source dev/ino with the destination file name.
8587         * tests/mv/Makefile.am (TESTS): Add hard-3.
8588         * tests/mv/hard-3: New test, for the above-fixed bug.
8589         Inspired by a report from Iida Yosiaki.
8590
8591 2003-03-01  Jim Meyering  <jim@meyering.net>
8592
8593         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8594         header string.  Instead, put `Filesystem' and `Type' headers in the
8595         same string, so translators can use horizontal space as needed.
8596         Reported by Jean Charles Delepine.
8597
8598 2003-02-28  Jim Meyering  <jim@meyering.net>
8599
8600         * src/copy.c (copy_internal): When link fails because of an
8601         existing destination file, unlink that file and try again.
8602         Reported by Iida Yosiaki.
8603
8604         * tests/mv/Makefile.am (TESTS): Add hard-2.
8605         * tests/mv/hard-2: New test for the above-fixed bug.
8606         Based on a test case from Iida Yosiaki.
8607
8608 2003-02-26  Jim Meyering  <jim@meyering.net>
8609
8610         * tests/du/basic: Don't test du's -b option here.  Directory byte
8611         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8612         and IBM AIX 4.2.  Reported by Nelson Beebe.
8613
8614 2003-02-25  Jim Meyering  <jim@meyering.net>
8615
8616         * Makefile.maint (announcement): Now that ChangeLog entries
8617         are output by announce-gen, don't do it here.
8618         * announce-gen (print_changelog_deltas): New function.
8619         (main): Use it.
8620
8621 2003-02-22  Jim Meyering  <jim@meyering.net>
8622
8623         * announce-gen: New option: --release-type=TYPE
8624         * Makefile.maint (beta, major): New targets.  Remove `release'.
8625         Put them all together on a line.
8626         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8627         invocation of `announcement'.
8628         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8629
8630         * announce-gen: New option: --news=NEWS_FILE.
8631         Extract NEWS entries here, not via rules in Makefile.maint.
8632         * Makefile.maint (announcement): Now that NEWS entries are
8633         extracted by announce-gen, don't do it here.
8634         (news-r1, news-r2): Remove now-unused definitions.
8635
8636 2003-02-21  Jim Meyering  <jim@meyering.net>
8637
8638         * Version 4.5.8.
8639
8640         Merge in changes from autoconf's version of this file.
8641         * Makefile.maint (www-gnu): Define.
8642         (standards.texi-url_prefix): Use $(www-gnu).
8643         (make-stds.texi-url_prefix): Likewise.
8644
8645         * src/cp.c: Include "mmap-stack.h".
8646         (main): Invoke `run' through a macro that (when possible) runs it
8647         with a large, mmap'd stack.
8648
8649         * src/cp.c (run): New function, preparing for the above.
8650         Exit from this function, not from main
8651         (main): Call run.
8652
8653         * src/du.c: New option: --apparent-size.
8654         (enum) [APPARENT_SIZE_OPTION]: New member.
8655         (long_options): Add it.
8656         (usage): Describe it.
8657         (main): Handle it.
8658         ['b']: Set apparent_size.
8659         David Eisner reported that the behavior of --bytes had changed.
8660         Paul Eggert proposed the use of a new option, --apparent-size.
8661
8662         * src/du.c (apparent_size): New global.
8663         (print_only_size): Reflect the fact that we're printing byte counts,
8664         not ST_NBLOCKSIZE-byte-block counts.
8665         (print_size): Call print_only_size rather than duplicating its code.
8666         (process_file): Accumulate byte counts, rather than block counts.
8667
8668         * src/du.c (process_file): Always reset size_to_propagate_to_parent
8669         for --separate-dirs (-S).
8670
8671 2003-02-20  Jim Meyering  <jim@meyering.net>
8672
8673         * Use automake-1.7.3.  Regenerate dependent files.
8674
8675         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8676         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8677         (usage) [%B]: Describe it.
8678         [%b]: Refer to %B.
8679
8680         * src/du.c (process_file): Reorganize the code to use only
8681         one `sum' array, and change how -S works back to the way it was
8682         before 2003-01-31.  Patch by Bruno Haible.
8683
8684         * tests/du/basic: New test.
8685         * tests/du/Makefile.am (TESTS): Add basic.
8686
8687         * tests/envvar-check: Add checks for the following:
8688         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8689
8690         * tests/Makefile.am: Rename phony target envvar-check to evar-check
8691         so as not to conflict with the distributed file by the same name.
8692
8693         * src/du.c (process_file): Set info->skip before any possible return.
8694
8695         Report correct usage for directories, not 0.
8696         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8697         _before_ recording the dev/ino of a directory.
8698         Reported by Bruno Haible.
8699
8700         Now, df always displays the device file name corresponding to the
8701         listed mount point under `Filesystem'.  Before, for an unmounted
8702         block- or character-special file argument, it would display the
8703         command-line argument instead.
8704         * src/df.c (show_disk): Return a value indicating whether
8705         there was a match.  Don't try to find a mount point here.
8706         (show_entry): If show_disk doesn't find a match, call show_point.
8707
8708 2003-02-19  Jim Meyering  <jim@meyering.net>
8709
8710         * src/du.c: Include "mmap-stack.h".
8711         (du_files): Add prototype with ATTRIBUTE_NORETURN.
8712         Exit from this function, not from...
8713         (main): ...here.
8714         Instead, if possible, invoke du_files through a macro that
8715         runs it with a large, mmap'd stack.
8716
8717         * src/join.c (usage): Change wording in --help output:
8718         use FILENUM instead of `SIDE' and say what FILENUM means.
8719         Reported by Bernhard Gabler.
8720
8721         * src/df.c (print_header): Rather than using a hard-coded literal
8722         string of spaces matching the length of the English `...Type' header,
8723         output the right number of spaces to match the selected translation.
8724         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8725
8726         * src/split.c (bytes_split): Remove unnecessary `else' after break.
8727         (lines_split): Likewise.  and correct misleading indentation.
8728
8729         * src/split.c: Include "full-read.h".
8730         (bytes_split, lines_split, line_bytes_split): Use full_read,
8731         not safe_read.   The way split was using the latter, a short read
8732         could cause split to terminate before EOF.
8733
8734         * tests/misc/tty-eof: Test all programs that can read stdin,
8735         requiring no arguments and that write to standard output.
8736
8737         * tests/misc/tty-eof: New file.  Renamed from ...
8738         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
8739         * tests/misc/Makefile.am (TESTS): Reflect renaming.
8740
8741 2003-02-18  Jim Meyering  <jim@meyering.net>
8742
8743         cksum would perform an extra read after encountering EOF
8744         * src/cksum.c (cksum): Exit the loop upon EOF, too.
8745         Patch by Michael Bacarella.
8746
8747         Test for the bug fixed today in cksum, md5sum, and sha1sum.
8748         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8749         cat, cksum, md5sum, and sha1sum all in the same loop.
8750
8751 2003-02-14  Jim Meyering  <jim@meyering.net>
8752
8753         * src/remove.c: Include "euidaccess.h".
8754         Remove declaration of euidaccess.
8755
8756 2003-02-12  Jim Meyering  <jim@meyering.net>
8757
8758         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8759         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
8760
8761 2003-02-10  Jim Meyering  <jim@meyering.net>
8762
8763         * src/test.c: Don't include group-member.h.
8764         Include euidaccess.h.
8765         (eaccess): Rewrite function to set the real uid and gid temporarily
8766         to the effective uid and gid, then invoke 'access', and then set the
8767         real uid and gid back.  On systems that lack setreuid or setregid,
8768         fall back on the kludges in euidaccess.  Before, it would not work
8769         for e.g., files with ACLs, files that were marked immutable,
8770         or on file systems mounted read-only.  Nelson Beebe raised the issue.
8771         Paul Eggert suggested the new implementation.
8772
8773 2003-02-09  Jim Meyering  <jim@meyering.net>
8774
8775         * src/test.c (test_stat): Remove function.  It's job is done (only
8776         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
8777
8778 2003-02-08  Jim Meyering  <jim@meyering.net>
8779
8780         * Version 4.5.7.
8781
8782         * tests/mv/part-symlink: Don't assume that the file owner username
8783         length is less than 9 in ls output: instead, omit that field
8784         altogether.  Reported by, and suggested fix from, Ferdinand.
8785
8786         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8787         * tests/du/Makefile.am (TESTS): Add restore-wd.
8788
8789         * src/rm.c: Correct now-invalid comment about cycle-detection.
8790
8791 2003-02-06  Jim Meyering  <jim@meyering.net>
8792
8793         * NEWS: Add entries from old/*/NEWS
8794         from fileutils-4.1 through 4.1.11 and
8795         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
8796
8797         * Version 4.5.6.
8798
8799         * src/du.c (process_file): Don't return early for excluded files
8800         or for files whose dev/inode we've already seen.
8801
8802 2003-02-05  Jim Meyering  <jim@meyering.net>
8803
8804         * tests/du/exclude: New file.
8805         * tests/du/Makefile.am (TESTS): Add exclude.
8806
8807 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
8808
8809         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8810         Fix memory allocation arithmetic.
8811
8812 2003-02-04  Jim Meyering  <jim@meyering.net>
8813
8814         `df /dev/block-or-char-device-file--not-mounted' now reports
8815         the name of the file system on which the file resides, usually `/'.
8816         Before, it would leave the `Mounted on' field blank.
8817         * src/df.c (show_disk): Move function to precede find_mount_point.
8818         (show_disk): Add parameter: STATP.
8819         If we don't find a matching device name, then resort to calling
8820         find_mount_point.  Reported by Bob Proulx.
8821
8822 2003-02-03  Andreas Schwab  <schwab@suse.de>
8823
8824         * tests/rm/cycle: Require non-root.
8825         * tests/rm/isatty: Likewise.
8826
8827 2003-02-02  Jim Meyering  <jim@meyering.net>
8828
8829         * Version 4.5.5.
8830
8831         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8832
8833         Ensure that there are no offending uses of `:'.
8834         * Makefile.maint (makefile_path_separator_check): New rule.
8835         (local-check): Add it to the list.
8836
8837 2003-02-01  Jim Meyering  <jim@meyering.net>
8838
8839         * src/du.c (MAX_N_DESCRIPTORS): Define.
8840
8841         * src/stat.c (G_fail): New global.
8842         (human_time): Diagnose failed localtime, not failed nstrftime.
8843         (main): Fail if G_fail is set.
8844
8845 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8846
8847         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8848         hard-coding the path-separator.  Also double-quote the new PATH,
8849         to avoid problems when the path-separator is a semi-colon or when
8850         `pwd` contains e.g. a space.
8851         * tests/chgrp/Makefile.am: Likewise.
8852         * tests/chmod/Makefile.am: Likewise.
8853         * tests/chown/Makefile.am: Likewise.
8854         * tests/cp/Makefile.am: Likewise.
8855         * tests/dd/Makefile.am: Likewise.
8856         * tests/dircolors/Makefile.am: Likewise.
8857         * tests/du/Makefile.am: Likewise.
8858         * tests/expr/Makefile.am: Likewise.
8859         * tests/factor/Makefile.am: Likewise.
8860         * tests/fmt/Makefile.am: Likewise.
8861         * tests/install/Makefile.am: Likewise.
8862         * tests/ln/Makefile.am: Likewise.
8863         * tests/ls/Makefile.am: Likewise.
8864         * tests/ls-2/Makefile.am: Likewise.
8865         * tests/md5sum/Makefile.am: Likewise.
8866         * tests/misc/Makefile.am: Likewise.
8867         * tests/mkdir/Makefile.am: Likewise.
8868         * tests/mv/Makefile.am: Likewise.
8869         * tests/od/Makefile.am: Likewise.
8870         * tests/rm/Makefile.am: Likewise.
8871         * tests/rmdir/Makefile.am: Likewise.
8872         * tests/seq/Makefile.am: Likewise.
8873         * tests/sha1sum/Makefile.am: Likewise.
8874         * tests/shred/Makefile.am: Likewise.
8875         * tests/stty/Makefile.am: Likewise.
8876         * tests/sum/Makefile.am: Likewise.
8877         * tests/tail-2/Makefile.am: Likewise.
8878         * tests/touch/Makefile.am: Likewise.
8879         * tests/tsort/Makefile.am: Likewise.
8880         * tests/unexpand/Makefile.am: Likewise.
8881
8882 2003-01-31  Jim Meyering  <jim@meyering.net>
8883
8884         * src/stat.c: Include "file-type.h"
8885         (print_human_type): Remove function.
8886         (human_access): Rename from print_human_access.  Return a string.
8887         (human_time): Rename from print_human_time.  Return a string.
8888         (print_stat): Arrange so that field width and an alignment specifier
8889         are honored for the %A, %F, %x, %y, and %z formats.
8890         [%F]: Use file_type; this gives slightly different file type strings,
8891         e.g., `directory' instead of `Directory' and `regular file' or
8892         `regular empty file' instead of `Regular file'.
8893         Prompted by a report from Richard Dawe that the uses of
8894         S_IFSOCK and S_IFIFO in print_human_time were not portable
8895         to systems using e.g., DJGPP.
8896
8897 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
8898
8899         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8900         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
8901
8902 2003-01-31  Jim Meyering  <jim@meyering.net>
8903
8904         * src/du.c (main): Upon processing an invalid option or an invalid
8905         --exclude-from or --max-depth option argument, don't exit right away,
8906         in case there are others.  Rather record the failure and exit after
8907         processing other options.
8908
8909         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8910         tar archive easier to reproduce.
8911
8912         Rewrite to perform directory traversal using nftw.
8913
8914         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8915         (AUTHORS): Add self.
8916         (opt_one_file_system): Move global into `main'.
8917         (path, xstat, exit_status): Remove declarations.
8918         (arg_length, suffix_length): New globals.
8919         (G_fail): New global, sort of like the old `exit_status'.
8920         (IS_FTW_DIR_TYPE): Define.
8921         (print_only_size): New function.
8922         (process_file): New function.
8923         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8924         (str_trunc, pop_dir, count_entry): Likewise.
8925         (du_files): Rewrite to use nftw.
8926
8927 2003-01-30  Jim Meyering  <jim@meyering.net>
8928
8929         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8930         symlink-to-directory with -L, even without the trailing slash.
8931
8932 2003-01-27  Jim Meyering  <jim@meyering.net>
8933
8934         * src/Makefile.am (check-misc): Check for st_blocks, too.
8935
8936         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8937         Reported by Richard Dawe.
8938
8939 2003-01-27  Andreas Schwab  <schwab@suse.de>
8940
8941         * src/ls.c (quote_name): Add fourth parameter, width, into which to
8942         store the screen columns, and return the number of bytes instead.
8943         (print_dir): Pass NULL as fourth parameter of quote_name.
8944         (print_name_with_quoting): Likewise.
8945         (length_of_file_name_and_frills): Get the width from the fourth
8946         parameter of quote_name instead of return value.
8947
8948 2003-01-27  Jim Meyering  <jim@meyering.net>
8949
8950         * src/ls.c (decode_switches): If `dired' is set without
8951         `format == long_format', then silently reset dired.  This doesn't
8952         change the behavior of ls (all prior uses of dired were protected
8953         by `&& format == long_format'), and lets us...
8954         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8955         (PUSH_CURRENT_DIRED_POS): Likewise.
8956         (main): Likewise.
8957
8958 2003-01-22  Jim Meyering  <jim@meyering.net>
8959
8960         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8961         * tests/du/Makefile.am (TESTS): Add no-x.
8962
8963 2003-01-21  Jim Meyering  <jim@meyering.net>
8964
8965         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8966         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8967         it may still be a directory -- or not (e.g., with FreeBSD on an
8968         NFS-mounted file system), so resort to calling lstat to find out.
8969         Based on a patch by Michael van Elst.
8970
8971         * tests/cp/same-file: Don't assume that the file owner username
8972         length is less than 9 in ls output: instead, omit that field
8973         altogether.  Reported by, and suggested fix from, Ferdinand.
8974
8975 2003-01-20  Jim Meyering  <jim@meyering.net>
8976
8977         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8978         large format widths no longer cause strftime to infloop.
8979
8980         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8981
8982 2003-01-19  Jim Meyering  <jim@meyering.net>
8983
8984         * src/readlink.c: Include "canonicalize.h".
8985
8986 2003-01-18  Jim Meyering  <jim@meyering.net>
8987
8988         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8989         New member.
8990         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8991         (long_options): Add option --dereference-command-line-symlink-to-dir.
8992         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8993         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8994         -d, -F, -l options is specified.
8995         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8996         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8997         Change --dereference-command-line (-H) to dereference *all*
8998         command line arguments, including broken symlinks.
8999
9000 2003-01-15  Paul Eggert  <eggert@twinsun.com>
9001
9002         Change ls -H back to the way it was yesterday, since this is
9003         compatible with FreeBSD and the POSIX spec is confusing
9004         and somewhat contradictory.
9005
9006         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
9007         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
9008         (long_options): Change the long option name back.
9009         (usage): Change the usage back.
9010         (gobble_file): When -H is specified, dereference a top-level
9011         arg even if it points to a non-directory.
9012
9013 2003-01-15  Jim Meyering  <jim@meyering.net>
9014
9015         * src/ls.c (gobble_file): Fall back on using lstat when required:
9016         when --dereference (-L) is not specified, and
9017         - when operating on a dangling symlink
9018         - when operating on command-line-symlink-to-directories
9019         This fixes numerous problems.  Here are examples:
9020         - `ls dangling-symlink' would fail with `no such file...'
9021         Now it prints `dangling-symlink'.
9022         - `ls -i symlink' would mistakenly print the inode of the referent.
9023         Now it prints the inode of the symlink.  Likewise for --size (-s).
9024         Based on a patch from Michael Stone.
9025         Reported by Deepak Goel as Debian bug #173793.
9026
9027         Rename ls's --dereference-command-line (-H)
9028         option to   --dereference-command-line-symlink-to-dir.
9029         * src/ls.c [enum Dereference_symlink]
9030         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
9031         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
9032         (long_options): Rename the long option.
9033         (usage): Say that --dereference-... changes how ls treats
9034         only symlinks to directories specified on the command line.
9035
9036 2003-01-14  Jim Meyering  <jim@meyering.net>
9037
9038         * tests/ls/dangle: New file/test, for the above fix.
9039         * tests/ls/inode: Another new file/test, for the above fix.
9040         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
9041
9042         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
9043         so that ls --color would no longer highlight the names of files with
9044         the execute bit set when not specified on the command line.
9045         Patch by Michael Stone.  Reported by Stephen Depooter as
9046         Debian bug 175135.
9047
9048         * tests/ls-2/tests (color-exe): New test, for the above fix.
9049
9050 2003-01-13  Jim Meyering  <jim@meyering.net>
9051
9052         * tests/shred/exact: Also test for just fixed bug with --zero.
9053
9054         * src/shred.c (long_opts): --zero does not require an argument.
9055         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
9056
9057 2003-01-12  Jim Meyering  <jim@meyering.net>
9058
9059         * Makefile.maint (cvs-update): Skip any file with local modifications.
9060
9061         * src/unexpand.c (usage): Document --first-only and mention that
9062         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
9063
9064 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
9065
9066         * src/df.c: Include "canonicalize.h".
9067         Use canonicalize_file_name unconditionally.
9068
9069 2003-01-09  Jim Meyering  <jim@meyering.net>
9070
9071         * README: Add readlink.
9072
9073 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9074
9075         * src/df.c: Include "xgetcwd.h".
9076         * src/pwd.c: Likewise.
9077
9078 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9079
9080         * src/shred.c: Remove declaration of xstrdup.
9081         We already get it via xalloc.h which is included via system.h.
9082
9083 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
9084
9085         New program: readlink.
9086
9087         * src/Makefile.am (bin_PROGRAMS): Add readlink.
9088         * src/readlink.c: New file.
9089
9090         * man/readlink.x: New file.
9091         * man/Makefile.am (dist_man_MANS): Add readlink.1.
9092         (readlink.1): New rule.
9093
9094 2003-01-09  Jim Meyering  <jim@meyering.net>
9095
9096         When selecting ranges of byte offsets (as opposed to ranges of fields)
9097         and when --output-delimiter=STRING is specified, output STRING between
9098         ranges of selected bytes.
9099         * src/cut.c (RANGE_START_SENTINEL): Define.
9100         (output_delimiter_specified): New global.
9101         (print_kth): Add parameter.  Adjust all callers.
9102         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
9103         (cut_bytes): When requested, output STRING between ranges of
9104         selected bytes.
9105         (main): Make a diagnostic a little clearer.
9106         Based on a patch from Jan Nieuwenhuizen.
9107
9108         * tests/cut/Test.pm: New tests for the above.
9109
9110         * src/cut.c (set_fields): Make code agree with comment:
9111         Don't merge abutting ranges like 4- and 2-3.  This makes no
9112         difference currently, but is required to support an upcoming change.
9113
9114 2003-01-07  Jim Meyering  <jim@meyering.net>
9115
9116         * src/cut.c (set_fields): Fix typo in comment.
9117
9118         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
9119         * tests/touch/Makefile.am (TESTS): Add not-owner.
9120         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
9121         Now, this tests only the nonexistent-directory diagnostic.
9122         Suggestion from Michael Stone.
9123
9124         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
9125
9126 2003-01-04  Jim Meyering  <jim@meyering.net>
9127
9128         * src/copy.h: Remove use of PARAMS.
9129         * src/remove.h: Likewise.
9130         * src/chown-core.h: Likewise.
9131
9132         rm could be tricked into mistakenly reporting a cycle.
9133         * src/remove.c: [cycle_check_state]: New global.
9134         (remove_cwd_entries): Adapt to new semantics of cycle_check.
9135         (rm): Call cycle_check_init and cycle_check_free for each file.
9136         * tests/rm/cycle (rm): New test, for the above fix.
9137         * tests/rm/Makefile.am (TESTS): Add cycle.
9138
9139         When rm detects a cycle, don't abort the entire command,
9140         but rather just the affected command line argument.
9141         * src/remove.c: Include <setjmp.h>
9142         (struct dirstack_state) [current_arg_jumpbuf]: New member.
9143         (remove_cwd_entries): Call longjmp if we detect a cycle.
9144         (rm): Call setjmp here.
9145
9146         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
9147         Instead, include cycle-check.h and use it.
9148
9149         * src/remove.h (struct dev_ino): Remove declaration.
9150
9151         * src/remove.c (remove_cwd_entries): Fix typos in comment.
9152
9153         Don't include trailing /. in diagnostics about directories.
9154         * src/remove.c (full_filename_): When FILENAME is just `.'
9155         and there is a nonempty directory-name part, don't append `/.'.
9156         * tests/rm/unread2: Remove trailing /. from diagnostic.
9157         * tests/rm/rm2: Likewise.
9158
9159         * src/remove.c (struct dirstack_state): Define.
9160         To be used in place of these file-scoped globals ...
9161         (dir_stack, len_stack, Active_dir): Remove globals.
9162         (ds_init, ds_free): New functions.
9163         (full_filename): Define.
9164         (full_filename_): Rename from full_filename.
9165
9166         Begin to make AD_* functions more generic.
9167         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9168         (AD_push): Likewise.
9169         (AD_INIT_OTHER_MEMBERS): Define.
9170         (remove_dir): Define the `status' member manually after each
9171         call to AD_push or AD_push_initial.
9172
9173         * src/Makefile.am (check-misc): New rule, to ensure that no more
9174         S_IS* macro definitions sneak into the code.
9175         (check): Depend on check-misc.
9176
9177         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
9178         * src/du.c (count_entry) [S_ISLNK]: Don't define.
9179         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
9180
9181 2003-01-03  Jim Meyering  <jim@meyering.net>
9182
9183         * src/true.c: Add copyright.
9184         (AUTHORS): I suppose I've written it.
9185
9186         * src/Makefile.am (false.c): Make the generated file be read-only.
9187
9188 2003-01-04  Jim Meyering  <jim@meyering.net>
9189
9190         * src/ls.c: Include "dev-ino.h".
9191         [struct dev_ino]: Remove declaration.
9192
9193 2003-01-02  Jim Meyering  <jim@meyering.net>
9194
9195         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
9196         from mv: s/missing file arguments/missing file argument/.
9197         With --target-directory=DIR, cp and mv work with a single file argument.
9198         Reported by Karl Berry.
9199
9200         * tests/rm/isatty: Enable this test.
9201
9202 2002-12-31  Jim Meyering  <jim@meyering.net>
9203
9204         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9205         (AD_push): Likewise.
9206         (AD_INIT_OTHER_MEMBERS): Define.
9207         (remove_dir): Define the `status' member manually after each
9208         call to AD_push or AD_push_initial.
9209
9210         * src/ls.c [struct dev_ino]: Remove definition.
9211         Include "dev-ino.h" instead.
9212
9213 2002-12-28  Jim Meyering  <jim@meyering.net>
9214
9215         * tests/du/Makefile.am (TESTS): Add no-deref.
9216         * tests/du/no-deref: New script.
9217
9218 2002-12-23  Jim Meyering  <jim@meyering.net>
9219
9220         * src/remove.c (remove_cwd_entries): Fix typo in comment.
9221
9222 2002-12-21  Jim Meyering  <jim@meyering.net>
9223
9224         * announce-gen: Generate MML-formatted announcement.
9225         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
9226
9227 2002-12-20  Jim Meyering  <jim@meyering.net>
9228
9229         * src/touch.c (touch): Change the wording of a diagnostic so
9230         that it makes sense both when the file exists and when it doesn't.
9231         Suggestion from Michael Stone.
9232
9233 2002-12-18  Jim Meyering  <jim@meyering.net>
9234
9235         * src/stty.c (valid_options): Declare to be static.
9236
9237 2002-12-15  Jim Meyering  <jim@meyering.net>
9238
9239         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9240
9241         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9242         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9243         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9244         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9245         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9246
9247         * src/remove.c (PARAMS): Remove definition.
9248         * src/sys2.h: Likewise.
9249
9250         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9251         Include strftime.h instead.
9252
9253 2002-12-14  Jim Meyering  <jim@meyering.net>
9254
9255         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9256
9257         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9258         This is necessary at least for Irix6.5 when using c89.
9259         Reported by Nelson Beebe.
9260
9261         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9262
9263         * tests/misc/cat-tty-eof: New test.
9264
9265         * src/mknod.c (usage): Specify how major and minor mode numbers
9266         are interpreted.  Report forwarded by Kristin E Thomas.
9267         * src/mknod.c: Remove now-redundant usage-specifying comment.
9268
9269 2002-12-13  Jim Meyering  <jim@meyering.net>
9270
9271         * Version 4.5.4.
9272
9273         * tests/du/trailing-slash: Allow for a directory of size `0'.
9274         That happens at least on file systems of type tmpfs on linux-2.4.18.
9275
9276         * announce-gen: New script to begin replacing the commands
9277         associated with the rule here...
9278         * Makefile.maint (announcement): Invoke announce-gen.
9279         * Makefile.am (EXTRA_DIST): Add announce-gen.
9280
9281         * tests/cp/preserve-2: New file/test, for latest fix.
9282         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9283
9284 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9285
9286         Fix a bug whereby cp would fail to parse an option like
9287         --preserve=mode,ownership.
9288         * src/cp.c (decode_preserve_arg): Advance `comma' to
9289         point the character following the comma.
9290
9291 2002-12-11  Jim Meyering  <jim@meyering.net>
9292
9293         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9294         in case it's already defined.
9295
9296 2002-12-09  Jim Meyering  <jim@meyering.net>
9297
9298         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9299         Instead, evoke a framework failure if /no-$$ exists.
9300         Reported by Michael Stone.
9301
9302 2002-12-08  Jim Meyering  <jim@meyering.net>
9303
9304         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9305         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9306         du honors (per POSIX) the trailing slash on an argument referring
9307         to a symlink-to-directory.
9308
9309 2002-12-06  Jim Meyering  <jim@meyering.net>
9310
9311         * Use autoconf-2.57.  Regenerate dependent files.
9312         * Use automake-1.7.2.  Regenerate dependent files.
9313
9314         * src/ls.c (gobble_file): Also stat the file if it's a
9315         regular file and --indicator-style=classify (aka -F).
9316         Thanks to Ed Santiago for opening my eyes.
9317
9318         * tests/ls/file-type: New file.  Test for the above.
9319         A test to contrast ls -F and ls --indicator-style=file-type.
9320         * tests/ls/Makefile.am (TESTS): Add file-type.
9321
9322 2002-12-04  Jim Meyering  <jim@meyering.net>
9323
9324         * tests/ls/follow-slink: Make sure the symlink was created.
9325         Richard Dawe reported that `ln -s link link' succeeds, but creates
9326         no file on systems running some version of the DJGPP libc.
9327
9328 2002-12-03  Jim Meyering  <jim@meyering.net>
9329
9330         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9331         since this package no longer panders to K&R compilers.
9332
9333 2002-12-02  Jim Meyering  <jim@meyering.net>
9334
9335         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9336
9337         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9338         something to replace.
9339
9340 2002-12-01  Jim Meyering  <jim@meyering.net>
9341
9342         * src/stat.c: Don't include <string.h> or <ctype.h>.
9343         That's already done via system.h.
9344         * src/dircolors.c: Don't include <ctype.h>.
9345
9346 2002-11-30  Jim Meyering  <jim@meyering.net>
9347
9348         * ls.c (gobble_file): Remove the block of code that caused
9349         `ls --color -F symlink-to-dir' to list the files in
9350         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9351         like `ls -F symlink-to-dir') but with the addition of highlighting.
9352         Similarly, `ls --color -dF symlink-to-dir' would print
9353         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9354         Reported by Jeff Sheinberg as Debian bug #168203.
9355         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9356
9357         ls is now more efficient: with certain options, it no longer needs
9358         to stat each directory entry on systems with valid dirent.d_type.
9359         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9360         (main): Make --recursive set format_needs_type, not format_needs_stat.
9361         (gobble_file): Remove a FIXME comment, now that it's fixed.
9362
9363 2002-11-24  Jim Meyering  <jim@meyering.net>
9364
9365         * src/du.c (du_files): Don't strip any trailing slash.
9366         Rewrite so that `/' is no longer represented internally as
9367         the empty string.
9368         (count_entry): When appending a file name component,
9369         account for the fact that the current path may end in `/'.
9370         François Pinard reported that `du symlink-to-dir/' was not
9371         equivalent to `du symlink-to-dir/.'.  Now it is.
9372         * tests/du/trailing-slash: New file/test, for the above fix.
9373         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9374
9375 2002-11-23  Jim Meyering  <jim@meyering.net>
9376
9377         * src/tac.c (output): Declare some local variables to be of type size_t,
9378         rather than `int' to avoid warnings from gcc.
9379
9380 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9381
9382         * src/ls.c (decode_switches): Use case-sensitive matching to
9383         decode the QUOTING_STYLE environment variable.  This is more
9384         consistent with the documentation, and with --quoting-style.
9385
9386 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9387
9388         * src/stty.c (struct speeds): Add support for all baud rates defined
9389         in linux-2.4.19.
9390
9391 2002-11-19  Jim Meyering  <jim@meyering.net>
9392
9393         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9394         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9395         * tests/fmt/basic: Likewise.
9396
9397 2002-11-17  Jim Meyering  <jim@meyering.net>
9398
9399         * configure.ac: Update via autoupdate.
9400         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9401
9402         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9403         Reported by Hans Ginzel.
9404
9405 2002-11-15  Jim Meyering  <jim@meyering.net>
9406
9407         * Makefile.cfg (gnu_rel_host): Define.
9408         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9409         on whether $(VERSION) looks like a major release number.
9410
9411         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9412         (release): Rename from `alpha'.
9413         (alpha): Depend on release.
9414
9415         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9416
9417 2002-11-14  Jim Meyering  <jim@meyering.net>
9418
9419         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9420         (announcement): Use the new variable.
9421
9422         * Makefile.maint: Sync with Bison, i.e.:
9423         (po-check): Scan .l and .y files instead of the
9424         .c and the .h files that they generate.  This fixes the bug
9425         reported by Tim Van Holder in:
9426         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9427         Look for N_ as well as for _.  Try to avoid matching #define for
9428         N_ and _.
9429         From Paul Eggert.
9430
9431 2002-11-12  Jim Meyering  <jim@meyering.net>
9432
9433         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9434         Replace sole use with equivalent `#ifdef S_ISLNK'.
9435         Inconsistency reported by Dmitry V. Levin.
9436
9437 2002-11-11  Jim Meyering  <jim@meyering.net>
9438
9439         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9440         so that help2man produces properly formatted man pages.
9441         Reported by Herbert Xu as Debian bug #168400.
9442
9443 2002-11-10  Jim Meyering  <jim@meyering.net>
9444
9445         * src/ls.c (sighandler): Handle SIGTSTP specially.
9446         Based on suggestions from Solar Designer and Dmitry V. Levin.
9447         Add comments.
9448
9449         * Makefile.cfg (cvs_files): Define.  From autoconf.
9450         (local_updates): Likewise.
9451
9452         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9453         Remove functions.
9454         (sighandler): New function, based on the one in sort.c.
9455         (main): Use sigaction, if possible; otherwise signal.
9456         Handle these signals:
9457         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9458         Don't register our handler if the signal is already being ignored.
9459
9460         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9461         * src/csplit.c (interrupt_handler): Likewise.
9462         * src/sort.c (sighandler): Likewise.
9463         (main): Declare `i' and `nsigs' to be unsigned, not int.
9464
9465 2002-11-09  Jim Meyering  <jim@meyering.net>
9466
9467         ls --color: restore terminal text color upon signal.
9468         * src/ls.c: Include "full-write.h" and <signal.h>.
9469         (restore_default_color, restore_default_color_handler): New functions.
9470         (sigtstp_handler, put_indicator_direct): New functions.
9471         (main) [print_with_color]: Register signal handlers.
9472         Patch mostly by Solar Designer and Stanislav Ievlev.
9473
9474         Update from autoconf.
9475         * Makefile.maint (AMTAR): Remove definition.
9476         (update, cvs-update, po-update, do-po-update): New rules.
9477         (wget-update): Update (thus renaming to cvs-update).
9478         (automake_repo): Use anoncvs@sources.redhat.com.
9479
9480 2002-11-06  Jim Meyering  <jim@meyering.net>
9481
9482         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9483
9484         * tests/misc/printf: Be careful to test the code in this package,
9485         not the shell built-in function.
9486
9487         * src/printf.c (print_esc): A hexadecimal escape sequence has
9488         at most two hex. digits, not three.  Reported by Padraig Brady.
9489         (usage): Update description.
9490         * tests/misc/printf-hex: New file/test, for the above fix.
9491
9492 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9493
9494         Add support for locale-specific size indications (e.g.,
9495         thousands-separators) and for explicit size suffixes on output.
9496
9497         * doc/coreutils.texi (Block size): Say that:
9498         This affects display format as well as block size.
9499         Fractional block counts are rounded up.
9500         ls file size blocksize defaults to 1.
9501         A block size spec preceded by ' generates thousands separators.
9502         A suffix without a preceding integer generates suffixes.
9503         (tail invocation): 32k -> 32 KiB.
9504         (What information is listed): ls -h is now equivalent to
9505         ls --block-size=human, and ls -H is now equivalent to
9506         ls --block-size=si.  Displayed file size is now always affected by
9507         --block-size.
9508
9509         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9510         lib/umaxtostr.c: New files, taken from GNU tar.
9511
9512         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9513         umaxtostr.c.
9514         (EXTRA_DIST): Add inttostr.c.
9515
9516         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9517         notations like thousands separators.
9518         Specify what includer of include.h must include beforehand.
9519         (human_group_digits, human_suppress_point_zero, human_autoscale,
9520         human_base_1024, human_SI, human_B): New enum values.
9521         (human_readable): Rename from human_readable_inexact; put the
9522         options before the sizes.  All uses changed.  The old human_readable
9523         function has been removed; use inttostr.h instead.
9524         (human_options): Renamed from human_block_size, with new signature
9525         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9526
9527         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9528         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9529         freestanding C89.  No need to check for stdlib.h or string.h since
9530         autoconf does this now.
9531
9532         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9533         human.h, to print large numbers simply.
9534         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9535         * src/dd.c (print_stats, main): Likewise.
9536         * src/df.c (print_header): Likewise.
9537         * src/factor.c (print_factors): Likewise.
9538         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9539         * src/shred.c (dopass): Likewise.
9540         * src/sort.c (checkfp): Likewise.
9541         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9542         * src/tail.c (xlseek): Likewise.
9543         * src/wc.c (write_counts, wc): Likewise.
9544
9545         * src/df.c (human_output_opts): New var.
9546         (output_block_size): Now uintmax_t, not int, to handle larger
9547         block sizes.  All uses changed.
9548         * src/du.c: Likewise.
9549         * src/ls.c: Likewise.
9550
9551         * src/df.c (print_header): In the header line, prefer SI to human
9552         representation if it's shorter; if neither is shorter, try to
9553         intuit what the user would prefer.
9554
9555         * src/expr.c (inttostr): Remove; use new imaxtostr library
9556         function instead.
9557
9558         * src/ls.c (file_output_block_size): New var, to distinguish
9559         file sizes from other sizes.
9560         (decode_switches): Set it.
9561
9562         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9563         (dopass): When printing progress, use floor for what has been done
9564         so far (since we should be conservative there), and ceiling for
9565         what needs to be done (since that's what other programs use).
9566
9567 2002-10-19  Jim Meyering  <jim@meyering.net>
9568
9569         * src/pinky.c (print_heading): Align TTY and Name headings.
9570         Reported by Karl Eichwalder.
9571
9572 2002-10-18  Jim Meyering  <jim@meyering.net>
9573
9574         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9575         Remove now-useless cast.
9576         (stdread): Remove function.
9577         (bytes_split): Use size_t instead of int.
9578         Use safe_read, not stdread.
9579         (lines_split): Likewise.
9580         Use memchr rather than a `while' loop.
9581         (line_bytes_split): Use size_t instead of int.
9582         Use safe_read, not stdread.
9583         (main): Add some FIXME comments to remind me to remove casts.
9584
9585         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9586         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9587
9588 2002-10-17  Jim Meyering  <jim@meyering.net>
9589
9590         Fix a problem that could make e.g., `cat' misbehave on systems which
9591         give invalid (unreasonably large) values for stat.st_blksize.
9592         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9593         Reported by Petter Reinholdtsen.
9594
9595 2002-10-14  Jim Meyering  <jim@meyering.net>
9596
9597         Specifying a printf conversion specifer as nl's separator string
9598         could cause nl to segfault.
9599         * src/nl.c (build_print_fmt): Don't include separator string
9600         in the printf format; it might contain `%'.
9601         Use a better bound on the length of the print_fmt buffer.
9602         (print_lineno): Print the separator here instead.
9603         Reported by Doug Coleman.
9604
9605         * tests/misc/nl: New file/tests, including a test for the above.
9606         * tests/misc/Makefile.am (TESTS): Add nl.
9607
9608         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9609         * tests/misc/Makefile.am (TESTS): Add split-l.
9610
9611 2002-10-13  Jim Meyering  <jim@meyering.net>
9612
9613         * Version 4.5.3.
9614
9615         * src/du.c (usage): Tweak description of --dereference-args/-D.
9616
9617         * src/du.c (count_entry): Also save cwd when dereferencing (via
9618         --dereference-args, -D) a command-line argument.
9619         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9620
9621         * src/Makefile.am (../AUTHORS): New target/rule.
9622
9623 2002-10-12  Jim Meyering  <jim@meyering.net>
9624
9625         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9626         of type size_t, since that's the way it's used and avoids a warning.
9627
9628         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9629         since that's how it's always used and avoids a new warning from gcc.
9630         (read_input): Adapt to new safe_read ABI.
9631
9632         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9633         to avoid warnings.
9634
9635         * src/pinky.c (print_long_entry): fread returns size_t.
9636         Declare local `bytes' accordingly, to avoid warning.
9637
9638         tail -c +N would perform an extra read after encountering EOF
9639         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9640         * src/tail.c (start_bytes): Detect EOF, inform caller.
9641         (tail_bytes): Upon EOF in start_bytes, return immediately.
9642         (file_lines): Reorganize to use memrchr rather than an explicit loop.
9643         Adapt to new safe_read ABI.
9644
9645 2002-10-11  Jim Meyering  <jim@meyering.net>
9646
9647         * tests/du/deref: New file/test, for the above fix.
9648         * tests/du/Makefile.am (TESTS): Add deref.
9649
9650 2002-10-10  Jim Meyering  <jim@meyering.net>
9651
9652         * tests/ln/Makefile.am (TESTS): Add target-1.
9653         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9654
9655 2002-10-09  Jim Meyering  <jim@meyering.net>
9656
9657         * tests/cp/backup-is-src: Ensure that certain environment variables
9658         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
9659
9660         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9661         consume 4GB of disk space on systems without support for sparse files.
9662         Fix a logic error that'd make it `cat err' even though dd didn't fail.
9663
9664         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9665         Patch by steven@magelico.net, forwarded by Michael Stone.
9666
9667         * tests/ls/dired: Ensure that ls produces English messages.
9668         Patch by Alexey Vyskubov, forwarded by Michael Stone.
9669
9670 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
9671
9672         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9673
9674 2002-10-08  Jim Meyering  <jim@meyering.net>
9675
9676         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9677         Fix syntax in test: use =, not ==.
9678         Reported by Bob Proulx.
9679         Change all the rest like this: grep -lR "testing framework'" .\
9680         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9681
9682         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9683         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9684         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9685         * src/wc.c (wc): Likewise.
9686
9687 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9688
9689         * src/cat.c (cat):
9690         Don't advance the write pointer past the end of the write buffer.
9691         * src/sort.c (begfield, limfield): Likewise.
9692
9693 2002-10-07  Jim Meyering  <jim@meyering.net>
9694
9695         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9696         * src/head.c (head_bytes, head_lines): Likewise.
9697
9698 2002-10-06  Jim Meyering  <jim@meyering.net>
9699
9700         * src/dd.c (scanargs): Ensure that specified block sizes (specified
9701         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9702         (skip, dd_copy): Adapt to new safe_read ABI.
9703
9704         * Makefile.maint (signatures): Define.
9705         (%.sig): New rule.
9706         (announcement): Depend on $(signatures).
9707
9708         * Makefile.maint (announcement): Output all URLs for detached
9709         signatures, not just the last one from the previous loop.
9710
9711 2002-10-05  Jim Meyering  <jim@meyering.net>
9712
9713         * Version 4.5.2.
9714
9715         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9716         don't recurse into directory, DIR.  Prompted by a report from
9717         Leonardo Milano.
9718
9719         * tests/rm/i-no-r: New file/test, for the above fix.
9720         * tests/rm/Makefile.am (TESTS): Add i-no-r.
9721
9722         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9723         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9724
9725 2002-10-03  Jim Meyering  <jim@meyering.net>
9726
9727         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9728         * src/df.c (AUTHORS): Likewise.
9729         * src/du.c (AUTHORS): Likewise.
9730         * src/tail.c (AUTHORS): Likewise.
9731         * src/touch.c (AUTHORS): Likewise.
9732
9733 2002-10-02  Jim Meyering  <jim@meyering.net>
9734
9735         * Makefile.am (SUBDIRS): Remove `old'.
9736         (EXTRA_DIST): List the files in old/.
9737         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9738         Suggestion from Akim Demaille.
9739
9740 2002-10-01  Jim Meyering  <jim@meyering.net>
9741
9742         * src/sys2.h (SSIZE_MAX): Define.
9743
9744 2002-09-30  Jim Meyering  <jim@meyering.net>
9745
9746         * src/csplit.c: Don't include stdlib.h here.  It's already included
9747         via system.h.
9748
9749 2002-09-29  Jim Meyering  <jim@meyering.net>
9750
9751         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9752         expression to avoid bogus warning from gcc.
9753
9754         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9755         (cat): Declare insize and outsize to be of type size_t, not int.
9756         Rearrange pointer/integer expressions to avoid bogus warnings.
9757         (main): Declare insize and outsize to be of type size_t, not int.
9758
9759         * src/tail.c (parse_options): Give a sensible diagnostic for
9760         an invalid byte or line count.  Reported by Mikko Tuumanen.
9761
9762         * src/touch.c (main): Split a long line.
9763
9764         * tests/du/Makefile.am (TESTS): Add slink.
9765         * tests/du/slink: New test for system.h change of 2002-08-31.
9766
9767         In move mode, always first try to rename.  Before, upon failure to
9768         rename a directory, this code would never attempt to rename any
9769         other file in that directory, but would thenceforth always copy.
9770         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9771         may fail with EXDEV, yet renaming files within that directory to
9772         a newly-created destination directory succeeds.
9773         * src/copy.c (copy_internal): Remove local, move_mode;
9774         use x->move_mode instead.  Based on a patch from Tom Haynes.
9775
9776 2002-09-28  Jim Meyering  <jim@meyering.net>
9777
9778         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9779         Factor out some duplication.
9780         (main): Use it.
9781         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9782
9783         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9784         compiler warnings.
9785         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9786         to avoid compiler warnings.
9787
9788         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9789         compiler warnings.
9790
9791         Fix things so `mkdir -p' can create very deep directories, e.g.,
9792         mkdir -p $(perl -e 'print "a/" x 40000') now works.
9793         * src/mkdir.c (main): For --parents (-p), call make_path with the
9794         entire directory name, so we don't ever require that file operations
9795         like stat or chmod be performed on the entire command line argument.
9796         * makepath.c (make_path): Restore umask *before* creating the final
9797         component.
9798
9799 2002-09-27  Andreas Schwab  <schwab@suse.de>
9800
9801         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9802         to avoid overflow.  Reported by Hans Lermen.
9803
9804 2002-09-26  Jim Meyering  <jim@meyering.net>
9805
9806         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
9807
9808 2002-09-25  Jim Meyering  <jim@meyering.net>
9809
9810         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9811         and add a cast, to avoid a warning about `signed and unsigned type in
9812         conditional expression'.
9813
9814 2002-09-22  Jim Meyering  <jim@meyering.net>
9815
9816         * src/rmdir.c: Include "dirname.h", for declaration of
9817         strip_trailing_slashes.
9818
9819         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9820         Now they're defined through system.h.
9821
9822         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9823         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9824         since it's already included from sys2.h via system.h.
9825
9826         * Use automake-1.6f.  Regenerate dependent files.
9827
9828         * src/Makefile.am (PERL): Remove duplicate definition.
9829
9830         fmt's -s, -t, -c options didn't work properly for long lines.
9831         Since get_line may end up calling put_paragraph (for long lines),
9832         be sure to set global, `other_indent', before it is used there.
9833
9834         * src/fmt.c (set_other_indent): New function, factored out of...
9835         (get_paragraph): ... here.  Call it.
9836         (get_line): Call set_other_indent before calling flush_paragraph,
9837         which calls fmt_paragraph, which in turn calls put_paragraph,
9838         which uses other_indent.
9839
9840         * tests/fmt/Makefile.am (TESTS): Add long-line.
9841         * tests/fmt/long-line: New file/test, for the above fix.
9842
9843 2002-09-21  Jim Meyering  <jim@meyering.net>
9844
9845         * src/od.c: No longer include deprecated <values.h>.
9846         It was required solely for now-removed reference to BITSPERBYTE.
9847         * src/install.c: Likewise.
9848         Suggestion from Bruno Haible.
9849
9850 2002-09-06  Andreas Schwab  <schwab@suse.de>
9851
9852         `rmdir -p dir-specified-with-trailing-slash/' would fail.
9853         * src/rmdir.c (remove_parents): Strip trailing slashes.
9854
9855 2002-09-20  Jim Meyering  <jim@meyering.net>
9856
9857         * tests/rmdir/t-slash: New file/test, for the above fix.
9858         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9859
9860         * Makefile.maint (announcement): Arrange to gpg-sign the message.
9861         Add a URL for each detached signature file.
9862
9863 2002-09-07  Bruno Haible  <bruno@clisp.org>
9864
9865         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9866
9867 2002-09-18  Jim Meyering  <jim@meyering.net>
9868
9869         `od -t x8' used the wrong (`l'-prefixed) printf format.
9870         Likewise for the o8 and u8 formats.
9871         * src/od.c (ISPEC_TO_FORMAT): Define macro.
9872         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9873         Reported by Arun Sharma.
9874
9875 2002-09-17  Jim Meyering  <jim@meyering.net>
9876
9877         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9878         From gettext's intl/loadmsgcat.c.
9879
9880         * tests/od/x8: New file/test, for the above fix.
9881         * tests/od/Makefile.am (TESTS): Add x8.
9882
9883 2002-09-15  Jim Meyering  <jim@meyering.net>
9884
9885         * Use autoconf-2.54.  Regenerate dependent files.
9886
9887         * src/csplit.c (get_format_width): Add cast to avoid
9888         warning about `signed and unsigned type in conditional expression'.
9889
9890 2002-09-14  Jim Meyering  <jim@meyering.net>
9891
9892         * src/who.c (print_user): Change type of local to size_t
9893         to avoid warnings about `comparison between signed and unsigned'.
9894         * src/ptx.c (generate_all_output): Likewise.
9895
9896         * src/dd.c (main, skip): Add casts to avoid warnings about
9897         `comparison between signed and unsigned'.
9898
9899         * src/id.c (print_full_info, print_group_list): Add casts to avoid
9900         warnings about `signed and unsigned type in conditional expression'.
9901
9902         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9903         to avoid warnings about `comparison between signed and unsigned'.
9904         (split_3): Change parameter names to be readable and add comment.
9905         Clean up the test for whether a line may be ignored.
9906
9907 2002-09-13  Jim Meyering  <jim@meyering.net>
9908
9909         * src/printf.c (main): Handle leading command line argument of `--'.
9910         Reported by Raul: DervishD <raul@pleyades.net>
9911         * tests/misc/printf: New file: test for the above.
9912         * tests/misc/Makefile.am (TESTS): Add printf.
9913
9914         * src/date.c (usage): Explain that %S's range of [0..60] is required --
9915         rather than 0..59 -- to accommodate the occasional positive leap second.
9916         Reported by Richard Neill.
9917
9918 2002-09-12  Jim Meyering  <jim@meyering.net>
9919
9920         * src/Makefile.am (nanosec_libs): Define.
9921         (sleep_LDADD, tail_LDADD): Use it here.
9922
9923         Factor nanosleep-related code into ../lib/xnanosleep.c.
9924         * src/sleep.c: Include xnanosleep.h.
9925         Factor out fenv.h-related code.
9926         (timespec_subtract): Remove function.
9927         (main): Remove code that deals with computing start and stop times
9928         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
9929
9930         Allow S (in --sleep-interval=S) to be a floating point value.
9931         * src/tail.c: Include xnanosleep.h and xstrtod.h.
9932         Move declaration of global variable, sleep_interval, to ...
9933         (main): ...here.
9934         (usage): Update description of --sleep-interval option.
9935         (tail_forever): New parameter, sleep_interval.  Update caller.
9936         Use xnanosleep, rather than sleep.
9937         (parse_options): New parameter, sleep_interval.  Update caller.
9938         Use xstrtod, now that we accept floating point values.
9939         Prompted by a patch from Augey Mikus.
9940
9941 2002-09-06  Jim Meyering  <jim@meyering.net>
9942
9943         * src/remove.c (prompt): Change comment to give a better note to
9944         translators.  From Michael Piefel.
9945
9946 2002-09-02  Jim Meyering  <jim@meyering.net>
9947
9948         * README: A good problem report/patch includes diffs against
9949         the most recent test release.
9950
9951         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9952         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9953
9954         * src/kill.c (print_table_row): Use an unsigned type for widths
9955         to avoid warning about comparison between signed and unsigned.
9956         (list_signals): Likewise.
9957
9958         * src/od.c (skip): Add a cast to avoid warning about comparison
9959         between signed and unsigned.
9960         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
9961         comparisons to make them more readable.
9962
9963 2002-09-01  Jim Meyering  <jim@meyering.net>
9964
9965         * Version 4.5.1.
9966
9967 2002-08-31  Jim Meyering  <jim@meyering.net>
9968
9969         Symlinks were always reported as using 0 blocks.
9970         * src/system.h (ST_NBLOCKS): Don't depend on file type.
9971         This reverts the change of 2000-01-30.
9972         Based on a report and patch from Neil Brown via Michael Stone.
9973         This fixes Debian Bug#156358.
9974
9975         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9976         `exit (1)' to `exit (EXIT_FAILURE)', and
9977         `usage (1)' to `usage (EXIT_FAILURE)'.
9978
9979         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9980         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9981         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9982         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9983         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9984         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9985         error never exits successfully.
9986
9987 2002-08-29  Jim Meyering  <jim@meyering.net>
9988
9989         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9990         when ignoring any return value.
9991
9992         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9993         failures.  On some systems (at least EMC Celerra and Solaris5.8),
9994         this appears to be necessary.
9995         (is_empty_dir): Likewise.  Also, always close directory handle.
9996         * src/ls.c (print_dir): Likewise.
9997         (print_dir): Rename local variable: reading -> dirp.
9998         Reported by Mike Coleman.
9999
10000 2002-08-28  Jim Meyering  <jim@meyering.net>
10001
10002         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
10003         Give a diagnostic and fail if closedir fails.
10004
10005 2002-08-26  Jim Meyering  <jim@meyering.net>
10006
10007         * Makefile.am (THANKS-to-translators): New rule.
10008         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
10009         * THANKStt.in: New file.
10010
10011         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
10012         file-scoped global.
10013         (main): Register it with atexit.
10014         Close STDOUT_FILENO, to avoid a problem when writing to
10015         /dev/audio on at least Solaris 5.7 and 5.8 systems.
10016         Reported by Shing-Shong Shei.
10017
10018 2002-08-25  Jim Meyering  <jim@meyering.net>
10019
10020         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
10021         * src/tac.c (main): Likewise.
10022         * src/tail.c (main): Likewise.
10023         * src/tee.c (main): Likewise.
10024         * src/tr.c (main): Likewise.
10025         * src/wc.c (main): Likewise.
10026
10027 2002-08-20  Jim Meyering  <jim@meyering.net>
10028
10029         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
10030
10031 2002-08-10  Paul Eggert  <eggert@twinsun.com>
10032
10033         * src/nohup.sh: Don't use "exec --"; it's not portable and
10034         shouldn't be needed.
10035
10036 2002-08-09  Jim Meyering  <jim@meyering.net>
10037
10038         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
10039         (usage): Clarify help text for the -COLUMN option.
10040         Patch by Padraig Brady.
10041         * tests/pr/Test.pm [col-last]: New test for the above.
10042
10043         * configure.ac: Start with version 4.5.1, chosen so that it's larger
10044         than the latest version numbers of the component packages.
10045
10046         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
10047         programs in ../src.
10048
10049 2002-08-08  Jim Meyering  <jim@meyering.net>
10050
10051         * src/date.c: Guard inclusion of <langinfo.h> with
10052         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
10053         * src/sort.c: Likewise.
10054         Patch by GOTO Masanori.
10055
10056 2002-08-05  Paul Eggert  <eggert@twinsun.com>
10057
10058         Fix some minor time-related bugs with POSIX time arguments.
10059         Some valid time stamps were being rejected (notably -1, and
10060         time stamps before 1900 on 64-bit hosts).  And some invalid
10061         time stamps were being accepted, e.g. September 31.
10062
10063         * src/date.c (main): Adjust to posixtime signature change.
10064         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
10065         Use localtime, not posixtm, to warn about obsolete "touch".
10066
10067 2002-08-05  Jim Meyering  <jim@meyering.net>
10068
10069         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
10070
10071 2002-08-04  Jim Meyering  <jim@meyering.net>
10072
10073         * src/Makefile.am (check-README): New target/rule.
10074         (check): Depend on it.
10075
10076         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
10077
10078 2002-08-03  Jim Meyering  <jim@meyering.net>
10079
10080         * Makefile.am (SUBDIRS): Add old.
10081         * old/: New directory, containing legacy ChangeLog* and NEWS files
10082         from the fileutils, sh-utils, and textutils packages.
10083
10084         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
10085
10086 2002-08-02  Paul Eggert  <eggert@twinsun.com>
10087
10088         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
10089
10090         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
10091         (hard_LC_COLLATE): New var.
10092         (different): Args are now char *, not const char *.
10093         Use xmemcoll instead of memcmp to compare lines, so that
10094         LC_COLLATE has effect.  However, use memcmp if it is an
10095         easy locale.
10096         (check_file): Do not include newline in comparison, so that
10097         xmemcoll has a byte to stomp on temporarily.
10098         (main): Set hard_LC_COLLATE.
10099
10100 2002-07-29  Jim Meyering  <jim@meyering.net>
10101
10102         * Makefile.am (SUBDIRS): Remove djgpp, for now.
10103
10104 2002-07-20  Jim Meyering  <jim@meyering.net>
10105
10106         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
10107         into EXIT_FAILURE.  Otherwise, false --help and false --version
10108         would fail.
10109
10110 2002-07-08  Jim Meyering  <jim@meyering.net>
10111
10112         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
10113         rather than the hard-coded `sh-utils'.
10114
10115 2002-07-01  Jim Meyering  <jim@meyering.net>
10116
10117         * configure.ac: Merge the three files from fileutils,
10118         textutils, and sh-utils.
10119         * Makefile.am: Likewise.
10120         * src/Makefile.am: Likewise.