947c887f07cc280a8d115483dbc19c0229d2ddaa
[platform/upstream/coreutils.git] / ChangeLog
1 2005-08-23  Jim Meyering  <jim@meyering.net>
2
3         * Version 5.3.1-cvs.
4         * configure.ac: Use `5.3.1-cvs' as the version string.
5         * NEWS: Adjust accordingly.
6
7         * src/od.c: Include <float.h> unconditionally.
8         * src/uptime.c (print_uptime): Remove unnecessary parens in
9         `#if defined (SYMBOL)' expressions.
10         * src/system.h: Likewise.
11         * src/hostname.c: Likewise.
12         * src/su.c: Likewise.
13         * src/test.c: Likewise.
14
15 2005-08-22  Jim Meyering  <jim@meyering.net>
16
17         * src/tail.c (xwrite_stdout): Rename from xwrite.  Remove always-
18         equal-to-STDOUT_FILENO parameter and associated assertion.
19         Adjust all callers.
20
21 2005-08-21  Jim Meyering  <jim@meyering.net>
22
23         * src/ln.c (do_link): If ln is invoked with --interactive (-i),
24         encounters an existing destination file, and gets an affirmative
25         response, then first try to unlink the destination file rather
26         than simply failing.  Suggestion from Karl Berry.
27         FIXME: add test for this
28
29         * src/ln.c (main): Declare `target_directory' with const attribute.
30         * src/du.c (time_style): Add `const' attribute.
31         (tot_dui): Remove unnecessary (and too-short) initializer list.
32
33 2005-08-19  Jim Meyering  <jim@meyering.net>
34
35         * src/sort.c (usage) [-b,-t]: Ensure that there are at least two
36         spaces between each option and the corresponding description -- this
37         lets help2man format entries properly.  Reported by Edward Welbourne.
38
39 2005-08-17  Jim Meyering  <jim@meyering.net>
40
41         * src/sort.c (usage): Fix typo s/POS 2/POS2/.
42         Reported by Edward Welbourne.
43
44         * tests/misc/date [neg-secs]: New test for today's strftime.c bug fix.
45         * tests/misc/date: Remove terminating "\n"s once again.
46         Automatically add them whenever EXIT != 0.
47
48 2005-08-16  Paul Eggert  <eggert@cs.ucla.edu>
49
50         * src/df.c (show_dev): New arg STAT_FILE.  All uses changed.
51         This sometimes gives better results on networked file systems
52         that do not respect POSIX semantics.  Problem reported by
53         Bruno Haible.
54
55 2005-08-15  Jim Meyering  <jim@meyering.net>
56
57         Don't print uninitialized data (or anything else) to stdout
58         upon localtime failure.
59         * src/date.c (show_date): Remove stray `puts (buf);' (debugging?)
60         from the 2004-02-02 change.
61         * tests/misc/date (uninit-64): New test for the above.
62         Rewrite all other OUT strings to include the terminating "\n".
63
64 2005-08-14  Jim Meyering  <jim@meyering.net>
65
66         * src/md5sum.c (usage): Fix typo s/formated/formatted/ reported
67         by Norbert Kiesel.
68
69         Use one fewer file descriptor in a common case.
70         * src/touch.c: Include "fd-reopen.h", rather than "fcntl--.h".
71         Use fd_reopen rather than open.
72
73 2005-08-14  James Youngman  <jay@gnu.org>
74
75         * src/test.c (age_of): Return the nanoseconds part of the timestamp,
76         if available.
77         (binary_operator) [-nt, -ot]: Use nanosecond values to break ties.
78
79 2005-08-14  Jim Meyering  <jim@meyering.net>
80
81         * src/ls.c (long_time_expected_width): Revert last change, just to
82         be paranoid, and add a comment explaining why.  Paul Eggert mentioned
83         the possibility.
84
85         * src/wc.c: Don't define mbrtowc at all.
86         If mbstate_t is not defined, then AC_TYPE_MBSTATE_T will define
87         it to `int' for us.  Now wc.c really does compile on HP-UX 11.23.
88
89 2005-08-13  Jim Meyering  <jim@meyering.net>
90
91         * tests/date: Remove directory
92         * tests/Makefile.am (SUBDIRS): Remove date.
93         * configure.ac (AC_CONFIG_FILES): Remove tests/date/Makefile.
94
95         * tests/Coreutils.pm: New keywords, ENV and ENV_DEL, to support
96         tests/misc/date.
97
98         With todays additions, the generated shell script,
99         tests/date/date-tests had becoming far too large (over 350KB),
100         so use the superior-but-perl-requiring framework instead.
101         * tests/date/Test.pm: Move all tests from here...
102         * tests/misc/date: ...to this new file.
103         * tests/misc/Makefile.am (TESTS): Add date.
104
105         * tests/date/Test.pm (test_vector) [cross-dst]: New test for
106         just-fixed getdate.y bug.
107         * tests/date/Test.pm (test_vector): Add 364 more tests like the above.
108         Remove unused $sunos4 variable.
109
110 2005-08-12  Jim Meyering  <jim@meyering.net>
111
112         * src/nohup.c (main): Explain why we reopen stdin for write-only access.
113
114         * src/ls.c (long_time_expected_width): Don't test for failed localtime.
115         That cannot happen when the result date's year is in range.
116         Add an assertion instead.
117
118         * src/ls.c (sort_files): Use cleaner `sizeof *VAR_NAME'
119         rather than `sizeof (TYPE_NAME)'.
120         * src/ptx.c (sort_found_occurs, digest_word_file): Likewise.
121         (alloc_and_compile_regex): Likewise.
122
123         * src/wc.c: Test `!defined HAVE_MBSTATE_T' rather than
124         `defined mbstate_t' to detect missing support for mbstate_t.
125         The latter didn't work for HP-UX 11.23.
126
127         Add bulletproofing in case stdin is closed.
128         * src/dircolors.c (have_read_stdin): Remove global variable.
129         (dc_parse_stream): Always use stdin (freopen, if needed) rather
130         than sometimes using fopen to get a new file descriptor.
131         Call fclose unconditionally.
132         (main): Don't close stdin here.  If needed, now it's already done
133         by dc_parse_stream.
134
135         * src/dircolors.c (dc_parse_file): Remove comment about
136         now-removed OPENOPTS.
137
138         * src/fold.c (fold_file): Cosmetic: use X2REALLOC rather than x2realloc.
139         * src/pr.c (main): Likewise.
140
141         * src/csplit.c (new_control_record): Cosmetic: use X2NREALLOC (only
142         two arguments) rather than x2nrealloc (with three).
143         * src/cut.c (ADD_RANGE_PAIR): Likewise.
144         * src/expand.c (add_tab_stop): Likewise.
145         * src/join.c (extract_field, getseq): Likewise.
146         * src/od.c (decode_format_string): Likewise.
147         * src/sort.c (add_temp_dir): Likewise.
148         * src/unexpand.c (add_tab_stop): Likewise.
149
150         * src/pr.c (main): Cosmetic: use '\0' in place of 0.
151
152 2005-08-02  Jim Meyering  <jim@meyering.net>
153
154         * src/date.c: Include "xanstrftime.h".
155         (show_date): Use xanstrftime instead of open-coding it.
156         * src/du.c: Likewise.
157
158 2005-07-29  Jim Meyering  <jim@meyering.net>
159
160         * src/date.c (show_date): Remove now-unnecessary code that
161         treated an empty format string as a special case.
162         * tests/date/Test.pm (empty-format): New test, for this case.
163
164 2005-07-19  Jim Meyering  <jim@meyering.net>
165
166         * src/md5sum.c (usage): Adjust printf argument list to match
167         new format string.
168
169 2005-07-19  Paul Eggert  <eggert@cs.ucla.edu>
170
171         * NEWS: md5sum --check now accepts multiple input files, and
172         similarly for sha1sum.  Extension suggested by Chris Girling.
173         * src/md5sum.c (usage, main): Support this new usage.
174
175 2005-07-18  Paul Eggert  <eggert@cs.ucla.edu>
176
177         Fix a problem noted by James Youngman: VPATH-style builds don't
178         work because of po file problems.
179         * src/Makefile.am (BUILT_SOURCES): Remove false.c.
180         (false.c): Remove; it's now a source file.
181         * src/false.c: New file.
182         * src/true.c (EXIT_STATUS): New macro.
183         (PROGRAM_NAME, usage): Behave like "false" if EXIT_STATUS indicates.
184         (usage): Remove "These option names may not be abbreviated."
185
186 2005-07-15  Paul Eggert  <eggert@cs.ucla.edu>
187
188         * src/nohup.c (main): Don't worry about POSIXLY_CORRECT.  Today's
189         Austin Group Minutes says that the GNU behavior will be put
190         forward as proposed text for a future revision.
191
192 2005-07-13  Paul Eggert  <eggert@cs.ucla.edu>
193
194         * src/Makefile.am (nanosec_libs): Remove $(FESETROUND_LIBM); no longer
195         needed.  Problem reported by Jeff Bailey.
196
197 2005-07-12  Jim Meyering  <jim@meyering.net>
198
199         * Makefile.maint (copyright-check): Reflect rearrangement in
200         version-etc files.
201
202 2005-07-11  Paul Eggert  <eggert@cs.ucla.edu>
203
204         * NEWS: Binary input and output are now implemented more consistently.
205         These changes affect only platforms like MS-DOS that distinguish
206         between binary and text files.
207         * src/cat.c (usage, main, long_options) [O_BINARY]:
208         Remove support for -B.  Use same rules as other programs to decide
209         whether to use binary I/O, except that the -bensAE options always
210         select text mode.
211         * src/cat.c (main): Avoid setmode; use POSIX-specified routines instead.
212         * src/cksum.c (cksum): Likewise.
213         * src/head.c (head_lines, head_file): Likewise.
214         * src/od.c (open_next_file): Likewise.
215         * src/split.c (main): Likewise.
216         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
217         * src/tac.c (copy_to_temp, tac_file, main): Likewise.
218         * src/tail.c (tail_bytes, tail_lines, tail_file, main): Likewise.
219         * src/tee.c (tee): Likewise.
220         * src/tr.c (main): Likewise.
221         * src/wc.c (wc): Likewise.
222         * src/copy.c (copy_reg): Always copy in binary mode.
223         * src/expand.c (expand): Always copy in text mode.  POSIX says
224         the input and output must be text.
225         * src/unexpand.c (unexpand): Likewise.
226         * src/head.c (elide_tail_bytes_file, elide_tail_lines_file, head_bytes):
227         (head_lines, head_file): Always use binary mode except for std tty.
228         * src/md5sum.c (usage): Clarify whether text or binary is the default.
229         (split_3, main): BINARY is now a 3-way value.  All uses changed.
230         (digest_file): Likewise.  Clear *BINARY if we determine the file
231         to be text.  All uses changed.
232         (main): Don't report a file to be binary if we actually read it
233         as text in MS-DOS, because it was a terminal.
234         * src/shred.c (wipefile): Always use binary mode.  Clearly this
235         never worked right on DOS!
236         * src/system.h (setmode, fileno): Remove; no longer needed, we think.
237         (SET_MODE, SET_BINARY, SET_BINARY2): Remove.
238         [defined __DJGPP__]: Don't include <io.h> or <sys/exceptn.h>.
239         * src/wc.c (wc_file): FILE might be null now.
240         (main): Simplify code a bit, so that fewer places need the
241         setmode fixes.
242
243 2005-07-09  Paul Eggert  <eggert@cs.ucla.edu>
244
245         * src/comm.c, src/csplit.c, src/dd.c, src/join.c, src/md5sum.c:
246         * src/pr.c, src/sort.c, src/tee.c:
247         Don't include stdio.h; no longer needed.
248
249 2005-07-08  Paul Eggert  <eggert@cs.ucla.edu>
250
251         Fix porting problems reported by Eric Blake.
252
253         * configure.ac: Remove check for AC_HEADER_TIOCGWINSZ.
254         * src/cat.c, src/ls.c, src/stty.c: Include stropts.h if available,
255         because POSIX says that's where ioctl is declared.
256         * src/cat.c: Use HAVE_SYS_IOCTL_H instead of _POSIX_SOURCE
257         to decide whether to include <sys/ioctl.h>.
258         * src/stty.c: Use only HAVE_SYS_IOCTL_H to decide whether
259         to include <sys/ioctl.h>.
260
261         * src/id.c (print_user): Don't assume uid fits in unsigned int.
262         (print_group): Likewise, for gid.
263
264 2005-07-05  Paul Eggert  <eggert@cs.ucla.edu>
265
266         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Generate a hard error
267         (not just a warning) if GCC is used and the types don't match.
268
269 2005-07-04  Paul Eggert  <eggert@cs.ucla.edu>
270
271         * src/system.h (VERIFY_W_TYPEOF): Remove; no longer needed.
272         (DECIMAL_DIGIT_ACCUMULATE): Change last arg from T's maximum value
273         to T itself.  All callers changed.  Check that T is unsigned, and
274         that Accum is of type T.  This fixes a bug in the unlikely case
275         where SIZE_MAX <= INT_MAX, and it no longer requires typeof to do
276         the proper validity checks.
277
278         * src/od.c: Adjust to verify.h change.
279         * src/system.h (VERIFY_W_TYPEOF): Likewise.
280
281 2005-07-04  Jim Meyering  <jim@meyering.net>
282
283         * src/system.h: Include "verify.h".
284
285         * src/system.h (verify): Rename from VERIFY_EXPR, to be lower case,
286         like assert.  Use sizeof, rather than equivalent ((...)0), for
287         it's slightly simpler syntax.  Suggestions from Paul Eggert.
288         (verify_decl): Rename from VERIFY.
289         * src/od.c: Reflect name change.
290
291 2005-07-03  Jim Meyering  <jim@meyering.net>
292
293         * NEWS: cp and mv: the --reply=X option is deprecated
294         Suggested by Bob Proulx, after numerous user complaints
295         about how --reply=no appeared not to work.
296         * src/mv.c (main): Using --reply now evokes a warning.
297         (usage): Remove description of --reply.
298         * src/cp.c (main): Using --reply now evokes a warning.
299         (usage): Remove description of --reply.
300         * tests/mv/i-link-no: Adjust for new diagnostic.
301         * tests/mv/reply-no: Likewise.
302
303         * src/printf.c (verify_numeric): Rename from verify.
304         Update caller.
305
306 2005-07-03  Paul Eggert  <eggert@cs.ucla.edu>
307
308         * src/copy.h: Include "lstat.h" rather than rolling our own.
309         * src/ls.c: Likewise.
310         * src/remove.c: Likewise.
311
312 2005-07-02  Paul Eggert  <eggert@cs.ucla.edu>
313
314         Cleanup to isolate "safer" functions to a small part of the code.
315         * src/comm.c: Include stdio--.h, not stdio-safer.h.
316         (compare_files): Use fopen, not fopen_safer.
317         * src/copy.c: Include fcntl--.h, not unistd-safer.h.
318         (copy_reg): Don't call fd_safer; no longer needed
319         now that we include fcntl--.h.
320         * src/csplit.c: Include fd-reopen.h.
321         Include stdio--.h, not stdio-safer.h.
322         (input_desc): Remove.  All uses changed to STDIN_FILENO.
323         (set_input_file): Reopen stdin, to simplify code.
324         (create_output_file): Use fopen, not fopen_safer.
325         * src/dd.c: Include fd-reopen.h.
326         (open_fd): Remove.  All callers changed to use fd_reopen instead.
327         * src/join.c: Include stdio--.h, not stdio-safer.h.
328         (main): Use fopen, not fopen_safer.
329         * src/md5sum.c: Include stdio--.h.
330         (digest_check): Don't try to read both checksums and data from stdin.
331         * src/nohup.c: Include fd-reopen.h.
332         Include unistd--.h, not unistd-safer.h.
333         (main): Use fd_reopen to simplify code.  When replacing stdin,
334         use "/dev/null" not "/", as that's less likely to go wrong these days.
335         (main): Use dup, not dup_safer.
336         * src/pr.c: Include stdio--.h, not stdio-safer.h.
337         (open_file): Invoke fopen, not fopen_safer.
338         * src/shred.c: Include fcntl--.h, not unistd-safer.h.
339         (wipename, wipe_file): Don't use fd_safer; no longer needed
340         now that we include fcntl--.h.
341         * src/sort.c: Include stdio--.h rather than stdio-safer.h.
342         Include stdlib--.h.  Do not include unistd-safer.h.
343         (create_temp_file): Don't call fd_safer; no longer needed
344         now that we include *--.h files.
345         (xfopen): Don't call fopen_safer, for similar reasons.
346         * src/split.c: Include fcntl--.h rather than unistd-safer.h.
347         Include fd-reopen.h.
348         (input_desc): Remove.  All uses replaced by STDIN_FILENO.
349         (cwrite): Don't call fd_safer; no longer needed now that
350         we include fcntl--.h.
351         (main): Reuse stdin rather than opening a new one.  This
352         saves a file descriptor.
353         * src/stty.c: Include fd-reopen.h.
354         (display_all, display_settings, display_window_size, set_window_size):
355         Remove fd arg, since we now assume stdin.  All callers changed.
356         (main): Reuse stdin rather than opening a new one.  This
357         saves a file descriptor.
358         * src/tac.c: Include stdlib--.h rather than unistd-safer.h.
359         (copy_to_temp): Don't call fd_safer; no longer needed now
360         that we include stdlib--.h.
361         * src/tail.c: Include fcntl--.h, not unistd-safer.h.
362         (recheck, tail_file): Don't call fd_safer; no longer needed
363         now that we include fcntl--.h.
364         * src/tee.c: Include stdio--.h, not stdio-safer.h.
365         (tee): Don't call fopen_safer; no longer needed now that we
366         include stdio--.h.
367         * src/touch.c: Include fcntl--.h, not unistd-safer.h.
368         (touch): Don't call fd_safer; no longer needed now that
369         we include fcntl--.h.
370
371         * src/du.c (main): Reuse stdin rather than opening a new stream.
372         This saves a file descriptor.
373         * src/uniq.c: Don't include stdio-safer.h; no longer needed.
374         (writeline): Remove stream arg; we now always output to stdout.
375         All callers changed.
376         (check_file): Reuse stdout rather than opening a new stream.
377         This saves a file descriptor.
378
379 2005-07-02  Jim Meyering  <jim@meyering.net>
380
381         * Makefile.maint (sc_obsolete_symbols): New rule.
382         (syntax-check-rules): Add it to the list.
383         * Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols.
384         * .x-sc_obsolete_symbols: New file.
385
386 2005-07-01  Jim Meyering  <jim@meyering.net>
387
388         * src/system.h: Assume HAVE_FCNTL_H (i.e., include <fcntl.h>
389         unconditionally, and don't include <sys/file.h>).
390         * src/system.h: Likewise for HAVE_UNISTD_H.
391
392 2005-06-30  Jim Meyering  <jim@meyering.net>
393
394         * src/cp.c: Add uses of ARGMATCH_VERIFY to ensure that
395         corresponding option string and value arrays are consistent.
396         * src/date.c: Likewise.
397         * src/du.c: Likewise.
398         * src/ls.c: Likewise.
399         cp.c and date.c each had a harmless trailing `, 0' (now-removed)
400         in a value list.
401
402         * src/system.h (VERIFY): Guard definition with #ifndef.
403         (VERIFY_EXPR): Undef before defining.
404
405 2005-06-29  Jim Meyering  <jim@meyering.net>
406
407         * src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
408         * src/du.c (show_date): Likewise.
409         * src/date.c (show_date): Likewise.
410         * src/od.c (dump_strings): Likewise.
411         * src/sort.c (fillbuf): Likewise.
412         * src/chmod.c (main): Likewise.
413
414         * src/system.h (VERIFY): Rewrite to use string-concatenation
415         and __LINE__ so as not to require a struct name parameter.
416         (GL_CONCAT, GL_CONCAT2): Define helper macros.
417         * src/od.c: Update sole use.
418
419         * src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
420         when computing the --author column width.  This bug might have
421         resulted in misaligned columns when using the --author option
422         on the Hurd.  Spotted by Arnold Robbins.
423
424 2005-06-28  Jim Meyering  <jim@meyering.net>
425
426         * src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
427         not x2nrealloc.  The former is a little more concise and readable.
428         N.B. this sort of transformation is ok only when the base type is
429         unlikely ever to change to a multibyte type.
430         * src/du.c (show_date): Likewise.
431         * src/date.c (show_date): Likewise.
432         * src/od.c (dump_strings): Likewise.
433         * src/sort.c (fillbuf): Likewise.
434
435 2005-06-24  Jim Meyering  <jim@meyering.net>
436
437         * src/mv.c (usage): Clarify how --reply=no works.
438
439 2005-06-23  Paul Eggert  <eggert@cs.ucla.edu>
440
441         Address the following "du" issues:
442
443         - The option name "--last-time=TYPE" is different from the ls's option
444           "--time=TYPE" with a similar meaning.  I assume this wasn't intended.
445
446         - --time-style implies --time, but this is not true for "ls".  It's
447           better to be consistent.
448
449         - Since we don't have POSIX compatibility concerns, there's no need
450           for the "posix-" styles, or for support of styles with newlines, or
451           for the "locale" style, except for parsing the TIME_STYLE
452           environment variable.
453
454         - It's cleaner (and these days, no less efficient) to use functions
455           rather than macros when possible.
456
457         - struct duinfo doesn't need a 'valid' flag; you can simply use a time
458           stamp that is less than all valid time stamps.
459
460         - The code needs a bit of reformatting to fit the usual GNU style.
461
462         * NEWS: du's --last-time option is now --time.
463         * doc/coreutils.texi (ls invocation): Fix typo: --time=use is
464         equivalent to --time=atime, not --time=ctime.
465         (ls invocation, du invocation): Fix typo: --time-style=long-iso
466         is equivalent to a time style with a leading "+".
467         (du invocation): --last-time is now --time.
468         --time-style no longer implies --time.
469         The locale and posix- stuff now works only for TIME_STYLE, not
470         for --time-style.  Give equivalent format for --time-style=iso.
471         * src/du.c: Do not include hard-locale.h.
472         (struct duinfo): Remove 'valid' member.  All uses changed to use
473         negative nsec instead.
474         (DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
475         (duinfo_init, duinfo_set, duinfo_add): New functions, taking the
476         role of the removed macros.
477         (opt_time): Renamed from opt_last_time.  All uses changed.
478         (TIME_OPTION): Renamed from LAST_TIME_OPTION.  All uses changed.
479         (long_options, usage): Rename --last-time to --time.
480         (locale_time_style): Remove.
481         (time_style_args, time_style_types, usage): Remove support for
482         --time-style=locale.
483         (show_date): Now returns void, since nobody looked at the result.
484         Assume FORMAT is not null.  An empty FORMAT now outputs an empty time.
485         Simplify nstrftime invocation.
486         (main): Put in ls compatibility workarounds only for TIME_STYLE,
487         not for --time-style.  Omit unnecessary space in iso time style.
488
489 2005-06-23  Jim Meyering  <jim@meyering.net>
490
491         * src/du.c (time_format): Add `const' attribute.
492
493         * src/date.c (show_date): Use puts rather than printf ("%s\n",.
494
495         * src/du.c (show_date): Rename local `time_format' so as not to
496         shadow the file-scoped global by that name.
497         (show_date): Add a FIXME comment.
498
499         * src/du.c: Include hard-locale.h and strftime.h.
500         (DUINFO_INI, DUINFO_SET, DUINFO_ADD):
501         Enclose body in `do {...} while (0)', not just `{...}'.
502         Adjust uses (add semicolons).
503         Adjust formatting, indentation.
504         (usage): Tweak formatting to maintain more or less constant indentation.
505
506 2005-06-14  William Brendling  <wbrendling@gmail.com>
507
508         * src/du.c: Add --last-time and --time-style options.
509
510 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
511
512         * tests/umask-check: New file.
513         * tests/Makefile.am (EXTRA_DIST): Add umask-check.
514         * tests/mkdir/perm: Use umask-check.
515         * tests/cp/cp-parents: Likewise, instead of using chmod
516         as described below.  Problem reported by Kevin Mudrick.
517
518 2005-06-22  Jim Meyering  <jim@meyering.net>
519
520         Make rmdir produce diagnostics like this:
521         rmdir: /tmp: Permission denied
522         not like this:
523         rmdir: `/tmp': Permission denied
524
525         * src/rmdir.c: Include "quotearg.h", not "quote.h".
526         (remove_parents, main): Use quotearg_colon, not quote.
527
528 2005-06-22  Paul Eggert  <eggert@cs.ucla.edu>
529
530         * tests/cp/cp-parents: Use chmod to work around some hosts with
531         ACL problems.  Problem reported by Kevin Mudrick.
532
533 2005-06-21  Jim Meyering  <jim@meyering.net>
534
535         * tests/du/deref-args: Use --apparent-size to avoid the vagaries
536         of counting blocks.  Kevin Mudrick reported that this test would
537         fail on an nfs-mounted directory where attribute-caching is
538         turned on.
539
540 2005-06-19  Jim Meyering  <jim@meyering.net>
541
542         * src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
543
544         * src/shred.c (usage): Use `file system', not `filesystem'.
545
546 2005-06-18  Jim Meyering  <jim@meyering.net>
547
548         * src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
549
550 2005-06-17  Jim Meyering  <jim@meyering.net>
551
552         * src/shred.c (usage): Clarify that shred works on an ext3 file
553         system as long as it's not in data=journal mode.
554         Tiny change by Mark Melahn.
555
556 2005-06-16  Paul Eggert  <eggert@cs.ucla.edu>
557
558         * src/hostid.c (main): Don't print fewer than 8 digits, or spurious
559         leading "f"s.  "f" problem reported by Tim Waugh.
560         * NEWS: Document this.
561
562 2005-06-16  Jim Meyering  <jim@meyering.net>
563
564         Don't embed `this'-style quotes in format strings.
565         * src/tr.c: Rather than this: error (..., "...`%s'...", arg);
566         do this:                      error (..., "...%s...", quote (arg));
567         * src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
568         * src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
569         * src/split.c, src/tail.c: Likewise.
570
571         * src/sleep.c: Include "quote.h".  Remove hard-coded quotes, as above.
572         * src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
573         * src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
574
575         * src/mv.c: Finally remove support for --version-control=S (-V).
576         It was deprecated nearly 6 years ago and has been warning
577         users to switch to --backup=S since fileutils-4.0j.
578         * src/cp.c, src/install.c, src/ln.c: Likewise.
579
580 2005-06-15  Jim Meyering  <jim@meyering.net>
581
582         * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
583         * tests/install/basic-1: Ensure that each `-d'-specified directory
584         is created.  Ensure that rel-named dirs are not created when
585         chdir($PWD) fails.
586
587         * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
588
589 2005-06-14  Paul Eggert  <eggert@cs.ucla.edu>
590
591         Improve diagnostics for restore_cwd failure.
592         * src/install.c (main): Standardize on a diagnostic for
593         restore_cwd failure, and report errno.
594         (install_file_in_file_parents): Fail if restore_cwd fails and
595         one of the files is relative.  This fixes a bug (albeit unlikely).
596         * src/mkdir.c (create_parents): Remove static var (now local to 'main').
597         (main): Standardize on a diagnostic for restore_cwd failure,
598         and report errno.
599         Don't bother to check cwd_errno unless create_parents.
600         Use mkdir rather than make_dir; it's simpler.
601
602         * src/install.c (main): Adjust to new make_dir_parents convention.
603         * src/mkdir.c (main): Likewise.
604
605 2005-06-14  Jim Meyering  <jim@meyering.net>
606
607         * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
608         is an absolute directory name.
609
610         * Makefile.maint (my-distcheck): Add -Wall to the list of options that
611         are used with -Werror.  This target is not intended for general use.
612
613 2005-06-13  Jim Meyering  <jim@meyering.net>
614
615         * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
616         relative directory name after make_dir_parents fails to restore
617         the working directory.  Before, `mkdir -p' could create directories
618         in the wrong place in unusual circumstances.
619         * src/install.c (main): Likewise.
620         (install_file_in_file_parents): Update make_dir_parents caller.
621         * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
622         * tests/mkdir/Makefile.am (TESTS): Add p-3.
623
624 2005-06-10  Paul Eggert  <eggert@cs.ucla.edu>
625
626         Act on the Austin Group's response yesterday to XCU ERN 63; see
627         <http://www.opengroup.org/austin/docs/austin_260.txt>.
628         * NEWS: ls no longer outputs an extra space between mode and link count.
629         * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
630         * src/ls.c (any_has_acl): New var.
631         (clear_files): Clear it.
632         (gobble_file): Set it if a file has an ACL.
633         (print_long_format): Omit needless space unless some file has an ACL.
634
635 2005-06-10  Jim Meyering  <jim@meyering.net>
636
637         * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
638
639 2005-06-02  Jim Meyering  <jim@meyering.net>
640
641         * src/sort.c (usage): Put `Ordering options:' line where it belongs.
642
643 2005-06-01  Paul Eggert  <eggert@cs.ucla.edu>
644
645         Use "file name" when talking about file names, instead of "filename"
646         or "path", as per the GNU coding standards.
647         * src/basename.c: Don't use "path" or "filename".
648         * src/copy.c: Likewise.
649         * src/copy.h: Likewise.
650         * src/cp-hash.c: Likewise.
651         * src/cp.c: Likewise.
652         * src/df.c: Likewise.
653         * src/install.c: Likewise.
654         * src/ls.c: Likewise.
655         * src/pinky.c: Likewise.
656         * src/pr.c: Likewise.
657         * src/pwd.c: Likewise.
658         * src/remove.c: Likewise.
659         * src/rmdir.c: Likewise.
660         * src/sort.c: Likewise.
661         * src/system.h: Likewise.
662         * src/tty.c: Likewise.
663         * src/who.c: Likewise.
664         * src/cp.c (parents_option): Renamed from flag_path.  All uses changed.
665         (make_dir_parents_private): Renamed from make_path_private.
666         All uses changed.
667         * src/cp.c (usage): Don't use "path" to describe a file name.
668         * src/readlink.c (usage): Likewise.
669         * src/rmdir.c (usage): Likewise.
670         * src/df.c: Don't include "path-concat.h"; not needed.
671         * src/install.c (install_file_in_file_parents): Renamed from
672         install_file_to_path.  All uses changed.
673         * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
674         All uses changed.
675         * src/ls.c (make_link_name): Renamed from make_link_path.
676         All uses changed.
677         * src/pwd.c (struct file_name): Renamed from struct Path.
678         All uses changed.
679         (file_name_free): Renamed from path_free.  All uses changed.
680         (file_name_init): Renamed from path_init.  All uses changed.
681         (file_name_prepend): Renamed from path_prepend.  All uses changed.
682         * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
683         All uses changed.
684         (longopts): Add comment that --path is deprecated.
685
686 2005-05-31  Jim Meyering  <jim@meyering.net>
687
688         * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
689         This is a crutch so that `make distcheck's sc_tight_scope rule
690         knows that they really are deliberately declared that way.
691
692 2005-05-30  Paul Eggert  <eggert@cs.ucla.edu>
693
694         Port to Solaris 10's rules for whether programs can chown files.
695         * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
696         (DO_CHOWN): Remove.  Replaced by chown_failure_ok.  All callers
697         changed.
698         (copy_internal): If chown failed, don't worry about what happened
699         to the mode bits; they can't have changed.
700         (chown_privileges, chown_failure_ok): New functions.
701         * src/copy.h: Add copyright notice.
702         (struct cp_options): Remove myeuid member.  Add chown_privileges
703         member.
704         (chown_privileges, chown_failure_ok): New function decls.
705         * src/cp.c (re_protect): Remove unnecessary call to geteuid.
706         Use chown_failure_ok rather than our own code.
707         * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
708         * src/install.c (cp_option_init): Likewise.
709         * src/mv.c (cp_option_init): Likewise.
710
711 2005-05-29  Paul Eggert  <eggert@cs.ucla.edu>
712
713         * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
714         * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
715         Remove decls.
716         * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
717         * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
718         [!defined _POSIX_VERSION]: Remove decls.
719         * src/install.c (getpwnam, getgrnam): Remove decl.
720         (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
721         * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
722         (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
723         * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
724         * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
725         isn't defined.
726         Don't include <sys/file.h>; no longer needed.
727         (getegid, geteuid): Remove no-longer-necessary decls.
728
729         * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
730         Define to 256, not 255, as per modern POSIX.
731
732 2005-05-27  Paul Eggert  <eggert@cs.ucla.edu>
733
734         * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
735         * src/dd.c (skip): Return the number of records that were not
736         skipped due to encountering EOF.
737         (dd_copy): If the file wasn't seekable and EOF was encountered,
738         write zeros past EOF until the desired offset is reached.
739
740         * NEWS: expr and test now correctly compare integers of unlimited size.
741         (Also, correct a comment that claimed that expr detects integer
742         overflow; it does so only when converting from strings.)
743         * src/expr.c: Include strnumcmp.h, xstrtol.h.
744         (looks_like_integer): New function.
745         (toarith): Use it.  Also, use xstrtoimax rather than rolling our
746         own diagnostics.
747         (eval2): Don't look for trouble if !evaluate; this simplifies things.
748         Compare numbers using string comparison, so that overflow is
749         not possible.
750         * src/sort.c: Refactor so that others can use large-integer
751         comparison functions.
752         Include "strnumcmp.h".
753         (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
754         Remove; moved to strnumcmp.
755         (decimal_point): Now int, to simplify converison overhead with
756         new API.  All uses changed.
757         (thousands_sep): Now -1 if there isn't one, as per new API.
758         All uses changed.
759         (numcompare): Move contents to strnumcmp module, except for
760         skipping blanks.
761         * src/test.c: Include inttostr.h, strnumcmp.h.
762         (whitespace, digit, digit_value, integer_expected_error): Remove.
763         (is_int): Remove; replaced by...
764         (find_int): New function.
765         (binary_operator): Don't let integers overflow in comparisons;
766         return the correct answer instead.  Simplify the code.
767         (unary_operator): Convert the integer ourself, since find_int
768         no longer does so.
769         * tests/expr/basic (bigcmp): New test.
770         * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
771
772 2005-05-26  Paul Eggert  <eggert@cs.ucla.edu>
773
774         * NEWS: nohup now redirects a tty stdin to an unreadable fd
775         instead of closing it.
776         * doc/coreutils.texi (nohup invocation): Document this.
777         * src/nohup.c (main): Implement this.
778
779 2005-05-26  Jim Meyering  <jim@meyering.net>
780
781         * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
782         Reported by David Alan Gilbert.
783         * tests/expr/basic: Add tests using arithmetic on negative integers.
784
785 2005-05-19  Jim Meyering  <jim@meyering.net>
786
787         * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
788         Remove inaccurate-but-harmless `const' attributes.
789
790         * src/join.c (decode_field_spec): Add an abort after
791         `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
792         about variables being used uninitialized.
793
794 2005-05-18  Paul Eggert  <eggert@cs.ucla.edu>
795
796         * configure.ac: Add copyright notice.  gl_LIB_CHECK -> cu_LIB_CHECK.
797         * src/Makefile.am: Add copyright notice.
798         (factor_LDADD): Remove, as factor no longer needs sqrt.
799         * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
800         it's always true now.
801
802 2005-05-16  Paul Eggert  <eggert@cs.ucla.edu>
803
804         Fix Cygwin porting problem reported by Eric Blake.
805         * src/remove.c (DT_IS_DIR): Remove.
806         (DT_IS_KNOWN, DT_MUST_BE): New macros.
807         (remove_entry): Use them.
808
809 2005-05-14  Paul Eggert  <eggert@cs.ucla.edu>
810
811         * src/remove.c: Include unlinkdir.h.
812         (UNLINK_CAN_UNLINK_DIRS): Remove.
813         (remove_entry): Use cannot_unlink_dirs () rather than
814         UNLINK_CAN_UNLINK_DIRS.
815
816 2005-05-14  Jim Meyering  <jim@meyering.net>
817
818         Update FSF postal mail address.
819         * Makefile.maint, Makefile.cfg, gnupload
820         * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
821         * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
822         * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
823         * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
824         * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
825         * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
826         * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
827         * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
828         * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
829         * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
830         * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
831         * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
832         * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
833         * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
834         * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
835         * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
836         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
837         * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
838         * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
839         * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
840         * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
841         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
842
843 2005-05-13  Jim Meyering  <jim@meyering.net>
844
845         * NEWS: `rm -r' now removes all of the files it should, even on
846         systems with a buggy readdir affecting file systems inaccessible
847         at configure time.
848
849         In some unusual circumstances `rm -r' would fail to remove --
850         or even consider -- all entries in a directory with more than 254
851         (SunOS) or 338 (Darwin) entries.  This could cause trouble even on
852         other types of systems when using an affected file system via e.g.,
853         NFS.  The underlying cause was a bug in readdir on those systems.
854         Coreutils-5.2.1 and earlier used a configure-time test designed
855         to detect precisely those problem systems, but it would detect
856         the problem and enable remove.c's work-around code only when its
857         configure-time test was run on a losing file system.  Obviously,
858         it couldn't detect a problem if the offending file system wasn't
859         tested or even mounted at coreutils configure time.  Now, rm itself
860         performs a minimal-cost run-time test to detect the problem.
861
862         * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
863         (remove_cwd_entries):  When readdir returns NULL for a directory from
864         which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
865         entries, call rewinddir and then resume the readdir/unlink loop.
866         (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
867
868 2005-05-12  Paul Eggert  <eggert@cs.ucla.edu>
869
870         * NEWS: nohup now closes stdin if it is a terminal, unless
871         POSIXLY_CORRECT is set.  This fixes a glitch noted by Wayne Pollock in
872         <https://www.opengroup.org/sophocles/show_mail.tpl?
873         source=L&listname=austin-group-l&id=8341>.
874         * doc/coreutils.texi (nohup invocation): Document this.
875         * src/nohup.c (main): Implement this.
876
877 2005-05-12  Jim Meyering  <jim@meyering.net>
878
879         * src/date.c: Assume `free (NULL)' works.
880         * src/dd.c: Likewise.
881         * src/df.c:Likewise.
882         * src/dircolors.c:Likewise.
883         * src/head.c: Likewise.
884         * src/ls.c: Likewise.
885         * src/md5sum.c: Likewise.
886         * src/pr.c: Likewise.
887         * src/sort.c: Likewise.
888
889 2005-05-10  Jim Meyering  <jim@meyering.net>
890
891         * tests/touch/not-owner: Skip this test if the user running it
892         owns `/' or has write access to it.
893
894         * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
895         This makes `mv -i --reply=no f1 f2' work as expected (in not
896         performing the move operation).  But note that specifying `-i'
897         after `--reply=no' does *not* work.
898         Tiny patch from Vlada Macek.
899         Correct a comment.
900         * tests/mv/reply-no: New file.  Test for the above fix.
901         * tests/mv/Makefile.am (TESTS): Add reply-no.
902
903         * tests/ls-2/tests: Don't print PATH to stderr.
904
905 2005-05-08  Paul Eggert  <eggert@cs.ucla.edu>
906
907         * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
908         responses.
909
910 2005-05-06  Paul Eggert  <eggert@cs.ucla.edu>
911
912         * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
913         * src/dd.c (flags, usage): Add support for "binary" and "text".
914
915 2005-05-04  Paul Eggert  <eggert@cs.ucla.edu>
916
917         * NEWS: chmod -w now complains if it differs from chmod a-w.
918         * src/chmod.c: Include quotearg.h.
919         (diagnose_surprises): New var.
920         (process_file): Diagnose surprises.  Simplify the logic a bit,
921         while we're at it.
922         (main): Prepare to diagnose surprises.  Remove useless code for
923         '-' option.
924         * tests/chmod/Makefile.am (TESTS): Add umask-x.
925         * tests/chmod/umask-x: New file.
926
927 2005-05-02  Paul Eggert  <eggert@cs.ucla.edu>
928
929         * NEWS: ls --indicator-style=directory renamed to ls
930         --indicator-style=slash, to avoid confusion with ls --directory.
931         * src/ls.c (usage): Likewise.
932         (slash): Renamed from directory_only.  All uses changed.
933
934 2005-05-01  Paul Eggert  <eggert@cs.ucla.edu>
935
936         * NEWS: "chmod +1 foo" is now diagnosed.
937
938 2005-04-29  Paul Eggert  <eggert@cs.ucla.edu>
939
940         * NEWS: ls -p now marks only directories.  New option
941         --indicator-style=directory equivalent to -p.
942         * doc/coreutils.texi (ls invocation): Document this.
943         Also, mention ">" is for doors.
944         * src/ls.c (enum indicator_style): New constant directory_only,
945         for -p.
946         (indicator_style_args, indicator_style_types): Set it appropriately.
947         (decode_switches, gobble_file, print_type_indicator):
948         (length_of_file_name_and_frills):
949         Implement the change described in NEWS.
950         (decode_switches): Quote ">", too.
951         (usage): Update to match the new behavior.  Describe ">".
952         * tests/ls/file-type: Test for new behavior.  Omit -1 option.
953         The "ls --color" test wasn't being checked; add a check for
954         "ls --color=auto" instead.
955
956         * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
957         * tests/misc/split-fail: Likewise.
958         * tests/pr/Test.pm: Likewise.
959         * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
960         * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
961         if they use file names starting with +.
962         (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
963         * tests/uniq/Test.pm (tv, test_vector): Likewise.
964
965         The following was partly derived from a tiny change by Eric Blake:
966         * tests/misc/nice: Don't use 'set -'.  It's not portable to strict
967         POSIX 1003.1-2001 hosts.  Also, don't set _POSIX2_VERSION.
968         * tests/mkdir/perm: Don't use 'set -'.  Simplify test construction.
969         Work even if the underyling system attaches ACLs to new dirs.
970         * tests/mv/part-hardlink: Don't use 'set -'.
971         * tests/stty/row-col-1: Don't use 'set -'.
972
973 2005-04-28  Paul Eggert  <eggert@cs.ucla.edu>
974
975         * NEWS: Document fixes described below.
976         * src/chmod.c (change, umask_value): New static vars.
977         (reference_file): Move this static var to inside "main".
978         (process_file, process_files): Remove CHANGES arg; now taken from
979         static var.  All uses changed.
980         (usage): Fix incorrect description of MODE operand.
981         (main): For invalid mode usages, output a brief usage message.
982         Adjust to new modechange API.
983         * install.c (main): Adjust to new modechange API.
984         Also, free the mode_change object when done.
985         * mkdir.c (main): Likewise.
986         * mkfifo.c (main): Likewise.
987         * mknod.c (main): Likewise.
988         * tests/chmod/equal-X: Check for =xX bug.
989         * tests/chmod/equals: Check for =u bug.
990         * tests/chmod/usage: Check for u+gr and ug,+x bugs.
991
992 2005-04-26  Paul Eggert  <eggert@cs.ucla.edu>
993
994         Restore support for usages like "head -1" and "tail -1",
995         even when conforming to POSIX 1003.1-2001.
996         Fix bug with "POSIXLY_CORRECT=1 fold file -3".
997         join now supports a NUL field separator, e.g., "join -t '\0'".
998         join now detects and reports incompatible options, e.g.,
999         "join -t x -t y",
1000         * NEWS: Document this.
1001         * src/date.c: Remove posixver.h and its uses.
1002         (COMMON_SHORT_OPTIONS): Remove.
1003         (short_options): New constant.
1004         (short_options, usage): -I now always takes an optional arg.
1005         * src/expand.c: Remove posixver.h and its uses.
1006         (shortopts): New constant.  -DIGIT now always takes an optional arg.
1007         (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
1008         Don't complain about -DIGIT.
1009         * src/fold.c: Remove posixver.h and its uses.
1010         (shortopts): New constant.  -DIGIT now always takes an optional arg.
1011         (main): Don't preprocess arg list; that was buggy.  Use method
1012         similar to expand.
1013         * src/head.c: Remove posixver.h and its uses.
1014         (header_mode_option): Remove.
1015         (main): Don't complain about obsolete -NUM args.
1016         * src/join.c: Remove posixver.h and its uses.
1017         (obsolete_usage): Remove.
1018         (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
1019         they haven't been set yet.
1020         (tab): Now int, not char.  Initialize to -1 to indicate white space
1021         separates columns, so that we can use NUL as a separator.
1022         All uses changed.
1023         (OBSOLETE_LONG_OPTIONS, get_option): Remove.
1024         (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
1025         suffices.  Use xstrtoul for sizes; it suffices.
1026         (decode_field_spec): Report an error and exit on failure.  Return void,
1027         not bool.
1028         (add_field_list): Likewise.
1029         (set_join_field): New function.
1030         (enum operand_status): New enum.
1031         (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
1032         PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
1033         possibilities with obsolete option parsing.
1034         (main): Use it.  Do not depend on POSIX version.
1035         Check for conflicting options.  Parse obsolete options -j1 and -j2
1036         so that it is a pure extension to POSIX 1003.1-2001.
1037         Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
1038         * src/nice.c: Remove posixver.h and its uses.
1039         (main): Always support -NUM option.
1040         * src/od.c: Remove posixver.h and its uses.
1041         (short_options): New constant, which always supports -w[num].
1042         (COMMON_SHORT_OPTIONS): Remove.
1043         * src/pr.c: Remove posixver.h and its uses.
1044         (short_options): New constant, which always supports -S[string].
1045         (COMMON_SHORT_OPTIONS): Remove.
1046         * src/sort.c: Remove posixver.h and its uses.
1047         (short_options): New constant, which always supports -y arg.
1048         (COMMON_SHORT_OPTIONS): Remove.
1049         (main): Redo workaround for Solaris compatibility with -y.
1050         This change isn't visible to the user; it just cleans up the
1051         code so that we don't need posixver.h.
1052         * src/split.c: Remove posixver.h and its uses.
1053         (main): Don't complain about -NUM option.
1054         * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
1055         * src/unexpand.c: Remove posixver.h and its uses.
1056         (main): Don't complain about -TAB.
1057         * src/uniq.c (main): Don't complain about -NUM.
1058
1059 2005-04-22  Paul Eggert  <eggert@cs.ucla.edu>
1060
1061         * src/nohup.c (main): If getopt fails, exit with status 127,
1062         not status 1.  POSIX requires this.
1063         * NEWS: Document this.
1064
1065         * src/nice.c (main): Report proper program name when getopt finds
1066         trouble.  Problem reported by Behdad Esfahbod.
1067
1068         * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
1069         when the "+x" was being evaluated.
1070         * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
1071         * mkfifo.c (main): Likewise.
1072         * mknod.c (main): Likewise.
1073         * tests/mkdir/perm: Test for the above bug.
1074
1075 2005-04-20  Paul Eggert  <eggert@cs.ucla.edu>
1076
1077         Port test cases to Microsoft-Windows-related environments,
1078         following suggestions from Eric Blake.
1079         * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
1080         * tests/install/basic-1: Undo previous change.
1081         (dd, dd2): New vars, which use $EXEEXT.  All uses of dd and dd2 changed.
1082         * tests/install/trap: Undo previous change.
1083         (sig): New var.  Use it insted of "trap '' CHLD".
1084         Append $EXEEXT to executable name.
1085
1086         "fetish" -> "coreutils" in more places.
1087         * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
1088         (package Coreutils): Renamed from package Fetish.  All uses changed.
1089         * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
1090         remove Fetish.pm.
1091
1092 2005-04-19  Paul Eggert  <eggert@cs.ucla.edu>
1093
1094         * tests/mv/setup (dot_mount_point): Use stat -L, in case the
1095         directory is actually a symbolic link.  Problem reported by
1096         Eric Blake.
1097
1098         * tests/mv/mv-special-1: Use test -p to test for fifos, rather
1099         than the (incorrect) test -f and the (inadequate) ls.  ls is
1100         inadequate because on some hosts a buggy mv will create a file of
1101         the wrong type (problem reported by Eric Blake).  Skip this test
1102         if test -p doesn't work.
1103
1104         * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
1105         since the latter can have shell metacharacters in them (e.g., spaces).
1106         This follows up to the 2005-01-17 patch, which missed this occurrence.
1107
1108 2005-04-18  Paul Eggert  <eggert@cs.ucla.edu>
1109
1110         "fetish" -> "coreutils" in several places.
1111         * Makefile.cfg (ftp): Remove fetish.sf.net.
1112         * Makefile.maint (emit_upload_commands): Likewise.
1113         * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
1114         * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
1115         * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
1116
1117         * tests/install/basic-1: Use "cat", not "test", to test for
1118         ../../src/dd.  Problem reported by Eric Blake.
1119
1120 2005-04-18  Jim Meyering  <jim@meyering.net>
1121
1122         * src/dd.c: Don't include stat-macros.h directly.  system.h does that.
1123
1124 2005-04-17  Paul Eggert  <eggert@cs.ucla.edu>
1125
1126         Work around a couple of "make check" failures reported for Cygwin
1127         and ash by Eric Blake.
1128         * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
1129         * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
1130
1131 2005-04-16  Jim Meyering  <jim@meyering.net>
1132
1133         * src/dd.c (S_TYPEISSHM): Remove definition.
1134         Get the definition by including "stat-macros.h", instead.
1135
1136 2005-04-14  Paul Eggert  <eggert@cs.ucla.edu>
1137
1138         Fix test suite problems reported by Eric Blake on Cygwin.
1139         * tests/mv/mv-special-1: Ignore chatter about when files are removed,
1140         since POSIX doesn't require rename to fail across file systems.
1141         * tests/mv/setup (dot_mount_point): Use stat rather than df, as
1142         it's more reliable.
1143         (other_partition_tmpdir): Remove df from name as that would be
1144         misleading now.
1145
1146 2005-04-14  Jim Meyering  <jim@meyering.net>
1147
1148         * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
1149
1150 2005-04-12  Paul Eggert  <eggert@cs.ucla.edu>
1151
1152         * src/ls.c (usage): "uid" -> "user ID".
1153
1154 2005-04-12  Jim Meyering  <jim@meyering.net>
1155
1156         * src/tsort.c (tsort): Use "%s" as the format string,
1157         rather than a diagnostic or a file name.
1158
1159         * src/comm.c (compare_files): Remove declaration of unused local.
1160
1161         * src/chown-core.c (chopt_free): Mark parameter as unused.
1162
1163 2005-04-11  Paul Eggert  <eggert@cs.ucla.edu>
1164
1165         * man/chown.x: Reword to match user manual.
1166         * man/id.x: Likewise.
1167         * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
1168         for "group ID".
1169         * src/whoami.c (usage, main): Likewise.
1170
1171         Add bulletproofing for cases where stdin, stdout, or stderr are closed.
1172         * src/comm.c: Include stdio-safer.h.
1173         (compare_files): Exit right away on I/O error rather than continuing
1174         and producing confusing output and error messages.
1175         Return void, not int; all callers changed.
1176         Use fopen_safer to avoid confusion with file descriptors.
1177         * src/copy.c: Include unistd-safer.h.
1178         (copy_reg): Use fd_safer.
1179         * src/csplit.c: Include stdio-safer.h.
1180         (input_desc): Remove unnecessary static initialization.
1181         (set_input_file): Use STDIN_FILENO, not 0.
1182         (create_output_file): Use fopen_safer.
1183         * src/dircolors.c (dc_parse_file): Don't assume fopen does not
1184         return stdin.
1185         * src/head.c (head_file): Don't assume open does not return 0.
1186         * src/join.c: Include stdio-safer.h.
1187         (main): Use fopen_safer.  Simplify the resulting code.
1188         * src/md5sum.c (digest_file, digest_check):
1189         Don't assume that fopen does not return stdin.
1190         * src/nohup.c: Include unistd-safer.h.
1191         (main): Don't dup stderr to stdin or stdout by mistake.
1192         * src/od.c (check_and_close): Don't assume fopen does not return stdin.
1193         * src/paste.c (paste_serial): Likewise.
1194         * src/pr.c: Include stdio-safer.h.
1195         (open_file): Use fopen_safer.
1196         (close_file): Don't assume fopen does not return stdin.
1197         * src/ptx.c (main): Don't assume fopen returns stdout after closing
1198         stdout.  Use freopen instead.
1199         * src/shred.c: Include unistd-safer.h.
1200         (wipename): Use fd_safer on directory file descriptor.
1201         (wipefile): Remove special case for /dev/fd/* on older hosts.
1202         It didn't work in general, and wasn't documented.
1203         Use fd_safer.
1204         * src/sort.c: Include unistd-safer.h.
1205         (create_temp_file): Use fd_safer.
1206         (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
1207         * src/split.c: Include unistd-safer.h.
1208         (cwrite): Use fd_safer.  Replace mystery constant 0666 with symbolic
1209         version, as POSIX requires.
1210         * src/sum.c (bsd_sum_file, sysv_sym_file):
1211         Use same pattern as elsewhere for checking for stdin.
1212         * src/tac.c: Include unistd-safer.h.
1213         (copy_to_temp): Use fd_safer.
1214         (tac_file): Don't assume fopen cannot return stdin.
1215         * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
1216         (recheck, tail_file): Use fd_safer rather than open_safer.
1217         * src/tee.c: Include stdio-safer.h.
1218         (tee): Use fopen_safer.
1219         * src/touch.c: Include unistd-safer.h.
1220         (touch): Use fd_safer.
1221         * src/tsort.c (have_read_stdin): Remove; no longer needed.  All uses
1222         removed.
1223         (tsort): Do not assume fopen can't return stdin.
1224         Close stdin before returning.  All uses changed.
1225         * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
1226         * src/uniq.c: Include stdio_safer.h.
1227         (check_file): Don't assume fopen cannot return stdin or stdout.
1228
1229 2005-04-09  Jim Meyering  <jim@meyering.net>
1230
1231         * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
1232
1233         Now that close_stdout closes standard output unconditionally,
1234         these workarounds for dd and cat are no longer necessary.
1235         * src/dd.c (close_stdout_wrapper): Remove function.
1236         (main): Call atexit with close_stdout, instead.
1237         * src/cat.c (close_stdout_wrapper): Likewise.
1238         Don't close STDOUT_FILENO explicitly; close_stdout does it.
1239
1240         * src/system.h (__attribute__): Readability nit:
1241         Change this:
1242         #  define __attribute__(x)
1243         to this:
1244         #  define __attribute__(x) /* empty */
1245
1246 2005-04-09  Jim Meyering  <jim@meyering.net>
1247
1248         * src/rm.c (usage): Mention that --recursive removes listed
1249         directories too, not just their contents.
1250         Say that by default, rm does not remove directories.
1251
1252         * src/pr.c: Don't include "timespec.h".  system.h does that.
1253         * Makefile.maint (sc_system_h_headers): Propagate exit status
1254         through trap.
1255
1256 2005-04-08  Paul Eggert  <eggert@cs.ucla.edu>
1257
1258         * NEWS: Document that dd no longer treats QUIT or PIPE specially,
1259         and when conforming to POSIX no longer treats USR1 specially.
1260         Document that dd no longer dumps core when handling signals.
1261         * src/system.h (RETSIGTYPE): Remove; no longer needed.  All uses
1262         replaced with void.
1263         * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
1264         All uses changed.
1265         (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
1266         (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
1267         behavior when called from a signal handler.  All uses changed.
1268         (main) [!defined SA_NOCLDSTOP]:
1269         Use siginterrupt to specify that system calls should be interrupted.
1270         * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
1271         (process_signals): Add forward decl.
1272         (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
1273         New macros.
1274         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1275         (SA_NODEFER) [!defined SA_NODEFER]: New macro.
1276         (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
1277         (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
1278         New vars.
1279         (usage): Mention -USR1 versus -INFO.
1280         (cleanup): Don't invoke print_stats; the caller must do it now.
1281         All callers changed.
1282         (quit): Process signals just before exiting.
1283         (interrupt_handler): Simply record the signal and return.
1284         (siginfo_handler): Simply increment the signal counter and return.
1285         (install_handler): Remove, replacing with:
1286         (install_signal_handlers, process_signals, iread, iwrite):
1287         New functions.  All callers to safe_read and full_write replaced
1288         by iread and iwrite.  All callers to install_handler replaced by
1289         install_handlers.
1290         * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
1291         All uses changed.
1292         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1293         (main) [! SA_NOCLDSTOP]: Use it.
1294         * src/shred.c: Remove all uses of signals; modern hosts have
1295         /dev/random and don't need this gorp.
1296         Do not include signal.h.
1297         (env, sigill_handler, isaac_seed_machdep): Remove.  All uses removed.
1298         * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
1299         All uses changed.
1300         (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
1301         (main) [! SA_NOCLDSTOP]: Use it.
1302
1303         * src/dd.c: Do not include inttostr.h, no longer needed.
1304         (print_stats, main): Rewrite and simplify formats to use PRIuMAX
1305         instead of umaxtostr.
1306         (print_stats): Work even in languages that have special
1307         forms for two of things, for r_truncate and w_bytes.  We can't
1308         fix delta_s in this way, since ngettext doesn't support floating-point.
1309         (main): Rewrite to avoid casts.
1310
1311 2005-04-07  Jim Meyering  <jim@meyering.net>
1312
1313         Placate gcc-4's -Wuninitialized.
1314         * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
1315         * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
1316
1317         * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
1318         be `const'.
1319         (binop): Move function definition to precede first use so we can...
1320         (binop): ...remove prototype.
1321
1322 2005-04-05  Paul Eggert  <eggert@cs.ucla.edu>
1323
1324         * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
1325         * src/basename.c (usage): Add examples.
1326         * src/cat.c (usage): Likewise.
1327         * src/chgrp.c (usage): Likewise.
1328         * src/chown.c (usage): Likewise.
1329         * src/dirname.c (usage): Likewise.
1330
1331 2005-04-05  Jim Meyering  <jim@meyering.net>
1332
1333         * src/nice.c (usage): Mention that some shells provide a
1334         built-in function by the same name.
1335         * src/nohup.c (usage): Likewise.
1336         * src/printenv.c (usage):Likewise.
1337
1338 2005-04-04  Dmitry V. Levin  <ldv@altlinux.org>
1339
1340         * src/tee.c (tee): When closing files, do not close stdout,
1341         leave this job to close_stdout() instead.
1342         * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
1343         * tests/Makefile.am (SUBDIRS): Add tee.
1344         * tests/tee/Makefile.am: New file.
1345         * tests/tee/.cvsignore: Likewise.
1346         * tests/tee/{basic,dash}: New tee tests.
1347
1348 2005-04-04  Jim Meyering  <jim@meyering.net>
1349
1350         * src/echo.c (usage): Mention that some shells provide a
1351         built-in function by the same name.
1352         * src/kill.c (usage): Likewise
1353         * src/printf.c (usage): Likewise.
1354         * src/pwd.c (usage): Likewise.
1355         * src/stat.c (usage): Likewise.
1356         * src/test.c (usage): Likewise.
1357         * src/true.c (usage):
1358         * src/system.h (USAGE_BUILTIN_WARNING): New macro.
1359
1360         * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
1361         * man/printf.x: Likewise.
1362         * man/pwd.x: Likewise.
1363
1364 2005-04-03  Jim Meyering  <jim@meyering.net>
1365
1366         * src/pr.c (main): Fix off-by-one error.
1367         pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
1368         end of a malloc'd buffer.
1369
1370 2005-04-01  Jim Meyering  <jim@meyering.net>
1371
1372         * src/pr.c (main): Free column_count_string when done with it.
1373
1374         Don't let pr treat +1:-1 like +1:18446744073709551615.
1375         * src/pr.c (strtoumax): Remove declaration.
1376         (first_last_page): Use xstrtoumax in place of strtoumax,
1377         so we don't interpret a negative page number (e.g., in an option
1378         like --pages=1:-1) as valid.
1379         * tests/pr/Test.pm (neg-page): Add a test for this.
1380
1381 2005-03-30  Paul Eggert  <eggert@cs.ucla.edu>
1382
1383         * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
1384         * src/uptime.c (uptime): New arg OPTIONS.  All uses changed.
1385         * src/users.c (users): Likewise.
1386         * src/who.c (who): Likewise.
1387         * src/uptime.c (main): Check PIDs when invoked with zero arguments.
1388         * src/users.c (main): Likewise.
1389         * src/who.c (main): Likewise.  Also with two arguments.
1390         Omit duplicate code in 2-arg case.
1391         (UT_PID): Moved to ../lib/readutmp.h.
1392
1393 2005-03-29  Jim Meyering  <jim@meyering.net>
1394
1395         * src/system.h (ptr_align): Declare `ptr' parameter to be a
1396         `const' pointer, since this function never writes through it.
1397
1398         * src/uname.c: Indent cpp directives to reflect nesting.
1399
1400 2005-03-28  Jim Meyering  <jim@meyering.net>
1401
1402         * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
1403         Add `void' to make this an ANSI-style function declaration.
1404         * src/remove.c (ds_init): Likewise.
1405         * src/pr.c (print_sep_string): Likewise.
1406
1407         * src/stty.c (speeds): Declare this array to be static.
1408         * src/Makefile.am (sc_tight_scope): Adjust to catch any
1409         new declarations like that of stty.c's `speeds'.
1410
1411         * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
1412         (GETOPT_VERSION_OPTION_DECL): Likewise.
1413         * src/chown.c (long_options): Likewise.
1414         * src/chgrp.c (long_options): Likewise.
1415         * src/chmod.c (long_options): Likewise.
1416         * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
1417         Likewise.
1418         * src/chown-core.c (chopt_init): Likewise.
1419         * src/comm.c (long_options): Likewise.
1420         * src/copy.c (copy_reg): Likewise.
1421         * src/csplit.c (extract_regexp): Likewise.
1422         * src/cut.c (longopts): Likewise.
1423         * src/date.c (time_spec_string): Likewise.
1424         * src/df.c (find_mount_point, show_point): Likewise.
1425         * src/expr.c (docolon): Likewise.
1426         * src/fmt.c (long_options): Likewise.
1427         * src/ls.c (time_style_args, indicator_style_args, long_options)
1428         (format_args, sort_args, time_args, decode_switches)
1429         (gobble_file): Likewise.
1430         * src/md5sum.c (long_options): Likewise.
1431         * src/mv.c (reply_args): Likewise.
1432         * src/paste.c (longopts): Likewise.
1433         * src/pinky.c (print_entry): Likewise.
1434         * src/pr.c (long_options): Likewise.
1435         * src/ptx.c (long_options, format_args): Likewise.
1436         * src/readlink.c (longopts): Likewise.
1437         * src/sort.c (long_options, mergefps): Likewise.
1438         * src/stat.c (long_options): Likewise.
1439         * src/tac.c (main): Likewise.
1440         * src/tail.c (follow_mode_string): Likewise.
1441         * src/touch.c (longopts, time_args): Likewise.
1442         * src/uniq.c (delimit_method_string): Likewise.
1443         * src/uptime.c (print_uptime): Likewise.
1444         * src/who.c (print_user): Likewise.
1445
1446 2005-03-27  Jim Meyering  <jim@meyering.net>
1447
1448         * src/dcgen: Simplify further, clean up.
1449         Add a standard-output-closing global destructor.
1450         Require perl-5.002.
1451         * src/wheel-gen.pl: Use the same global destructor as dcgen.
1452
1453 2005-03-26  Paul Eggert  <eggert@cs.ucla.edu>
1454
1455         * src/dcgen: Squeeze multiple blanks into one.  Output a simple
1456         array of adjacent strings rather than a more complicated data
1457         structure; this saves space in the dircolors executable.
1458         * src/dircolors.c (parse_line): Use char *, not unsigned char *.
1459         This avoids casts.
1460         (dc_parse_stream, main): Avoid casts.
1461         Adjust to simpler data structure generated by new dcgen.
1462
1463 2005-03-25  Eric Blake  <ebb9@byu.net>  (tiny change)
1464
1465         * src/ls.c (usage): Document usage of LS_COLORS.
1466
1467 2005-03-25  Paul Eggert  <eggert@cs.ucla.edu>
1468
1469         * src/dircolors.hin: Add "TERM cygwin".
1470
1471 2005-03-25  Jim Meyering  <jim@meyering.net>
1472
1473         * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
1474         the return value, and update callers:
1475         * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
1476         * src/expand.c (parse_tab_stops, main): Likewise.
1477         * src/split.c (main): Likewise.
1478         * src/unexpand.c (parse_tab_stops, main): Likewise.
1479         * src/uniq.c (main): Likewise.
1480
1481 2005-03-22  Jim Meyering  <jim@meyering.net>
1482
1483         * build-aux: New directory.  Renamed from config.
1484         * configure.ac: Reflect renaming: config -> build-aux.
1485         * Makefile.am (dist-hook): Likewise.
1486         * Makefile.maint: Likewise.
1487         * Makefile.cfg (cvs_files): Likewise.
1488         * .x-sc_sun_os_names: Likewise.
1489         * .x-sc_trailing_blank: Likewise.
1490
1491         * src/ls.c (get_funky_string): Use '\a', rather than 7, for
1492         portability to EBCDIC hosts.
1493
1494 2005-03-20  Jim Meyering  <jim@meyering.net>
1495
1496         * src/pr.c (init_header): Add missing `%' in new format string.
1497         (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
1498
1499 2005-03-19  Jim Meyering  <jim@meyering.net>
1500
1501         * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
1502         $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
1503
1504 2005-03-18  Paul Eggert  <eggert@cs.ucla.edu>
1505
1506         * NEWS: pr -D "FORMAT" now accepts the same formats that
1507         date +"FORMAT" does.
1508         * src/pr.c: Include strftime.h, timespec.h.
1509         (init_header): Obtain and format nanosecond part of time stamp.
1510
1511         * NEWS: nohup now ignores the umask when creating nohup.out.
1512         nohup now closes stderr if it is a terminal and stdout is closed.
1513         * src/nohup.c (main): Likewise.  Be a little more paranoid about
1514         return values; e.g., check for any negative return from open.
1515         Assume free (NULL) works.
1516         Close file descriptor leak when redirecting standard output to a file.
1517
1518 2005-03-17  Jim Meyering  <jim@meyering.net>
1519
1520         * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
1521         in place of functionally-equivalent code.
1522         * src/expand.c (parse_tab_stops, main): Likewise.
1523         * src/split.c (main): Likewise.
1524         * src/unexpand.c (parse_tab_stops, main): Likewise.
1525         * src/uniq.c (main): Likewise.
1526         * src/od.c: Use VERIFY macro in place of an equivalent open-coded
1527         declaration.
1528         * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
1529         New macros.
1530
1531         Before, this command would make uniq skip 11 fields and print
1532         only the first line:
1533         $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
1534         1 1
1535         1 2
1536         * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
1537         not like `uniq -f11'.
1538
1539 2005-03-15  Jim Meyering  <jim@meyering.net>
1540
1541         Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
1542         `pr -0' should give a better diagnostic and `pr -03' should be
1543         equivalent to `pr -3'.
1544         * src/pr.c (parse_column_count): Change return type to void.
1545         Call error (EXIT_FAILURE, ... for an invalid string.
1546         (main): Allocate space for column_count_string using malloc.
1547         Accumulate all old-style column-count digits before converting.
1548         When the number of columns is specified via both old-style,
1549         (e.g., -3), and a long option (--columns=5), ensure that only
1550         the last one specified takes effect.
1551         * tests/pr/Test.pm: Add tests for the above.
1552
1553 2005-03-15  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1554
1555         * src/copy.c (copy_reg): Copy regular files in binary mode.
1556
1557 2005-03-14  Paul Eggert  <eggert@cs.ucla.edu>
1558
1559         * NEWS: Restate why ls limits time stamp lengths.
1560
1561 2005-03-12  Jim Meyering  <jim@meyering.net>
1562
1563         Add a little infrastructure to help prevent future bugs like the
1564         one fixed below.
1565         * src/stat.c (xstrcat): New function.
1566         (print_statfs, print_stat): Add buf_len parameter and convert all
1567         uses of strcat to xstrcat.  Update callers.
1568         (print_it): Call print_func with buf_len parameter.
1569
1570         Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
1571         could cause a buffer overrun error.
1572         * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
1573         conversion of the stat %s format string to the longer printf %llu one.
1574         Patch from Guochun Shi.
1575
1576 2005-03-11  Paul Eggert  <eggert@cs.ucla.edu>
1577
1578         * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
1579         (long_time_expected_width, print_long_format): Use it, to avoid
1580         some possible denial-of-service attacks.
1581         * NEWS: Document this.
1582
1583 2005-03-11  Jim Meyering  <jim@meyering.net>
1584
1585         Prompt once again for `mv -i A B' when A and B are hard links
1586         to the same file.  This fixes a bug introduced by my 2003-04-04
1587         (coreutils-5.0.1) change.  Reported by Thomas Wolff via Eric Blake.
1588         * src/copy.c (abandon_move): New function, factored out of
1589         copy_internal, now that this code is being used from two places.
1590         (copy_internal): Perform the same interactive-related test for
1591         whether it's alright to proceed and (usually) overwrite the
1592         destination file.
1593         * tests/mv/i-4: Add tests for the above.
1594
1595         Don't segfault for a very long date format string, e.g.,
1596         ls -ld --time-style=+%99999999H .
1597         * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
1598         so format string abuse cannot provoke stack overflow.
1599         (print_long_format): Likewise.
1600
1601         Don't segfault for a long header date string, e.g.,
1602         echo a|pr -D +%9999999A
1603         * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
1604         Don't bother with fixed-sized initial buffer;  always use x*alloc.
1605
1606         * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
1607         in place of equivalent INT_STRLEN_BOUND + 1.
1608         * src/expr.c (tostring, printv): Likewise.
1609
1610 2005-03-09  Paul Eggert  <eggert@cs.ucla.edu>
1611
1612         * src/system.h: Include intprops.h.
1613         (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1614         they are now defined in intprops.h.
1615
1616 2005-03-09  Jim Meyering  <jim@meyering.net>
1617
1618         * TODO: Remove entry about named pipes.  It was fixed in 5.3.0.
1619
1620 2005-03-08  Paul Eggert  <eggert@cs.ucla.edu>
1621
1622         * src/date.c (usage): Redo to match recent documentation changes.
1623         Don't bother documenting which usages are GNU extensions; the list
1624         wasn't correct, and is better left to the printed manual anyway.
1625
1626 2005-03-06  Jim Meyering  <jim@meyering.net>
1627
1628         Factor out column-count processing.
1629         * src/pr.c: Include "inttostr.h".
1630         (parse_column_count): New function.
1631         (main): Use the new function for both old-style, -9, and long,
1632         --columns=-9, options.
1633
1634         * src/cksum.c: Remove `register' keyword.
1635         * src/cut.c: Likewise.
1636         * src/dd.c: Likewise.
1637         * src/env.c: Likewise.
1638         * src/factor.c: Likewise.
1639         * src/fmt.c: Likewise.
1640         * src/fold.c: Likewise.
1641         * src/id.c: Likewise.
1642         * src/logname.c: Likewise.
1643         * src/ls.c: Likewise.
1644         * src/pr.c: Likewise.
1645         * src/printf.c: Likewise.
1646         * src/shred.c: Likewise.
1647         * src/sort.c: Likewise.
1648         * src/sum.c: Likewise.
1649         * src/test.c: Likewise.
1650         * src/tsort.c: Likewise.
1651         * src/uniq.c: Likewise.
1652         * src/wc.c: Likewise.
1653         * src/whoami.c: Likewise.
1654
1655 2005-03-01  Paul Eggert  <eggert@cs.ucla.edu>
1656
1657         * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1658         longer needed.
1659
1660 2005-03-01  Jim Meyering  <jim@meyering.net>
1661
1662         * src/copy.c (copy_internal): Change test of source type from
1663         !S_ISREG to S_ISLNK.  Reported by Paul Eggert in
1664         http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1665
1666 2005-02-28  Jim Meyering  <jim@meyering.net>
1667
1668         * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1669
1670 2005-02-21  Paul Eggert  <eggert@cs.ucla.edu>
1671
1672         * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1673         (nanosec_libs): Add $(LIB_XNANOSLEEP).  Needed for newer GNU/Linux
1674         hosts with clock_gettime.
1675
1676 2005-02-20  Paul Eggert  <eggert@cs.ucla.edu>
1677
1678         * NEWS: Describe user-visible change to dd.
1679         * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1680         Remove $(LIB_CLOCK_GETTIME).  These functions now use
1681         gethrxtime instead.
1682         * src/dd.c: Include gethrxtime.h, xtime.h.
1683         (start_time): Now of type xtime_t, not struct timespec.
1684         (print_stats, main): Use gethrxtime rather than gettime.
1685         * src/ls.c (time): Remove obsolete decl.
1686         (get_current_time): gettimeofday always returns 0, so don't
1687         check its result.
1688         * src/shred.c: Include gethrxtime.h.
1689         (isaac_seed): Use gethrxtime rather than a mishmash.
1690         * src/touch.c (time): Remove obsolete decl.
1691
1692         * tests/misc/split-fail: Don't assume that the current host
1693         supports integers wider than 32 bits.  Fix comment typo.
1694         * tests/od/x8: Likewise.
1695
1696         * src/chown-core.c (enum RCH_status): Remove trailing comma,
1697         as it's not valid in standard C89.
1698
1699 2005-02-15  Jim Meyering  <jim@meyering.net>
1700
1701         * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1702         so that file systems of type `xfs' are recognized as such.
1703         * src/fs.h: Regenerate.
1704         Reported by Bernd Eckenfels.
1705         * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1706         * src/fs.h: Regenerate.
1707         Reported by Andreas Schwab.
1708
1709         * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1710         to work around the invalid definition from Darwin 7.7.0.
1711         Test failure reported by Sébastien Maret.
1712
1713 2005-02-14  Paul Eggert  <eggert@cs.ucla.edu>
1714
1715         * src/sort.c (mergefps): Use binary search rather than linear one
1716         when comparing new line to lines already in main memory.
1717         Idea suggested by James Lemley.
1718
1719 2005-02-09  Jim Meyering  <jim@meyering.net>
1720
1721         * src/copy.c (valid_options): Add an assertion that
1722         not both hard_link and symbolic_link are set.
1723
1724 2005-02-08  Paul Eggert  <eggert@cs.ucla.edu>
1725
1726         * NEWS: Document stat -f -c %S, plus changes to default formats.
1727         * doc/coreutils.texi (stat invocation): Normalize terminology,
1728         capitalization, and sort order to match --help output.  Mention %c
1729         for file systems.  Add new -f -c format %S, and document %s versus %S;
1730         problem reported by Jeroen van Wolffelaar.
1731         * src/stat.c (usage): Likewise.
1732         (STATFS_FRSIZE): New macro.
1733         (print_statfs): Use it, for stat -f -c %S.
1734         (do_statfs): Change default formats to output %S.
1735
1736 2005-02-03  Paul Eggert  <eggert@cs.ucla.edu>
1737
1738         * src/system.h: Include "memrchr.h".
1739         (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1740
1741 2005-02-02  Jim Meyering  <jim@meyering.net>
1742
1743         * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1744         systems that don't support sparse files.
1745         Check for $2 -ge 128, rather than $2 = 128, in case
1746         there is a file system type that doesn't support sparse files,
1747         yet for which metadata takes up additional space.
1748         Both reported by Andreas Schwab.
1749
1750 2005-02-01  Eric Blake  <ebb9@byu.net>  (tiny change)
1751
1752         * tests/du/8gb: Create a larger test file, so we properly
1753         detect that sparse files can be created on NTFS under cygwin.
1754
1755 2005-01-30  Jim Meyering  <jim@meyering.net>
1756
1757         * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1758
1759         * src/stty.c: Remove unnecessary parentheses in all #if directives.
1760
1761 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1762
1763         * .cvsignore: Ignore config.cache and config.status.lineno.
1764         * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1765         instead of VSWTCH, for use with CSWTCH.
1766
1767 2005-01-29  Eric Blake  <ebb9@byu.net>  (tiny change)
1768
1769         * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1770         * tests/rwx-to-mode: Ignore ACL designation.
1771         * tests/setgid-check: Likewise.
1772         * tests/chown/separator: Quote user and group names.
1773
1774 2005-01-24  Jim Meyering  <jim@meyering.net>
1775
1776         * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1777         Suggestion from Johan Boule.
1778
1779 2005-01-17  Eric Blake  <ebb9@byu.net>  (tiny change)
1780
1781         * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1782         duplicates.
1783         * man/Makefile.am (all_programs): Revert previous patch; updated
1784         all_programs.list fixes this.
1785         (.x.1): No need to add $(EXEEXT).
1786
1787 2005-01-03  Corinna Vinschen  <corinna@vinschen.de>  (tiny change)
1788
1789         * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1790         available.
1791
1792 2005-01-22  Jim Meyering  <jim@meyering.net>
1793
1794         * Makefile.maint (v_etc_file): The version string has moved to
1795         version-etc-fsf.c, search that new file, not version-etc.c.
1796
1797 2005-01-17  Paul Eggert  <eggert@cs.ucla.edu>
1798
1799         * tests/group-names: Use numeric group ids, not symbolic group names,
1800         since the latter can have shell metacharacters in them (e.g., spaces).
1801         Problem reported by Eric Blake.
1802         * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1803         * tests/chgrp/deref: Likewise.
1804         * tests/chgrp/posix-H: Likewise.
1805         * tests/chgrp/recurse: Likewise.
1806
1807 2005-01-15  Jim Meyering  <jim@meyering.net>
1808
1809         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1810         because just calling gethrtime evokes an `illegal instruction'
1811         failure when compiled with Sun's c89 on Solaris 8 and 9.
1812         Reported by Nelson Beebe.
1813
1814         * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1815         twice with the same value of `t'.
1816         Replace nested #if-#else blocks with #if-#elif-#elif chain.
1817
1818 2005-01-14  Jim Meyering  <jim@meyering.net>
1819
1820         The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1821         * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1822         sockets, since that's what you get when reading from a command-line-
1823         supplied pipe on Darwin 7.7.
1824         (IS_PIPE_LIKE_FILE_TYPE): Define.
1825         (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1826         Reported by Nelson Beebe.
1827         This same change is also required on NetBSD/sparc-1.5.
1828         Reported by Adrian Bunk.
1829
1830         * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1831         rather than suffering silently.
1832         Before, expr would silently overflow and wrap around:
1833           $ expr 9223372036854775808 = 0   # $(echo 2^63|bc)
1834           1
1835         Now it detects the problem and exits nonzero:
1836           $ ./expr $(echo 2^63|bc) = 0
1837           ./expr: 9223372036854775808: integer is too large
1838
1839         * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1840         failure, so that doesn't cause `make check' to stop.  Nelson Beebe
1841         reported that this test would fail with the diagnostic,
1842         `cannot find name for group ID 10', on one of his systems.
1843
1844 2005-01-13  Jim Meyering  <jim@meyering.net>
1845
1846         * src/test.c (is_int): Don't overflow when evaluating integer
1847         constants.  Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1848         would print `FAIL'.
1849
1850         * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1851         names of temporary files that would clash on 8.3 file systems.
1852         * tests/mk-script (validate): Likewise.
1853
1854 2005-01-12  Jim Meyering  <jim@meyering.net>
1855
1856         * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1857
1858         * tests/tr/Test.pm (repeat-xC): Change test name from
1859         `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1860         Reported by Eric Blake.
1861         (repeat-000): Rename to `repeat-zeros' for the same reason.
1862
1863 2005-01-11  Jim Meyering  <jim@meyering.net>
1864
1865         * configure.ac: Update version to 5.3.1.
1866
1867 2005-01-11  Eric Blake  <ebb9@byu.net>
1868
1869         * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1870         * man/Makefile.am (all_programs): Account for $(EXEEXT).
1871
1872 2005-01-11  Jim Meyering  <jim@meyering.net>
1873
1874         * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1875         with decreasing values.
1876
1877         * src/expand.c (main): Likewise.
1878         * src/unexpand.c (main): Check for overflow in tabstop values
1879         specified via the obsolete form.  E.g., now this command fails:
1880         _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1881         Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1882         * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1883
1884 2005-01-10  Paul Eggert  <eggert@cs.ucla.edu>
1885
1886         Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1887         * NEWS: Document the changes.
1888         * doc/coreutils.texi (pathchk invocation): Likewise.
1889         * src/pathchk.c (PORTABILITY_OPTION): New constant.
1890         (longopts, usage, main, validate_file_name):
1891         Add support for new -P option.
1892         Reject empty file names (unless -p is not specified and the
1893         current system allows empty file names).
1894         Change --portability so that is now equivalent to -p -P.
1895         Don't test whether file name is too long, if it is known to exist.
1896         (no_leading_hyphen): New function.
1897         * tests/misc/pathchk1: Add tests for empty file names and
1898         pathchk -P.
1899
1900 2005-01-08  Jim Meyering  <jim@meyering.net>
1901
1902         * Version 5.3.0.
1903
1904         `pr --columns=N' was not equivalent to `pr -N' when also using
1905         either -s or -w.
1906
1907         * src/pr.c (main): Set `explicit_columns' for --columns=N,
1908         not just for -N.  This bug has existed since the introduction
1909         of the --columns=N option on 1998-08-15.
1910         * NEWS: Document this.
1911         * tests/pr/Test.pm (test_vector): For each -N test, automatically
1912         create a new test vector using --columns=N.
1913
1914 2005-01-07  Paul Eggert  <eggert@twinsun.com>
1915
1916         * src/pr.c (main): Check for column count overflow with
1917         usages like "pr -2147483648".
1918
1919 2005-01-07  Jim Meyering  <jim@meyering.net>
1920
1921         * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1922
1923 2005-01-06  Jim Meyering  <jim@meyering.net>
1924
1925         * README: List the precise HP-UX version numbers that are affected.
1926         Suggestion from Bob Proulx.
1927
1928         * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1929         predicate before `-name ChangeLog' to avoid a harmless warning
1930         from find-4.2.10.
1931
1932 2005-01-05  Jim Meyering  <jim@meyering.net>
1933
1934         * tests/help-version: Punt on the uptime test, since it fails when
1935         it can't get boot time, and I don't want that to stop `make check'.
1936
1937         * src/du.c (process_file): Evaluate exclusion rules against
1938         the entire file name, not just the last component.
1939         Reported by Robert Lindgren.
1940         * tests/du/exclude: Test for this.
1941         * NEWS: Document this.
1942
1943         Ensure that tests/Makefile.am's check-root actions stay up to date.
1944         * Makefile.maint (sc_root_tests): New rule.
1945         (syntax-check-rules): Add it to the list.
1946
1947 2005-01-04  Jim Meyering  <jim@meyering.net>
1948
1949         * man/shred.x: Change one-line summary to reflect that shred does
1950         not remove files by default.  Suggestion from Helen Faulkner in
1951         http://bugs.debian.org/288552
1952
1953         * README: Request VERBOSE=yes output when reporting test failures.
1954         Other minor changes.
1955
1956         * tests/Makefile.am (check-root): Update.
1957
1958 2005-01-03  Paul Eggert  <eggert@cs.ucla.edu>
1959
1960         * src/system.h: Undo previous change; we now use Autoconf.
1961
1962 2005-01-03  Jim Meyering  <jim@meyering.net>
1963
1964         * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1965         a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems.  Setting
1966         either (or both) to zero would succeed, but subsequent `stty size'
1967         would say `no size information for this device' due to the ioctl
1968         failing with EINVAL.
1969
1970         * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1971         not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1972         then fail at compile-time rather than let tools like od produce
1973         invalid results at run time.
1974
1975 2004-12-21  Jim Meyering  <jim@meyering.net>
1976
1977         * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1978         not `xx01, xx02, ...'.
1979         Reported by Matt Kraai in http://bugs.debian.org/286605
1980
1981         * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1982         when using c89.
1983
1984 2004-12-20  Paul Eggert  <eggert@cs.ucla.edu>
1985
1986         * src/split.c (usage): Mention default size.  Suggested by Dan Jacobson.
1987
1988 2004-12-19  Paul Eggert  <eggert@cs.ucla.edu>
1989
1990         * NEWS: Mention that one should eval "`dircolors`" rather than
1991         `dircolors`.
1992
1993 2004-12-17  Jim Meyering  <jim@meyering.net>
1994
1995         * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1996         so temporary directories aren't left behind upon e.g., interrupt.
1997
1998 2004-12-16  Paul Eggert  <eggert@cs.ucla.edu>
1999
2000         * src/ls.c (print_dir): Use "%s: not listing already-listed
2001         directory", not "not listing already-listed directory: %s", to
2002         format already-listed directories, to be consistent with other
2003         diagnostics involving file names and colons.
2004
2005 2004-12-15  Jim Meyering  <jim@meyering.net>
2006
2007         * src/Makefile.am (__LDADD): Define, so that building `[' on
2008         Solaris still uses the -lgen library that it requires in order
2009         to get a definition of eaccess.
2010
2011 2004-12-14  Jim Meyering  <jim@meyering.net>
2012
2013         tac would exit immediately upon I/O or temp-file creation failure.
2014         Now it continues on, processing any remaining command line arguments.
2015
2016         * src/tac.c: Include quotearg.h.
2017         Use quotearg_colon in most diagnostics.
2018         (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
2019         failure.  Before, this command (with /full/tmp being a full partition)
2020           TMPDIR=/full/tmp ./tac /proc/modules tac.c
2021         would exit immediately upon the write error while trying to copy
2022         non-seekable /proc/modules to the full partition.  Now it still
2023         reports the failure but continues on with the remaining file.
2024         (tac_nonseekable): Return false also if copy_to_temp fails.
2025         [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
2026         using atexit like this is wrong.
2027         * NEWS: Document this.
2028         * tests/misc/tac-continue: New test for this.
2029         * tests/misc/Makefile.am (TESTS): Add tac-continue.
2030
2031         * tests/chown/basic: Add a few more tests.
2032
2033 2004-12-13  Paul Eggert  <eggert@cs.ucla.edu>
2034
2035         * src/ls.c (gobble_file): Change arg name to be command_line_arg
2036         rather than explicit_arg, for consistency with copy.c.
2037         (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
2038         it is deducible from dirname arg.  All callers changed.
2039         (extract_dirs_from_files, print_dir, queue_directory):
2040         Add command_line_arg arg.  All callers changed.
2041         (struct pending): Add command_line_arg member.
2042         (main): Use NULL rather than 0 when appropriate.
2043         (set_exit_status, file_failure): New functions.
2044         (queue_directory): Store command_line_arg into new structure.
2045         (print_dir, gobble_file, get_link_name):
2046         Use file_failure to report problems in accessing files,
2047         so that the exit status is set consistently.
2048         (print_dir): Simplify readdir failure code yet again.
2049         If closedir fails, report "closing directory" rather than "reading
2050         directory" failure.
2051         (xstrcoll): Use set_exit_status to set status on failure.
2052         * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
2053         not status 1.
2054
2055 2004-12-11  Jim Meyering  <jim@meyering.net>
2056
2057         Avoid a race condition vulnerability in chown, when used with
2058         --from=O:G and without the (-h) --no-dereference option.
2059         * src/chown-core.c (restricted_chown): New function.
2060         (change_file_owner): Call it.
2061         Reported by Ulrich Drepper.
2062         * NEWS: Mention this.
2063
2064 2004-12-09  Paul Eggert  <eggert@cs.ucla.edu>
2065
2066         * ls now exits with status 1 on minor problems, 2 if serious trouble.
2067         * NEWS: Document this.
2068         * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
2069         All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
2070         specified below.
2071         (main): Initialize exit failure to LS_FAILURE.
2072         (print_dir, gobble_file, get_link_name, xstrcoll):
2073         Set exit status to LS_MINOR_PROBLEM if the failure is minor.
2074         (print_dir): Do not give up on entire directory merely because readdir
2075         returns EOVERFLOW.
2076         (usage): Explain exit status.
2077         * tests/help-version: ls and variants now exit with status 2
2078         on serious trouble.
2079
2080 2004-12-08  Paul Eggert  <eggert@cs.ucla.edu>
2081
2082         * NEWS: Document new UTC+HH:MM date syntax, and put date changes
2083         together.
2084
2085 2004-12-07  Paul Eggert  <eggert@cs.ucla.edu>
2086
2087         * src/factor.c (factor): Don't list 1 as a factor of 1.
2088         Problem reported by Thomas Folz-Donahue.
2089
2090 2004-12-06  Jim Meyering  <jim@meyering.net>
2091
2092         * tests/du/files0-from: Sanitize environment.
2093         Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
2094         setting is the default (exported from /etc/profile) on at least one
2095         NetBSD 1.6 system.
2096         * tests/du/no-deref: Likewise.
2097         * tests/cp/symlink-slash: Likewise.
2098         * tests/ls/symlink-slash: Likewise
2099
2100 2004-12-05  Jim Meyering  <jim@meyering.net>
2101
2102         * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
2103         _POSIX2_VERSION=199209 is in the environment, or when building on
2104         e.g., OpenBSD 3.2.
2105
2106 2004-12-04  Jim Meyering  <jim@meyering.net>
2107
2108         * NEWS: Mention cut's new --complement option.
2109
2110 2004-10-01  Paolo Bonzini  <bonzini@gnu.org>
2111
2112         * cut.c (complement, COMPLEMENT_OPTION): New.
2113         (longopts): Add --complement.
2114         (usage): Say not that -b, -c, and -f `print' fields,
2115         but rather that they `select' fields for printing.
2116         Describe the new --complement option.
2117         (mark_range_start): Extracted from set_fields.
2118         (print_kth): Support --complement.
2119         (compare_ranges): New function.
2120         (set_fields): Rewrite the part that populates range_start_ht,
2121         merging it with the part that populates printable_field.
2122         (main): Handle --complement.
2123
2124 2004-12-03  Paul Eggert  <eggert@cs.ucla.edu>
2125
2126         * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
2127         failed.  This works around an assertion failure reported by
2128         Roberto Nibali in:
2129         http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
2130
2131 2004-12-02  Jim Meyering  <jim@meyering.net>
2132
2133         With using --color and with LS_COLORS saying not to color
2134         executables, don't stat every file.
2135         * src/ls.c (is_colored): New function.
2136         (gobble_file): Use it.
2137         (main): Use it here, in place of too-strict tests against NULL:
2138         if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
2139         old test would fail.
2140
2141 2004-12-01  Paul Eggert  <eggert@cs.ucla.edu>
2142
2143         * src/comm.c (compare_files): Assume setlocale exists.
2144         * src/join.c (keycmp): Likewise.
2145         * src/seq.c (decimal_point): Treat like sort.  Now char.
2146         All uses changed.
2147         (main): Assume localeconv exists.  Use same code as sort.
2148         * src/sort.c (C_DECIMAL_POINT): Remove.  Use changed to '.'.
2149         Assume setlocale exists.
2150         (thousands_sep): Renamed from th_sep.
2151         (IS_THOUSANDS_SEP): Remove.  All uses replaced by comparisons.
2152         (NONZERO): Parenthesize use of arg.
2153         (numcompare): Avoid duplicate loads.  Use ISDIGIT as boolean, for
2154         consistency.  Avoid unnecessary negation by reversing
2155         fraccompare args.
2156         (main): Rewrite localeconv call to match seq.c.
2157         * src/system.h: Assume locale.h exists.
2158         (HAVE_SETLOCALE): Remove.
2159         * src/uniq.c (different): Assume setlocale exists.
2160
2161         * src/ls.c (sort_files): Minor cleanup.  Remove an unnecessary
2162         'volatile' on a local variable.  Rewrite to avoid unnecessary
2163         double-assignment to 'func' in the usual case where strcoll does
2164         not fail.
2165
2166 2004-11-30  Paul Eggert  <eggert@cs.ucla.edu>
2167
2168         * src/pinky.c (gethostname): Remove decl.
2169         (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
2170         * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
2171         UT_TYPE_BOOT_TIME instead of by-hand code.
2172         * src/users.c (list_entries_users): Use IS_USER_PROCESS
2173         instead of by-hand code.
2174         * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
2175         DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
2176         (IS_USER_PROCESS): Move to ../lib/readutmp.h.
2177         (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
2178         UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
2179         (gethostname): Remove decl.
2180         (list_entries_who, scan_entries): Use the new macros defined above,
2181         for consistency with pinky, uptime, and users.
2182
2183 2004-11-25  Paul Eggert  <eggert@cs.ucla.edu>
2184
2185         Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
2186         HP's ANSI C compiler.  Declaring int functions causes warnings on
2187         some modern systems and shouldn't be needed to compile on ancient
2188         ones.
2189         * src/copy.h (stat, lstat, rename): Remove decls.
2190         * src/install.c (stat): Remove decl.
2191         * src/ln.c (link, symlink): Remove decls.
2192
2193 2004-11-25  Jim Meyering  <jim@meyering.net>
2194
2195         * man/help2man: Import help2man-1.35.1.
2196         * man/Makefile.am (.x.1): Remove now-unnecessary use of
2197         locally-added --program-name=NAME option.  Now, help2man gets
2198         the name from the [NAME] section (i.e. from our .x file).
2199         * man/install.x: Use `install', not `ginstall' in the one-line
2200         description.  Reported by Brendan O'Dea.
2201         * man/sha1sum.x: Use `sha1sum', not `shasum'.
2202
2203 2004-11-24  Jim Meyering  <jim@meyering.net>
2204
2205         Since the changes of 2004-05-22, the u.saved_cwd member at
2206         the bottom of the active-directory stack was no longer
2207         strictly necessary.  This change removes that member and uses
2208         the newer cwd_state parameter for the final restore_cwd.
2209
2210         * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
2211         [dev_ino]: Rename from `a'.
2212         (AD_pop_and_chdir): Add a parameter to play the role of just-removed
2213         bottom-of-stack cwd-state member.
2214         (AD_pop_and_chdir): No longer return boolean.  Adjust caller.
2215         (AD_push_initial): Remove CWD parameter.  Adjust caller.
2216
2217 2004-11-23  Paul Eggert  <eggert@cs.ucla.edu>
2218
2219         Minor performance improvements and cleanups for "touch".
2220         * src/touch.c (posix_date): Remove; not needed as a static var.
2221         All uses rewritten.
2222         (touch): Use new futimens function to operate more efficiently
2223         in some cases.  Don't stat/fstat existing file when
2224         (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
2225         old time stamps aren't needed in that case.
2226         (main): change_times is int, not bool.  Simplify test for
2227         change_times.
2228
2229 2004-11-20  Paul Eggert  <eggert@cs.ucla.edu>
2230
2231         * src/install.c (usage): Avoid usage that runs afoul of Docbook
2232         translation.  Problem reported by Eric S. Raymond.
2233
2234         Restore dd's noctty flag, reverting the change of 2004-04-08.
2235         POSIX does not allow "dd" to use O_NOCTTY by default.
2236         * NEWS: Add noctty flag to dd.
2237         * doc/coreutils.texi (dd invocation): Likewise.
2238         * src/dd.c (flags, usage, main): Likewise.
2239
2240 2004-11-19  Alfred M. Szmidt  <ams@gnu.org>
2241
2242         * src/ls.c (usage): Clarified description of --no-group (-G),
2243         --human-readable (-h), --inode (-i), --size (-s), --time,
2244         and --time-style.
2245
2246 2004-11-19  Jim Meyering  <jim@meyering.net>
2247
2248         * src/ls.c (usage): Clarify description of --author.
2249         Tweak indentation so that help2man creates better nroff.
2250         Reported by Dan Jacobson.
2251
2252         * src/uniq.c (check_file): Don't check stdout for errors here.
2253
2254         * src/pwd.c (find_dir_entry): Update comment to match reality.
2255
2256 2004-11-18  Jim Meyering  <jim@meyering.net>
2257
2258         * src/pwd.c (robust_getcwd): Correct the comment: this function
2259         constructs the directory name.  The caller prints it.
2260
2261 2004-11-16  Paul Eggert  <eggert@cs.ucla.edu>
2262
2263         * src/stat.c (STATFS): New macro, for portability to Solaris 9.
2264         (do_statfs): Use it.
2265
2266         * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
2267         src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
2268         src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
2269         src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
2270         src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
2271         * src/readlink.c (main): argv is not const.
2272
2273         * src/cut.c (usage): Improve documentation along the lines suggested
2274         by Debian 5.2.1-2.
2275         * src/echo.c (usage): Likewise.
2276         * src/expr.c (usage): Likewise.
2277
2278         * src/dircolors.hin: Add putty, screen-bce.
2279
2280         * src/pinky.c (print_entry): Fix memory leak.
2281         * src/who.c (print_user): Likewise.
2282
2283 2004-11-15  Paul Eggert  <eggert@cs.ucla.edu>
2284
2285         * NEWS: New dd operand "status=noxfer".
2286         * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
2287         C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
2288         C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
2289         macros.
2290         (STATUS_NOXFER, statuses): New constants.
2291         (usage, print_stats, scanargs): Add support for status=noxfer.
2292         (usage): Update status output to match new behavior.
2293         (print_stats): Always output complete byte count.
2294         Put space between numbers and units, as SI requires.
2295         Use ngettext so that i18n can use plurals for "byte" and "second".
2296         Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
2297         (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
2298         the string.
2299         * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
2300         problems with regression testing.
2301
2302 2004-11-14  Paul Eggert  <eggert@cs.ucla.edu>
2303
2304         * NEWS: dd now outputs total bytes, seconds, and bytes per second.
2305         * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
2306         * src/dd.c: Include "human.h".
2307         (w_bytes, start_time): New vars.
2308         (usage): Document new I/O statistics output
2309         (print_stats): Output new I/O statistics.
2310         (cleanup): Do statistics after closing stdin and stdout, so that
2311         the times are more accurate.
2312         (write_output, dd_copy): Count output bytes.
2313         (main): Get initial value of clock.
2314
2315 2004-11-14  Jim Meyering  <jim@meyering.net>
2316
2317         Backslash-escape `-'s in email addresses, so that they are
2318         rendered properly in UTF-locales.
2319         * man/help2man (escape_hyphens): New function.
2320         (main): Call it on email addresses.
2321
2322         * src/sort.c (zaptemp): Mark new diagnostic for translation.
2323
2324         * tests/misc/close-stdout: New file.  Test today's closeout.c change.
2325         * tests/misc/Makefile.am (TESTS): Add close-stdout.
2326
2327 2004-11-13  Jim Meyering  <jim@meyering.net>
2328
2329         * src/test.c (usage): Put the description of `[-n] STRING'
2330         on two lines, one for `-n STRING' and one for `STRING' so that
2331         help2man properly escapes the `-'.  Otherwise, the hyphen is
2332         rendered inappropriately in UTF-8 locales.
2333         Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
2334
2335 2004-11-12  Paul Eggert  <eggert@cs.ucla.edu>
2336
2337         * NEWS: Document the following changes.
2338
2339         * src/sort.c: Avoid O(N**2) behavior when there are many temporary
2340         files.
2341         (temptail): New variable, so that we can easily append to list.
2342         (create_temp_file): Create new files at end of list, so that
2343         searching the list has O(N*NMERGE) behavior instead of O(N**2).
2344         (zaptemp): Update temptail if needed.
2345         (mergefps, merge): Accept new arg that counts temp files, and keep it
2346         up to date as we create and remove temporaries.  This is for
2347         efficiency, so that we don't call zaptemp so often.
2348         All callers changed.
2349         (sort): Don't create array in reverse order, since the list of
2350         temporaries is now in the correct order.
2351
2352         (zaptemp): Protect against race condition: if 'sort' is
2353         interrupted in the middle of zaptemp, it might unlink the
2354         temporary file twice, and the second time this happens the file
2355         might already have been created by some other process.
2356
2357         (zaptemp): Warn if a temporary file is not removed.
2358
2359         (create_temp_file): Use offsetof for clarity.
2360         (die): Move it up earlier, to clean up the code a bit.
2361
2362         * src/pr.c (strtoumax): Declare if not declared.
2363         (skip_to_page, first_page_number, last_page_number, page_number,
2364         first_last_page, print_header):
2365         Use uintmax_t for page numbers.
2366         (first_last_page): Remove unnecessary forward declaration.
2367         Do not modify arg (it is now a const pointer).
2368         Return a true if successful, false (without print a diagnostic)
2369         otherwise.
2370         (main): If +XXX does not specify a valid page range, treat it
2371         as a file name.  This follows the response to Open Group XCU ERN 41
2372         <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
2373         which says the behavior is allowed.
2374         (skip_to_page): When starting page number exceeds page count,
2375         print both numbers in the diagnostic.
2376         (print_header): Detect page number overflow.
2377
2378 2004-11-07  Jim Meyering  <jim@meyering.net>
2379
2380         * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
2381         (main) [__APPLE__]: Get the processor type via syscall rather than
2382         hard-coding "powerpc".  From Toby Peterson.
2383
2384         * src/sort.c (merge): Remove declarations of now-unused variables.
2385
2386 2004-11-06  Paul Eggert  <eggert@cs.ucla.edu>
2387
2388         * src/sort.c (first_same_file): Remove.  Move most of the code to....
2389         (avoid_trashing_input): New function.
2390         (merge): Avoid some silly merges, e.g., copying a single file to
2391         a temporary file when there are exactly 17 input files to merge.
2392         Take a count of temporary files rather than a max_merge arg.
2393         All uses changed.
2394
2395 2004-11-06  Jim Meyering  <jim@meyering.net>
2396
2397         * src/sort.c (xfclose): Don't close stdout here (just flush it),
2398         since close_stdout now closes stdout unconditionally.
2399
2400 2004-11-05  Paul Eggert  <eggert@cs.ucla.edu>
2401
2402         * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
2403         first_same_file, merge, sort, main): Use size_t for indexes to arrays.
2404         This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
2405         temporary files).
2406         (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
2407         thus avoiding unchecked stack overflow in some cases.  As a side
2408         effect this improve the performance of "sort -M" by a factor of 4
2409         on my benchmarks.
2410
2411 2004-11-03  Paul Eggert  <eggert@cs.ucla.edu>
2412
2413         * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
2414
2415         * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
2416         expression; it's not portable.  Problem reported by Albert Chin.
2417         Don't invoke a program more than once.
2418         * src/groups.sh (version): New variable, containing author info,
2419         for benefit of AUTHORS check.  Use it when acting on --version option.
2420         * AUTHORS: Remove duplicate lines.  Remove bogus "chroot:"
2421         in groups line.
2422
2423         * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
2424         as this breaks the new regime that does "#define getopt rpl_getopt".
2425         Problem reported by Albert Chin for Solaris 9 with Sun cc in:
2426         http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
2427         I suppose this may cause problems on ancient hosts with
2428         incompatible getopt declarations, but we'll cross that bridge if
2429         the problem gets reported to us by someone who can test the fix.
2430
2431 2004-11-03  Jim Meyering  <jim@meyering.net>
2432
2433         * src/tac.c: quote(...) file names in diagnostics.
2434
2435 2004-10-29  Paul Eggert  <eggert@cs.ucla.edu>
2436
2437         * NEWS: Document getdate changes.
2438
2439 2004-10-29  Jim Meyering  <jim@meyering.net>
2440
2441         * src/tac.c (tac_file): Remove temporary prototype and move this
2442         function `down' so that it precedes definition of tac_nonseekable.
2443
2444         `tac /proc/modules' would print nothing
2445         Reported by Harald Dunkel in http://bugs.debian.org/278604.
2446
2447         * src/tac.c (copy_to_temp): Renamed from save_stdin, since
2448         now it copies a general file descriptor, not just stdin.
2449         (tac_nonseekable): Renamed/adapted from tac_stdin.
2450         (tac_file): Get fd via `open' directly rather than via fopen/fileno,
2451         since we never used the stream.  Perform "-" to stdin mapping here
2452         rather than in main.  Determine whether a file is seekable,
2453         by trying to `lseek' to its end, and dispatch to tac_seekable or
2454         tac_nonseekable accordingly.
2455         (main): Rewrite argument handling now that it uses only tac_file.
2456         * NEWS: Mention it here.
2457
2458 2004-10-21  Jim Meyering  <jim@meyering.net>
2459
2460         * tests/mv/leak-fd: New file.
2461         * tests/mv/Makefile.am (TESTS): Add it.
2462         * tests/rm/dot-rel: New file.
2463         * tests/rm/Makefile.am (TESTS): Add it.
2464
2465         Correct my patch of 2004-10-18.
2466         * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
2467         if necessary, not in remove_dir.  Otherwise, removing multiple
2468         `.'-relative nonempty directories no longer worked.
2469
2470 2004-10-20  Paul Eggert  <eggert@cs.ucla.edu>
2471
2472         * src/fmt.c (usage): Improve description of --prefix.
2473         Problem reported by Edward Welbourne.
2474
2475         * man/uniq.x: Change summary so that it doesn't imply that
2476         uniq writes to its input file.  Problem reported by
2477         Dan Jacobson.
2478
2479 2004-10-18  Jim Meyering  <jim@meyering.net>
2480
2481         Plug a leak that would cause a cross-device mv to fail when
2482         operating on too many command-line-specified nonempty directories.
2483         * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
2484         top of the stack before returning.  This usually closes the file
2485         descriptor that was used to return to the original working directory.
2486         Reported by Cyril Bouthors in
2487         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
2488         * NEWS: Mention it here.
2489
2490         * src/pathchk.c (validate_file_name): Give a more descriptive
2491         diagnostic when pathconf fails.  This also avoids an unwarranted
2492         warning from gcc-3.3.5 about a format not being a string literal.
2493
2494         * src/sleep.c (main): Remove declaration of unused local, c.
2495         * src/printenv.c (main): Likewise.
2496         * src/logname.c (main): Likewise.
2497         * src/uptime.c (main): Likewise, for optc.
2498         * src/tsort.c (main): Likewise, for opt.
2499
2500 2004-10-17  Paul Eggert  <eggert@cs.ucla.edu>
2501
2502         * AUTHORS: Add self to pathchk.
2503         * src/pathchk.c (AUTHORS): Add self.
2504         Change "path" to "file name" whenever possible.
2505         Remove usage comment, as it was a duplication of the code or doc.
2506         Include <wchar.h> if available.
2507         (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
2508         (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
2509         pathconf_wrapper, portable_chars, dir_ok): Remove.
2510         (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
2511         (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
2512         (portable_chars_only): New arg FILELEN.
2513         Don't assume ASCII; we might be on an EBCDIC host.
2514         Don't assume unibyte locale in diagnostic.
2515         (component_start, component_len): New functions.
2516         (validate_file_name): Renamed from validate_path.  All uses changed.
2517         Pretty much a complete rewrite.
2518         Don't make copy of file arg.  Always append trailing slash to
2519         pathconf arg, just in case it's a symlink (this is pure paranoia;
2520         we don't know of any hosts where the trailing slash is required).
2521         Use size_t instead of long int when possible.
2522         Avoid need to call pathconf in most practical cases.
2523         Don't use euidaccess several times to test searchability;
2524         just use lstat once.  Reword diagnostic to put the (often very long)
2525         file names last.
2526
2527 2004-10-15  Paul Eggert  <eggert@cs.ucla.edu>
2528
2529         * src/printf.c (usage): Mention Unicode, and use H for hex digits.
2530
2531 2004-10-13  Jim Meyering  <jim@meyering.net>
2532
2533         * NEWS: Mention today's fts.c fix.
2534
2535 2004-10-13  Paul Eggert  <eggert@cs.ucla.edu>
2536
2537         * tests/stty/row-col-1: Set LC_ALL=C.
2538
2539 2004-10-12  Jim Meyering  <jim@meyering.net>
2540
2541         * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
2542         From Jesus Climent in http://bugs.debian.org/276149.
2543
2544 2004-10-05  Paul Eggert  <eggert@cs.ucla.edu>
2545
2546         * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
2547         problems.  All uses changed.
2548
2549 2004-10-05  Jim Meyering  <jim@meyering.net>
2550
2551         * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
2552         since Karl says its trailing blanks are there to stay :-)
2553
2554 2004-10-04  Paul Eggert  <eggert@cs.ucla.edu>
2555
2556         * src/expr.c (NEW, OLD): Remove, partly to avoid
2557         reference to obsolescent macro XMALLOC.
2558         All uses replaced by xmalloc and free.
2559
2560 2004-09-28  Jim Meyering  <jim@meyering.net>
2561
2562         * src/tail.c (usage): Clarify: --retry works only with --follow=name.
2563         Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2564
2565 2004-09-27  Paul Eggert  <eggert@cs.ucla.edu>
2566
2567         * src/od.c (format_address_paren): c is optional, so don't output
2568         it if it's '\0'.
2569
2570 2004-09-26  Paul Eggert  <eggert@cs.ucla.edu>
2571
2572         Add support for ls --hide.  Idea suggested by Bardur Arantsson.
2573         * NEWS: Document this.
2574         * src/ls.c (file_ignored): Renamed from file_interesting, with
2575         inverted return value.  Accept the file name, not a struct dirent *.
2576         All uses changed.  Avoid the expense of calling fnmatch if the
2577         file is ignorable due to leading '.'.
2578         (all_files, really_all_files): Removed; replaced by:
2579         (ignore): New variable.  All uses changed.
2580         (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
2581         New constants.
2582         (hide_patterns): New variable.
2583         (long_options, decode_switches, file_ignored, usage):
2584         Add support for --hide.
2585         (patterns_match): New function.
2586         (usage): Replace "hide" with "ignore" in explanation, to avoid
2587         confusion.
2588
2589 2004-09-25  Paul Eggert  <eggert@cs.ucla.edu>
2590
2591         * src/ls.c (gobble_file, print_long_format): Don't assume that
2592         human-readable output has a byte count equal to its column width;
2593         this isn't always true in locales where the radix character is not
2594         '.' or ','.
2595         (format_user_or_group): Revamp code to match the above fix;
2596         this avoids the (very faint) possibility of integer overflow.
2597
2598 2004-09-24  Paul Eggert  <eggert@cs.ucla.edu>
2599
2600         * NEWS: Mention that "chmod -r -w x" now works as expected.
2601         * src/chmod.c (main): Revamp option processing to support this.
2602         * tests/chmod/Makefile.am (TESTS): Add 'usage'.
2603         * tests/chmod/usage: New set of tests for usage like that.
2604
2605 2004-09-24  Jim Meyering  <jim@meyering.net>
2606
2607         * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
2608         it lists only cvs-controlled regular files.
2609
2610         * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2611         to avoid a warning from gcc-3.4.1.  Reported by Paul Eggert.
2612
2613 2004-09-23  Paul Eggert  <eggert@cs.ucla.edu>
2614
2615         * Makefile.maint (CVS_LIST): New macro.
2616         (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2617         sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2618         sc_trailing_blank, po-check): Use it instead of the
2619         nonstandard "cvsu --list".
2620
2621         * src/tail.c (parse_obsolete_option): Bring back support
2622         for obsolete option followed by non-obsolete, or by more
2623         than one file.  When obsolete, conform to SUSv2 rather than
2624         original POSIX 1003.2-1992, as SUSv2 corrected the case of
2625         "tail -c".  Add support for the SUSv2 "b" modifier.
2626         * NEWS: Mention the above.
2627         * tests/tail/Test.pm: New test case obs-b to check the above.
2628         err-[134] no longer need _POSIX2_VERSION=199209.
2629         Fix comments to match revised behavior.
2630
2631 2004-09-22  Jim Meyering  <jim@meyering.net>
2632
2633         * Use automake-1.9.2.  Regenerate dependent files.
2634
2635         * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2636         Improve the comment.
2637
2638         Clean up scoping etc. so that some make `distcheck' tests pass.
2639         * src/csplit.c (xalloc_die): Declare to be static.
2640         * src/chown-core.c (chown_files): Declare as `extern'.
2641         * src/cp-hash.c (remember_created): Likewise.
2642         * src/copy.c (copy): Likewise.
2643         * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2644
2645         * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2646         * src/unexpand.c: Likewise.
2647
2648         * src/Makefile.am (check-AUTHORS): New rule.
2649         (check): Depend on it.
2650         * AUTHORS: Update.
2651
2652         * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2653         (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2654
2655 2004-09-22  Paul Eggert  <eggert@cs.ucla.edu>
2656
2657         * src/ls.c (decode_switches): Don't compare a short value
2658         to SIZE_MAX: GCC sometimes complains.
2659
2660 2004-09-21  Paul Eggert  <eggert@cs.ucla.edu>
2661
2662         * NEWS: The following commands now reject unknown options:
2663         basename dirname factor hostname link nohup sync unlink yes
2664         Also, pathchk no longer accepts trailing options.
2665
2666         * src/basename.c: Include <getopt.h>.
2667         * src/chroot.c: Likewise.
2668         * src/dirname.c: Likewise.
2669         * src/factor.c: Likewise.
2670         * src/hostid.c: Likewise.
2671         * src/hostname.c: Likewise.
2672         * src/nohup.c: Likewise.
2673         * src/pwd.c: Likewise.
2674         * src/setuidgid.c: Likewise.
2675         * src/sync.c: Likewise.
2676
2677         * src/basename.c (main): Reject unknown options.
2678         * src/dirname.c (main): Likewise.
2679         * src/factor.c (main): Likewise.
2680         * src/hostid.c (main): Likewise.
2681         * src/hostname.c (main): Likewise.
2682         * src/link.c (main): Likewise.
2683         * src/nohup.c (main): Likewise.
2684         * src/pwd.c (main): Likewise.
2685         * src/setuidgid.c (main): Likewise.
2686         * src/sync.c (main): Likewise.
2687         * src/unlink.c (main): Likewise.
2688         * src/yes.c (main): Likewise.
2689
2690         * src/cat.c (main): Remove unused "case 0".
2691         * src/chgrp.c (main): Likewise.
2692         * src/chmod.c (main): Likewise.
2693         * src/chown.c (main): Likewise.
2694         * src/comm.c (main): Likewise.
2695         * src/cp.c (main): Likewise.
2696         * src/csplit.c (main): Likewise.
2697         * src/cut.c (main): Likewise.
2698         * src/date.c (main): Likewise.
2699         * src/df.c (main): Likewise.
2700         * src/du.c (main): Likewise.
2701         * src/env.c (main): Likewise.
2702         * src/expand.c (main): Likewise.
2703         * src/fold.c (main): Likewise.
2704         * src/head.c (main): Likewise.
2705         * src/id.c (main): Likewise.
2706         * src/install.c (main): Likewise.
2707         * src/join.c (main): Likewise.
2708         * src/ln.c (main): Likewise.
2709         * src/ls.c (decode_switches): Likewise.
2710         * src/mkdir.c (main): Likewise.
2711         * src/mkfifo.c (main): Likewise.
2712         * src/mknode.c (main): Likewise.
2713         * src/mv.c (main): Likewise.
2714         * src/nl.c (main): Likewise.
2715         * src/paste.c (main): Likewise.
2716         * src/pinky.c (main): Likewise.
2717         * src/pr.c (main): Likewise.
2718         * src/ptx.c (main): Likewise.
2719         * src/readlink.c (main): Likewise.
2720         * src/rm.c (main): Likewise.
2721         * src/rmdir.c (main): Likewise.
2722         * src/seq.c (main): Likewise.
2723         * src/shred.c (main): Likewise.
2724         * src/split.c (main): Likewise.
2725         * src/sum.c (main): Likewise.
2726         * src/tac.c (main): Likewise.
2727         * src/tail.c (main): Likewise.
2728         * src/tee.c (main): Likewise.
2729         * src/touch.c (main): Likewise.
2730         * src/tr.c (main): Likewise.
2731         * src/tty.c (main): Likewise.
2732         * src/uname.c (main): Likewise.
2733         * src/unexpand.c (main): Likewise.
2734         * src/wc.c (main): Likewise.
2735         * src/who.c (main): Likewise.
2736
2737         * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2738         * src/cksum.c (main): Likewise.
2739         * src/dd.c (main): Likewise.
2740         * src/logname.c (main): Likewise.
2741         * src/printenv.c (main): Likewise.
2742         * src/sleep.c (main): Likewise.
2743         * src/tsort.c (main): Likewise.
2744         * src/uptime.c (main): Likewise.
2745         * src/users.c (main): Likewise.
2746         * src/whoami.c (main): Likewise.
2747
2748         * src/du.c (long_options): Standardize on NULL vs 0.
2749         * src/rm.c (long_opts): Likewise.
2750
2751         * src/logname.c (long_options): Remove.
2752         * src/printenv.c (long_options): Likewise.
2753         * src/sleep.c (long_options): Likewise.
2754         * src/tsort.c (long_options): Likewise.
2755         * src/uptime.c (longopts): Likewise.
2756         * src/users.c (longopts): Likewise.
2757         * src/whoami.c (long_options): Likewise.
2758
2759         * src/pathchk.c (longopts): Add --help, --version.
2760         (main): Use longopts rather than parse_long_options.
2761         * src/stty.c (longpts, main): Likewise.
2762
2763         * src/pathchk.c (main): Don't reorder arguments, so that
2764         we can check weird file names.
2765
2766         * src/readlink.c: Don't include "long-options.h".
2767         * src/sort.c: Likewise.
2768         * src/stty.c: Likewise.
2769
2770         * src/split.c (verbose): Now bool, not int.
2771         (VERBOSE_OPTION): New enum.
2772         (longopts, main): Use it.
2773
2774         * tests/factor/basic: Adjust to new wording in diagnostic
2775         that results from the above changes.
2776
2777 2004-09-21  Jim Meyering  <jim@meyering.net>
2778
2779         * man/rm.x: Say "the response is affirmative" rather than "the
2780         response begins with y or Y", so that the documentation is
2781         accurate in non-English locales.  Problem reported by Munzir Taha.
2782
2783 2004-09-19  Paul Eggert  <eggert@cs.ucla.edu>
2784
2785         * src/echo.c (main): Don't pass NULL to strcmp when
2786         POSIXLY_CORRECT and given no arguments.
2787
2788         * src/md5sum.c (STRING_OPTION): Remove.
2789         (long_options, main): Remove support for undocumented and
2790         obsolete --string option, as suggested in the 1996-09-26 patch.
2791         * NEWS: Document this.
2792
2793         * tests/rm/fail-eperm: Don't try to remove writeable files in a
2794         sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2795         you remove such files.  Problem reported by Bert Fischer in:
2796         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2797
2798 2004-09-18  Paul Eggert  <eggert@cs.ucla.edu>
2799
2800         * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2801         (long_options, main): Use them instead of magic numbers 2 and 1.
2802         For --string, optarg can't possibly be NULL.
2803
2804         * src/dd.c (usage): Distinguish between options and operands.
2805         (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2806         Say "operands" for operands, not "options".
2807         (main): Use getopt_long, so that "dd --" works as POSIX requires.
2808         * tests/dd/misc: Check for "dd --".
2809
2810         * src/chroot.c (main): Reject unknown options instead of
2811         interpreting them as a directory to chroot to.
2812
2813         * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2814         The current standard (POSIX 1003.1-2004) is correct.
2815         (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2816         collision with builtin function.
2817         (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2818         output the first 0 as 8 digits, to make it easier to compare to
2819         the text of the standard.  Output crctab to be a const array.
2820         (crctab): Use result of above changes.
2821         (long_options): Remove; not needed if empty.
2822         (main): getopt_long can't return 0 here, so simplify the code.
2823
2824 2004-09-13  Jim Meyering  <jim@meyering.net>
2825
2826         * src/Makefile.am (localedir.h): Don't redirect directly to target.
2827
2828 2004-09-13  Paul Eggert  <eggert@cs.ucla.edu>
2829
2830         * src/id.c (print_full_info): Don't exit with failure status simply
2831         because a user or group number can't be turned into a name.
2832         Problem reported by Felipe Kellermann in:
2833         http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2834
2835 2004-09-12  Jim Meyering  <jim@meyering.net>
2836
2837         * Makefile.maint (my-distcheck): When building with -Werror, also
2838         require -Wshadow.
2839
2840 2004-09-10  Paul Eggert  <eggert@cs.ucla.edu>
2841
2842         * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2843         * src/tail.c (parse_obsolete_option): Renamed from
2844         parse_obsolescent_option, since the options are obsolete now.
2845         Remove bool *arg; just exit if there's an error.  Revamp to follow
2846         POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2847         file" and "tail -10 -- file" correctly when we are conforming to
2848         the older standard.
2849         (main): Adjust to this change.
2850         * tests/tail/Test.pm (test_vector): minus-* requires
2851         _POSIX2_VERSION=199209 now, to work correctly if there is
2852         an input file.  err-1 and err-3 no longer errors if there
2853         is another file.
2854
2855 2004-09-09  Paul Eggert  <eggert@cs.ucla.edu>
2856
2857         * src/test.c (usage): Document -r, -w, -x more carefully.
2858
2859 2004-09-08  Paul Eggert  <eggert@cs.ucla.edu>
2860
2861         * src/test.c (usage): Document "test" (with no args) and "[ ]".
2862         Document that -h and -L don't dereference.
2863
2864         * NEWS: Document that "tr xy -z" now works as per POSIX.
2865         Sort the descriptions.
2866         * src/tr.c (main): Don't reorder options.
2867         * tests/tr/Test.pm (fowler-1): New test case.
2868
2869 2004-09-06  Paul Eggert  <eggert@cs.ucla.edu>
2870
2871         * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2872         MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2873         conforming to pre-2001 POSIX.
2874         * NEWS: Document this.
2875         * tests/touch/obsolescent: Test for this bug.  Also, set
2876         _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2877         a better test for obsolescent features.
2878
2879         * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2880         "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2881         plain "sort".
2882
2883         * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2884         (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2885         (long_options, main): --strings is now -S, not -s.
2886         (usage): Reflect the usage changes.
2887         (parse_old_offset): Do not issue a diagnostic on failure;
2888         callers now do this as necessary.
2889         (main): Support POSIX syntax.  Remove unused case 0 from getopt_long.
2890         Add support for new short options (many undocumented) for
2891         compatibility with FreeBSD.  Remove FIXME for -s; it's now
2892         POSIX-compatible.  Default format is now oS, not o2.
2893         * NEWS: Describe the above.
2894
2895 2004-09-05  Paul Eggert  <eggert@cs.ucla.edu>
2896
2897         * src/stty.c (valid_options): Remove.
2898         (main): Fix some bugs in handling invalid option-combinations
2899         like "stty -F".
2900         (recover_mode): Arg is now char const *, not char *.
2901         (main): Use STDIN_FILENO, not 0.
2902         Simplify option-parsing code a tad.
2903         * tests/stty/basic-1: Check for the fixed bugs.
2904
2905 2004-09-03  Paul Eggert  <eggert@cs.ucla.edu>
2906
2907         * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2908         it from ever being nonzero.  Reported by Pozsar Balazs in:
2909         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2910         (human_fstype): Add ramfs, squashfs, sysfs.
2911         Reported by Pozsar Balazs in:
2912         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2913         (human_fstype): Return char const *, not char *.
2914         Simplify internals a bit, and avoid casts.
2915
2916         * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2917         (bit_count): Remove.  All uses changed to....
2918         (multiple_bits_set): New function.
2919         (scanargs): Use it, and check separately for each set of
2920         incompatible options, to improve diagnostics.
2921         (MX): Remove.
2922         (apply_translations): Move checks for incompatible options
2923         to scanargs, so that they're done consistently.
2924
2925 2004-09-02  Paul Eggert  <eggert@cs.ucla.edu>
2926
2927         Output correct errno-related diagnostic on "paste" I/O errors.
2928         * src/paste.c (write_error, xputchar): New functions.
2929         (paste_parallel): Use correct errno value after input error.
2930         (paste_parallel, paste_serial): Report errno value after output error.
2931
2932         Port to diet libc.  Problem reported by Felix von Leitner in:
2933         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2934         * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2935         it's not portable C to assume FILE is a complete type.
2936         (paste_parallel): Use index test instead of ENDLIST, and NULL
2937         instead of CLOSED.
2938
2939 2004-08-24  Paul Eggert  <eggert@cs.ucla.edu>
2940
2941         POSIX-conformance fixes for "expand" and "unexpand".
2942         Also, consistently use "tab stop" rather than "tabstop".
2943         * NEWS: Document fixes.
2944         * src/expand.c: Revamp to resemble the new unexpand.c better.
2945         (usage): -i does not convert tabs after non-tabs.
2946         (add_tab_stop): Renamed from add_tabstop.  All uses changed.
2947         (parse_tab_stop): Renamed from parse_tabstop.  All uses changed.
2948         (validate_tab_stop): Renamed from validate_tabstop.  All uses changed.
2949         (next_file, main): Check fclose against 0, not EOF.
2950         (expand): Remove unnecessary casts.
2951         Add another loop nesting level, for lines, so that per-line variables
2952         are initialized cleanly.
2953         Revamp tab checking.  Check for write error immediately, rather
2954         than just once at the end of the program.
2955         * src/unexpand.c: Lkewise (for the expand.c changes).
2956         (TAB_STOP_SENTINEL): Remove.
2957         (tab_size): Now size_t, not uintmax_t, since we need to store
2958         the sequences of blanks.
2959         (max_column_width): New var.
2960         (usage): Say "blank" where POSIX requires this.
2961         (add_tab_stop): Calculate maximum column width.
2962         (unexpand): Store the pending blanks, instead of merely counting them.
2963         Follow POSIX's rules about -a requiring two blanks before a tab stop.
2964         Get rid of internal label and goto.
2965         * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2966         Add blanks-1 through blanks-13.
2967
2968 2004-08-19  Paul Eggert  <eggert@cs.ucla.edu>
2969
2970         * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2971         succeed without changing the uid and gid, like FreeBSD.
2972         * src/chgrp.c (parse_group): Return gid_t rather than storing it
2973         through a pointer.  Treat "chgrp '' file" as a no-op change,
2974         as FreeBSD does.
2975         (main): Set chopt.group_name to NULL if the group is the empty
2976         string.
2977         * src/chown-core.c (describe_change): Describe changes to -1:-1
2978         without using "to OWNERSHIP" phrase.
2979         * src/chown.c (usage): "chown '' file" is now allowed.
2980         (main): Do not set user name to the empty string if the group
2981         name is null.
2982         * tests/chgrp/basic: Test "chgrp '' file".
2983         * tests/chown/Makefile.am (TESTS): Add separator.
2984         * tests/chown/separator: New file, partly taken from
2985         Dmitry V. Levin's suggestion in
2986         <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2987
2988 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2989
2990         * tests/install/basic-1: Test for the -d regression.
2991
2992 2004-08-11  Dmitry V. Levin  <ldv@altlinux.org>
2993
2994         * src/install.c (main): Fix -d regression introduced with
2995         --target-directory support at 2004-06-25.
2996
2997 2004-08-11  Paul Eggert  <eggert@cs.ucla.edu>
2998
2999         * src/copy.c (copy_internal): When preserving links, unlink
3000         a destination with link count greater than one.  This is so
3001         that commands like "cp -a" don't get confused when copying into
3002         a destination that already contains many hard links.  Problem
3003         reported by Tim Waugh in:
3004         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
3005
3006 2004-08-10  Paul Eggert  <eggert@cs.ucla.edu>
3007
3008         Convert all files to UTF-8.
3009         * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
3010         * tests/sort/Test.pm (16a): Likewise.
3011         * tests/uniq/Test.pm (8): Likewise.
3012         * tests/misc/printf-hex: Use ASCII, not Latin-1.
3013
3014         * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
3015         * src/shred.c (usage): "-" is an operand, not an option.
3016         * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
3017         A null file arg means standard output.
3018         (main): "-o -" means to write to a file named "-",
3019         not to standard output.
3020         * src/tee.c (usage, tee): "tee -" writes to standard output, not
3021         to a file named "-".
3022
3023 2004-08-10  Dmitry V. Levin  <ldv@altlinux.org>
3024
3025         * src/install.c (change_timestamps): Fix int->bool conversion
3026         bugs introduced on 2004-07-29.
3027
3028 2004-08-09  Paul Eggert  <eggert@cs.ucla.edu>
3029
3030         * src/shred.c (wipename): Work even if the directory is writeable
3031         and not readable.  Prefer write access, since this should work
3032         better with fdatasync.
3033
3034         * src/csplit.c (xalloc_die): New function.
3035         (main): Remove now-obsolete initialization of xalloc_fail_func.
3036
3037         * src/md5sum.c: Adjust to sha->sha1 renaming.
3038
3039 2004-08-08  Dmitry V. Levin  <ldv@altlinux.org>
3040
3041         Minor code cleanup.
3042         * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
3043         (can_mode): Make variable local.
3044
3045 2004-08-07  Paul Eggert  <eggert@cs.ucla.edu>
3046
3047         * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
3048         Do not define, to avoid annoying compiler messages on QNX 6.3.
3049         Problem reported by Johan in:
3050         http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
3051
3052 2004-08-04  Paul Eggert  <eggert@cs.ucla.edu>
3053
3054         * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
3055         Define to a concatenation of string literals, not to an expression;
3056         needed for concatenation contexts.
3057         (INTMAX_MAX, INTMAX_MIN): New macros.
3058
3059         * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
3060         unsigned long; this isn't true for st_ino on Solaris 9.
3061
3062 2004-08-03  Paul Eggert  <eggert@cs.ucla.edu>
3063
3064         * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
3065         whether to include files.  Include <sys/param.h> if
3066         HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
3067         (main) [defined __POWERPC__]: Add a kludge to work around a
3068         Mac OS X bug, so that uname -p defaults to "powerpc" if
3069         sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
3070         fails.  Problem reported by Petter Reinholdtsen in:
3071         http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
3072
3073         * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
3074         main): Use bool for booleans.
3075         (writeline, check_file): Use uintmax_t for line counts.
3076         (check_file): Check for and report line number overflow,
3077         when that matters.
3078         * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
3079         (print_lines, print_words, print_chars, print_bytes, print_linelength,
3080         have_read_stdin, wc, wc_file, main):
3081         Use bool for booleans.
3082         (exit_status): Remove.
3083         (wc, wc_file): Return bool status.  All callers changed.
3084         * src/who.c (scan_entries): 0 -> STDIN_FILENO.
3085         * src/whoami.c (main): Print uids using unsigned long int, not
3086         unsigned int.
3087
3088         * src/unexpand.c: Int cleanup and minor reorganization to be more
3089         like src/expand.c.
3090         Include quote.h, xstrndup.h.
3091         (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
3092         (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
3093         unexpand, main):
3094         Use bool for booleans.
3095         (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
3096         Use uintmax_t for column counts.
3097         (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
3098         (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
3099         as a tab stop.
3100         (parse_tabstops): Don't use ISBLANK on possibly-signed char.
3101         Detect overflow in tab stop string.
3102         (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
3103         (unexpand): Concatenate input files the same way expand does.
3104
3105         * src/touch.c (no_create, use_ref, posix_date, amtime_now,
3106         touch, main): Use bool for booleans.
3107         (main): Avoid integer overflow when given more than INT_MAX
3108         options.
3109         * src/tsort.c (struct item, n_strings): Use size_t for sizes.
3110         (have_read_stdin, count_items, scan_zeros, detect_loop,
3111         recurse_tree, walk_tree, tsort, main):
3112         Use bool for booleans.
3113         (exit_status): Remove.
3114         (tsort): Return a success flag instead of storing into a global.
3115         (main): Use it.
3116         * src/tty.c (silent, main): Use bool for booleans.
3117         (main): 0 -> STDIN_FILENO.
3118         * src/uname.c (print_element): Use bool for booleans.
3119
3120         * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
3121         Remove.  All uses replaced by C99 boolean primitives.
3122         (TEST_TRUE, TEST_FALSE): New constants, for readability.
3123         (test_unop, binop, unary_operator, binary_operator, two_arguments,
3124         three_arguments, posixtest, expr, term, and, or, is_int, age_of,
3125         one_argument, main): Use bool for booleans.
3126         (advance, unary_advance): Now inline procedures rather than a macros.
3127         (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
3128         (term, and, or): When it's easy, loop instead of recursing.
3129         (term): Avoid integer overflow if there are INT_MAX-3 args (!).
3130         (binary_operator, unary_operator): Simplify by systematically rewriting
3131         true==FOO to FOO (where FOO is a boolean).
3132         (unary_operator): Don't consider a file to be a regular file
3133         merely because its mode&S_IFMT is zero.  Just use S_ISREG.
3134         Remove unnecessary casts.  Remove ifdefs for things like
3135         S_ISSOCK that are no longer needed, since stat-macros.h always
3136         defines them now.
3137
3138         * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
3139         Use bool for booleans.
3140         (buf_init_from_stdin, buf_free, find_bol, print_line):
3141         Use size_t for sizes.
3142         * src/tac.c (separator_ends_record, tac_seekable, tac_file,
3143         tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
3144         (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
3145         (tac_seekable): Use ptrdiff_t for pointer subtraction.
3146         Report an error if the result is out of range.
3147         (tac_seekable, main): Check for integer overflow in buffer size
3148         calculations.
3149         (main): Remove unnecessary casts.
3150
3151         * src/su.c (run_shell): Pass a new n_additional_args arg, so that
3152         the callee doesn't have to count 'em.  All callers changed.
3153         Don't allocate more space for the arg vector than we'll need.
3154         Use memcpy to copy the args rather than rolling our own loop.
3155         Use size_t for sizes.
3156         (fast_startup, simulate_login, change_environment, log_su,
3157         correct_password, restricted_shell, main): Use bool for booleans.
3158         (longopts): Don't assume change_environment is an int.
3159         Use NULL, not 0, for pointers.
3160         (xsetenv): New function, replacing xputenv and concat.
3161         All callers changed.
3162         (elements): Remove; no longer needed.
3163         (log_su, correct_passwd, main): Prefer !x to x==NULL.
3164         (log_su): 2 -> STDERR_FILENO.
3165         (modify_environment, main): Don't assume that getenv's returned value
3166         has an indefinite lifetime.
3167         (modify_environment): Allocate a larger environ.
3168         (main): Remove an impossible 'case 0'; if it happens now, it'll
3169         get diagnosed.  Don't assume getpwnam results outlive endpwent.
3170         Check for null or empty pw_name, pw_dir and for null pw_passwd.
3171
3172         * src/stty.c (VA_START): Remove.  All callers now use va_start.
3173         (_POSIX_VDISABLE): Remove unnecessary cast.
3174         (struct control_info, visible): Use cc_t for control chars.
3175         (struct control_info): Use size_t for sizes.
3176         (recover_mode, set_mode, display_speed, display_window_size,
3177         valid_options, main, display_changed):
3178         Use bool for booleans.
3179         (integer_arg): Return unsigned long int, not long int.
3180         Accept new max arg; all callers changed, to specify a maximum
3181         value for integer parameters instead of silently overflowing.
3182         (wrap): Do not overrun the stack buffer if the output contains
3183         more than 1024 bytes.  Instead, malloc a buffer.
3184         (main): Remove a "what is this?!?" FIXME.  Nobody knows what it is.
3185         Remove unnecessary casts.
3186         (set_control_char): Allow int values only up to cc_t range.
3187         (screen_columns): Don't reject INT_MAX.
3188         (display_changed, display_all, display_speed, recover_mode):
3189         Don't assume cc_t fits in int.
3190
3191         * src/remove.h: Add copyright notice.
3192         (struct rm_options): Use bool for booleans.
3193         * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
3194         errno_rmdir_non_empty, remove_parents, main): Likewise.
3195         * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
3196         main): Likewise.
3197         (main): Don't dump core if invoked with argv[0]==NULL.
3198         * src/tee.c (tee, append, ignore_interrupts, main, tee):
3199         Use bool for booleans.
3200         (tee): Use ssize_t for read returns.
3201
3202         * src/ptx.c: Add a FIXME mentioning that there are many
3203         unchecked integer overflows in this file.
3204         (gnu_extensions, auto_reference, input_reference, right_reference,
3205         ignore_case, initialize_regex, fix_output_parameters,
3206         output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
3207         Use bool for booleans.
3208         (SKIP_SOMETHING, compare_words, digest_break_file,
3209         find_occurs_in_text, fix_output_parameters):
3210         Use to_uchar instead of a caset.
3211         (print_field): Rewrite to avoid cast.
3212
3213         * src/printf.c (posixly_correct): Use bool for booleans.
3214         (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
3215         (STRTOX): Rewrite to avoid casts.
3216         (print_esc_char): Arg is char, not int.
3217         * src/readlink.c (canonicalize): Remove.  All uses now merely inspect
3218         can_mode.
3219         (no_newline, verbose): Use bool for booleans.
3220         (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
3221         * src/shred.c (struct Options, main): Use bool for booleans.
3222         (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
3223         * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
3224         Use bool for booleans.
3225         * src/stat.c (G_fail): Remove.
3226         (print_statfs): Print various gotta-be-nonnegative values using
3227         unsigned long int, not long int or int.
3228         (do_statfs, do_stat): Return a boolean success flag.
3229         (do_stat, main): Use bool for booleans.
3230
3231         * src/pr.c: Add a FIXME mentioning that there are many
3232         unchecked integer overflows in this file.
3233         (TRUE, FALSE): Remove.  All uses replaced by true and false.
3234         (struct COLUMN, read_line, print_page, print_stored, open_file,
3235         skip_to_page, init_fps, parallel_files, align_empty_cols,
3236         empty_line, FF_only, explicit_columns, extremities, keep_FF,
3237         print_a_FF, print_a_header, use_form_feed, have_read_stdin,
3238         print_across_flag, storing_columns, balance_columns,
3239         truncate_lines, join_lines, untabify_input, failed_opens,
3240         numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
3241         double_space, ignore_failed_opens, use_col_separator,
3242         pad_vertically, last_line, main, init_parameters, skip_read,
3243         read_line, print_stored):
3244         Use bool for booleans.
3245         (struct COLUMN, char_to_clump, store_char, print_char):
3246         Use char for chars.
3247         (clump_buff, print_clump): Use char[], not int[], for an array whose
3248         elements are always chars.
3249         (first_last_page, main, getoptarg, balance, add_line_number,
3250         char_to_uclump): Remove unnecessary casts.
3251         (init_parameters): Allocate chars, not ints, for clump_buff.
3252         (print_char): Use to_uchar before invoking ISPRINT.
3253         (char_to_clump): Convert to unsigned char before invoking ISPRINT.
3254
3255         * src/nohup.c (main): Use bool for booleans.
3256         * src/paste.c (paste_parallel, paste_serial, main): Likewise.
3257         * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
3258         (portable_chars_only): Use to_uchar rather than a cast.
3259         * src/printenv.c (main): Use bool for booleans.
3260         Do not assume that the environ has at most one matching entry
3261         for each option (integer overflow was possible otherwise).
3262
3263         * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
3264         constant.  Do not assume PRIdMAX etc. are strings of length 3 or
3265         less.
3266         (struct tspec): Use it.  fmt_string is now an array, not
3267         a pointer, as there's little point to the indirection here.
3268         (struct tspec, flag_dump_strings,
3269         traditional, flag_pseudo_start, limit_bytes_to_format,
3270         abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
3271         decode_one_format, open_next_file, check_and_close,
3272         decode_format_string, skip, write_block, read_char, read_block,
3273         parse_old_offset, dump, dump_strings, main):
3274         Use bool for booleans.
3275         (struct tspec): Use void *, not char *, for generic pointers.
3276         (bytes_to_oct_digits, bytes_to_signed_dec_digits,
3277         bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
3278         Use char, not unsigned int, since char suffices.
3279         (print_s_char, print_char, print_s_short, print_short,
3280         print_int, print_long, print_long_long, print_float,
3281         print_double, print_long_double): Rewrite to avoid casts.
3282         These now take void * arguments, instead of char *.
3283         Use the same body for all functions, except for the choice
3284         of type.  Assume C89 to simplify handling of signed char.
3285         (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
3286         Rewrite to avoid casts.
3287         (print_named_ascii, print_ascii): Now takes void *, not char *.
3288         (decode_one_format): Use int for printf field widths, not
3289         unsigned int.  Pass void * to subsidiary printers,
3290         not char *.  Simplify handling of floating-point formats
3291         by factoring out common code dealing with precision and field width.
3292         (decode_format_string): Avoid need for temporary copy of
3293         each decoded struct tspec.
3294         (get_lcm): Remove unnecessary cast.
3295         (main): Fix bug where more than INT_MAX failed decodes were ignored.
3296
3297 2004-08-02  Paul Eggert  <eggert@cs.ucla.edu>
3298
3299         * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
3300         (enum number_format): Remove.
3301         (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
3302         not enum values.
3303         (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
3304         (section_del): Now const.
3305         (print_fmt): Remove.
3306         (starting_line_number, page_incr, blank_join, line_no,
3307         print_lineno, proc_text, main):
3308         Use intmax_t for line numbers.
3309         (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
3310         Use bool for booleans.
3311         (lineno_format): Now a string, not an enum value.
3312         (build_print_fmt): Remove.  All calls removed.  This work is
3313         now done within print_lineno.
3314         (build_type_arg): Use size_t for sizes.
3315         (print_lineno): Check for line number overflow.
3316         (proc_text, main): Remove unnecessary cast.
3317
3318         * src/ln.c (symbolic_link, interactive, remove_existing_files,
3319         verbose, hard_dir_link, dereference_dest_dir_symlinks,
3320         do_link, main): Use bool for booleans.
3321
3322         * src/ls.c (struct fileinfo, file_interesting,
3323         extract_dirs_from_files, color_symlink_as_referent,
3324         FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
3325         numeric_ids, print_block_size, dired, print_with_color,
3326         check_symlink_color, print_inode, recursive, immediate_dirs,
3327         all_files, really_all_files, qmark_funny_chars,
3328         print_dir_name, format_needs_stat, format_needs_type, visit_dir,
3329         main, decode_switches, parse_ls_color, print_dir, file_interesting,
3330         gobble_file, make_link_path, basename_is_dot_or_dotdot,
3331         extract_dirs_from_files, print_long_format):
3332         Use bool for booleans.
3333         (dir_defaulted): Remove; no longer needed.
3334         (main): Use int to count files, since it suffices for argv.
3335         Rewrite to avoid need for dir_defaulted.
3336         (main, print_dir, gobble_file, get_link_name,
3337         xstrcoll):
3338         Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
3339         (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
3340         Remove unnecessary cast to int.  Use int instead of unsigned
3341         int to count from 0 to 1.
3342         (get_funky_string, print_type_indicator): Use char for bytes, not int.
3343         (make_link_path): Use NULL for null pointers.
3344         (quote_name): Use to_uchar instead of cast.
3345
3346         * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
3347         print_full_info): Use bool for booleans.
3348         (problems): Remove, replacing with....
3349         (ok): New var (inverted from old sense).
3350         (print_user, print_group, print_full_info):
3351         Print uids/gids with %lu, not %u.
3352         (xgetgroups): Don't run out of memory if getgroups or getugroups
3353         returns -1.
3354         * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
3355
3356         * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
3357         int, since it suffices.
3358         (factor, print_factors): Use size_t for sizes.
3359         (print_factors, do_stdin, main): Use bool for booleans.
3360         * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
3361         (fold_file, main): Use bool for booleans.
3362         (fold_file, main): Use size_t for sizes.
3363         (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
3364         of prohibiting widths greater than INT_MAX.
3365         * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
3366         write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
3367         elide_tail_lines_pipe, elide_tail_lines_seekable,
3368         elide_tail_lines_file, head_bytes, head_lines, head, head_file,
3369         string_to_integer, main):
3370         Use bool for booleans.
3371         (main): Rewrite to avoid cast.
3372
3373         * src/csplit.c (struct line): Use size_t for sizes.
3374         (main): Remove unnecessary cast.
3375         * src/cut.c (cut_fields): Use to_uchar rather than a cast.
3376         * src/cut.c (cut_file, main): Use bool for booleans.
3377         * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
3378         * src/env.c (main): Likewise.
3379         * src/expr.c (nextarg): Likewise.
3380         * src/env.c (main): Remove unused and nonstandard envp arg.
3381
3382         * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
3383         fmt's arbitrary limits.
3384         (TRUE, FALSE): Remove; all uses changed to (true, false).
3385         (main): Use bool for booleans.
3386         Limit maximum width to MAXCHARS / 2.  Use xstrtoul, not xstrtol,
3387         to parse width.
3388         (copy_rest): Remove unnecessary cast.
3389         (get_prefix): Rewrite to avoid cast.
3390         (check_punctuation): Use char *, not unsigned char *; C89 requires
3391         this.  Avoid off-by-one buffer read overrun when line is empty.
3392         (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
3393         Remove unnecessary casts.
3394         * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
3395         changes.
3396
3397         * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
3398         next_file, expand, main):
3399         Use bool for booleans.
3400         (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
3401         expand, main):
3402         Use uintmax_t for column counts.
3403         (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
3404         All callers changed.
3405         (parse_tabstops): Don't pass a negative char to isblank.
3406         Avoid memory leak with large tab stops.
3407         (validate_tabstops, expand): Don't assume number of tab stops is
3408         <= INT_MAX.
3409         (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
3410         storing values into exit_status.
3411         (expand): Use same pattern as unexpand for reading chars.
3412         Report an error when input line is too long, instead of silently
3413         screwing up.  Do not mishandle tab stops when backspacing left
3414         over start of line.
3415
3416         * src/dircolors.c (have_read_stdin, append_quoted,
3417         dc_parse_stream, dc_parse_file, main): Use bool for booleans.
3418         (dc_parse_stream): Use enum for state, rather than int.
3419         Use ssize_t to store getline result.
3420
3421         * src/dd.c (translation_needed, parse_integer, scanargs,
3422         apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
3423         Use bool for booleans.
3424         (translate_buffer): Use to_uchar rather than a cast.
3425         (swab_buffer, copy_simple, copy_with_unblock):
3426         Use size_t for sizes.
3427
3428         * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
3429         * src/sleep.c (apply_suffix): Likewise.
3430         * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
3431         forever, from_start, print_headers, have_read_stdin, valid_file_spec,
3432         write_header, file_lines, pipe_lines, pipe_bytes, recheck,
3433         tail_forever, tail_bytes, tail_lines, tail, tail_file,
3434         parse_obsolescent_option, parse_options, main): Likewise.
3435         * src/sleep.c (apply_suffix): Invert sense of result.
3436         Use int (not unsigned int) for multiplier, as this generates better
3437         code with some compilers.  Simplify code a bit.
3438         * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
3439         parse_options): Use uintmax_t, not unsigned int or unsigned long int,
3440         for state counters.
3441         (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
3442         make it a bit clearer.
3443
3444         * src/hostname.c: Include "xgethostname.h".
3445         (xgethostname): Remove decl; xgethostname.h has it.
3446         (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
3447         && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
3448         prototypes rather than K&R form.  Assume any negative value from
3449         sysinfo denotes failure, not just -1.
3450         (main): Simplify use of sethostname.
3451
3452         * src/pinky.c (include_idle, include_heading, include_fullname,
3453         include_project, include_plan, include_home_and_shell, do_short_format,
3454         include_where, main): Use bool for booleans.
3455         (count_ampersands, create_fullname, scan_entries, short_pinky):
3456         Use size_t for sizes.
3457         (create_fullname): Check for overflow in size calculations.
3458         (idle_string): Don't assume that the number of idle days
3459         is less than 10**8 and/or INT_MAX/(24*60*60).
3460         (main): No need to pass a non-NULL last arg to getopt_long.
3461         * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
3462         (print_uptime): Remove unused local variable.
3463         (main): No need to pass a non-NULL last arg to getopt_long.
3464         * src/users.c (list_entries_users, users): Use size_t for sizes.
3465         (list_entries_users): Use char for bytes.
3466         (main): No need to pass a non-NULL last arg to getopt_long.
3467         * src/who.c (do_lookup, short_list, short_output, include_idle,
3468         include_heading, include_mesg, include_exit, need_boottime,
3469         need_deadprocs, need_login, need_initspawn, need_clockchange,
3470         need_runlevel, need_users, my_line_only, main): Use bool for booleans.
3471         (print_runlevel): Use unsigned char for bytes.
3472         (list_entries_who, scan_entries, who): Use size_t for sizes.
3473         (main): No need to pass a non-NULL last arg to getopt_long.
3474
3475         * src/install.c (isdir): Remove decl.
3476         (install_file_to_path): Rely on make_path to fail if the destination
3477         is not a directory, by passing preserve_existing==true to it.
3478         Hence we no longer need to call isdir.
3479         Free dest_dir immediately when it's no longer needed, rather than
3480         waiting until the end of the function.
3481         (copy_file): Don't bother calling isdir, as copy will do the
3482         right thing if the destination is a directory.
3483
3484         * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
3485         print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
3486         Use bool for booleans.
3487         (max_depth): Now size_t, not int, to avoid an arbitrary limit
3488         of INT_MAX on depth.
3489         (G_fail): Remove: no longer needed, now that the relevant
3490         functions return bool.
3491         (process_file): Use return value to signal success rather than
3492         setting a global.  Remove first_call static var; not needed, since
3493         we can look at n_alloc.  Use size_t for depths.  Remove FIXME
3494         about size_t casts, as it's now fixed.  Use xnrealloc rather
3495         than the obsolescent XREALLOC.  Don't bother to check whether
3496         reallocation is needed unless level > prev_level.
3497         (du_files): Invert sense of result, for consistency with
3498         other coreutils code.  All callers changed.
3499         (main): Allow --max-depth values up to SIZE_MAX.
3500
3501         * src/df.c (inode_format, show_all_fs, show_local_fs,
3502         show_listed_fs, posix_format, require_sync, print_type,
3503         selected_fstype, excluded_fstype, show_dev, show_point, main):
3504         Use bool for booleans.
3505         (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
3506         (show_dev, show_point, main):
3507         Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3508         Don't assume disk name lengths are <= INT_MAX.
3509         Rewrite pct calculation to avoid cast.
3510         (show_point): Don't assume resolved length is <= SSIZE_MAX.
3511
3512         * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
3513         instead of uintptr_t.
3514         * src/shred.c (UINT_MAX_32_BITS): Remove.
3515         (word32): Remove.  All uses changed to uint32_t.
3516         (isaac_seed_data): Remove unnecessary cast.
3517         * src/system.h (ptr_align): Use size_t; in practice, this is just as
3518         good as uintptr_t in checking for alignments, and has fewer
3519         configuration hassles.
3520
3521         * src/Makefile.am (localedir.h): Make it readonly; this
3522         undoes part of the 2004-07-27 patch.
3523
3524 2004-07-30  Paul Eggert  <eggert@cs.ucla.edu>
3525
3526         * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
3527         (IS_THOUSANDS_SEP): Use bool when appropriate.
3528         (numcompare, main): Use char, not int, when the value is always a char.
3529         (numcompare): Remove "register"; compilers are smart enough these days.
3530         * src/system.h (errno, CHAR_BIT): Remove decls;
3531         no longer needed now we assume C89 or better.
3532         Include <inttypes.h> before <stdint.h>, as it's the
3533         Autoconf-recommended pattern.
3534         (to_uchar): New inline function, moved here from tr.c.
3535         Use full names for int types, e.g. "long int" rather than "long".
3536         * src/tr.c (to_uchar): Remove; now in system.h.
3537         (is_char_class_member): Use bool when appropriate.
3538
3539         * src/mkdir.c (create_parents, main): Use bool when appropriate.
3540         (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3541
3542 2004-07-29  Paul Eggert  <eggert@cs.ucla.edu>
3543
3544         * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
3545
3546         * src/chmod.c (recurse, force_silent, process_file, process_files,
3547         main): Use bool when appropriate.
3548         * src/cksum.c (cksum, main): Likewise.
3549         * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
3550         compare_files, main): Likewise.
3551
3552         * src/copy.h (struct cp_options): Likewise.
3553         * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
3554         same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
3555         * src/cp-hash.h (remember_created): Likewise.
3556         * src/cp-hash.c (remember_created): Likewise.
3557         * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
3558         re_protect, make_path_private, target_directory_operand, do_copy,
3559         cp_option_init, decode_preserve_arg, main): Likewise.
3560         * src/install.c (isdir, change_timestamps, change_attributes,
3561         copy_file, install_file_to_path, install_file_in_dir,
3562         install_file_in_file, strip_files, dir_arg, cp_option_init, main,
3563         change_attributes, change_timestamps): Likewise.
3564         * src/mv.c (remove_trailing_slashes, rm_option_init,
3565         cp_option_init, do_move, movefile, main): Likewise.
3566         * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
3567         AD_push, prompt, remove_dir): Likewise.
3568         * src/rm.c (rm_option_init, main): Likewise.
3569
3570         * src/remove.c (top_dir, pop_dir, full_filename_):
3571         Use size_t for sizes.
3572         * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
3573         succeeds.  It's not necessary in that case, as *NEW_DST is always
3574         false already.
3575         (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
3576         (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
3577         * src/rm.c (main): Likewise.
3578
3579         md5sum, sha1sum integer cleanups.
3580
3581         * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
3582         not needed.
3583         (ALG_UNSPECIFIED): Remove.
3584         (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
3585         * src/md5.c: Don't include any files other than checksum.h.
3586         * src/sha1sum.c: Likewise.
3587         * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
3588         bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
3589         Use bool when appropriate.
3590         (digest_check): Increase limit of number of input lines to
3591         UINTMAX_MAX from INT_MAX.  Diagnose any overflows of this counter.
3592         Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
3593
3594 2004-07-28  Paul Eggert  <eggert@cs.ucla.edu>
3595
3596         * src/cat.c (exit_status): Remove.  Now done by passing a boolean
3597         'ok' flag around.
3598         (simple_cat, cat): Return true if successful.  All callers changed.
3599         (simple_cat, cat, main): Use bool for booleans.
3600         (simple_cat): Use size_t for sizes.
3601         (cat, main): Use the same names for parameters that we use for
3602         long options, to avoid confusion.  This inverts the sense of the
3603         show_tabs (formerly output_tabs) and number_nonblank
3604         (formerly numbers_at_empty_lines) variables.
3605         (main): Don't mess up (due to integer overflow) if we are given
3606         INT_MAX - INT_MIN + 1 options.
3607         [O_BINARY]: Don't invoke isatty unless the other options require it.
3608         (main): When deciding whether to use simple_cat, don't worry
3609         about binary option; it's irrelevant.
3610
3611         * src/dcgen: Remove comments, trailing white space, and empty
3612         lines from the output strings, to save space.
3613         Use a narrower type like 'unsigned char' for line lengths, if
3614         that will do.
3615         Make the output variables static, not extern.
3616
3617         * src/chgrp.c (parse_group): Require base 10 when parsing
3618         groups as integers.
3619         (main): int -> bool when appropriate.
3620         * src/chown.c (main): Likewise.
3621         * src/chown-core.c: Include inttostr.h.
3622         (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3623         (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3624         instead of uint_to_string).
3625         (describe_change): Instead of an int flag, use a char *
3626         auxiliary; this avoids the need for casts.
3627         Assume free (NULL) works.
3628         (change_file_owner): Return true/false, not 0/-1, since
3629         we don't set errno.  All callers changed.
3630         Use bool when appropriate.
3631         (chown_files): Likewise.
3632         * src/chown-core.h (chown_files): Likewise.
3633
3634         * tests/chown/basic: Test for proper handling of uids like
3635         "010", which must be parsed as decimal.
3636
3637         * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3638         pwd when there are multiple names for the working directory
3639         (which can happen with an automounter, sigh).
3640
3641         * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3642         this causes Solaris 8 'make' to refuse to build "groups".
3643         (localedir.h): Don't depend on Makefile: this causes Solaris
3644         8 'make' to build localedir.h unnecessarily.  The dependence
3645         on Makefile is ineffective anyway, since $(localedir) might
3646         change even if Makefile hasn't.
3647
3648         * src/remove.c (remove_dir): If we can't save the state of the
3649         working directory, pretend we started from "/", not ".".
3650         This avoids a bug on hosts like Solaris that don't let you
3651         remove the working directory.
3652
3653 2004-07-27  Paul Eggert  <eggert@cs.ucla.edu>
3654
3655         * src/printf.c (strtiomax, strtoumax): Declare if not already
3656         declared: this fixes a portability bug with Solaris 8 + GCC.
3657         (STRTOX): Parenthesize use of macro arg as expression.
3658         (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3659         parentheses.
3660         * configure.ac: Check for declaration of strtoumax, for
3661         src/printf.c.
3662
3663         * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3664         pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3665
3666         * tests/readlink/can-e: Don't assume that we can remove the
3667         working directory: this isn't possible under Solaris 8, say.
3668         * tests/readlink/can-f: Likewise.
3669         * tests/readlink/can-m: Likewise.
3670
3671         * src/copy.c (copy_internal): find_backup_file_name no longer
3672         returns NULL, so don't bother to check for this.
3673         * src/cp.c (do_copy): Likewise.
3674         * src/ln.c (do_link): Likewise.
3675
3676 2004-07-25  Paul Eggert  <eggert@cs.ucla.edu>
3677
3678         * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3679         All uses changed.
3680         (NZERO): New macro, if system doesn't define it already.
3681         (usage): Distinguish priorities from nice values.
3682         Don't assume NZERO is 20.
3683         (main): Use bool instead of int where appropriate.
3684         If user specifies an adjustment out of range, always truncate it
3685         to an inrange value instead of sometimes giving an error message
3686         and sometimes not.
3687         Do not assume that -1 is an error return from "nice" or
3688         "getpriority", as it might be the current nice value minus NZERO.
3689         If nice/setpriority fails with errno == EPERM, go ahead and run
3690         the command anyway; POSIX requires this.
3691
3692         * src/pathchk.c: Include euidaccess.h.
3693         (dir_ok): Use euidaccess, not access.
3694         * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3695         (eaccess): Remove.  All users changed to use euidaccess instead.
3696
3697 2004-07-24  Paul Eggert  <eggert@cs.ucla.edu>
3698
3699         * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3700         Don't assume ut_line is null-terminated.
3701         * src/who.c (print_line): New arguments USERLEN and LINELEN,
3702         since USER and LINE might not be null terminated.  All callers
3703         changed.
3704
3705 2004-07-23  Paul Eggert  <eggert@cs.ucla.edu>
3706
3707         Fix bug with "tail -f" reported by Rob Holland in
3708         <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3709         Also, remove the undocumented and unsupported-since-2000
3710         --max-consecutive-size-changes options.  Fix another related bug:
3711         "tail" got confused if stdin, stdout, or stderr were closed.
3712         Also, use output buffering even with "tail -f".
3713
3714         * NEWS: Document this, plus yesterday's patch.
3715         * doc/coreutils.texi (tail invocation): "size has remained the same"
3716         -> "file has not changed", which is more accurate for fifos.
3717         * src/tail.c: Include fcntl-safer.h.
3718         (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3719         (COPY_A_BUFFER): New macro.
3720         (struct File_spec): New members mtime, mode, blocking.
3721         Remove member n_consecutive_size_changes.
3722         (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3723         max_n_consecutive_size_changes_between_opens,
3724         MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3725         (long_options, tail_forever, parse_options):
3726         Remove (non-)support for --max-consecutive-size-changes.
3727         (record_open_fd): New function.
3728         (recheck, tail_file): Use it.  Don't assume that stdin is open.
3729         (dump_remainder): Add support for new COPY_A_BUFFER special value.
3730         Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3731         (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3732         All uses changed.
3733         (n_live_files): Remove, replacing with...
3734         (any_live_files): New function.  All uses changed.
3735         (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3736         is safe; this avoids some hangs when reading from a fifo.
3737         Avoid invoking fstat or sleep when using blocking I/O.
3738         Do not check for changes to size if the file is not a regular file,
3739         as the size is undefined in that case.
3740         Check for changes to mtime or mode, too; this works for non-regular
3741         files.
3742         (tail_forever, main): Redo fflush strategy to work even when input
3743         is nonblocking.  Don't use unbuffered output; just flush when needed.
3744
3745 2004-07-22  Paul Eggert  <eggert@cs.ucla.edu>
3746
3747         * src/tail.c (main): Ignore -f if no file operand is specified
3748         and standard input is a pipe.
3749         * doc/coreutils.texi (tail invocation): Do not ignore -f for
3750         all pipes, just for when standard input is a pipe and no
3751         file operand is specified.
3752         * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3753         Add a new commented-out f-2 test, which we still fail.
3754         (test_vector): All f-* tests are special cases, not just f-1.
3755
3756 2004-07-12  Paul Eggert  <eggert@cs.ucla.edu>
3757
3758         * src/uptime.c: Include c-strtod.h.
3759         (print_uptime): Use c_strtod instead of setlocale and sscanf.
3760         Use long int rather than int to count days (for 64-bit hosts),
3761         and check for arithmetic overflow when converting double to time_t.
3762
3763 2004-07-11  Paul Eggert  <eggert@cs.ucla.edu>
3764
3765         * src/printf.c (vstrtold): Renamed from vstrtod.
3766         Now returns long double.  All uses changed.
3767         (print_direc): Use "L" length modifier when printing floating point
3768         numbers, since we're now printing long double.
3769
3770 2004-07-06  Paul Eggert  <eggert@cs.ucla.edu>
3771
3772         printf cleanup, to avoid undefined behavior, to add support for
3773         formats that Bash supports, and to support wide integers like
3774         Bash does.
3775
3776         * NEWS: Document this.
3777         * src/printf.c (UNSPECIFIED): Remove.  All uses now replaced by
3778         booleans, so that we don't reserve any values for precision or
3779         width (like Bash).
3780         (STRTOX): Use prototype, not K&R-style definition.
3781         (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3782         in ../lib), with type change to intmax_t.
3783         All uses changed.
3784         (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3785         All uses changed.
3786         (vstrtod): Renamed from xstrtod.  All uses changed.
3787         (print_direc): Use boolean arg instead of special value to indicate
3788         a missing precision or width.  LENGTH no longer includes
3789         length modifiers or conversion character.  New arg CONVERSION
3790         now specifies conversion character.
3791         Use intmax_t-width formatting for integers (like Bash).
3792         Add support for C99 %a, %A, %F (like Bash).
3793         Add support for field width with %c (POSIX requires this).
3794         Add a FIXME for lack of support for field width and precision
3795         for %b.
3796         Add support for '\'', '0' flags.
3797         Check for invalid combinations of flags, field width, precision,
3798         and conversion, to prevent use of undefined behavior.
3799         Allow multiple length modifiers, for formats like "%lld" (like Bash).
3800         Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3801         In error message, output entire invalid conversion specification,
3802         instead of merely outputting % followed by the conversion char.
3803         * tests/misc/printf: Add tests for the above.
3804
3805 2004-04-03  Dmitry V. Levin  <ldv@altlinux.org>
3806
3807         Change "readlink -f" to be more compatible with prior implementations.
3808         Add more canonicalize options, -e and -m.
3809         Add comprehensive tests for all readlink modes.
3810
3811         * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3812         Do not add canonicalize.c here.
3813
3814         * src/readlink.c (longopts): Add new options.
3815         (usage): Document them.
3816         (canonicalize_fname): New proxy function.
3817         (main): Handle new options.
3818         * doc/coreutils.texi (readlink invocation): Document new
3819         "readlink -f" behaviour and new canonicalize options, -e and -m.
3820
3821         * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3822         * tests/Makefile.am (SUBDIRS): Add readlink.
3823         * tests/readlink/Makefile.am: New file.
3824         * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3825         * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3826         * tests/misc/readlink: Remove file.
3827
3828 2004-07-04  Jim Meyering  <jim@meyering.net>
3829
3830         * src/copy.c (copy_internal): Add a FIXME comment.
3831
3832 2004-07-02  Paul Eggert  <eggert@cs.ucla.edu>
3833
3834         * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3835         * src/cp.c (do_copy): Likewise.
3836         * src/mv.c (movefile): Likewise.
3837
3838         * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3839         to avoid problem when path_concat dir name is longer than 2 GiB (!).
3840
3841         * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3842         This cleans up the semantics a bit, as we no longer try to open the
3843         same file twice.
3844
3845 2004-07-01  Paul Eggert  <eggert@cs.ucla.edu>
3846
3847         * NEWS: Add short names -t and -T for --target-directory
3848         and --no-target-directory options, respectively.
3849
3850         * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3851         Remove.  All uses changed to 'T' and 't', respectively.
3852         * src/install.c, src/ln.c, src/mv.c: Likewise.
3853
3854         * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3855         aliases for --target-directory and --no-target-directory,
3856         respectively.
3857         * src/install.c (long_options, main, usage): Likewise.
3858         * src/ln.c, src/mv.c: Likewise.
3859
3860 2004-07-01  Jim Meyering  <jim@meyering.net>
3861
3862         * Makefile.maint (sc_file_system): New target.
3863         (syntax-check-rules): Add it.
3864         .x-sc_file_system: New file.
3865         * Makefile.am (EXTRA_DIST): Add it.
3866
3867         * man/sync.x: Use "file system" rather than "filesystem".
3868         * man/stat.x, man/df.x: Likewise.
3869
3870 2004-06-30  Paul Eggert  <eggert@cs.ucla.edu>
3871
3872         * src/df.c (usage, main): Output "file system" rather than
3873         "filesystem".
3874         * src/du.c (usage): Likewise.
3875         * src/shred.c (usage): Likewise.
3876         * src/stat.c (usage): Likewise.
3877         * src/stat.c (long_options, usage): Rename "--filesystem" to
3878         "--file-system".  But keep the old name around, for compatibility
3879         reasons.
3880
3881 2004-06-29  Paul Eggert  <eggert@cs.ucla.edu>
3882
3883         Add support for --no-target-directory option.
3884
3885         * NEWS: Document it.
3886         * doc/coreutils.texi (Common options, Target directory, cp
3887         invocation, install invocation, mv invocation, ln invocation):
3888         Likewise.
3889         (link invocation): Explain how to rewrite link using ln now
3890         that we have --no-target-directory.
3891         (ln invocation): Explain that --no-target-directory subsumes
3892         --no-dereference.
3893         (unlink invocation): Modify wording to match new wording in
3894         link invocation.
3895
3896         * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3897         (long_opts, usage, do_copy, main): Add support for
3898         --no-target-directory,
3899         * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3900         usage): Likewise.
3901         * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3902         main): Likewise.
3903         * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3904         main): Likewise.
3905         * src/mv.c (enum): Sort values.
3906
3907 2004-06-29  Jim Meyering  <jim@meyering.net>
3908
3909         Don't let verbose-mode output from a subshell obscure actual differences.
3910         * tests/rm/inaccessible: Turn off command-echoing just before
3911         invoking subshell, then turn it back on if VERBOSE=yes afterward.
3912
3913 2004-06-25  Paul Eggert  <eggert@cs.ucla.edu>
3914
3915         Add support for 'install --target-directory', an option
3916         that has been documented for years but not implemented (!).
3917         * doc/coreutils.texi (install invocation): Document
3918         --target-directory in synopsis, too.
3919         * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3920         (long_options, main, usage): Add --target-directory.
3921         (target_directory_operand): New function, stolen from mv.c.
3922         (main): Use it.  Check for -d and --target-directory.
3923         Alter wording of diagnostics to match other programs.
3924
3925 2004-06-28  Jim Meyering  <jim@meyering.net>
3926
3927         * src/cp.c (usage): Fix copy+paste error in description of
3928         --target-directory: s/move/copy/.  From Paul Jarc.
3929
3930 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3931
3932         Use more-consistent rules among cp, ln, and mv when dealing with
3933         last operands that are (or look like) directories.
3934
3935         * src/cp.c (target_directory_operand): New, nearly-common function,
3936         It reports an error if the destination appears to be a directory
3937         (e.g., because it has a trailing slash) but is not.
3938         * src/ln.c, src/mv.c: Likewise.
3939         * src/cp.c (do_copy): Use it.
3940         * src/ln.c (main): Likewise.
3941         * src/mv.c (main): Likewise.
3942
3943         * src/cp.c (do_copy): Don't assume argc is positive.
3944         Don't bother to lstat dest, since copy() will do that for us.
3945         Use "const" to avoid the need for cast.
3946
3947         * src/cp.c (do_copy): Don't output a usage message because of file
3948         problems (e.g., an operand is not a directory).  Use it only for
3949         syntax.  Standardize on "target %s is not a directory" for the
3950         diagnostic.
3951         * src/ln.c (main): Likewise.
3952         * src/mv.c (main): Likewise.
3953
3954         * src/cp.c (do_copy): Remove test for trailing slash, since
3955         target_directory_operand now does this.
3956         * src/ln.c (main): Likewise.
3957         * src/mv.c (movefile): Likewise.
3958
3959         * src/cp.c (main): Reject multiple target directories.
3960         Check whether a specified target is a directory when parsing the
3961         options, using stat.  This gives more-accurate diagnostics.
3962         * src/ln.c (main): Likewise.
3963
3964         * src/ln.c (isdir): Remove decl; no longer needed.
3965         * src/mv.c (isdir, lstat): Likewise.
3966
3967         * src/ln.c (do_link): New arg dest_is_dir.  All uses changed.
3968         Don't check the destination ourself; rely on dest_is_dir.
3969         This way we can avoid lstatting the destination in the
3970         usual case, and in the worst case we lstat 1, not 3 times.
3971         Don't bother to unlink unless link failed; this saves a syscall.
3972         Remove unnecessary backup_succeeded flag;
3973         it was identical to "dest_backup != NULL".
3974
3975         * src/ln.c (main): Use int to count to argc, not unsigned int.
3976         This handles negative operand counts.
3977         * src/mv.c (main): Likewise.
3978
3979         * src/mv.c (do_move): Don't call hash_init; expect the caller to
3980         do it, for consistency with cp.c and ln.c.  All callers changed.
3981         (movefile): dest_is_dir parameter is now bool, not int.
3982         (main): Standardize on "missing destination file operand after %s"
3983         for the diagnostic, for consistency with cp.c.
3984
3985         * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3986         will complain about the arg count.
3987         Adjust to new (briefer) diagnostics.
3988         * tests/cp/fail-perm: Add a test to verify that we get the new
3989         diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3990
3991 2004-06-27  Paul Eggert  <eggert@cs.ucla.edu>
3992
3993         Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3994         d/" incorrectly created a link d/x/x.  It also saves some system
3995         calls.
3996
3997         * NEWS: Document the fix.
3998
3999         * src/ln.c (main): Don't append basename to dest if this
4000         results in an existing directory name.
4001         * tests/ln/misc: See whether a trailing slash is followed too far.
4002
4003 2004-06-26  Jim Meyering  <jim@meyering.net>
4004
4005         * src/printf.c (main): When given no arguments, print the standard
4006         "missing operand\nTry printf --help..." message -- to be consistent.
4007
4008 2004-06-26  Jim Meyering  <jim@meyering.net>
4009
4010         * src/mknod.c (main): Add \n at the end of message output via fprintf.
4011
4012 2004-06-25  Jim Meyering  <jim@meyering.net>
4013
4014         * tests/ln/misc: Add test for ln subscript error.
4015
4016 2004-06-23  Paul Eggert  <eggert@cs.ucla.edu>
4017
4018         * src/ln.c (do_link): Remove unnecessary call to lstat.
4019         (main): Avoid subscript error when the destination is "".
4020
4021 2004-06-23  Jim Meyering  <jim@meyering.net>
4022
4023         * tests/*: Replace all occurrences of `(exit N); exit' with
4024         `(exit N); exit N'.  Otherwise, those many tests could exit with
4025         improper exit status when exiting via e.g., a trapped interrupt.
4026         Thanks to a report from Bob Proulx.
4027
4028 2004-06-22  Paul Eggert  <eggert@cs.ucla.edu>
4029
4030         * src/who.c (idle_string, print_user): New arg boottime,
4031         specifying the most recent boot time.  All uses changed.
4032         (idle_string) Consider a line to be "old" if it hasn't been used
4033         since the last boot time.  Watch out for overflow when computing
4034         times, and for times in the future.
4035         (idle_string): Record latest boot time.
4036
4037 2004-06-22  Jim Meyering  <jim@meyering.net>
4038
4039         * src/test.c (usage): Correct description of `-t FD'.  The file
4040         descriptor, FD, is no longer optional.  Reported by Ton Nijkes.
4041
4042 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
4043
4044         The 2004-06-19 fix for who and pinky was incomplete, as ctime
4045         has undefined behavior if the year precedes -999 or follows 9999.
4046         Since we have to stop using ctime anyway, we might as well use
4047         strftime and fix the FIXME, and support internationalized dates.
4048
4049         * NEWS: Document the new behavior.
4050         * src/who.c: Include "hard-locale.h".
4051         (time_format, time_format_width): New vars.
4052         (time_string, print_line): Use them.
4053         (main): Set them.
4054         (time_string): Use localtime + strftime instead of
4055         ctime, to avoid problems with years before -999 or after 9999.
4056         * src/pinky.c: Likewise.
4057
4058 2004-06-21  Paul Eggert  <eggert@cs.ucla.edu>
4059
4060         Fix bug: GNU 'ls' didn't count columns correctly if user or group
4061         names contained multibyte characters where the column count
4062         differed from the byte count.  This patch also corrects
4063         some comments.
4064
4065         * src/ls.c (format_user_or_group): New function, which counts
4066         columns correctly.
4067         (format_user, format_group): Use it.
4068         (format_user_or_group_width): New function, which counts columns
4069         correctly.
4070         (format_user_width, format_group_width): Use it.
4071
4072 2004-06-21  Jim Meyering  <jim@meyering.net>
4073
4074         * tests/priv-check: Quote "$PATH" in PATH=$PATH.
4075         Suggestion from Andreas Schwab.
4076
4077         * tests/priv-check: When running as root, be sure to propagate
4078         PATH through to the process we exec as non-root.
4079         Reported by michael@aplatform.com.
4080
4081         * src/mknod.c (main): Don't segfault when calculating the
4082         expected number of operands for `mknod NAME'.
4083
4084 2004-06-20  Jim Meyering  <jim@meyering.net>
4085
4086         * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
4087
4088 2004-06-20  Paul Eggert  <eggert@cs.ucla.edu>
4089
4090         * src/basename.c (main):
4091         Standardize on the diagnostics given when someone gives
4092         too few operands ("missing operand after `xxx'") or
4093         too many operands ("extra operand `xxx'").
4094         Include "quote.h" and/or "error.h" if it wasn't already being included.
4095         * src/chgrp.c (main): Likewise.
4096         * src/chmod.c (main): Likewise.
4097         * src/chown.c (main): Likewise.
4098         * src/chroot.c (main): Likewise.
4099         * src/comm.c (main): Likewise.
4100         * src/cp.c (do_copy): Likewise.
4101         * src/csplit.c (main): Likewise.
4102         * src/date.c (main): Likewise.
4103         * src/dircolors.c (main): Likewise.
4104         * src/dirname.c (main): Likewise.
4105         * src/du.c (main): Likewise.
4106         * src/expr.c (main): Likewise.
4107         * src/hostid.c (main): Likewise.
4108         * src/hostname.c (main): Likewise.
4109         * src/id.c (main): Likewise.
4110         * src/install.c (main): Likewise.
4111         * src/join.c (add_file_name, main): Likewise.
4112         * src/link.c (main): Likewise.
4113         * src/ln.c (main): Likewise.
4114         * src/logname.c (main): Likewise.
4115         * src/md5sum.c (main): Likewise.
4116         * src/mkdir.c (main): Likewise.
4117         * src/mkfifo.c (main): Likewise.
4118         * src/mknod.c (main): Likewise.
4119         * src/mv.c (main): Likewise.
4120         * src/nohup.c (main): Likewise.
4121         * src/od.c (main): Likewise.
4122         * src/pathchk.c (main): Likewise.
4123         * src/ptx.c (main): Likewise.
4124         * src/readlink.c (main): Likewise.
4125         * src/rm.c (main): Likewise.
4126         * src/rmdir.c (main): Likewise.
4127         * src/seq.c (main): Likewise.
4128         * src/setuidgid.c (main): Likewise.
4129         * src/shred.c (main): Likewise.
4130         * src/sleep.c (main): Likewise.
4131         * src/sort.c (main): Likewise.
4132         * src/split.c (main): Likewise.
4133         * src/stat.c (main): Likewise.
4134         * src/test.c (beyond, main): Likewise.
4135         * src/touch.c (main): Likewise.
4136         * src/tr.c (main): Likewise.
4137         * src/tsort.c (main): Likewise.
4138         * src/tty.c (main): Likewise.
4139         * src/uname.c (main): Likewise.
4140         * src/uniq.c (main): Likewise.
4141         * src/unlink.c (main): Likewise.
4142         * src/uptime.c (main): Likewise.
4143         * src/users.c (main): Likewise.
4144         * src/who.c (main): Likewise.
4145         * src/whoami.c (main): Likewise.
4146
4147         * tests/basename/basic: Adjust to new diagnostics.
4148         * tests/du/files0-from: Likewise.
4149         * tests/expr/basic: Likewise.
4150         * tests/mv/diag: Likewise.
4151         * tests/tsort/basic-1: Likewise.
4152
4153 2004-06-20  Jim Meyering  <jim@meyering.net>
4154
4155         * src/ln.c: Remove declaration of yesno.
4156         Instead, include yesno.h.
4157         * src/copy.c: Likewise.
4158
4159         * src/remove.c: Remove declaration of yesno.
4160         Instead, include yesno.h.
4161         (top_dir): Remove now-unnecessary cast of obstack_base.
4162         (pop_dir): Likewise.
4163         (full_filename_): Likewise.
4164
4165 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
4166
4167         Don't dump core if ctime returns NULL; this is possible on
4168         hosts with 64-bit time_t and 32-bit int.
4169         * src/who.c: Include "inttostr.h".
4170         (time_string): If ctime fails, print the raw time as an integer
4171         instead of dumping core.
4172         * src/pinky.c: Likewise, as follows:
4173         Include "inttostr.h".
4174         (time_string): New function, copied from who.c.
4175         (print_entry): Use it.
4176
4177 2004-06-19  Paul Eggert  <eggert@cs.ucla.edu>
4178
4179         * src/who.c (print_line): Don't truncate user names at 8 bytes.
4180         Problem reported by Guido Leenders in:
4181         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
4182         * NEWS: document this.
4183
4184 2004-06-19  Jim Meyering  <jim@meyering.net>
4185
4186         * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
4187         using GNU_PACKAGE (from PACKAGE) once again.  This restores
4188         `GNU' to the parenthesized package name in --version output.
4189         Before, the first argument from AC_INIT, `GNU coreutils', would
4190         be propagated to the PACKAGE variable.  Now, `GNU ' is trimmed.
4191         Reported by Richard Stallman.
4192
4193 2004-06-17  Jim Meyering  <jim@meyering.net>
4194
4195         * src/tr.c (to_uchar): Rename function from `uchar'.  The latter
4196         would clash with a typedef in Tru64's <sys/types.h>.  From Albert Chin.
4197
4198 2004-06-15  Paul Eggert  <eggert@cs.ucla.edu>
4199
4200         * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
4201         allows the GNU behavior.  "--" is now supported by chroot, hostid,
4202         hosname, pwd, sync, yes.
4203         * doc/coreutils.texi (yes invocation, false invocation,
4204         true invocation): Document this.
4205         * src/chroot.c (main): Handle "--".
4206         * src/hostid.c (main): Likewise.
4207         * src/hostname.c (main): Likewise.
4208         * src/pwd.c (main): Likewise.
4209         * src/sync.c (main): Likewise.
4210         * src/yes.c (main): Likewise.
4211         * src/true.c (main): Recognize --help and --version even if
4212         POSIXLY_CORRECT is set.
4213         * src/yes.c (main): Likewise.
4214
4215 2004-06-09  Paul Eggert  <eggert@cs.ucla.edu>
4216
4217         * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
4218         the GNU behavior.
4219         * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
4220         * src/ls.c (decode_switches): Pay attention to TABSIZE even if
4221         POSIXLY_CORRECT is set.  POSIX reserves upper-case environment
4222         variables to the implementation, so it's OK for ls to depend on
4223         TABSIZE.
4224         * src/pr.c: Include "hard-locale.h".
4225         (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
4226         POSIX specifies the behavior only in the POSIX locale.
4227         * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
4228         since POSIX says the behavior is unspecified here.
4229         * src/tail.c (parse_obsolescent_option): Support multiple file operands
4230         even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
4231         * src/printf.c (main): Recognize --help, --version even if
4232         POSIXLY_CORRECT.  POSIX does not specify any options, but it
4233         does not prohibit options either, so "printf" is like "expr" here.
4234         * src/unlink.c (main): Likewise.
4235         * tests/misc/printf: Adjust to the new semantics for \x if
4236         POSIXLY_CORRECT.
4237
4238 2004-06-14  Jim Meyering  <jim@meyering.net>
4239
4240         * tests/misc/pwd: New test, for fix of 2004-04-19.
4241         * tests/misc/Makefile.am (TESTS): Add pwd.
4242         (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
4243
4244         * src/copy.c: Remove declaration of euidaccess.
4245         Instead, include "euidaccess.h".
4246
4247 2004-06-13  Paul Eggert  <eggert@cs.ucla.edu>
4248
4249         * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
4250         (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
4251         as (sizeof "??") reliably returns 3.
4252         (print_line): Guard against idle and pid being too long
4253         (which is possible when printing headers).
4254         (print_user): Allocate enough bytes for idlestr.  Use IDLESTR_LEN.
4255         Avoid unnecessary cast of sizeof to int.
4256         (make_id_equals_comment): Do not assume that UT_ID returns
4257         a string; it might return a non-null-terminated array.
4258         Use strncat instead.  It's not very often where strncat is
4259         exactly what you want, but this is one of those rare cases.
4260
4261 2004-06-11  Paul Eggert  <eggert@cs.ucla.edu>
4262
4263         * src/who.c (list_entries_who): Don't output a trailing space.
4264
4265 2004-06-09  Jim Meyering  <jim@meyering.net>
4266
4267         * src/touch.c (usage): Improve wording in description of the
4268         --time=WORD option.  Reported by Dan Jacobson.
4269
4270         * src/chown-core.c (change_file_owner): Change names of parameters
4271         old_uid and old_gid to required_uid and required_gid respectively.
4272
4273         * src/chmod.c (mode_changed): Return false, not 0, now that the
4274         function returns `bool'.
4275
4276 2004-06-08  Paul Eggert  <eggert@cs.ucla.edu>
4277
4278         Adjust chmod and chown to be similar if -c or -v are given.  In
4279         particular, a no-op chown is no longer reported as a change; this
4280         reverts to previous behavior.  Also, fix both commands so that -v
4281         report failures even if the failure is not due to the chmod or
4282         chown syscalls.
4283
4284         * src/chmod.c (CH_NOT_APPLIED): New constant.
4285         (describe_change): Handle it.
4286         (process_file): Use it, if a symlink wasn't changed.
4287         (mode_changed): Return bool, not int.  Accept new argument
4288         NEW_MODE; all callers changed.  This lets us avoid statting the
4289         file unless the new mode has unusual bits.
4290         (process_file): Return -1 on error.  With -v, report all errors
4291         verbosely, not just some.
4292
4293         * src/chown-core.c (change_file_owner): Return -1 on error, not
4294         1 sometimes and -1 on others.  Our caller ORs together our results,
4295         and (-1 | 1) == 0 on ones-complement hosts.
4296         With -v report all errors verbosely, not just some.
4297         Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
4298         file_stats wasn't set properly in that case.
4299
4300         * tests/chgrp/basic: Adjust to above changes.
4301
4302 2004-05-20  Paul Eggert  <eggert@cs.ucla.edu>
4303
4304         * tests/chgrp/basic: Test that chgrp -h does not fail on
4305         symlinks, even on hosts where that's not supported.
4306         Test that if -R is specified without -H or L, -h is assumed.
4307         Test that chown() is not optimized away.
4308
4309 2004-05-18  Paul Eggert  <eggert@cs.ucla.edu>
4310
4311         Several fixes to chgrp and chown for compatibility with POSIX and BSD:
4312
4313           Check for incompatible options.  When -R and --dereference are
4314           both used, then either -H or -L must also be used.  When -R and -h
4315           are both used, then -P must be in effect.
4316
4317           -H, -L, and -P have no effect unless -R is also specified.
4318           If -P and -R are both specified, -h is assumed.
4319
4320           Do not optimize away the chown() system call when the file's owner
4321           and group already have the desired value.  This optimization was
4322           incorrect, as it failed to updated the last-changed time and reset
4323           special permission bits, as POSIX requires.
4324
4325           Do not report an error if the owner or group of a
4326           recursively-encountered symbolic link cannot be updated because
4327           the file system does not support it.
4328
4329         * NEWS: Document the above.
4330
4331         * src/chgrp.c (main): Check for incompatible options.  -R --dereference
4332         requires either -H or -L, and -R -h requires -P.  If -H, specify
4333         FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster.  Make this
4334         file as much like chown.c as possible.
4335         * src/chown.c (main): Likewise.
4336
4337         * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
4338         needed.  Chown a directory only after chowning its children; this
4339         avoids problems if the new directory ownership doesn't permit
4340         access to the children.  Dereference symlinks before doing
4341         ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
4342         Do not optimize away the chown() system call when the file's owner
4343         and group already have the desired value.  POSIX does not permit
4344         this optimization.  Rely on chown and lchown to do the right
4345         thing with symlinks and/or -1 arguments, now that we have wrappers
4346         to do this.  Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
4347         errors, not just command-line errors.
4348         (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
4349
4350         * src/system.h (ENOTSUP): Remove.
4351
4352         * tests/chgrp/basic: Use chown --from to discover whether the
4353         group changed, since chgrp now changes unconditionally.  This
4354         complicates the sed script a bit.  Do not specify --dereference,
4355         since it's the default (and we want to test this).  Adjust output
4356         to match the fact that chgrp no longer optimizes the case of
4357         changing a file's group to the same value as before.
4358         * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
4359         options are incompatible, and their behavior is undefined with POSIX.
4360         (changed, not_changed): Adjust to match the fact that -h is no longer
4361         specified.  Sort names.
4362         * tests/chown/deref: Adjust error-diagnostic spelling to match new
4363         behavior.
4364
4365 2004-06-07  Paul Eggert  <eggert@cs.ucla.edu>
4366
4367         * src/uname.c (main): Fix typo introduced on 2003-05-10 that
4368         prevented a diagnostic of any operands.
4369
4370 2004-06-08  Jim Meyering  <jim@meyering.net>
4371
4372         * src/shred.c (direct_mode): Turn it on/off with directio, too.
4373
4374 2004-06-07  Jim Meyering  <jim@meyering.net>
4375
4376         Enable direct-mode I/O (bypassing the buffer cache), if possible.
4377         Prompted by a suggestion from Kalle Olavi Niemitalo
4378         in http://bugs.debian.org/207035.
4379         * src/shred.c (direct_mode): New function.
4380         (do_wipefd): Turn on direct-mode I/O.
4381         (dopass): If a file's first write fails with EINVAL,
4382         turn off direct-mode I/O and retry the write.
4383
4384 2004-06-05  Paul Eggert  <eggert@cs.ucla.edu>
4385
4386         * src/tr.c (main): "tr -d a b" is now a fatal error even if
4387         POSIXLY_CORRECT is set.  The POSIX SYNOPSIS does not allow this
4388         option combination.
4389
4390 2004-06-04  Paul Eggert  <eggert@cs.ucla.edu>
4391
4392         * src/shred.c (dopass): Don't subtract 1 from the offset after
4393         a write error.  Problem reported by Jon Peatfield in:
4394         http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
4395
4396 2004-06-02  Paul Eggert  <eggert@cs.ucla.edu>
4397
4398         Fix bug reported by Buciuman Adrian in
4399         <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
4400         where 'dd' created a file that was too large.  The bug was that dd
4401         assumed that the input file offset does not advance after a failed
4402         read; but POSIX says that the input file offset is undefined after
4403         a failed read.
4404
4405         * src/dd.c (MAX_BLOCKSIZE): New macro.
4406         (input_seekable, input_seek_errno, input_offset,
4407         input_offset_overflow): New vars.
4408         (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
4409         (advance_input_offset): New function.
4410         (skip_via_lseek): Set errno to zero when reporting our failure,
4411         so that we don't report based on garbage errno.
4412         (skip): If fdesc is standard input, advance the input offset.
4413         Do not quit if reading, and if noerror was specified;
4414         POSIX seems to require this.
4415         If read fails on output file, report the earlier lseek failure
4416         instead; this fixes a FIXME in dd_copy.
4417         (advance_input_after_read_error): New function.
4418         (dd_copy): Use it, instead of assuming that failed reads
4419         do not advance the file pointer.  Advance input offset
4420         after nonfailed reads.  Advance only a partial block if
4421         the previous read (before the failed read) succeeded, and
4422         do not generate an output block of zeros in this case.
4423         (main): Determine initial input offset, seekability of input,
4424         and error if it wasn't seekable.
4425
4426 2004-06-02  Jim Meyering  <jim@meyering.net>
4427
4428         rm (without -f) could hang unnecessarily when attempting to
4429         remove a symlink to a file on an off-line NFS-mounted partition.
4430         Reported by David Howells in https://bugzilla.redhat.com/124699.
4431         * src/remove.c (write_protected_non_symlink): New function.
4432         Don't invoke euidaccess on symlinks.
4433         (prompt): Use write_protected_non_symlink rather than using
4434         euidaccess directly, being careful not to call lstat twice for a file.
4435
4436         Fix a bug in how the --output-delimiter=D option works with
4437         abutting byte or character ranges.  Reported by David Krider in
4438         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
4439         * src/cut.c (print_kth): Remove special case for open-ended range.
4440         (set_fields): Record the range start index for an interval even
4441         when it abuts another interval on its low side.
4442         Also record the range start index of the longest right-open-interval.
4443         * tests/cut/Test.pm: Add tests of --output-delimiter=S with
4444         abutting and overlapping byte ranges.
4445
4446 2004-06-01  Paul Eggert  <eggert@cs.ucla.edu>
4447
4448         Some POSIX-conformance cleanups for tr.
4449
4450         * src/tr.c (posix_pedantic): Remove; no longer needed since
4451         we need to test this in just one place now.
4452         (usage): Mention -C.
4453         (unquote): Note that \055, \n, etc are escaped.
4454         Do not worry about POSIXLY_CORRECT when warning about ambiguous
4455         escape sequences.
4456         \ at end of string stands for itself.
4457         Do not diagnose invalid backslash escapes: POSIX says the behavior
4458         is unspecified in this case, so we don't need to diagnose it.
4459         (main): Add support for -C (currently an alias for -c).
4460         Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
4461         a diagnostic here.
4462         * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
4463         Fix comment for range-a-a.
4464
4465 2004-05-25  Paul Eggert  <eggert@cs.ucla.edu>
4466
4467         Improve the efficiency (and in one case, correctness) of code
4468         that reads symlinks.
4469
4470         * src/copy.c (copy_internal): Don't use alloca, as it can mess up
4471         royally if the link length is long (e.g., GNU/Hurd).  Use
4472         xreadlink instead, it's safer.  Don't bother to read the link if
4473         it's the wrong size.  Add a FIXME because this area is a bit murky
4474         and undocumented.
4475         * src/ls.c (get_link_name): Update use of xreadlink.
4476         * src/readlink.c (main): Likewise.
4477         * src/stat.c (print_stat): Likewise.
4478
4479 2004-06-01  Jim Meyering  <jim@meyering.net>
4480
4481         * src/env.c (main): Prefer the notation `STREQ (a, b)'
4482         over `!strcmp (a, b)'.
4483         * src/sort.c (main, sort_buffer_size): Prefer the notation
4484         `STREQ (a, b)' over `strcmp (a, b) == 0'.
4485         * src/date.c (batch_convert): Likewise.
4486         * src/expr.c (nextarg): Likewise.
4487         * src/su.c (correct_password, restricted_shell, main): Likewise.
4488         * src/ptx.c (swallow_file_in_memory, main): Likewise.
4489         * src/test.c (binary_operator, and, or, main): Likewise.
4490
4491 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4492
4493         * NEWS: echo compatibility cleanup.
4494         * doc/coreutils.texi (echo invocation): Document the changes.
4495         * src/echo.c (V9_ECHO): Remove; always enabled.
4496         (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
4497         we use the same naming convention as bash.  Now an enum,
4498         not a macro.
4499         (usage): Reword to mention -e/-E more accurately.
4500         Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
4501         (hextobin): New function.
4502         (main): Use bool rather than int for local vars when appropriate.
4503         Do not allow options if POSIXLY_CORRECT, unless we are using
4504         BSD semantics and the first argument is "-n".
4505         Don't pass unnecessary extra arg to parse_long_options.
4506         do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
4507         Do not look for options if !allow_options.
4508         Use size_t rather than int when appropriate.
4509         Open-code option test rather than using strrchr.
4510         Use faster test for "-".
4511         Avoid redundant argc test.
4512         Add support for \x, for Bash compatibility.
4513         Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
4514         When '\c' is encountered, stop printing immediately, as POSIX
4515         requires.
4516         Add support for \xhh syntax.
4517         Add support for \0ooo syntax; POSIX requires this.
4518
4519 2004-06-01  Jim Meyering  <jim@meyering.net>
4520
4521         * Use automake-1.8b.  Regenerate dependent files.
4522
4523 2004-05-31  Jim Meyering  <jim@meyering.net>
4524
4525         * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
4526         the build src/ directory -- at the front.
4527         ($(srcdir)/$x-tests): Depend on Makefile.am.
4528         Use $x as the program name, except when it would be `test' (test is
4529         the sole program tested via mk-script that is also a shell built-in).
4530         In that case, use the old ../../src/$x.
4531
4532 2004-05-30  Jim Meyering  <jim@meyering.net>
4533
4534         Work around HPUX /bin/cc compiler bug that is exposed, now that
4535         sets are arrays of type `bool'.  More details here:
4536         http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
4537         FIXME: verify that the above URL points to the right message
4538
4539         * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
4540         rather than `N_CHARS * sizeof(in_set[0])'.  Using HPUX's /bin/cc
4541         (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
4542         system, those two expressions are not the same (256 vs. 1024).
4543         The effect of this problem was that `tr -c x y' would fail:
4544         tr: when not truncating set1, string2 must be non-empty
4545         (set_initialize): Remove unnecessary initialization of the `in_set'
4546         buffer; that initialization triggered the same compiler bug as above.
4547
4548 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4549
4550         tr cleanup, mostly having to do with integer type ranges.
4551         Remove all casts.
4552
4553         * tests/tr/Test.pm: Add a few tests for the below.  Alas, most of
4554         the test cases wouldn't be portable, or would take too much CPU
4555         time, or both.
4556
4557         * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
4558         This is safe since the code already assumes N_CHARS fits in int.
4559         (Filter): Remove: we want to prototype everything.
4560         (ORD, CHR): Remove.  All uses removed.  Some replaced with:
4561         (uchar): New function.  All places where a char must be converted
4562         to an unsigned char are now done this way, not by ad-hoc methods.
4563         (count): New type.  Use it whenever counts or states are needed.
4564         (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
4565         since we used it in an unsigned int context) to UINTMAX_MAX - 1.
4566         (REPEAT_COUNT_MAXIMUM): New macro.  Use it in place of BEGIN_STATE
4567         whenever appropriate.
4568         (NOT_A_CHAR): Remove global macro; now a local enum.
4569         (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
4570         the rest of the code no longer depends on them.
4571         (class_ok): Remove; all uses changed to use inline comparisons.
4572         (RE_NO_TYPE): Remove; wasn't used or needed.
4573         (struct List_element): normal_char and equiv_code are now unsigned
4574         char, not int.
4575         first_char, last_char, and the_repeated_char are now unsigned char,
4576         not unsigned int.  repeat_count is now count, not size_t.
4577         All uses changed.
4578         (struct Spec_list): state is now count, not unsigned int.
4579         lengthis now count, not size_t.
4580         n_indefinite_repeats is now size_t, not int.
4581         has_equiv_class, has_char_class, and has_restricted_char_class
4582         are now bool, not int.  All uses changed.
4583         (struct E_string): s is now char *, not unsigned char *.
4584         escaped is now bool *, not int *.  All uses changed.
4585         (ES_MATCH): Remove macro, replacing with:
4586         (es_match): New inline function.  All uses changed.
4587         (squeeze_repeats, complement, posix_pedantic, truncate_set1,
4588         translating): Now bool, not int.
4589         (io_buf): Now char array, not unsigned char.
4590         (SET_TYPE): Remove.  All uses replaced with bool.
4591         (is_equiv_class_member, unquote, append_range, append_char_class,
4592         append_equiv_class, find_closing_delim, star_digits_closebracket,
4593         build_spec_list, parse_str, homogeneous_spec_list):
4594         Now returns bool, not int.  All uses changed.
4595         (is_equiv_class_member): Now inline.
4596         (is_equiv_class_member, is_char_class_member, make_printable_str,
4597         append_normal_char, append_range, append_repeated_char,
4598         get_s2_spec_stats):
4599         Args are now of proper integer type.
4600         (unquote, look_up_char_class, make_printable_str,
4601         append_equiv_class, build_spec_list, squeeze_filter):
4602         Avoid unsigned char *p; gently convert *p to unsigned char instead.
4603         (unquote, get_spec_stats): Do not jump past declarations and then
4604         use them; C doesn't allow this in portable programs.
4605         (make_printable_str): Check for overflow in size calculations.
4606         (xmemdup): Remove.  All uses rewritten.
4607         (find_bracketed_repeat): Args are now of proper pointer-to-integer
4608         type.  Do not reject [c*0].  Use xstrtoumax, not xstrtoul.
4609         (find_bracketed_repeat, star_digits_closebracket): Check that the
4610         digits are not escaped.
4611         (build_spec_list): Don't bother to copy opnd_str; not needed.
4612         (build_spec_list, get_next): Simplify internal logic a bit.
4613         (card_of_complement): Fix bug due to char overflow.
4614         (get_spec_stats): Don't assume len fits into int.
4615         Check for integer overflow.  Use abort() rather than assert(0).
4616         (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4617         was being invoked.
4618         (squeeze_filter): READER is never null now; simplify code.
4619         READER arg now has a simpler type.  Remove unnecessary casts.
4620         (squeeze_filter, main): Calls to fwrite improperly checked result
4621         against zero, rather than against requested size.
4622         (plain_read): New function.
4623         (read_and_delete, read_and_xlate):
4624         Remove unused filter arg, and don't worry about hit_eof.
4625         Simplify by using plain_read.
4626         (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4627         (main): Always pass a non-null procedure to squeeze_filter.
4628         Rewrite so that class_ok isn't needed.
4629
4630 2004-05-29  Paul Eggert  <eggert@cs.ucla.edu>
4631
4632         * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4633         fdatasync reports EBADF when syncing (unwritable) directories.
4634         Problem reported by Albert Chin-A-Young in:
4635         http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4636
4637 2004-05-29  Jim Meyering  <jim@meyering.net>
4638
4639         * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4640         Patch from Albert Chin.
4641
4642         * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4643
4644         * src/remove.c (push_dir): Merge declaration and adjacent assignment
4645         into a single statement.
4646
4647 2004-05-28  Jim Meyering  <jim@meyering.net>
4648
4649         * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4650
4651 2004-05-22  Jim Meyering  <jim@meyering.net>
4652
4653         rm -r would get a failed assertion when run from an inaccessible
4654         directory and with two or more command line arguments including an
4655         absolute-named directory followed by a relative-named directory.
4656
4657         * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4658         * src/remove.c (struct cwd_state): Define.
4659         (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4660         can be detected by the caller.  Instead of returning a malloc'd
4661         directory name, communicate it to caller via a new parameter, and
4662         return an indication of whether restore_cwd failed.  Update caller.
4663         Eliminate an unnecessary call to AC_stack_top.
4664         (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4665         so we can now communicate to caller whether/how functions like
4666         restore_cwd have failed.  Update caller.
4667         (rm_1): Fail if we've failed to restore the working directory
4668         and the name of the next file to remove is `.'-relative.
4669         (rm): Fail if the require_restore_cwd flag is true and we've
4670         failed to restore the working directory.
4671         * src/mv.c (rm_option_init): Initialize new member,
4672         x->require_restore_cwd.
4673         * src/rm.c (rm_option_init): Likewise.
4674
4675 2004-05-21  Jim Meyering  <jim@meyering.net>
4676
4677         * tests/rm/inaccessible: New test for the above fix.
4678         * tests/rm/Makefile.am (TESTS): Add inaccessible.
4679
4680         * src/remove.c (rm): Use free rather than XFREE.
4681         (remove_dir): Use xmalloc, not XMALLOC.
4682         (ds_init): Likewise.
4683
4684 2004-05-20  Jim Meyering  <jim@meyering.net>
4685
4686         * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4687         diagnostics in shred.c have been fixed, don't exempt shred.c from
4688         this check.
4689
4690         * src/shred.c: Use translatable diagnostics, e.g.
4691         change "%s: remove" to _("%s: failed to remove") and
4692         change "%s: close"  to _("%s: failed to close").
4693
4694 2004-05-17  Paul Eggert  <eggert@cs.ucla.edu>
4695
4696         * src/shred.c (names): Bring back lower-case letters, "_", and
4697         ".".  But continue to omit +, =, %, @, #, as they're either
4698         shell metacharacters (for some shells) or are not in some
4699         character sets, or (in the case of '%') must be a
4700         metacharacter somewhere.
4701
4702 2004-05-16  Paul Eggert  <eggert@cs.ucla.edu>
4703
4704         * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4705
4706 2004-05-17  Jim Meyering  <jim@meyering.net>
4707
4708         * src/shred.c (incname): Decrement `len' only once per loop iteration.
4709
4710         chgrp and chown now dereference symlinks by default, per POSIX.
4711         Reported by Michal Politowski as http://bugs.debian.org/249177.
4712
4713         * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4714         * src/chown.c (usage): Update to reflect this.
4715         * src/chgrp.c (usage): Likewise.
4716         * NEWS: Describe the change.
4717         Adapt tests accordingly.
4718         * tests/chgrp/basic: Use -h where necessary to retain semantics.
4719         * tests/chgrp/deref: Likewise.
4720         * tests/chgrp/posix-H: Likewise.
4721
4722 2004-05-15  Paul Eggert  <eggert@cs.ucla.edu>
4723
4724         In shred, check for errors from fdatasync more carefully.  If
4725         fdatasync fails with errno==EINVAL, it means this implementation
4726         does not support synchronized I/O for this file.  Do not report
4727         this as an error, as (for example) AIX 5.2 fdatasync reports it
4728         for raw disk devices.  Problem reported by Albert Chin in
4729         <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4730
4731         Check for write errors, though: the old code ignored them.
4732         Improve error checking in a few other cases, too (e.g., close of a
4733         directory).
4734
4735         Also, change several 'int' values to 'bool', so that the error
4736         checking is a bit clearer.  Similarly, change unsigned values
4737         to size_t where appropriate.
4738
4739         * src/shred.c: Include "dirname.h".
4740         (datasync) [!HAVE_FDATASYNC]: Remove.
4741         (dosync): New function.
4742         (dopass): Use it.  Return 1 on write error, -1 on other error.
4743         All callers changed.  Report write error if dosync does.
4744         (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4745         not int (0/-1).  All callers changed.  Return false if there's a
4746         write error.
4747         (incname): Return bool (true/false), not int (0/1).  Accept
4748         size_t length, not unsigned.  All callers changed.  Do not
4749         bother checking for non-digits; it can't happen.  Replace
4750         recursion with iteration.
4751         (wipename): Use dir_name, base_name, etc. instead of assuming
4752         Unix file names.  Use size_t for length, not unsigned.
4753         Report error if unlink or close fails.
4754         (wipename, main): Use bool for booleans.
4755
4756         (names): Use only digits and uppercase letters, for greater
4757         portability.
4758
4759 2004-05-16  Jim Meyering  <jim@meyering.net>
4760
4761         * tests/chown/deref: New test for the yesterday's change.
4762         * tests/chown/Makefile.am (TESTS): Add deref.
4763
4764 2004-05-15  Jim Meyering  <jim@meyering.net>
4765
4766         chown --dereference did nothing when the owner/group of a
4767         symlink matched the desired owner/group.  Reported by David Malone.
4768         Also reported in 1999 as http://bugs.debian.org/39642.
4769
4770         * src/chown-core.c (change_file_owner): When --dereference has
4771         been specified, and when processing a symlink, stat it to get the
4772         owner and group of the referent.
4773
4774 2004-05-14  Jim Meyering  <jim@meyering.net>
4775
4776         * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4777         s/supercede/supersede/ reported by Andrew Fabbro.
4778
4779 2004-05-13  Paul Eggert  <eggert@cs.ucla.edu>
4780
4781         Improve performance of `sort -m' on large files, at the cost of
4782         making some contrived examples unsafe.  POSIX allows this
4783         optimization.  Performance problem reported by Jonathan Baker in
4784         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4785
4786         * src/sort.c (first_same_file): Do not treat input pipes
4787         differently from other files.
4788         * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4789         might write F before reading all the input.
4790         * NEWS: Likewise.
4791
4792 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4793
4794         * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4795         '\007', for portability to EBCDIC hosts.
4796         * src/printf.c (print_esc_char): Likewise.
4797         * src/tr.c (unquote, make_printable_str): Likewise.
4798
4799 2004-05-12  Jim Meyering  <jim@meyering.net>
4800
4801         * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4802         where the result is used.  This avoids one unnecessary lstat call
4803         per command line argument.
4804
4805 2004-05-12  Paul Eggert  <eggert@cs.ucla.edu>
4806
4807         Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4808
4809         * src/Makefile.am (all_programs.list): New rule, copied from
4810         man/Makefile.am and tests/Makefile.am, except that we use the
4811         system tr rather than ./tr and we don't use tr -s.
4812         * tests/Makefile.am (all_programs): Use it.
4813         * man/Makefile.am (all_programs): Likewise.  Renamed from programs,
4814         for consistency.  All uses changed.
4815
4816 2004-05-11  Jim Meyering  <jim@meyering.net>
4817
4818         * tests/rm/unread3: New test, for the above fix and today's
4819         lib/save-cwd.c improvement.
4820         * tests/rm/Makefile.am (TESTS): Add unread3.
4821
4822         * src/rm.c: Don't include "save-cwd.h".  It's no longer used.
4823
4824 2004-05-10  Jim Meyering  <jim@meyering.net>
4825
4826         * tests/install/trap: New file.  Test for bug fix of 2004-04-18.
4827         * tests/install/Makefile.am (TESTS): Add trap.
4828
4829         * src/remove.c (AD_push): Don't use errno in diagnostic about
4830         `changed dev/ino'.
4831
4832         Remove these generated files from CVS.
4833         * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4834         * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4835         * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4836         * tests/tr/tr-tests, tests/wc/wc-tests:
4837
4838 2004-05-09  Jim Meyering  <jim@meyering.net>
4839
4840         * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4841         a loop initializing the just-allocated memory to zero.
4842
4843 2004-05-08  Jim Meyering  <jim@meyering.net>
4844
4845         * tests/rm/no-give-up: New file; check for today's fix.
4846         * tests/rm/Makefile.am (TESTS): Add no-give-up.
4847
4848 2004-05-08  Paul Eggert  <eggert@cs.ucla.edu>
4849
4850         Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4851         <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4852
4853         * src/remove.c (remove_entry): Check for errno values like ENOENT
4854         that show the file cannot be directory, instead of for errno
4855         values like EPERM that show the file might be a directory.  This
4856         is necessary because, when a single unlink() call has multiple
4857         reasons to fail, it can set errno to any of those reasons; it's
4858         only the rare errno value like ENOENT that excludes all the other
4859         possible reasons to fail even when the file is a directory.
4860         (remove_cwd_entries): Don't attempt chdir if the file is known
4861         to not be a directory.
4862         (remove_dir): Use the same method that remove_cwd_entries uses
4863         (for some reason they differed).  Don't assert that saved_errno
4864         must be EPERM; it might be just about anything.
4865
4866 2004-05-06  Jim Meyering  <jim@meyering.net>
4867
4868         * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4869         Don't add `1' to the buffer size (it was to protect against malloc
4870         implementations that fail to allocate a buffer of size zero).
4871         That is no longer necessary, since we use a malloc wrapper
4872         on such systems.
4873
4874         * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4875         * src/head.c (elide_tail_bytes_pipe): Likewise.
4876         * src/df.c (main): Likewise.
4877         * src/shred.c (do_wipefd): Likewise.
4878         * src/users.c (list_entries_users): Likewise.
4879         * src/tail.c (main): Likewise.
4880         * src/md5sum.c (main): Likewise.
4881
4882 2004-04-29  Paul Eggert  <eggert@cs.ucla.edu>
4883
4884         * src/df.c (show_disk, show_point): If several filesystems are
4885         mounted on the same mount point, prefer the last one, not the first.
4886         Problem reported by Christian Jones in
4887         <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4888         (show_disk): Remove unused statp arg.  Return bool, not int.
4889         (show_point): Rewrite to avoid gotos.  Use the same algorithm
4890         for lofs and dummies for each pass through the mount table,
4891         rather than subtly different algorithms (which are probably
4892         inadvertent).
4893
4894 2004-05-03  Jim Meyering  <jim@meyering.net>
4895
4896         * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4897         have m4/Makefile*.
4898
4899 2004-05-01  Jim Meyering  <jim@meyering.net>
4900
4901         When chown or chgrp is modifying the referent of a symlink,
4902         use the chown(2) function, if possible.
4903         * src/chown-core.c (change_file_owner): Don't hard-code the
4904         open/fchown/close kludge here.  Use `chown' instead.
4905         The chown function works just fine on conforming systems.
4906         Other systems now go through the new chown wrapper that
4907         resorts to the old kludge.
4908
4909         * src/chown-core.c (change_file_owner): Add a comment.
4910
4911 2004-04-27  Jim Meyering  <jim@meyering.net>
4912
4913         * src/ptx.c: Make over 40 global extern variables `static'.
4914         (syntax_table, re_syntax_table): Remove declarations of two unused
4915         variables (they were exposed by the above change).
4916
4917         * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4918         * src/ln.c (backup_type): Likewise.
4919
4920         * src/remove.c (rm): Add `extern' keyword.
4921         * src/cp-hash.c (forget_created, remember_created)
4922         (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4923         * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4924         * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4925         (uid_to_name, chown_files): Likewise.
4926
4927         * src/Makefile.am (sc_tight_scope): New rule.
4928         * Makefile.maint (sc_tight_scope): New rule.
4929         (syntax-check-rules): Add it.
4930
4931 2004-04-26  Jim Meyering  <jim@meyering.net>
4932
4933         * Use automake-1.8.4.  Regenerate dependent files.
4934
4935         * src/sort.c (limfield): Make a comment clearer.
4936
4937 2004-04-25  Paul Eggert  <eggert@twinsun.com>
4938
4939         Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4940         leading blanks when computing the location of the field end;
4941         it is not supposed to skip trailing blanks.  Solaris 8 "sort"
4942         does conform to POSIX.  Also fix the documentation to clarify
4943         this and related issues.
4944
4945         * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4946         that the options are in alphabetical order.  Describe how -b works
4947         more-accurately; this involves fixing some examples, too.  Mention
4948         what happens if the start field falls after an end field or after
4949         a line end.  Warn about using -k without -b, -g, -M, -n, or -t.
4950         Add an example of how to sort IPv4 addresses and Apache Common
4951         Log Format dates.  Remove a duplicate example.
4952         (Putting the tools together): Use separate options rather
4953         than agglomerating them.
4954         * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4955         decode whether to skip leading blanks.
4956         (trailing_blanks): Remove.
4957         (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4958
4959         * tests/pr/Test.pm: Fix typo in env_default comment.
4960         * tests/sort/Test.pm: Likewise.
4961         (18c, 18d): Reverse the order of output lines, so that the
4962         test cases conform to POSIX.
4963
4964 2004-04-22  Paul Eggert  <eggert@twinsun.com>
4965
4966         More signal-handling cleanup for ls.c.  Do not allow signals to
4967         happen between arbitrary output bytes, as the
4968         restore-default-color sequence can bollix up multibyte chars or
4969         color-change sequences in the ordinary output.  Instead, process
4970         signals only between printing a file name and changing the color
4971         back to non_filename_text color.  That way, if the signal handler
4972         changes the color (to the default), 'ls' will change it back when
4973         'ls' continues (after being suspended).
4974
4975         Also, do not bother with signal-handling unless stdout is a
4976         controlling terminal; this lets stdio buffer better when "ls
4977         --color" is piped or sent to a file.
4978
4979         * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4980         Do not include "full-write.h"; no longer needed.
4981         (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4982         (put_indicator_direct): Remove.  All callers changed to use
4983         put_indicator.
4984         (caught_signals, interrupt_signal, stop_signal_count): New vars.
4985         (restore_default_color): Don't bother checking for put_indicator
4986         failure.
4987         (sighandler): Don't handle SIGTSTP; that's another handler now.
4988         Simply set interrupt_signal to the signal, then exit.
4989         (stophandler, process_signals): New functions.
4990         (main): Don't output any color changes until _after_ the signal
4991         handlers are set up.  This fixes a race condition where 'ls'
4992         could be interrupted while initializing colors, and leaving the
4993         terminal in an undesirable state.
4994         Don't mess with signal-handling if standard output is not a
4995         controlling terminal.
4996         When exiting, restore the default color, then restore the
4997         default signal handling, then act on any signals that weren't
4998         acted on yet.
4999         Do not print //DIRED// etc. in colors; this avoids the need
5000         to catch signals when printing them.
5001         (print_name_with_quoting): Process signals just before switching
5002         color back to non_filename_text.
5003
5004 2004-04-23  Jim Meyering  <jim@meyering.net>
5005
5006         Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
5007         * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
5008         of quotearg_buffer.  Patch by Mikulas Patocka.
5009
5010 2004-04-18  Paul Eggert  <eggert@twinsun.com>
5011
5012         tee ignored SIGPIPE, but POSIX doesn't allow this.
5013
5014         * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
5015         does not allow this.  This undoes the 1996-10-24 patch.
5016
5017 2004-04-18  Paul Eggert  <eggert@twinsun.com>
5018
5019         Signal-handling cleanup for coreutils.  Here are the highlights:
5020
5021          - csplit sometimes failed to remove files when interrupted.
5022          - csplit didn't clean up if two signals arrived nearly simultaneously.
5023          - install -s would infloop on System V if SIGCHLD was ignored.
5024          - ls could incorrectly restore color if multiple signals
5025            arrived nearly simultaneously.
5026
5027         * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
5028         Define.
5029         (filename_space, prefix, suffix, digits, files_created, remove_files):
5030         Now volatile.
5031         (caught_signals): New var.
5032         (cleanup): Block signals while deleting all files.
5033         (cleanup_fatal, handle_line_error, regexp_error):
5034         Mark with ATTRIBUTE_NORETURN.
5035         (create_output_file, close_output_file, interrupt_handler):
5036         Block signals while changing the number of output files,
5037         to fix some race conditions.
5038         (delete_all_files): Do nothing if remove_files is zero.
5039         Clear files_created.
5040         (main): Don't mess with signals until after argument processing
5041         is done.
5042
5043         * src/csplit.c (main): Rewrite signal-catching code to make it
5044         similar to other coreutils programs.  When processing signals,
5045         block all signals that we catch, but do not block signals that we
5046         don't catch.  Avoid problems with unsigned int warnings.
5047         * src/ls.c (main): Likewise.
5048         * src/sort.c (main): Likewise.
5049
5050         * src/csplit.c (interrupt_handler):
5051         Use void, not (obsolete) RETSIGTYPE.
5052         * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
5053
5054         * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
5055         Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
5056         * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
5057         * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
5058         * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
5059         for SIG_IGN.
5060         * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
5061
5062         * src/install.c: Include <signal.h>.
5063         (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
5064         given, since System V fork+wait does not work if SIGCHLD is ignored.
5065
5066         * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
5067         handler to self, not to SIG_IGN, since SIGTSTP can be received
5068         more than once.
5069         (main): Use SA_RESTART, as that is simpler than checking for EINTR
5070         failures all over the place.
5071
5072 2004-04-20  Jim Meyering  <jim@meyering.net>
5073
5074         * src/remove.c (is_empty_dir): Clarify comment.
5075
5076         * man/help2man: Accept new option: --program-name=NAME, so that we
5077         can override the one in --version output.  This is needed solely
5078         so that test.1 doesn't refer to `[' as the program name.
5079         Reported by Benjamin Cutler as http://bugs.debian.org/205251.
5080         * man/Makefile.am (.x.1): Use help2man's new --program-name option.
5081
5082         * src/pwd.c: Don't include pathmax.h; system.h already does it.
5083
5084         * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
5085
5086 2004-04-19  Jim Meyering  <jim@meyering.net>
5087
5088         * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
5089         Initialize a buffer to avoid warnings from tools like valgrind.
5090
5091         * Makefile.maint (sc_trailing_blank): New rule.
5092         (syntax-check-rules): Add it.
5093         * .x-sc_trailing_blank: New file.
5094
5095         Make pwd work even if the resulting name is so long that getcwd fails.
5096         * src/pwd.c: (path_free, path_init, path_prepend): New functions.
5097         (nth_parent, find_dir_entry, robust_getcwd): New functions.
5098         (main): First try getcwd, then, upon failure, robust_getcwd.
5099
5100 2004-04-18  Jim Meyering  <jim@meyering.net>
5101
5102         * src/who.c (print_user): Use xrealloc here, rather than
5103         unchecked realloc.  Remove anachronistic casts.
5104
5105         * src/remove.c (full_filename_): Don't leak upon failed realloc.
5106
5107         * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
5108         from remove.c.
5109         * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
5110         renaming it.  Update uses.
5111
5112 2004-04-17  Jim Meyering  <jim@meyering.net>
5113
5114         * configure.ac: Depend on automake-1.8.3.
5115
5116         * src/join.c (add_file_name): Declare function to be `static'.
5117         (string_to_join_field): Likewise.
5118         * src/remove.c (ds_init, ds_free): Likewise.
5119
5120         * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
5121         (syntax-check-rules): Add to the list.
5122
5123 2004-04-13  Paul Eggert  <eggert@twinsun.com>
5124
5125         Use page-aligned buffers whenever we bother to do I/O using buffer
5126         sizes that are tailored for the files.
5127
5128         * src/cat.c: Include getpagesize.h.
5129         * src/copy.c: Likewise.
5130         * src/shred.c: Likewise.
5131         * src/split.c: Likewise.
5132         * src/cat.c (main): Align I/O buffers to page boundaries.
5133         * src/copy.c (copy_reg): Likewise.
5134         * src/shred.c (dopass): Likewise.
5135         * src/split.c (main): Likewise.
5136         * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
5137         All uses replaced by ptr_align.
5138         * src/od.c (gcd, lcm): Remove; now in system.h.
5139         * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
5140
5141 2004-04-14  Jim Meyering  <jim@meyering.net>
5142
5143         Remove m4/Makefile.am: it's no longer needed, with newer automake
5144         * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
5145         * Makefile.am (SUBDIRS): Remove `m4' from the list.
5146
5147 2004-04-13  Jim Meyering  <jim@meyering.net>
5148
5149         * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
5150
5151 2004-03-27  Paul Eggert  <eggert@twinsun.com>
5152
5153         * NEWS: cp -pu and mv -u (when copying) now take the destination
5154         file system time stamp resolution into account.
5155         * doc/coreutils.texi (mv invocation): Document this.
5156         (cp invocation): Document -u (it was missing!) with new behavior.
5157
5158         * src/copy.c: Include "utimecmp.h".
5159         (copy_internal): Compare time stamps using utimecmp rather than
5160         MTIME_CMP.
5161
5162 2004-04-09  Jim Meyering  <jim@meyering.net>
5163
5164         * Makefile.maint (.re-list): New rule/file, to replace
5165         hard-coded list of header file names.
5166         (sc_system_h_headers): Use the new file.
5167         Don't look for sys2.h anymore.
5168
5169         * src/system.h: Include new "stat-macros.h" rather than hard-coding
5170         all of its macro definitions -- the list was slightly out of date.
5171         Suggestion from Dmitry V. Levin.
5172
5173 2004-04-08  Paul Eggert  <eggert@cs.ucla.edu>
5174
5175         * NEWS: Remove noctty flag from dd.  Suggested by Philippe Troin.
5176         * doc/coreutils.texi (dd invocation): Likewise.
5177         * src/shred.c (O_NOCTTY): Remove redundant decl.
5178         * src/dd.c (flags, usage): Remove noctty flag.
5179         (main): Always use O_NOCTTY when opening files.
5180
5181 2004-04-08  Jim Meyering  <jim@meyering.net>
5182
5183         * src/dd.c (dd_copy): Mark two diagnostics for translations.
5184         (set_fd_flags): Undo part of today's change: it's a little
5185         cleaner -- and more efficient in the common case -- to go
5186         ahead and OR in the -1 when fcntl fails.
5187
5188         * Makefile.maint (sc_dd_max_sym_length): New target.
5189         (syntax-check-rules): Add it.
5190
5191         * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
5192         Correct spelling: s/shasum/sha1sum.  Reported by Jesse Kornblum.
5193
5194         * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
5195         Rename parameter, flags, to avoid shadowing global.
5196         (LONGEST_SYMBOL): Tweak comment.
5197
5198 2004-04-07  Paul Eggert  <eggert@twinsun.com>
5199
5200         * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
5201         and new dd options iflag= and oflag=.
5202         * src/dd.c (usage): Likewise.
5203         * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
5204         * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
5205         (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
5206         (input_flags, output_flags): New vars.
5207         (LONGEST_SYMBOL): New macro.
5208         (struct symbol_value): Renamed from struct conversion.  Members
5209         symbol and value renamed from convname and conversion.  The
5210         symbol value is now an array instead of a pointer; this saves
5211         a bit of space and time in practice.  All uses changed.
5212         (conversions): Add nocreat, excl, fdatasync, fsync.  Now const.
5213         (flags): New constant array.
5214         (iflag_error_msgid, oflag_error_msgid): New constants.
5215         (parse_symbols): Renamed from parse_conversion and generalized
5216         to handle either conversion or flag symbols.
5217         (scanargs): Adjust uses of parse_symbols accodingly.  Add
5218         support for iflag= and oflag=.  Reject attempts to use
5219         both excl and nocreat.
5220         (set_fd_flags): New function.
5221         (dd_copy): Just return X rather than calling quit (X), since our
5222         caller invokes quit with the returned value.  Add support for
5223         fdatasync and fsync.
5224         (main): Add support for iflag=, oflag=, and new conv= symbols.
5225         * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
5226         O_RSYNC, O_SYNC): Define to 0 if not already defined.
5227
5228         * NEWS: Remove duplicate mention of BLOCKSIZE.
5229
5230 2004-04-02  Andreas Schwab  <schwab@suse.de>
5231
5232         * src/stty.c: Add support for IUTF8 input flag.
5233
5234 2004-04-06  Jim Meyering  <jim@meyering.net>
5235
5236         * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
5237         Interix spells it `mkdev'.  Reported by Mark Funkenhauser.
5238
5239 2004-04-04  Jim Meyering  <jim@meyering.net>
5240
5241         A specified format is no longer automatically newline terminated.
5242         If you want a newline at the end of your format, use `\n'.
5243         * src/stat.c (print_it): Don't print a newline at the end of
5244         every format.
5245         (do_statfs): Add a newline at end of each default format string.
5246
5247 2004-03-30  Paul Eggert  <eggert@twinsun.com>
5248
5249         * src/nohup.c (main): Adjust to new calling convention
5250         for set_cloexec_flag.
5251
5252 2004-03-31  Jim Meyering  <jim@meyering.net>
5253
5254         * tests/Fetish.pm (run_tests): Remove `.orig' file.
5255         Remove debugging diagnostic.
5256
5257         Specifying an invalid --width=N (-w) or --gap-size=N (-g)
5258         would not elicit an error.
5259         * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
5260         (main): Don't use atoi.  Use xstrtoul instead.
5261
5262 2004-03-30  Jim Meyering  <jim@meyering.net>
5263
5264         * Makefile.maint (sc_prohibit_atoi_atof): New rule.
5265         (syntax-check-rules): Add it.
5266         * .x-sc_prohibit_atoi_atof: New file.
5267
5268 2004-03-29  Jim Meyering  <jim@meyering.net>
5269
5270         * tests/du/files0-from: Use new OUT_SUBST directive, so that this
5271         test is not sensitive to system-dependent block size differences.
5272         Prompted by a report of Solaris 8 differences from Paul Eggert.
5273
5274         * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
5275         Rename `%tmp' to `%actual'.  Reverse order of last two args to
5276         _compare_files (to $actual, $expected) so as to match declaration.
5277
5278 2004-03-28  Paul Eggert  <eggert@twinsun.com>
5279
5280         Fix some gotchas encountered when porting to Solaris 8, using
5281         the Forte 6u2 compiler.
5282
5283         * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
5284         Declare sethostname, since no Solaris header does it.
5285         * src/who.c: Include "vasprintf.h", for asprintf.
5286
5287 2004-03-28  Jim Meyering  <jim@meyering.net>
5288
5289         Minor optimization:
5290         * src/du.c (process_file): Don't record dev/inode for directories.
5291
5292         Under some circumstances, without -c, du would mistakenly count the
5293         space of hard-linked files, not just the first one it encountered.
5294         Reported by Anthony Thyssen.
5295         * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
5296
5297         * src/du.c: Rename global `print_totals' to `print_grand_total'.
5298
5299         * src/du.c (main): Rearrange filtering loop to be a tiny bit
5300         more efficient.
5301
5302         * src/chown-core.c: Don't include savedir.h -- no longer needed.
5303         * src/chmod.c: Likewise.
5304
5305 2004-03-25  Jim Meyering  <jim@meyering.net>
5306
5307         * src/du.c (main): Remove now-unused declaration of `i'.
5308
5309 2004-03-24  Paul Eggert  <eggert@twinsun.com>
5310
5311         * src/du.c (main): Filter out file names of length zero before
5312         invoking fts, so that they don't cause fatal errors.
5313
5314 2004-03-25  Jim Meyering  <jim@meyering.net>
5315
5316         * tests/du/files0-from (zero-len): Add a test for the above.
5317
5318 2004-02-25  Paul Eggert  <eggert@twinsun.com>
5319
5320         * NEWS: New environment var BLOCKSIZE.
5321         * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
5322         * tests/envvar-check: Test for it.  Factor the code to simplify it.
5323
5324 2004-03-23  Paul Eggert  <eggert@twinsun.com>
5325
5326         * NEWS: Shorten the du --files0-from announcement, and say
5327         "NUL-terminated" rather than "NUL-separated".
5328         * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
5329         Remove: not used.
5330         (usage): Say "NUL-terminated", not "NUL-separated".
5331         (main): Check for I/O error when istream is closed.
5332         Allow --files0-from=F even if F is empty; this specifies no files.
5333         (du_files): Now that we allow the list of files to be empty,
5334         handle that case.
5335         * tests/du/files0-from: Adjust to above changes to src/du.c.
5336
5337 2004-03-24  Jim Meyering  <jim@meyering.net>
5338
5339         * tests/tail-2/assert: Avoid race condition that could cause
5340         spurious failure.  Based on a patch from Andreas Schwab.
5341
5342 2004-03-23  Jim Meyering  <jim@meyering.net>
5343
5344         * src/du.c (main): Free the hash table, too.
5345
5346 2004-03-22  Jim Meyering  <jim@meyering.net>
5347
5348         * man/Makefile.am (.x.1): Remove --info-page= option, reverting
5349         the change of 2004-01-22.  I can no longer reproduce the problem
5350         that prompted that change, and `info coreutils pr' would display the
5351         `printing text' section of the manual, not the one on `pr invocation'.
5352
5353         * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
5354         to match corrected output.
5355
5356         * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
5357         (main): Use readtoken0 functions rather than readtokens.
5358         Don't use errno when diagnosing readtokens0 failure.
5359         Fix off-by-one error in the token number reported in a diagnostic.
5360         (du_files): Return bool, rather than int.
5361         (main): Call readtokens0_free.
5362
5363 2004-03-21  Jim Meyering  <jim@meyering.net>
5364
5365         * src/remove.c (ds_free): Plug a small leak.
5366
5367         * tests/Fetish.pm: Fix typo in comment.
5368
5369 2004-03-07  Jim Meyering  <jim@meyering.net>
5370
5371         * NEWS: du accepts a new option --files0-from=FILE, where FILE
5372         contains a list of NUL-separated file names.
5373
5374         * src/du.c: Include "readtokens.h".
5375         (usage): Describe the new option, and adjust the `Usage':
5376         with this option, no FILE may be specified on the command line.
5377         (main): Handle the new option.
5378
5379         * tests/du/files0-from: New tests, for the above.
5380         * tests/du/Makefile.am (TESTS): Add files0-from.
5381
5382         * src/factor.c (do_stdin): Reflect changes in use of readtoken.
5383         * src/tsort.c (tsort): Likewise.
5384
5385 2004-02-29  Paul Eggert  <eggert@twinsun.com>
5386
5387         * NEWS: Add support for a new notation @N to get_date to represent
5388         the time stamp with numeric value N.  Improve support for
5389         fractional time stamps.  date's -d and -f options now accept them.
5390         Likewise for touch -t.  date has a new option --iso-8601=ns.
5391
5392         * doc/coreutils.texi (touch invocation):
5393         Describe use of fractional seconds.
5394         (date invocation, Options for date): Likewise.
5395         * doc/getdate.texi (General date syntax, Time of day items): Likewise.
5396         * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
5397         (Options for date): Describe new --iso-8601=ns option.
5398
5399         * doc/getdate.texi: Add copyright notice.  Change getdate to
5400         get_date when talking about the function name.
5401         (Seconds since the Epoch): New section, containing the time_t
5402         info moved from Date input formats section, along with new
5403         info about the @ syntax.  Mention negative time stamps,
5404         fractional time stamps, and leap seconds.
5405         (General date syntax): Modernize examples a bit to reflect new
5406         features.
5407         (General date syntax, Relative items in date strings):
5408         Use ' rather than " to quote formats.
5409         (Time of day items): Add an example with fractional seconds.
5410         Describe fractional-second syntax.
5411
5412         * src/Makefile.am (touch_LDADD): New macro, since `touch' now
5413         needs clock_gettime.
5414
5415         * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
5416         (time_spec_string, time_spec, show_date): Support it.
5417         (usage): Remove description of -ITIMESPEC, as it's obsolete and
5418         confusing.  Mention --iso-8601=ns.
5419         (batch_convert): getline returns ssize_t, not int.
5420
5421         * src/touch.c (newtime): Now an array of two timespecs, one
5422         for access and one for modification.
5423         (ref_stats): Remove.
5424         (get_reldate): Use get_date's parameter profile.
5425         (touch, main): Adjust to above changes.
5426         (main): Work even if tm_year == INT_MAX (so long as long int is wider).
5427         Use gettime instead of gettimeofday, for new get_date signature.
5428
5429         * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
5430         ns-relative.
5431
5432 2004-03-15  Jim Meyering  <jim@meyering.net>
5433
5434         * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
5435         target before updating $(prev_version_file).
5436
5437         * tests/misc/date-sec: New file, to test for just-fixed bug in date.
5438         See today's change in lib/getdate.y.
5439         * tests/misc/Makefile.am (TESTS): Add date-sec.
5440
5441 2004-03-14  Jim Meyering  <jim@meyering.net>
5442
5443         * announce-gen (print_changelog_deltas): Use `.sig' suffix for
5444         signature files, not `.asc'.  Reported by angico@yahoo.com.
5445
5446 2004-03-13  Jim Meyering  <jim@meyering.net>
5447
5448         * src/cp.c (do_copy): Tweak wording in a diagnostic.
5449         Suggestion from Karl Berry.
5450         Include "quoatearg.h".
5451         (do_copy): Use quotearg_colon (not quote) for diagnostics
5452         that begin with `"%s:'.
5453
5454         * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
5455         Suggestion from Dan Jacobson.
5456
5457 2004-03-12  Jim Meyering  <jim@meyering.net>
5458
5459         * Version 5.2.1.
5460
5461         Sometimes, when source and destination partition are different,
5462         mv mistakenly fails to preserve a hard link.  Reported by IIDA Yosiaki.
5463
5464         * src/copy.c: When moving a set of N hard-linked files between
5465         partitions, via two or more command line arguments where the
5466         command line argument containing the Nth link contains no other
5467         link to that same file, mv would mistakenly copy the file, rather
5468         than hard-linking it to the other(s).  That happens because when the
5469         final link is processed, its link count has been reduced to 1 since
5470         the other links have been `copied' to the destination partition
5471         and the source links have been removed.
5472         (copy_internal): When in move mode, use the source dev/inode
5473         pair to look up destination name even when st_nlink == 1.
5474         * src/cp-hash.c (src_to_dest_lookup): New function.
5475         * src/cp-hash.h (src_to_dest_lookup): Add prototype.
5476         * tests/mv/part-hardlink: New file.  Test for the above fix.
5477         * tests/mv/Makefile.am (TESTS): Add part-hardlink.
5478
5479         * announce-gen: Sync with autoconf.
5480
5481         * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
5482         This was triggered on a Linux-2.2.19 system using a file system
5483         NFS-mounted from some sort of Sun.
5484
5485 2004-03-11  Jim Meyering  <jim@meyering.net>
5486
5487         * Use automake-1.8.3.  Regenerate dependent files.
5488
5489 2004-03-10  Jim Meyering  <jim@meyering.net>
5490
5491         * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
5492         so that this test works with SELinux-enabled systems.
5493         Based on a patch from Tim Waugh.
5494
5495         `join -1 x' would give a misleading diagnostic
5496         * src/join.c (string_to_join_field): Report that a non-numeric field
5497         number is invalid, rather than `so large that it is not representable'.
5498         * tests/join/Test.pm (invalid-j): New partial test for the above fix.
5499
5500 2004-03-06  Jim Meyering  <jim@meyering.net>
5501
5502         cp --sparse=always sparse-image-file.img /dev/hda1 could
5503         produce an invalid copy on the destination device.
5504
5505         * src/copy.c (copy_reg): Even with --sparse=always, try to
5506         make `holes' only if the destination is a regular file.
5507         Reported by Szakacsits Szabolcs.
5508
5509 2004-03-03  Paul Eggert  <eggert@twinsun.com>
5510
5511         * src/nohup.c (main): Don't invoke set_cloexec_flag with
5512         a file descriptor of -1.
5513
5514 2004-03-02  Dmitry V. Levin  <ldv@altlinux.org>
5515
5516         * src/nohup.c: Include "cloexec.h".
5517         (main): Set the copy of stderr to close on exec.
5518
5519 2004-03-01  Paul Eggert  <eggert@twinsun.com>
5520
5521         * configure.ac: Include <signal.h> when checking for strsignal,
5522         sys_siglist, and friends.  Problem reported by Tony Leneis in
5523         <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
5524
5525 2004-02-25  Paul Eggert  <eggert@twinsun.com>
5526
5527         * tests/du/deref-args, tests/du/exclude, tests/du/slash:
5528         * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
5529         etc. are set.
5530
5531 2004-02-23  Paul Eggert  <eggert@twinsun.com>
5532
5533         * NEWS: Document how chown's USER.GROUP argument is now parsed.
5534
5535 2004-02-23  Jim Meyering  <jim@meyering.net>
5536
5537         * src/seq.c (usage): Remove stray space after \n in --help output.
5538
5539 2004-02-22  Jim Meyering  <jim@meyering.net>
5540
5541         * src/du.c (usage): Separate -H and --si.  Say that the meaning
5542         of -H will soon change to that of --dereference-args (-D).
5543
5544 2004-02-21  Jim Meyering  <jim@meyering.net>
5545
5546         * src/comm.c (usage): Tell what comm does when there are no options.
5547         Reword in terms of FILE1 and FILE2 rather than `left file' and
5548         `right file'.  Suggestion from Dan Jacobson.
5549
5550 2004-02-15  Paul Eggert  <eggert@twinsun.com>
5551
5552         Fix some POSIX-conformance bugs in expr.
5553
5554         * NEWS: document the following changes to src/expr.c.
5555         * doc/coreutils.texi (expr invocation): Likewise.
5556         Document what forms integers may take, and say "integer"
5557         consistently instead of "number".  Warn about operands
5558         that "expr" can misinterpret, and how to work around the
5559         problem.
5560         * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
5561         Accept a bool argument specifying whether to evaluate the
5562         expression.  This is to allow short-circuit evaluation.  All
5563         callers changed.
5564         (null): Report that a string is zero even if it has
5565         a form like "-0" or "00".
5566         (eval1, eval): Use short-circuit evaluation for | and &.
5567         (eval): Return 0 if both arguments are null or zero, instead
5568         of returning the first argument.
5569         * tests/expr/basic: Add some tests for the above.
5570
5571 2004-02-17  Jim Meyering  <jim@meyering.net>
5572
5573         * Version 5.2.0.
5574
5575         `make check' from a build inside a chroot environment would fail
5576         * tests/help-version: Specify an argument (`/') for df, in the
5577         unusual event that there is no valid entry in /etc/mtab.
5578         Likewise for id: add the -u option, so we don't get spurious
5579         failures when there are no user or group names.
5580         Patch by Tim Waugh.
5581
5582         * src/sort.c (usage) [-u]: Add punctuation so that the description in
5583         the help2man-generated (line-joined) man page is more readable.
5584         Reported by Tim Waugh.
5585         [-T]: Add a semicolon, for the same reason.
5586
5587 2004-02-15  Jim Meyering  <jim@meyering.net>
5588
5589         * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
5590
5591 2004-02-11  Jim Meyering  <jim@meyering.net>
5592
5593         * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
5594         $(srcdir)/../Makefile.am.in, rather than $<.
5595         Suggestion from Michael Elizabeth Chastain.
5596
5597 2004-02-10  Jim Meyering  <jim@meyering.net>
5598
5599         * config/install-sh: Make this script executable.
5600         * Makefile.am (dist-hook): New target, to ensure that config/install-sh
5601         is executable.  Otherwise, on systems that lack a suitable install
5602         binary, `make install' would fail, because of the way this script
5603         is invoked (without `$SHELL ' prefix).
5604         Reported by Bob Proulx.
5605
5606 2004-02-08  Jim Meyering  <jim@meyering.net>
5607
5608         * Version 5.1.3.
5609
5610         * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5611         that would cause an unwarranted test failure.
5612         * tests/rm/rm3: Likewise.
5613
5614 2004-02-07  Jim Meyering  <jim@meyering.net>
5615
5616         Remove xstat function pointer member.  The way it was used was not
5617         portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5618         inline `stat' and `lstat' functions, thus making the tests of
5619         `xstat == lstat' in copy.c always fail.
5620         * src/copy.h (struct cp_options) [xstat]: Remove member.
5621         (XSTAT): New macro.
5622         * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5623         (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5624         Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5625         (valid_options): Remove now-obsolete FIXME comments.
5626
5627         * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5628         `*(x->xstat) (...)'.
5629         (do_copy): Declare/use local xstat rather than x->xstat.
5630         (main): Remove code that set x.xstat.
5631         * src/mv.c (cp_option_init): Don't initialize xstat member.
5632         * src/install.c (cp_option_init): Likewise.
5633
5634         * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5635         so that emit_upload_commands can use these variables, too.
5636
5637 2004-02-06  Jim Meyering  <jim@meyering.net>
5638
5639         * tests/rm/deep-1: Remove `du' stack space test.
5640         Apparently, `ulimit -s N' isn't portable enough.
5641         This test will be restored (with a guard against losing ulimit)
5642         in its own file later.
5643
5644         * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5645         since this test doesn't take long enough to merit them.
5646         Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5647
5648         * Makefile.maint (signatures): Remove definition.
5649         Now, automake's gnupload handles this.
5650         (%.sig: %): Remove now-unused rule.
5651         (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5652         `$(distdir).tar.bz2 $(distdir).tar.gz'.
5653         (emit-upload-commands): Adjust to use gnupload.
5654
5655 2004-02-05  Jim Meyering  <jim@meyering.net>
5656
5657         * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5658         (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5659         Now, those are all defined in timespec.h.
5660         Include timespec.h.
5661
5662         * src/date.c: Don't include timespec.h, now that system.h does it.
5663
5664 2004-02-02  Paul Eggert  <eggert@twinsun.com>
5665
5666         Don't dump core if localtime returns NULL (possible on
5667         hosts with 64-bit time_t and 32-bit int).
5668         * src/date.c: Include "inttostr.h".
5669         (batch_convert, main):
5670         If time conversion fails, exit with nonzero status.
5671         (show_date): Return int to report conversion failure.
5672         Print the time as an int if localtime fails.
5673         * src/uptime.c: Print "??" if the current clock can't
5674         be converted by localtime.  This won't happen until the year
5675         2*31 + 1900, but we don't want to dump core even if the current
5676         clock has the wrong value.
5677
5678         * src/stat.c: Include "inttostr.h".
5679         (human_time): Print the date/time as a number of seconds since the
5680         epoch if it can't be converted by localtime.  This is better than
5681         just saying "invalid", and is consistent with what "ls" does.
5682         Don't dump core if the year has more than 48 digits; this isn't
5683         possible on any contemporary host, but we might as well do it right.
5684
5685 2004-01-31  Paul Eggert  <eggert@twinsun.com>
5686
5687         * src/stat.c (human_time): Accept time rather than
5688         pointer-to-const-time parameter, for clarity.  All callers changed.
5689
5690 2004-02-02  Jim Meyering  <jim@meyering.net>
5691
5692         * src/stat.c (do_stat): Remove extra trailing newline from
5693         default formats.  Reported by Nelson H. F. Beebe.
5694
5695         Print actual fractional seconds in time stamps, not just `.00000000'.
5696         * src/stat.c (human_time): Add and use new parameter, t_ns.
5697         (print_stat): Update callers.
5698         * src/ls.c (TIMESPEC_NS): Remove definition.
5699         * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5700         also uses this macro.
5701         Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5702         fractional seconds for files on an XFS file system, but that stat's
5703         fractional seconds were always zero.
5704
5705 2004-01-28  Paul Eggert  <eggert@twinsun.com>
5706
5707         * src/seq.c (print_numbers): Use 'double' for loop index, not
5708         'int', to avoid problems with integer overflow.  On almost all
5709         machines 'double' works in every case where 'int' works, and
5710         it works on other cases besides.
5711
5712 2004-01-27  Jim Meyering  <jim@meyering.net>
5713
5714         * src/seq.c (usage): Mention that if INCREMENT is omitted,
5715         it defaults to 1, even when FIRST is larger than LAST.
5716         Reword so as not to exclude the possibility that INCREMENT be zero.
5717
5718 2004-01-25  Jim Meyering  <jim@meyering.net>
5719
5720         * Version 5.1.2.
5721
5722         * Makefile.maint (signatures): Comment out definition.
5723
5724 2004-01-23  Jim Meyering  <jim@meyering.net>
5725
5726         * Makefile.maint (header_regexp): Add exitfail.
5727
5728         * man/Makefile.am (EXTRA_DIST): Add help2man.
5729         Reported by Nelson H. F. Beebe.
5730
5731         * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5732         so it works on systems with Perl installed somewhere other than in
5733         /usr/bin.
5734
5735         * src/paste.c (paste_parallel): Declare local, chr, to be of type
5736         `int', not `char', since it must hold EOF.  This bug would make
5737         paste infloop on some systems.  Test failures reported by
5738         Nelson H. F. Beebe and Christian Krackowizer.
5739
5740 2004-01-22  Jim Meyering  <jim@meyering.net>
5741
5742         * tests/rmdir/fail-perm: New file.  Test for just-fixed rmdir bug.
5743         * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5744
5745         * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5746         * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5747         Use --info-page='coreutils PROG' option.
5748         Now, readlink.1 refers the user to `info coreutils readlink'
5749         rather than to `info readlink'.  Reported by Matt Swift.
5750
5751 2004-01-21  Paul Eggert  <eggert@twinsun.com>
5752
5753         Exit status cleanup.
5754
5755         * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5756         * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5757         * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5758         * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5759         * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5760         * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5761         * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5762         * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5763         * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5764         * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5765         * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5766         * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5767         * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5768         * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5769         * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5770         * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5771         * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5772
5773         * src/cat.c (usage): Don't bother normalizing exit status
5774         since the arg is already the correct exit status now.
5775         * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5776         * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5777         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5778         * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5779         * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5780
5781         * src/chown.c (main): Removed unused local 'fail'.
5782
5783         * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5784         Remove.
5785
5786         * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5787         * src/env.c, src/nice.c, src/su.c: Likewise.
5788         * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5789         * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5790         * src/expr.c (main): Use initialize_exit_failure rather than
5791         setting exit_failure directly; this optimizes away redundant
5792         assignments.
5793         * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5794
5795         * src/chroot.c (main): Exit with status 1 rather than 127
5796         if chroot itself fails, as per documentation.
5797
5798         * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5799         rather than roll-your-own symbols or integers.
5800         * src/env.c (main): Likewise.
5801         * src/nohup.c (main): Likewise.
5802         * src/su.c (run_shell): Likewise.
5803
5804         * src/cp.c (exit_status): Remove static var....
5805         (main): Making it local here instead.  Use =, not |=, to set it.
5806
5807         * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5808         not 2, on errors.
5809         * src/date.c (batch_convert, main): Likewise.
5810         * src/dd.c (dd_copy): Likewise.
5811         * src/pr.c (first_last_page, main, getoptarg): Likewise.
5812         * src/tr.c (main): Likewise.
5813         * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5814         POSIX doesn't require it.
5815         * src/dd.c (write_output, skip, dd_copy): Likewise.
5816         * src/df.c (main): Likewise.
5817         * src/id.c (main): Likewise.
5818         * src/install.c (main): Likewise.
5819         * src/ln.c (main): Likewise.
5820         * src/ls.c (main): Likewise.
5821         * src/mv.c (main): Likewise.
5822         * src/shred.c (main): Likewise.
5823
5824         * src/env.c (main): Exit with status 1, not 2, on errors detected
5825         by env proper.
5826         * src/hostname.c (main): Likewise.
5827         * src/nl.c (main): Likewise.
5828         * src/stty.c (main): Likewise.
5829
5830         * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5831         consistency with the other programs' naming conventions.
5832         All uses changed.
5833
5834         * src/factor.c (main): Do not report a usage error simply
5835         because stdin has bad numbers.
5836
5837         * src/id.c (problems): Now a boolean int, not a counter,
5838         so that we don't have to worry about int overflow.  All uses changed.
5839         * src/touch.c (err): Likewise.
5840
5841         * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5842
5843         * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5844         * src/mknod.c: Likewise.
5845
5846         * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5847         on error; this is in case EXIT_FAILURE is unusual.
5848         * src/su.c (main): Likewise.
5849
5850         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5851         changed to EXIT_CANNOT_INVOKE.
5852
5853         * src/printenv.c (PRINTENV_FAILURE): New constant.
5854         (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5855         command-line syntax problems.
5856
5857         * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5858         (main): Avoid integer overflow when seeing whether errors occurred.
5859
5860         * src/seq.c (print_numbers): Now returns void, not (zero) int.
5861         All callers changed.
5862         (main): Remove unused local variable 'errs'.  Always exit successfully
5863         if we reach the end.
5864
5865         * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5866         for consistency with other programs here.  All uses changed.
5867         (main): Use 'error' to exit rather than invoking 'exit' here.
5868
5869         * src/sort.c: Don't include <assert.h>.
5870         (SORT_OUT_OF_ORDER,  SORT_FAILURE): Now enums, not macros.
5871         (usage): Don't use 'assert'.
5872         (main): Remove redundant assignment to exit_failure.
5873
5874         * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5875         New enum values.
5876         (initialize_exit_failure): New inline function.
5877         Include exitfail.h here, since we refer to exit_failure.
5878         All callers changed to not include exitfail.h.
5879
5880         * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5881         substitute them for the corresponding integer constants.
5882
5883         * tests/help-version (expected_failure_status_date): Remove, as
5884         'date' is now normal.
5885         (expected_failure_status_nohup): New var.
5886
5887 2004-01-21  Jim Meyering  <jim@meyering.net>
5888
5889         * tests/touch/relative: Remove `command' syntax.
5890         Thanks to Nelson H. F. Beebe and Paul Eggert.
5891
5892         * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5893         so as to avoid problems with systems using TAI clocks.
5894         Although it's no longer necessary, set TZ=UTC0 also for the
5895         initial touch command.  Reported by Paul Jarc here:
5896         http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5897
5898 2004-01-20  Diego Biurrun  <diego@biurrun.de>
5899
5900         * src/dircolors.hin: Add .mov to the list of media files.
5901
5902 2004-01-19  Paul Eggert  <eggert@twinsun.com>
5903
5904         * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5905         portable).  Problem reported by Christian Krackowizer.  Also, use
5906         +0000 rather than +0 to specify a time zone, as the documentation
5907         requires four digits.
5908
5909 2004-01-19  Jim Meyering  <jim@meyering.net>
5910
5911         * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5912         * tests/mv/backup-is-src: Likewise.
5913         Problem reported by Peter Horst
5914
5915 2004-01-17  Jim Meyering  <jim@meyering.net>
5916
5917         * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5918
5919         * Version 5.1.1.
5920
5921 2003-12-15  Paul Eggert  <eggert@twinsun.com>
5922
5923         * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5924         with -r specifying the origin for -d.
5925         * src/touch.c (flexible_date): Remove static var.
5926         (get_reldate): New function.
5927         (main): Use it, to implement this new behavior.
5928
5929 2004-01-16  Jim Meyering  <jim@meyering.net>
5930
5931         * tests/touch/relative: New test for the above.
5932         * tests/touch/Makefile.am (TESTS): Add relative.
5933
5934 2004-01-13  Jim Meyering  <jim@meyering.net>
5935
5936         * src/system.h: Include contents of sys2.h.
5937         * src/sys2.h: Remove file.
5938         * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5939
5940         * Use automake-1.8.2.  Regenerate dependent files.
5941
5942         * Update to gettext-0.13.1.
5943         * configure.ac: Use gettext-0.13.1.
5944         * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5945
5946 2004-01-12  Jim Meyering  <jim@meyering.net>
5947
5948         * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5949
5950         * Makefile.maint (po-check): Ensure that cvsu works before using it.
5951         Reported by Alexandre Duret-Lutz.
5952
5953         * src/tail.c (main): Warn about following stdin only when it's a tty.
5954
5955         * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5956
5957 2004-01-10  Jim Meyering  <jim@meyering.net>
5958
5959         * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5960
5961 2004-01-09  Jim Meyering  <jim@meyering.net>
5962
5963         * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5964
5965 2004-01-08  Jim Meyering  <jim@meyering.net>
5966
5967         * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5968         From Andreas Schwab.
5969
5970         * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5971         remnant) from PATH component.  That would cause tests in this directory
5972         not to run the just-built binaries, but rather whatever happened
5973         to be in one's PATH.  Reported by Christian Krackowizer.
5974
5975 2004-01-04  Jim Meyering  <jim@meyering.net>
5976
5977         * src/csplit.c (new_control_record): Use x2nrealloc
5978         rather than xrealloc.
5979
5980         * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5981         alloca and strcpy.
5982         (make_path_private): Likewise.
5983
5984 2004-01-03  Jim Meyering  <jim@meyering.net>
5985
5986         * src/paste.c: Use `bool' (not int) as the type for a few
5987         global variables.
5988         (collapse_escapes): Rewrite to set globals rather than modifying
5989         its parameter.
5990         Use size_t (not int) for all counters and related index variables.
5991         (paste_parallel): Remove needless complexity of
5992         using xrealloc in the loop;  just allocate the buffers up front.
5993         Free the two temporary buffers.
5994         Move declarations of locals `down' into scope where used.
5995         (paste_serial): Remove `register' attributes.
5996         (main): Simplify delim-related code.
5997         Free `delims', now that it's malloc'd.
5998
5999 2004-01-02  Jim Meyering  <jim@meyering.net>
6000
6001         * src/chroot.c: Include "quote.h".
6002         (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
6003         (main): Exit with status of 127, not 1, for too-few-args,
6004         chroot failure, or chdir failure.
6005         Give a better diagnostic upon execvp failure.
6006
6007         * src/du.c (usage): Mention that, with its current meaning,
6008         -H is deprecated.
6009
6010         * src/tail.c (main): Warn about following stdin when it's a tty.
6011         Fail when following by name but no names are specified.
6012
6013 2003-12-30  Jim Meyering  <jim@meyering.net>
6014
6015         * src/fold.c (main): Use memcpy, not strcpy.
6016
6017         * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
6018         alloca and strcpy.
6019
6020 2003-12-28  Jim Meyering  <jim@meyering.net>
6021
6022         * src/unexpand.c (n_tabs_allocated): New global.
6023         (add_tabstop): Use x2nrealloc rather than xrealloc.
6024         * src/expand.c: Likewise.
6025
6026         * tests/misc/expand: New file.
6027         * tests/misc/Makefile.am (TESTS): Add expand.
6028
6029         * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
6030         (fillbuf): Use x2nrealloc rather than xrealloc.
6031         (sort): Use xnmalloc rather than xmalloc.
6032         (main): Likewise.
6033
6034 2003-12-27  Jim Meyering  <jim@meyering.net>
6035
6036         * src/tee.c (tee): Use xnmalloc rather than xmalloc.
6037
6038 2003-12-29  Paul Eggert  <eggert@twinsun.com>
6039
6040         * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
6041         LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
6042
6043         * doc/coreutils.texi (join invocation): Remove documentation
6044         accordingly.  Document that -t makes all separators significant.
6045
6046         * src/join.c: Include posixver.h.
6047         (obsolete_usage): New var.
6048         (longopts): Put obsolete options first.
6049         (OBSOLETE_LONG_OPTIONS): New constant.
6050         (get_option, add_file_name): New functions.
6051         (main): Use them to support new behavior.
6052         (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
6053         Do not mark -j FIELD as obsolescent; it is longstanding
6054         UNIX tradition and is a valid extension to POSIX.
6055
6056         * tests/join/Test.pm (tv): Avoid obsolete -o usage.
6057
6058 2003-12-28  Paul Eggert  <eggert@twinsun.com>
6059
6060         * src/join.c (add_field_list): Don't use alloca with unbounded
6061         size; just modify the argument, which is no longer const *.
6062
6063         Various other minor cleanups, mostly to avoid the need for casts.
6064
6065         (extract_field): Renamed from ADD_FIELD, as it's now a function.
6066
6067         (struct field.beg): Now char *, not unsigned char const *.  All
6068         uses changed.  It shouldn't be const since xmemcoll writes on its
6069         arguments.
6070         (extract_field): Likewise, for 2nd arg.
6071         (keycmp): Remove now-unnecessary cast of xmemcoll args.
6072
6073         (is_blank): New function, to avoid need to cast arg to unsigned char.
6074         (extract_field): Use it.
6075
6076         (xfields): Rewrite pretty much from scratch.
6077
6078         (hard_LC_COLLATE): Now bool, not int.
6079         (get_line, getseq, add_field_list): Now returns bool, not int.
6080         (decode_field_spec, add_field_list): Return true on success (not
6081         false), for consistency with the rest of the code.  All uses changed.
6082
6083         (tab): Now char, not unsigned char.  This wasn't 100% necessary
6084         but is slightly cleaner.
6085         (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
6086
6087         (empty_filler): Now const *.
6088
6089         (make_blank): Remove; wasn't needed.  Remove all calls.
6090         (main): Don't set uni_blank.nfields; zero is fine.
6091
6092 2003-12-27  Jim Meyering  <jim@meyering.net>
6093
6094         * src/join.c: Include "quote.h".
6095         (min, max): Remove definitions.
6096         Make a few function parameters and corresponding
6097         locals `const'.  Use bool for boolean variables.
6098         Use size_t (not int) for all counters and related index variables.
6099         (prjoin): Remove now-useless assertion.
6100         (string_to_join_field): New function.
6101         (main): Accept join fields as large as SIZE_MAX.
6102         (keycmp): Rename `min' to MIN and max to MAX.
6103
6104 2003-12-26  Jim Meyering  <jim@meyering.net>
6105
6106         fold -s didn't work on e.g., alpha-based systems.
6107         * src/fold.c (fold_file): Adjust types (int->size_t) so that using
6108         x2nrealloc works properly on systems with differing sizes for int
6109         and size_t.  Reported by Nelson Beebe.
6110
6111         * src/fold.c: Use `bool' (not int) as the type for a few
6112         global variables.
6113
6114 2003-12-23  Paul Eggert  <eggert@twinsun.com>
6115
6116         * src/ls.c (length_of_file_names_and_frills):
6117         Remove forward decl; not needed.
6118         (print_file_name_and_frills, length_of_file_name_and_frills):
6119         With -m, don't output spaces before inum or size.
6120         (print_with_commas): Don't output space just before newline.
6121
6122 2003-12-24  Jim Meyering  <jim@meyering.net>
6123
6124         * tests/ls/Makefile.am (TESTS): Add m-option.
6125         * tests/ls/m-option: New file.  Test for above fixes.
6126
6127 2003-12-20  Jim Meyering  <jim@meyering.net>
6128
6129         * Version 5.1.0.
6130
6131         * src/pr.c: Change type of global, buff_allocated, to size_t.
6132
6133         * src/join.c [struct seq]: Change types of members count and alloc
6134         from `int' to `size_t'.
6135
6136         * tests/Makefile.am (root-hint): Tweak wording.
6137
6138         * src/du.c: Accept new option (-0, --null) that makes it so each
6139         output line is NUL-terminated rather than newline-terminated.
6140
6141         * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
6142         Reported by Volker Paul.
6143         * tests/dd/Makefile.am (TESTS): Add unblock-sync.
6144         * tests/dd/unblock-sync: New test for the above.
6145
6146 2003-12-19  Jim Meyering  <jim@meyering.net>
6147
6148         * tests/misc/nohup: Double quote back-ticked expression,
6149         in case it ends up having an unexpected value.
6150
6151         * tests/ls/no-arg: Use ls's -1 option in both runs.
6152
6153         * src/du.c (fts_debug): New global.
6154         (FTS_CROSS_CHECK, DEBUG_OPT): Define.
6155         (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
6156         (main) [DU_DEBUG]: Accept -d option.
6157
6158 2003-12-18  Jim Meyering  <jim@meyering.net>
6159
6160         * src/ls.c (format_user): Increment dired_pos via two statements,
6161         `dired_pos += width; dired_pos++;' rather than one,
6162         `dired_pos += width + 1;' since the latter could conceivably overflow.
6163         (format_group): Likewise.
6164         From Paul Eggert.
6165
6166         * configure.ac: Require automake-1.8.
6167
6168 2003-12-12  Jim Meyering  <jim@meyering.net>
6169
6170         * Use automake-1.8.  Regenerate dependent files.
6171
6172 2003-12-08  Jim Meyering  <jim@meyering.net>
6173
6174         * Makefile.maint (news-date-check): New rule.
6175         (alpha beta major): Depend on it.
6176
6177 2003-12-03  Paul Eggert  <eggert@twinsun.com>
6178
6179         * NEWS: ls -l (and similar options) now adjust all columns to
6180         fit the data.  Generalized from a suggestion by Leah Q for file sizes.
6181         * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
6182         (format_user_width, format_group_width, unsigned_file_size,
6183         format_group): New functions.
6184         (block_size_width): Renamed from block_size_size.
6185         (inode_number_width, nlink_width, owner_width, group_width,
6186         author_width, major_device_number_width, minor_device_number_width,
6187         file_size_width): New vars.
6188         (clear_files): Initialize them.
6189         (gobble_file): Set them.  Don't ceiling block_size_width to 7.
6190         (print_long_file): Use them.
6191         (gobble_file): Use a new local variable 'f' to make the code
6192         smaller and more consistent with other functions.
6193         (format_user): Output to stdout, not to a buffer, so that we
6194         don't have to worry about buffer overrun.  Update dired_pos.
6195         (print_long_file): Don't put owner, group, author into buffer;
6196         just print them directly.  Don't assume link counts and
6197         major and minor numbers fit into unsigned long int.
6198         * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
6199         'ls' output is fixed-width.
6200
6201 2003-12-02  Jim Meyering  <jim@meyering.net>
6202
6203         * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
6204
6205 2003-11-27  Jim Meyering  <jim@meyering.net>
6206
6207         * Use automake-1.7f.  Regenerate dependent files.
6208
6209 2003-11-24  Paul Eggert  <eggert@twinsun.com>
6210
6211         Parse floating-point operands and options in the C locale.
6212         POSIX requires this for printf, and we might as well be
6213         consistent elsewhere (tail, sleep, seq).
6214
6215         * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
6216         needed now that we assume C89.  Include "c-strtod.h".
6217         (xstrtod): Call c_strtod, not strtod.
6218         * src/sleep.c: Include "c-strtod.h".
6219         (main): Update xstrtod call to include new argument, c_strtod.
6220         * src/seq.c (scan_double_arg): Likewise.
6221         * src/tail.c (parse_options): Likewise.
6222
6223 2003-11-24  Jim Meyering  <jim@meyering.net>
6224
6225         * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
6226         Reported by Mark Conty.
6227
6228 2003-11-22  Jim Meyering  <jim@meyering.net>
6229
6230         * Makefile.maint (sc_xalloc_h_in_src): Remove rule.  Subsumed by...
6231         (sc_system_h_headers): Do this test only if sys2.h exists.
6232
6233 2003-11-20  Jim Meyering  <jim@meyering.net>
6234
6235         * tests/help-version: Ensure that the bug-reporting address is
6236         included in the --help output for every program.
6237         * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
6238
6239         * src/ptx.c (usage): Output bug-reporting address.
6240         Reported by Dan Jacobson.
6241
6242 2003-11-19  Jim Meyering  <jim@meyering.net>
6243
6244         * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
6245         on the join fields.  Suggestion from Bruce Robertson.
6246
6247 2003-11-18  Jim Meyering  <jim@meyering.net>
6248
6249         `od -c -w9999999' could segfault
6250         * src/od.c (dump): Use xnmalloc/free, not alloca.
6251
6252 2003-11-16  Jim Meyering  <jim@meyering.net>
6253
6254         * Use autoconf-2.59.  Regenerate dependent files.
6255
6256         * tests/du/hard-link: Minor tweak: use mkdir -p.
6257
6258         Fix read-from-free'd-buffer error detected by valgrind.
6259         * src/csplit.c (remove_line): Don't return a pointer to data in
6260         a freed buffer.  Instead, arrange to free the buffer on the
6261         subsequent call.
6262
6263         * tests/misc/csplit: New test for above fix.
6264
6265 2003-11-11  Jim Meyering  <jim@meyering.net>
6266
6267         * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
6268         This avoids a warning from valgrind about memcpy with overlapping
6269         source and destination.
6270
6271         * configure.ac: Require automake-1.7.8.
6272
6273 2003-11-09  Jim Meyering  <jim@meyering.net>
6274
6275         * Use automake-1.7.9.  Regenerate dependent files.
6276
6277         * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
6278         * src/chown.c: Likewise.
6279
6280         * src/chown-core.c: Include "root-dev-ino.h".
6281         (chopt_init): Initialize new member.
6282         (change_file_owner): Support rm's new --preserve-root option.
6283
6284         * src/remove.c: Include "root-dev-ino.h".
6285         (remove_cwd_entries): Remove now-obsolete FIXME comment.
6286         (remove_dir): Support rm's new --preserve-root option.
6287
6288         * src/chown.c: Include "root-dev-ino.h".
6289         Add new options: --preserve-root and --no-preserve-root.
6290
6291         * src/chmod.c: Include "root-dev-ino.h".
6292         (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
6293         ROOT_DEV_INO_WARN macros.
6294         (get_root_dev_ino): Remove function definition, now that it's
6295         been moved to a separate file.
6296         (usage): Describe new options.
6297
6298         * src/mv.c (rm_option_init): Initialized new member.
6299
6300         * src/remove.h: Include "dev-ino.h".
6301         (struct rm_options): Add new member: root_dev_ino.
6302         * src/chown-core.h: Include "dev-ino.h".
6303         (struct Chown_option): Add new member: root_dev_ino.
6304
6305 2003-11-06  Jim Meyering  <jim@meyering.net>
6306
6307         * src/paste.c (paste_parallel): Use `sizeof *var' rather than
6308         hard-coding `sizeof FILE*'.
6309
6310 2003-11-05  Dennis Smit  <ds@nerds-incorporated.org>
6311
6312         * src/wc.c (main): Free `fstatus' so there is no confusion about
6313         whether it's leaked or not.
6314         * src/who.c (who): Likewise for `utmp_buf'.
6315
6316 2003-11-05  Paul Eggert  <eggert@twinsun.com>
6317
6318         Fix 'cut' problems with size_t overflow and unsigned int.
6319         More generally, resize integer variables to fit use more precisely.
6320         * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
6321         (struct range_pair): Make members to be of type size_t, not unsigned.
6322         (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
6323         (suppress_non_delimited, output_delimiter_specified,
6324         have_read_stdin, print_kth, set_fields): Now bool, nt int.
6325         (delim): Now unsigned char, not int.
6326         (mark_printable_field, is_printable_field, is_range_start_index,
6327         set_fields, set_fields, cut_bytes, cut_fields):
6328         Use size_t, not unsigned, for field and byte counts.
6329         (hash_int): Use uintptr_t, not unsigned, for pointers converted
6330         to integers.  This squeezes more info out of them.
6331         (set_fields, cut_bytes, cut_fields, main):
6332         Use bool, not int, for booleans.
6333         (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
6334
6335 2003-11-05  Paul Eggert  <eggert@twinsun.com>
6336
6337         * man/Makefile.am (check-programs-vs-x):
6338         Work even if $(programs) contains '$'.
6339         Work even if 'missing=1' in environment.
6340         Don't report an error simply because $(programs) outputs nothing.
6341
6342 2003-11-05  Jim Meyering  <jim@meyering.net>
6343
6344         * Use autoconf-2.58.  Regenerate dependent files.
6345
6346         * src/tr.c (spec_init): Fix typo in last change.
6347
6348         * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
6349         call to variadic version_etc function, so that it works even on systems
6350         for which sizeof char* != sizeof int.
6351         * src/true.c (main): Likewise.
6352         * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
6353         * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
6354         * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
6355         * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
6356         Similarly, cast NULL to `(char *)' in call to variadic function,
6357         parse_long_options, so that it works even on systems for which
6358         sizeof char* != sizeof int.
6359         A similar problem was reported by Harti Brandt in
6360         http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
6361
6362         * src/users.c (users): Free `utmp_buf' explicitly so that people
6363         don't mistake this for a real leak.
6364         Patch by Dennis Smit <ds@nerds-incorporated.org.
6365
6366 2003-11-04  Paul Eggert  <eggert@twinsun.com>
6367
6368         * README: Document _POSIX2_VERSION.
6369
6370 2003-11-04  Jim Meyering  <jim@meyering.net>
6371
6372         * src/tac.c (memrchr): Remove #if-0'd function.
6373         (tac_stdin_to_mem): Clean up #if-0'd code.
6374
6375         * src/od.c (decode_format_string): Remove unnecessary casts.
6376         Use more maintainable `sizeof *var'.
6377         (main): Call decode_format_string rather than decode_one_format,
6378         now that `spec' may be NULL.
6379
6380         * src/chmod.c (AUTHORS): Add my name.
6381
6382         * src/split.c (next_file_name): Use `sizeof *var' rather than
6383         hard-coding `sizeof size_t'.
6384
6385         * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
6386
6387         * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
6388         to avoid potential overflow in pointer arithmetic.
6389         (set_fields): Use not `1', but rather `sizeof *printable_field' as
6390         second argument to xcalloc.
6391         * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
6392         rather than xrealloc.
6393         * src/date.c (show_date): Likewise.
6394         * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
6395         * src/pr.c (store_char): Likewise.
6396         * src/fold.c (fold_file): Likewise.
6397
6398         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6399         type changes (unsigned int -> size_t) in hash.c.
6400         * src/cp-hash.c (src_to_dest_hash): Likewise.
6401         * src/du.c (entry_hash): Likewise.
6402         * src/ls.c (dev_ino_hash): Likewise.
6403         * src/cut.c (hash_int): Likewise.  Declare function as static.
6404
6405 2003-11-03  Jim Meyering  <jim@meyering.net>
6406
6407         * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6408         * tests/misc/fold: Fail the test immediately if we're not running
6409         the expected version of fold.
6410
6411 2003-11-02  Jim Meyering  <jim@meyering.net>
6412
6413         * src/tr.c (append_normal_char, append_range, append_char_class)
6414         (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
6415         rather than `sizeof EXPLICIT_TYPE'.  The former is more maintainable
6416         and usually shorter.
6417         * src/copy.c (copy_internal): Likewise.
6418         * src/join.c (initseq, add_field, make_blank): Likewise.
6419         * src/od.c (main): Likewise.
6420         * src/cp.c (make_path_private): Likewise.
6421         * src/tsort.c (new_item, record_relation): Likewise.
6422
6423         * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
6424         (main): Also remove anachronistic cast of xmalloc return value.
6425         * src/ptx.c (alloc_and_compile_regex, main): Likewise.
6426         (main): Also remove anachronistic cast of xmalloc return value.
6427         * src/sort.c (inittables): Likewise.
6428         (sort): Also Split a long line.
6429
6430 2003-10-25  Jim Meyering  <jim@meyering.net>
6431
6432         * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6433         type changes (unsigned int -> size_t) in hash.c.
6434         * src/cp-hash.c (src_to_dest_hash): Likewise.
6435         * src/du.c (entry_hash): Likewise.
6436         * src/ls.c (dev_ino_hash): Likewise.
6437         * src/cut.c (hash_int): Likewise.  Declare function as static.
6438
6439 2003-10-21  Jim Meyering  <jim@meyering.net>
6440
6441         Don't fail when run with VERBOSE=yes.
6442         * tests/chgrp/basic: Do `set +x' before starting the subshell
6443         from which we invoke chgrp.  Otherwise, the output from the
6444         VERBOSE=yes-induced `set -x' would result in spurious differences.
6445         Reported by Russel Coker via Michael Stone.
6446
6447 2003-10-19  Jim Meyering  <jim@meyering.net>
6448
6449         chmod now uses fts to perform a directory traversal when -R is
6450         specified.  Before, it operated on full path names, and as such
6451         would encounter the PATH_MAX (often 4096) limit.
6452
6453         * src/chmod.c: Include "xfts.h".
6454         (process_file): Rename from change_file_mode.
6455         Adapt to be used with fts.
6456         (process_files): New function.
6457
6458 2003-10-18  Jim Meyering  <jim@meyering.net>
6459
6460         * tests/du/deref-args: Ensure that du -D now dereferences all
6461         symlinks specified on the command line, not just those that
6462         reference directories.
6463
6464         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6465         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6466         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6467         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6468         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6469         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6470         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6471         * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
6472         of 2003-09-19.  Now, AUTHORS is a comma-separated list of strings.
6473         Update the call to parse_long_options so that `AUTHORS, NULL' are the
6474         last parameters.
6475         * src/true.c (main): Append NULL to version_etc argument list.
6476         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6477
6478 2003-10-17  Andreas Schwab  <schwab@suse.de>
6479
6480         * tests/mk-script: Get $srcdir from first parameter instead of
6481         hardcoding it.
6482         (main): Update usage.
6483
6484         * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
6485         first argument of mk-script.
6486         ($(srcdir)/Makefile.am): Likewise.  Prepend $(srcdir) to target.
6487
6488 2003-10-17  Jim Meyering  <jim@meyering.net>
6489
6490         * src/mv.c (usage): Tweak descriptions of -i and -f so that the
6491         generated `man' page is more readable.  Suggestion from Dan Jacobson.
6492
6493         * src/chown-core.c (change_file_owner): Handle the cases in
6494         which fts_info indicates an error with the given entry.
6495
6496         * src/du.c (main): Simply assign to bit_flags.
6497         Don't bother with bit arithmetic.
6498
6499         * tests/chmod/no-x: New file.
6500         * tests/chgrp/no-x: New file.
6501         * tests/chmod/Makefile.am (TESTS): Add no-x.
6502         * tests/chgrp/Makefile.am (TESTS): Likewise.
6503
6504         * src/du.c: Include "xfts.h".
6505         (du_files): Use xfts_open, rather than fts_open.
6506         * src/chown-core.c (chown_files): Likewise.
6507
6508 2003-10-16  Jim Meyering  <jim@meyering.net>
6509
6510         * src/chgrp.c (main): Simply assign to bit_flags.
6511         Don't bother with bit arithmetic.
6512         * src/chown.c (main): Likewise.
6513         Rename a couple of local variables.
6514         Remove unnecessary casts.
6515
6516         * src/tail.c (start_bytes): Rename local, remainder, to avoid
6517         gcc's warning about shadowing a global.
6518
6519 2003-10-15  Jim Meyering  <jim@meyering.net>
6520
6521         chown and chgrp now accept POSIX-mandated -H, -L, -P options and
6522         use fts to perform a directory traversal when -R is specified.
6523         Before, they operated on full path names, and as such would
6524         encounter the PATH_MAX (often 4096) limit.
6525         They are more efficient.  For example, before, chgrp -R would
6526         take almost 5 seconds to change about 2000 directories and fail
6527         (with `File name too long'), while now it succeeds on a hierarchy
6528         of depth 20,000 in 1/10 the time.
6529
6530         * src/chown.c: Include "userspec.h" and "fts_.h".
6531         (WRITTEN_BY): Add my name.
6532         (getpwnam, getgrnam, getgrgid): Remove declarations.
6533         (endpwent): Remove definition.
6534         (usage): Update.
6535         (main): Handle new options.
6536         Call new function, chown_files rather than change_file_owner.
6537
6538         * src/chgrp.c: Include "fts_.h".
6539         (WRITTEN_BY): Add my name.
6540         (MAXUID, MAXGID): Remove definitions.  Use GID_T_MAX instead of
6541         the latter.
6542         (usage): Update.
6543         (main): Handle new options.
6544         Call new function, chown_files rather than change_file_owner.
6545
6546         Rewrite to iterate through hierarchies using fts rather than
6547         via explicit recursion.
6548         * src/chown-core.c: Include "fts_.h"
6549         (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
6550         on a single file at a time.
6551         (chown_files): New function.
6552         * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
6553         [struct Chown_option] (recurse, force_silent): Change type to `bool'.
6554         [struct Chown_option] (dereference): Remove member with ambiguous name.
6555         [struct Chown_option] (affect_symlink_referent): New member.
6556         (chown_files): New prototype.
6557
6558         * tests/chgrp/recurse: Update tests accordingly.
6559         * tests/chgrp/posix-H: New tests for the above.
6560         * tests/chgrp/Makefile.am (TESTS): Add posix-H.
6561
6562         * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
6563         work even for superuser.  Suggestion from Dan Jacobson.
6564
6565 2003-10-14  Paul Eggert  <eggert@twinsun.com>
6566
6567         Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
6568         properly diagnosed.
6569         * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
6570         lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
6571         * src/sort.c (parse_field_count): Handle the case where overflow
6572         and invalid suffix char are both reported.
6573
6574 2003-10-14  Jim Meyering  <jim@meyering.net>
6575
6576         * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
6577         warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
6578         true on Linux.
6579
6580 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6581
6582         Fix to avoid a denial-of-service attack if the display width is
6583         enormous.  Also, clean up the code a bit by removing duplicate code.
6584
6585         * src/ls.c (init_column_info): Remove forward decl; no longer needed.
6586         (calculate_columns): New function, that contains code that used
6587         to be common to print_many_per_line and print_horizontal.
6588         (print_many_per_line, print_horizontal): Use it.
6589         (decode_switches): Set max_idx here, not in calculate_columns.
6590         (print_current_files): Don't call init_column_info; calculate_columns
6591         now does that.
6592         (init_column_info): Don't allocate a lot more space than is needed
6593         to represent the current set of files.  Allocate all the new
6594         size_t cells in one call to xnmalloc, rather than a row at a time.
6595
6596 2003-10-13  Jim Meyering  <jim@meyering.net>
6597
6598         * src/ls.c (init_column_info): Add another FIXME comment.
6599
6600 2003-10-13  Paul Eggert  <eggert@twinsun.com>
6601
6602         Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
6603         Remove several arbitrary limits on hosts where int cannot represent
6604         all size_t values.
6605
6606         * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
6607         nfiles, files_index, tabsize, line_length, struct column_info.line_len,
6608         struct column_info.col_arr[0], max_idx):
6609         Now size_t, not int.
6610         (get_funky_string): Return bool indicating success, instead of
6611         a negative count to indicate failure.  Store number of columns
6612         through new parameter OUTPUT_COUNT; that way, they can never
6613         go negative.  Change equals_end from int to bool.  All uses
6614         changed.
6615         (struct column_info.valid_len): Now bool, not int.  All uses changed.
6616         (dired_dump_obstack, get_funky_string, clear_files,
6617         extract_dirs_from_files, print_current_files,
6618         print_many_per_line, print_horizontal, init_column_info,
6619         put_indicator, length_of_file_name_and_frills,
6620         print_with_commas): Use size_t, not int, for local variables
6621         that count sizes.
6622         (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6623         Check for TIOCGWINSZ returing negative values (or values greater
6624         than SIZE_MAX!).
6625         (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6626         init_column_info):
6627         Use xmalloc and xnmalloc, not XMALLOC.
6628         (gobble_file): Use xnrealloc, not XREALLOC.
6629         (print_color_indicator): Remove now-unnecessary cast to size_t.
6630
6631 2003-10-12  Paul Eggert  <eggert@twinsun.com>
6632
6633         * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6634         * tests/sort/sort-tests: Remove from CVS; assume that people
6635         brave enough to check coreutils out from CVS can rebuild it.
6636
6637 2003-10-12  Jim Meyering  <jim@meyering.net>
6638
6639         New options: --preserve-root and --no-preserve-root.
6640         * src/chmod.c (change_file_mode): Honor new option.
6641         (change_file_mode): Strip trailing slashes on directory
6642         argument passed to change_dir_mode.
6643         (get_root_dev_ino): New function.
6644         (main): Initialize global, root_dev_ino.
6645
6646         * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6647         S_ISLNK or S_ISSOCK.  The S_IS* macros are guaranteed to be defined
6648         via system.h.
6649         * src/chmod.c (change_file_mode): Likewise.
6650
6651 2003-10-08  Jim Meyering  <jim@meyering.net>
6652
6653         * src/csplit.c (main): Remove obsolete FIXME.
6654
6655 2003-10-07  Jim Meyering  <jim@meyering.net>
6656
6657         * Use automake-1.7.8.  Regenerate dependent files.
6658
6659 2003-09-29  Paul Eggert  <eggert@twinsun.com>
6660
6661         csplit cleanup.
6662
6663         * doc/coreutils.texi (csplit invocation):
6664         The regexp offset need not have a sign; POSIX requires support
6665         for signless offets.
6666
6667         Be more careful about int widths.  For example, remove some
6668         arbitrary limits by replacing 'unsigned' with 'size_t',
6669         'uintmax_t', etc.  Use standard bool rather than a homegrown type.
6670         * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6671         * src/csplit.c (FALSE, TRUE, boolean): Remove.  All uses changed
6672         to <stdbool.h> usage.
6673         (struct control): offset is now intmax_t, not int.
6674         repeat_forever is now bool, not int.
6675         (struct cstring): len is now size_t, not unsigned int.
6676         (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6677         size_t, not unsigned.  start_line, first_available are now
6678         uintmax_t, not unsigned.
6679         (hold_count, control_used): Now size_t, not unsigned.
6680         (last_line_number, current_line, bytes_written):
6681         Now uintmax_t, not unsigned.
6682         (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6683         create_new_buffer, get_new_buffer, load_buffer, find_line,
6684         process_regexp, split_file, new_control_record, extract_regexp,
6685         get_format_width, get_format_prec, max_out):
6686         size args, locals, and returned values are now size_t, not unsigned
6687         or int.
6688         (get_first_line_in_buffer, find_line, write_to_file,
6689         handle_line_error, process_line_count, regexp_error, process_regexp,
6690         split_file):
6691         File line, byte, and repetition counts are now uintmax_t, not unsigned.
6692         (check_for_offset): Don't require a sign before the offset.
6693         Use xstrtoimax to do the real work.
6694         (extract_regexp): Remove harmful cast of size to unsigned.
6695         256 -> 1<<CHAR_BIT, for clarity.
6696         (get_format_flags): Return at most 3, to avoid worries about overflow.
6697
6698         (bytes_to_octal_digits): Remove.
6699
6700         (cleanup): Don't check whether output_stream is NULL, since
6701         close_output_file does that for us.
6702
6703         (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6704         (sizeof *p);" instead of the more long-winded alternatives.
6705
6706         (get_new_buffer): Use O(1) algorithm for resizing a buffer
6707         to a much larger size, instead of an O(N) algorithm.
6708
6709         (process_regexp): Use plain NULL rather than casted 0.
6710
6711         (make_filename): Use %u, not %d, to format unsigned file number.
6712
6713         (new_control_record): Use xrealloc exclusively, since it handles
6714         NULL reliably.
6715
6716         (extract_regexp): Change misspelled word in diagnostic.
6717
6718         (get_format_width): Even if a minimum field width is specified,
6719         allow room for enough octal digits to represent the value of
6720         the maximum representible integer.  This fixes a potential
6721         buffer overrun.  Calculate this room at compile-time, not
6722         at run-time; this removes the need for bytes_to_octal_digits.
6723         Check for overflow; this removes a FIXME.
6724
6725         (get_format_prec): Don't allow precision to be signed; it's
6726         not ANSI.  Check for overflow.  Remove hardcoded "11" as
6727         default precision; this fixes a potential buffer overrun
6728         on hosts with wider size_t.
6729
6730         (get_format_conv_type): Change local variable to be of type
6731         unsigned char, not int; this removes a potential subscript
6732         violation on hosts where char is signed.
6733
6734         (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6735         Allow "%%" in format.  Don't overflow when
6736         counting lots of percents.
6737
6738         (usage): Default sprintf format is %02u, not %d.
6739
6740 2003-10-05  Jim Meyering  <jim@meyering.net>
6741
6742         * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6743
6744         * src/du.c (du_files): Mark diagnostic for translation.
6745
6746 2003-10-04  Jim Meyering  <jim@meyering.net>
6747
6748         * src/du.c (du_files): Ignore any failure of fts_close.
6749         Give better diagnostics for failed fts_open.
6750
6751         * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6752
6753         Deprecate existing use of -H (aka --si).
6754         * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6755         [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6756         (main): Warn that the meaning of -H will soon change to be
6757         POSIX compliant.
6758
6759 2003-10-03  Jim Meyering  <jim@meyering.net>
6760
6761         * src/du.c: Accept --no-dereference (-P).
6762
6763 2003-10-02  Jim Meyering  <jim@meyering.net>
6764
6765         * tests/du/trailing-slash: Adjust for slightly different output.
6766
6767         Rewrite du.c to use fts.
6768         * src/du.c: Include "fts_.h", not ftw.h.
6769         (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6770         (IS_FTW_DIR_TYPE): Remove definition.
6771         (IS_DIR_TYPE): Define.
6772         (is_symlink_to_dir): Remove now-unnecessary function.
6773         (process_file, du_files): Rewrite to use fts.
6774
6775         * tests/du/inaccessible-cwd: Ensure that even when run from an
6776         inaccessible directory, du can still operate on accessible
6777         directories elsewhere.
6778         * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6779
6780         * tests/rm/deep-1: Ensure that du can process a hierarchy
6781         of depth 400 while using no more than 50KB of stack space.
6782
6783 2003-10-01  Akim Demaille  <akim@epita.fr>
6784
6785         * announce-gen (print_news_deltas): New function, extracted from main.
6786         (main): Make `news_file' an array.
6787         Use '...=s' => \@var for --news and --url-directory specs.
6788         Before there were a couple of portability problems.
6789
6790 2003-09-28  Jim Meyering  <jim@meyering.net>
6791
6792         * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6793         (syntax-check-rules): Add it.
6794
6795         * src/copy.c: Remove unnecessary cast of alloca, since now it's
6796         guaranteed to be (void *).
6797         * src/cp.c: Likewise.
6798         * src/join.c: Likewise.
6799         * src/ln.c: Likewise.
6800         * src/ls.c: Likewise.
6801         * src/od.c: Likewise.
6802         * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6803
6804 2003-09-27  Jim Meyering  <jim@meyering.net>
6805
6806         Don't exhaust virtual memory when processing large inputs.
6807         Fix this by removing csplit's internal free-list management;
6808         instead rely on malloc for that.
6809
6810         * src/csplit.c (free_list): Remove global.
6811         (clear_all_line_control): Remove function.
6812         (get_new_buffer): Always use create_new_buffer to obtain a
6813         new buffer, rather than searching free_list.
6814         (free_buffer): Just call free.
6815         Reported by Nikola Milutinovic.
6816
6817 2003-09-26  Jim Meyering  <jim@meyering.net>
6818
6819         * man/rm.x: Also list `chattr' in SEE ALSO section.
6820         Suggestion from Mark Hubbart.
6821
6822 2003-09-25  Jim Meyering  <jim@meyering.net>
6823
6824         * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6825         that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6826
6827         * Use autoconf-2.57d.  Regenerate dependent files.
6828
6829 2003-09-24  Jim Meyering  <jim@meyering.net>
6830
6831         Minor efficiency tweak.
6832         * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6833         (do_link): Likewise.
6834
6835 2003-09-23  Jim Meyering  <jim@meyering.net>
6836
6837         * src/paste.c (paste_serial): Save errno after input error,
6838         to report proper errno value.
6839         Based on a patch from Paul Eggert.
6840
6841         * src/tee.c (tee): Adjust fwrite arguments so that the return
6842         value is the number of bytes written.
6843
6844 2003-09-16  Paul Eggert  <eggert@twinsun.com>
6845
6846         Don't assume ferror sets errno.  Bug reported by Bruno Haible.
6847
6848         * src/comm.c (compare_files): Save errno after input error,
6849         to report proper errno value.
6850         * src/fold.c (fold_file): Likewise.
6851         * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6852         * src/unexpand.c (unexpand): Likewise.
6853
6854         * src/csplit.c (close_output_file): Don't report bogus errno value
6855         after ferror discovers an output error.  We don't know the proper
6856         errno value, since it might have been caused by any of a whole
6857         bunch of calls, and it might have been trashed in the meantime.
6858         Fixing this problem will require much more extensive changes;
6859         in the meantime just say "write error".
6860         * src/od.c (check_and_close, dump, dump_strings): Likewise.
6861         * src/uniq.c (check_file): Likewise.
6862
6863         * src/join.c (get_line): Report error right away if I/O fails,
6864         so that the proper errno value is used.
6865         * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6866         * src/tee.c (tee): Likewise.
6867         * src/uniq.c (check_file): Likewise.
6868
6869         * src/od.c (skip): If a read fails, don't retry it later, so
6870         that we report the proper errno.
6871
6872         * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6873
6874         * src/tee.c (tee): Once a write failure has occurred, don't bother
6875         writing anything more to that stream.
6876
6877         * src/uniq.c (check_file): Check for ferror (stdout) even if
6878         ostream == stdout.
6879
6880         * src/yes.c (UNROLL): Remove.
6881         (main): Exit immediately when write failure is detected.
6882         Simplify code by assigning to argv when argc == 1.
6883
6884 2003-09-21  Paul Eggert  <eggert@twinsun.com>
6885
6886         * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6887         (WRITTEN_BY): Change "Franc,ois" (actually using
6888         c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6889         xgettext requires.
6890
6891 2003-09-19  Jim Meyering  <jim@meyering.net>
6892
6893         `du -D symlink-to-dir' would mistakenly omit the slash in
6894         lines like this: 24     symlink-to-dir/subdir
6895         * src/du.c (process_file): Fix offset calculation.
6896         Reported by Jeff Sheinberg as Debian bug #211591;
6897         http://bugs.debian.org/205251
6898
6899         * tests/du/deref-args: New file/test for the above.
6900         * tests/du/Makefile.am (TESTS): Add deref-args.
6901
6902         * src/du.c (process_file): Remove useless disjunct.
6903
6904         * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6905         to Written_by.
6906         * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6907         Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6908         Mark each WRITTEN_BY string as translatable.
6909
6910         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6911         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6912         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6913         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6914         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6915         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6916         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6917         * who.c, whoami.c, yes.c: Revert yesterday's changes.
6918         Instead, a subsequent change will embed `Written by ' in
6919         each string along with the author names.
6920
6921         * src/true.c: Revert yesterday's changes.
6922         * src/sys2.h: Likewise.
6923
6924 2003-09-18  Jim Meyering  <jim@meyering.net>
6925
6926         * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6927         * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6928         * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6929         * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6930         * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6931         * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6932         * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6933         * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6934         comma-separated list of strings and/or update the call to
6935         parse_long_options so that `AUTHORS, NULL' are the last parameters.
6936         * src/true.c (main): Append NULL to version_etc argument list.
6937         * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6938
6939         * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6940         shadowing the math function name.  Also rename loga to log_a.
6941
6942 2003-09-14  Jim Meyering  <jim@meyering.net>
6943
6944         * src/factor.c (print_factors): Give a separate diagnostic
6945         for numbers that are too large, but otherwise valid.
6946         Reported by Dániel Varga.
6947
6948 2003-09-10  Jim Meyering  <jim@meyering.net>
6949
6950         * Use automake-1.7.7.  Regenerate dependent files.
6951
6952         * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6953         of `fmt -1'.  Using the just-built tr is a little cleaner.
6954         Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6955         * man/Makefile.am (programs, check-x-vs-1): Likewise.
6956
6957 2003-09-09  Jim Meyering  <jim@meyering.net>
6958
6959         * src/copy.c: Alphabetize includes.
6960         Remove duplicate inclusion of "same.h".
6961
6962 2003-09-08  Jim Meyering  <jim@meyering.net>
6963
6964         * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6965         Didn't give enough of a benefit, mainly because it's not yet
6966         in wide enough use.
6967
6968         * Version 5.0.91.
6969
6970         * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6971         (check-programs-vs-x): Fail if $(programs) is empty.
6972
6973         * src/remove.c: Add a comment.
6974
6975 2003-09-07  Jim Meyering  <jim@meyering.net>
6976
6977         * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6978         Don't define.  These symbols are no longer used.
6979
6980         * tests/misc/tty-eof: Write ^D as \cD.
6981         Complete the change of 2003-08-02.
6982
6983         * Makefile.maint (po-check): Use cvsu, so that a temporary source
6984         file in lib/ or src/ doesn't induce an unwarranted failure.
6985         Add a kludge to filter out the sole generated source file that
6986         also has translatable messages: src/false.c.
6987
6988 2003-09-06  Jim Meyering  <jim@meyering.net>
6989
6990         * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6991         (parse_options): Give a diagnostic for (but still accept) the
6992         deprecated --allow-missing option.
6993
6994 2003-09-04  Paul Eggert  <eggert@twinsun.com>
6995
6996         Don't ignore -S if input is a pipe.  Bug report by Michael McFarland in
6997         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6998
6999         * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg.  Compute the
7000         size_bound ourselves. if an input file is a pipe and the user
7001         specified a size, use that size instead of trying to guess the
7002         pipe size.  This has the beneficial side effect of avoiding the
7003         overhead of default_sort_size in that case.  All callers changed.
7004         (sort): Remove static var size; now done by sort_buffer_size.
7005
7006 2003-09-05  Jim Meyering  <jim@meyering.net>
7007
7008         * Use automake-1.7.6b and autoconf-2.57b.  Regenerate dependent files.
7009
7010         * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
7011         to start, rather than just .1.  Upon failure, print unexpected state.
7012
7013 2003-09-04  Paul Eggert  <eggert@twinsun.com>
7014
7015         * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
7016         SAFE_READ_ERROR to tmp->nbytes.
7017         * src/tail.c (pipe_lines, pipe_bytes): Likewise.
7018
7019         * src/head.c (struct linebuffer): Change nbytes and nlines
7020         from unsigned int to size_t.  unsigned int is safe (after the
7021         2003-09-03 patch) but size_t is cleaner.
7022         * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
7023         (pipe_bytes): Likewise for local variable 'i', which was 'int'.
7024
7025         Standardize on BUFSIZ as opposed to other macro names and values.
7026         * src/head.c (BUFSIZE): Remove.  All uses changed to BUFSIZ.
7027         * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
7028         stdio.h has always defined it,
7029         and other code already assumes it's defined.
7030         * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
7031         (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
7032         (io_buf): IO_BUF_SIZE -> BUFSIZ.
7033
7034 2003-09-04  Paul Eggert  <eggert@twinsun.com>
7035
7036         * src/seq.c (step): Default to 1.
7037         (print_numbers): Allow the output to be empty.
7038         (main): The default step is 1, even if LAST < FIRST;
7039         as per documentation.
7040         * tests/seq/basic (onearg-2): Output should be empty.
7041
7042 2003-09-05  Jim Meyering  <jim@meyering.net>
7043
7044         * Makefile.cfg (wget_files): Temporarily disable, until master
7045         versions are restored to ftp.gnu.org.
7046
7047         * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
7048
7049         Make seq's --width (-w) option work properly even when the
7050         endpoint requiring the larger width is negative and smaller than
7051         the other endpoint.
7052         * src/seq.c (get_width_format): Include `-' in the set of bytes
7053         allowed in a `simple' number (no decimal point, no exponent).
7054         Reported by Patrick Mauritz.
7055
7056 2003-09-02  Paul Eggert  <eggert@twinsun.com>
7057
7058         * NEWS: sort -t '\0' now uses a NUL tab.
7059         sort option order no longer matters, unless POSIX requires it.
7060         * src/sort.c (usage): Say "blanks" instead of "whitespace",
7061         Similar fixes for many comments.
7062         (TAB_DEFAULT): New constant, so that we can support NUL as
7063         the field separator.
7064         (tab): Now int, not char.  Initialize to TAB_DEFAULT.
7065         (specify_sort_size): If multiple sizes are specified, use the largest.
7066         (begfield, limfield): Support NUL tab char.
7067         (set_ordering): Do not let -i override -d.
7068         (main): Report an error if incompatible -o or -t options are given.
7069         Report an error for "-t ''".  Allow "-t '\0'" to specify a NUL tab.
7070
7071 2003-09-05  Jim Meyering  <jim@meyering.net>
7072
7073         * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
7074
7075 2003-09-03  Andreas Schwab  <schwab@suse.de>
7076
7077         Bug report and patch here:
7078         <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
7079         * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
7080         * src/head.c (elide_tail_lines_pipe): Likewise.
7081
7082 2003-09-03  Jim Meyering  <jim@meyering.net>
7083
7084         * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
7085         small amount of code from him was first moved to lib/human.c, and was
7086         subsequently rewritten entirely.
7087         * src/df.c (AUTHORS): Likewise.
7088
7089 2003-08-22  Lawrence Teo  <lcteo@uncc.edu>
7090
7091         * src/md5sum.c (split_3): Accept the BSD format for generic
7092         message digest modes.  Currently works with BSD's MD5 and SHA1
7093         formats since these are the two algorithms presently used in
7094         coreutils.  Updated comments to reflect this change.
7095         (bsd_split_3): Updated comments.
7096
7097         * tests/md5sum/basic-1: New test to make sure that
7098         `md5sum --check' doesn't accept the BSD SHA1 format (adapted
7099         from `check-bsd' test in tests/sha1sum/basic-1).
7100
7101         * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
7102         --check exit status and BSD SHA1 format (adapted from tests
7103         in tests/md5sum/basic-1).
7104
7105 2003-08-30  Jim Meyering  <jim@meyering.net>
7106
7107         * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
7108
7109         When source and destination arguments refer to the same file, reside
7110         on a partition (e.g. VFAT) on which distinct names may refer to the
7111         same directory entry (often due to variations in case), and when the
7112         link count for the file is 1, mv no longer unlinks the file.  Instead,
7113         it gives the expected diagnostic that the source and destination are
7114         the same.  WARNING: this is an incomplete fix.  If the file happens
7115         to have a link count of 2 or greater, such an erroneous mv command
7116         will still unlink it.
7117         Although that is not possible on vfat or umsdos, it is possible on
7118         other file system types, e.g., ntfs, and hpfs.
7119         * src/copy.c (same_file_ok): Invoke same_name (which might still
7120         return false for names that refer to the same directory entry)
7121         only if the link count is 2 or more.
7122         * tests/mv/vfat: Show how to demonstrate the above problem.
7123         This test is not run.
7124         * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
7125
7126 2003-08-27  Jim Meyering  <jim@meyering.net>
7127
7128         * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
7129         who's -l option has been eliciting an unconditional warning about
7130         this impending change since sh-utils-2.0.12 (April 2002).
7131
7132         * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
7133         This would happen for nonempty files not ending with a newline.
7134         Reported by Dan Jacobson.
7135         * tests/misc/paste-no-nl: New file.  Test for above-fixed bug.
7136         * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
7137
7138         * src/stat.c (print_it): Avoid buffer overrun that would
7139         occur when the user-specified format string ends with `%'.
7140         Patch by Tommi Kyntola.
7141         * tests/misc/stat-fmt: New file.  Test for above-fixed bug.
7142         * tests/misc/Makefile.am (TESTS): Add stat-fmt.
7143
7144 2003-08-26  Jim Meyering  <jim@meyering.net>
7145
7146         Apply changes from bison.
7147         * GNUmakefile (SHELL): Define to `sh', if necessary.
7148         Add copyright.
7149         * Makefile.maint (WGETFLAGS): Define to `-C off'.
7150         Update all uses of $(WGET).
7151
7152 2003-08-22  Akim Demaille  <akim@epita.fr>
7153
7154         * Makefile.cfg (local-checks-to-skip): New.
7155         * Makefile.maint (local-check): Rename as...
7156         (local-checks-available): this.
7157         (local-check): New.
7158
7159 2003-08-26  Akim Demaille  <akim@epita.fr>
7160
7161         * announce-gen (print_changelog_deltas): Neutralize "<#" as
7162         "<\#" to avoid magic from Gnus when posting parts of this script.
7163
7164 2003-08-25  Jim Meyering  <jim@meyering.net>
7165
7166         * src/stat.c (main): Warn about use of deprecated `-l' option.
7167
7168 2003-08-22  Jim Meyering  <jim@meyering.net>
7169
7170         * src/stat.c (do_stat): For link count at end of line, use %h format,
7171         instead of %-5h.  The latter would make stat emit trailing spaces.
7172         Reported by Dan Jacobson.
7173
7174 2003-08-20  Jim Meyering  <jim@meyering.net>
7175
7176         * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
7177
7178 2003-08-19  Jim Meyering  <jim@meyering.net>
7179
7180         * src/system.h: Include stdlib.h unconditionally,
7181         as we're now assuming that part of hosted C89.
7182
7183 2003-08-18  Jim Meyering  <jim@meyering.net>
7184
7185         * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
7186         to avoid warnings from gcc.
7187
7188 2003-08-17  Jim Meyering  <jim@meyering.net>
7189
7190         Avoid unnecessary and sometimes time-consuming hostname lookups.
7191         * src/who.c (print_user): Use strchr, not strrchr.
7192         * src/pinky.c (print_entry): Likewise.
7193         Patch by Michael Stone.
7194         This fixes a typo I introduced in who-users.c on 1996-02-23.
7195
7196         * Makefile.maint (makefile-check): Add 0-9 to the range of characters
7197         disallowed between `@...@'.
7198
7199 2003-08-16  Paul Eggert  <eggert@twinsun.com>
7200
7201         * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
7202         done by gnulib .m4 files.
7203         (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
7204         * src/sys2.h (strtoull): Remove unused declaration.
7205
7206 2003-08-16  Jim Meyering  <jim@meyering.net>
7207
7208         * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
7209         are read-only.
7210
7211         * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
7212         race condition bug.  The bug would be triggered when tailing a file
7213         with file pointer not at beginning of file, and where the file was
7214         truncated to have a length of less than the initial offset at just
7215         the right moment (between the two lseek calls in this function).
7216
7217         An invalid initial value for *read_pos would result in
7218         `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
7219         busy-wait rather than sleeping between iterations.  The bug manifests
7220         itself only when tailing regular files that are initially nonempty.
7221         * src/tail.c (tail_bytes): Set *read_pos to new file offset after
7222         each xlseek call.
7223         (tail_lines): Likewise, after lseek calls.
7224         Reported by Nick Estes.  See http://bugs.debian.org/205251 for details.
7225         * tests/tail-2/tail-n0f: New file.  Test for above fix.
7226         * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
7227
7228 2003-08-15  Jim Meyering  <jim@meyering.net>
7229
7230         * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
7231         (sc_sun_os_names): Likewise.
7232         * .x-sc_space_tab, .x-sc_sun_os_names: New files.
7233
7234         * man/help2man: Remove some SPACEs before TAB.
7235
7236 2003-08-14  Paul Eggert  <eggert@twinsun.com>
7237
7238         * Makefile.maint (LC_ALL): Set to C.
7239         * man/Makefile.am (ASSORT): New var.
7240         (check-x-vs-1, programs): Use it.
7241         * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
7242         * tests/Makefile.am (ASSORT, all_programs): Likewise.
7243
7244 2003-08-11  Jim Meyering  <jim@meyering.net>
7245
7246         fold -s -wN would infloop for N < 8 with TABs in the input.
7247         E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
7248         * src/fold.c (fold_file): Move contents of `else'-block
7249         out of conditional so it's used also for --spaces (-s).
7250         * tests/misc/fold: Test for the above fix.
7251         * tests/misc/Makefile.am (TESTS): Add fold.
7252
7253 2003-08-10  Jim Meyering  <jim@meyering.net>
7254
7255         * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
7256         system.h so the types from time.h and sys/time.h are available.
7257         It appears that this is necessary for OpenBSD, NetBSD, and
7258         Darwin 6.5 (MacOS 10.2.5).  Reported by Nelson Beebe.
7259
7260 2003-08-06  Paul Eggert  <eggert@twinsun.com>
7261
7262         * NEWS: Add support for setting file timestamps to microsecond
7263         resolution, on hosts that support this.
7264         * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
7265         * src/copy.c (copy_internal):
7266         Set file timestamps with utimens, not utime.
7267         * src/cp.c (re_protect): Likewise.
7268         * src/install.c (change_timestamps): Likewise.
7269         * src/touch.c (newtime, touch, main): Likewise.
7270
7271 2003-08-09  Jim Meyering  <jim@meyering.net>
7272
7273         * Makefile.maint (sc_sun_os_names): New rule based on a regexp
7274         from Paul Eggert.
7275         (syntax-check-rules): Add it.
7276
7277         * src/tail.c (main): Tweak Solaris OS version number in comment.
7278         * src/wc.c (wc): Likewise
7279         * tests/tail-2/fflush: Likewise.
7280
7281         * src/tail.c: Add new undocumented option, --presume-input-pipe.
7282         (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
7283
7284 2003-08-08  Paul Eggert  <eggert@twinsun.com>
7285
7286         Use new gnulib 'extensions' module.
7287         * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
7288         AC_GNU_SOURCE.
7289
7290 2003-08-08  Paul Eggert  <eggert@twinsun.com>
7291
7292         * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
7293
7294 2003-08-09  Jim Meyering  <jim@meyering.net>
7295
7296         * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
7297         For tests of obsolete behavior, don't presume that unsetting
7298         _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
7299
7300 2003-08-07  Paul Eggert  <eggert@twinsun.com>
7301
7302         * doc/coreutils.texi (split invocation):
7303         Add -d or --numeric-suffixes option to 'split'.
7304         From a suggestion by Jesse Kornblum.
7305         * src/split.c (suffix_alphabet): New var.
7306         (longopts, usage, next_file_name, main): Support -d.
7307         (next_file_name, main): Allow -a0, as POSIX requires.
7308         (next_file_name): Don't assume ASCII-like encoding;
7309         'a' through 'z' are not contiguous in EBCDIC.
7310
7311 2003-08-05  Paul Eggert  <eggert@twinsun.com>
7312
7313         Merge getline from gnulib.
7314         * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
7315         * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
7316         New files, from gnulib.
7317         * lib/getdelim2.c, lib/getdelim2.h: Remove.
7318         * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
7319         getdelim2.h to getndelim2.c and getndelim2.h.
7320         * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
7321         checking for getdelim.
7322         (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
7323         than rolling our own.
7324         * src/cut.c: Include getndelim2.h rather than getdelim2.h.
7325         (cut_fields): Invoke getndelim2 rather than getdelim2.
7326
7327 2003-08-04  Jim Meyering  <jim@meyering.net>
7328
7329         * src/sort.c (main): Use unsigned int instead of int for `nsigs'
7330         and for the indices to iterate through nsigs.
7331
7332 2003-08-02  Paul Eggert  <eggert@twinsun.com>
7333
7334         * src/sort.c: Minor code cleanups, mostly to use more accurate
7335         types and to remove unnecessary casts.
7336         (min, max): Remove.  All uses changed to MIN and MAX.
7337         (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
7338         keyfield.skipsblanks, struct keyfield.skipeblanks, struct
7339         keyfield.numeric, struct keyfield.general_numeric, struct
7340         keyfield.month, struct keyfield.reverse, reverse, unique,
7341         have_read_stdin): Now bool, not int.  All uses changed.
7342         (eolchar): Now char, not int.
7343         (struct keyfield.ignore): Now bool const *, not int *.
7344         (struct keyfield.translate): Now char const *, not char *.
7345         (struct month.name): Likewise.
7346         (blanks, nonprinting, nondictionary): Now bool[], not int[].
7347         (cleanup, inittables, keycompare, check, mergefps, first_same_file,
7348         check, sort, main): Use const * pointers when possible.
7349         (month_cmp): Rewrite to avoid casts.
7350         (inittables): Initialize tables unconditionally, to avoid branches.
7351         (fillbuf): Return bool, not int.  All uses changed.
7352         (fillbuf, keycompare, new_key, main):
7353         Use SIZE_MAX rather than (size_t) -1.
7354         (trailing_blanks): Renamed from trim_trailing_blanks.
7355         Return the number of blanks to trim.  All uses changed.
7356         (getmonth): Use trailing_blanks rather than open code.
7357         (keycompare): Do not cast char * to unsigned char *; not needed.
7358         CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
7359         ourselves.
7360         (compare, main): Use | rather than || to avoid jumps.
7361         Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
7362         be nonzero there.
7363         (check, first_same_file, sort, main):
7364         Use bool instead of int local vars when possible.
7365         (check): Merge the old 'checkfp' and 'check' into a single function,
7366         that returns a boolean (true if the file was ordered).
7367         All uses changed.
7368         (main): Use int instead of unsigned for iterating through nsigs.
7369         Rename local var "posix_pedantic" to "posixly_correct".
7370
7371 2003-08-02  Jim Meyering  <jim@meyering.net>
7372
7373         * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
7374         to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
7375
7376         * src/cut.c (cut_fields): Don't read again after encountering an
7377         initial EOF.  E.g., `cut -f2' would do so.
7378         * tests/misc/tty-eof: Add a test for the above fix.
7379
7380         * src/sort.c (sortlines): Add description and references.
7381         From Paul Eggert.
7382
7383         * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
7384         the tests in help-version will use the just-built binaries.
7385         Reported by Christian Krackowizer.
7386
7387 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7388
7389         * NEWS: Add --rfc-2822 option to GNU date.
7390         * doc/coreutils.texi (Time directives, Options for date, Examples
7391         of date): Likewise.
7392         * src/date.c (long_options, usage, main): Likewise.
7393         * doc/getdate.texi (General date syntax): Likewise.
7394         * doc/coreutils.texi (Options for date): Fix a typo in format:
7395         it's now %d not %_d.  Add URLs.
7396
7397 2003-08-01  Jim Meyering  <jim@meyering.net>
7398
7399         * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
7400         Otherwise, with at least the /bin/sh from HPUX 10.20,
7401         the trap code would end up converting that to exit 1 and thus an
7402         unexpected test failure.  Reported by Christian Krackowizer.
7403
7404 2003-07-31  Paul Eggert  <eggert@twinsun.com>
7405
7406         * src/ptx.c: Do not include bumpalloc.h.
7407         (WORD_TABLE): New member alloc.
7408         (ALLOC_NEW_WORD): Remove.
7409         (occurs_alloc): New var.
7410         (digest_word_file, find_occurs_in_text): Check for arithmetic
7411         overflow when computing table size.  Use xrealloc rather than
7412         bumpalloc primitives.
7413
7414 2003-07-29  Jim Meyering  <jim@meyering.net>
7415
7416         * Version 5.0.90.
7417
7418         * README: When running tests as root, suggest using
7419         sudo with NON_ROOT_USERNAME=$USER.
7420
7421         * tests/Makefile.am (all_programs): Makefile is in ../src, not
7422         $(srcdir)/../src.
7423
7424 2003-07-28  Jim Meyering  <jim@meyering.net>
7425
7426         * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
7427
7428 2003-07-28  Paul Eggert  <eggert@twinsun.com>
7429
7430         * lib/stdbool.hin (_Bool): Make it signed char, instead of
7431         an enum type, so that it's guaranteed to promote to int.
7432         * src/sort.c (sortlines_temp): Undo previous change.
7433
7434 2003-07-28  Jim Meyering  <jim@meyering.net>
7435
7436         * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
7437         `bool'.  Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
7438         would cause lines[-1 - swap] (with swap = false) to evaluate to
7439         lines[4294967295].
7440
7441 2003-07-27  Jim Meyering  <jim@meyering.net>
7442
7443         * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
7444         since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
7445
7446         * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
7447         directories, as required by POSIX.   Reported by Karl Berry.
7448         * tests/rm/dir-no-w: New file.  Test for the above fix.
7449         * tests/rm/Makefile.am (TESTS): Add dir-no-w.
7450
7451         * tests/mk-script: Emit `$xx', not its expansion.
7452
7453 2003-07-27  Paul Eggert  <eggert@twinsun.com>
7454
7455         This change was inspired by a similar proposal by Stepan Kasal.
7456         * src/sort.c (mergelines, sortlines_temp): New functions.
7457         (sortlines): Use them, to reduce the number of times that
7458         we need to copy 'struct line' values.  This improved CPU
7459         performance by about 30% on one 18 MB test.
7460         (sort): Don't invoke sortlines unless we have 2 or more lines.
7461
7462 2003-07-26  Stepan Kasal  <kasal@ucw.cz>
7463
7464         * src/sort.c (sort): Don't require two `struct line's per text line,
7465         the new sort algorithm requires just 1.5.
7466
7467 2003-07-27  Jim Meyering  <jim@meyering.net>
7468
7469         * src/pathchk.c (validate_path): Use %lu, not %ld.
7470         From Paul Eggert.
7471         * src/cut.c (is_printable_field): Simplify bit arithmetic.
7472         From Paul Eggert.
7473         * src/ls.c (sort_files): Put `volatile' in the right place.
7474         From Paul Eggert.
7475
7476 2003-07-26  Jim Meyering  <jim@meyering.net>
7477
7478         Use only one bit per field/offset in array, not one `int'.
7479         * src/cut.c (printable_field): Change type to `unsigned char'.
7480         (mark_printable_field, is_printable_field): New functions.
7481         Use them in place of all direct accesses of `printable_field'.
7482
7483         * src/expand.c (parse_tabstops): Detect overflow properly.
7484         * src/cut.c (set_fields): Likewise.
7485
7486         * src/rm.c: Include "dirname.h".
7487         (usage): Use base_name (program_name) in body of --help output.
7488         This lets me...
7489         * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
7490         Idea from Brendan O'Dea, who suggested using
7491         `program_name = basename (argv[0]);' everywhere --
7492         can't do that, but using base_name works just fine here.
7493
7494         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
7495
7496 2003-07-24  Paul Eggert  <eggert@twinsun.com>
7497
7498         Fix some POSIX-compliance problems with 'test'.  This makes
7499         'test' more compatible with Bash.
7500
7501         * NEWS, doc/coreutils.texi: Document the following.
7502         * src/test.c: Include exitfail.h.
7503         (TEST_FAILURE): New constant, used for exit status if 'test' fails.
7504         (test-syntax_error): Use it.
7505         (binary_operator): Now takes bool arg specifying whether left operand
7506         is -l ARG, so that caller determines this rather than us.
7507         All uses changed.
7508         (term): Use posixtest to evaluate parenthesized subexpressions.
7509         (unary_operator, one_argument): Remove support for -t without operand.
7510         (one_argument): Take argument from argv[pos].
7511         (one_argument, two_arguments, three_arguments): Advance pos.
7512         All callers changed.
7513         (three_arguments): Look for binary ops before "!".  Then look
7514         for parenthesized one_argument expressions, instead of trusting
7515         expr () to do the right thing.
7516         (posixtest): Now takes number of args.  All callers changed.
7517         Treat "( A B )" like "A B".
7518         (main): Set exit_failure to TEST_FAILURE.  Don't depend on
7519         POSIXLY_CORRECT, as we now conform to POSIX by default.
7520         (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
7521         * tests/test/Test.pm (test_vector): Add several tests to check
7522         the above.  Syntax errors now exit with status 2, not 1.
7523         * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
7524
7525 2003-07-26  Jim Meyering  <jim@meyering.net>
7526
7527         * tests/help-version: Adjust for above change in test behavior:
7528         `[' exits with 2, not 1, and test doesn't accept --help or --version.
7529
7530         * Makefile.maint (ME): Don't use trick suggested in Make manual.
7531         It doesn't work for make-3.79.1.  Reported by Christian Krackowizer.
7532
7533         * Makefile.maint (sc_system_h_headers): Another syntax check.
7534         (syntax-check-rules): Add it to the list.
7535
7536         * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
7537         so it matches `%ld' format even on 32-bit systems.
7538
7539         * src/fmt.c (flush_paragraph): Cast field width to `int' to
7540         avoid warning on 64-bit systems.
7541
7542         * src/ls.c (sort_files): Make `func' volatile, so it can't be
7543         clobbered by a `longjmp' into this function.
7544
7545 2003-07-25  Jim Meyering  <jim@meyering.net>
7546
7547         * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
7548         value.
7549
7550         * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
7551         because it'd evoke spurious failure on 64-bit systems.
7552
7553 2003-07-24  Jim Meyering  <jim@meyering.net>
7554
7555         * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
7556         output its current record counts.  Reported by Jurriaan.
7557
7558         * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
7559         `wc' with no options.  This goes along with the change of 2003-07-20.
7560
7561 2003-07-23  Jim Meyering  <jim@meyering.net>
7562
7563         Don't include headers already included by system.h:
7564         * src/tr.c: Don't include errno.h.
7565         * src/true.c: Don't include version-etc.h.
7566         * src/test.c: Don't include limits.h or error.h.
7567         * src/stat.c: Don't include unistd.h or time.h.
7568         * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
7569         * src/pr.c: Don't include time.h.
7570         * src/pathchk.c: Don't include errno.h.
7571         * src/nice.c: Don't include sys/time.h.
7572         * src/ls.c: Don't include stdlib.h.
7573
7574         * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
7575         * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
7576         * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
7577         * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
7578         * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
7579         * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
7580         * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
7581         * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
7582         Don't include closeout.h.
7583
7584         * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
7585         can access the required version of rm.
7586         * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
7587
7588         * tests/cut/Test.pm (out-delim3a): New test.
7589
7590         * man/help2man: Update to version 1.33.
7591
7592         * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
7593
7594         * src/dircolors.c: Include xstrndup.h.
7595         (xstrndup): Remove function, now that it's been factored out into
7596         it's own file.
7597
7598 2003-07-22  Paul Eggert  <eggert@twinsun.com>
7599
7600         * src/wc.c (wc): Fix typo in computation of file from file_x,
7601         which caused the former to be used uninitialized if file_x was
7602         nonzero.
7603
7604 2003-07-22  Jim Meyering  <jim@meyering.net>
7605
7606         * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
7607
7608         * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
7609         help2man, to avoid having `rm.td/rm' appear in rm.1.  Reported by
7610         Thomas Luzat.  See http://bugs.debian.org/202413 for details.
7611
7612         * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7613
7614         * src/hostid.c: Don't include <unistd.h>.  system.h already does that.
7615
7616         * src/cut.c (set_fields): Mark all selected indices before trying to
7617         determine range endpoints.
7618         * tests/cut/Test.pm: New test for the above fix.
7619
7620         Begin to address this comment: What if someone wants to
7621         extract the 1,000,000-th field of some huge input file?
7622         The first step is to rearrange things so that the values
7623         in the printable_field array are all 0/1 rather than 0/1/2.
7624         * src/cut.c (RANGE_START_SENTINEL): Remove.
7625         Store range-start indices in a hash table, rather than
7626         overloading the `printable_field' array.
7627         (range_start_ht): New global.
7628         (hash_int, hash_compare_ints, is_range_start_index): New functions.
7629         (print_kth): Use is_range_start_index; don't test printable_field.
7630         (set_fields): Detect overflow.
7631         (set_fields): Insert each range-start index into range_start_ht.
7632         (main): Call set_fields only once, and only after
7633         output_delimiter_specified and (if required) range_start_ht have
7634         been defined.
7635
7636 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7637
7638         * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7639         invoked with a null pointer when there were no file arguments.
7640
7641 2003-07-20  Jim Meyering  <jim@meyering.net>
7642
7643         * Makefile.maint (sc_changelog): Add another nit-picky check.
7644
7645         * src/wc.c (write_counts): Add a comment.
7646         (wc): Rename `file' parameter.
7647         Set new local, `file', to be the file name, or (when it's NULL)
7648         _("standard output") so that all uses of `file' use the proper value.
7649         Use STREQ, not strcmp.
7650
7651 2003-07-20  Paul Eggert  <eggert@twinsun.com>
7652
7653         wc count field widths now are heuristically adjusted depending
7654         on the input size, if known.  If only one count is printed, it
7655         is guaranteed to be printed without leading spaces.
7656
7657         Previously, wc did not align the count fields if
7658         POSIXLY_CORRECT was set, but POSIX did not actually require
7659         this undesirable behavior, so it has been removed.
7660
7661         * NEWS: Document this.
7662         * doc/coreutils.texi (wc invocation): Likewise.
7663
7664         * src/wc.c (number_width): New var.
7665         (posixly_correct): Remove.
7666         (struct fstatus): New struct.
7667         (write_counts): Output fields of width number_width.
7668         Do not worry about POSIXLY_CORRECT.
7669         Use null file, not empty-string file, to denote stdin,
7670         since "" is a valid file name on some hosts.
7671         (wc, wc_file): New arg fstatus.  Use it to avoid invoking fstat
7672         if possible.
7673         (wc):  Avoid problems if end_pos - current_pos overflows.
7674         Do not print odd message if stdin has a read error.
7675         (get_input_fstatus, compute_number_width): New functions.
7676         (main): Use them to implement the new behavior.
7677         Ignore POSIXLY_CORRECT.
7678
7679         * tests/wc/Test.pm: Adjust to the new output widths.
7680
7681 2003-07-19  Jim Meyering  <jim@meyering.net>
7682
7683         * tests/rm/fail-eperm: Don't create temporary directory --
7684         we don't use it.
7685
7686         * tests/shred/remove: Don't open-code test for UID != 0.
7687         Use priv-check's require-non-root instead.
7688         Update to use newer framework.
7689
7690         * tests/help-version (expected_failure_status_expr): Record that
7691         expr exits with status of 3 for e.g., a write error.
7692
7693         * tests/priv-check: Use `id -u' to see if we're running as root,
7694         rather than trying go write to an write-protected file.
7695         When running as root, ensure $NON_ROOT_USERNAME is valid.
7696         When running as root with `require-non-root', ensure that `.'
7697         is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7698         to $NON_ROOT_USERNAME.  If `.' is not writable, then skip the test.
7699
7700         * src/printenv.c: Include "exitfail.h".
7701         (main): Set exit_failure rather than calling close_stdout_set_status.
7702         * src/date.c: Likewise.
7703         * src/sort.c: Likewise.
7704         * src/tty.c: Likewise.
7705
7706 2003-07-18  Jim Meyering  <jim@meyering.net>
7707
7708         * tests/touch/not-owner: Update to use newer framework.
7709
7710         * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7711         directory, and remove Perl-coded `you may not run as root' test.
7712         * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7713         hard-coding something not quite equivalent.
7714         Paul Jarc reported the inconsistent diagnostics.
7715
7716         * src/sort.c (main): Use close_stdout via atexit.
7717         Now `sort --version' and `sort --help' fail, as they should
7718         when their output is redirected to /dev/full.
7719
7720         * src/su.c (usage): Don't call close_stdout here.
7721         (main): Use close_stdout via atexit.
7722         Now `su --version > /dev/full' fails, as it should.
7723         Somehow, the change of 2000-05-07 that purports to fix this
7724         was not checked in.
7725
7726         * tests/help-version (--help/--version vs. /dev/full): Special-case
7727         `[' to protect it from expected_failure_status-`eval'.
7728
7729         * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7730         count and the corresponding line, as required by POSIX.
7731         Reported by Clement Wang.
7732         * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7733
7734         * tests/expr/basic: Add tests for when exit status is 2.
7735
7736         * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7737         Use an anonymous `enum', rather than #define.
7738
7739 2003-07-17  Paul Eggert  <eggert@twinsun.com>
7740
7741         * src/expr.c: Include "exitfail.h", "quotearg.h".
7742         (EXPR_INVALID, EXPR_ERROR): New constants.
7743         (nomoreargs, null, toarith, nextarg): Return bool, not int.
7744         (syntax_error): New function, exiting with status 2.  Use it
7745         insteading of printing "syntax error" ourselves.
7746         (main): Initialize exit_failure to EXPR_ERROR.
7747         Exit with EXPR_INVALID on syntax error (too few arguments).
7748         (nextarg): Use strcmp, not strcoll; strcoll might return
7749         an undesirable 0, or might fail.
7750         (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7751         or other such error.
7752         (eval2): Report an error if strcoll fails in a string comparison.
7753         * src/sort.c: Include "exitfail.h".
7754         (main): Set exit_failure, not xalloc_exit_failure and
7755         xmemcoll_exit_failure.
7756         * tests/expr/basic: Invalid value exits with status 3, not 2.
7757
7758 2003-07-16  Jim Meyering  <jim@meyering.net>
7759
7760         * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7761         per GNU maintainer guidelines.  The next non-beta release will be 5.1.
7762
7763         This script would have caught at least two recent bugs:
7764         those in [ and kill.
7765         * tests/help-version: Revive this script.
7766         It wasn't doing anything useful, since $all_programs wasn't being
7767         defined by the invoking Makefile.am.
7768         Reflect that nohup is no longer a script, so don't exclude it.
7769         Add framework to handle the programs added since it was last run:
7770         kill, stat, unlink, [, link, readlink.
7771         Fix path-related problems deriving from the move of this script
7772         from src/ to its present location.
7773         * tests/Makefile.am (all_programs): Define.
7774         (TESTS_ENVIRONMENT): Use it.
7775
7776         * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7777         whereby kill would always attempt to operate on argv[0] and fail.
7778
7779         * src/test.c (integer_expected_error): Improve diagnostic -- now,
7780         it also matches the one from bash's builtin test.
7781         (binary_operator): Add \n at end of diagnostic.
7782
7783         * tests/rm/fail-2eperm: Remove setuidgid-related code.  Move it to ...
7784         * tests/priv-check: Move setuidgid-related and
7785         NON_ROOT_USERNAME-checking code to this file.
7786
7787         * README: Update section on testing as `root'.
7788         Suggestion from Paul Jarc.
7789
7790         * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7791         names of authors that I just found in bash's builtins/test.def.
7792
7793         Running `[' with no arguments would evoke a segfault.
7794         * src/test.c (main) [LBRACKET]: Move initialization of argv to
7795         precede potential use via test_syntax_error.
7796
7797         * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7798         warning from automake -Wall.
7799
7800 2003-07-15  Jim Meyering  <jim@meyering.net>
7801
7802         * Version 5.0.1.
7803
7804         * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7805         prompt us about it.
7806
7807         * announce-gen (print_changelog_deltas): Relax tests for matching
7808         version-number line in NEWS.
7809         Change the .sig suffix to .asc here, too.
7810
7811 2003-07-14  Jim Meyering  <jim@meyering.net>
7812
7813         * Makefile.maint (%.asc): Renamed from %.sig.
7814         Generate and use ascii-armored signatures.
7815         Use gpg's -o option.
7816
7817 2003-07-13  Jim Meyering  <jim@meyering.net>
7818
7819         * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7820         (main): Use them.
7821
7822         * Makefile.maint (syntax-check): Move each individual check into
7823         its own target.
7824         (syntax-check-rules): This is the list of syntax-check targets.
7825         (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7826         (sc_cast_of_x_alloc_return_value, sc_space_tab):
7827         (sc_error_exit_success, sc_xalloc_h_in_src):  New targets.
7828
7829 2003-07-12  Jim Meyering  <jim@meyering.net>
7830
7831         * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7832         traces of the nohup script.
7833
7834         * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7835         $(OPTIONAL_BIN_ZCRIPTS).
7836
7837         * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7838         target, not before the `>'.
7839
7840         * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7841         now that that function no longer calls `error'.
7842
7843         * src/df.c (find_mount_point): Emit a diagnostic for each
7844         failed syscall, rather than relying on caller to do that.
7845         The caller couldn't do a good job, anyhow -- too many different
7846         ways to fail (each with a different referent).
7847         Give a diagnostic upon failed save_cwd, now that that function
7848         no longer calls `error'.
7849         (show_point): Don't diagnose find_mount_point's errors, now that
7850         it handles them itself.
7851
7852         * src/df.c (find_mount_point): Don't let free clobber errno upon
7853         failed chdir.
7854
7855         * src/sys2.h: Remove alloca-related block.
7856         * src/system.h: Include <alloca.h> here, instead.
7857
7858         It appears that the `#pragma alloca' included via "system.h" is
7859         adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7860         * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7861         * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7862
7863         * src/chown-core.c (change_file_owner): Do not restore any special
7864         permission bits (e.g., set-user-ID, set-group-ID) that are reset
7865         by chown(2) on some systems.  Suggestion and insistence :-) from
7866         Michael Stone.
7867
7868         * tests/input-tty: Also check `test -t 1'.
7869         This is necessary on linux-2.4.21.  Otherwise, the stty/basic-1
7870         test would block when run in the background.
7871
7872 2003-07-11  Jim Meyering  <jim@meyering.net>
7873
7874         * tests/sample-test: Also fail if cat-to-create-expected-output
7875         fails.  Otherwise, if both `exp' and `out' were to end up empty
7876         because of e.g., a full disk, they would mistakenly compare equal.
7877
7878         * src/nohup.c: New file.  Rewrite of nohup.sh in C.
7879         This solves a portability problem: on at least Solaris systems,
7880         when nohup.sh used the vendor /bin/sh, it would exit with status
7881         of `1' rather than the required 126 or 127 upon failure to exec
7882         the specified program.
7883
7884         * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7885         (bin_PROGRAMS): Add nohup.
7886         (EXTRA_DIST): Remove nohup.sh.
7887         (all_programs): Remove use of $(EXTRA_SCRIPTS).
7888         * src/nohup.sh: Remove file.
7889         * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7890
7891         * tests/misc/nohup: Tests for the above.
7892         * tests/misc/Makefile.am (TESTS): Add nohup.
7893
7894         * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7895         the macro, COPY_FD_DIAGNOSE.
7896         (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7897         (head_file): Likewise.
7898
7899         * src/date.c: Include "quote.h".
7900         (batch_convert): Use the quote function rather than using literal `...'
7901         in a diagnostic.
7902
7903         * src/setuidgid.c (main): Enclose diagnostic in _(...).
7904         * src/fmt.c (main): Likewise.
7905         * src/mknod.c (main): Likewise.
7906         * src/tac.c (tac_seekable): Likewise.
7907         * src/yes.c (main): Likewise.
7908         * src/od.c (main): Likewise.
7909         * src/install.c (change_attributes): Likewise.
7910
7911 2003-07-10  Jim Meyering  <jim@meyering.net>
7912
7913         * src/head.c (usage): Use 1024*1024 in place of 1048576.
7914         * src/tail.c (usage): Likewise.
7915
7916         * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7917         place of the kludge in this test.  Suggestion from Paul Jarc.
7918
7919         * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7920         * src/setuidgid.c: New program, solely for testing (not installed).
7921
7922         * src/chown-core.c (change_file_owner): Don't leak file descriptors
7923         when dereferencing symlinks.
7924
7925 2003-07-09  Jim Meyering  <jim@meyering.net>
7926
7927         * tests/du/slash: New file/test for today's lib/ftw.c fix.
7928         * tests/du/Makefile.am (TESTS): Add slash
7929
7930         * src/tail.c (xlseek): Avoid warning about ``return without value
7931         from function returning non-void''.
7932
7933 2003-07-08  Jim Meyering  <jim@meyering.net>
7934
7935         * man/help2man: Update to version 1.29.
7936
7937         * man/help2man: Add END handler to close STDOUT and check for errors.
7938
7939 2003-06-30  Paul Eggert  <eggert@twinsun.com>
7940
7941         Add support for a "[" that conforms to the GNU coding standards,
7942         i.e., that does not depend on its name.
7943         * src/lbracket.c: New file.
7944         * README: Add "[".
7945         * man/Makefile.am (programs): Ignore "[", since it doesn't have
7946         a separate man page.
7947         * src/Makefile.am (bin_PROGRAMS): Add "[".
7948         (__SOURCES): New var.
7949         * src/test.c (LBRACKET): Define to 0 if not defined.
7950         (main): Use LBRACKET rather than argv[0].
7951
7952         * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7953         Reported by Paul Jarc and Dan Jacobson.
7954
7955         * src/test.c (main): Do not recognize --help or --version if
7956         POSIXLY_CORRECT, when invoked as "test".  Handle "[ ]" correctly.
7957         Do not bother testing that margv[margc] is non-null.
7958
7959 2003-07-04  Jim Meyering  <jim@meyering.net>
7960
7961         * src/who.c (print_line): Rewrite to use asprintf, in order to be
7962         able to avoid emitting trailing spaces.  Reported by Dan Jacobson.
7963
7964         * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7965         option, and perform the +1600 invocations of head IFF the envvar
7966         RUN_EXPENSIVE_TESTS is set.
7967
7968 2003-07-03  Jim Meyering  <jim@meyering.net>
7969
7970         * src/cp.c (do_copy): Give a better diagnostic when failing due
7971         to nonexistent destination directory.  Reported by Dmitry Rutsky.
7972         See http://bugs.debian.org/199730 for details.
7973
7974 2003-06-27  Jim Meyering  <jim@meyering.net>
7975
7976         split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7977         * src/split.c (longopts): Use `1', not `0' as the value for
7978         for &verbose.  Reported by Keith Thompson.
7979
7980         Test for the above fix.
7981         * tests/misc/split-a: Also use --verbose and compare stderr
7982         output with what we'd expect.
7983
7984 2003-06-20  Jim Meyering  <jim@meyering.net>
7985
7986         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7987         Use `error_t' (rather than int) as type for local `err'.
7988         From Alfred M. Szmidt.
7989
7990 2003-06-19  Marcus Brinkmann  <marcus@gnu.org>
7991
7992         * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7993         Fix author preservation code.
7994
7995 2003-06-19  Jim Meyering  <jim@meyering.net>
7996
7997         * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7998         (do_link): Don't warn about hard link to symlink.
7999
8000 2003-06-18  Jim Meyering  <jim@meyering.net>
8001
8002         * src/cut.c: Include "getdelim2.h", not "getstr.h".
8003         Reflect renaming: getstr -> getdelim2.
8004
8005         * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
8006         readline -> readlinebuffer.
8007
8008 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8009
8010         * src/readlink.c: Include <sys/types.h> before system.h (because
8011         the latter includes <sys/stat.h>).  Required on Ultrix 4.3.
8012
8013 2003-06-17  Jim Meyering  <jim@meyering.net>
8014
8015         * src/system.h (initialize_main): Define.
8016         Use it in every `main'.  Applied via this:
8017         p='initialize_main (&argc, &argv);'
8018         perl -ni -e '/program_name.=.argv.0/ and print "  '"$p"'\n"; print' \
8019           $(grep -l program_name.=.argv.0 *.c)
8020         test.c uses margc/margv, so I made the change manually for that file.
8021         Based on a patch from Bernard Giroud.
8022
8023 2003-06-09  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8024
8025         Fix for build failure on Ultrix 4.3.
8026         * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
8027         Include sys/param.h and sys/mount.h on ultrix.
8028
8029 2003-06-16  Jim Meyering  <jim@meyering.net>
8030
8031         * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
8032         definitions.
8033         * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
8034         them here instead, but with one change: define EISDIR to -1, not 0.
8035
8036         * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
8037         guaranteed to be defined.
8038         * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
8039
8040         * README: Mention the CVS repository.
8041         Encourage addition of test cases.
8042
8043 2003-06-12  Jim Meyering  <jim@meyering.net>
8044
8045         * src/touch.c (touch): Call close only if necessary.
8046         From Bruno Haible.
8047
8048         * src/wc.c (usage): Correct wording: wc prints counts in the order
8049         `newline, word, byte'.  Reported by Keith M. Briggs.
8050         * man/wc.x: Fix it here, too.  And change `lines' to `newlines'.
8051
8052 2003-06-10  Jim Meyering  <jim@meyering.net>
8053
8054         * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
8055
8056 2003-06-07  Jim Meyering  <jim@meyering.net>
8057
8058         * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
8059         rule.
8060
8061 2003-06-06  Jim Meyering  <jim@meyering.net>
8062
8063         * src/extract-magic (main): Avoid newer 3-arg form of open,
8064         so this script works also with e.g., perl5.005_03.
8065         Patch by John David Anglin.
8066
8067 2003-06-04  Paul Eggert  <eggert@twinsun.com>
8068
8069         * src/system.h: Include <stdbool.h> unconditionally.
8070
8071 2003-06-04  Jim Meyering  <jim@meyering.net>
8072
8073         * man/Makefile.am (check-programs-vs-x): Rename target
8074         from check-programs-vs-1.  Adjust rule to check for the
8075         primary (.x) file, not the generated one (.1).
8076
8077 2003-06-03  Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
8078
8079         * man/kill.x: New file.
8080         * man/Makefile.am (dist_man_MANS): Add kill.1.
8081         (kill.1): New rule.
8082
8083 2003-06-04  Jim Meyering  <jim@meyering.net>
8084
8085         Ensure that the .x file for a new program is never forgotten again.
8086         * man/Makefile.am (programs): Define.
8087         (check-programs-vs-1): New phony target.
8088         (check-local): Depend on it.
8089
8090 2003-06-03  Jim Meyering  <jim@meyering.net>
8091
8092         Avoid unnecessary copying of environment.
8093         * src/env.c (main): Rather than clearing the environment and --
8094         unless told to ignore environment -- copying all settings from
8095         the saved, original environment, clear the environment only when
8096         that is requested.  Suggested by Jens Elkner.
8097
8098 2003-06-02  Jim Meyering  <jim@meyering.net>
8099
8100         * src/system.h: Always include <string.h>, since we assume C89.
8101         Include <limits.h> without checking for HAVE_LIMITS_H.
8102
8103         * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
8104         (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
8105
8106 2003-06-01  Jim Meyering  <jim@meyering.net>
8107
8108         Avoid a race condition in `tail -f' described by Ken Raeburn in
8109         http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
8110         * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
8111         (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
8112         (tail_bytes, tail_lines, tail): Likewise.
8113         (tail_file): Use the new `read_pos' value as the size,
8114         rather than stats.st_size from the fstat call.
8115
8116 2003-05-28  Jim Meyering  <jim@meyering.net>
8117
8118         * src/extract-magic: Allow expansion of `$file' in the here-
8119         document corresponding to the comment at the top of fs.h.
8120
8121 2003-05-26  Jim Meyering  <jim@meyering.net>
8122
8123         * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
8124         <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
8125         Use #if/#elif/... cascade so we get only one set of include files.
8126         Reported by Nelson Beebe.
8127
8128 2003-05-24  Jim Meyering  <jim@meyering.net>
8129
8130         * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
8131         * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
8132         accept the BSD format.
8133
8134 2003-03-28  Joe Orton  <jorton@redhat.com>
8135
8136         * src/md5sum.c (bsd_split_3): New function.
8137         (split_3): Detect checksums from BSD 'md5' command and handle them
8138         using bsd_split_3.
8139
8140         * tests/md5sum/basic-1: New tests for --check exit status, and for
8141         BSD-style checksum files.
8142
8143 2003-05-21  Jim Meyering  <jim@meyering.net>
8144
8145         * src/head.c (elide_tail_lines_pipe): Fix a thinko.
8146         This sort of thing is why it'd be *Really Good* to factor
8147         out the common code used here and in tail.c.
8148
8149 2003-05-14  Jim Meyering  <jim@meyering.net>
8150
8151         * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
8152
8153         * tests/du/slink: Skip this test if `.' is on an XFS file system.
8154
8155         * tests/du/fd-leak: New file.  Test for the bug in du that
8156         was fixed by the 2003-05-12 change to lib/ftw.c.
8157         * tests/du/Makefile.am (TESTS): Add fd-leak.
8158
8159         * src/head.c (AUTHORS): Enclose string in N_(...), now that it
8160         includes a translatable word, `and'.
8161
8162         * src/dd.c (usage): Don't use `,' as the thousands separator
8163         in e.g. 1,000,000 and 1,048,576.  Instead, do this:
8164         `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
8165         * src/df.c (usage): Likewise.
8166         * src/du.c (usage): Likewise.
8167         * src/ls.c (usage): Likewise.
8168
8169         * Makefile.maint (syntax-check): Add another check.
8170
8171 2003-05-13  Paul Eggert  <eggert@twinsun.com>
8172
8173         Fix uniq to conform to POSIX, which requires that "uniq -d -u"
8174         must output nothing.  Problem reported by Josh Hyman.
8175
8176         * src/uniq.c (enum output_mode, mode): Remove, replacing with:
8177         (output_unique, output_first_repeated, output_later_repeated):
8178         New vars.  All uses of "mode" changed to use these variables,
8179         which are not mutually exclusive as "mode" was.
8180         (writeline): New arg "match", used to control whether to
8181         obey output_first_repeated or output_later_repeated.
8182         All callers changed.
8183         (check_file, main): Adjust to above changes.
8184
8185         * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
8186
8187 2003-05-14  Jim Meyering  <jim@meyering.net>
8188
8189         * tests/rm/rm3: Use tr's \n notation rather than \012.
8190         This package can afford to do that, since its tests are guaranteed use
8191         GNU tr, which has accepted the more modern notation for 10 years.
8192         * tests/rm/rm5: Likewise.
8193         * tests/cp/same-file: Likewise.
8194         * tests/stty/row-col-1: Likewise.
8195         * tests/stty/basic-1: Likewise.
8196         * tests/rm/deep-1: Likewise.
8197         * tests/mv/part-symlink: Likewise.
8198         * tests/mkdir/perm: Likewise.
8199         * tests/misc/nice: Likewise.
8200
8201 2003-05-13  Jim Meyering  <jim@meyering.net>
8202
8203         * src/copy.c (struct F_triple) [name]: Remove const attribute.
8204         (triple_free): Don't apply cast to argument of free.
8205         (seen_file): Add cast here instead.
8206
8207         * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
8208         (src_to_dest_free): Don't apply cast to argument of free.
8209
8210         * src/sort.c (zaptemp): Don't apply cast to argument of free.
8211         * src/pr.c (init_fps, init_store_cols): Likewise.
8212         * src/join.c (delseq, freeline): Likewise.
8213         * src/expr.c (OLD): Likewise.
8214         * src/sort.c (sort): Likewise.
8215         * src/head.c (elide_tail_lines_pipe): Likewise.
8216
8217         * src/tail.c: Include "quote.h".
8218         Use quote in diagnostics.  Change many error format strings
8219         from just `%s' to e.g., `error reading %s'.
8220         (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
8221         Rewrite newline-counting loop to use memchr.
8222
8223         * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
8224         Now that assert is no longer used, don't include <assert.h>.
8225
8226 2003-05-12  Jim Meyering  <jim@meyering.net>
8227
8228         * src/head.c: Include <assert.h>.
8229         (AUTHORS): Add my name.
8230         (elide_tail_lines_pipe): New function.
8231
8232 2003-05-10  Jim Meyering  <jim@meyering.net>
8233
8234         * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
8235
8236         * src/readlink.c (main): Set program_name before first use.
8237         Remove that (redundant) first use.
8238         Don't exit successfully just because --verbose was specified.
8239         Pass 0, not EXIT_SUCCESS, as first argument to error; when that
8240         parameter is 0, error does not exit.
8241
8242         * src/uname.c (main): When failing due to too many arguments, also say
8243         that, rather than just "Try `uname --help' for more information.".
8244         * src/comm.c (main): Likewise, but for too few arguments.
8245         * src/logname.c: Include error.h.
8246         (main): Say why we're failing.
8247
8248         * src/uniq.c (main): Don't segfault when argc < optind.
8249         * src/who.c (main): Handle argc < optind.
8250         * src/df.c (main): Likewise.
8251         * src/install.c (main): Likewise.
8252         * src/mv.c (main): Likewise.
8253         * src/pwd.c (main): Likewise.
8254         * src/tty.c (main): Likewise.
8255         * src/chroot.c (main): Likewise.
8256         * src/hostname.c: Likewise.
8257         * src/du.c (main): Likewise.
8258         * src/expand.c (main): Likewise.
8259         * src/env.c (main): Likewise.
8260         * src/unexpand.c (main): Likewise.
8261         * src/printenv.c (main): Likewise.
8262         * src/sync.c (main): Handle argc == 0.
8263         * src/expr.c (main): Likewise.
8264         * src/printf.c (main): Likewise.
8265         * src/basename.c (main): Likewise.
8266         * src/ln.c (main): Test for `missing argument' before computing n_files.
8267         * src/tail.c (main): Test for the case of no arguments before
8268         computing n_files.
8269
8270         * src/kill.c (send_signals): Don't check command line arguments here.
8271         (main): Check them here instead.  Handle argc < optind.
8272
8273         * src/logname.c (main): Use error, rather than fprintf, for the sake
8274         of consistency.
8275
8276         * src/rm.c (main): Don't overrun array bound if argc is 0.
8277
8278 2003-05-09  Jim Meyering  <jim@meyering.net>
8279
8280         * src/sort.c (main): Don't overrun array bound if argc is 0.
8281         That would happen when invoked via: execl ("/usr/bin/sort", NULL);
8282         Reported by Wartan Hachaturow.
8283
8284 2003-05-07  Jim Meyering  <jim@meyering.net>
8285
8286         Implement support so that `head --lines=-N' works on seekable files.
8287         * src/head.c (enum Copy_fd_status): Define.
8288         (COPY_FD_DIAGNOSE): New macro.
8289         (elide_tail_lines_seekable): New funtion.
8290         (elide_tail_lines_file): Call it here.
8291
8292 2003-05-06  Jim Meyering  <jim@meyering.net>
8293
8294         * src/sys2.h (CHAR_BIT): Remove duplicate definition.
8295
8296 2003-05-04  Jim Meyering  <jim@meyering.net>
8297
8298         * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
8299         caused the addition of thousands of small files to the tar archive.
8300         * tests/misc/head-elide-tail: New file.  Add them here instead.
8301         * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
8302
8303 2003-05-04  Paul Eggert  <eggert@twinsun.com>
8304
8305         * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
8306         (IF_READDIR_NEEDS_REWINDDIR): Remove.
8307         (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
8308         which was a bit weird because it couldn't be emulated by a function.
8309
8310 2003-05-03  Jim Meyering  <jim@meyering.net>
8311
8312         Extend head to accept --lines=-N (--bytes=-N) and to print all
8313         but the N lines (bytes) at the end of the file.
8314         * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
8315         Use quote() in diagnostics, rather than literal `' marks.
8316         (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
8317         New functions.
8318         (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
8319         (head_file): Reorganize so as to call head from only one place.
8320         (main): Likewise, for head_file.
8321         Handle new, undocumented option, --presume-input-pipe.
8322         Handle negative line and byte counts.
8323         * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
8324
8325         * tests/du/8gb: Skip test if the file system of `.' doesn't support
8326         sparse files -- otherwise it'd create a file of size 8GB.
8327
8328 2003-05-02  Jim Meyering  <jim@meyering.net>
8329
8330         * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
8331         Instead explain about `-' and standard input.
8332         (main): Give a proper diagnostic for e.g., `fmt -c -72'.
8333         Reported by Keith Thompson.
8334         * tests/fmt/basic: Add test for the above fix.
8335
8336         * src/fmt.c: Include "quote.h".
8337         Use quote() in diagnostics, rather than literal `' marks.
8338         (main): Exit nonzero when unable to open an input file.
8339         * tests/fmt/basic: Add test for the above fix.
8340
8341         * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
8342         specifications like `-72x'.
8343         * tests/fmt/basic: Add test for the above fix.
8344
8345         Work around nasty readdir bug on Darwin6.5.
8346         * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
8347         [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
8348         returned NULL and there has been at least one successful unlink or
8349         rmdir call since the opendir or previous rewinddir, then call
8350         rewinddir and reiterate the loop.
8351
8352         Factor out common code.
8353         * src/remove.c (readdir_ignoring_dotdirs): New function.
8354         (is_empty_dir): Use it here.
8355         (remove_cwd_entries): Use it here.
8356
8357 2003-05-01  Jim Meyering  <jim@meyering.net>
8358
8359         * tests/rm/r-3: Create 500 rather than just 300 files.
8360         There's a bug in Darwin6.5's readdir that shows up only with
8361         338 or more files.
8362         Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
8363         has two components.
8364
8365         * src/tail.c:
8366         Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
8367         (dump_remainder): Move two declarations `down' into the scope
8368         where they are used.
8369         (xlseek): Return the resulting offset.
8370         (file_lines): Rename parameter, file_length, to end_pos.
8371         (pipe_lines): Don't coerce safe_read return value to `int'.
8372         Adapt tests accordingly.
8373         (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
8374         to `unsigned int'.
8375         Change type of `total_bytes' from `int' to `size_t',
8376         since the former wouldn't always be wide enough.
8377         Don't coerce safe_read return value to `int',
8378         and adapt tests accordingly.
8379         Now that testing for a read error no longer involves
8380         using `tmp', handle that case *after* freeing `tmp'.
8381         (start_bytes): Clean up.
8382         (tail_bytes): Now that `n_bytes' may be larger than
8383         OFF_T_MAX, test for that condition and, if it's true, don't
8384         use lseek optimizations.
8385         (parse_options): Don't fail just because N_UNITS is larger than
8386         the maximum size of a file -- tail may be applied to an input
8387         stream (e.g., a pipe) with more data than that.
8388
8389         * Makefile.maint (syntax-check): Rename from alloc-check.
8390         Also check for SPACE-TAB sequences.
8391         Also check for malloc/calloc/realloc casts.
8392
8393 2003-05-01  Jim Meyering  <jim@meyering.net>
8394
8395         * src/tail.c (start_lines): Rewrite to use memchr.  Clean up.
8396
8397 2003-04-28  Jim Meyering  <jim@meyering.net>
8398
8399         * tests/misc/tty-eof: Send two tokens, not just one, so we don't
8400         make the now-more-picky tsort fail.
8401
8402 2003-04-24  Jim Meyering  <jim@meyering.net>
8403
8404         * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
8405         (main): Minor syntactic clean-up.
8406
8407         * src/tsort.c (tsort): Fail if the input contains an odd number of
8408         tokens.  Reported by junkio@cox.net.
8409
8410         * tests/tsort/basic-1: Test for the above fix.
8411
8412 2003-04-21  Jim Meyering  <jim@meyering.net>
8413
8414         * tests/misc/printf: Add tests for the printf fixes below.
8415
8416         * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
8417
8418 2003-04-20  Paul Eggert  <eggert@twinsun.com>
8419
8420         Fix printf POSIX compatibility bug reported by Ben Harris in
8421         <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
8422         * doc/coreutils.texi (printf invocation): It's \NNN in the format,
8423         \0NNN in the %b operand.
8424         * src/printf.c (usage): Likewise.
8425         (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
8426         is desired.  All uses changed.  Behave like Bash printf if %b
8427         operand uses \NNN where the initial N is not 0.
8428
8429 2003-04-17  Jim Meyering  <jim@meyering.net>
8430
8431         * src/stty.c: Remove uses of PROTOTYPE macro.
8432
8433 2003-04-15  Jim Meyering  <jim@meyering.net>
8434
8435         * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
8436         each sequence of spaces before a TAB character.
8437
8438 2003-04-13  Jim Meyering  <jim@meyering.net>
8439
8440         * src/remove.c (is_empty_dir): Don't closedir (NULL).
8441
8442 2003-04-12  Jim Meyering  <jim@meyering.net>
8443
8444         Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
8445         --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
8446         FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
8447         * src/nl.c (main): Fix those problems and remove literal quote marks
8448         (e.g., "`%s'") from format string; instead use "%s" in each format
8449         string and `quote (optarg)' as the corresponding argument.
8450         Also, diagnose all invalid command line options before failing.
8451
8452         * src/nl.c (proc_text): Fix a bug that would make nl output extra
8453         newlines in some cases.  Details here: http://bugs.debian.org/177256.
8454         This bug was introduced on 2001-11-10 for textutils-2.0.17.
8455         * tests/misc/nl: Add test for the above-fixed bug.
8456
8457         * tests/misc/readlink: New file.  Test the --canonicalize option.
8458         * tests/misc/Makefile.am (TESTS): Add readlink.
8459
8460 2003-04-11  Jim Meyering  <jim@meyering.net>
8461
8462         Clean up.
8463         * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
8464         * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
8465         * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
8466         retain alignment) each sequence of spaces before a TAB character.
8467
8468         * src/ls.c: Include <stdlib.h> unconditionally.
8469
8470         * Makefile.maint (xalloc-check): Rename from header-check.
8471
8472         * src/yes.c: Include error.h after system.h, not before.
8473
8474         Clean up.
8475         * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
8476         * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
8477         * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
8478         * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
8479         * src/tr.c: * src/unexpand.c, src/users.c:
8480         Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
8481         return values and of xrealloc's first argument.
8482         Fix the former with this:
8483         perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
8484
8485 2003-04-10  Jim Meyering  <jim@meyering.net>
8486
8487         * src/stty.c (wrapf): Declare with format attribute.
8488
8489         The S_MAGIC_... names shouldn't be maintained in two places (prior
8490         to this change, one would have to keep stat.c and fs.h in sync).
8491         This change makes it so those names and the corresponding
8492         hexadecimal constants all reside in stat.c.  fs.h is now generated.
8493         * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
8494         (BUILT_SOURCES): Add fs.h, now that it's generated.
8495         (EXTRA_DIST): Add extract-magic.
8496         * src/extract-magic: New script to extract fs.h definitions from stat.c.
8497         * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
8498         fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
8499
8500         * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
8501         file with nominal length > 4GB fails.  Reported by Michael Deutschmann.
8502
8503         * man/unexpand.x: Add `SEE ALSO' reference to expand.
8504         * man/expand.x: Add `SEE ALSO' reference to unexpand.
8505         Suggestion from Dan Jacobson.
8506
8507 2003-04-10  Maciej W. Rozycki  <macro@ds2.pg.gda.pl>
8508
8509         * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
8510         * src/stat.c (human_fstype): Handle Linux's devpts.
8511
8512 2003-04-09  Paul Eggert  <eggert@twinsun.com>
8513
8514         * src/split.c (line_bytes_split): Arg is of type size_t, since
8515         that's all that is supported for now.
8516         (main): Check for overflow in obsolescent line count option.
8517
8518 2003-04-09  Jim Meyering  <jim@meyering.net>
8519
8520         * tests/misc/split-fail: Add a new test for the above fix.
8521
8522         * src/split.c (bytes_split): Use size_t temporary (rather than
8523         uintmax_t original) in remaining computations.  From Paul Eggert.
8524
8525         Handle command line option arguments larger than 2^31.
8526         This allows e.g., splitting into files of size 2GB and larger,
8527         and running split --lines=N with N=2^31 or more.
8528         But for --line-bytes=N, the restriction that N <= SIZE_MAX
8529         remains (for now), due to the way it is implemented.
8530
8531         * src/split.c: Include "inttostr.h".
8532         (bytes_split, lines_split, line_bytes_split, main):
8533         Use uintmax_t, not size_t, for file sizes.
8534         (main): Give a better diagnostic for option arguments == 0.
8535         Use umaxtostr to print file sizes.
8536         Reported by Luke Hassell.
8537
8538 2003-04-08  Jim Meyering  <jim@meyering.net>
8539
8540         * src/rm.c (usage): Mention that --directory (-d) works only
8541         on some systems.  Suggestion from Samuel Tardieu.
8542
8543         * tests/basename/basic: Run $PERL to see if it is available,
8544         rather than testing its value.
8545         * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
8546         * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
8547         * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
8548         * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
8549         * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
8550         * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
8551         * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
8552         * tests/sum/basic-1, tests/seq/basic: Likewise.
8553
8554         * tests/misc/Makefile.am (TESTS): Add split-fail.
8555         * tests/misc/split-fail: New file.
8556
8557         * src/split.c: Rename local variables: nchars -> n_bytes.
8558         (lines_split): Rename local, nlines -> n_lines.
8559         (main): Rename local variable: s/accum/n_units/.
8560         (main): Use STDIN_FILENO, not literal `0'.
8561
8562 2003-04-07  Jim Meyering  <jim@meyering.net>
8563
8564         * src/stat.c: Add #include directives for Ultrix 4.4.
8565         Based on a suggested change from Bert Deknuydt.
8566
8567 2003-04-06  Jim Meyering  <jim@meyering.net>
8568
8569         * Makefile.maint (makefile-check): New rule.
8570         (local-check): Add it.
8571
8572 2003-04-05  Jim Meyering  <jim@meyering.net>
8573
8574         * Makefile.am (nearly all of them):
8575         Use $(VAR) rather than @VAR@, now that we can rely on automake to
8576         emit a definition for each substituted variable.
8577         * tests/Makefile.am.in: Likewise.
8578
8579         * tests/rm/rm5: Add a comment explaining why this test fails when
8580         using Tru64's broken sed.
8581         * tests/rm/rm3: Likewise.
8582
8583         Make `kill -t' output signal descriptions (not `?') on Tru64.
8584         * src/kill.c (sys_siglist): Also check for __sys_siglist.
8585         Patch by Tony Leneis.
8586         * configure.ac: Also check for declaration of __sys_siglist.
8587         Required for Tru64 4.0D, 4.0F, and 5.1.
8588         Reported by Tony Leneis.
8589
8590 2003-04-04  Jim Meyering  <jim@meyering.net>
8591
8592         * src/Makefile.am (PERL): Remove unnecessary definition.
8593
8594         Because of inappropriate (but POSIX-mandated) behavior of rename,
8595         `mv a b' would not remove `a' in some unusual cases.  Work around
8596         this by unlinking `a' when necessary.
8597
8598         * src/copy.c (same_file_ok): Add an output parameter.
8599         Set it in the offending case.
8600         (copy_internal): When necessary, unlink SRC_PATH and inform caller.
8601         Reported by Ed Avis.
8602         * tests/mv/hard-4: New test for the above.
8603         * tests/mv/Makefile.am (TESTS): Add hard-4.
8604
8605         Clean up rules for automatically generated sources:
8606         * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
8607         Make each generated file be read-only.
8608         Add each file name to BUILT_SOURCES separately.
8609         (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8610
8611         Put LOCALEDIR macro definition in new file: localedir.h.
8612         * src/Makefile.am (DEFS): Remove definition.
8613         (localedir.h): New rule.
8614         (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8615         * src/system.h: Include "localedir.h".
8616
8617 2003-04-02  Jim Meyering  <jim@meyering.net>
8618
8619         * Version 5.0.
8620
8621         * tests/misc/Makefile.am (TESTS): Add false.
8622
8623         * Makefile.maint (TMPDIR): Make sure it's defined.
8624         (my-distcheck): Build in $(TMPDIR), not `.'.
8625
8626         * src/Makefile.am (false.c): Change all occurrences of
8627         `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8628         unsuccessfully also with --help.  Reported by Paul Jarc,
8629         * tests/misc/false: New test for the above.
8630
8631 2003-03-30  Jim Meyering  <jim@meyering.net>
8632
8633         * NEWS: Note the location of older NEWS files.
8634
8635         * src/remove.c (is_empty_dir): Don't let a failing closedir
8636         clobber errno.  Spotted by Arnold Robbins.
8637
8638         * src/env.c: Fix typo in comment.  From Arnold Robbins.
8639
8640 2003-03-29  Jim Meyering  <jim@meyering.net>
8641
8642         * Version 4.5.12.
8643
8644         * README: Note to expect build problems for stat.c on Ultrix 4.3.
8645         Note that there are some harmless test failures when running
8646         `make check' as root on some systems.
8647
8648 2003-03-28  Jim Meyering  <jim@meyering.net>
8649
8650         * tests/stty/row-col-1: Skip this test if stty can't get window size.
8651         This happens when connecting to sparc-solaris5.7 via ssh from within
8652         emacs.  Reported by Karl Berry.
8653
8654         * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8655         Otherwise, on systems (DJGPP) that emulate pipes using files,
8656         this test would never complete, waiting for `yes' to terminate.
8657         * tests/du/slink: As above, use seq, not `yes' to generate link target.
8658         * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8659         Reported by Rich Dawe.
8660
8661 2003-03-27  Jim Meyering  <jim@meyering.net>
8662
8663         * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8664         from `written by...' comment, at his request.
8665
8666 2003-03-24  Paul Eggert  <eggert@twinsun.com>
8667
8668         Fix buffer overrun problem reported by TAKAI Kousuke, along
8669         with some other POSIX incompatibilities.
8670
8671         * src/printf.c (print_esc): Do not treat \x specially if
8672         POSIXLY_CORRECT.  Avoid buffer overrun if the format ends
8673         in backslash.  Treat incomplete escape sequences as strings
8674         of characters, as POSIX requires.
8675         (print_formatted): Allow multiple flags.  Avoid buffer overrun
8676         if the format is incomplete.
8677
8678 2003-03-24  Jim Meyering  <jim@meyering.net>
8679
8680         * tests/misc/printf: Add tests for the above fixes and changes.
8681
8682 2003-03-26  Jim Meyering  <jim@meyering.net>
8683
8684         * src/copy.h (struct cp_options): Add a comment.
8685
8686 2003-03-23  Jim Meyering  <jim@meyering.net>
8687
8688         * README: Describe problem with 64-bit mode on HPUX 11.x,
8689         with patch for /usr/include/inttypes.h.
8690         * TODO: Plan to add an autoconf test to work around the bug.
8691
8692 2003-03-22  Jim Meyering  <jim@meyering.net>
8693
8694         * src/stat.c: Don't include <sys/sysmacros.h>.
8695         That is already done via system.h.  Otherwise, the multiple
8696         inclusion would evoke redefinition warnings from Cray's /bin/cc,
8697         aka Cray Standard C Version 4.0.3  (057126) Mar 22 2003  22:02:28.
8698         (human_fstype): Factor some directives `up', out of this function.
8699         Cast away `const' to avoid error from Cray's /bin/cc.
8700
8701 2003-03-20  Jim Meyering  <jim@meyering.net>
8702
8703         * announce-gen (print_changelog_deltas): Ensure that a newline
8704         precedes each row of `*'s.
8705
8706 2003-03-20  Jim Meyering  <jim@meyering.net>
8707
8708         * Version 4.5.11.
8709
8710         * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8711         format flag characters.
8712         Do not require that a field width be specified.
8713         Do not fail when given a field width of `0'.
8714         Reported by Dan Jacobson.
8715         * tests/seq/basic: Add new tests for the above-fixed bug.
8716
8717         * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8718         (install-root): Likewise.
8719         (install-exec-local): Likewise.
8720         Based on a patch from Richard Dawe.
8721
8722 2003-03-19  Jim Meyering  <jim@meyering.net>
8723
8724         * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8725         because the DJGPP 2.03 port of 'ln -s' doesn't work.
8726         Include $(EXEEXT) in program names.
8727         Since $(LN_S) may degenerate to `cp -p', be careful
8728         to invoke it from the destination directory.
8729         Mostly from Richard Dawe.
8730         * configure.ac: Use AC_PROG_LN_S.
8731
8732         * tests/mv/part-symlink: Unset CDPATH.  Otherwise, having the
8733         CDPATH shell variable set could cause this test to fail.
8734         Reported by Karl Berry.
8735
8736 2003-03-18  Jim Meyering  <jim@meyering.net>
8737
8738         * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8739         type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8740         AIX 5.1's xlc could not compile the former.
8741         Patch by Petter Reinholdtsen.  Also reported by Mike Jetzer.
8742
8743 2003-03-17  Richard Dawe  <rich@phekda.freeserve.co.uk>
8744
8745         * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8746         program names, since automake only adds $(EXEEXT) to programs
8747         in its *_PROGRAMS.
8748
8749 2003-03-16  Jim Meyering  <jim@meyering.net>
8750
8751         * src/remove.c (rm): Put two local variables in static storage,
8752         so they can't be clobbered by the potential longjmp.
8753
8754 2003-03-15  Jim Meyering  <jim@meyering.net>
8755
8756         * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8757         so that a version number with a two-digit component can still count
8758         as an alpha release.  Reported by Richard A Downing.
8759         (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8760
8761 2003-03-14  Jim Meyering  <jim@meyering.net>
8762
8763         * src/ansi2knr.c: Remove no-longer-used file.
8764         * src/ansi2knr.1: Likewise.
8765
8766         * Makefile.maint (prev_version_file): Don't use ?= for this particular
8767         assignment, since it causes trouble with old versions of GNU make
8768         (e.g. 3.76.1).  The other uses of `?=' are inoffensive.  Details here.
8769         http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8770         Patch from Alexandre Duret-Lutz.
8771
8772         * Use patched automake-1.7.3.  Regenerate Makefile.in files in
8773         subdirectories so that each includes a definition of ACLOCAL_M4.
8774
8775         * announce-gen (main): Label the compressed source URLs.
8776
8777         * Version 4.5.10.
8778
8779         * tests/du/slink: Relax the test for the `local'ness of a file system,
8780         so that now it works also for tmpfs.
8781
8782         * tests/du/hard-link: Transform output from first du, so that this
8783         test doesn't fail on file systems like tmpfs that order directory
8784         entries differently.
8785
8786 2003-03-13  Jim Meyering  <jim@meyering.net>
8787
8788         * tests/du/8gb: Work around what appears to be an NFS failure that
8789         would make this test fail on some systems.
8790
8791 2003-03-11  Jim Meyering  <jim@meyering.net>
8792
8793         * tests/du/basic: Make the test file exactly 4k bytes long.
8794
8795         * src/split.c (longopts): Don't hard-code `2' here.
8796         Instead, just specify `&verbose', and ...
8797         (main): ... remove the `case 2:' block for --verbose.
8798
8799         * tests/du/basic: Make the test file larger than 64 bytes, so that
8800         we don't immediately disqualify file systems (e.g., NetApp) on which
8801         smaller files take up zero disk blocks.  Reported by Vin Shelton.
8802
8803 2003-03-10  Jim Meyering  <jim@meyering.net>
8804
8805         Don't segfault for a negative field width or precision in format string.
8806         Note that this is just a stopgap fix.  The longer term solution may
8807         involve adapting bash's builtins/printf.def.
8808
8809         * src/printf.c: (UNSPECIFIED): Define.
8810         (print_direc): Use the special value, UNSPECIFIED, to indicate
8811         that field_width or precision has not been specified.
8812         (print_formatted): Fail if field_width or precision is the
8813         special value, UNSPECIFIED.
8814         Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8815
8816         * src/sys2.h (INT_MIN): Define, if necessary.
8817         * tests/misc/printf: Add a test for the above-fixed bug.
8818
8819 2003-03-09  Jim Meyering  <jim@meyering.net>
8820
8821         * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8822         changing its sign.  This avoids a warning from gcc on 64-bit systems.
8823         Reported by Bob Proulx.
8824         (pop_dir): Reverse order of sign change and cast, to be consistent
8825         with the above.
8826
8827 2003-03-08  Jim Meyering  <jim@meyering.net>
8828
8829         * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8830         shell variable, but only in the environment.  With /bin/sh->bash, the
8831         shell variable is set to `y', and that would cause a spurious warning.
8832         Reported by Bob Proulx.
8833
8834         * tests/Makefile.am (check-root): Remove touch/fifo.
8835         It doesn't appear to have to be run as root.
8836
8837         * tests/rm/fail-2eperm: Rather than simply using the first non-root
8838         user name, make sure that the selected user name has a usable shell.
8839         Reported by Paul Jarc.
8840
8841         Before, when using shred on a device, one had to specify --exact,
8842         or be careful to choose a size that would not be rounded up and
8843         exceed the maximum value;  that could result in a failure of
8844         the final write.
8845         * src/shred.c (do_wipefd): --exact is now the default for non-regular
8846         files.  Suggestion from Ben Elliston.
8847         (usage): Say it.
8848
8849         * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8850         Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8851         Patch by Bob Proulx.
8852
8853         * src/Makefile.am (check-misc): Check for use of `defined' in
8854         #define directives.
8855         Change to $(srcdir) before running grep.
8856
8857         * src/sleep.c: Remove now-unused #include and #define directives.
8858
8859         * src/du.c (process_file): If a file's size is not being counted
8860         e.g., because it's a hard link to a file we've already counted,
8861         then don't print a line for it.
8862
8863         * tests/du/hard-link: New test for the above-fixed bug.
8864         * tests/du/Makefile.am (TESTS): Add hard-link.
8865
8866         `du -S' didn't work
8867         * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8868         and make the two-array approach work.
8869
8870         * tests/du/basic: Correct/add tests for the above fix.
8871         Set LC_ALL, etc., now that we use sort.
8872         Check the block/size of a small file, too.
8873         Correct expected results for simple dir1/dir2/file case.
8874         Add another test of du -S.
8875
8876 2003-03-07  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
8877
8878         Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8879         middle-end/9986).  As one of GCC's optimizations, it transforms a
8880         fputs_unlocked call to a fputc_unlocked call when the string is
8881         one character long.  However, hpux doesn't have fputc_unlocked.
8882
8883         * expr.c (usage): Use putchar, not fputs, to output a single character.
8884         * ls.c (dired_dump_obstack): Likewise.
8885         * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8886         * stat.c (print_it): Likewise.
8887
8888 2003-03-07  Jim Meyering  <jim@meyering.net>
8889
8890         * src/cp.c: Remove everything associated with mmap-stack.c.
8891         This reverts the two changes of 2003-02-21.
8892         * src/du.c: Remove everything associated with mmap-stack.c.
8893         This reverts the change of 2003-02-19.
8894
8895 2003-03-06  Jim Meyering  <jim@meyering.net>
8896
8897         * tests/cp/same-file: Unset CDPATH.  Otherwise, having the
8898         CDPATH shell variable set could cause this test to fail.
8899         Reported by Karl Berry.
8900
8901 2003-03-05  Jim Meyering  <jim@meyering.net>
8902
8903         * Version 4.5.9.
8904
8905         * src/printf.c (print_esc): Remove pointless comparison of unsigned
8906         integer with zero, to avoid a warning from Intel's ecc.
8907         Reported by Nelson Beebe.
8908
8909         * src/du.c (process_file): Sizes must all be of type uintmax_t.
8910         Otherwise, for files or totals that are too big, numbers would
8911         be truncated.  Patch mostly by Michael Stone.
8912         Reported by Ingo Saitz as Debian bug #183210.
8913
8914         * tests/du/8gb: New test for the above-fixed bug.
8915         * tests/du/Makefile.am (TESTS): Add 8gb.
8916
8917         * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8918         rather than UTILS_OPEN_MAX - 10.
8919
8920 2003-03-04  Jim Meyering  <jim@meyering.net>
8921
8922         * README: Refer new feature discussion to bug-coreutils@gnu.org,
8923         rather than bug-gnu-utils, now that the former is better known.
8924         Suggestion from Göran Uddeborg.
8925
8926         * src/stat.c (usage): Capitalize consistently.
8927         Reported by Göran Uddeborg.
8928
8929         * Makefile.maint (rel-files): Include $(signatures), so that
8930         those files are also copied into $(release_archive_dir).
8931
8932         * src/df.c (find_mount_point): Call error here, now that restore_cwd
8933         no longer does it.
8934         * src/remove.c (AD_pop_and_chdir): Likewise.
8935
8936         * tests/Makefile.am (check-root): Add fail-2eperm.
8937
8938 2003-03-03  Jim Meyering  <jim@meyering.net>
8939
8940         * src/remove.c (remove_cwd_entries): Include the full filename of
8941         the offending file, not just the basename.
8942
8943         * tests/misc/tty-eof: Set $ME properly.
8944
8945         * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8946         Remove now-unused variables.
8947         (tag-prev-version, prev-cvs-tag): Likewise.
8948
8949         * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8950         accurate diagnostic when failing to remove a file owned by some other
8951         user.  Reported by Ivo Timmermans via Michael Stone.
8952         This fixes Debian bug# 178471.
8953
8954         * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8955         * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8956         Based on a report from Ivo Timmermans.
8957
8958 2003-03-02  Jim Meyering  <jim@meyering.net>
8959
8960         * src/copy.c (copy_internal) [un_backup]: When recovering from a
8961         failure to create a hard link, do not remove the entry associating
8962         the source dev/ino with the destination file name.
8963         * tests/mv/Makefile.am (TESTS): Add hard-3.
8964         * tests/mv/hard-3: New test, for the above-fixed bug.
8965         Inspired by a report from Iida Yosiaki.
8966
8967 2003-03-01  Jim Meyering  <jim@meyering.net>
8968
8969         * src/df.c (print_header): Don't embed spaces in a separate `Type'
8970         header string.  Instead, put `Filesystem' and `Type' headers in the
8971         same string, so translators can use horizontal space as needed.
8972         Reported by Jean Charles Delepine.
8973
8974 2003-02-28  Jim Meyering  <jim@meyering.net>
8975
8976         * src/copy.c (copy_internal): When link fails because of an
8977         existing destination file, unlink that file and try again.
8978         Reported by Iida Yosiaki.
8979
8980         * tests/mv/Makefile.am (TESTS): Add hard-2.
8981         * tests/mv/hard-2: New test for the above-fixed bug.
8982         Based on a test case from Iida Yosiaki.
8983
8984 2003-02-26  Jim Meyering  <jim@meyering.net>
8985
8986         * tests/du/basic: Don't test du's -b option here.  Directory byte
8987         counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8988         and IBM AIX 4.2.  Reported by Nelson Beebe.
8989
8990 2003-02-25  Jim Meyering  <jim@meyering.net>
8991
8992         * Makefile.maint (announcement): Now that ChangeLog entries
8993         are output by announce-gen, don't do it here.
8994         * announce-gen (print_changelog_deltas): New function.
8995         (main): Use it.
8996
8997 2003-02-22  Jim Meyering  <jim@meyering.net>
8998
8999         * announce-gen: New option: --release-type=TYPE
9000         * Makefile.maint (beta, major): New targets.  Remove `release'.
9001         Put them all together on a line.
9002         Pass the release type (via RELEASE_TYPE envvar) to the MAKE
9003         invocation of `announcement'.
9004         (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
9005
9006         * announce-gen: New option: --news=NEWS_FILE.
9007         Extract NEWS entries here, not via rules in Makefile.maint.
9008         * Makefile.maint (announcement): Now that NEWS entries are
9009         extracted by announce-gen, don't do it here.
9010         (news-r1, news-r2): Remove now-unused definitions.
9011
9012 2003-02-21  Jim Meyering  <jim@meyering.net>
9013
9014         * Version 4.5.8.
9015
9016         Merge in changes from autoconf's version of this file.
9017         * Makefile.maint (www-gnu): Define.
9018         (standards.texi-url_prefix): Use $(www-gnu).
9019         (make-stds.texi-url_prefix): Likewise.
9020
9021         * src/cp.c: Include "mmap-stack.h".
9022         (main): Invoke `run' through a macro that (when possible) runs it
9023         with a large, mmap'd stack.
9024
9025         * src/cp.c (run): New function, preparing for the above.
9026         Exit from this function, not from main
9027         (main): Call run.
9028
9029         * src/du.c: New option: --apparent-size.
9030         (enum) [APPARENT_SIZE_OPTION]: New member.
9031         (long_options): Add it.
9032         (usage): Describe it.
9033         (main): Handle it.
9034         ['b']: Set apparent_size.
9035         David Eisner reported that the behavior of --bytes had changed.
9036         Paul Eggert proposed the use of a new option, --apparent-size.
9037
9038         * src/du.c (apparent_size): New global.
9039         (print_only_size): Reflect the fact that we're printing byte counts,
9040         not ST_NBLOCKSIZE-byte-block counts.
9041         (print_size): Call print_only_size rather than duplicating its code.
9042         (process_file): Accumulate byte counts, rather than block counts.
9043
9044         * src/du.c (process_file): Always reset size_to_propagate_to_parent
9045         for --separate-dirs (-S).
9046
9047 2003-02-20  Jim Meyering  <jim@meyering.net>
9048
9049         * Use automake-1.7.3.  Regenerate dependent files.
9050
9051         * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
9052         This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
9053         (usage) [%B]: Describe it.
9054         [%b]: Refer to %B.
9055
9056         * src/du.c (process_file): Reorganize the code to use only
9057         one `sum' array, and change how -S works back to the way it was
9058         before 2003-01-31.  Patch by Bruno Haible.
9059
9060         * tests/du/basic: New test.
9061         * tests/du/Makefile.am (TESTS): Add basic.
9062
9063         * tests/envvar-check: Add checks for the following:
9064         BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
9065
9066         * tests/Makefile.am: Rename phony target envvar-check to evar-check
9067         so as not to conflict with the distributed file by the same name.
9068
9069         * src/du.c (process_file): Set info->skip before any possible return.
9070
9071         Report correct usage for directories, not 0.
9072         * src/du.c (process_file): Return for `file_type == FTW_DPRE'
9073         _before_ recording the dev/ino of a directory.
9074         Reported by Bruno Haible.
9075
9076         Now, df always displays the device file name corresponding to the
9077         listed mount point under `Filesystem'.  Before, for an unmounted
9078         block- or character-special file argument, it would display the
9079         command-line argument instead.
9080         * src/df.c (show_disk): Return a value indicating whether
9081         there was a match.  Don't try to find a mount point here.
9082         (show_entry): If show_disk doesn't find a match, call show_point.
9083
9084 2003-02-19  Jim Meyering  <jim@meyering.net>
9085
9086         * src/du.c: Include "mmap-stack.h".
9087         (du_files): Add prototype with ATTRIBUTE_NORETURN.
9088         Exit from this function, not from...
9089         (main): ...here.
9090         Instead, if possible, invoke du_files through a macro that
9091         runs it with a large, mmap'd stack.
9092
9093         * src/join.c (usage): Change wording in --help output:
9094         use FILENUM instead of `SIDE' and say what FILENUM means.
9095         Reported by Bernhard Gabler.
9096
9097         * src/df.c (print_header): Rather than using a hard-coded literal
9098         string of spaces matching the length of the English `...Type' header,
9099         output the right number of spaces to match the selected translation.
9100         Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
9101
9102         * src/split.c (bytes_split): Remove unnecessary `else' after break.
9103         (lines_split): Likewise.  and correct misleading indentation.
9104
9105         * src/split.c: Include "full-read.h".
9106         (bytes_split, lines_split, line_bytes_split): Use full_read,
9107         not safe_read.   The way split was using the latter, a short read
9108         could cause split to terminate before EOF.
9109
9110         * tests/misc/tty-eof: Test all programs that can read stdin,
9111         requiring no arguments and that write to standard output.
9112
9113         * tests/misc/tty-eof: New file.  Renamed from ...
9114         * tests/misc/cat-tty-eof: Remove file.  Rename to tty-eof.
9115         * tests/misc/Makefile.am (TESTS): Reflect renaming.
9116
9117 2003-02-18  Jim Meyering  <jim@meyering.net>
9118
9119         cksum would perform an extra read after encountering EOF
9120         * src/cksum.c (cksum): Exit the loop upon EOF, too.
9121         Patch by Michael Bacarella.
9122
9123         Test for the bug fixed today in cksum, md5sum, and sha1sum.
9124         * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
9125         cat, cksum, md5sum, and sha1sum all in the same loop.
9126
9127 2003-02-14  Jim Meyering  <jim@meyering.net>
9128
9129         * src/remove.c: Include "euidaccess.h".
9130         Remove declaration of euidaccess.
9131
9132 2003-02-12  Jim Meyering  <jim@meyering.net>
9133
9134         * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
9135         in cast to avoid warning from icc.  Reported by Alexandre Duret-Lutz.
9136
9137 2003-02-10  Jim Meyering  <jim@meyering.net>
9138
9139         * src/test.c: Don't include group-member.h.
9140         Include euidaccess.h.
9141         (eaccess): Rewrite function to set the real uid and gid temporarily
9142         to the effective uid and gid, then invoke 'access', and then set the
9143         real uid and gid back.  On systems that lack setreuid or setregid,
9144         fall back on the kludges in euidaccess.  Before, it would not work
9145         for e.g., files with ACLs, files that were marked immutable,
9146         or on file systems mounted read-only.  Nelson Beebe raised the issue.
9147         Paul Eggert suggested the new implementation.
9148
9149 2003-02-09  Jim Meyering  <jim@meyering.net>
9150
9151         * src/test.c (test_stat): Remove function.  It's job is done (only
9152         when necessary) by the wrapper in lib/stat.c.  Adjust all uses.
9153
9154 2003-02-08  Jim Meyering  <jim@meyering.net>
9155
9156         * Version 4.5.7.
9157
9158         * tests/mv/part-symlink: Don't assume that the file owner username
9159         length is less than 9 in ls output: instead, omit that field
9160         altogether.  Reported by, and suggested fix from, Ferdinand.
9161
9162         * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
9163         * tests/du/Makefile.am (TESTS): Add restore-wd.
9164
9165         * src/rm.c: Correct now-invalid comment about cycle-detection.
9166
9167 2003-02-06  Jim Meyering  <jim@meyering.net>
9168
9169         * NEWS: Add entries from old/*/NEWS
9170         from fileutils-4.1 through 4.1.11 and
9171         from sh-utils-2.0 through 2.0.15.  Suggestion from Karl Berry.
9172
9173         * Version 4.5.6.
9174
9175         * src/du.c (process_file): Don't return early for excluded files
9176         or for files whose dev/inode we've already seen.
9177
9178 2003-02-05  Jim Meyering  <jim@meyering.net>
9179
9180         * tests/du/exclude: New file.
9181         * tests/du/Makefile.am (TESTS): Add exclude.
9182
9183 2003-02-04  Dmitry V. Levin  <ldv@altlinux.org>
9184
9185         * src/who.c (print_boottime, print_deadprocs, print_runlevel):
9186         Fix memory allocation arithmetic.
9187
9188 2003-02-04  Jim Meyering  <jim@meyering.net>
9189
9190         `df /dev/block-or-char-device-file--not-mounted' now reports
9191         the name of the file system on which the file resides, usually `/'.
9192         Before, it would leave the `Mounted on' field blank.
9193         * src/df.c (show_disk): Move function to precede find_mount_point.
9194         (show_disk): Add parameter: STATP.
9195         If we don't find a matching device name, then resort to calling
9196         find_mount_point.  Reported by Bob Proulx.
9197
9198 2003-02-03  Andreas Schwab  <schwab@suse.de>
9199
9200         * tests/rm/cycle: Require non-root.
9201         * tests/rm/isatty: Likewise.
9202
9203 2003-02-02  Jim Meyering  <jim@meyering.net>
9204
9205         * Version 4.5.5.
9206
9207         * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
9208
9209         Ensure that there are no offending uses of `:'.
9210         * Makefile.maint (makefile_path_separator_check): New rule.
9211         (local-check): Add it to the list.
9212
9213 2003-02-01  Jim Meyering  <jim@meyering.net>
9214
9215         * src/du.c (MAX_N_DESCRIPTORS): Define.
9216
9217         * src/stat.c (G_fail): New global.
9218         (human_time): Diagnose failed localtime, not failed nstrftime.
9219         (main): Fail if G_fail is set.
9220
9221 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
9222
9223         * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
9224         hard-coding the path-separator.  Also double-quote the new PATH,
9225         to avoid problems when the path-separator is a semi-colon or when
9226         `pwd` contains e.g. a space.
9227         * tests/chgrp/Makefile.am: Likewise.
9228         * tests/chmod/Makefile.am: Likewise.
9229         * tests/chown/Makefile.am: Likewise.
9230         * tests/cp/Makefile.am: Likewise.
9231         * tests/dd/Makefile.am: Likewise.
9232         * tests/dircolors/Makefile.am: Likewise.
9233         * tests/du/Makefile.am: Likewise.
9234         * tests/expr/Makefile.am: Likewise.
9235         * tests/factor/Makefile.am: Likewise.
9236         * tests/fmt/Makefile.am: Likewise.
9237         * tests/install/Makefile.am: Likewise.
9238         * tests/ln/Makefile.am: Likewise.
9239         * tests/ls/Makefile.am: Likewise.
9240         * tests/ls-2/Makefile.am: Likewise.
9241         * tests/md5sum/Makefile.am: Likewise.
9242         * tests/misc/Makefile.am: Likewise.
9243         * tests/mkdir/Makefile.am: Likewise.
9244         * tests/mv/Makefile.am: Likewise.
9245         * tests/od/Makefile.am: Likewise.
9246         * tests/rm/Makefile.am: Likewise.
9247         * tests/rmdir/Makefile.am: Likewise.
9248         * tests/seq/Makefile.am: Likewise.
9249         * tests/sha1sum/Makefile.am: Likewise.
9250         * tests/shred/Makefile.am: Likewise.
9251         * tests/stty/Makefile.am: Likewise.
9252         * tests/sum/Makefile.am: Likewise.
9253         * tests/tail-2/Makefile.am: Likewise.
9254         * tests/touch/Makefile.am: Likewise.
9255         * tests/tsort/Makefile.am: Likewise.
9256         * tests/unexpand/Makefile.am: Likewise.
9257
9258 2003-01-31  Jim Meyering  <jim@meyering.net>
9259
9260         * src/stat.c: Include "file-type.h"
9261         (print_human_type): Remove function.
9262         (human_access): Rename from print_human_access.  Return a string.
9263         (human_time): Rename from print_human_time.  Return a string.
9264         (print_stat): Arrange so that field width and an alignment specifier
9265         are honored for the %A, %F, %x, %y, and %z formats.
9266         [%F]: Use file_type; this gives slightly different file type strings,
9267         e.g., `directory' instead of `Directory' and `regular file' or
9268         `regular empty file' instead of `Regular file'.
9269         Prompted by a report from Richard Dawe that the uses of
9270         S_IFSOCK and S_IFIFO in print_human_time were not portable
9271         to systems using e.g., DJGPP.
9272
9273 2003-01-31  Richard Dawe  <rich@phekda.freeserve.co.uk>
9274
9275         * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
9276         test using S_IFMT and S_IFLNK.  S_IFLNK may not be defined.
9277
9278 2003-01-31  Jim Meyering  <jim@meyering.net>
9279
9280         * src/du.c (main): Upon processing an invalid option or an invalid
9281         --exclude-from or --max-depth option argument, don't exit right away,
9282         in case there are others.  Rather record the failure and exit after
9283         processing other options.
9284
9285         * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
9286         tar archive easier to reproduce.
9287
9288         Rewrite to perform directory traversal using nftw.
9289
9290         * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
9291         (AUTHORS): Add self.
9292         (opt_one_file_system): Move global into `main'.
9293         (path, xstat, exit_status): Remove declarations.
9294         (arg_length, suffix_length): New globals.
9295         (G_fail): New global, sort of like the old `exit_status'.
9296         (IS_FTW_DIR_TYPE): Define.
9297         (print_only_size): New function.
9298         (process_file): New function.
9299         (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
9300         (str_trunc, pop_dir, count_entry): Likewise.
9301         (du_files): Rewrite to use nftw.
9302
9303 2003-01-30  Jim Meyering  <jim@meyering.net>
9304
9305         * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
9306         symlink-to-directory with -L, even without the trailing slash.
9307
9308 2003-01-27  Jim Meyering  <jim@meyering.net>
9309
9310         * src/Makefile.am (check-misc): Check for st_blocks, too.
9311
9312         * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
9313         Reported by Richard Dawe.
9314
9315 2003-01-27  Andreas Schwab  <schwab@suse.de>
9316
9317         * src/ls.c (quote_name): Add fourth parameter, width, into which to
9318         store the screen columns, and return the number of bytes instead.
9319         (print_dir): Pass NULL as fourth parameter of quote_name.
9320         (print_name_with_quoting): Likewise.
9321         (length_of_file_name_and_frills): Get the width from the fourth
9322         parameter of quote_name instead of return value.
9323
9324 2003-01-27  Jim Meyering  <jim@meyering.net>
9325
9326         * src/ls.c (decode_switches): If `dired' is set without
9327         `format == long_format', then silently reset dired.  This doesn't
9328         change the behavior of ls (all prior uses of dired were protected
9329         by `&& format == long_format'), and lets us...
9330         (DIRED_INDENT): ... remove the `format == long_format' conjunct.
9331         (PUSH_CURRENT_DIRED_POS): Likewise.
9332         (main): Likewise.
9333
9334 2003-01-22  Jim Meyering  <jim@meyering.net>
9335
9336         * tests/du/no-x: New test, for functionality added to lib/ftw.c.
9337         * tests/du/Makefile.am (TESTS): Add no-x.
9338
9339 2003-01-21  Jim Meyering  <jim@meyering.net>
9340
9341         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
9342         && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
9343         it may still be a directory -- or not (e.g., with FreeBSD on an
9344         NFS-mounted file system), so resort to calling lstat to find out.
9345         Based on a patch by Michael van Elst.
9346
9347         * tests/cp/same-file: Don't assume that the file owner username
9348         length is less than 9 in ls output: instead, omit that field
9349         altogether.  Reported by, and suggested fix from, Ferdinand.
9350
9351 2003-01-20  Jim Meyering  <jim@meyering.net>
9352
9353         * tests/date/Test.pm (wide-fmt): New test to demonstrate that
9354         large format widths no longer cause strftime to infloop.
9355
9356         * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
9357
9358 2003-01-19  Jim Meyering  <jim@meyering.net>
9359
9360         * src/readlink.c: Include "canonicalize.h".
9361
9362 2003-01-18  Jim Meyering  <jim@meyering.net>
9363
9364         * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
9365         New member.
9366         (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
9367         (long_options): Add option --dereference-command-line-symlink-to-dir.
9368         (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
9369         rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
9370         -d, -F, -l options is specified.
9371         (decode_switches): Handle --dereference-command-line-symlink-to-dir.
9372         (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
9373         Change --dereference-command-line (-H) to dereference *all*
9374         command line arguments, including broken symlinks.
9375
9376 2003-01-15  Paul Eggert  <eggert@twinsun.com>
9377
9378         Change ls -H back to the way it was yesterday, since this is
9379         compatible with FreeBSD and the POSIX spec is confusing
9380         and somewhat contradictory.
9381
9382         * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
9383         from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
9384         (long_options): Change the long option name back.
9385         (usage): Change the usage back.
9386         (gobble_file): When -H is specified, dereference a top-level
9387         arg even if it points to a non-directory.
9388
9389 2003-01-15  Jim Meyering  <jim@meyering.net>
9390
9391         * src/ls.c (gobble_file): Fall back on using lstat when required:
9392         when --dereference (-L) is not specified, and
9393         - when operating on a dangling symlink
9394         - when operating on command-line-symlink-to-directories
9395         This fixes numerous problems.  Here are examples:
9396         - `ls dangling-symlink' would fail with `no such file...'
9397         Now it prints `dangling-symlink'.
9398         - `ls -i symlink' would mistakenly print the inode of the referent.
9399         Now it prints the inode of the symlink.  Likewise for --size (-s).
9400         Based on a patch from Michael Stone.
9401         Reported by Deepak Goel as Debian bug #173793.
9402
9403         Rename ls's --dereference-command-line (-H)
9404         option to   --dereference-command-line-symlink-to-dir.
9405         * src/ls.c [enum Dereference_symlink]
9406         (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
9407         DEREF_COMMAND_LINE_ARGUMENTS.  Update all uses.
9408         (long_options): Rename the long option.
9409         (usage): Say that --dereference-... changes how ls treats
9410         only symlinks to directories specified on the command line.
9411
9412 2003-01-14  Jim Meyering  <jim@meyering.net>
9413
9414         * tests/ls/dangle: New file/test, for the above fix.
9415         * tests/ls/inode: Another new file/test, for the above fix.
9416         * tests/ls/Makefile.am (TESTS): Add dangle and inode.
9417
9418         * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
9419         so that ls --color would no longer highlight the names of files with
9420         the execute bit set when not specified on the command line.
9421         Patch by Michael Stone.  Reported by Stephen Depooter as
9422         Debian bug 175135.
9423
9424         * tests/ls-2/tests (color-exe): New test, for the above fix.
9425
9426 2003-01-13  Jim Meyering  <jim@meyering.net>
9427
9428         * tests/shred/exact: Also test for just fixed bug with --zero.
9429
9430         * src/shred.c (long_opts): --zero does not require an argument.
9431         Patch by Michael Stone.  Reported by Roland Turner as Debian bug 172019.
9432
9433 2003-01-12  Jim Meyering  <jim@meyering.net>
9434
9435         * Makefile.maint (cvs-update): Skip any file with local modifications.
9436
9437         * src/unexpand.c (usage): Document --first-only and mention that
9438         --tabs=N (-t) enables --all (-a).  Reported by wiregauze@yahoo.com.
9439
9440 2002-12-01  Dmitry V. Levin  <ldv@altlinux.org>
9441
9442         * src/df.c: Include "canonicalize.h".
9443         Use canonicalize_file_name unconditionally.
9444
9445 2003-01-09  Jim Meyering  <jim@meyering.net>
9446
9447         * README: Add readlink.
9448
9449 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9450
9451         * src/df.c: Include "xgetcwd.h".
9452         * src/pwd.c: Likewise.
9453
9454 2002-11-30  Dmitry V. Levin  <ldv@altlinux.org>
9455
9456         * src/shred.c: Remove declaration of xstrdup.
9457         We already get it via xalloc.h which is included via system.h.
9458
9459 2002-08-27  Dmitry V. Levin  <ldv@altlinux.org>
9460
9461         New program: readlink.
9462
9463         * src/Makefile.am (bin_PROGRAMS): Add readlink.
9464         * src/readlink.c: New file.
9465
9466         * man/readlink.x: New file.
9467         * man/Makefile.am (dist_man_MANS): Add readlink.1.
9468         (readlink.1): New rule.
9469
9470 2003-01-09  Jim Meyering  <jim@meyering.net>
9471
9472         When selecting ranges of byte offsets (as opposed to ranges of fields)
9473         and when --output-delimiter=STRING is specified, output STRING between
9474         ranges of selected bytes.
9475         * src/cut.c (RANGE_START_SENTINEL): Define.
9476         (output_delimiter_specified): New global.
9477         (print_kth): Add parameter.  Adjust all callers.
9478         (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
9479         (cut_bytes): When requested, output STRING between ranges of
9480         selected bytes.
9481         (main): Make a diagnostic a little clearer.
9482         Based on a patch from Jan Nieuwenhuizen.
9483
9484         * tests/cut/Test.pm: New tests for the above.
9485
9486         * src/cut.c (set_fields): Make code agree with comment:
9487         Don't merge abutting ranges like 4- and 2-3.  This makes no
9488         difference currently, but is required to support an upcoming change.
9489
9490 2003-01-07  Jim Meyering  <jim@meyering.net>
9491
9492         * src/cut.c (set_fields): Fix typo in comment.
9493
9494         * tests/touch/not-owner: New test, mostly extracted from fail-diag.
9495         * tests/touch/Makefile.am (TESTS): Add not-owner.
9496         * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
9497         Now, this tests only the nonexistent-directory diagnostic.
9498         Suggestion from Michael Stone.
9499
9500         * tests/touch/fail-diag: Fix typo: s/ld/ls/.
9501
9502 2003-01-04  Jim Meyering  <jim@meyering.net>
9503
9504         * src/copy.h: Remove use of PARAMS.
9505         * src/remove.h: Likewise.
9506         * src/chown-core.h: Likewise.
9507
9508         rm could be tricked into mistakenly reporting a cycle.
9509         * src/remove.c: [cycle_check_state]: New global.
9510         (remove_cwd_entries): Adapt to new semantics of cycle_check.
9511         (rm): Call cycle_check_init and cycle_check_free for each file.
9512         * tests/rm/cycle (rm): New test, for the above fix.
9513         * tests/rm/Makefile.am (TESTS): Add cycle.
9514
9515         When rm detects a cycle, don't abort the entire command,
9516         but rather just the affected command line argument.
9517         * src/remove.c: Include <setjmp.h>
9518         (struct dirstack_state) [current_arg_jumpbuf]: New member.
9519         (remove_cwd_entries): Call longjmp if we detect a cycle.
9520         (rm): Call setjmp here.
9521
9522         * src/remove.c (cycle_check, is_power_of_two): Remove functions.
9523         Instead, include cycle-check.h and use it.
9524
9525         * src/remove.h (struct dev_ino): Remove declaration.
9526
9527         * src/remove.c (remove_cwd_entries): Fix typos in comment.
9528
9529         Don't include trailing /. in diagnostics about directories.
9530         * src/remove.c (full_filename_): When FILENAME is just `.'
9531         and there is a nonempty directory-name part, don't append `/.'.
9532         * tests/rm/unread2: Remove trailing /. from diagnostic.
9533         * tests/rm/rm2: Likewise.
9534
9535         * src/remove.c (struct dirstack_state): Define.
9536         To be used in place of these file-scoped globals ...
9537         (dir_stack, len_stack, Active_dir): Remove globals.
9538         (ds_init, ds_free): New functions.
9539         (full_filename): Define.
9540         (full_filename_): Rename from full_filename.
9541
9542         Begin to make AD_* functions more generic.
9543         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9544         (AD_push): Likewise.
9545         (AD_INIT_OTHER_MEMBERS): Define.
9546         (remove_dir): Define the `status' member manually after each
9547         call to AD_push or AD_push_initial.
9548
9549         * src/Makefile.am (check-misc): New rule, to ensure that no more
9550         S_IS* macro definitions sneak into the code.
9551         (check): Depend on check-misc.
9552
9553         * src/remove.c [S_ISLNK]: Don't define.  It's already defined in sys2.h.
9554         * src/du.c (count_entry) [S_ISLNK]: Don't define.
9555         * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
9556
9557 2003-01-03  Jim Meyering  <jim@meyering.net>
9558
9559         * src/true.c: Add copyright.
9560         (AUTHORS): I suppose I've written it.
9561
9562         * src/Makefile.am (false.c): Make the generated file be read-only.
9563
9564 2003-01-04  Jim Meyering  <jim@meyering.net>
9565
9566         * src/ls.c: Include "dev-ino.h".
9567         [struct dev_ino]: Remove declaration.
9568
9569 2003-01-02  Jim Meyering  <jim@meyering.net>
9570
9571         * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
9572         from mv: s/missing file arguments/missing file argument/.
9573         With --target-directory=DIR, cp and mv work with a single file argument.
9574         Reported by Karl Berry.
9575
9576         * tests/rm/isatty: Enable this test.
9577
9578 2002-12-31  Jim Meyering  <jim@meyering.net>
9579
9580         * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9581         (AD_push): Likewise.
9582         (AD_INIT_OTHER_MEMBERS): Define.
9583         (remove_dir): Define the `status' member manually after each
9584         call to AD_push or AD_push_initial.
9585
9586         * src/ls.c [struct dev_ino]: Remove definition.
9587         Include "dev-ino.h" instead.
9588
9589 2002-12-28  Jim Meyering  <jim@meyering.net>
9590
9591         * tests/du/Makefile.am (TESTS): Add no-deref.
9592         * tests/du/no-deref: New script.
9593
9594 2002-12-23  Jim Meyering  <jim@meyering.net>
9595
9596         * src/remove.c (remove_cwd_entries): Fix typo in comment.
9597
9598 2002-12-21  Jim Meyering  <jim@meyering.net>
9599
9600         * announce-gen: Generate MML-formatted announcement.
9601         This makes it a *lot* harder to send stale MD5/SHA1 signatures.
9602
9603 2002-12-20  Jim Meyering  <jim@meyering.net>
9604
9605         * src/touch.c (touch): Change the wording of a diagnostic so
9606         that it makes sense both when the file exists and when it doesn't.
9607         Suggestion from Michael Stone.
9608
9609 2002-12-18  Jim Meyering  <jim@meyering.net>
9610
9611         * src/stty.c (valid_options): Declare to be static.
9612
9613 2002-12-15  Jim Meyering  <jim@meyering.net>
9614
9615         * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9616
9617         * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9618         * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9619         * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9620         * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9621         * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9622
9623         * src/remove.c (PARAMS): Remove definition.
9624         * src/sys2.h: Likewise.
9625
9626         * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9627         Include strftime.h instead.
9628
9629 2002-12-14  Jim Meyering  <jim@meyering.net>
9630
9631         * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9632
9633         * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9634         This is necessary at least for Irix6.5 when using c89.
9635         Reported by Nelson Beebe.
9636
9637         * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9638
9639         * tests/misc/cat-tty-eof: New test.
9640
9641         * src/mknod.c (usage): Specify how major and minor mode numbers
9642         are interpreted.  Report forwarded by Kristin E Thomas.
9643         * src/mknod.c: Remove now-redundant usage-specifying comment.
9644
9645 2002-12-13  Jim Meyering  <jim@meyering.net>
9646
9647         * Version 4.5.4.
9648
9649         * tests/du/trailing-slash: Allow for a directory of size `0'.
9650         That happens at least on file systems of type tmpfs on linux-2.4.18.
9651
9652         * announce-gen: New script to begin replacing the commands
9653         associated with the rule here...
9654         * Makefile.maint (announcement): Invoke announce-gen.
9655         * Makefile.am (EXTRA_DIST): Add announce-gen.
9656
9657         * tests/cp/preserve-2: New file/test, for latest fix.
9658         * tests/cp/Makefile.am (TESTS): Add preserve-2.
9659
9660 2002-12-11  TAKAI Kousuke  <takai@vlsi.kuee.kyoto-u.ac.jp>
9661
9662         Fix a bug whereby cp would fail to parse an option like
9663         --preserve=mode,ownership.
9664         * src/cp.c (decode_preserve_arg): Advance `comma' to
9665         point the character following the comma.
9666
9667 2002-12-11  Jim Meyering  <jim@meyering.net>
9668
9669         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9670         in case it's already defined.
9671
9672 2002-12-09  Jim Meyering  <jim@meyering.net>
9673
9674         * tests/touch/fail-diag: Don't get a test failure if /no exists.
9675         Instead, evoke a framework failure if /no-$$ exists.
9676         Reported by Michael Stone.
9677
9678 2002-12-08  Jim Meyering  <jim@meyering.net>
9679
9680         * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9681         Define to rpl_lstat, so that even on systems like Solaris 5.8,
9682         du honors (per POSIX) the trailing slash on an argument referring
9683         to a symlink-to-directory.
9684
9685 2002-12-06  Jim Meyering  <jim@meyering.net>
9686
9687         * Use autoconf-2.57.  Regenerate dependent files.
9688         * Use automake-1.7.2.  Regenerate dependent files.
9689
9690         * src/ls.c (gobble_file): Also stat the file if it's a
9691         regular file and --indicator-style=classify (aka -F).
9692         Thanks to Ed Santiago for opening my eyes.
9693
9694         * tests/ls/file-type: New file.  Test for the above.
9695         A test to contrast ls -F and ls --indicator-style=file-type.
9696         * tests/ls/Makefile.am (TESTS): Add file-type.
9697
9698 2002-12-04  Jim Meyering  <jim@meyering.net>
9699
9700         * tests/ls/follow-slink: Make sure the symlink was created.
9701         Richard Dawe reported that `ln -s link link' succeeds, but creates
9702         no file on systems running some version of the DJGPP libc.
9703
9704 2002-12-03  Jim Meyering  <jim@meyering.net>
9705
9706         * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9707         since this package no longer panders to K&R compilers.
9708
9709 2002-12-02  Jim Meyering  <jim@meyering.net>
9710
9711         * tests/du/slink: Skip this test if `.' is on a non-local file system.
9712
9713         * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9714         something to replace.
9715
9716 2002-12-01  Jim Meyering  <jim@meyering.net>
9717
9718         * src/stat.c: Don't include <string.h> or <ctype.h>.
9719         That's already done via system.h.
9720         * src/dircolors.c: Don't include <ctype.h>.
9721
9722 2002-11-30  Jim Meyering  <jim@meyering.net>
9723
9724         * ls.c (gobble_file): Remove the block of code that caused
9725         `ls --color -F symlink-to-dir' to list the files in
9726         `symlink-to-dir/.'.  Now, it prints `symlink-to-dir@', (just
9727         like `ls -F symlink-to-dir') but with the addition of highlighting.
9728         Similarly, `ls --color -dF symlink-to-dir' would print
9729         `symlink-to-dir/';  now it prints `symlink-to-dir@'.
9730         Reported by Jeff Sheinberg as Debian bug #168203.
9731         * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9732
9733         ls is now more efficient: with certain options, it no longer needs
9734         to stat each directory entry on systems with valid dirent.d_type.
9735         * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9736         (main): Make --recursive set format_needs_type, not format_needs_stat.
9737         (gobble_file): Remove a FIXME comment, now that it's fixed.
9738
9739 2002-11-24  Jim Meyering  <jim@meyering.net>
9740
9741         * src/du.c (du_files): Don't strip any trailing slash.
9742         Rewrite so that `/' is no longer represented internally as
9743         the empty string.
9744         (count_entry): When appending a file name component,
9745         account for the fact that the current path may end in `/'.
9746         François Pinard reported that `du symlink-to-dir/' was not
9747         equivalent to `du symlink-to-dir/.'.  Now it is.
9748         * tests/du/trailing-slash: New file/test, for the above fix.
9749         * tests/du/Makefile.am (TESTS): Add trailing-slash.
9750
9751 2002-11-23  Jim Meyering  <jim@meyering.net>
9752
9753         * src/tac.c (output): Declare some local variables to be of type size_t,
9754         rather than `int' to avoid warnings from gcc.
9755
9756 2002-11-21  Paul Eggert  <eggert@twinsun.com>
9757
9758         * src/ls.c (decode_switches): Use case-sensitive matching to
9759         decode the QUOTING_STYLE environment variable.  This is more
9760         consistent with the documentation, and with --quoting-style.
9761
9762 2002-11-21  Martin Buck  <martin.buck@ascom.ch
9763
9764         * src/stty.c (struct speeds): Add support for all baud rates defined
9765         in linux-2.4.19.
9766
9767 2002-11-19  Jim Meyering  <jim@meyering.net>
9768
9769         * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9770         run in a UTF locale.  Report and suggested fix by Bruno Haible.
9771         * tests/fmt/basic: Likewise.
9772
9773 2002-11-17  Jim Meyering  <jim@meyering.net>
9774
9775         * configure.ac: Update via autoupdate.
9776         Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9777
9778         * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9779         Reported by Hans Ginzel.
9780
9781 2002-11-15  Jim Meyering  <jim@meyering.net>
9782
9783         * Makefile.cfg (gnu_rel_host): Define.
9784         (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9785         on whether $(VERSION) looks like a major release number.
9786
9787         * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9788         (release): Rename from `alpha'.
9789         (alpha): Depend on release.
9790
9791         * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9792
9793 2002-11-14  Jim Meyering  <jim@meyering.net>
9794
9795         * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9796         (announcement): Use the new variable.
9797
9798         * Makefile.maint: Sync with Bison, i.e.:
9799         (po-check): Scan .l and .y files instead of the
9800         .c and the .h files that they generate.  This fixes the bug
9801         reported by Tim Van Holder in:
9802         <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9803         Look for N_ as well as for _.  Try to avoid matching #define for
9804         N_ and _.
9805         From Paul Eggert.
9806
9807 2002-11-12  Jim Meyering  <jim@meyering.net>
9808
9809         * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9810         Replace sole use with equivalent `#ifdef S_ISLNK'.
9811         Inconsistency reported by Dmitry V. Levin.
9812
9813 2002-11-11  Jim Meyering  <jim@meyering.net>
9814
9815         * src/stat.c (usage): Transform --help items output via s/ - /   /,
9816         so that help2man produces properly formatted man pages.
9817         Reported by Herbert Xu as Debian bug #168400.
9818
9819 2002-11-10  Jim Meyering  <jim@meyering.net>
9820
9821         * src/ls.c (sighandler): Handle SIGTSTP specially.
9822         Based on suggestions from Solar Designer and Dmitry V. Levin.
9823         Add comments.
9824
9825         * Makefile.cfg (cvs_files): Define.  From autoconf.
9826         (local_updates): Likewise.
9827
9828         * src/ls.c (restore_default_color_handler, sigtstp_handler):
9829         Remove functions.
9830         (sighandler): New function, based on the one in sort.c.
9831         (main): Use sigaction, if possible; otherwise signal.
9832         Handle these signals:
9833         SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9834         Don't register our handler if the signal is already being ignored.
9835
9836         * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9837         * src/csplit.c (interrupt_handler): Likewise.
9838         * src/sort.c (sighandler): Likewise.
9839         (main): Declare `i' and `nsigs' to be unsigned, not int.
9840
9841 2002-11-09  Jim Meyering  <jim@meyering.net>
9842
9843         ls --color: restore terminal text color upon signal.
9844         * src/ls.c: Include "full-write.h" and <signal.h>.
9845         (restore_default_color, restore_default_color_handler): New functions.
9846         (sigtstp_handler, put_indicator_direct): New functions.
9847         (main) [print_with_color]: Register signal handlers.
9848         Patch mostly by Solar Designer and Stanislav Ievlev.
9849
9850         Update from autoconf.
9851         * Makefile.maint (AMTAR): Remove definition.
9852         (update, cvs-update, po-update, do-po-update): New rules.
9853         (wget-update): Update (thus renaming to cvs-update).
9854         (automake_repo): Use anoncvs@sources.redhat.com.
9855
9856 2002-11-06  Jim Meyering  <jim@meyering.net>
9857
9858         * tests/misc/Makefile.am (TESTS): Add printf-hex.
9859
9860         * tests/misc/printf: Be careful to test the code in this package,
9861         not the shell built-in function.
9862
9863         * src/printf.c (print_esc): A hexadecimal escape sequence has
9864         at most two hex. digits, not three.  Reported by Padraig Brady.
9865         (usage): Update description.
9866         * tests/misc/printf-hex: New file/test, for the above fix.
9867
9868 2002-10-07  Paul Eggert  <eggert@twinsun.com>
9869
9870         Add support for locale-specific size indications (e.g.,
9871         thousands-separators) and for explicit size suffixes on output.
9872
9873         * doc/coreutils.texi (Block size): Say that:
9874         This affects display format as well as block size.
9875         Fractional block counts are rounded up.
9876         ls file size blocksize defaults to 1.
9877         A block size spec preceded by ' generates thousands separators.
9878         A suffix without a preceding integer generates suffixes.
9879         (tail invocation): 32k -> 32 KiB.
9880         (What information is listed): ls -h is now equivalent to
9881         ls --block-size=human, and ls -H is now equivalent to
9882         ls --block-size=si.  Displayed file size is now always affected by
9883         --block-size.
9884
9885         * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9886         lib/umaxtostr.c: New files, taken from GNU tar.
9887
9888         * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9889         umaxtostr.c.
9890         (EXTRA_DIST): Add inttostr.c.
9891
9892         * lib/human.c, lib/human.h: Rewrite to support locale-specific
9893         notations like thousands separators.
9894         Specify what includer of include.h must include beforehand.
9895         (human_group_digits, human_suppress_point_zero, human_autoscale,
9896         human_base_1024, human_SI, human_B): New enum values.
9897         (human_readable): Rename from human_readable_inexact; put the
9898         options before the sizes.  All uses changed.  The old human_readable
9899         function has been removed; use inttostr.h instead.
9900         (human_options): Renamed from human_block_size, with new signature
9901         that allows block sizes up to UINTMAX_MAX.  All callers changed.
9902
9903         * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9904         AC_HEADER_STDBOOL.  No need to check for limits.h since it's in
9905         freestanding C89.  No need to check for stdlib.h or string.h since
9906         autoconf does this now.
9907
9908         * src/cksum.c (cksum): Use primitives from inttostr.h, not
9909         human.h, to print large numbers simply.
9910         * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9911         * src/dd.c (print_stats, main): Likewise.
9912         * src/df.c (print_header): Likewise.
9913         * src/factor.c (print_factors): Likewise.
9914         * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9915         * src/shred.c (dopass): Likewise.
9916         * src/sort.c (checkfp): Likewise.
9917         * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9918         * src/tail.c (xlseek): Likewise.
9919         * src/wc.c (write_counts, wc): Likewise.
9920
9921         * src/df.c (human_output_opts): New var.
9922         (output_block_size): Now uintmax_t, not int, to handle larger
9923         block sizes.  All uses changed.
9924         * src/du.c: Likewise.
9925         * src/ls.c: Likewise.
9926
9927         * src/df.c (print_header): In the header line, prefer SI to human
9928         representation if it's shorter; if neither is shorter, try to
9929         intuit what the user would prefer.
9930
9931         * src/expr.c (inttostr): Remove; use new imaxtostr library
9932         function instead.
9933
9934         * src/ls.c (file_output_block_size): New var, to distinguish
9935         file sizes from other sizes.
9936         (decode_switches): Set it.
9937
9938         * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9939         (dopass): When printing progress, use floor for what has been done
9940         so far (since we should be conservative there), and ceiling for
9941         what needs to be done (since that's what other programs use).
9942
9943 2002-10-19  Jim Meyering  <jim@meyering.net>
9944
9945         * src/pinky.c (print_heading): Align TTY and Name headings.
9946         Reported by Karl Eichwalder.
9947
9948 2002-10-18  Jim Meyering  <jim@meyering.net>
9949
9950         * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9951         Remove now-useless cast.
9952         (stdread): Remove function.
9953         (bytes_split): Use size_t instead of int.
9954         Use safe_read, not stdread.
9955         (lines_split): Likewise.
9956         Use memchr rather than a `while' loop.
9957         (line_bytes_split): Use size_t instead of int.
9958         Use safe_read, not stdread.
9959         (main): Add some FIXME comments to remind me to remove casts.
9960
9961         * src/system.h (ST_BLKSIZE): Correct comment describing how to
9962         reproduce HPUX-11 cat failure.  From Petter Reinholdtsen.
9963
9964 2002-10-17  Jim Meyering  <jim@meyering.net>
9965
9966         Fix a problem that could make e.g., `cat' misbehave on systems which
9967         give invalid (unreasonably large) values for stat.st_blksize.
9968         * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9969         Reported by Petter Reinholdtsen.
9970
9971 2002-10-14  Jim Meyering  <jim@meyering.net>
9972
9973         Specifying a printf conversion specifer as nl's separator string
9974         could cause nl to segfault.
9975         * src/nl.c (build_print_fmt): Don't include separator string
9976         in the printf format; it might contain `%'.
9977         Use a better bound on the length of the print_fmt buffer.
9978         (print_lineno): Print the separator here instead.
9979         Reported by Doug Coleman.
9980
9981         * tests/misc/nl: New file/tests, including a test for the above.
9982         * tests/misc/Makefile.am (TESTS): Add nl.
9983
9984         * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9985         * tests/misc/Makefile.am (TESTS): Add split-l.
9986
9987 2002-10-13  Jim Meyering  <jim@meyering.net>
9988
9989         * Version 4.5.3.
9990
9991         * src/du.c (usage): Tweak description of --dereference-args/-D.
9992
9993         * src/du.c (count_entry): Also save cwd when dereferencing (via
9994         --dereference-args, -D) a command-line argument.
9995         Reported by Michal Svec.  Based on a patch by Andreas Schwab.
9996
9997         * src/Makefile.am (../AUTHORS): New target/rule.
9998
9999 2002-10-12  Jim Meyering  <jim@meyering.net>
10000
10001         * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
10002         of type size_t, since that's the way it's used and avoids a warning.
10003
10004         * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
10005         since that's how it's always used and avoids a new warning from gcc.
10006         (read_input): Adapt to new safe_read ABI.
10007
10008         * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
10009         to avoid warnings.
10010
10011         * src/pinky.c (print_long_entry): fread returns size_t.
10012         Declare local `bytes' accordingly, to avoid warning.
10013
10014         tail -c +N would perform an extra read after encountering EOF
10015         [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
10016         * src/tail.c (start_bytes): Detect EOF, inform caller.
10017         (tail_bytes): Upon EOF in start_bytes, return immediately.
10018         (file_lines): Reorganize to use memrchr rather than an explicit loop.
10019         Adapt to new safe_read ABI.
10020
10021 2002-10-11  Jim Meyering  <jim@meyering.net>
10022
10023         * tests/du/deref: New file/test, for the above fix.
10024         * tests/du/Makefile.am (TESTS): Add deref.
10025
10026 2002-10-10  Jim Meyering  <jim@meyering.net>
10027
10028         * tests/ln/Makefile.am (TESTS): Add target-1.
10029         * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
10030
10031 2002-10-09  Jim Meyering  <jim@meyering.net>
10032
10033         * tests/cp/backup-is-src: Ensure that certain environment variables
10034         are not set (e.g., SIMPLE_BACKUP_SUFFIX).  Reported by Duncan Roe.
10035
10036         * tests/tail-2/big-4gb: Mark this as an expensive test; it would
10037         consume 4GB of disk space on systems without support for sparse files.
10038         Fix a logic error that'd make it `cat err' even though dd didn't fail.
10039
10040         * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
10041         Patch by steven@magelico.net, forwarded by Michael Stone.
10042
10043         * tests/ls/dired: Ensure that ls produces English messages.
10044         Patch by Alexey Vyskubov, forwarded by Michael Stone.
10045
10046 2002-10-08  Dmitry V. Levin  <ldv@altlinux.org>
10047
10048         * src/ln.c (main): Fix target_directory parsing when n_files == 1.
10049
10050 2002-10-08  Jim Meyering  <jim@meyering.net>
10051
10052         * tests/tail-2/big-4gb: Use double quotes around diagnostic.
10053         Fix syntax in test: use =, not ==.
10054         Reported by Bob Proulx.
10055         Change all the rest like this: grep -lR "testing framework'" .\
10056         |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
10057
10058         * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
10059         * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
10060         * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
10061         * src/wc.c (wc): Likewise.
10062
10063 2002-10-07  Paul Eggert  <eggert@twinsun.com>
10064
10065         * src/cat.c (cat):
10066         Don't advance the write pointer past the end of the write buffer.
10067         * src/sort.c (begfield, limfield): Likewise.
10068
10069 2002-10-07  Jim Meyering  <jim@meyering.net>
10070
10071         * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
10072         * src/head.c (head_bytes, head_lines): Likewise.
10073
10074 2002-10-06  Jim Meyering  <jim@meyering.net>
10075
10076         * src/dd.c (scanargs): Ensure that specified block sizes (specified
10077         via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
10078         (skip, dd_copy): Adapt to new safe_read ABI.
10079
10080         * Makefile.maint (signatures): Define.
10081         (%.sig): New rule.
10082         (announcement): Depend on $(signatures).
10083
10084         * Makefile.maint (announcement): Output all URLs for detached
10085         signatures, not just the last one from the previous loop.
10086
10087 2002-10-05  Jim Meyering  <jim@meyering.net>
10088
10089         * Version 4.5.2.
10090
10091         * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
10092         don't recurse into directory, DIR.  Prompted by a report from
10093         Leonardo Milano.
10094
10095         * tests/rm/i-no-r: New file/test, for the above fix.
10096         * tests/rm/Makefile.am (TESTS): Add i-no-r.
10097
10098         * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
10099         * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
10100
10101 2002-10-03  Jim Meyering  <jim@meyering.net>
10102
10103         * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
10104         * src/df.c (AUTHORS): Likewise.
10105         * src/du.c (AUTHORS): Likewise.
10106         * src/tail.c (AUTHORS): Likewise.
10107         * src/touch.c (AUTHORS): Likewise.
10108
10109 2002-10-02  Jim Meyering  <jim@meyering.net>
10110
10111         * Makefile.am (SUBDIRS): Remove `old'.
10112         (EXTRA_DIST): List the files in old/.
10113         * configure.ac (AC_CONFIG_FILES): Remove old/* names.
10114         Suggestion from Akim Demaille.
10115
10116 2002-10-01  Jim Meyering  <jim@meyering.net>
10117
10118         * src/sys2.h (SSIZE_MAX): Define.
10119
10120 2002-09-30  Jim Meyering  <jim@meyering.net>
10121
10122         * src/csplit.c: Don't include stdlib.h here.  It's already included
10123         via system.h.
10124
10125 2002-09-29  Jim Meyering  <jim@meyering.net>
10126
10127         * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
10128         expression to avoid bogus warning from gcc.
10129
10130         * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
10131         (cat): Declare insize and outsize to be of type size_t, not int.
10132         Rearrange pointer/integer expressions to avoid bogus warnings.
10133         (main): Declare insize and outsize to be of type size_t, not int.
10134
10135         * src/tail.c (parse_options): Give a sensible diagnostic for
10136         an invalid byte or line count.  Reported by Mikko Tuumanen.
10137
10138         * src/touch.c (main): Split a long line.
10139
10140         * tests/du/Makefile.am (TESTS): Add slink.
10141         * tests/du/slink: New test for system.h change of 2002-08-31.
10142
10143         In move mode, always first try to rename.  Before, upon failure to
10144         rename a directory, this code would never attempt to rename any
10145         other file in that directory, but would thenceforth always copy.
10146         On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
10147         may fail with EXDEV, yet renaming files within that directory to
10148         a newly-created destination directory succeeds.
10149         * src/copy.c (copy_internal): Remove local, move_mode;
10150         use x->move_mode instead.  Based on a patch from Tom Haynes.
10151
10152 2002-09-28  Jim Meyering  <jim@meyering.net>
10153
10154         * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
10155         Factor out some duplication.
10156         (main): Use it.
10157         [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
10158
10159         * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
10160         compiler warnings.
10161         (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
10162         to avoid compiler warnings.
10163
10164         * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
10165         compiler warnings.
10166
10167         Fix things so `mkdir -p' can create very deep directories, e.g.,
10168         mkdir -p $(perl -e 'print "a/" x 40000') now works.
10169         * src/mkdir.c (main): For --parents (-p), call make_path with the
10170         entire directory name, so we don't ever require that file operations
10171         like stat or chmod be performed on the entire command line argument.
10172         * makepath.c (make_path): Restore umask *before* creating the final
10173         component.
10174
10175 2002-09-27  Andreas Schwab  <schwab@suse.de>
10176
10177         * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
10178         to avoid overflow.  Reported by Hans Lermen.
10179
10180 2002-09-26  Jim Meyering  <jim@meyering.net>
10181
10182         * src/install.c (get_ids): Use strtoul, not strtol.  Remove some casts.
10183
10184 2002-09-25  Jim Meyering  <jim@meyering.net>
10185
10186         * src/test.c (eaccess): Change type of local `euid' from int to uid_t
10187         and add a cast, to avoid a warning about `signed and unsigned type in
10188         conditional expression'.
10189
10190 2002-09-22  Jim Meyering  <jim@meyering.net>
10191
10192         * src/rmdir.c: Include "dirname.h", for declaration of
10193         strip_trailing_slashes.
10194
10195         * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
10196         Now they're defined through system.h.
10197
10198         * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
10199         * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
10200         since it's already included from sys2.h via system.h.
10201
10202         * Use automake-1.6f.  Regenerate dependent files.
10203
10204         * src/Makefile.am (PERL): Remove duplicate definition.
10205
10206         fmt's -s, -t, -c options didn't work properly for long lines.
10207         Since get_line may end up calling put_paragraph (for long lines),
10208         be sure to set global, `other_indent', before it is used there.
10209
10210         * src/fmt.c (set_other_indent): New function, factored out of...
10211         (get_paragraph): ... here.  Call it.
10212         (get_line): Call set_other_indent before calling flush_paragraph,
10213         which calls fmt_paragraph, which in turn calls put_paragraph,
10214         which uses other_indent.
10215
10216         * tests/fmt/Makefile.am (TESTS): Add long-line.
10217         * tests/fmt/long-line: New file/test, for the above fix.
10218
10219 2002-09-21  Jim Meyering  <jim@meyering.net>
10220
10221         * src/od.c: No longer include deprecated <values.h>.
10222         It was required solely for now-removed reference to BITSPERBYTE.
10223         * src/install.c: Likewise.
10224         Suggestion from Bruno Haible.
10225
10226 2002-09-06  Andreas Schwab  <schwab@suse.de>
10227
10228         `rmdir -p dir-specified-with-trailing-slash/' would fail.
10229         * src/rmdir.c (remove_parents): Strip trailing slashes.
10230
10231 2002-09-20  Jim Meyering  <jim@meyering.net>
10232
10233         * tests/rmdir/t-slash: New file/test, for the above fix.
10234         * tests/rmdir/Makefile.am (TESTS): Add t-slash.
10235
10236         * Makefile.maint (announcement): Arrange to gpg-sign the message.
10237         Add a URL for each detached signature file.
10238
10239 2002-09-07  Bruno Haible  <bruno@clisp.org>
10240
10241         * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
10242
10243 2002-09-18  Jim Meyering  <jim@meyering.net>
10244
10245         `od -t x8' used the wrong (`l'-prefixed) printf format.
10246         Likewise for the o8 and u8 formats.
10247         * src/od.c (ISPEC_TO_FORMAT): Define macro.
10248         (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
10249         Reported by Arun Sharma.
10250
10251 2002-09-17  Jim Meyering  <jim@meyering.net>
10252
10253         * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
10254         From gettext's intl/loadmsgcat.c.
10255
10256         * tests/od/x8: New file/test, for the above fix.
10257         * tests/od/Makefile.am (TESTS): Add x8.
10258
10259 2002-09-15  Jim Meyering  <jim@meyering.net>
10260
10261         * Use autoconf-2.54.  Regenerate dependent files.
10262
10263         * src/csplit.c (get_format_width): Add cast to avoid
10264         warning about `signed and unsigned type in conditional expression'.
10265
10266 2002-09-14  Jim Meyering  <jim@meyering.net>
10267
10268         * src/who.c (print_user): Change type of local to size_t
10269         to avoid warnings about `comparison between signed and unsigned'.
10270         * src/ptx.c (generate_all_output): Likewise.
10271
10272         * src/dd.c (main, skip): Add casts to avoid warnings about
10273         `comparison between signed and unsigned'.
10274
10275         * src/id.c (print_full_info, print_group_list): Add casts to avoid
10276         warnings about `signed and unsigned type in conditional expression'.
10277
10278         * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
10279         to avoid warnings about `comparison between signed and unsigned'.
10280         (split_3): Change parameter names to be readable and add comment.
10281         Clean up the test for whether a line may be ignored.
10282
10283 2002-09-13  Jim Meyering  <jim@meyering.net>
10284
10285         * src/printf.c (main): Handle leading command line argument of `--'.
10286         Reported by Raul: DervishD <raul@pleyades.net>
10287         * tests/misc/printf: New file: test for the above.
10288         * tests/misc/Makefile.am (TESTS): Add printf.
10289
10290         * src/date.c (usage): Explain that %S's range of [0..60] is required --
10291         rather than 0..59 -- to accommodate the occasional positive leap second.
10292         Reported by Richard Neill.
10293
10294 2002-09-12  Jim Meyering  <jim@meyering.net>
10295
10296         * src/Makefile.am (nanosec_libs): Define.
10297         (sleep_LDADD, tail_LDADD): Use it here.
10298
10299         Factor nanosleep-related code into ../lib/xnanosleep.c.
10300         * src/sleep.c: Include xnanosleep.h.
10301         Factor out fenv.h-related code.
10302         (timespec_subtract): Remove function.
10303         (main): Remove code that deals with computing start and stop times
10304         as well as the loop around nanosleep.  Now that's in xnanosleep.c.
10305
10306         Allow S (in --sleep-interval=S) to be a floating point value.
10307         * src/tail.c: Include xnanosleep.h and xstrtod.h.
10308         Move declaration of global variable, sleep_interval, to ...
10309         (main): ...here.
10310         (usage): Update description of --sleep-interval option.
10311         (tail_forever): New parameter, sleep_interval.  Update caller.
10312         Use xnanosleep, rather than sleep.
10313         (parse_options): New parameter, sleep_interval.  Update caller.
10314         Use xstrtod, now that we accept floating point values.
10315         Prompted by a patch from Augey Mikus.
10316
10317 2002-09-06  Jim Meyering  <jim@meyering.net>
10318
10319         * src/remove.c (prompt): Change comment to give a better note to
10320         translators.  From Michael Piefel.
10321
10322 2002-09-02  Jim Meyering  <jim@meyering.net>
10323
10324         * README: A good problem report/patch includes diffs against
10325         the most recent test release.
10326
10327         * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
10328         (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
10329
10330         * src/kill.c (print_table_row): Use an unsigned type for widths
10331         to avoid warning about comparison between signed and unsigned.
10332         (list_signals): Likewise.
10333
10334         * src/od.c (skip): Add a cast to avoid warning about comparison
10335         between signed and unsigned.
10336         * src/install.c (get_ids): Likewise.  Also rearrange range-checking
10337         comparisons to make them more readable.
10338
10339 2002-09-01  Jim Meyering  <jim@meyering.net>
10340
10341         * Version 4.5.1.
10342
10343 2002-08-31  Jim Meyering  <jim@meyering.net>
10344
10345         Symlinks were always reported as using 0 blocks.
10346         * src/system.h (ST_NBLOCKS): Don't depend on file type.
10347         This reverts the change of 2000-01-30.
10348         Based on a report and patch from Neil Brown via Michael Stone.
10349         This fixes Debian Bug#156358.
10350
10351         * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
10352         `exit (1)' to `exit (EXIT_FAILURE)', and
10353         `usage (1)' to `usage (EXIT_FAILURE)'.
10354
10355         * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
10356         * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
10357         * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
10358         * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
10359         * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
10360         But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
10361         error never exits successfully.
10362
10363 2002-08-29  Jim Meyering  <jim@meyering.net>
10364
10365         * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
10366         when ignoring any return value.
10367
10368         * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
10369         failures.  On some systems (at least EMC Celerra and Solaris5.8),
10370         this appears to be necessary.
10371         (is_empty_dir): Likewise.  Also, always close directory handle.
10372         * src/ls.c (print_dir): Likewise.
10373         (print_dir): Rename local variable: reading -> dirp.
10374         Reported by Mike Coleman.
10375
10376 2002-08-28  Jim Meyering  <jim@meyering.net>
10377
10378         * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
10379         Give a diagnostic and fail if closedir fails.
10380
10381 2002-08-26  Jim Meyering  <jim@meyering.net>
10382
10383         * Makefile.am (THANKS-to-translators): New rule.
10384         (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
10385         * THANKStt.in: New file.
10386
10387         * src/cat.c (close_stdout_wrapper): New, kludgey, function and
10388         file-scoped global.
10389         (main): Register it with atexit.
10390         Close STDOUT_FILENO, to avoid a problem when writing to
10391         /dev/audio on at least Solaris 5.7 and 5.8 systems.
10392         Reported by Shing-Shong Shei.
10393
10394 2002-08-25  Jim Meyering  <jim@meyering.net>
10395
10396         * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
10397         * src/tac.c (main): Likewise.
10398         * src/tail.c (main): Likewise.
10399         * src/tee.c (main): Likewise.
10400         * src/tr.c (main): Likewise.
10401         * src/wc.c (main): Likewise.
10402
10403 2002-08-20  Jim Meyering  <jim@meyering.net>
10404
10405         * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
10406
10407 2002-08-10  Paul Eggert  <eggert@twinsun.com>
10408
10409         * src/nohup.sh: Don't use "exec --"; it's not portable and
10410         shouldn't be needed.
10411
10412 2002-08-09  Jim Meyering  <jim@meyering.net>
10413
10414         * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
10415         (usage): Clarify help text for the -COLUMN option.
10416         Patch by Padraig Brady.
10417         * tests/pr/Test.pm [col-last]: New test for the above.
10418
10419         * configure.ac: Start with version 4.5.1, chosen so that it's larger
10420         than the latest version numbers of the component packages.
10421
10422         * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
10423         programs in ../src.
10424
10425 2002-08-08  Jim Meyering  <jim@meyering.net>
10426
10427         * src/date.c: Guard inclusion of <langinfo.h> with
10428         `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
10429         * src/sort.c: Likewise.
10430         Patch by GOTO Masanori.
10431
10432 2002-08-05  Paul Eggert  <eggert@twinsun.com>
10433
10434         Fix some minor time-related bugs with POSIX time arguments.
10435         Some valid time stamps were being rejected (notably -1, and
10436         time stamps before 1900 on 64-bit hosts).  And some invalid
10437         time stamps were being accepted, e.g. September 31.
10438
10439         * src/date.c (main): Adjust to posixtime signature change.
10440         * src/touch.c (main): Likewise.  Remove unnecessary initialization.
10441         Use localtime, not posixtm, to warn about obsolete "touch".
10442
10443 2002-08-05  Jim Meyering  <jim@meyering.net>
10444
10445         * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
10446
10447 2002-08-04  Jim Meyering  <jim@meyering.net>
10448
10449         * src/Makefile.am (check-README): New target/rule.
10450         (check): Depend on it.
10451
10452         * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
10453
10454 2002-08-03  Jim Meyering  <jim@meyering.net>
10455
10456         * Makefile.am (SUBDIRS): Add old.
10457         * old/: New directory, containing legacy ChangeLog* and NEWS files
10458         from the fileutils, sh-utils, and textutils packages.
10459
10460         * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
10461
10462 2002-08-02  Paul Eggert  <eggert@twinsun.com>
10463
10464         * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
10465
10466         * src/uniq.c: Include hard-locale.h, xmemcoll.h.
10467         (hard_LC_COLLATE): New var.
10468         (different): Args are now char *, not const char *.
10469         Use xmemcoll instead of memcmp to compare lines, so that
10470         LC_COLLATE has effect.  However, use memcmp if it is an
10471         easy locale.
10472         (check_file): Do not include newline in comparison, so that
10473         xmemcoll has a byte to stomp on temporarily.
10474         (main): Set hard_LC_COLLATE.
10475
10476 2002-07-29  Jim Meyering  <jim@meyering.net>
10477
10478         * Makefile.am (SUBDIRS): Remove djgpp, for now.
10479
10480 2002-07-20  Jim Meyering  <jim@meyering.net>
10481
10482         * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
10483         into EXIT_FAILURE.  Otherwise, false --help and false --version
10484         would fail.
10485
10486 2002-07-08  Jim Meyering  <jim@meyering.net>
10487
10488         * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
10489         rather than the hard-coded `sh-utils'.
10490
10491 2002-07-01  Jim Meyering  <jim@meyering.net>
10492
10493         * configure.ac: Merge the three files from fileutils,
10494         textutils, and sh-utils.
10495         * Makefile.am: Likewise.
10496         * src/Makefile.am: Likewise.