1 2005-05-14 Jim Meyering <jim@meyering.net>
5 Update FSF postal mail address.
6 * Makefile.maint, Makefile.cfg, gnupload
7 * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
8 * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
9 * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
10 * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
11 * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
12 * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
13 * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
14 * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
15 * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
16 * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
17 * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
18 * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
19 * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
20 * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
21 * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
22 * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
23 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
24 * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
25 * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
26 * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
27 * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
28 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
30 2005-05-13 Jim Meyering <jim@meyering.net>
32 * NEWS: `rm -r' now removes all of the files it should, even on
33 systems with a buggy readdir affecting file systems inaccessible
36 In some unusual circumstances `rm -r' would fail to remove --
37 or even consider -- all entries in a directory with more than 254
38 (SunOS) or 338 (Darwin) entries. This could cause trouble even on
39 other types of systems when using an affected file system via e.g.,
40 NFS. The underlying cause was a bug in readdir on those systems.
41 Coreutils-5.2.1 and earlier used a configure-time test designed
42 to detect precisely those problem systems, but it would detect
43 the problem and enable remove.c's work-around code only when its
44 configure-time test was run on a losing file system. Obviously,
45 it couldn't detect a problem if the offending file system wasn't
46 tested or even mounted at coreutils configure time. Now, rm itself
47 performs a minimal-cost run-time test to detect the problem.
49 * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
50 (remove_cwd_entries): When readdir returns NULL for a directory from
51 which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
52 entries, call rewinddir and then resume the readdir/unlink loop.
53 (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
55 2005-05-12 Paul Eggert <eggert@cs.ucla.edu>
57 * NEWS: nohup now closes stdin if it is a terminal, unless
58 POSIXLY_CORRECT is set. This fixes a glitch noted by Wayne Pollock in
59 <https://www.opengroup.org/sophocles/show_mail.tpl?
60 source=L&listname=austin-group-l&id=8341>.
61 * doc/coreutils.texi (nohup invocation): Document this.
62 * src/nohup.c (main): Implement this.
64 2005-05-12 Jim Meyering <jim@meyering.net>
66 * src/date.c: Assume `free (NULL)' works.
69 * src/dircolors.c:Likewise.
70 * src/head.c: Likewise.
72 * src/md5sum.c: Likewise.
74 * src/sort.c: Likewise.
76 2005-05-10 Jim Meyering <jim@meyering.net>
78 * tests/touch/not-owner: Skip this test if the user running it
79 owns `/' or has write access to it.
81 * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
82 This makes `mv -i --reply=no f1 f2' work as expected (in not
83 performing the move operation). But note that specifying `-i'
84 after `--reply=no' does *not* work.
85 Tiny patch from Vlada Macek.
87 * tests/mv/reply-no: New file. Test for the above fix.
88 * tests/mv/Makefile.am (TESTS): Add reply-no.
90 * tests/ls-2/tests: Don't print PATH to stderr.
92 2005-05-08 Paul Eggert <eggert@cs.ucla.edu>
94 * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
97 2005-05-06 Paul Eggert <eggert@cs.ucla.edu>
99 * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
100 * src/dd.c (flags, usage): Add support for "binary" and "text".
102 2005-05-04 Paul Eggert <eggert@cs.ucla.edu>
104 * NEWS: chmod -w now complains if it differs from chmod a-w.
105 * src/chmod.c: Include quotearg.h.
106 (diagnose_surprises): New var.
107 (process_file): Diagnose surprises. Simplify the logic a bit,
109 (main): Prepare to diagnose surprises. Remove useless code for
111 * tests/chmod/Makefile.am (TESTS): Add umask-x.
112 * tests/chmod/umask-x: New file.
114 2005-05-02 Paul Eggert <eggert@cs.ucla.edu>
116 * NEWS: ls --indicator-style=directory renamed to ls
117 --indicator-style=slash, to avoid confusion with ls --directory.
118 * src/ls.c (usage): Likewise.
119 (slash): Renamed from directory_only. All uses changed.
121 2005-05-01 Paul Eggert <eggert@cs.ucla.edu>
123 * NEWS: "chmod +1 foo" is now diagnosed.
125 2005-04-29 Paul Eggert <eggert@cs.ucla.edu>
127 * NEWS: ls -p now marks only directories. New option
128 --indicator-style=directory equivalent to -p.
129 * doc/coreutils.texi (ls invocation): Document this.
130 Also, mention ">" is for doors.
131 * src/ls.c (enum indicator_style): New constant directory_only,
133 (indicator_style_args, indicator_style_types): Set it appropriately.
134 (decode_switches, gobble_file, print_type_indicator):
135 (length_of_file_name_and_frills):
136 Implement the change described in NEWS.
137 (decode_switches): Quote ">", too.
138 (usage): Update to match the new behavior. Describe ">".
139 * tests/ls/file-type: Test for new behavior. Omit -1 option.
140 The "ls --color" test wasn't being checked; add a check for
141 "ls --color=auto" instead.
143 * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
144 * tests/misc/split-fail: Likewise.
145 * tests/pr/Test.pm: Likewise.
146 * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
147 * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
148 if they use file names starting with +.
149 (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
150 * tests/uniq/Test.pm (tv, test_vector): Likewise.
152 The following was partly derived from a tiny change by Eric Blake:
153 * tests/misc/nice: Don't use 'set -'. It's not portable to strict
154 POSIX 1003.1-2001 hosts. Also, don't set _POSIX2_VERSION.
155 * tests/mkdir/perm: Don't use 'set -'. Simplify test construction.
156 Work even if the underyling system attaches ACLs to new dirs.
157 * tests/mv/part-hardlink: Don't use 'set -'.
158 * tests/stty/row-col-1: Don't use 'set -'.
160 2005-04-28 Paul Eggert <eggert@cs.ucla.edu>
162 * NEWS: Document fixes described below.
163 * src/chmod.c (change, umask_value): New static vars.
164 (reference_file): Move this static var to inside "main".
165 (process_file, process_files): Remove CHANGES arg; now taken from
166 static var. All uses changed.
167 (usage): Fix incorrect description of MODE operand.
168 (main): For invalid mode usages, output a brief usage message.
169 Adjust to new modechange API.
170 * install.c (main): Adjust to new modechange API.
171 Also, free the mode_change object when done.
172 * mkdir.c (main): Likewise.
173 * mkfifo.c (main): Likewise.
174 * mknod.c (main): Likewise.
175 * tests/chmod/equal-X: Check for =xX bug.
176 * tests/chmod/equals: Check for =u bug.
177 * tests/chmod/usage: Check for u+gr and ug,+x bugs.
179 2005-04-26 Paul Eggert <eggert@cs.ucla.edu>
181 Restore support for usages like "head -1" and "tail -1",
182 even when conforming to POSIX 1003.1-2001.
183 Fix bug with "POSIXLY_CORRECT=1 fold file -3".
184 join now supports a NUL field separator, e.g., "join -t '\0'".
185 join now detects and reports incompatible options, e.g.,
187 * NEWS: Document this.
188 * src/date.c: Remove posixver.h and its uses.
189 (COMMON_SHORT_OPTIONS): Remove.
190 (short_options): New constant.
191 (short_options, usage): -I now always takes an optional arg.
192 * src/expand.c: Remove posixver.h and its uses.
193 (shortopts): New constant. -DIGIT now always takes an optional arg.
194 (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
195 Don't complain about -DIGIT.
196 * src/fold.c: Remove posixver.h and its uses.
197 (shortopts): New constant. -DIGIT now always takes an optional arg.
198 (main): Don't preprocess arg list; that was buggy. Use method
200 * src/head.c: Remove posixver.h and its uses.
201 (header_mode_option): Remove.
202 (main): Don't complain about obsolete -NUM args.
203 * src/join.c: Remove posixver.h and its uses.
204 (obsolete_usage): Remove.
205 (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
206 they haven't been set yet.
207 (tab): Now int, not char. Initialize to -1 to indicate white space
208 separates columns, so that we can use NUL as a separator.
210 (OBSOLETE_LONG_OPTIONS, get_option): Remove.
211 (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
212 suffices. Use xstrtoul for sizes; it suffices.
213 (decode_field_spec): Report an error and exit on failure. Return void,
215 (add_field_list): Likewise.
216 (set_join_field): New function.
217 (enum operand_status): New enum.
218 (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
219 PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
220 possibilities with obsolete option parsing.
221 (main): Use it. Do not depend on POSIX version.
222 Check for conflicting options. Parse obsolete options -j1 and -j2
223 so that it is a pure extension to POSIX 1003.1-2001.
224 Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
225 * src/nice.c: Remove posixver.h and its uses.
226 (main): Always support -NUM option.
227 * src/od.c: Remove posixver.h and its uses.
228 (short_options): New constant, which always supports -w[num].
229 (COMMON_SHORT_OPTIONS): Remove.
230 * src/pr.c: Remove posixver.h and its uses.
231 (short_options): New constant, which always supports -S[string].
232 (COMMON_SHORT_OPTIONS): Remove.
233 * src/sort.c: Remove posixver.h and its uses.
234 (short_options): New constant, which always supports -y arg.
235 (COMMON_SHORT_OPTIONS): Remove.
236 (main): Redo workaround for Solaris compatibility with -y.
237 This change isn't visible to the user; it just cleans up the
238 code so that we don't need posixver.h.
239 * src/split.c: Remove posixver.h and its uses.
240 (main): Don't complain about -NUM option.
241 * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
242 * src/unexpand.c: Remove posixver.h and its uses.
243 (main): Don't complain about -TAB.
244 * src/uniq.c (main): Don't complain about -NUM.
246 2005-04-22 Paul Eggert <eggert@cs.ucla.edu>
248 * src/nohup.c (main): If getopt fails, exit with status 127,
249 not status 1. POSIX requires this.
250 * NEWS: Document this.
252 * src/nice.c (main): Report proper program name when getopt finds
253 trouble. Problem reported by Behdad Esfahbod.
255 * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
256 when the "+x" was being evaluated.
257 * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
258 * mkfifo.c (main): Likewise.
259 * mknod.c (main): Likewise.
260 * tests/mkdir/perm: Test for the above bug.
262 2005-04-20 Paul Eggert <eggert@cs.ucla.edu>
264 Port test cases to Microsoft-Windows-related environments,
265 following suggestions from Eric Blake.
266 * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
267 * tests/install/basic-1: Undo previous change.
268 (dd, dd2): New vars, which use $EXEEXT. All uses of dd and dd2 changed.
269 * tests/install/trap: Undo previous change.
270 (sig): New var. Use it insted of "trap '' CHLD".
271 Append $EXEEXT to executable name.
273 "fetish" -> "coreutils" in more places.
274 * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
275 (package Coreutils): Renamed from package Fetish. All uses changed.
276 * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
279 2005-04-19 Paul Eggert <eggert@cs.ucla.edu>
281 * tests/mv/setup (dot_mount_point): Use stat -L, in case the
282 directory is actually a symbolic link. Problem reported by
285 * tests/mv/mv-special-1: Use test -p to test for fifos, rather
286 than the (incorrect) test -f and the (inadequate) ls. ls is
287 inadequate because on some hosts a buggy mv will create a file of
288 the wrong type (problem reported by Eric Blake). Skip this test
289 if test -p doesn't work.
291 * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
292 since the latter can have shell metacharacters in them (e.g., spaces).
293 This follows up to the 2005-01-17 patch, which missed this occurrence.
295 2005-04-18 Paul Eggert <eggert@cs.ucla.edu>
297 "fetish" -> "coreutils" in several places.
298 * Makefile.cfg (ftp): Remove fetish.sf.net.
299 * Makefile.maint (emit_upload_commands): Likewise.
300 * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
301 * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
302 * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
304 * tests/install/basic-1: Use "cat", not "test", to test for
305 ../../src/dd. Problem reported by Eric Blake.
307 2005-04-18 Jim Meyering <jim@meyering.net>
309 * src/dd.c: Don't include stat-macros.h directly. system.h does that.
311 2005-04-17 Paul Eggert <eggert@cs.ucla.edu>
313 Work around a couple of "make check" failures reported for Cygwin
314 and ash by Eric Blake.
315 * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
316 * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
318 2005-04-16 Jim Meyering <jim@meyering.net>
320 * src/dd.c (S_TYPEISSHM): Remove definition.
321 Get the definition by including "stat-macros.h", instead.
323 2005-04-14 Paul Eggert <eggert@cs.ucla.edu>
325 Fix test suite problems reported by Eric Blake on Cygwin.
326 * tests/mv/mv-special-1: Ignore chatter about when files are removed,
327 since POSIX doesn't require rename to fail across file systems.
328 * tests/mv/setup (dot_mount_point): Use stat rather than df, as
330 (other_partition_tmpdir): Remove df from name as that would be
333 2005-04-14 Jim Meyering <jim@meyering.net>
335 * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
337 2005-04-12 Paul Eggert <eggert@cs.ucla.edu>
339 * src/ls.c (usage): "uid" -> "user ID".
341 2005-04-12 Jim Meyering <jim@meyering.net>
343 * src/tsort.c (tsort): Use "%s" as the format string,
344 rather than a diagnostic or a file name.
346 * src/comm.c (compare_files): Remove declaration of unused local.
348 * src/chown-core.c (chopt_free): Mark parameter as unused.
350 2005-04-11 Paul Eggert <eggert@cs.ucla.edu>
352 * man/chown.x: Reword to match user manual.
353 * man/id.x: Likewise.
354 * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
356 * src/whoami.c (usage, main): Likewise.
358 Add bulletproofing for cases where stdin, stdout, or stderr are closed.
359 * src/comm.c: Include stdio-safer.h.
360 (compare_files): Exit right away on I/O error rather than continuing
361 and producing confusing output and error messages.
362 Return void, not int; all callers changed.
363 Use fopen_safer to avoid confusion with file descriptors.
364 * src/copy.c: Include unistd-safer.h.
365 (copy_reg): Use fd_safer.
366 * src/csplit.c: Include stdio-safer.h.
367 (input_desc): Remove unnecessary static initialization.
368 (set_input_file): Use STDIN_FILENO, not 0.
369 (create_output_file): Use fopen_safer.
370 * src/dircolors.c (dc_parse_file): Don't assume fopen does not
372 * src/head.c (head_file): Don't assume open does not return 0.
373 * src/join.c: Include stdio-safer.h.
374 (main): Use fopen_safer. Simplify the resulting code.
375 * src/md5sum.c (digest_file, digest_check):
376 Don't assume that fopen does not return stdin.
377 * src/nohup.c: Include unistd-safer.h.
378 (main): Don't dup stderr to stdin or stdout by mistake.
379 * src/od.c (check_and_close): Don't assume fopen does not return stdin.
380 * src/paste.c (paste_serial): Likewise.
381 * src/pr.c: Include stdio-safer.h.
382 (open_file): Use fopen_safer.
383 (close_file): Don't assume fopen does not return stdin.
384 * src/ptx.c (main): Don't assume fopen returns stdout after closing
385 stdout. Use freopen instead.
386 * src/shred.c: Include unistd-safer.h.
387 (wipename): Use fd_safer on directory file descriptor.
388 (wipefile): Remove special case for /dev/fd/* on older hosts.
389 It didn't work in general, and wasn't documented.
391 * src/sort.c: Include unistd-safer.h.
392 (create_temp_file): Use fd_safer.
393 (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
394 * src/split.c: Include unistd-safer.h.
395 (cwrite): Use fd_safer. Replace mystery constant 0666 with symbolic
396 version, as POSIX requires.
397 * src/sum.c (bsd_sum_file, sysv_sym_file):
398 Use same pattern as elsewhere for checking for stdin.
399 * src/tac.c: Include unistd-safer.h.
400 (copy_to_temp): Use fd_safer.
401 (tac_file): Don't assume fopen cannot return stdin.
402 * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
403 (recheck, tail_file): Use fd_safer rather than open_safer.
404 * src/tee.c: Include stdio-safer.h.
405 (tee): Use fopen_safer.
406 * src/touch.c: Include unistd-safer.h.
407 (touch): Use fd_safer.
408 * src/tsort.c (have_read_stdin): Remove; no longer needed. All uses
410 (tsort): Do not assume fopen can't return stdin.
411 Close stdin before returning. All uses changed.
412 * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
413 * src/uniq.c: Include stdio_safer.h.
414 (check_file): Don't assume fopen cannot return stdin or stdout.
416 2005-04-09 Jim Meyering <jim@meyering.net>
418 * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
420 Now that close_stdout closes standard output unconditionally,
421 these workarounds for dd and cat are no longer necessary.
422 * src/dd.c (close_stdout_wrapper): Remove function.
423 (main): Call atexit with close_stdout, instead.
424 * src/cat.c (close_stdout_wrapper): Likewise.
425 Don't close STDOUT_FILENO explicitly; close_stdout does it.
427 * src/system.h (__attribute__): Readability nit:
429 # define __attribute__(x)
431 # define __attribute__(x) /* empty */
433 2005-04-09 Jim Meyering <jim@meyering.net>
435 * src/rm.c (usage): Mention that --recursive removes listed
436 directories too, not just their contents.
437 Say that by default, rm does not remove directories.
439 * src/pr.c: Don't include "timespec.h". system.h does that.
440 * Makefile.maint (sc_system_h_headers): Propagate exit status
443 2005-04-08 Paul Eggert <eggert@cs.ucla.edu>
445 * NEWS: Document that dd no longer treats QUIT or PIPE specially,
446 and when conforming to POSIX no longer treats USR1 specially.
447 Document that dd no longer dumps core when handling signals.
448 * src/system.h (RETSIGTYPE): Remove; no longer needed. All uses
450 * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
452 (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
453 (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
454 behavior when called from a signal handler. All uses changed.
455 (main) [!defined SA_NOCLDSTOP]:
456 Use siginterrupt to specify that system calls should be interrupted.
457 * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
458 (process_signals): Add forward decl.
459 (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
461 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
462 (SA_NODEFER) [!defined SA_NODEFER]: New macro.
463 (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
464 (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
466 (usage): Mention -USR1 versus -INFO.
467 (cleanup): Don't invoke print_stats; the caller must do it now.
469 (quit): Process signals just before exiting.
470 (interrupt_handler): Simply record the signal and return.
471 (siginfo_handler): Simply increment the signal counter and return.
472 (install_handler): Remove, replacing with:
473 (install_signal_handlers, process_signals, iread, iwrite):
474 New functions. All callers to safe_read and full_write replaced
475 by iread and iwrite. All callers to install_handler replaced by
477 * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
479 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
480 (main) [! SA_NOCLDSTOP]: Use it.
481 * src/shred.c: Remove all uses of signals; modern hosts have
482 /dev/random and don't need this gorp.
483 Do not include signal.h.
484 (env, sigill_handler, isaac_seed_machdep): Remove. All uses removed.
485 * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
487 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
488 (main) [! SA_NOCLDSTOP]: Use it.
490 * src/dd.c: Do not include inttostr.h, no longer needed.
491 (print_stats, main): Rewrite and simplify formats to use PRIuMAX
492 instead of umaxtostr.
493 (print_stats): Work even in languages that have special
494 forms for two of things, for r_truncate and w_bytes. We can't
495 fix delta_s in this way, since ngettext doesn't support floating-point.
496 (main): Rewrite to avoid casts.
498 2005-04-07 Jim Meyering <jim@meyering.net>
500 Placate gcc-4's -Wuninitialized.
501 * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
502 * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
504 * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
506 (binop): Move function definition to precede first use so we can...
507 (binop): ...remove prototype.
509 2005-04-05 Paul Eggert <eggert@cs.ucla.edu>
511 * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
512 * src/basename.c (usage): Add examples.
513 * src/cat.c (usage): Likewise.
514 * src/chgrp.c (usage): Likewise.
515 * src/chown.c (usage): Likewise.
516 * src/dirname.c (usage): Likewise.
518 2005-04-05 Jim Meyering <jim@meyering.net>
520 * src/nice.c (usage): Mention that some shells provide a
521 built-in function by the same name.
522 * src/nohup.c (usage): Likewise.
523 * src/printenv.c (usage):Likewise.
525 2005-04-04 Dmitry V. Levin <ldv@altlinux.org>
527 * src/tee.c (tee): When closing files, do not close stdout,
528 leave this job to close_stdout() instead.
529 * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
530 * tests/Makefile.am (SUBDIRS): Add tee.
531 * tests/tee/Makefile.am: New file.
532 * tests/tee/.cvsignore: Likewise.
533 * tests/tee/{basic,dash}: New tee tests.
535 2005-04-04 Jim Meyering <jim@meyering.net>
537 * src/echo.c (usage): Mention that some shells provide a
538 built-in function by the same name.
539 * src/kill.c (usage): Likewise
540 * src/printf.c (usage): Likewise.
541 * src/pwd.c (usage): Likewise.
542 * src/stat.c (usage): Likewise.
543 * src/test.c (usage): Likewise.
544 * src/true.c (usage):
545 * src/system.h (USAGE_BUILTIN_WARNING): New macro.
547 * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
548 * man/printf.x: Likewise.
549 * man/pwd.x: Likewise.
551 2005-04-03 Jim Meyering <jim@meyering.net>
553 * src/pr.c (main): Fix off-by-one error.
554 pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
555 end of a malloc'd buffer.
557 2005-04-01 Jim Meyering <jim@meyering.net>
559 * src/pr.c (main): Free column_count_string when done with it.
561 Don't let pr treat +1:-1 like +1:18446744073709551615.
562 * src/pr.c (strtoumax): Remove declaration.
563 (first_last_page): Use xstrtoumax in place of strtoumax,
564 so we don't interpret a negative page number (e.g., in an option
565 like --pages=1:-1) as valid.
566 * tests/pr/Test.pm (neg-page): Add a test for this.
568 2005-03-30 Paul Eggert <eggert@cs.ucla.edu>
570 * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
571 * src/uptime.c (uptime): New arg OPTIONS. All uses changed.
572 * src/users.c (users): Likewise.
573 * src/who.c (who): Likewise.
574 * src/uptime.c (main): Check PIDs when invoked with zero arguments.
575 * src/users.c (main): Likewise.
576 * src/who.c (main): Likewise. Also with two arguments.
577 Omit duplicate code in 2-arg case.
578 (UT_PID): Moved to ../lib/readutmp.h.
580 2005-03-29 Jim Meyering <jim@meyering.net>
582 * src/system.h (ptr_align): Declare `ptr' parameter to be a
583 `const' pointer, since this function never writes through it.
585 * src/uname.c: Indent cpp directives to reflect nesting.
587 2005-03-28 Jim Meyering <jim@meyering.net>
589 * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
590 Add `void' to make this an ANSI-style function declaration.
591 * src/remove.c (ds_init): Likewise.
592 * src/pr.c (print_sep_string): Likewise.
594 * src/stty.c (speeds): Declare this array to be static.
595 * src/Makefile.am (sc_tight_scope): Adjust to catch any
596 new declarations like that of stty.c's `speeds'.
598 * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
599 (GETOPT_VERSION_OPTION_DECL): Likewise.
600 * src/chown.c (long_options): Likewise.
601 * src/chgrp.c (long_options): Likewise.
602 * src/chmod.c (long_options): Likewise.
603 * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
605 * src/chown-core.c (chopt_init): Likewise.
606 * src/comm.c (long_options): Likewise.
607 * src/copy.c (copy_reg): Likewise.
608 * src/csplit.c (extract_regexp): Likewise.
609 * src/cut.c (longopts): Likewise.
610 * src/date.c (time_spec_string): Likewise.
611 * src/df.c (find_mount_point, show_point): Likewise.
612 * src/expr.c (docolon): Likewise.
613 * src/fmt.c (long_options): Likewise.
614 * src/ls.c (time_style_args, indicator_style_args, long_options)
615 (format_args, sort_args, time_args, decode_switches)
616 (gobble_file): Likewise.
617 * src/md5sum.c (long_options): Likewise.
618 * src/mv.c (reply_args): Likewise.
619 * src/paste.c (longopts): Likewise.
620 * src/pinky.c (print_entry): Likewise.
621 * src/pr.c (long_options): Likewise.
622 * src/ptx.c (long_options, format_args): Likewise.
623 * src/readlink.c (longopts): Likewise.
624 * src/sort.c (long_options, mergefps): Likewise.
625 * src/stat.c (long_options): Likewise.
626 * src/tac.c (main): Likewise.
627 * src/tail.c (follow_mode_string): Likewise.
628 * src/touch.c (longopts, time_args): Likewise.
629 * src/uniq.c (delimit_method_string): Likewise.
630 * src/uptime.c (print_uptime): Likewise.
631 * src/who.c (print_user): Likewise.
633 2005-03-27 Jim Meyering <jim@meyering.net>
635 * src/dcgen: Simplify further, clean up.
636 Add a standard-output-closing global destructor.
638 * src/wheel-gen.pl: Use the same global destructor as dcgen.
640 2005-03-26 Paul Eggert <eggert@cs.ucla.edu>
642 * src/dcgen: Squeeze multiple blanks into one. Output a simple
643 array of adjacent strings rather than a more complicated data
644 structure; this saves space in the dircolors executable.
645 * src/dircolors.c (parse_line): Use char *, not unsigned char *.
647 (dc_parse_stream, main): Avoid casts.
648 Adjust to simpler data structure generated by new dcgen.
650 2005-03-25 Eric Blake <ebb9@byu.net> (tiny change)
652 * src/ls.c (usage): Document usage of LS_COLORS.
654 2005-03-25 Paul Eggert <eggert@cs.ucla.edu>
656 * src/dircolors.hin: Add "TERM cygwin".
658 2005-03-25 Jim Meyering <jim@meyering.net>
660 * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
661 the return value, and update callers:
662 * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
663 * src/expand.c (parse_tab_stops, main): Likewise.
664 * src/split.c (main): Likewise.
665 * src/unexpand.c (parse_tab_stops, main): Likewise.
666 * src/uniq.c (main): Likewise.
668 2005-03-22 Jim Meyering <jim@meyering.net>
670 * build-aux: New directory. Renamed from config.
671 * configure.ac: Reflect renaming: config -> build-aux.
672 * Makefile.am (dist-hook): Likewise.
673 * Makefile.maint: Likewise.
674 * Makefile.cfg (cvs_files): Likewise.
675 * .x-sc_sun_os_names: Likewise.
676 * .x-sc_trailing_blank: Likewise.
678 * src/ls.c (get_funky_string): Use '\a', rather than 7, for
679 portability to EBCDIC hosts.
681 2005-03-20 Jim Meyering <jim@meyering.net>
683 * src/pr.c (init_header): Add missing `%' in new format string.
684 (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
686 2005-03-19 Jim Meyering <jim@meyering.net>
688 * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
689 $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
691 2005-03-18 Paul Eggert <eggert@cs.ucla.edu>
693 * NEWS: pr -D "FORMAT" now accepts the same formats that
695 * src/pr.c: Include strftime.h, timespec.h.
696 (init_header): Obtain and format nanosecond part of time stamp.
698 * NEWS: nohup now ignores the umask when creating nohup.out.
699 nohup now closes stderr if it is a terminal and stdout is closed.
700 * src/nohup.c (main): Likewise. Be a little more paranoid about
701 return values; e.g., check for any negative return from open.
702 Assume free (NULL) works.
703 Close file descriptor leak when redirecting standard output to a file.
705 2005-03-17 Jim Meyering <jim@meyering.net>
707 * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
708 in place of functionally-equivalent code.
709 * src/expand.c (parse_tab_stops, main): Likewise.
710 * src/split.c (main): Likewise.
711 * src/unexpand.c (parse_tab_stops, main): Likewise.
712 * src/uniq.c (main): Likewise.
713 * src/od.c: Use VERIFY macro in place of an equivalent open-coded
715 * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
718 Before, this command would make uniq skip 11 fields and print
720 $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
723 * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
724 not like `uniq -f11'.
726 2005-03-15 Jim Meyering <jim@meyering.net>
728 Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
729 `pr -0' should give a better diagnostic and `pr -03' should be
730 equivalent to `pr -3'.
731 * src/pr.c (parse_column_count): Change return type to void.
732 Call error (EXIT_FAILURE, ... for an invalid string.
733 (main): Allocate space for column_count_string using malloc.
734 Accumulate all old-style column-count digits before converting.
735 When the number of columns is specified via both old-style,
736 (e.g., -3), and a long option (--columns=5), ensure that only
737 the last one specified takes effect.
738 * tests/pr/Test.pm: Add tests for the above.
740 2005-03-15 Corinna Vinschen <corinna@vinschen.de> (tiny change)
742 * src/copy.c (copy_reg): Copy regular files in binary mode.
744 2005-03-14 Paul Eggert <eggert@cs.ucla.edu>
746 * NEWS: Restate why ls limits time stamp lengths.
748 2005-03-12 Jim Meyering <jim@meyering.net>
750 Add a little infrastructure to help prevent future bugs like the
752 * src/stat.c (xstrcat): New function.
753 (print_statfs, print_stat): Add buf_len parameter and convert all
754 uses of strcat to xstrcat. Update callers.
755 (print_it): Call print_func with buf_len parameter.
757 Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
758 could cause a buffer overrun error.
759 * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
760 conversion of the stat %s format string to the longer printf %llu one.
761 Patch from Guochun Shi.
763 2005-03-11 Paul Eggert <eggert@cs.ucla.edu>
765 * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
766 (long_time_expected_width, print_long_format): Use it, to avoid
767 some possible denial-of-service attacks.
768 * NEWS: Document this.
770 2005-03-11 Jim Meyering <jim@meyering.net>
772 Prompt once again for `mv -i A B' when A and B are hard links
773 to the same file. This fixes a bug introduced by my 2003-04-04
774 (coreutils-5.0.1) change. Reported by Thomas Wolff via Eric Blake.
775 * src/copy.c (abandon_move): New function, factored out of
776 copy_internal, now that this code is being used from two places.
777 (copy_internal): Perform the same interactive-related test for
778 whether it's alright to proceed and (usually) overwrite the
780 * tests/mv/i-4: Add tests for the above.
782 Don't segfault for a very long date format string, e.g.,
783 ls -ld --time-style=+%99999999H .
784 * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
785 so format string abuse cannot provoke stack overflow.
786 (print_long_format): Likewise.
788 Don't segfault for a long header date string, e.g.,
789 echo a|pr -D +%9999999A
790 * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
791 Don't bother with fixed-sized initial buffer; always use x*alloc.
793 * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
794 in place of equivalent INT_STRLEN_BOUND + 1.
795 * src/expr.c (tostring, printv): Likewise.
797 2005-03-09 Paul Eggert <eggert@cs.ucla.edu>
799 * src/system.h: Include intprops.h.
800 (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
801 they are now defined in intprops.h.
803 2005-03-09 Jim Meyering <jim@meyering.net>
805 * TODO: Remove entry about named pipes. It was fixed in 5.3.0.
807 2005-03-08 Paul Eggert <eggert@cs.ucla.edu>
809 * src/date.c (usage): Redo to match recent documentation changes.
810 Don't bother documenting which usages are GNU extensions; the list
811 wasn't correct, and is better left to the printed manual anyway.
813 2005-03-06 Jim Meyering <jim@meyering.net>
815 Factor out column-count processing.
816 * src/pr.c: Include "inttostr.h".
817 (parse_column_count): New function.
818 (main): Use the new function for both old-style, -9, and long,
819 --columns=-9, options.
821 * src/cksum.c: Remove `register' keyword.
822 * src/cut.c: Likewise.
823 * src/dd.c: Likewise.
824 * src/env.c: Likewise.
825 * src/factor.c: Likewise.
826 * src/fmt.c: Likewise.
827 * src/fold.c: Likewise.
828 * src/id.c: Likewise.
829 * src/logname.c: Likewise.
830 * src/ls.c: Likewise.
831 * src/pr.c: Likewise.
832 * src/printf.c: Likewise.
833 * src/shred.c: Likewise.
834 * src/sort.c: Likewise.
835 * src/sum.c: Likewise.
836 * src/test.c: Likewise.
837 * src/tsort.c: Likewise.
838 * src/uniq.c: Likewise.
839 * src/wc.c: Likewise.
840 * src/whoami.c: Likewise.
842 2005-03-01 Paul Eggert <eggert@cs.ucla.edu>
844 * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
847 2005-03-01 Jim Meyering <jim@meyering.net>
849 * src/copy.c (copy_internal): Change test of source type from
850 !S_ISREG to S_ISLNK. Reported by Paul Eggert in
851 http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
853 2005-02-28 Jim Meyering <jim@meyering.net>
855 * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
857 2005-02-21 Paul Eggert <eggert@cs.ucla.edu>
859 * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
860 (nanosec_libs): Add $(LIB_XNANOSLEEP). Needed for newer GNU/Linux
861 hosts with clock_gettime.
863 2005-02-20 Paul Eggert <eggert@cs.ucla.edu>
865 * NEWS: Describe user-visible change to dd.
866 * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
867 Remove $(LIB_CLOCK_GETTIME). These functions now use
869 * src/dd.c: Include gethrxtime.h, xtime.h.
870 (start_time): Now of type xtime_t, not struct timespec.
871 (print_stats, main): Use gethrxtime rather than gettime.
872 * src/ls.c (time): Remove obsolete decl.
873 (get_current_time): gettimeofday always returns 0, so don't
875 * src/shred.c: Include gethrxtime.h.
876 (isaac_seed): Use gethrxtime rather than a mishmash.
877 * src/touch.c (time): Remove obsolete decl.
879 * tests/misc/split-fail: Don't assume that the current host
880 supports integers wider than 32 bits. Fix comment typo.
881 * tests/od/x8: Likewise.
883 * src/chown-core.c (enum RCH_status): Remove trailing comma,
884 as it's not valid in standard C89.
886 2005-02-15 Jim Meyering <jim@meyering.net>
888 * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
889 so that file systems of type `xfs' are recognized as such.
890 * src/fs.h: Regenerate.
891 Reported by Bernd Eckenfels.
892 * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
893 * src/fs.h: Regenerate.
894 Reported by Andreas Schwab.
896 * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
897 to work around the invalid definition from Darwin 7.7.0.
898 Test failure reported by Sébastien Maret.
900 2005-02-14 Paul Eggert <eggert@cs.ucla.edu>
902 * src/sort.c (mergefps): Use binary search rather than linear one
903 when comparing new line to lines already in main memory.
904 Idea suggested by James Lemley.
906 2005-02-09 Jim Meyering <jim@meyering.net>
908 * src/copy.c (valid_options): Add an assertion that
909 not both hard_link and symbolic_link are set.
911 2005-02-08 Paul Eggert <eggert@cs.ucla.edu>
913 * NEWS: Document stat -f -c %S, plus changes to default formats.
914 * doc/coreutils.texi (stat invocation): Normalize terminology,
915 capitalization, and sort order to match --help output. Mention %c
916 for file systems. Add new -f -c format %S, and document %s versus %S;
917 problem reported by Jeroen van Wolffelaar.
918 * src/stat.c (usage): Likewise.
919 (STATFS_FRSIZE): New macro.
920 (print_statfs): Use it, for stat -f -c %S.
921 (do_statfs): Change default formats to output %S.
923 2005-02-03 Paul Eggert <eggert@cs.ucla.edu>
925 * src/system.h: Include "memrchr.h".
926 (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
928 2005-02-02 Jim Meyering <jim@meyering.net>
930 * tests/du/8gb: Also adjust the test (s/64/128/) to detect
931 systems that don't support sparse files.
932 Check for $2 -ge 128, rather than $2 = 128, in case
933 there is a file system type that doesn't support sparse files,
934 yet for which metadata takes up additional space.
935 Both reported by Andreas Schwab.
937 2005-02-01 Eric Blake <ebb9@byu.net> (tiny change)
939 * tests/du/8gb: Create a larger test file, so we properly
940 detect that sparse files can be created on NTFS under cygwin.
942 2005-01-30 Jim Meyering <jim@meyering.net>
944 * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
946 * src/stty.c: Remove unnecessary parentheses in all #if directives.
948 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
950 * .cvsignore: Ignore config.cache and config.status.lineno.
951 * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
952 instead of VSWTCH, for use with CSWTCH.
954 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
956 * tests/Makefile.am (.PHONY): Add check-root and root-hint.
957 * tests/rwx-to-mode: Ignore ACL designation.
958 * tests/setgid-check: Likewise.
959 * tests/chown/separator: Quote user and group names.
961 2005-01-24 Jim Meyering <jim@meyering.net>
963 * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
964 Suggestion from Johan Boule.
966 2005-01-17 Eric Blake <ebb9@byu.net> (tiny change)
968 * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
970 * man/Makefile.am (all_programs): Revert previous patch; updated
971 all_programs.list fixes this.
972 (.x.1): No need to add $(EXEEXT).
974 2005-01-03 Corinna Vinschen <corinna@vinschen.de> (tiny change)
976 * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
979 2005-01-22 Jim Meyering <jim@meyering.net>
981 * Makefile.maint (v_etc_file): The version string has moved to
982 version-etc-fsf.c, search that new file, not version-etc.c.
984 2005-01-17 Paul Eggert <eggert@cs.ucla.edu>
986 * tests/group-names: Use numeric group ids, not symbolic group names,
987 since the latter can have shell metacharacters in them (e.g., spaces).
988 Problem reported by Eric Blake.
989 * tests/chgrp/basic: Assume groups are numeric, not symbolic.
990 * tests/chgrp/deref: Likewise.
991 * tests/chgrp/posix-H: Likewise.
992 * tests/chgrp/recurse: Likewise.
994 2005-01-15 Jim Meyering <jim@meyering.net>
996 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
997 because just calling gethrtime evokes an `illegal instruction'
998 failure when compiled with Sun's c89 on Solaris 8 and 9.
999 Reported by Nelson Beebe.
1001 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1002 twice with the same value of `t'.
1003 Replace nested #if-#else blocks with #if-#elif-#elif chain.
1005 2005-01-14 Jim Meyering <jim@meyering.net>
1007 The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1008 * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1009 sockets, since that's what you get when reading from a command-line-
1010 supplied pipe on Darwin 7.7.
1011 (IS_PIPE_LIKE_FILE_TYPE): Define.
1012 (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1013 Reported by Nelson Beebe.
1014 This same change is also required on NetBSD/sparc-1.5.
1015 Reported by Adrian Bunk.
1017 * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1018 rather than suffering silently.
1019 Before, expr would silently overflow and wrap around:
1020 $ expr 9223372036854775808 = 0 # $(echo 2^63|bc)
1022 Now it detects the problem and exits nonzero:
1023 $ ./expr $(echo 2^63|bc) = 0
1024 ./expr: 9223372036854775808: integer is too large
1026 * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1027 failure, so that doesn't cause `make check' to stop. Nelson Beebe
1028 reported that this test would fail with the diagnostic,
1029 `cannot find name for group ID 10', on one of his systems.
1031 2005-01-13 Jim Meyering <jim@meyering.net>
1033 * src/test.c (is_int): Don't overflow when evaluating integer
1034 constants. Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1037 * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1038 names of temporary files that would clash on 8.3 file systems.
1039 * tests/mk-script (validate): Likewise.
1041 2005-01-12 Jim Meyering <jim@meyering.net>
1043 * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1045 * tests/tr/Test.pm (repeat-xC): Change test name from
1046 `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1047 Reported by Eric Blake.
1048 (repeat-000): Rename to `repeat-zeros' for the same reason.
1050 2005-01-11 Jim Meyering <jim@meyering.net>
1052 * configure.ac: Update version to 5.3.1.
1054 2005-01-11 Eric Blake <ebb9@byu.net>
1056 * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1057 * man/Makefile.am (all_programs): Account for $(EXEEXT).
1059 2005-01-11 Jim Meyering <jim@meyering.net>
1061 * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1062 with decreasing values.
1064 * src/expand.c (main): Likewise.
1065 * src/unexpand.c (main): Check for overflow in tabstop values
1066 specified via the obsolete form. E.g., now this command fails:
1067 _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1068 Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1069 * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1071 2005-01-10 Paul Eggert <eggert@cs.ucla.edu>
1073 Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1074 * NEWS: Document the changes.
1075 * doc/coreutils.texi (pathchk invocation): Likewise.
1076 * src/pathchk.c (PORTABILITY_OPTION): New constant.
1077 (longopts, usage, main, validate_file_name):
1078 Add support for new -P option.
1079 Reject empty file names (unless -p is not specified and the
1080 current system allows empty file names).
1081 Change --portability so that is now equivalent to -p -P.
1082 Don't test whether file name is too long, if it is known to exist.
1083 (no_leading_hyphen): New function.
1084 * tests/misc/pathchk1: Add tests for empty file names and
1087 2005-01-08 Jim Meyering <jim@meyering.net>
1091 `pr --columns=N' was not equivalent to `pr -N' when also using
1094 * src/pr.c (main): Set `explicit_columns' for --columns=N,
1095 not just for -N. This bug has existed since the introduction
1096 of the --columns=N option on 1998-08-15.
1097 * NEWS: Document this.
1098 * tests/pr/Test.pm (test_vector): For each -N test, automatically
1099 create a new test vector using --columns=N.
1101 2005-01-07 Paul Eggert <eggert@twinsun.com>
1103 * src/pr.c (main): Check for column count overflow with
1104 usages like "pr -2147483648".
1106 2005-01-07 Jim Meyering <jim@meyering.net>
1108 * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1110 2005-01-06 Jim Meyering <jim@meyering.net>
1112 * README: List the precise HP-UX version numbers that are affected.
1113 Suggestion from Bob Proulx.
1115 * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1116 predicate before `-name ChangeLog' to avoid a harmless warning
1119 2005-01-05 Jim Meyering <jim@meyering.net>
1121 * tests/help-version: Punt on the uptime test, since it fails when
1122 it can't get boot time, and I don't want that to stop `make check'.
1124 * src/du.c (process_file): Evaluate exclusion rules against
1125 the entire file name, not just the last component.
1126 Reported by Robert Lindgren.
1127 * tests/du/exclude: Test for this.
1128 * NEWS: Document this.
1130 Ensure that tests/Makefile.am's check-root actions stay up to date.
1131 * Makefile.maint (sc_root_tests): New rule.
1132 (syntax-check-rules): Add it to the list.
1134 2005-01-04 Jim Meyering <jim@meyering.net>
1136 * man/shred.x: Change one-line summary to reflect that shred does
1137 not remove files by default. Suggestion from Helen Faulkner in
1138 http://bugs.debian.org/288552
1140 * README: Request VERBOSE=yes output when reporting test failures.
1141 Other minor changes.
1143 * tests/Makefile.am (check-root): Update.
1145 2005-01-03 Paul Eggert <eggert@cs.ucla.edu>
1147 * src/system.h: Undo previous change; we now use Autoconf.
1149 2005-01-03 Jim Meyering <jim@meyering.net>
1151 * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1152 a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems. Setting
1153 either (or both) to zero would succeed, but subsequent `stty size'
1154 would say `no size information for this device' due to the ioctl
1155 failing with EINVAL.
1157 * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1158 not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1159 then fail at compile-time rather than let tools like od produce
1160 invalid results at run time.
1162 2004-12-21 Jim Meyering <jim@meyering.net>
1164 * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1165 not `xx01, xx02, ...'.
1166 Reported by Matt Kraai in http://bugs.debian.org/286605
1168 * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1171 2004-12-20 Paul Eggert <eggert@cs.ucla.edu>
1173 * src/split.c (usage): Mention default size. Suggested by Dan Jacobson.
1175 2004-12-19 Paul Eggert <eggert@cs.ucla.edu>
1177 * NEWS: Mention that one should eval "`dircolors`" rather than
1180 2004-12-17 Jim Meyering <jim@meyering.net>
1182 * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1183 so temporary directories aren't left behind upon e.g., interrupt.
1185 2004-12-16 Paul Eggert <eggert@cs.ucla.edu>
1187 * src/ls.c (print_dir): Use "%s: not listing already-listed
1188 directory", not "not listing already-listed directory: %s", to
1189 format already-listed directories, to be consistent with other
1190 diagnostics involving file names and colons.
1192 2004-12-15 Jim Meyering <jim@meyering.net>
1194 * src/Makefile.am (__LDADD): Define, so that building `[' on
1195 Solaris still uses the -lgen library that it requires in order
1196 to get a definition of eaccess.
1198 2004-12-14 Jim Meyering <jim@meyering.net>
1200 tac would exit immediately upon I/O or temp-file creation failure.
1201 Now it continues on, processing any remaining command line arguments.
1203 * src/tac.c: Include quotearg.h.
1204 Use quotearg_colon in most diagnostics.
1205 (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1206 failure. Before, this command (with /full/tmp being a full partition)
1207 TMPDIR=/full/tmp ./tac /proc/modules tac.c
1208 would exit immediately upon the write error while trying to copy
1209 non-seekable /proc/modules to the full partition. Now it still
1210 reports the failure but continues on with the remaining file.
1211 (tac_nonseekable): Return false also if copy_to_temp fails.
1212 [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1213 using atexit like this is wrong.
1214 * NEWS: Document this.
1215 * tests/misc/tac-continue: New test for this.
1216 * tests/misc/Makefile.am (TESTS): Add tac-continue.
1218 * tests/chown/basic: Add a few more tests.
1220 2004-12-13 Paul Eggert <eggert@cs.ucla.edu>
1222 * src/ls.c (gobble_file): Change arg name to be command_line_arg
1223 rather than explicit_arg, for consistency with copy.c.
1224 (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1225 it is deducible from dirname arg. All callers changed.
1226 (extract_dirs_from_files, print_dir, queue_directory):
1227 Add command_line_arg arg. All callers changed.
1228 (struct pending): Add command_line_arg member.
1229 (main): Use NULL rather than 0 when appropriate.
1230 (set_exit_status, file_failure): New functions.
1231 (queue_directory): Store command_line_arg into new structure.
1232 (print_dir, gobble_file, get_link_name):
1233 Use file_failure to report problems in accessing files,
1234 so that the exit status is set consistently.
1235 (print_dir): Simplify readdir failure code yet again.
1236 If closedir fails, report "closing directory" rather than "reading
1238 (xstrcoll): Use set_exit_status to set status on failure.
1239 * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1242 2004-12-11 Jim Meyering <jim@meyering.net>
1244 Avoid a race condition vulnerability in chown, when used with
1245 --from=O:G and without the (-h) --no-dereference option.
1246 * src/chown-core.c (restricted_chown): New function.
1247 (change_file_owner): Call it.
1248 Reported by Ulrich Drepper.
1249 * NEWS: Mention this.
1251 2004-12-09 Paul Eggert <eggert@cs.ucla.edu>
1253 * ls now exits with status 1 on minor problems, 2 if serious trouble.
1254 * NEWS: Document this.
1255 * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1256 All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1258 (main): Initialize exit failure to LS_FAILURE.
1259 (print_dir, gobble_file, get_link_name, xstrcoll):
1260 Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1261 (print_dir): Do not give up on entire directory merely because readdir
1263 (usage): Explain exit status.
1264 * tests/help-version: ls and variants now exit with status 2
1267 2004-12-08 Paul Eggert <eggert@cs.ucla.edu>
1269 * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1272 2004-12-07 Paul Eggert <eggert@cs.ucla.edu>
1274 * src/factor.c (factor): Don't list 1 as a factor of 1.
1275 Problem reported by Thomas Folz-Donahue.
1277 2004-12-06 Jim Meyering <jim@meyering.net>
1279 * tests/du/files0-from: Sanitize environment.
1280 Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1281 setting is the default (exported from /etc/profile) on at least one
1283 * tests/du/no-deref: Likewise.
1284 * tests/cp/symlink-slash: Likewise.
1285 * tests/ls/symlink-slash: Likewise
1287 2004-12-05 Jim Meyering <jim@meyering.net>
1289 * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1290 _POSIX2_VERSION=199209 is in the environment, or when building on
1293 2004-12-04 Jim Meyering <jim@meyering.net>
1295 * NEWS: Mention cut's new --complement option.
1297 2004-10-01 Paolo Bonzini <bonzini@gnu.org>
1299 * cut.c (complement, COMPLEMENT_OPTION): New.
1300 (longopts): Add --complement.
1301 (usage): Say not that -b, -c, and -f `print' fields,
1302 but rather that they `select' fields for printing.
1303 Describe the new --complement option.
1304 (mark_range_start): Extracted from set_fields.
1305 (print_kth): Support --complement.
1306 (compare_ranges): New function.
1307 (set_fields): Rewrite the part that populates range_start_ht,
1308 merging it with the part that populates printable_field.
1309 (main): Handle --complement.
1311 2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
1313 * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1314 failed. This works around an assertion failure reported by
1316 http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1318 2004-12-02 Jim Meyering <jim@meyering.net>
1320 With using --color and with LS_COLORS saying not to color
1321 executables, don't stat every file.
1322 * src/ls.c (is_colored): New function.
1323 (gobble_file): Use it.
1324 (main): Use it here, in place of too-strict tests against NULL:
1325 if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1326 old test would fail.
1328 2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
1330 * src/comm.c (compare_files): Assume setlocale exists.
1331 * src/join.c (keycmp): Likewise.
1332 * src/seq.c (decimal_point): Treat like sort. Now char.
1334 (main): Assume localeconv exists. Use same code as sort.
1335 * src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
1336 Assume setlocale exists.
1337 (thousands_sep): Renamed from th_sep.
1338 (IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
1339 (NONZERO): Parenthesize use of arg.
1340 (numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
1341 consistency. Avoid unnecessary negation by reversing
1343 (main): Rewrite localeconv call to match seq.c.
1344 * src/system.h: Assume locale.h exists.
1345 (HAVE_SETLOCALE): Remove.
1346 * src/uniq.c (different): Assume setlocale exists.
1348 * src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
1349 'volatile' on a local variable. Rewrite to avoid unnecessary
1350 double-assignment to 'func' in the usual case where strcoll does
1353 2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
1355 * src/pinky.c (gethostname): Remove decl.
1356 (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1357 * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1358 UT_TYPE_BOOT_TIME instead of by-hand code.
1359 * src/users.c (list_entries_users): Use IS_USER_PROCESS
1360 instead of by-hand code.
1361 * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1362 DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1363 (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1364 (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1365 UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1366 (gethostname): Remove decl.
1367 (list_entries_who, scan_entries): Use the new macros defined above,
1368 for consistency with pinky, uptime, and users.
1370 2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
1372 Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1373 HP's ANSI C compiler. Declaring int functions causes warnings on
1374 some modern systems and shouldn't be needed to compile on ancient
1376 * src/copy.h (stat, lstat, rename): Remove decls.
1377 * src/install.c (stat): Remove decl.
1378 * src/ln.c (link, symlink): Remove decls.
1380 2004-11-25 Jim Meyering <jim@meyering.net>
1382 * man/help2man: Import help2man-1.35.1.
1383 * man/Makefile.am (.x.1): Remove now-unnecessary use of
1384 locally-added --program-name=NAME option. Now, help2man gets
1385 the name from the [NAME] section (i.e. from our .x file).
1386 * man/install.x: Use `install', not `ginstall' in the one-line
1387 description. Reported by Brendan O'Dea.
1388 * man/sha1sum.x: Use `sha1sum', not `shasum'.
1390 2004-11-24 Jim Meyering <jim@meyering.net>
1392 Since the changes of 2004-05-22, the u.saved_cwd member at
1393 the bottom of the active-directory stack was no longer
1394 strictly necessary. This change removes that member and uses
1395 the newer cwd_state parameter for the final restore_cwd.
1397 * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1398 [dev_ino]: Rename from `a'.
1399 (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1400 bottom-of-stack cwd-state member.
1401 (AD_pop_and_chdir): No longer return boolean. Adjust caller.
1402 (AD_push_initial): Remove CWD parameter. Adjust caller.
1404 2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
1406 Minor performance improvements and cleanups for "touch".
1407 * src/touch.c (posix_date): Remove; not needed as a static var.
1409 (touch): Use new futimens function to operate more efficiently
1410 in some cases. Don't stat/fstat existing file when
1411 (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1412 old time stamps aren't needed in that case.
1413 (main): change_times is int, not bool. Simplify test for
1416 2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
1418 * src/install.c (usage): Avoid usage that runs afoul of Docbook
1419 translation. Problem reported by Eric S. Raymond.
1421 Restore dd's noctty flag, reverting the change of 2004-04-08.
1422 POSIX does not allow "dd" to use O_NOCTTY by default.
1423 * NEWS: Add noctty flag to dd.
1424 * doc/coreutils.texi (dd invocation): Likewise.
1425 * src/dd.c (flags, usage, main): Likewise.
1427 2004-11-19 Alfred M. Szmidt <ams@gnu.org>
1429 * src/ls.c (usage): Clarified description of --no-group (-G),
1430 --human-readable (-h), --inode (-i), --size (-s), --time,
1433 2004-11-19 Jim Meyering <jim@meyering.net>
1435 * src/ls.c (usage): Clarify description of --author.
1436 Tweak indentation so that help2man creates better nroff.
1437 Reported by Dan Jacobson.
1439 * src/uniq.c (check_file): Don't check stdout for errors here.
1441 * src/pwd.c (find_dir_entry): Update comment to match reality.
1443 2004-11-18 Jim Meyering <jim@meyering.net>
1445 * src/pwd.c (robust_getcwd): Correct the comment: this function
1446 constructs the directory name. The caller prints it.
1448 2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
1450 * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1451 (do_statfs): Use it.
1453 * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1454 src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1455 src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1456 src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1457 src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1458 * src/readlink.c (main): argv is not const.
1460 * src/cut.c (usage): Improve documentation along the lines suggested
1462 * src/echo.c (usage): Likewise.
1463 * src/expr.c (usage): Likewise.
1465 * src/dircolors.hin: Add putty, screen-bce.
1467 * src/pinky.c (print_entry): Fix memory leak.
1468 * src/who.c (print_user): Likewise.
1470 2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
1472 * NEWS: New dd operand "status=noxfer".
1473 * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1474 C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1475 C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1477 (STATUS_NOXFER, statuses): New constants.
1478 (usage, print_stats, scanargs): Add support for status=noxfer.
1479 (usage): Update status output to match new behavior.
1480 (print_stats): Always output complete byte count.
1481 Put space between numbers and units, as SI requires.
1482 Use ngettext so that i18n can use plurals for "byte" and "second".
1483 Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1484 (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1486 * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1487 problems with regression testing.
1489 2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
1491 * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1492 * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1493 * src/dd.c: Include "human.h".
1494 (w_bytes, start_time): New vars.
1495 (usage): Document new I/O statistics output
1496 (print_stats): Output new I/O statistics.
1497 (cleanup): Do statistics after closing stdin and stdout, so that
1498 the times are more accurate.
1499 (write_output, dd_copy): Count output bytes.
1500 (main): Get initial value of clock.
1502 2004-11-14 Jim Meyering <jim@meyering.net>
1504 Backslash-escape `-'s in email addresses, so that they are
1505 rendered properly in UTF-locales.
1506 * man/help2man (escape_hyphens): New function.
1507 (main): Call it on email addresses.
1509 * src/sort.c (zaptemp): Mark new diagnostic for translation.
1511 * tests/misc/close-stdout: New file. Test today's closeout.c change.
1512 * tests/misc/Makefile.am (TESTS): Add close-stdout.
1514 2004-11-13 Jim Meyering <jim@meyering.net>
1516 * src/test.c (usage): Put the description of `[-n] STRING'
1517 on two lines, one for `-n STRING' and one for `STRING' so that
1518 help2man properly escapes the `-'. Otherwise, the hyphen is
1519 rendered inappropriately in UTF-8 locales.
1520 Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1522 2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
1524 * NEWS: Document the following changes.
1526 * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1528 (temptail): New variable, so that we can easily append to list.
1529 (create_temp_file): Create new files at end of list, so that
1530 searching the list has O(N*NMERGE) behavior instead of O(N**2).
1531 (zaptemp): Update temptail if needed.
1532 (mergefps, merge): Accept new arg that counts temp files, and keep it
1533 up to date as we create and remove temporaries. This is for
1534 efficiency, so that we don't call zaptemp so often.
1535 All callers changed.
1536 (sort): Don't create array in reverse order, since the list of
1537 temporaries is now in the correct order.
1539 (zaptemp): Protect against race condition: if 'sort' is
1540 interrupted in the middle of zaptemp, it might unlink the
1541 temporary file twice, and the second time this happens the file
1542 might already have been created by some other process.
1544 (zaptemp): Warn if a temporary file is not removed.
1546 (create_temp_file): Use offsetof for clarity.
1547 (die): Move it up earlier, to clean up the code a bit.
1549 * src/pr.c (strtoumax): Declare if not declared.
1550 (skip_to_page, first_page_number, last_page_number, page_number,
1551 first_last_page, print_header):
1552 Use uintmax_t for page numbers.
1553 (first_last_page): Remove unnecessary forward declaration.
1554 Do not modify arg (it is now a const pointer).
1555 Return a true if successful, false (without print a diagnostic)
1557 (main): If +XXX does not specify a valid page range, treat it
1558 as a file name. This follows the response to Open Group XCU ERN 41
1559 <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1560 which says the behavior is allowed.
1561 (skip_to_page): When starting page number exceeds page count,
1562 print both numbers in the diagnostic.
1563 (print_header): Detect page number overflow.
1565 2004-11-07 Jim Meyering <jim@meyering.net>
1567 * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1568 (main) [__APPLE__]: Get the processor type via syscall rather than
1569 hard-coding "powerpc". From Toby Peterson.
1571 * src/sort.c (merge): Remove declarations of now-unused variables.
1573 2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
1575 * src/sort.c (first_same_file): Remove. Move most of the code to....
1576 (avoid_trashing_input): New function.
1577 (merge): Avoid some silly merges, e.g., copying a single file to
1578 a temporary file when there are exactly 17 input files to merge.
1579 Take a count of temporary files rather than a max_merge arg.
1582 2004-11-06 Jim Meyering <jim@meyering.net>
1584 * src/sort.c (xfclose): Don't close stdout here (just flush it),
1585 since close_stdout now closes stdout unconditionally.
1587 2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
1589 * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1590 first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1591 This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1593 (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1594 thus avoiding unchecked stack overflow in some cases. As a side
1595 effect this improve the performance of "sort -M" by a factor of 4
1598 2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
1600 * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1602 * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1603 expression; it's not portable. Problem reported by Albert Chin.
1604 Don't invoke a program more than once.
1605 * src/groups.sh (version): New variable, containing author info,
1606 for benefit of AUTHORS check. Use it when acting on --version option.
1607 * AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
1610 * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1611 as this breaks the new regime that does "#define getopt rpl_getopt".
1612 Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1613 http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1614 I suppose this may cause problems on ancient hosts with
1615 incompatible getopt declarations, but we'll cross that bridge if
1616 the problem gets reported to us by someone who can test the fix.
1618 2004-11-03 Jim Meyering <jim@meyering.net>
1620 * src/tac.c: quote(...) file names in diagnostics.
1622 2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
1624 * NEWS: Document getdate changes.
1626 2004-10-29 Jim Meyering <jim@meyering.net>
1628 * src/tac.c (tac_file): Remove temporary prototype and move this
1629 function `down' so that it precedes definition of tac_nonseekable.
1631 `tac /proc/modules' would print nothing
1632 Reported by Harald Dunkel in http://bugs.debian.org/278604.
1634 * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1635 now it copies a general file descriptor, not just stdin.
1636 (tac_nonseekable): Renamed/adapted from tac_stdin.
1637 (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1638 since we never used the stream. Perform "-" to stdin mapping here
1639 rather than in main. Determine whether a file is seekable,
1640 by trying to `lseek' to its end, and dispatch to tac_seekable or
1641 tac_nonseekable accordingly.
1642 (main): Rewrite argument handling now that it uses only tac_file.
1643 * NEWS: Mention it here.
1645 2004-10-21 Jim Meyering <jim@meyering.net>
1647 * tests/mv/leak-fd: New file.
1648 * tests/mv/Makefile.am (TESTS): Add it.
1649 * tests/rm/dot-rel: New file.
1650 * tests/rm/Makefile.am (TESTS): Add it.
1652 Correct my patch of 2004-10-18.
1653 * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1654 if necessary, not in remove_dir. Otherwise, removing multiple
1655 `.'-relative nonempty directories no longer worked.
1657 2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
1659 * src/fmt.c (usage): Improve description of --prefix.
1660 Problem reported by Edward Welbourne.
1662 * man/uniq.x: Change summary so that it doesn't imply that
1663 uniq writes to its input file. Problem reported by
1666 2004-10-18 Jim Meyering <jim@meyering.net>
1668 Plug a leak that would cause a cross-device mv to fail when
1669 operating on too many command-line-specified nonempty directories.
1670 * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1671 top of the stack before returning. This usually closes the file
1672 descriptor that was used to return to the original working directory.
1673 Reported by Cyril Bouthors in
1674 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1675 * NEWS: Mention it here.
1677 * src/pathchk.c (validate_file_name): Give a more descriptive
1678 diagnostic when pathconf fails. This also avoids an unwarranted
1679 warning from gcc-3.3.5 about a format not being a string literal.
1681 * src/sleep.c (main): Remove declaration of unused local, c.
1682 * src/printenv.c (main): Likewise.
1683 * src/logname.c (main): Likewise.
1684 * src/uptime.c (main): Likewise, for optc.
1685 * src/tsort.c (main): Likewise, for opt.
1687 2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
1689 * AUTHORS: Add self to pathchk.
1690 * src/pathchk.c (AUTHORS): Add self.
1691 Change "path" to "file name" whenever possible.
1692 Remove usage comment, as it was a duplication of the code or doc.
1693 Include <wchar.h> if available.
1694 (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1695 (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1696 pathconf_wrapper, portable_chars, dir_ok): Remove.
1697 (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1698 (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1699 (portable_chars_only): New arg FILELEN.
1700 Don't assume ASCII; we might be on an EBCDIC host.
1701 Don't assume unibyte locale in diagnostic.
1702 (component_start, component_len): New functions.
1703 (validate_file_name): Renamed from validate_path. All uses changed.
1704 Pretty much a complete rewrite.
1705 Don't make copy of file arg. Always append trailing slash to
1706 pathconf arg, just in case it's a symlink (this is pure paranoia;
1707 we don't know of any hosts where the trailing slash is required).
1708 Use size_t instead of long int when possible.
1709 Avoid need to call pathconf in most practical cases.
1710 Don't use euidaccess several times to test searchability;
1711 just use lstat once. Reword diagnostic to put the (often very long)
1714 2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
1716 * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1718 2004-10-13 Jim Meyering <jim@meyering.net>
1720 * NEWS: Mention today's fts.c fix.
1722 2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
1724 * tests/stty/row-col-1: Set LC_ALL=C.
1726 2004-10-12 Jim Meyering <jim@meyering.net>
1728 * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
1729 From Jesus Climent in http://bugs.debian.org/276149.
1731 2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
1733 * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
1734 problems. All uses changed.
1736 2004-10-05 Jim Meyering <jim@meyering.net>
1738 * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
1739 since Karl says its trailing blanks are there to stay :-)
1741 2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
1743 * src/expr.c (NEW, OLD): Remove, partly to avoid
1744 reference to obsolescent macro XMALLOC.
1745 All uses replaced by xmalloc and free.
1747 2004-09-28 Jim Meyering <jim@meyering.net>
1749 * src/tail.c (usage): Clarify: --retry works only with --follow=name.
1750 Reported by Nik A. Melchior in http://bugs.debian.org/273781.
1752 2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
1754 * src/od.c (format_address_paren): c is optional, so don't output
1757 2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
1759 Add support for ls --hide. Idea suggested by Bardur Arantsson.
1760 * NEWS: Document this.
1761 * src/ls.c (file_ignored): Renamed from file_interesting, with
1762 inverted return value. Accept the file name, not a struct dirent *.
1763 All uses changed. Avoid the expense of calling fnmatch if the
1764 file is ignorable due to leading '.'.
1765 (all_files, really_all_files): Removed; replaced by:
1766 (ignore): New variable. All uses changed.
1767 (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
1769 (hide_patterns): New variable.
1770 (long_options, decode_switches, file_ignored, usage):
1771 Add support for --hide.
1772 (patterns_match): New function.
1773 (usage): Replace "hide" with "ignore" in explanation, to avoid
1776 2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
1778 * src/ls.c (gobble_file, print_long_format): Don't assume that
1779 human-readable output has a byte count equal to its column width;
1780 this isn't always true in locales where the radix character is not
1782 (format_user_or_group): Revamp code to match the above fix;
1783 this avoids the (very faint) possibility of integer overflow.
1785 2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
1787 * NEWS: Mention that "chmod -r -w x" now works as expected.
1788 * src/chmod.c (main): Revamp option processing to support this.
1789 * tests/chmod/Makefile.am (TESTS): Add 'usage'.
1790 * tests/chmod/usage: New set of tests for usage like that.
1792 2004-09-24 Jim Meyering <jim@meyering.net>
1794 * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
1795 it lists only cvs-controlled regular files.
1797 * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
1798 to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
1800 2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
1802 * Makefile.maint (CVS_LIST): New macro.
1803 (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
1804 sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
1805 sc_trailing_blank, po-check): Use it instead of the
1806 nonstandard "cvsu --list".
1808 * src/tail.c (parse_obsolete_option): Bring back support
1809 for obsolete option followed by non-obsolete, or by more
1810 than one file. When obsolete, conform to SUSv2 rather than
1811 original POSIX 1003.2-1992, as SUSv2 corrected the case of
1812 "tail -c". Add support for the SUSv2 "b" modifier.
1813 * NEWS: Mention the above.
1814 * tests/tail/Test.pm: New test case obs-b to check the above.
1815 err-[134] no longer need _POSIX2_VERSION=199209.
1816 Fix comments to match revised behavior.
1818 2004-09-22 Jim Meyering <jim@meyering.net>
1820 * Use automake-1.9.2. Regenerate dependent files.
1822 * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
1823 Improve the comment.
1825 Clean up scoping etc. so that some make `distcheck' tests pass.
1826 * src/csplit.c (xalloc_die): Declare to be static.
1827 * src/chown-core.c (chown_files): Declare as `extern'.
1828 * src/cp-hash.c (remember_created): Likewise.
1829 * src/copy.c (copy): Likewise.
1830 * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
1832 * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
1833 * src/unexpand.c: Likewise.
1835 * src/Makefile.am (check-AUTHORS): New rule.
1836 (check): Depend on it.
1839 * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
1840 (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
1842 2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
1844 * src/ls.c (decode_switches): Don't compare a short value
1845 to SIZE_MAX: GCC sometimes complains.
1847 2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
1849 * NEWS: The following commands now reject unknown options:
1850 basename dirname factor hostname link nohup sync unlink yes
1851 Also, pathchk no longer accepts trailing options.
1853 * src/basename.c: Include <getopt.h>.
1854 * src/chroot.c: Likewise.
1855 * src/dirname.c: Likewise.
1856 * src/factor.c: Likewise.
1857 * src/hostid.c: Likewise.
1858 * src/hostname.c: Likewise.
1859 * src/nohup.c: Likewise.
1860 * src/pwd.c: Likewise.
1861 * src/setuidgid.c: Likewise.
1862 * src/sync.c: Likewise.
1864 * src/basename.c (main): Reject unknown options.
1865 * src/dirname.c (main): Likewise.
1866 * src/factor.c (main): Likewise.
1867 * src/hostid.c (main): Likewise.
1868 * src/hostname.c (main): Likewise.
1869 * src/link.c (main): Likewise.
1870 * src/nohup.c (main): Likewise.
1871 * src/pwd.c (main): Likewise.
1872 * src/setuidgid.c (main): Likewise.
1873 * src/sync.c (main): Likewise.
1874 * src/unlink.c (main): Likewise.
1875 * src/yes.c (main): Likewise.
1877 * src/cat.c (main): Remove unused "case 0".
1878 * src/chgrp.c (main): Likewise.
1879 * src/chmod.c (main): Likewise.
1880 * src/chown.c (main): Likewise.
1881 * src/comm.c (main): Likewise.
1882 * src/cp.c (main): Likewise.
1883 * src/csplit.c (main): Likewise.
1884 * src/cut.c (main): Likewise.
1885 * src/date.c (main): Likewise.
1886 * src/df.c (main): Likewise.
1887 * src/du.c (main): Likewise.
1888 * src/env.c (main): Likewise.
1889 * src/expand.c (main): Likewise.
1890 * src/fold.c (main): Likewise.
1891 * src/head.c (main): Likewise.
1892 * src/id.c (main): Likewise.
1893 * src/install.c (main): Likewise.
1894 * src/join.c (main): Likewise.
1895 * src/ln.c (main): Likewise.
1896 * src/ls.c (decode_switches): Likewise.
1897 * src/mkdir.c (main): Likewise.
1898 * src/mkfifo.c (main): Likewise.
1899 * src/mknode.c (main): Likewise.
1900 * src/mv.c (main): Likewise.
1901 * src/nl.c (main): Likewise.
1902 * src/paste.c (main): Likewise.
1903 * src/pinky.c (main): Likewise.
1904 * src/pr.c (main): Likewise.
1905 * src/ptx.c (main): Likewise.
1906 * src/readlink.c (main): Likewise.
1907 * src/rm.c (main): Likewise.
1908 * src/rmdir.c (main): Likewise.
1909 * src/seq.c (main): Likewise.
1910 * src/shred.c (main): Likewise.
1911 * src/split.c (main): Likewise.
1912 * src/sum.c (main): Likewise.
1913 * src/tac.c (main): Likewise.
1914 * src/tail.c (main): Likewise.
1915 * src/tee.c (main): Likewise.
1916 * src/touch.c (main): Likewise.
1917 * src/tr.c (main): Likewise.
1918 * src/tty.c (main): Likewise.
1919 * src/uname.c (main): Likewise.
1920 * src/unexpand.c (main): Likewise.
1921 * src/wc.c (main): Likewise.
1922 * src/who.c (main): Likewise.
1924 * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
1925 * src/cksum.c (main): Likewise.
1926 * src/dd.c (main): Likewise.
1927 * src/logname.c (main): Likewise.
1928 * src/printenv.c (main): Likewise.
1929 * src/sleep.c (main): Likewise.
1930 * src/tsort.c (main): Likewise.
1931 * src/uptime.c (main): Likewise.
1932 * src/users.c (main): Likewise.
1933 * src/whoami.c (main): Likewise.
1935 * src/du.c (long_options): Standardize on NULL vs 0.
1936 * src/rm.c (long_opts): Likewise.
1938 * src/logname.c (long_options): Remove.
1939 * src/printenv.c (long_options): Likewise.
1940 * src/sleep.c (long_options): Likewise.
1941 * src/tsort.c (long_options): Likewise.
1942 * src/uptime.c (longopts): Likewise.
1943 * src/users.c (longopts): Likewise.
1944 * src/whoami.c (long_options): Likewise.
1946 * src/pathchk.c (longopts): Add --help, --version.
1947 (main): Use longopts rather than parse_long_options.
1948 * src/stty.c (longpts, main): Likewise.
1950 * src/pathchk.c (main): Don't reorder arguments, so that
1951 we can check weird file names.
1953 * src/readlink.c: Don't include "long-options.h".
1954 * src/sort.c: Likewise.
1955 * src/stty.c: Likewise.
1957 * src/split.c (verbose): Now bool, not int.
1958 (VERBOSE_OPTION): New enum.
1959 (longopts, main): Use it.
1961 * tests/factor/basic: Adjust to new wording in diagnostic
1962 that results from the above changes.
1964 2004-09-21 Jim Meyering <jim@meyering.net>
1966 * man/rm.x: Say "the response is affirmative" rather than "the
1967 response begins with y or Y", so that the documentation is
1968 accurate in non-English locales. Problem reported by Munzir Taha.
1970 2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
1972 * src/echo.c (main): Don't pass NULL to strcmp when
1973 POSIXLY_CORRECT and given no arguments.
1975 * src/md5sum.c (STRING_OPTION): Remove.
1976 (long_options, main): Remove support for undocumented and
1977 obsolete --string option, as suggested in the 1996-09-26 patch.
1978 * NEWS: Document this.
1980 * tests/rm/fail-eperm: Don't try to remove writeable files in a
1981 sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
1982 you remove such files. Problem reported by Bert Fischer in:
1983 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
1985 2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
1987 * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
1988 (long_options, main): Use them instead of magic numbers 2 and 1.
1989 For --string, optarg can't possibly be NULL.
1991 * src/dd.c (usage): Distinguish between options and operands.
1992 (scanargs): Don't mess with argc, argv; getopt_long handles this now.
1993 Say "operands" for operands, not "options".
1994 (main): Use getopt_long, so that "dd --" works as POSIX requires.
1995 * tests/dd/misc: Check for "dd --".
1997 * src/chroot.c (main): Reject unknown options instead of
1998 interpreting them as a directory to chroot to.
2000 * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2001 The current standard (POSIX 1003.1-2004) is correct.
2002 (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2003 collision with builtin function.
2004 (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2005 output the first 0 as 8 digits, to make it easier to compare to
2006 the text of the standard. Output crctab to be a const array.
2007 (crctab): Use result of above changes.
2008 (long_options): Remove; not needed if empty.
2009 (main): getopt_long can't return 0 here, so simplify the code.
2011 2004-09-13 Jim Meyering <jim@meyering.net>
2013 * src/Makefile.am (localedir.h): Don't redirect directly to target.
2015 2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
2017 * src/id.c (print_full_info): Don't exit with failure status simply
2018 because a user or group number can't be turned into a name.
2019 Problem reported by Felipe Kellermann in:
2020 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2022 2004-09-12 Jim Meyering <jim@meyering.net>
2024 * Makefile.maint (my-distcheck): When building with -Werror, also
2027 2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
2029 * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2030 * src/tail.c (parse_obsolete_option): Renamed from
2031 parse_obsolescent_option, since the options are obsolete now.
2032 Remove bool *arg; just exit if there's an error. Revamp to follow
2033 POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2034 file" and "tail -10 -- file" correctly when we are conforming to
2036 (main): Adjust to this change.
2037 * tests/tail/Test.pm (test_vector): minus-* requires
2038 _POSIX2_VERSION=199209 now, to work correctly if there is
2039 an input file. err-1 and err-3 no longer errors if there
2042 2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
2044 * src/test.c (usage): Document -r, -w, -x more carefully.
2046 2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
2048 * src/test.c (usage): Document "test" (with no args) and "[ ]".
2049 Document that -h and -L don't dereference.
2051 * NEWS: Document that "tr xy -z" now works as per POSIX.
2052 Sort the descriptions.
2053 * src/tr.c (main): Don't reorder options.
2054 * tests/tr/Test.pm (fowler-1): New test case.
2056 2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
2058 * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2059 MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2060 conforming to pre-2001 POSIX.
2061 * NEWS: Document this.
2062 * tests/touch/obsolescent: Test for this bug. Also, set
2063 _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2064 a better test for obsolescent features.
2066 * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2067 "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2070 * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2071 (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2072 (long_options, main): --strings is now -S, not -s.
2073 (usage): Reflect the usage changes.
2074 (parse_old_offset): Do not issue a diagnostic on failure;
2075 callers now do this as necessary.
2076 (main): Support POSIX syntax. Remove unused case 0 from getopt_long.
2077 Add support for new short options (many undocumented) for
2078 compatibility with FreeBSD. Remove FIXME for -s; it's now
2079 POSIX-compatible. Default format is now oS, not o2.
2080 * NEWS: Describe the above.
2082 2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
2084 * src/stty.c (valid_options): Remove.
2085 (main): Fix some bugs in handling invalid option-combinations
2087 (recover_mode): Arg is now char const *, not char *.
2088 (main): Use STDIN_FILENO, not 0.
2089 Simplify option-parsing code a tad.
2090 * tests/stty/basic-1: Check for the fixed bugs.
2092 2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
2094 * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2095 it from ever being nonzero. Reported by Pozsar Balazs in:
2096 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2097 (human_fstype): Add ramfs, squashfs, sysfs.
2098 Reported by Pozsar Balazs in:
2099 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2100 (human_fstype): Return char const *, not char *.
2101 Simplify internals a bit, and avoid casts.
2103 * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2104 (bit_count): Remove. All uses changed to....
2105 (multiple_bits_set): New function.
2106 (scanargs): Use it, and check separately for each set of
2107 incompatible options, to improve diagnostics.
2109 (apply_translations): Move checks for incompatible options
2110 to scanargs, so that they're done consistently.
2112 2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
2114 Output correct errno-related diagnostic on "paste" I/O errors.
2115 * src/paste.c (write_error, xputchar): New functions.
2116 (paste_parallel): Use correct errno value after input error.
2117 (paste_parallel, paste_serial): Report errno value after output error.
2119 Port to diet libc. Problem reported by Felix von Leitner in:
2120 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2121 * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2122 it's not portable C to assume FILE is a complete type.
2123 (paste_parallel): Use index test instead of ENDLIST, and NULL
2126 2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
2128 POSIX-conformance fixes for "expand" and "unexpand".
2129 Also, consistently use "tab stop" rather than "tabstop".
2130 * NEWS: Document fixes.
2131 * src/expand.c: Revamp to resemble the new unexpand.c better.
2132 (usage): -i does not convert tabs after non-tabs.
2133 (add_tab_stop): Renamed from add_tabstop. All uses changed.
2134 (parse_tab_stop): Renamed from parse_tabstop. All uses changed.
2135 (validate_tab_stop): Renamed from validate_tabstop. All uses changed.
2136 (next_file, main): Check fclose against 0, not EOF.
2137 (expand): Remove unnecessary casts.
2138 Add another loop nesting level, for lines, so that per-line variables
2139 are initialized cleanly.
2140 Revamp tab checking. Check for write error immediately, rather
2141 than just once at the end of the program.
2142 * src/unexpand.c: Lkewise (for the expand.c changes).
2143 (TAB_STOP_SENTINEL): Remove.
2144 (tab_size): Now size_t, not uintmax_t, since we need to store
2145 the sequences of blanks.
2146 (max_column_width): New var.
2147 (usage): Say "blank" where POSIX requires this.
2148 (add_tab_stop): Calculate maximum column width.
2149 (unexpand): Store the pending blanks, instead of merely counting them.
2150 Follow POSIX's rules about -a requiring two blanks before a tab stop.
2151 Get rid of internal label and goto.
2152 * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2153 Add blanks-1 through blanks-13.
2155 2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
2157 * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2158 succeed without changing the uid and gid, like FreeBSD.
2159 * src/chgrp.c (parse_group): Return gid_t rather than storing it
2160 through a pointer. Treat "chgrp '' file" as a no-op change,
2162 (main): Set chopt.group_name to NULL if the group is the empty
2164 * src/chown-core.c (describe_change): Describe changes to -1:-1
2165 without using "to OWNERSHIP" phrase.
2166 * src/chown.c (usage): "chown '' file" is now allowed.
2167 (main): Do not set user name to the empty string if the group
2169 * tests/chgrp/basic: Test "chgrp '' file".
2170 * tests/chown/Makefile.am (TESTS): Add separator.
2171 * tests/chown/separator: New file, partly taken from
2172 Dmitry V. Levin's suggestion in
2173 <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2175 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
2177 * tests/install/basic-1: Test for the -d regression.
2179 2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
2181 * src/install.c (main): Fix -d regression introduced with
2182 --target-directory support at 2004-06-25.
2184 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
2186 * src/copy.c (copy_internal): When preserving links, unlink
2187 a destination with link count greater than one. This is so
2188 that commands like "cp -a" don't get confused when copying into
2189 a destination that already contains many hard links. Problem
2190 reported by Tim Waugh in:
2191 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2193 2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
2195 Convert all files to UTF-8.
2196 * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2197 * tests/sort/Test.pm (16a): Likewise.
2198 * tests/uniq/Test.pm (8): Likewise.
2199 * tests/misc/printf-hex: Use ASCII, not Latin-1.
2201 * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2202 * src/shred.c (usage): "-" is an operand, not an option.
2203 * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2204 A null file arg means standard output.
2205 (main): "-o -" means to write to a file named "-",
2206 not to standard output.
2207 * src/tee.c (usage, tee): "tee -" writes to standard output, not
2208 to a file named "-".
2210 2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
2212 * src/install.c (change_timestamps): Fix int->bool conversion
2213 bugs introduced on 2004-07-29.
2215 2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
2217 * src/shred.c (wipename): Work even if the directory is writeable
2218 and not readable. Prefer write access, since this should work
2219 better with fdatasync.
2221 * src/csplit.c (xalloc_die): New function.
2222 (main): Remove now-obsolete initialization of xalloc_fail_func.
2224 * src/md5sum.c: Adjust to sha->sha1 renaming.
2226 2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
2229 * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2230 (can_mode): Make variable local.
2232 2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
2234 * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2235 Do not define, to avoid annoying compiler messages on QNX 6.3.
2236 Problem reported by Johan in:
2237 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2239 2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
2241 * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2242 Define to a concatenation of string literals, not to an expression;
2243 needed for concatenation contexts.
2244 (INTMAX_MAX, INTMAX_MIN): New macros.
2246 * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2247 unsigned long; this isn't true for st_ino on Solaris 9.
2249 2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
2251 * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2252 whether to include files. Include <sys/param.h> if
2253 HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2254 (main) [defined __POWERPC__]: Add a kludge to work around a
2255 Mac OS X bug, so that uname -p defaults to "powerpc" if
2256 sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2257 fails. Problem reported by Petter Reinholdtsen in:
2258 http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2260 * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2261 main): Use bool for booleans.
2262 (writeline, check_file): Use uintmax_t for line counts.
2263 (check_file): Check for and report line number overflow,
2265 * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2266 (print_lines, print_words, print_chars, print_bytes, print_linelength,
2267 have_read_stdin, wc, wc_file, main):
2268 Use bool for booleans.
2269 (exit_status): Remove.
2270 (wc, wc_file): Return bool status. All callers changed.
2271 * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2272 * src/whoami.c (main): Print uids using unsigned long int, not
2275 * src/unexpand.c: Int cleanup and minor reorganization to be more
2277 Include quote.h, xstrndup.h.
2278 (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2279 (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2281 Use bool for booleans.
2282 (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2283 Use uintmax_t for column counts.
2284 (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2285 (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2287 (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2288 Detect overflow in tab stop string.
2289 (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2290 (unexpand): Concatenate input files the same way expand does.
2292 * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2293 touch, main): Use bool for booleans.
2294 (main): Avoid integer overflow when given more than INT_MAX
2296 * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2297 (have_read_stdin, count_items, scan_zeros, detect_loop,
2298 recurse_tree, walk_tree, tsort, main):
2299 Use bool for booleans.
2300 (exit_status): Remove.
2301 (tsort): Return a success flag instead of storing into a global.
2303 * src/tty.c (silent, main): Use bool for booleans.
2304 (main): 0 -> STDIN_FILENO.
2305 * src/uname.c (print_element): Use bool for booleans.
2307 * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2308 Remove. All uses replaced by C99 boolean primitives.
2309 (TEST_TRUE, TEST_FALSE): New constants, for readability.
2310 (test_unop, binop, unary_operator, binary_operator, two_arguments,
2311 three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2312 one_argument, main): Use bool for booleans.
2313 (advance, unary_advance): Now inline procedures rather than a macros.
2314 (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2315 (term, and, or): When it's easy, loop instead of recursing.
2316 (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2317 (binary_operator, unary_operator): Simplify by systematically rewriting
2318 true==FOO to FOO (where FOO is a boolean).
2319 (unary_operator): Don't consider a file to be a regular file
2320 merely because its mode&S_IFMT is zero. Just use S_ISREG.
2321 Remove unnecessary casts. Remove ifdefs for things like
2322 S_ISSOCK that are no longer needed, since stat-macros.h always
2325 * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2326 Use bool for booleans.
2327 (buf_init_from_stdin, buf_free, find_bol, print_line):
2328 Use size_t for sizes.
2329 * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2330 tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2331 (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2332 (tac_seekable): Use ptrdiff_t for pointer subtraction.
2333 Report an error if the result is out of range.
2334 (tac_seekable, main): Check for integer overflow in buffer size
2336 (main): Remove unnecessary casts.
2338 * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2339 the callee doesn't have to count 'em. All callers changed.
2340 Don't allocate more space for the arg vector than we'll need.
2341 Use memcpy to copy the args rather than rolling our own loop.
2342 Use size_t for sizes.
2343 (fast_startup, simulate_login, change_environment, log_su,
2344 correct_password, restricted_shell, main): Use bool for booleans.
2345 (longopts): Don't assume change_environment is an int.
2346 Use NULL, not 0, for pointers.
2347 (xsetenv): New function, replacing xputenv and concat.
2348 All callers changed.
2349 (elements): Remove; no longer needed.
2350 (log_su, correct_passwd, main): Prefer !x to x==NULL.
2351 (log_su): 2 -> STDERR_FILENO.
2352 (modify_environment, main): Don't assume that getenv's returned value
2353 has an indefinite lifetime.
2354 (modify_environment): Allocate a larger environ.
2355 (main): Remove an impossible 'case 0'; if it happens now, it'll
2356 get diagnosed. Don't assume getpwnam results outlive endpwent.
2357 Check for null or empty pw_name, pw_dir and for null pw_passwd.
2359 * src/stty.c (VA_START): Remove. All callers now use va_start.
2360 (_POSIX_VDISABLE): Remove unnecessary cast.
2361 (struct control_info, visible): Use cc_t for control chars.
2362 (struct control_info): Use size_t for sizes.
2363 (recover_mode, set_mode, display_speed, display_window_size,
2364 valid_options, main, display_changed):
2365 Use bool for booleans.
2366 (integer_arg): Return unsigned long int, not long int.
2367 Accept new max arg; all callers changed, to specify a maximum
2368 value for integer parameters instead of silently overflowing.
2369 (wrap): Do not overrun the stack buffer if the output contains
2370 more than 1024 bytes. Instead, malloc a buffer.
2371 (main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
2372 Remove unnecessary casts.
2373 (set_control_char): Allow int values only up to cc_t range.
2374 (screen_columns): Don't reject INT_MAX.
2375 (display_changed, display_all, display_speed, recover_mode):
2376 Don't assume cc_t fits in int.
2378 * src/remove.h: Add copyright notice.
2379 (struct rm_options): Use bool for booleans.
2380 * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2381 errno_rmdir_non_empty, remove_parents, main): Likewise.
2382 * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2384 (main): Don't dump core if invoked with argv[0]==NULL.
2385 * src/tee.c (tee, append, ignore_interrupts, main, tee):
2386 Use bool for booleans.
2387 (tee): Use ssize_t for read returns.
2389 * src/ptx.c: Add a FIXME mentioning that there are many
2390 unchecked integer overflows in this file.
2391 (gnu_extensions, auto_reference, input_reference, right_reference,
2392 ignore_case, initialize_regex, fix_output_parameters,
2393 output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2394 Use bool for booleans.
2395 (SKIP_SOMETHING, compare_words, digest_break_file,
2396 find_occurs_in_text, fix_output_parameters):
2397 Use to_uchar instead of a caset.
2398 (print_field): Rewrite to avoid cast.
2400 * src/printf.c (posixly_correct): Use bool for booleans.
2401 (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2402 (STRTOX): Rewrite to avoid casts.
2403 (print_esc_char): Arg is char, not int.
2404 * src/readlink.c (canonicalize): Remove. All uses now merely inspect
2406 (no_newline, verbose): Use bool for booleans.
2407 (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2408 * src/shred.c (struct Options, main): Use bool for booleans.
2409 (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2410 * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2411 Use bool for booleans.
2412 * src/stat.c (G_fail): Remove.
2413 (print_statfs): Print various gotta-be-nonnegative values using
2414 unsigned long int, not long int or int.
2415 (do_statfs, do_stat): Return a boolean success flag.
2416 (do_stat, main): Use bool for booleans.
2418 * src/pr.c: Add a FIXME mentioning that there are many
2419 unchecked integer overflows in this file.
2420 (TRUE, FALSE): Remove. All uses replaced by true and false.
2421 (struct COLUMN, read_line, print_page, print_stored, open_file,
2422 skip_to_page, init_fps, parallel_files, align_empty_cols,
2423 empty_line, FF_only, explicit_columns, extremities, keep_FF,
2424 print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2425 print_across_flag, storing_columns, balance_columns,
2426 truncate_lines, join_lines, untabify_input, failed_opens,
2427 numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2428 double_space, ignore_failed_opens, use_col_separator,
2429 pad_vertically, last_line, main, init_parameters, skip_read,
2430 read_line, print_stored):
2431 Use bool for booleans.
2432 (struct COLUMN, char_to_clump, store_char, print_char):
2434 (clump_buff, print_clump): Use char[], not int[], for an array whose
2435 elements are always chars.
2436 (first_last_page, main, getoptarg, balance, add_line_number,
2437 char_to_uclump): Remove unnecessary casts.
2438 (init_parameters): Allocate chars, not ints, for clump_buff.
2439 (print_char): Use to_uchar before invoking ISPRINT.
2440 (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2442 * src/nohup.c (main): Use bool for booleans.
2443 * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2444 * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2445 (portable_chars_only): Use to_uchar rather than a cast.
2446 * src/printenv.c (main): Use bool for booleans.
2447 Do not assume that the environ has at most one matching entry
2448 for each option (integer overflow was possible otherwise).
2450 * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2451 constant. Do not assume PRIdMAX etc. are strings of length 3 or
2453 (struct tspec): Use it. fmt_string is now an array, not
2454 a pointer, as there's little point to the indirection here.
2455 (struct tspec, flag_dump_strings,
2456 traditional, flag_pseudo_start, limit_bytes_to_format,
2457 abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2458 decode_one_format, open_next_file, check_and_close,
2459 decode_format_string, skip, write_block, read_char, read_block,
2460 parse_old_offset, dump, dump_strings, main):
2461 Use bool for booleans.
2462 (struct tspec): Use void *, not char *, for generic pointers.
2463 (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2464 bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2465 Use char, not unsigned int, since char suffices.
2466 (print_s_char, print_char, print_s_short, print_short,
2467 print_int, print_long, print_long_long, print_float,
2468 print_double, print_long_double): Rewrite to avoid casts.
2469 These now take void * arguments, instead of char *.
2470 Use the same body for all functions, except for the choice
2471 of type. Assume C89 to simplify handling of signed char.
2472 (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2473 Rewrite to avoid casts.
2474 (print_named_ascii, print_ascii): Now takes void *, not char *.
2475 (decode_one_format): Use int for printf field widths, not
2476 unsigned int. Pass void * to subsidiary printers,
2477 not char *. Simplify handling of floating-point formats
2478 by factoring out common code dealing with precision and field width.
2479 (decode_format_string): Avoid need for temporary copy of
2480 each decoded struct tspec.
2481 (get_lcm): Remove unnecessary cast.
2482 (main): Fix bug where more than INT_MAX failed decodes were ignored.
2484 2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
2486 * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2487 (enum number_format): Remove.
2488 (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2490 (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2491 (section_del): Now const.
2492 (print_fmt): Remove.
2493 (starting_line_number, page_incr, blank_join, line_no,
2494 print_lineno, proc_text, main):
2495 Use intmax_t for line numbers.
2496 (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2497 Use bool for booleans.
2498 (lineno_format): Now a string, not an enum value.
2499 (build_print_fmt): Remove. All calls removed. This work is
2500 now done within print_lineno.
2501 (build_type_arg): Use size_t for sizes.
2502 (print_lineno): Check for line number overflow.
2503 (proc_text, main): Remove unnecessary cast.
2505 * src/ln.c (symbolic_link, interactive, remove_existing_files,
2506 verbose, hard_dir_link, dereference_dest_dir_symlinks,
2507 do_link, main): Use bool for booleans.
2509 * src/ls.c (struct fileinfo, file_interesting,
2510 extract_dirs_from_files, color_symlink_as_referent,
2511 FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2512 numeric_ids, print_block_size, dired, print_with_color,
2513 check_symlink_color, print_inode, recursive, immediate_dirs,
2514 all_files, really_all_files, qmark_funny_chars,
2515 print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2516 main, decode_switches, parse_ls_color, print_dir, file_interesting,
2517 gobble_file, make_link_path, basename_is_dot_or_dotdot,
2518 extract_dirs_from_files, print_long_format):
2519 Use bool for booleans.
2520 (dir_defaulted): Remove; no longer needed.
2521 (main): Use int to count files, since it suffices for argv.
2522 Rewrite to avoid need for dir_defaulted.
2523 (main, print_dir, gobble_file, get_link_name,
2525 Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2526 (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2527 Remove unnecessary cast to int. Use int instead of unsigned
2528 int to count from 0 to 1.
2529 (get_funky_string, print_type_indicator): Use char for bytes, not int.
2530 (make_link_path): Use NULL for null pointers.
2531 (quote_name): Use to_uchar instead of cast.
2533 * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2534 print_full_info): Use bool for booleans.
2535 (problems): Remove, replacing with....
2536 (ok): New var (inverted from old sense).
2537 (print_user, print_group, print_full_info):
2538 Print uids/gids with %lu, not %u.
2539 (xgetgroups): Don't run out of memory if getgroups or getugroups
2541 * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2543 * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2544 int, since it suffices.
2545 (factor, print_factors): Use size_t for sizes.
2546 (print_factors, do_stdin, main): Use bool for booleans.
2547 * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2548 (fold_file, main): Use bool for booleans.
2549 (fold_file, main): Use size_t for sizes.
2550 (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2551 of prohibiting widths greater than INT_MAX.
2552 * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2553 write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2554 elide_tail_lines_pipe, elide_tail_lines_seekable,
2555 elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2556 string_to_integer, main):
2557 Use bool for booleans.
2558 (main): Rewrite to avoid cast.
2560 * src/csplit.c (struct line): Use size_t for sizes.
2561 (main): Remove unnecessary cast.
2562 * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2563 * src/cut.c (cut_file, main): Use bool for booleans.
2564 * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2565 * src/env.c (main): Likewise.
2566 * src/expr.c (nextarg): Likewise.
2567 * src/env.c (main): Remove unused and nonstandard envp arg.
2569 * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2570 fmt's arbitrary limits.
2571 (TRUE, FALSE): Remove; all uses changed to (true, false).
2572 (main): Use bool for booleans.
2573 Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
2575 (copy_rest): Remove unnecessary cast.
2576 (get_prefix): Rewrite to avoid cast.
2577 (check_punctuation): Use char *, not unsigned char *; C89 requires
2578 this. Avoid off-by-one buffer read overrun when line is empty.
2579 (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2580 Remove unnecessary casts.
2581 * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2584 * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2585 next_file, expand, main):
2586 Use bool for booleans.
2587 (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2589 Use uintmax_t for column counts.
2590 (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2591 All callers changed.
2592 (parse_tabstops): Don't pass a negative char to isblank.
2593 Avoid memory leak with large tab stops.
2594 (validate_tabstops, expand): Don't assume number of tab stops is
2596 (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2597 storing values into exit_status.
2598 (expand): Use same pattern as unexpand for reading chars.
2599 Report an error when input line is too long, instead of silently
2600 screwing up. Do not mishandle tab stops when backspacing left
2603 * src/dircolors.c (have_read_stdin, append_quoted,
2604 dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2605 (dc_parse_stream): Use enum for state, rather than int.
2606 Use ssize_t to store getline result.
2608 * src/dd.c (translation_needed, parse_integer, scanargs,
2609 apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2610 Use bool for booleans.
2611 (translate_buffer): Use to_uchar rather than a cast.
2612 (swab_buffer, copy_simple, copy_with_unblock):
2613 Use size_t for sizes.
2615 * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2616 * src/sleep.c (apply_suffix): Likewise.
2617 * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2618 forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2619 write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2620 tail_forever, tail_bytes, tail_lines, tail, tail_file,
2621 parse_obsolescent_option, parse_options, main): Likewise.
2622 * src/sleep.c (apply_suffix): Invert sense of result.
2623 Use int (not unsigned int) for multiplier, as this generates better
2624 code with some compilers. Simplify code a bit.
2625 * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2626 parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2628 (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2629 make it a bit clearer.
2631 * src/hostname.c: Include "xgethostname.h".
2632 (xgethostname): Remove decl; xgethostname.h has it.
2633 (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2634 && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2635 prototypes rather than K&R form. Assume any negative value from
2636 sysinfo denotes failure, not just -1.
2637 (main): Simplify use of sethostname.
2639 * src/pinky.c (include_idle, include_heading, include_fullname,
2640 include_project, include_plan, include_home_and_shell, do_short_format,
2641 include_where, main): Use bool for booleans.
2642 (count_ampersands, create_fullname, scan_entries, short_pinky):
2643 Use size_t for sizes.
2644 (create_fullname): Check for overflow in size calculations.
2645 (idle_string): Don't assume that the number of idle days
2646 is less than 10**8 and/or INT_MAX/(24*60*60).
2647 (main): No need to pass a non-NULL last arg to getopt_long.
2648 * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2649 (print_uptime): Remove unused local variable.
2650 (main): No need to pass a non-NULL last arg to getopt_long.
2651 * src/users.c (list_entries_users, users): Use size_t for sizes.
2652 (list_entries_users): Use char for bytes.
2653 (main): No need to pass a non-NULL last arg to getopt_long.
2654 * src/who.c (do_lookup, short_list, short_output, include_idle,
2655 include_heading, include_mesg, include_exit, need_boottime,
2656 need_deadprocs, need_login, need_initspawn, need_clockchange,
2657 need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2658 (print_runlevel): Use unsigned char for bytes.
2659 (list_entries_who, scan_entries, who): Use size_t for sizes.
2660 (main): No need to pass a non-NULL last arg to getopt_long.
2662 * src/install.c (isdir): Remove decl.
2663 (install_file_to_path): Rely on make_path to fail if the destination
2664 is not a directory, by passing preserve_existing==true to it.
2665 Hence we no longer need to call isdir.
2666 Free dest_dir immediately when it's no longer needed, rather than
2667 waiting until the end of the function.
2668 (copy_file): Don't bother calling isdir, as copy will do the
2669 right thing if the destination is a directory.
2671 * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2672 print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2673 Use bool for booleans.
2674 (max_depth): Now size_t, not int, to avoid an arbitrary limit
2675 of INT_MAX on depth.
2676 (G_fail): Remove: no longer needed, now that the relevant
2677 functions return bool.
2678 (process_file): Use return value to signal success rather than
2679 setting a global. Remove first_call static var; not needed, since
2680 we can look at n_alloc. Use size_t for depths. Remove FIXME
2681 about size_t casts, as it's now fixed. Use xnrealloc rather
2682 than the obsolescent XREALLOC. Don't bother to check whether
2683 reallocation is needed unless level > prev_level.
2684 (du_files): Invert sense of result, for consistency with
2685 other coreutils code. All callers changed.
2686 (main): Allow --max-depth values up to SIZE_MAX.
2688 * src/df.c (inode_format, show_all_fs, show_local_fs,
2689 show_listed_fs, posix_format, require_sync, print_type,
2690 selected_fstype, excluded_fstype, show_dev, show_point, main):
2691 Use bool for booleans.
2692 (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2693 (show_dev, show_point, main):
2694 Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2695 Don't assume disk name lengths are <= INT_MAX.
2696 Rewrite pct calculation to avoid cast.
2697 (show_point): Don't assume resolved length is <= SSIZE_MAX.
2699 * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2700 instead of uintptr_t.
2701 * src/shred.c (UINT_MAX_32_BITS): Remove.
2702 (word32): Remove. All uses changed to uint32_t.
2703 (isaac_seed_data): Remove unnecessary cast.
2704 * src/system.h (ptr_align): Use size_t; in practice, this is just as
2705 good as uintptr_t in checking for alignments, and has fewer
2706 configuration hassles.
2708 * src/Makefile.am (localedir.h): Make it readonly; this
2709 undoes part of the 2004-07-27 patch.
2711 2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
2713 * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2714 (IS_THOUSANDS_SEP): Use bool when appropriate.
2715 (numcompare, main): Use char, not int, when the value is always a char.
2716 (numcompare): Remove "register"; compilers are smart enough these days.
2717 * src/system.h (errno, CHAR_BIT): Remove decls;
2718 no longer needed now we assume C89 or better.
2719 Include <inttypes.h> before <stdint.h>, as it's the
2720 Autoconf-recommended pattern.
2721 (to_uchar): New inline function, moved here from tr.c.
2722 Use full names for int types, e.g. "long int" rather than "long".
2723 * src/tr.c (to_uchar): Remove; now in system.h.
2724 (is_char_class_member): Use bool when appropriate.
2726 * src/mkdir.c (create_parents, main): Use bool when appropriate.
2727 (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2729 2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
2731 * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
2733 * src/chmod.c (recurse, force_silent, process_file, process_files,
2734 main): Use bool when appropriate.
2735 * src/cksum.c (cksum, main): Likewise.
2736 * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
2737 compare_files, main): Likewise.
2739 * src/copy.h (struct cp_options): Likewise.
2740 * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
2741 same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
2742 * src/cp-hash.h (remember_created): Likewise.
2743 * src/cp-hash.c (remember_created): Likewise.
2744 * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
2745 re_protect, make_path_private, target_directory_operand, do_copy,
2746 cp_option_init, decode_preserve_arg, main): Likewise.
2747 * src/install.c (isdir, change_timestamps, change_attributes,
2748 copy_file, install_file_to_path, install_file_in_dir,
2749 install_file_in_file, strip_files, dir_arg, cp_option_init, main,
2750 change_attributes, change_timestamps): Likewise.
2751 * src/mv.c (remove_trailing_slashes, rm_option_init,
2752 cp_option_init, do_move, movefile, main): Likewise.
2753 * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
2754 AD_push, prompt, remove_dir): Likewise.
2755 * src/rm.c (rm_option_init, main): Likewise.
2757 * src/remove.c (top_dir, pop_dir, full_filename_):
2758 Use size_t for sizes.
2759 * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
2760 succeeds. It's not necessary in that case, as *NEW_DST is always
2762 (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
2763 (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
2764 * src/rm.c (main): Likewise.
2766 md5sum, sha1sum integer cleanups.
2768 * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
2770 (ALG_UNSPECIFIED): Remove.
2771 (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
2772 * src/md5.c: Don't include any files other than checksum.h.
2773 * src/sha1sum.c: Likewise.
2774 * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
2775 bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
2776 Use bool when appropriate.
2777 (digest_check): Increase limit of number of input lines to
2778 UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
2779 Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
2781 2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
2783 * src/cat.c (exit_status): Remove. Now done by passing a boolean
2785 (simple_cat, cat): Return true if successful. All callers changed.
2786 (simple_cat, cat, main): Use bool for booleans.
2787 (simple_cat): Use size_t for sizes.
2788 (cat, main): Use the same names for parameters that we use for
2789 long options, to avoid confusion. This inverts the sense of the
2790 show_tabs (formerly output_tabs) and number_nonblank
2791 (formerly numbers_at_empty_lines) variables.
2792 (main): Don't mess up (due to integer overflow) if we are given
2793 INT_MAX - INT_MIN + 1 options.
2794 [O_BINARY]: Don't invoke isatty unless the other options require it.
2795 (main): When deciding whether to use simple_cat, don't worry
2796 about binary option; it's irrelevant.
2798 * src/dcgen: Remove comments, trailing white space, and empty
2799 lines from the output strings, to save space.
2800 Use a narrower type like 'unsigned char' for line lengths, if
2802 Make the output variables static, not extern.
2804 * src/chgrp.c (parse_group): Require base 10 when parsing
2806 (main): int -> bool when appropriate.
2807 * src/chown.c (main): Likewise.
2808 * src/chown-core.c: Include inttostr.h.
2809 (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
2810 (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
2811 instead of uint_to_string).
2812 (describe_change): Instead of an int flag, use a char *
2813 auxiliary; this avoids the need for casts.
2814 Assume free (NULL) works.
2815 (change_file_owner): Return true/false, not 0/-1, since
2816 we don't set errno. All callers changed.
2817 Use bool when appropriate.
2818 (chown_files): Likewise.
2819 * src/chown-core.h (chown_files): Likewise.
2821 * tests/chown/basic: Test for proper handling of uids like
2822 "010", which must be parsed as decimal.
2824 * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
2825 pwd when there are multiple names for the working directory
2826 (which can happen with an automounter, sigh).
2828 * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
2829 this causes Solaris 8 'make' to refuse to build "groups".
2830 (localedir.h): Don't depend on Makefile: this causes Solaris
2831 8 'make' to build localedir.h unnecessarily. The dependence
2832 on Makefile is ineffective anyway, since $(localedir) might
2833 change even if Makefile hasn't.
2835 * src/remove.c (remove_dir): If we can't save the state of the
2836 working directory, pretend we started from "/", not ".".
2837 This avoids a bug on hosts like Solaris that don't let you
2838 remove the working directory.
2840 2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
2842 * src/printf.c (strtiomax, strtoumax): Declare if not already
2843 declared: this fixes a portability bug with Solaris 8 + GCC.
2844 (STRTOX): Parenthesize use of macro arg as expression.
2845 (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
2847 * configure.ac: Check for declaration of strtoumax, for
2850 * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
2851 pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
2853 * tests/readlink/can-e: Don't assume that we can remove the
2854 working directory: this isn't possible under Solaris 8, say.
2855 * tests/readlink/can-f: Likewise.
2856 * tests/readlink/can-m: Likewise.
2858 * src/copy.c (copy_internal): find_backup_file_name no longer
2859 returns NULL, so don't bother to check for this.
2860 * src/cp.c (do_copy): Likewise.
2861 * src/ln.c (do_link): Likewise.
2863 2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
2865 * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
2867 (NZERO): New macro, if system doesn't define it already.
2868 (usage): Distinguish priorities from nice values.
2869 Don't assume NZERO is 20.
2870 (main): Use bool instead of int where appropriate.
2871 If user specifies an adjustment out of range, always truncate it
2872 to an inrange value instead of sometimes giving an error message
2874 Do not assume that -1 is an error return from "nice" or
2875 "getpriority", as it might be the current nice value minus NZERO.
2876 If nice/setpriority fails with errno == EPERM, go ahead and run
2877 the command anyway; POSIX requires this.
2879 * src/pathchk.c: Include euidaccess.h.
2880 (dir_ok): Use euidaccess, not access.
2881 * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
2882 (eaccess): Remove. All users changed to use euidaccess instead.
2884 2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
2886 * src/uptime.c (print_uptime) [defined BOOT_MSG]:
2887 Don't assume ut_line is null-terminated.
2888 * src/who.c (print_line): New arguments USERLEN and LINELEN,
2889 since USER and LINE might not be null terminated. All callers
2892 2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
2894 Fix bug with "tail -f" reported by Rob Holland in
2895 <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
2896 Also, remove the undocumented and unsupported-since-2000
2897 --max-consecutive-size-changes options. Fix another related bug:
2898 "tail" got confused if stdin, stdout, or stderr were closed.
2899 Also, use output buffering even with "tail -f".
2901 * NEWS: Document this, plus yesterday's patch.
2902 * doc/coreutils.texi (tail invocation): "size has remained the same"
2903 -> "file has not changed", which is more accurate for fifos.
2904 * src/tail.c: Include fcntl-safer.h.
2905 (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
2906 (COPY_A_BUFFER): New macro.
2907 (struct File_spec): New members mtime, mode, blocking.
2908 Remove member n_consecutive_size_changes.
2909 (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
2910 max_n_consecutive_size_changes_between_opens,
2911 MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
2912 (long_options, tail_forever, parse_options):
2913 Remove (non-)support for --max-consecutive-size-changes.
2914 (record_open_fd): New function.
2915 (recheck, tail_file): Use it. Don't assume that stdin is open.
2916 (dump_remainder): Add support for new COPY_A_BUFFER special value.
2917 Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
2918 (recheck): New arg BLOCKING, specifying whether to use blocking reads.
2920 (n_live_files): Remove, replacing with...
2921 (any_live_files): New function. All uses changed.
2922 (tail_forever): Use nonblocking I/O unless we know that blocking I/O
2923 is safe; this avoids some hangs when reading from a fifo.
2924 Avoid invoking fstat or sleep when using blocking I/O.
2925 Do not check for changes to size if the file is not a regular file,
2926 as the size is undefined in that case.
2927 Check for changes to mtime or mode, too; this works for non-regular
2929 (tail_forever, main): Redo fflush strategy to work even when input
2930 is nonblocking. Don't use unbuffered output; just flush when needed.
2932 2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
2934 * src/tail.c (main): Ignore -f if no file operand is specified
2935 and standard input is a pipe.
2936 * doc/coreutils.texi (tail invocation): Do not ignore -f for
2937 all pipes, just for when standard input is a pipe and no
2938 file operand is specified.
2939 * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
2940 Add a new commented-out f-2 test, which we still fail.
2941 (test_vector): All f-* tests are special cases, not just f-1.
2943 2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
2945 * src/uptime.c: Include c-strtod.h.
2946 (print_uptime): Use c_strtod instead of setlocale and sscanf.
2947 Use long int rather than int to count days (for 64-bit hosts),
2948 and check for arithmetic overflow when converting double to time_t.
2950 2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
2952 * src/printf.c (vstrtold): Renamed from vstrtod.
2953 Now returns long double. All uses changed.
2954 (print_direc): Use "L" length modifier when printing floating point
2955 numbers, since we're now printing long double.
2957 2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
2959 printf cleanup, to avoid undefined behavior, to add support for
2960 formats that Bash supports, and to support wide integers like
2963 * NEWS: Document this.
2964 * src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
2965 booleans, so that we don't reserve any values for precision or
2967 (STRTOX): Use prototype, not K&R-style definition.
2968 (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
2969 in ../lib), with type change to intmax_t.
2971 (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
2973 (vstrtod): Renamed from xstrtod. All uses changed.
2974 (print_direc): Use boolean arg instead of special value to indicate
2975 a missing precision or width. LENGTH no longer includes
2976 length modifiers or conversion character. New arg CONVERSION
2977 now specifies conversion character.
2978 Use intmax_t-width formatting for integers (like Bash).
2979 Add support for C99 %a, %A, %F (like Bash).
2980 Add support for field width with %c (POSIX requires this).
2981 Add a FIXME for lack of support for field width and precision
2983 Add support for '\'', '0' flags.
2984 Check for invalid combinations of flags, field width, precision,
2985 and conversion, to prevent use of undefined behavior.
2986 Allow multiple length modifiers, for formats like "%lld" (like Bash).
2987 Add support for C99 'j', 't', 'z' length modifiers (like Bash).
2988 In error message, output entire invalid conversion specification,
2989 instead of merely outputting % followed by the conversion char.
2990 * tests/misc/printf: Add tests for the above.
2992 2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
2994 Change "readlink -f" to be more compatible with prior implementations.
2995 Add more canonicalize options, -e and -m.
2996 Add comprehensive tests for all readlink modes.
2998 * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
2999 Do not add canonicalize.c here.
3001 * src/readlink.c (longopts): Add new options.
3002 (usage): Document them.
3003 (canonicalize_fname): New proxy function.
3004 (main): Handle new options.
3005 * doc/coreutils.texi (readlink invocation): Document new
3006 "readlink -f" behaviour and new canonicalize options, -e and -m.
3008 * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3009 * tests/Makefile.am (SUBDIRS): Add readlink.
3010 * tests/readlink/Makefile.am: New file.
3011 * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3012 * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3013 * tests/misc/readlink: Remove file.
3015 2004-07-04 Jim Meyering <jim@meyering.net>
3017 * src/copy.c (copy_internal): Add a FIXME comment.
3019 2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
3021 * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3022 * src/cp.c (do_copy): Likewise.
3023 * src/mv.c (movefile): Likewise.
3025 * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3026 to avoid problem when path_concat dir name is longer than 2 GiB (!).
3028 * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3029 This cleans up the semantics a bit, as we no longer try to open the
3032 2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
3034 * NEWS: Add short names -t and -T for --target-directory
3035 and --no-target-directory options, respectively.
3037 * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3038 Remove. All uses changed to 'T' and 't', respectively.
3039 * src/install.c, src/ln.c, src/mv.c: Likewise.
3041 * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3042 aliases for --target-directory and --no-target-directory,
3044 * src/install.c (long_options, main, usage): Likewise.
3045 * src/ln.c, src/mv.c: Likewise.
3047 2004-07-01 Jim Meyering <jim@meyering.net>
3049 * Makefile.maint (sc_file_system): New target.
3050 (syntax-check-rules): Add it.
3051 .x-sc_file_system: New file.
3052 * Makefile.am (EXTRA_DIST): Add it.
3054 * man/sync.x: Use "file system" rather than "filesystem".
3055 * man/stat.x, man/df.x: Likewise.
3057 2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
3059 * src/df.c (usage, main): Output "file system" rather than
3061 * src/du.c (usage): Likewise.
3062 * src/shred.c (usage): Likewise.
3063 * src/stat.c (usage): Likewise.
3064 * src/stat.c (long_options, usage): Rename "--filesystem" to
3065 "--file-system". But keep the old name around, for compatibility
3068 2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
3070 Add support for --no-target-directory option.
3072 * NEWS: Document it.
3073 * doc/coreutils.texi (Common options, Target directory, cp
3074 invocation, install invocation, mv invocation, ln invocation):
3076 (link invocation): Explain how to rewrite link using ln now
3077 that we have --no-target-directory.
3078 (ln invocation): Explain that --no-target-directory subsumes
3080 (unlink invocation): Modify wording to match new wording in
3083 * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3084 (long_opts, usage, do_copy, main): Add support for
3085 --no-target-directory,
3086 * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3088 * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3090 * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3092 * src/mv.c (enum): Sort values.
3094 2004-06-29 Jim Meyering <jim@meyering.net>
3096 Don't let verbose-mode output from a subshell obscure actual differences.
3097 * tests/rm/inaccessible: Turn off command-echoing just before
3098 invoking subshell, then turn it back on if VERBOSE=yes afterward.
3100 2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
3102 Add support for 'install --target-directory', an option
3103 that has been documented for years but not implemented (!).
3104 * doc/coreutils.texi (install invocation): Document
3105 --target-directory in synopsis, too.
3106 * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3107 (long_options, main, usage): Add --target-directory.
3108 (target_directory_operand): New function, stolen from mv.c.
3109 (main): Use it. Check for -d and --target-directory.
3110 Alter wording of diagnostics to match other programs.
3112 2004-06-28 Jim Meyering <jim@meyering.net>
3114 * src/cp.c (usage): Fix copy+paste error in description of
3115 --target-directory: s/move/copy/. From Paul Jarc.
3117 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
3119 Use more-consistent rules among cp, ln, and mv when dealing with
3120 last operands that are (or look like) directories.
3122 * src/cp.c (target_directory_operand): New, nearly-common function,
3123 It reports an error if the destination appears to be a directory
3124 (e.g., because it has a trailing slash) but is not.
3125 * src/ln.c, src/mv.c: Likewise.
3126 * src/cp.c (do_copy): Use it.
3127 * src/ln.c (main): Likewise.
3128 * src/mv.c (main): Likewise.
3130 * src/cp.c (do_copy): Don't assume argc is positive.
3131 Don't bother to lstat dest, since copy() will do that for us.
3132 Use "const" to avoid the need for cast.
3134 * src/cp.c (do_copy): Don't output a usage message because of file
3135 problems (e.g., an operand is not a directory). Use it only for
3136 syntax. Standardize on "target %s is not a directory" for the
3138 * src/ln.c (main): Likewise.
3139 * src/mv.c (main): Likewise.
3141 * src/cp.c (do_copy): Remove test for trailing slash, since
3142 target_directory_operand now does this.
3143 * src/ln.c (main): Likewise.
3144 * src/mv.c (movefile): Likewise.
3146 * src/cp.c (main): Reject multiple target directories.
3147 Check whether a specified target is a directory when parsing the
3148 options, using stat. This gives more-accurate diagnostics.
3149 * src/ln.c (main): Likewise.
3151 * src/ln.c (isdir): Remove decl; no longer needed.
3152 * src/mv.c (isdir, lstat): Likewise.
3154 * src/ln.c (do_link): New arg dest_is_dir. All uses changed.
3155 Don't check the destination ourself; rely on dest_is_dir.
3156 This way we can avoid lstatting the destination in the
3157 usual case, and in the worst case we lstat 1, not 3 times.
3158 Don't bother to unlink unless link failed; this saves a syscall.
3159 Remove unnecessary backup_succeeded flag;
3160 it was identical to "dest_backup != NULL".
3162 * src/ln.c (main): Use int to count to argc, not unsigned int.
3163 This handles negative operand counts.
3164 * src/mv.c (main): Likewise.
3166 * src/mv.c (do_move): Don't call hash_init; expect the caller to
3167 do it, for consistency with cp.c and ln.c. All callers changed.
3168 (movefile): dest_is_dir parameter is now bool, not int.
3169 (main): Standardize on "missing destination file operand after %s"
3170 for the diagnostic, for consistency with cp.c.
3172 * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3173 will complain about the arg count.
3174 Adjust to new (briefer) diagnostics.
3175 * tests/cp/fail-perm: Add a test to verify that we get the new
3176 diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3178 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
3180 Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3181 d/" incorrectly created a link d/x/x. It also saves some system
3184 * NEWS: Document the fix.
3186 * src/ln.c (main): Don't append basename to dest if this
3187 results in an existing directory name.
3188 * tests/ln/misc: See whether a trailing slash is followed too far.
3190 2004-06-26 Jim Meyering <jim@meyering.net>
3192 * src/printf.c (main): When given no arguments, print the standard
3193 "missing operand\nTry printf --help..." message -- to be consistent.
3195 2004-06-26 Jim Meyering <jim@meyering.net>
3197 * src/mknod.c (main): Add \n at the end of message output via fprintf.
3199 2004-06-25 Jim Meyering <jim@meyering.net>
3201 * tests/ln/misc: Add test for ln subscript error.
3203 2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
3205 * src/ln.c (do_link): Remove unnecessary call to lstat.
3206 (main): Avoid subscript error when the destination is "".
3208 2004-06-23 Jim Meyering <jim@meyering.net>
3210 * tests/*: Replace all occurrences of `(exit N); exit' with
3211 `(exit N); exit N'. Otherwise, those many tests could exit with
3212 improper exit status when exiting via e.g., a trapped interrupt.
3213 Thanks to a report from Bob Proulx.
3215 2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
3217 * src/who.c (idle_string, print_user): New arg boottime,
3218 specifying the most recent boot time. All uses changed.
3219 (idle_string) Consider a line to be "old" if it hasn't been used
3220 since the last boot time. Watch out for overflow when computing
3221 times, and for times in the future.
3222 (idle_string): Record latest boot time.
3224 2004-06-22 Jim Meyering <jim@meyering.net>
3226 * src/test.c (usage): Correct description of `-t FD'. The file
3227 descriptor, FD, is no longer optional. Reported by Ton Nijkes.
3229 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
3231 The 2004-06-19 fix for who and pinky was incomplete, as ctime
3232 has undefined behavior if the year precedes -999 or follows 9999.
3233 Since we have to stop using ctime anyway, we might as well use
3234 strftime and fix the FIXME, and support internationalized dates.
3236 * NEWS: Document the new behavior.
3237 * src/who.c: Include "hard-locale.h".
3238 (time_format, time_format_width): New vars.
3239 (time_string, print_line): Use them.
3241 (time_string): Use localtime + strftime instead of
3242 ctime, to avoid problems with years before -999 or after 9999.
3243 * src/pinky.c: Likewise.
3245 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
3247 Fix bug: GNU 'ls' didn't count columns correctly if user or group
3248 names contained multibyte characters where the column count
3249 differed from the byte count. This patch also corrects
3252 * src/ls.c (format_user_or_group): New function, which counts
3254 (format_user, format_group): Use it.
3255 (format_user_or_group_width): New function, which counts columns
3257 (format_user_width, format_group_width): Use it.
3259 2004-06-21 Jim Meyering <jim@meyering.net>
3261 * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3262 Suggestion from Andreas Schwab.
3264 * tests/priv-check: When running as root, be sure to propagate
3265 PATH through to the process we exec as non-root.
3266 Reported by michael@aplatform.com.
3268 * src/mknod.c (main): Don't segfault when calculating the
3269 expected number of operands for `mknod NAME'.
3271 2004-06-20 Jim Meyering <jim@meyering.net>
3273 * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3275 2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
3277 * src/basename.c (main):
3278 Standardize on the diagnostics given when someone gives
3279 too few operands ("missing operand after `xxx'") or
3280 too many operands ("extra operand `xxx'").
3281 Include "quote.h" and/or "error.h" if it wasn't already being included.
3282 * src/chgrp.c (main): Likewise.
3283 * src/chmod.c (main): Likewise.
3284 * src/chown.c (main): Likewise.
3285 * src/chroot.c (main): Likewise.
3286 * src/comm.c (main): Likewise.
3287 * src/cp.c (do_copy): Likewise.
3288 * src/csplit.c (main): Likewise.
3289 * src/date.c (main): Likewise.
3290 * src/dircolors.c (main): Likewise.
3291 * src/dirname.c (main): Likewise.
3292 * src/du.c (main): Likewise.
3293 * src/expr.c (main): Likewise.
3294 * src/hostid.c (main): Likewise.
3295 * src/hostname.c (main): Likewise.
3296 * src/id.c (main): Likewise.
3297 * src/install.c (main): Likewise.
3298 * src/join.c (add_file_name, main): Likewise.
3299 * src/link.c (main): Likewise.
3300 * src/ln.c (main): Likewise.
3301 * src/logname.c (main): Likewise.
3302 * src/md5sum.c (main): Likewise.
3303 * src/mkdir.c (main): Likewise.
3304 * src/mkfifo.c (main): Likewise.
3305 * src/mknod.c (main): Likewise.
3306 * src/mv.c (main): Likewise.
3307 * src/nohup.c (main): Likewise.
3308 * src/od.c (main): Likewise.
3309 * src/pathchk.c (main): Likewise.
3310 * src/ptx.c (main): Likewise.
3311 * src/readlink.c (main): Likewise.
3312 * src/rm.c (main): Likewise.
3313 * src/rmdir.c (main): Likewise.
3314 * src/seq.c (main): Likewise.
3315 * src/setuidgid.c (main): Likewise.
3316 * src/shred.c (main): Likewise.
3317 * src/sleep.c (main): Likewise.
3318 * src/sort.c (main): Likewise.
3319 * src/split.c (main): Likewise.
3320 * src/stat.c (main): Likewise.
3321 * src/test.c (beyond, main): Likewise.
3322 * src/touch.c (main): Likewise.
3323 * src/tr.c (main): Likewise.
3324 * src/tsort.c (main): Likewise.
3325 * src/tty.c (main): Likewise.
3326 * src/uname.c (main): Likewise.
3327 * src/uniq.c (main): Likewise.
3328 * src/unlink.c (main): Likewise.
3329 * src/uptime.c (main): Likewise.
3330 * src/users.c (main): Likewise.
3331 * src/who.c (main): Likewise.
3332 * src/whoami.c (main): Likewise.
3334 * tests/basename/basic: Adjust to new diagnostics.
3335 * tests/du/files0-from: Likewise.
3336 * tests/expr/basic: Likewise.
3337 * tests/mv/diag: Likewise.
3338 * tests/tsort/basic-1: Likewise.
3340 2004-06-20 Jim Meyering <jim@meyering.net>
3342 * src/ln.c: Remove declaration of yesno.
3343 Instead, include yesno.h.
3344 * src/copy.c: Likewise.
3346 * src/remove.c: Remove declaration of yesno.
3347 Instead, include yesno.h.
3348 (top_dir): Remove now-unnecessary cast of obstack_base.
3349 (pop_dir): Likewise.
3350 (full_filename_): Likewise.
3352 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
3354 Don't dump core if ctime returns NULL; this is possible on
3355 hosts with 64-bit time_t and 32-bit int.
3356 * src/who.c: Include "inttostr.h".
3357 (time_string): If ctime fails, print the raw time as an integer
3358 instead of dumping core.
3359 * src/pinky.c: Likewise, as follows:
3360 Include "inttostr.h".
3361 (time_string): New function, copied from who.c.
3362 (print_entry): Use it.
3364 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
3366 * src/who.c (print_line): Don't truncate user names at 8 bytes.
3367 Problem reported by Guido Leenders in:
3368 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3369 * NEWS: document this.
3371 2004-06-19 Jim Meyering <jim@meyering.net>
3373 * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3374 using GNU_PACKAGE (from PACKAGE) once again. This restores
3375 `GNU' to the parenthesized package name in --version output.
3376 Before, the first argument from AC_INIT, `GNU coreutils', would
3377 be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
3378 Reported by Richard Stallman.
3380 2004-06-17 Jim Meyering <jim@meyering.net>
3382 * src/tr.c (to_uchar): Rename function from `uchar'. The latter
3383 would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
3385 2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
3387 * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3388 allows the GNU behavior. "--" is now supported by chroot, hostid,
3389 hosname, pwd, sync, yes.
3390 * doc/coreutils.texi (yes invocation, false invocation,
3391 true invocation): Document this.
3392 * src/chroot.c (main): Handle "--".
3393 * src/hostid.c (main): Likewise.
3394 * src/hostname.c (main): Likewise.
3395 * src/pwd.c (main): Likewise.
3396 * src/sync.c (main): Likewise.
3397 * src/yes.c (main): Likewise.
3398 * src/true.c (main): Recognize --help and --version even if
3399 POSIXLY_CORRECT is set.
3400 * src/yes.c (main): Likewise.
3402 2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
3404 * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3406 * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3407 * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3408 POSIXLY_CORRECT is set. POSIX reserves upper-case environment
3409 variables to the implementation, so it's OK for ls to depend on
3411 * src/pr.c: Include "hard-locale.h".
3412 (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3413 POSIX specifies the behavior only in the POSIX locale.
3414 * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3415 since POSIX says the behavior is unspecified here.
3416 * src/tail.c (parse_obsolescent_option): Support multiple file operands
3417 even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3418 * src/printf.c (main): Recognize --help, --version even if
3419 POSIXLY_CORRECT. POSIX does not specify any options, but it
3420 does not prohibit options either, so "printf" is like "expr" here.
3421 * src/unlink.c (main): Likewise.
3422 * tests/misc/printf: Adjust to the new semantics for \x if
3425 2004-06-14 Jim Meyering <jim@meyering.net>
3427 * tests/misc/pwd: New test, for fix of 2004-04-19.
3428 * tests/misc/Makefile.am (TESTS): Add pwd.
3429 (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3431 * src/copy.c: Remove declaration of euidaccess.
3432 Instead, include "euidaccess.h".
3434 2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
3436 * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3437 (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3438 as (sizeof "??") reliably returns 3.
3439 (print_line): Guard against idle and pid being too long
3440 (which is possible when printing headers).
3441 (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
3442 Avoid unnecessary cast of sizeof to int.
3443 (make_id_equals_comment): Do not assume that UT_ID returns
3444 a string; it might return a non-null-terminated array.
3445 Use strncat instead. It's not very often where strncat is
3446 exactly what you want, but this is one of those rare cases.
3448 2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
3450 * src/who.c (list_entries_who): Don't output a trailing space.
3452 2004-06-09 Jim Meyering <jim@meyering.net>
3454 * src/touch.c (usage): Improve wording in description of the
3455 --time=WORD option. Reported by Dan Jacobson.
3457 * src/chown-core.c (change_file_owner): Change names of parameters
3458 old_uid and old_gid to required_uid and required_gid respectively.
3460 * src/chmod.c (mode_changed): Return false, not 0, now that the
3461 function returns `bool'.
3463 2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
3465 Adjust chmod and chown to be similar if -c or -v are given. In
3466 particular, a no-op chown is no longer reported as a change; this
3467 reverts to previous behavior. Also, fix both commands so that -v
3468 report failures even if the failure is not due to the chmod or
3471 * src/chmod.c (CH_NOT_APPLIED): New constant.
3472 (describe_change): Handle it.
3473 (process_file): Use it, if a symlink wasn't changed.
3474 (mode_changed): Return bool, not int. Accept new argument
3475 NEW_MODE; all callers changed. This lets us avoid statting the
3476 file unless the new mode has unusual bits.
3477 (process_file): Return -1 on error. With -v, report all errors
3478 verbosely, not just some.
3480 * src/chown-core.c (change_file_owner): Return -1 on error, not
3481 1 sometimes and -1 on others. Our caller ORs together our results,
3482 and (-1 | 1) == 0 on ones-complement hosts.
3483 With -v report all errors verbosely, not just some.
3484 Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3485 file_stats wasn't set properly in that case.
3487 * tests/chgrp/basic: Adjust to above changes.
3489 2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
3491 * tests/chgrp/basic: Test that chgrp -h does not fail on
3492 symlinks, even on hosts where that's not supported.
3493 Test that if -R is specified without -H or L, -h is assumed.
3494 Test that chown() is not optimized away.
3496 2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
3498 Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3500 Check for incompatible options. When -R and --dereference are
3501 both used, then either -H or -L must also be used. When -R and -h
3502 are both used, then -P must be in effect.
3504 -H, -L, and -P have no effect unless -R is also specified.
3505 If -P and -R are both specified, -h is assumed.
3507 Do not optimize away the chown() system call when the file's owner
3508 and group already have the desired value. This optimization was
3509 incorrect, as it failed to updated the last-changed time and reset
3510 special permission bits, as POSIX requires.
3512 Do not report an error if the owner or group of a
3513 recursively-encountered symbolic link cannot be updated because
3514 the file system does not support it.
3516 * NEWS: Document the above.
3518 * src/chgrp.c (main): Check for incompatible options. -R --dereference
3519 requires either -H or -L, and -R -h requires -P. If -H, specify
3520 FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
3521 file as much like chown.c as possible.
3522 * src/chown.c (main): Likewise.
3524 * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3525 needed. Chown a directory only after chowning its children; this
3526 avoids problems if the new directory ownership doesn't permit
3527 access to the children. Dereference symlinks before doing
3528 ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3529 Do not optimize away the chown() system call when the file's owner
3530 and group already have the desired value. POSIX does not permit
3531 this optimization. Rely on chown and lchown to do the right
3532 thing with symlinks and/or -1 arguments, now that we have wrappers
3533 to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3534 errors, not just command-line errors.
3535 (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3537 * src/system.h (ENOTSUP): Remove.
3539 * tests/chgrp/basic: Use chown --from to discover whether the
3540 group changed, since chgrp now changes unconditionally. This
3541 complicates the sed script a bit. Do not specify --dereference,
3542 since it's the default (and we want to test this). Adjust output
3543 to match the fact that chgrp no longer optimizes the case of
3544 changing a file's group to the same value as before.
3545 * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3546 options are incompatible, and their behavior is undefined with POSIX.
3547 (changed, not_changed): Adjust to match the fact that -h is no longer
3548 specified. Sort names.
3549 * tests/chown/deref: Adjust error-diagnostic spelling to match new
3552 2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
3554 * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3555 prevented a diagnostic of any operands.
3557 2004-06-08 Jim Meyering <jim@meyering.net>
3559 * src/shred.c (direct_mode): Turn it on/off with directio, too.
3561 2004-06-07 Jim Meyering <jim@meyering.net>
3563 Enable direct-mode I/O (bypassing the buffer cache), if possible.
3564 Prompted by a suggestion from Kalle Olavi Niemitalo
3565 in http://bugs.debian.org/207035.
3566 * src/shred.c (direct_mode): New function.
3567 (do_wipefd): Turn on direct-mode I/O.
3568 (dopass): If a file's first write fails with EINVAL,
3569 turn off direct-mode I/O and retry the write.
3571 2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
3573 * src/tr.c (main): "tr -d a b" is now a fatal error even if
3574 POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
3577 2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
3579 * src/shred.c (dopass): Don't subtract 1 from the offset after
3580 a write error. Problem reported by Jon Peatfield in:
3581 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3583 2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
3585 Fix bug reported by Buciuman Adrian in
3586 <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3587 where 'dd' created a file that was too large. The bug was that dd
3588 assumed that the input file offset does not advance after a failed
3589 read; but POSIX says that the input file offset is undefined after
3592 * src/dd.c (MAX_BLOCKSIZE): New macro.
3593 (input_seekable, input_seek_errno, input_offset,
3594 input_offset_overflow): New vars.
3595 (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3596 (advance_input_offset): New function.
3597 (skip_via_lseek): Set errno to zero when reporting our failure,
3598 so that we don't report based on garbage errno.
3599 (skip): If fdesc is standard input, advance the input offset.
3600 Do not quit if reading, and if noerror was specified;
3601 POSIX seems to require this.
3602 If read fails on output file, report the earlier lseek failure
3603 instead; this fixes a FIXME in dd_copy.
3604 (advance_input_after_read_error): New function.
3605 (dd_copy): Use it, instead of assuming that failed reads
3606 do not advance the file pointer. Advance input offset
3607 after nonfailed reads. Advance only a partial block if
3608 the previous read (before the failed read) succeeded, and
3609 do not generate an output block of zeros in this case.
3610 (main): Determine initial input offset, seekability of input,
3611 and error if it wasn't seekable.
3613 2004-06-02 Jim Meyering <jim@meyering.net>
3615 rm (without -f) could hang unnecessarily when attempting to
3616 remove a symlink to a file on an off-line NFS-mounted partition.
3617 Reported by David Howells in https://bugzilla.redhat.com/124699.
3618 * src/remove.c (write_protected_non_symlink): New function.
3619 Don't invoke euidaccess on symlinks.
3620 (prompt): Use write_protected_non_symlink rather than using
3621 euidaccess directly, being careful not to call lstat twice for a file.
3623 Fix a bug in how the --output-delimiter=D option works with
3624 abutting byte or character ranges. Reported by David Krider in
3625 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3626 * src/cut.c (print_kth): Remove special case for open-ended range.
3627 (set_fields): Record the range start index for an interval even
3628 when it abuts another interval on its low side.
3629 Also record the range start index of the longest right-open-interval.
3630 * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3631 abutting and overlapping byte ranges.
3633 2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
3635 Some POSIX-conformance cleanups for tr.
3637 * src/tr.c (posix_pedantic): Remove; no longer needed since
3638 we need to test this in just one place now.
3639 (usage): Mention -C.
3640 (unquote): Note that \055, \n, etc are escaped.
3641 Do not worry about POSIXLY_CORRECT when warning about ambiguous
3643 \ at end of string stands for itself.
3644 Do not diagnose invalid backslash escapes: POSIX says the behavior
3645 is unspecified in this case, so we don't need to diagnose it.
3646 (main): Add support for -C (currently an alias for -c).
3647 Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3649 * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3650 Fix comment for range-a-a.
3652 2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
3654 Improve the efficiency (and in one case, correctness) of code
3655 that reads symlinks.
3657 * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3658 royally if the link length is long (e.g., GNU/Hurd). Use
3659 xreadlink instead, it's safer. Don't bother to read the link if
3660 it's the wrong size. Add a FIXME because this area is a bit murky
3662 * src/ls.c (get_link_name): Update use of xreadlink.
3663 * src/readlink.c (main): Likewise.
3664 * src/stat.c (print_stat): Likewise.
3666 2004-06-01 Jim Meyering <jim@meyering.net>
3668 * src/env.c (main): Prefer the notation `STREQ (a, b)'
3669 over `!strcmp (a, b)'.
3670 * src/sort.c (main, sort_buffer_size): Prefer the notation
3671 `STREQ (a, b)' over `strcmp (a, b) == 0'.
3672 * src/date.c (batch_convert): Likewise.
3673 * src/expr.c (nextarg): Likewise.
3674 * src/su.c (correct_password, restricted_shell, main): Likewise.
3675 * src/ptx.c (swallow_file_in_memory, main): Likewise.
3676 * src/test.c (binary_operator, and, or, main): Likewise.
3678 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
3680 * NEWS: echo compatibility cleanup.
3681 * doc/coreutils.texi (echo invocation): Document the changes.
3682 * src/echo.c (V9_ECHO): Remove; always enabled.
3683 (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3684 we use the same naming convention as bash. Now an enum,
3686 (usage): Reword to mention -e/-E more accurately.
3687 Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3688 (hextobin): New function.
3689 (main): Use bool rather than int for local vars when appropriate.
3690 Do not allow options if POSIXLY_CORRECT, unless we are using
3691 BSD semantics and the first argument is "-n".
3692 Don't pass unnecessary extra arg to parse_long_options.
3693 do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3694 Do not look for options if !allow_options.
3695 Use size_t rather than int when appropriate.
3696 Open-code option test rather than using strrchr.
3697 Use faster test for "-".
3698 Avoid redundant argc test.
3699 Add support for \x, for Bash compatibility.
3700 Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3701 When '\c' is encountered, stop printing immediately, as POSIX
3703 Add support for \xhh syntax.
3704 Add support for \0ooo syntax; POSIX requires this.
3706 2004-06-01 Jim Meyering <jim@meyering.net>
3708 * Use automake-1.8b. Regenerate dependent files.
3710 2004-05-31 Jim Meyering <jim@meyering.net>
3712 * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3713 the build src/ directory -- at the front.
3714 ($(srcdir)/$x-tests): Depend on Makefile.am.
3715 Use $x as the program name, except when it would be `test' (test is
3716 the sole program tested via mk-script that is also a shell built-in).
3717 In that case, use the old ../../src/$x.
3719 2004-05-30 Jim Meyering <jim@meyering.net>
3721 Work around HPUX /bin/cc compiler bug that is exposed, now that
3722 sets are arrays of type `bool'. More details here:
3723 http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
3724 FIXME: verify that the above URL points to the right message
3726 * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
3727 rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
3728 (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
3729 system, those two expressions are not the same (256 vs. 1024).
3730 The effect of this problem was that `tr -c x y' would fail:
3731 tr: when not truncating set1, string2 must be non-empty
3732 (set_initialize): Remove unnecessary initialization of the `in_set'
3733 buffer; that initialization triggered the same compiler bug as above.
3735 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
3737 tr cleanup, mostly having to do with integer type ranges.
3740 * tests/tr/Test.pm: Add a few tests for the below. Alas, most of
3741 the test cases wouldn't be portable, or would take too much CPU
3744 * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
3745 This is safe since the code already assumes N_CHARS fits in int.
3746 (Filter): Remove: we want to prototype everything.
3747 (ORD, CHR): Remove. All uses removed. Some replaced with:
3748 (uchar): New function. All places where a char must be converted
3749 to an unsigned char are now done this way, not by ad-hoc methods.
3750 (count): New type. Use it whenever counts or states are needed.
3751 (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
3752 since we used it in an unsigned int context) to UINTMAX_MAX - 1.
3753 (REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
3754 whenever appropriate.
3755 (NOT_A_CHAR): Remove global macro; now a local enum.
3756 (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
3757 the rest of the code no longer depends on them.
3758 (class_ok): Remove; all uses changed to use inline comparisons.
3759 (RE_NO_TYPE): Remove; wasn't used or needed.
3760 (struct List_element): normal_char and equiv_code are now unsigned
3762 first_char, last_char, and the_repeated_char are now unsigned char,
3763 not unsigned int. repeat_count is now count, not size_t.
3765 (struct Spec_list): state is now count, not unsigned int.
3766 lengthis now count, not size_t.
3767 n_indefinite_repeats is now size_t, not int.
3768 has_equiv_class, has_char_class, and has_restricted_char_class
3769 are now bool, not int. All uses changed.
3770 (struct E_string): s is now char *, not unsigned char *.
3771 escaped is now bool *, not int *. All uses changed.
3772 (ES_MATCH): Remove macro, replacing with:
3773 (es_match): New inline function. All uses changed.
3774 (squeeze_repeats, complement, posix_pedantic, truncate_set1,
3775 translating): Now bool, not int.
3776 (io_buf): Now char array, not unsigned char.
3777 (SET_TYPE): Remove. All uses replaced with bool.
3778 (is_equiv_class_member, unquote, append_range, append_char_class,
3779 append_equiv_class, find_closing_delim, star_digits_closebracket,
3780 build_spec_list, parse_str, homogeneous_spec_list):
3781 Now returns bool, not int. All uses changed.
3782 (is_equiv_class_member): Now inline.
3783 (is_equiv_class_member, is_char_class_member, make_printable_str,
3784 append_normal_char, append_range, append_repeated_char,
3786 Args are now of proper integer type.
3787 (unquote, look_up_char_class, make_printable_str,
3788 append_equiv_class, build_spec_list, squeeze_filter):
3789 Avoid unsigned char *p; gently convert *p to unsigned char instead.
3790 (unquote, get_spec_stats): Do not jump past declarations and then
3791 use them; C doesn't allow this in portable programs.
3792 (make_printable_str): Check for overflow in size calculations.
3793 (xmemdup): Remove. All uses rewritten.
3794 (find_bracketed_repeat): Args are now of proper pointer-to-integer
3795 type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
3796 (find_bracketed_repeat, star_digits_closebracket): Check that the
3797 digits are not escaped.
3798 (build_spec_list): Don't bother to copy opnd_str; not needed.
3799 (build_spec_list, get_next): Simplify internal logic a bit.
3800 (card_of_complement): Fix bug due to char overflow.
3801 (get_spec_stats): Don't assume len fits into int.
3802 Check for integer overflow. Use abort() rather than assert(0).
3803 (string2_extend): Fix subscript error: is_char_class_member (..., 255)
3805 (squeeze_filter): READER is never null now; simplify code.
3806 READER arg now has a simpler type. Remove unnecessary casts.
3807 (squeeze_filter, main): Calls to fwrite improperly checked result
3808 against zero, rather than against requested size.
3809 (plain_read): New function.
3810 (read_and_delete, read_and_xlate):
3811 Remove unused filter arg, and don't worry about hit_eof.
3812 Simplify by using plain_read.
3813 (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
3814 (main): Always pass a non-null procedure to squeeze_filter.
3815 Rewrite so that class_ok isn't needed.
3817 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
3819 * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
3820 fdatasync reports EBADF when syncing (unwritable) directories.
3821 Problem reported by Albert Chin-A-Young in:
3822 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
3824 2004-05-29 Jim Meyering <jim@meyering.net>
3826 * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
3827 Patch from Albert Chin.
3829 * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
3831 * src/remove.c (push_dir): Merge declaration and adjacent assignment
3832 into a single statement.
3834 2004-05-28 Jim Meyering <jim@meyering.net>
3836 * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
3838 2004-05-22 Jim Meyering <jim@meyering.net>
3840 rm -r would get a failed assertion when run from an inaccessible
3841 directory and with two or more command line arguments including an
3842 absolute-named directory followed by a relative-named directory.
3844 * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
3845 * src/remove.c (struct cwd_state): Define.
3846 (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
3847 can be detected by the caller. Instead of returning a malloc'd
3848 directory name, communicate it to caller via a new parameter, and
3849 return an indication of whether restore_cwd failed. Update caller.
3850 Eliminate an unnecessary call to AC_stack_top.
3851 (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
3852 so we can now communicate to caller whether/how functions like
3853 restore_cwd have failed. Update caller.
3854 (rm_1): Fail if we've failed to restore the working directory
3855 and the name of the next file to remove is `.'-relative.
3856 (rm): Fail if the require_restore_cwd flag is true and we've
3857 failed to restore the working directory.
3858 * src/mv.c (rm_option_init): Initialize new member,
3859 x->require_restore_cwd.
3860 * src/rm.c (rm_option_init): Likewise.
3862 2004-05-21 Jim Meyering <jim@meyering.net>
3864 * tests/rm/inaccessible: New test for the above fix.
3865 * tests/rm/Makefile.am (TESTS): Add inaccessible.
3867 * src/remove.c (rm): Use free rather than XFREE.
3868 (remove_dir): Use xmalloc, not XMALLOC.
3869 (ds_init): Likewise.
3871 2004-05-20 Jim Meyering <jim@meyering.net>
3873 * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
3874 diagnostics in shred.c have been fixed, don't exempt shred.c from
3877 * src/shred.c: Use translatable diagnostics, e.g.
3878 change "%s: remove" to _("%s: failed to remove") and
3879 change "%s: close" to _("%s: failed to close").
3881 2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
3883 * src/shred.c (names): Bring back lower-case letters, "_", and
3884 ".". But continue to omit +, =, %, @, #, as they're either
3885 shell metacharacters (for some shells) or are not in some
3886 character sets, or (in the case of '%') must be a
3887 metacharacter somewhere.
3889 2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
3891 * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
3893 2004-05-17 Jim Meyering <jim@meyering.net>
3895 * src/shred.c (incname): Decrement `len' only once per loop iteration.
3897 chgrp and chown now dereference symlinks by default, per POSIX.
3898 Reported by Michal Politowski as http://bugs.debian.org/249177.
3900 * src/chown-core.c (chopt_init): Affect each symlink referent by default.
3901 * src/chown.c (usage): Update to reflect this.
3902 * src/chgrp.c (usage): Likewise.
3903 * NEWS: Describe the change.
3904 Adapt tests accordingly.
3905 * tests/chgrp/basic: Use -h where necessary to retain semantics.
3906 * tests/chgrp/deref: Likewise.
3907 * tests/chgrp/posix-H: Likewise.
3909 2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
3911 In shred, check for errors from fdatasync more carefully. If
3912 fdatasync fails with errno==EINVAL, it means this implementation
3913 does not support synchronized I/O for this file. Do not report
3914 this as an error, as (for example) AIX 5.2 fdatasync reports it
3915 for raw disk devices. Problem reported by Albert Chin in
3916 <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
3918 Check for write errors, though: the old code ignored them.
3919 Improve error checking in a few other cases, too (e.g., close of a
3922 Also, change several 'int' values to 'bool', so that the error
3923 checking is a bit clearer. Similarly, change unsigned values
3924 to size_t where appropriate.
3926 * src/shred.c: Include "dirname.h".
3927 (datasync) [!HAVE_FDATASYNC]: Remove.
3928 (dosync): New function.
3929 (dopass): Use it. Return 1 on write error, -1 on other error.
3930 All callers changed. Report write error if dosync does.
3931 (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
3932 not int (0/-1). All callers changed. Return false if there's a
3934 (incname): Return bool (true/false), not int (0/1). Accept
3935 size_t length, not unsigned. All callers changed. Do not
3936 bother checking for non-digits; it can't happen. Replace
3937 recursion with iteration.
3938 (wipename): Use dir_name, base_name, etc. instead of assuming
3939 Unix file names. Use size_t for length, not unsigned.
3940 Report error if unlink or close fails.
3941 (wipename, main): Use bool for booleans.
3943 (names): Use only digits and uppercase letters, for greater
3946 2004-05-16 Jim Meyering <jim@meyering.net>
3948 * tests/chown/deref: New test for the yesterday's change.
3949 * tests/chown/Makefile.am (TESTS): Add deref.
3951 2004-05-15 Jim Meyering <jim@meyering.net>
3953 chown --dereference did nothing when the owner/group of a
3954 symlink matched the desired owner/group. Reported by David Malone.
3955 Also reported in 1999 as http://bugs.debian.org/39642.
3957 * src/chown-core.c (change_file_owner): When --dereference has
3958 been specified, and when processing a symlink, stat it to get the
3959 owner and group of the referent.
3961 2004-05-14 Jim Meyering <jim@meyering.net>
3963 * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
3964 s/supercede/supersede/ reported by Andrew Fabbro.
3966 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
3968 Improve performance of `sort -m' on large files, at the cost of
3969 making some contrived examples unsafe. POSIX allows this
3970 optimization. Performance problem reported by Jonathan Baker in
3971 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
3973 * src/sort.c (first_same_file): Do not treat input pipes
3974 differently from other files.
3975 * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
3976 might write F before reading all the input.
3979 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
3981 * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
3982 '\007', for portability to EBCDIC hosts.
3983 * src/printf.c (print_esc_char): Likewise.
3984 * src/tr.c (unquote, make_printable_str): Likewise.
3986 2004-05-12 Jim Meyering <jim@meyering.net>
3988 * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
3989 where the result is used. This avoids one unnecessary lstat call
3990 per command line argument.
3992 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
3994 Don't assume that "make -C" works; Solaris "make" doesn't have -C.
3996 * src/Makefile.am (all_programs.list): New rule, copied from
3997 man/Makefile.am and tests/Makefile.am, except that we use the
3998 system tr rather than ./tr and we don't use tr -s.
3999 * tests/Makefile.am (all_programs): Use it.
4000 * man/Makefile.am (all_programs): Likewise. Renamed from programs,
4001 for consistency. All uses changed.
4003 2004-05-11 Jim Meyering <jim@meyering.net>
4005 * tests/rm/unread3: New test, for the above fix and today's
4006 lib/save-cwd.c improvement.
4007 * tests/rm/Makefile.am (TESTS): Add unread3.
4009 * src/rm.c: Don't include "save-cwd.h". It's no longer used.
4011 2004-05-10 Jim Meyering <jim@meyering.net>
4013 * tests/install/trap: New file. Test for bug fix of 2004-04-18.
4014 * tests/install/Makefile.am (TESTS): Add trap.
4016 * src/remove.c (AD_push): Don't use errno in diagnostic about
4019 Remove these generated files from CVS.
4020 * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4021 * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4022 * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4023 * tests/tr/tr-tests, tests/wc/wc-tests:
4025 2004-05-09 Jim Meyering <jim@meyering.net>
4027 * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4028 a loop initializing the just-allocated memory to zero.
4030 2004-05-08 Jim Meyering <jim@meyering.net>
4032 * tests/rm/no-give-up: New file; check for today's fix.
4033 * tests/rm/Makefile.am (TESTS): Add no-give-up.
4035 2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
4037 Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4038 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4040 * src/remove.c (remove_entry): Check for errno values like ENOENT
4041 that show the file cannot be directory, instead of for errno
4042 values like EPERM that show the file might be a directory. This
4043 is necessary because, when a single unlink() call has multiple
4044 reasons to fail, it can set errno to any of those reasons; it's
4045 only the rare errno value like ENOENT that excludes all the other
4046 possible reasons to fail even when the file is a directory.
4047 (remove_cwd_entries): Don't attempt chdir if the file is known
4048 to not be a directory.
4049 (remove_dir): Use the same method that remove_cwd_entries uses
4050 (for some reason they differed). Don't assert that saved_errno
4051 must be EPERM; it might be just about anything.
4053 2004-05-06 Jim Meyering <jim@meyering.net>
4055 * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4056 Don't add `1' to the buffer size (it was to protect against malloc
4057 implementations that fail to allocate a buffer of size zero).
4058 That is no longer necessary, since we use a malloc wrapper
4061 * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4062 * src/head.c (elide_tail_bytes_pipe): Likewise.
4063 * src/df.c (main): Likewise.
4064 * src/shred.c (do_wipefd): Likewise.
4065 * src/users.c (list_entries_users): Likewise.
4066 * src/tail.c (main): Likewise.
4067 * src/md5sum.c (main): Likewise.
4069 2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
4071 * src/df.c (show_disk, show_point): If several filesystems are
4072 mounted on the same mount point, prefer the last one, not the first.
4073 Problem reported by Christian Jones in
4074 <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4075 (show_disk): Remove unused statp arg. Return bool, not int.
4076 (show_point): Rewrite to avoid gotos. Use the same algorithm
4077 for lofs and dummies for each pass through the mount table,
4078 rather than subtly different algorithms (which are probably
4081 2004-05-03 Jim Meyering <jim@meyering.net>
4083 * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4086 2004-05-01 Jim Meyering <jim@meyering.net>
4088 When chown or chgrp is modifying the referent of a symlink,
4089 use the chown(2) function, if possible.
4090 * src/chown-core.c (change_file_owner): Don't hard-code the
4091 open/fchown/close kludge here. Use `chown' instead.
4092 The chown function works just fine on conforming systems.
4093 Other systems now go through the new chown wrapper that
4094 resorts to the old kludge.
4096 * src/chown-core.c (change_file_owner): Add a comment.
4098 2004-04-27 Jim Meyering <jim@meyering.net>
4100 * src/ptx.c: Make over 40 global extern variables `static'.
4101 (syntax_table, re_syntax_table): Remove declarations of two unused
4102 variables (they were exposed by the above change).
4104 * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4105 * src/ln.c (backup_type): Likewise.
4107 * src/remove.c (rm): Add `extern' keyword.
4108 * src/cp-hash.c (forget_created, remember_created)
4109 (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4110 * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4111 * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4112 (uid_to_name, chown_files): Likewise.
4114 * src/Makefile.am (sc_tight_scope): New rule.
4115 * Makefile.maint (sc_tight_scope): New rule.
4116 (syntax-check-rules): Add it.
4118 2004-04-26 Jim Meyering <jim@meyering.net>
4120 * Use automake-1.8.4. Regenerate dependent files.
4122 * src/sort.c (limfield): Make a comment clearer.
4124 2004-04-25 Paul Eggert <eggert@twinsun.com>
4126 Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4127 leading blanks when computing the location of the field end;
4128 it is not supposed to skip trailing blanks. Solaris 8 "sort"
4129 does conform to POSIX. Also fix the documentation to clarify
4130 this and related issues.
4132 * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4133 that the options are in alphabetical order. Describe how -b works
4134 more-accurately; this involves fixing some examples, too. Mention
4135 what happens if the start field falls after an end field or after
4136 a line end. Warn about using -k without -b, -g, -M, -n, or -t.
4137 Add an example of how to sort IPv4 addresses and Apache Common
4138 Log Format dates. Remove a duplicate example.
4139 (Putting the tools together): Use separate options rather
4140 than agglomerating them.
4141 * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4142 decode whether to skip leading blanks.
4143 (trailing_blanks): Remove.
4144 (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4146 * tests/pr/Test.pm: Fix typo in env_default comment.
4147 * tests/sort/Test.pm: Likewise.
4148 (18c, 18d): Reverse the order of output lines, so that the
4149 test cases conform to POSIX.
4151 2004-04-22 Paul Eggert <eggert@twinsun.com>
4153 More signal-handling cleanup for ls.c. Do not allow signals to
4154 happen between arbitrary output bytes, as the
4155 restore-default-color sequence can bollix up multibyte chars or
4156 color-change sequences in the ordinary output. Instead, process
4157 signals only between printing a file name and changing the color
4158 back to non_filename_text color. That way, if the signal handler
4159 changes the color (to the default), 'ls' will change it back when
4160 'ls' continues (after being suspended).
4162 Also, do not bother with signal-handling unless stdout is a
4163 controlling terminal; this lets stdio buffer better when "ls
4164 --color" is piped or sent to a file.
4166 * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4167 Do not include "full-write.h"; no longer needed.
4168 (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4169 (put_indicator_direct): Remove. All callers changed to use
4171 (caught_signals, interrupt_signal, stop_signal_count): New vars.
4172 (restore_default_color): Don't bother checking for put_indicator
4174 (sighandler): Don't handle SIGTSTP; that's another handler now.
4175 Simply set interrupt_signal to the signal, then exit.
4176 (stophandler, process_signals): New functions.
4177 (main): Don't output any color changes until _after_ the signal
4178 handlers are set up. This fixes a race condition where 'ls'
4179 could be interrupted while initializing colors, and leaving the
4180 terminal in an undesirable state.
4181 Don't mess with signal-handling if standard output is not a
4182 controlling terminal.
4183 When exiting, restore the default color, then restore the
4184 default signal handling, then act on any signals that weren't
4186 Do not print //DIRED// etc. in colors; this avoids the need
4187 to catch signals when printing them.
4188 (print_name_with_quoting): Process signals just before switching
4189 color back to non_filename_text.
4191 2004-04-23 Jim Meyering <jim@meyering.net>
4193 Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4194 * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4195 of quotearg_buffer. Patch by Mikulas Patocka.
4197 2004-04-18 Paul Eggert <eggert@twinsun.com>
4199 tee ignored SIGPIPE, but POSIX doesn't allow this.
4201 * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4202 does not allow this. This undoes the 1996-10-24 patch.
4204 2004-04-18 Paul Eggert <eggert@twinsun.com>
4206 Signal-handling cleanup for coreutils. Here are the highlights:
4208 - csplit sometimes failed to remove files when interrupted.
4209 - csplit didn't clean up if two signals arrived nearly simultaneously.
4210 - install -s would infloop on System V if SIGCHLD was ignored.
4211 - ls could incorrectly restore color if multiple signals
4212 arrived nearly simultaneously.
4214 * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4216 (filename_space, prefix, suffix, digits, files_created, remove_files):
4218 (caught_signals): New var.
4219 (cleanup): Block signals while deleting all files.
4220 (cleanup_fatal, handle_line_error, regexp_error):
4221 Mark with ATTRIBUTE_NORETURN.
4222 (create_output_file, close_output_file, interrupt_handler):
4223 Block signals while changing the number of output files,
4224 to fix some race conditions.
4225 (delete_all_files): Do nothing if remove_files is zero.
4226 Clear files_created.
4227 (main): Don't mess with signals until after argument processing
4230 * src/csplit.c (main): Rewrite signal-catching code to make it
4231 similar to other coreutils programs. When processing signals,
4232 block all signals that we catch, but do not block signals that we
4233 don't catch. Avoid problems with unsigned int warnings.
4234 * src/ls.c (main): Likewise.
4235 * src/sort.c (main): Likewise.
4237 * src/csplit.c (interrupt_handler):
4238 Use void, not (obsolete) RETSIGTYPE.
4239 * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4241 * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4242 Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4243 * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4244 * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4245 * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4247 * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4249 * src/install.c: Include <signal.h>.
4250 (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4251 given, since System V fork+wait does not work if SIGCHLD is ignored.
4253 * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4254 handler to self, not to SIG_IGN, since SIGTSTP can be received
4256 (main): Use SA_RESTART, as that is simpler than checking for EINTR
4257 failures all over the place.
4259 2004-04-20 Jim Meyering <jim@meyering.net>
4261 * src/remove.c (is_empty_dir): Clarify comment.
4263 * man/help2man: Accept new option: --program-name=NAME, so that we
4264 can override the one in --version output. This is needed solely
4265 so that test.1 doesn't refer to `[' as the program name.
4266 Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4267 * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4269 * src/pwd.c: Don't include pathmax.h; system.h already does it.
4271 * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4273 2004-04-19 Jim Meyering <jim@meyering.net>
4275 * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4276 Initialize a buffer to avoid warnings from tools like valgrind.
4278 * Makefile.maint (sc_trailing_blank): New rule.
4279 (syntax-check-rules): Add it.
4280 * .x-sc_trailing_blank: New file.
4282 Make pwd work even if the resulting name is so long that getcwd fails.
4283 * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4284 (nth_parent, find_dir_entry, robust_getcwd): New functions.
4285 (main): First try getcwd, then, upon failure, robust_getcwd.
4287 2004-04-18 Jim Meyering <jim@meyering.net>
4289 * src/who.c (print_user): Use xrealloc here, rather than
4290 unchecked realloc. Remove anachronistic casts.
4292 * src/remove.c (full_filename_): Don't leak upon failed realloc.
4294 * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4296 * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4297 renaming it. Update uses.
4299 2004-04-17 Jim Meyering <jim@meyering.net>
4301 * configure.ac: Depend on automake-1.8.3.
4303 * src/join.c (add_file_name): Declare function to be `static'.
4304 (string_to_join_field): Likewise.
4305 * src/remove.c (ds_init, ds_free): Likewise.
4307 * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4308 (syntax-check-rules): Add to the list.
4310 2004-04-13 Paul Eggert <eggert@twinsun.com>
4312 Use page-aligned buffers whenever we bother to do I/O using buffer
4313 sizes that are tailored for the files.
4315 * src/cat.c: Include getpagesize.h.
4316 * src/copy.c: Likewise.
4317 * src/shred.c: Likewise.
4318 * src/split.c: Likewise.
4319 * src/cat.c (main): Align I/O buffers to page boundaries.
4320 * src/copy.c (copy_reg): Likewise.
4321 * src/shred.c (dopass): Likewise.
4322 * src/split.c (main): Likewise.
4323 * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4324 All uses replaced by ptr_align.
4325 * src/od.c (gcd, lcm): Remove; now in system.h.
4326 * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4328 2004-04-14 Jim Meyering <jim@meyering.net>
4330 Remove m4/Makefile.am: it's no longer needed, with newer automake
4331 * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4332 * Makefile.am (SUBDIRS): Remove `m4' from the list.
4334 2004-04-13 Jim Meyering <jim@meyering.net>
4336 * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4338 2004-03-27 Paul Eggert <eggert@twinsun.com>
4340 * NEWS: cp -pu and mv -u (when copying) now take the destination
4341 file system time stamp resolution into account.
4342 * doc/coreutils.texi (mv invocation): Document this.
4343 (cp invocation): Document -u (it was missing!) with new behavior.
4345 * src/copy.c: Include "utimecmp.h".
4346 (copy_internal): Compare time stamps using utimecmp rather than
4349 2004-04-09 Jim Meyering <jim@meyering.net>
4351 * Makefile.maint (.re-list): New rule/file, to replace
4352 hard-coded list of header file names.
4353 (sc_system_h_headers): Use the new file.
4354 Don't look for sys2.h anymore.
4356 * src/system.h: Include new "stat-macros.h" rather than hard-coding
4357 all of its macro definitions -- the list was slightly out of date.
4358 Suggestion from Dmitry V. Levin.
4360 2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
4362 * NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
4363 * doc/coreutils.texi (dd invocation): Likewise.
4364 * src/shred.c (O_NOCTTY): Remove redundant decl.
4365 * src/dd.c (flags, usage): Remove noctty flag.
4366 (main): Always use O_NOCTTY when opening files.
4368 2004-04-08 Jim Meyering <jim@meyering.net>
4370 * src/dd.c (dd_copy): Mark two diagnostics for translations.
4371 (set_fd_flags): Undo part of today's change: it's a little
4372 cleaner -- and more efficient in the common case -- to go
4373 ahead and OR in the -1 when fcntl fails.
4375 * Makefile.maint (sc_dd_max_sym_length): New target.
4376 (syntax-check-rules): Add it.
4378 * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4379 Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
4381 * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4382 Rename parameter, flags, to avoid shadowing global.
4383 (LONGEST_SYMBOL): Tweak comment.
4385 2004-04-07 Paul Eggert <eggert@twinsun.com>
4387 * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4388 and new dd options iflag= and oflag=.
4389 * src/dd.c (usage): Likewise.
4390 * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4391 * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4392 (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4393 (input_flags, output_flags): New vars.
4394 (LONGEST_SYMBOL): New macro.
4395 (struct symbol_value): Renamed from struct conversion. Members
4396 symbol and value renamed from convname and conversion. The
4397 symbol value is now an array instead of a pointer; this saves
4398 a bit of space and time in practice. All uses changed.
4399 (conversions): Add nocreat, excl, fdatasync, fsync. Now const.
4400 (flags): New constant array.
4401 (iflag_error_msgid, oflag_error_msgid): New constants.
4402 (parse_symbols): Renamed from parse_conversion and generalized
4403 to handle either conversion or flag symbols.
4404 (scanargs): Adjust uses of parse_symbols accodingly. Add
4405 support for iflag= and oflag=. Reject attempts to use
4406 both excl and nocreat.
4407 (set_fd_flags): New function.
4408 (dd_copy): Just return X rather than calling quit (X), since our
4409 caller invokes quit with the returned value. Add support for
4410 fdatasync and fsync.
4411 (main): Add support for iflag=, oflag=, and new conv= symbols.
4412 * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4413 O_RSYNC, O_SYNC): Define to 0 if not already defined.
4415 * NEWS: Remove duplicate mention of BLOCKSIZE.
4417 2004-04-02 Andreas Schwab <schwab@suse.de>
4419 * src/stty.c: Add support for IUTF8 input flag.
4421 2004-04-06 Jim Meyering <jim@meyering.net>
4423 * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4424 Interix spells it `mkdev'. Reported by Mark Funkenhauser.
4426 2004-04-04 Jim Meyering <jim@meyering.net>
4428 A specified format is no longer automatically newline terminated.
4429 If you want a newline at the end of your format, use `\n'.
4430 * src/stat.c (print_it): Don't print a newline at the end of
4432 (do_statfs): Add a newline at end of each default format string.
4434 2004-03-30 Paul Eggert <eggert@twinsun.com>
4436 * src/nohup.c (main): Adjust to new calling convention
4437 for set_cloexec_flag.
4439 2004-03-31 Jim Meyering <jim@meyering.net>
4441 * tests/Fetish.pm (run_tests): Remove `.orig' file.
4442 Remove debugging diagnostic.
4444 Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4445 would not elicit an error.
4446 * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4447 (main): Don't use atoi. Use xstrtoul instead.
4449 2004-03-30 Jim Meyering <jim@meyering.net>
4451 * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4452 (syntax-check-rules): Add it.
4453 * .x-sc_prohibit_atoi_atof: New file.
4455 2004-03-29 Jim Meyering <jim@meyering.net>
4457 * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4458 test is not sensitive to system-dependent block size differences.
4459 Prompted by a report of Solaris 8 differences from Paul Eggert.
4461 * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4462 Rename `%tmp' to `%actual'. Reverse order of last two args to
4463 _compare_files (to $actual, $expected) so as to match declaration.
4465 2004-03-28 Paul Eggert <eggert@twinsun.com>
4467 Fix some gotchas encountered when porting to Solaris 8, using
4468 the Forte 6u2 compiler.
4470 * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4471 Declare sethostname, since no Solaris header does it.
4472 * src/who.c: Include "vasprintf.h", for asprintf.
4474 2004-03-28 Jim Meyering <jim@meyering.net>
4477 * src/du.c (process_file): Don't record dev/inode for directories.
4479 Under some circumstances, without -c, du would mistakenly count the
4480 space of hard-linked files, not just the first one it encountered.
4481 Reported by Anthony Thyssen.
4482 * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4484 * src/du.c: Rename global `print_totals' to `print_grand_total'.
4486 * src/du.c (main): Rearrange filtering loop to be a tiny bit
4489 * src/chown-core.c: Don't include savedir.h -- no longer needed.
4490 * src/chmod.c: Likewise.
4492 2004-03-25 Jim Meyering <jim@meyering.net>
4494 * src/du.c (main): Remove now-unused declaration of `i'.
4496 2004-03-24 Paul Eggert <eggert@twinsun.com>
4498 * src/du.c (main): Filter out file names of length zero before
4499 invoking fts, so that they don't cause fatal errors.
4501 2004-03-25 Jim Meyering <jim@meyering.net>
4503 * tests/du/files0-from (zero-len): Add a test for the above.
4505 2004-02-25 Paul Eggert <eggert@twinsun.com>
4507 * NEWS: New environment var BLOCKSIZE.
4508 * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4509 * tests/envvar-check: Test for it. Factor the code to simplify it.
4511 2004-03-23 Paul Eggert <eggert@twinsun.com>
4513 * NEWS: Shorten the du --files0-from announcement, and say
4514 "NUL-terminated" rather than "NUL-separated".
4515 * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4517 (usage): Say "NUL-terminated", not "NUL-separated".
4518 (main): Check for I/O error when istream is closed.
4519 Allow --files0-from=F even if F is empty; this specifies no files.
4520 (du_files): Now that we allow the list of files to be empty,
4522 * tests/du/files0-from: Adjust to above changes to src/du.c.
4524 2004-03-24 Jim Meyering <jim@meyering.net>
4526 * tests/tail-2/assert: Avoid race condition that could cause
4527 spurious failure. Based on a patch from Andreas Schwab.
4529 2004-03-23 Jim Meyering <jim@meyering.net>
4531 * src/du.c (main): Free the hash table, too.
4533 2004-03-22 Jim Meyering <jim@meyering.net>
4535 * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4536 the change of 2004-01-22. I can no longer reproduce the problem
4537 that prompted that change, and `info coreutils pr' would display the
4538 `printing text' section of the manual, not the one on `pr invocation'.
4540 * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4541 to match corrected output.
4543 * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4544 (main): Use readtoken0 functions rather than readtokens.
4545 Don't use errno when diagnosing readtokens0 failure.
4546 Fix off-by-one error in the token number reported in a diagnostic.
4547 (du_files): Return bool, rather than int.
4548 (main): Call readtokens0_free.
4550 2004-03-21 Jim Meyering <jim@meyering.net>
4552 * src/remove.c (ds_free): Plug a small leak.
4554 * tests/Fetish.pm: Fix typo in comment.
4556 2004-03-07 Jim Meyering <jim@meyering.net>
4558 * NEWS: du accepts a new option --files0-from=FILE, where FILE
4559 contains a list of NUL-separated file names.
4561 * src/du.c: Include "readtokens.h".
4562 (usage): Describe the new option, and adjust the `Usage':
4563 with this option, no FILE may be specified on the command line.
4564 (main): Handle the new option.
4566 * tests/du/files0-from: New tests, for the above.
4567 * tests/du/Makefile.am (TESTS): Add files0-from.
4569 * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4570 * src/tsort.c (tsort): Likewise.
4572 2004-02-29 Paul Eggert <eggert@twinsun.com>
4574 * NEWS: Add support for a new notation @N to get_date to represent
4575 the time stamp with numeric value N. Improve support for
4576 fractional time stamps. date's -d and -f options now accept them.
4577 Likewise for touch -t. date has a new option --iso-8601=ns.
4579 * doc/coreutils.texi (touch invocation):
4580 Describe use of fractional seconds.
4581 (date invocation, Options for date): Likewise.
4582 * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4583 * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4584 (Options for date): Describe new --iso-8601=ns option.
4586 * doc/getdate.texi: Add copyright notice. Change getdate to
4587 get_date when talking about the function name.
4588 (Seconds since the Epoch): New section, containing the time_t
4589 info moved from Date input formats section, along with new
4590 info about the @ syntax. Mention negative time stamps,
4591 fractional time stamps, and leap seconds.
4592 (General date syntax): Modernize examples a bit to reflect new
4594 (General date syntax, Relative items in date strings):
4595 Use ' rather than " to quote formats.
4596 (Time of day items): Add an example with fractional seconds.
4597 Describe fractional-second syntax.
4599 * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4600 needs clock_gettime.
4602 * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4603 (time_spec_string, time_spec, show_date): Support it.
4604 (usage): Remove description of -ITIMESPEC, as it's obsolete and
4605 confusing. Mention --iso-8601=ns.
4606 (batch_convert): getline returns ssize_t, not int.
4608 * src/touch.c (newtime): Now an array of two timespecs, one
4609 for access and one for modification.
4610 (ref_stats): Remove.
4611 (get_reldate): Use get_date's parameter profile.
4612 (touch, main): Adjust to above changes.
4613 (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4614 Use gettime instead of gettimeofday, for new get_date signature.
4616 * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4619 2004-03-15 Jim Meyering <jim@meyering.net>
4621 * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4622 target before updating $(prev_version_file).
4624 * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4625 See today's change in lib/getdate.y.
4626 * tests/misc/Makefile.am (TESTS): Add date-sec.
4628 2004-03-14 Jim Meyering <jim@meyering.net>
4630 * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4631 signature files, not `.asc'. Reported by angico@yahoo.com.
4633 2004-03-13 Jim Meyering <jim@meyering.net>
4635 * src/cp.c (do_copy): Tweak wording in a diagnostic.
4636 Suggestion from Karl Berry.
4637 Include "quoatearg.h".
4638 (do_copy): Use quotearg_colon (not quote) for diagnostics
4639 that begin with `"%s:'.
4641 * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4642 Suggestion from Dan Jacobson.
4644 2004-03-12 Jim Meyering <jim@meyering.net>
4648 Sometimes, when source and destination partition are different,
4649 mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
4651 * src/copy.c: When moving a set of N hard-linked files between
4652 partitions, via two or more command line arguments where the
4653 command line argument containing the Nth link contains no other
4654 link to that same file, mv would mistakenly copy the file, rather
4655 than hard-linking it to the other(s). That happens because when the
4656 final link is processed, its link count has been reduced to 1 since
4657 the other links have been `copied' to the destination partition
4658 and the source links have been removed.
4659 (copy_internal): When in move mode, use the source dev/inode
4660 pair to look up destination name even when st_nlink == 1.
4661 * src/cp-hash.c (src_to_dest_lookup): New function.
4662 * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4663 * tests/mv/part-hardlink: New file. Test for the above fix.
4664 * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4666 * announce-gen: Sync with autoconf.
4668 * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4669 This was triggered on a Linux-2.2.19 system using a file system
4670 NFS-mounted from some sort of Sun.
4672 2004-03-11 Jim Meyering <jim@meyering.net>
4674 * Use automake-1.8.3. Regenerate dependent files.
4676 2004-03-10 Jim Meyering <jim@meyering.net>
4678 * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4679 so that this test works with SELinux-enabled systems.
4680 Based on a patch from Tim Waugh.
4682 `join -1 x' would give a misleading diagnostic
4683 * src/join.c (string_to_join_field): Report that a non-numeric field
4684 number is invalid, rather than `so large that it is not representable'.
4685 * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4687 2004-03-06 Jim Meyering <jim@meyering.net>
4689 cp --sparse=always sparse-image-file.img /dev/hda1 could
4690 produce an invalid copy on the destination device.
4692 * src/copy.c (copy_reg): Even with --sparse=always, try to
4693 make `holes' only if the destination is a regular file.
4694 Reported by Szakacsits Szabolcs.
4696 2004-03-03 Paul Eggert <eggert@twinsun.com>
4698 * src/nohup.c (main): Don't invoke set_cloexec_flag with
4699 a file descriptor of -1.
4701 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
4703 * src/nohup.c: Include "cloexec.h".
4704 (main): Set the copy of stderr to close on exec.
4706 2004-03-01 Paul Eggert <eggert@twinsun.com>
4708 * configure.ac: Include <signal.h> when checking for strsignal,
4709 sys_siglist, and friends. Problem reported by Tony Leneis in
4710 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4712 2004-02-25 Paul Eggert <eggert@twinsun.com>
4714 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4715 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4718 2004-02-23 Paul Eggert <eggert@twinsun.com>
4720 * NEWS: Document how chown's USER.GROUP argument is now parsed.
4722 2004-02-23 Jim Meyering <jim@meyering.net>
4724 * src/seq.c (usage): Remove stray space after \n in --help output.
4726 2004-02-22 Jim Meyering <jim@meyering.net>
4728 * src/du.c (usage): Separate -H and --si. Say that the meaning
4729 of -H will soon change to that of --dereference-args (-D).
4731 2004-02-21 Jim Meyering <jim@meyering.net>
4733 * src/comm.c (usage): Tell what comm does when there are no options.
4734 Reword in terms of FILE1 and FILE2 rather than `left file' and
4735 `right file'. Suggestion from Dan Jacobson.
4737 2004-02-15 Paul Eggert <eggert@twinsun.com>
4739 Fix some POSIX-conformance bugs in expr.
4741 * NEWS: document the following changes to src/expr.c.
4742 * doc/coreutils.texi (expr invocation): Likewise.
4743 Document what forms integers may take, and say "integer"
4744 consistently instead of "number". Warn about operands
4745 that "expr" can misinterpret, and how to work around the
4747 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
4748 Accept a bool argument specifying whether to evaluate the
4749 expression. This is to allow short-circuit evaluation. All
4751 (null): Report that a string is zero even if it has
4752 a form like "-0" or "00".
4753 (eval1, eval): Use short-circuit evaluation for | and &.
4754 (eval): Return 0 if both arguments are null or zero, instead
4755 of returning the first argument.
4756 * tests/expr/basic: Add some tests for the above.
4758 2004-02-17 Jim Meyering <jim@meyering.net>
4762 `make check' from a build inside a chroot environment would fail
4763 * tests/help-version: Specify an argument (`/') for df, in the
4764 unusual event that there is no valid entry in /etc/mtab.
4765 Likewise for id: add the -u option, so we don't get spurious
4766 failures when there are no user or group names.
4769 * src/sort.c (usage) [-u]: Add punctuation so that the description in
4770 the help2man-generated (line-joined) man page is more readable.
4771 Reported by Tim Waugh.
4772 [-T]: Add a semicolon, for the same reason.
4774 2004-02-15 Jim Meyering <jim@meyering.net>
4776 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
4778 2004-02-11 Jim Meyering <jim@meyering.net>
4780 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
4781 $(srcdir)/../Makefile.am.in, rather than $<.
4782 Suggestion from Michael Elizabeth Chastain.
4784 2004-02-10 Jim Meyering <jim@meyering.net>
4786 * config/install-sh: Make this script executable.
4787 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
4788 is executable. Otherwise, on systems that lack a suitable install
4789 binary, `make install' would fail, because of the way this script
4790 is invoked (without `$SHELL ' prefix).
4791 Reported by Bob Proulx.
4793 2004-02-08 Jim Meyering <jim@meyering.net>
4797 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
4798 that would cause an unwarranted test failure.
4799 * tests/rm/rm3: Likewise.
4801 2004-02-07 Jim Meyering <jim@meyering.net>
4803 Remove xstat function pointer member. The way it was used was not
4804 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
4805 inline `stat' and `lstat' functions, thus making the tests of
4806 `xstat == lstat' in copy.c always fail.
4807 * src/copy.h (struct cp_options) [xstat]: Remove member.
4809 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
4810 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
4811 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
4812 (valid_options): Remove now-obsolete FIXME comments.
4814 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
4815 `*(x->xstat) (...)'.
4816 (do_copy): Declare/use local xstat rather than x->xstat.
4817 (main): Remove code that set x.xstat.
4818 * src/mv.c (cp_option_init): Don't initialize xstat member.
4819 * src/install.c (cp_option_init): Likewise.
4821 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
4822 so that emit_upload_commands can use these variables, too.
4824 2004-02-06 Jim Meyering <jim@meyering.net>
4826 * tests/rm/deep-1: Remove `du' stack space test.
4827 Apparently, `ulimit -s N' isn't portable enough.
4828 This test will be restored (with a guard against losing ulimit)
4829 in its own file later.
4831 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
4832 since this test doesn't take long enough to merit them.
4833 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
4835 * Makefile.maint (signatures): Remove definition.
4836 Now, automake's gnupload handles this.
4837 (%.sig: %): Remove now-unused rule.
4838 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
4839 `$(distdir).tar.bz2 $(distdir).tar.gz'.
4840 (emit-upload-commands): Adjust to use gnupload.
4842 2004-02-05 Jim Meyering <jim@meyering.net>
4844 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
4845 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
4846 Now, those are all defined in timespec.h.
4849 * src/date.c: Don't include timespec.h, now that system.h does it.
4851 2004-02-02 Paul Eggert <eggert@twinsun.com>
4853 Don't dump core if localtime returns NULL (possible on
4854 hosts with 64-bit time_t and 32-bit int).
4855 * src/date.c: Include "inttostr.h".
4856 (batch_convert, main):
4857 If time conversion fails, exit with nonzero status.
4858 (show_date): Return int to report conversion failure.
4859 Print the time as an int if localtime fails.
4860 * src/uptime.c: Print "??" if the current clock can't
4861 be converted by localtime. This won't happen until the year
4862 2*31 + 1900, but we don't want to dump core even if the current
4863 clock has the wrong value.
4865 * src/stat.c: Include "inttostr.h".
4866 (human_time): Print the date/time as a number of seconds since the
4867 epoch if it can't be converted by localtime. This is better than
4868 just saying "invalid", and is consistent with what "ls" does.
4869 Don't dump core if the year has more than 48 digits; this isn't
4870 possible on any contemporary host, but we might as well do it right.
4872 2004-01-31 Paul Eggert <eggert@twinsun.com>
4874 * src/stat.c (human_time): Accept time rather than
4875 pointer-to-const-time parameter, for clarity. All callers changed.
4877 2004-02-02 Jim Meyering <jim@meyering.net>
4879 * src/stat.c (do_stat): Remove extra trailing newline from
4880 default formats. Reported by Nelson H. F. Beebe.
4882 Print actual fractional seconds in time stamps, not just `.00000000'.
4883 * src/stat.c (human_time): Add and use new parameter, t_ns.
4884 (print_stat): Update callers.
4885 * src/ls.c (TIMESPEC_NS): Remove definition.
4886 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
4887 also uses this macro.
4888 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
4889 fractional seconds for files on an XFS file system, but that stat's
4890 fractional seconds were always zero.
4892 2004-01-28 Paul Eggert <eggert@twinsun.com>
4894 * src/seq.c (print_numbers): Use 'double' for loop index, not
4895 'int', to avoid problems with integer overflow. On almost all
4896 machines 'double' works in every case where 'int' works, and
4897 it works on other cases besides.
4899 2004-01-27 Jim Meyering <jim@meyering.net>
4901 * src/seq.c (usage): Mention that if INCREMENT is omitted,
4902 it defaults to 1, even when FIRST is larger than LAST.
4903 Reword so as not to exclude the possibility that INCREMENT be zero.
4905 2004-01-25 Jim Meyering <jim@meyering.net>
4909 * Makefile.maint (signatures): Comment out definition.
4911 2004-01-23 Jim Meyering <jim@meyering.net>
4913 * Makefile.maint (header_regexp): Add exitfail.
4915 * man/Makefile.am (EXTRA_DIST): Add help2man.
4916 Reported by Nelson H. F. Beebe.
4918 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
4919 so it works on systems with Perl installed somewhere other than in
4922 * src/paste.c (paste_parallel): Declare local, chr, to be of type
4923 `int', not `char', since it must hold EOF. This bug would make
4924 paste infloop on some systems. Test failures reported by
4925 Nelson H. F. Beebe and Christian Krackowizer.
4927 2004-01-22 Jim Meyering <jim@meyering.net>
4929 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
4930 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
4932 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
4933 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
4934 Use --info-page='coreutils PROG' option.
4935 Now, readlink.1 refers the user to `info coreutils readlink'
4936 rather than to `info readlink'. Reported by Matt Swift.
4938 2004-01-21 Paul Eggert <eggert@twinsun.com>
4940 Exit status cleanup.
4942 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
4943 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
4944 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
4945 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
4946 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
4947 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
4948 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
4949 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
4950 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
4951 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
4952 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
4953 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
4954 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
4955 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
4956 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
4957 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
4958 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
4960 * src/cat.c (usage): Don't bother normalizing exit status
4961 since the arg is already the correct exit status now.
4962 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
4963 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
4964 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
4965 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
4966 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
4968 * src/chown.c (main): Removed unused local 'fail'.
4970 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
4973 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
4974 * src/env.c, src/nice.c, src/su.c: Likewise.
4975 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
4976 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
4977 * src/expr.c (main): Use initialize_exit_failure rather than
4978 setting exit_failure directly; this optimizes away redundant
4980 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
4982 * src/chroot.c (main): Exit with status 1 rather than 127
4983 if chroot itself fails, as per documentation.
4985 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
4986 rather than roll-your-own symbols or integers.
4987 * src/env.c (main): Likewise.
4988 * src/nohup.c (main): Likewise.
4989 * src/su.c (run_shell): Likewise.
4991 * src/cp.c (exit_status): Remove static var....
4992 (main): Making it local here instead. Use =, not |=, to set it.
4994 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
4996 * src/date.c (batch_convert, main): Likewise.
4997 * src/dd.c (dd_copy): Likewise.
4998 * src/pr.c (first_last_page, main, getoptarg): Likewise.
4999 * src/tr.c (main): Likewise.
5000 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5001 POSIX doesn't require it.
5002 * src/dd.c (write_output, skip, dd_copy): Likewise.
5003 * src/df.c (main): Likewise.
5004 * src/id.c (main): Likewise.
5005 * src/install.c (main): Likewise.
5006 * src/ln.c (main): Likewise.
5007 * src/ls.c (main): Likewise.
5008 * src/mv.c (main): Likewise.
5009 * src/shred.c (main): Likewise.
5011 * src/env.c (main): Exit with status 1, not 2, on errors detected
5013 * src/hostname.c (main): Likewise.
5014 * src/nl.c (main): Likewise.
5015 * src/stty.c (main): Likewise.
5017 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5018 consistency with the other programs' naming conventions.
5021 * src/factor.c (main): Do not report a usage error simply
5022 because stdin has bad numbers.
5024 * src/id.c (problems): Now a boolean int, not a counter,
5025 so that we don't have to worry about int overflow. All uses changed.
5026 * src/touch.c (err): Likewise.
5028 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5030 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5031 * src/mknod.c: Likewise.
5033 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5034 on error; this is in case EXIT_FAILURE is unusual.
5035 * src/su.c (main): Likewise.
5037 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5038 changed to EXIT_CANNOT_INVOKE.
5040 * src/printenv.c (PRINTENV_FAILURE): New constant.
5041 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5042 command-line syntax problems.
5044 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5045 (main): Avoid integer overflow when seeing whether errors occurred.
5047 * src/seq.c (print_numbers): Now returns void, not (zero) int.
5048 All callers changed.
5049 (main): Remove unused local variable 'errs'. Always exit successfully
5050 if we reach the end.
5052 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5053 for consistency with other programs here. All uses changed.
5054 (main): Use 'error' to exit rather than invoking 'exit' here.
5056 * src/sort.c: Don't include <assert.h>.
5057 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
5058 (usage): Don't use 'assert'.
5059 (main): Remove redundant assignment to exit_failure.
5061 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5063 (initialize_exit_failure): New inline function.
5064 Include exitfail.h here, since we refer to exit_failure.
5065 All callers changed to not include exitfail.h.
5067 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5068 substitute them for the corresponding integer constants.
5070 * tests/help-version (expected_failure_status_date): Remove, as
5071 'date' is now normal.
5072 (expected_failure_status_nohup): New var.
5074 2004-01-21 Jim Meyering <jim@meyering.net>
5076 * tests/touch/relative: Remove `command' syntax.
5077 Thanks to Nelson H. F. Beebe and Paul Eggert.
5079 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5080 so as to avoid problems with systems using TAI clocks.
5081 Although it's no longer necessary, set TZ=UTC0 also for the
5082 initial touch command. Reported by Paul Jarc here:
5083 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5085 2004-01-20 Diego Biurrun <diego@biurrun.de>
5087 * src/dircolors.hin: Add .mov to the list of media files.
5089 2004-01-19 Paul Eggert <eggert@twinsun.com>
5091 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5092 portable). Problem reported by Christian Krackowizer. Also, use
5093 +0000 rather than +0 to specify a time zone, as the documentation
5094 requires four digits.
5096 2004-01-19 Jim Meyering <jim@meyering.net>
5098 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5099 * tests/mv/backup-is-src: Likewise.
5100 Problem reported by Peter Horst
5102 2004-01-17 Jim Meyering <jim@meyering.net>
5104 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5108 2003-12-15 Paul Eggert <eggert@twinsun.com>
5110 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5111 with -r specifying the origin for -d.
5112 * src/touch.c (flexible_date): Remove static var.
5113 (get_reldate): New function.
5114 (main): Use it, to implement this new behavior.
5116 2004-01-16 Jim Meyering <jim@meyering.net>
5118 * tests/touch/relative: New test for the above.
5119 * tests/touch/Makefile.am (TESTS): Add relative.
5121 2004-01-13 Jim Meyering <jim@meyering.net>
5123 * src/system.h: Include contents of sys2.h.
5124 * src/sys2.h: Remove file.
5125 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5127 * Use automake-1.8.2. Regenerate dependent files.
5129 * Update to gettext-0.13.1.
5130 * configure.ac: Use gettext-0.13.1.
5131 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5133 2004-01-12 Jim Meyering <jim@meyering.net>
5135 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5137 * Makefile.maint (po-check): Ensure that cvsu works before using it.
5138 Reported by Alexandre Duret-Lutz.
5140 * src/tail.c (main): Warn about following stdin only when it's a tty.
5142 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5144 2004-01-10 Jim Meyering <jim@meyering.net>
5146 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5148 2004-01-09 Jim Meyering <jim@meyering.net>
5150 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5152 2004-01-08 Jim Meyering <jim@meyering.net>
5154 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5155 From Andreas Schwab.
5157 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5158 remnant) from PATH component. That would cause tests in this directory
5159 not to run the just-built binaries, but rather whatever happened
5160 to be in one's PATH. Reported by Christian Krackowizer.
5162 2004-01-04 Jim Meyering <jim@meyering.net>
5164 * src/csplit.c (new_control_record): Use x2nrealloc
5165 rather than xrealloc.
5167 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5169 (make_path_private): Likewise.
5171 2004-01-03 Jim Meyering <jim@meyering.net>
5173 * src/paste.c: Use `bool' (not int) as the type for a few
5175 (collapse_escapes): Rewrite to set globals rather than modifying
5177 Use size_t (not int) for all counters and related index variables.
5178 (paste_parallel): Remove needless complexity of
5179 using xrealloc in the loop; just allocate the buffers up front.
5180 Free the two temporary buffers.
5181 Move declarations of locals `down' into scope where used.
5182 (paste_serial): Remove `register' attributes.
5183 (main): Simplify delim-related code.
5184 Free `delims', now that it's malloc'd.
5186 2004-01-02 Jim Meyering <jim@meyering.net>
5188 * src/chroot.c: Include "quote.h".
5189 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5190 (main): Exit with status of 127, not 1, for too-few-args,
5191 chroot failure, or chdir failure.
5192 Give a better diagnostic upon execvp failure.
5194 * src/du.c (usage): Mention that, with its current meaning,
5197 * src/tail.c (main): Warn about following stdin when it's a tty.
5198 Fail when following by name but no names are specified.
5200 2003-12-30 Jim Meyering <jim@meyering.net>
5202 * src/fold.c (main): Use memcpy, not strcpy.
5204 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5207 2003-12-28 Jim Meyering <jim@meyering.net>
5209 * src/unexpand.c (n_tabs_allocated): New global.
5210 (add_tabstop): Use x2nrealloc rather than xrealloc.
5211 * src/expand.c: Likewise.
5213 * tests/misc/expand: New file.
5214 * tests/misc/Makefile.am (TESTS): Add expand.
5216 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5217 (fillbuf): Use x2nrealloc rather than xrealloc.
5218 (sort): Use xnmalloc rather than xmalloc.
5221 2003-12-27 Jim Meyering <jim@meyering.net>
5223 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5225 2003-12-29 Paul Eggert <eggert@twinsun.com>
5227 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5228 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5230 * doc/coreutils.texi (join invocation): Remove documentation
5231 accordingly. Document that -t makes all separators significant.
5233 * src/join.c: Include posixver.h.
5234 (obsolete_usage): New var.
5235 (longopts): Put obsolete options first.
5236 (OBSOLETE_LONG_OPTIONS): New constant.
5237 (get_option, add_file_name): New functions.
5238 (main): Use them to support new behavior.
5239 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5240 Do not mark -j FIELD as obsolescent; it is longstanding
5241 UNIX tradition and is a valid extension to POSIX.
5243 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5245 2003-12-28 Paul Eggert <eggert@twinsun.com>
5247 * src/join.c (add_field_list): Don't use alloca with unbounded
5248 size; just modify the argument, which is no longer const *.
5250 Various other minor cleanups, mostly to avoid the need for casts.
5252 (extract_field): Renamed from ADD_FIELD, as it's now a function.
5254 (struct field.beg): Now char *, not unsigned char const *. All
5255 uses changed. It shouldn't be const since xmemcoll writes on its
5257 (extract_field): Likewise, for 2nd arg.
5258 (keycmp): Remove now-unnecessary cast of xmemcoll args.
5260 (is_blank): New function, to avoid need to cast arg to unsigned char.
5261 (extract_field): Use it.
5263 (xfields): Rewrite pretty much from scratch.
5265 (hard_LC_COLLATE): Now bool, not int.
5266 (get_line, getseq, add_field_list): Now returns bool, not int.
5267 (decode_field_spec, add_field_list): Return true on success (not
5268 false), for consistency with the rest of the code. All uses changed.
5270 (tab): Now char, not unsigned char. This wasn't 100% necessary
5271 but is slightly cleaner.
5272 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5274 (empty_filler): Now const *.
5276 (make_blank): Remove; wasn't needed. Remove all calls.
5277 (main): Don't set uni_blank.nfields; zero is fine.
5279 2003-12-27 Jim Meyering <jim@meyering.net>
5281 * src/join.c: Include "quote.h".
5282 (min, max): Remove definitions.
5283 Make a few function parameters and corresponding
5284 locals `const'. Use bool for boolean variables.
5285 Use size_t (not int) for all counters and related index variables.
5286 (prjoin): Remove now-useless assertion.
5287 (string_to_join_field): New function.
5288 (main): Accept join fields as large as SIZE_MAX.
5289 (keycmp): Rename `min' to MIN and max to MAX.
5291 2003-12-26 Jim Meyering <jim@meyering.net>
5293 fold -s didn't work on e.g., alpha-based systems.
5294 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5295 x2nrealloc works properly on systems with differing sizes for int
5296 and size_t. Reported by Nelson Beebe.
5298 * src/fold.c: Use `bool' (not int) as the type for a few
5301 2003-12-23 Paul Eggert <eggert@twinsun.com>
5303 * src/ls.c (length_of_file_names_and_frills):
5304 Remove forward decl; not needed.
5305 (print_file_name_and_frills, length_of_file_name_and_frills):
5306 With -m, don't output spaces before inum or size.
5307 (print_with_commas): Don't output space just before newline.
5309 2003-12-24 Jim Meyering <jim@meyering.net>
5311 * tests/ls/Makefile.am (TESTS): Add m-option.
5312 * tests/ls/m-option: New file. Test for above fixes.
5314 2003-12-20 Jim Meyering <jim@meyering.net>
5318 * src/pr.c: Change type of global, buff_allocated, to size_t.
5320 * src/join.c [struct seq]: Change types of members count and alloc
5321 from `int' to `size_t'.
5323 * tests/Makefile.am (root-hint): Tweak wording.
5325 * src/du.c: Accept new option (-0, --null) that makes it so each
5326 output line is NUL-terminated rather than newline-terminated.
5328 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5329 Reported by Volker Paul.
5330 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5331 * tests/dd/unblock-sync: New test for the above.
5333 2003-12-19 Jim Meyering <jim@meyering.net>
5335 * tests/misc/nohup: Double quote back-ticked expression,
5336 in case it ends up having an unexpected value.
5338 * tests/ls/no-arg: Use ls's -1 option in both runs.
5340 * src/du.c (fts_debug): New global.
5341 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5342 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5343 (main) [DU_DEBUG]: Accept -d option.
5345 2003-12-18 Jim Meyering <jim@meyering.net>
5347 * src/ls.c (format_user): Increment dired_pos via two statements,
5348 `dired_pos += width; dired_pos++;' rather than one,
5349 `dired_pos += width + 1;' since the latter could conceivably overflow.
5350 (format_group): Likewise.
5353 * configure.ac: Require automake-1.8.
5355 2003-12-12 Jim Meyering <jim@meyering.net>
5357 * Use automake-1.8. Regenerate dependent files.
5359 2003-12-08 Jim Meyering <jim@meyering.net>
5361 * Makefile.maint (news-date-check): New rule.
5362 (alpha beta major): Depend on it.
5364 2003-12-03 Paul Eggert <eggert@twinsun.com>
5366 * NEWS: ls -l (and similar options) now adjust all columns to
5367 fit the data. Generalized from a suggestion by Leah Q for file sizes.
5368 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5369 (format_user_width, format_group_width, unsigned_file_size,
5370 format_group): New functions.
5371 (block_size_width): Renamed from block_size_size.
5372 (inode_number_width, nlink_width, owner_width, group_width,
5373 author_width, major_device_number_width, minor_device_number_width,
5374 file_size_width): New vars.
5375 (clear_files): Initialize them.
5376 (gobble_file): Set them. Don't ceiling block_size_width to 7.
5377 (print_long_file): Use them.
5378 (gobble_file): Use a new local variable 'f' to make the code
5379 smaller and more consistent with other functions.
5380 (format_user): Output to stdout, not to a buffer, so that we
5381 don't have to worry about buffer overrun. Update dired_pos.
5382 (print_long_file): Don't put owner, group, author into buffer;
5383 just print them directly. Don't assume link counts and
5384 major and minor numbers fit into unsigned long int.
5385 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5386 'ls' output is fixed-width.
5388 2003-12-02 Jim Meyering <jim@meyering.net>
5390 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5392 2003-11-27 Jim Meyering <jim@meyering.net>
5394 * Use automake-1.7f. Regenerate dependent files.
5396 2003-11-24 Paul Eggert <eggert@twinsun.com>
5398 Parse floating-point operands and options in the C locale.
5399 POSIX requires this for printf, and we might as well be
5400 consistent elsewhere (tail, sleep, seq).
5402 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5403 needed now that we assume C89. Include "c-strtod.h".
5404 (xstrtod): Call c_strtod, not strtod.
5405 * src/sleep.c: Include "c-strtod.h".
5406 (main): Update xstrtod call to include new argument, c_strtod.
5407 * src/seq.c (scan_double_arg): Likewise.
5408 * src/tail.c (parse_options): Likewise.
5410 2003-11-24 Jim Meyering <jim@meyering.net>
5412 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5413 Reported by Mark Conty.
5415 2003-11-22 Jim Meyering <jim@meyering.net>
5417 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
5418 (sc_system_h_headers): Do this test only if sys2.h exists.
5420 2003-11-20 Jim Meyering <jim@meyering.net>
5422 * tests/help-version: Ensure that the bug-reporting address is
5423 included in the --help output for every program.
5424 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5426 * src/ptx.c (usage): Output bug-reporting address.
5427 Reported by Dan Jacobson.
5429 2003-11-19 Jim Meyering <jim@meyering.net>
5431 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5432 on the join fields. Suggestion from Bruce Robertson.
5434 2003-11-18 Jim Meyering <jim@meyering.net>
5436 `od -c -w9999999' could segfault
5437 * src/od.c (dump): Use xnmalloc/free, not alloca.
5439 2003-11-16 Jim Meyering <jim@meyering.net>
5441 * Use autoconf-2.59. Regenerate dependent files.
5443 * tests/du/hard-link: Minor tweak: use mkdir -p.
5445 Fix read-from-free'd-buffer error detected by valgrind.
5446 * src/csplit.c (remove_line): Don't return a pointer to data in
5447 a freed buffer. Instead, arrange to free the buffer on the
5450 * tests/misc/csplit: New test for above fix.
5452 2003-11-11 Jim Meyering <jim@meyering.net>
5454 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5455 This avoids a warning from valgrind about memcpy with overlapping
5456 source and destination.
5458 * configure.ac: Require automake-1.7.8.
5460 2003-11-09 Jim Meyering <jim@meyering.net>
5462 * Use automake-1.7.9. Regenerate dependent files.
5464 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5465 * src/chown.c: Likewise.
5467 * src/chown-core.c: Include "root-dev-ino.h".
5468 (chopt_init): Initialize new member.
5469 (change_file_owner): Support rm's new --preserve-root option.
5471 * src/remove.c: Include "root-dev-ino.h".
5472 (remove_cwd_entries): Remove now-obsolete FIXME comment.
5473 (remove_dir): Support rm's new --preserve-root option.
5475 * src/chown.c: Include "root-dev-ino.h".
5476 Add new options: --preserve-root and --no-preserve-root.
5478 * src/chmod.c: Include "root-dev-ino.h".
5479 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5480 ROOT_DEV_INO_WARN macros.
5481 (get_root_dev_ino): Remove function definition, now that it's
5482 been moved to a separate file.
5483 (usage): Describe new options.
5485 * src/mv.c (rm_option_init): Initialized new member.
5487 * src/remove.h: Include "dev-ino.h".
5488 (struct rm_options): Add new member: root_dev_ino.
5489 * src/chown-core.h: Include "dev-ino.h".
5490 (struct Chown_option): Add new member: root_dev_ino.
5492 2003-11-06 Jim Meyering <jim@meyering.net>
5494 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5495 hard-coding `sizeof FILE*'.
5497 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
5499 * src/wc.c (main): Free `fstatus' so there is no confusion about
5500 whether it's leaked or not.
5501 * src/who.c (who): Likewise for `utmp_buf'.
5503 2003-11-05 Paul Eggert <eggert@twinsun.com>
5505 Fix 'cut' problems with size_t overflow and unsigned int.
5506 More generally, resize integer variables to fit use more precisely.
5507 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5508 (struct range_pair): Make members to be of type size_t, not unsigned.
5509 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5510 (suppress_non_delimited, output_delimiter_specified,
5511 have_read_stdin, print_kth, set_fields): Now bool, nt int.
5512 (delim): Now unsigned char, not int.
5513 (mark_printable_field, is_printable_field, is_range_start_index,
5514 set_fields, set_fields, cut_bytes, cut_fields):
5515 Use size_t, not unsigned, for field and byte counts.
5516 (hash_int): Use uintptr_t, not unsigned, for pointers converted
5517 to integers. This squeezes more info out of them.
5518 (set_fields, cut_bytes, cut_fields, main):
5519 Use bool, not int, for booleans.
5520 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5522 2003-11-05 Paul Eggert <eggert@twinsun.com>
5524 * man/Makefile.am (check-programs-vs-x):
5525 Work even if $(programs) contains '$'.
5526 Work even if 'missing=1' in environment.
5527 Don't report an error simply because $(programs) outputs nothing.
5529 2003-11-05 Jim Meyering <jim@meyering.net>
5531 * Use autoconf-2.58. Regenerate dependent files.
5533 * src/tr.c (spec_init): Fix typo in last change.
5535 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5536 call to variadic version_etc function, so that it works even on systems
5537 for which sizeof char* != sizeof int.
5538 * src/true.c (main): Likewise.
5539 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5540 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5541 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5542 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5543 Similarly, cast NULL to `(char *)' in call to variadic function,
5544 parse_long_options, so that it works even on systems for which
5545 sizeof char* != sizeof int.
5546 A similar problem was reported by Harti Brandt in
5547 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5549 * src/users.c (users): Free `utmp_buf' explicitly so that people
5550 don't mistake this for a real leak.
5551 Patch by Dennis Smit <ds@nerds-incorporated.org.
5553 2003-11-04 Paul Eggert <eggert@twinsun.com>
5555 * README: Document _POSIX2_VERSION.
5557 2003-11-04 Jim Meyering <jim@meyering.net>
5559 * src/tac.c (memrchr): Remove #if-0'd function.
5560 (tac_stdin_to_mem): Clean up #if-0'd code.
5562 * src/od.c (decode_format_string): Remove unnecessary casts.
5563 Use more maintainable `sizeof *var'.
5564 (main): Call decode_format_string rather than decode_one_format,
5565 now that `spec' may be NULL.
5567 * src/chmod.c (AUTHORS): Add my name.
5569 * src/split.c (next_file_name): Use `sizeof *var' rather than
5570 hard-coding `sizeof size_t'.
5572 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5574 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5575 to avoid potential overflow in pointer arithmetic.
5576 (set_fields): Use not `1', but rather `sizeof *printable_field' as
5577 second argument to xcalloc.
5578 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5579 rather than xrealloc.
5580 * src/date.c (show_date): Likewise.
5581 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5582 * src/pr.c (store_char): Likewise.
5583 * src/fold.c (fold_file): Likewise.
5585 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5586 type changes (unsigned int -> size_t) in hash.c.
5587 * src/cp-hash.c (src_to_dest_hash): Likewise.
5588 * src/du.c (entry_hash): Likewise.
5589 * src/ls.c (dev_ino_hash): Likewise.
5590 * src/cut.c (hash_int): Likewise. Declare function as static.
5592 2003-11-03 Jim Meyering <jim@meyering.net>
5594 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5595 * tests/misc/fold: Fail the test immediately if we're not running
5596 the expected version of fold.
5598 2003-11-02 Jim Meyering <jim@meyering.net>
5600 * src/tr.c (append_normal_char, append_range, append_char_class)
5601 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5602 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
5603 and usually shorter.
5604 * src/copy.c (copy_internal): Likewise.
5605 * src/join.c (initseq, add_field, make_blank): Likewise.
5606 * src/od.c (main): Likewise.
5607 * src/cp.c (make_path_private): Likewise.
5608 * src/tsort.c (new_item, record_relation): Likewise.
5610 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5611 (main): Also remove anachronistic cast of xmalloc return value.
5612 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5613 (main): Also remove anachronistic cast of xmalloc return value.
5614 * src/sort.c (inittables): Likewise.
5615 (sort): Also Split a long line.
5617 2003-10-25 Jim Meyering <jim@meyering.net>
5619 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5620 type changes (unsigned int -> size_t) in hash.c.
5621 * src/cp-hash.c (src_to_dest_hash): Likewise.
5622 * src/du.c (entry_hash): Likewise.
5623 * src/ls.c (dev_ino_hash): Likewise.
5624 * src/cut.c (hash_int): Likewise. Declare function as static.
5626 2003-10-21 Jim Meyering <jim@meyering.net>
5628 Don't fail when run with VERBOSE=yes.
5629 * tests/chgrp/basic: Do `set +x' before starting the subshell
5630 from which we invoke chgrp. Otherwise, the output from the
5631 VERBOSE=yes-induced `set -x' would result in spurious differences.
5632 Reported by Russel Coker via Michael Stone.
5634 2003-10-19 Jim Meyering <jim@meyering.net>
5636 chmod now uses fts to perform a directory traversal when -R is
5637 specified. Before, it operated on full path names, and as such
5638 would encounter the PATH_MAX (often 4096) limit.
5640 * src/chmod.c: Include "xfts.h".
5641 (process_file): Rename from change_file_mode.
5642 Adapt to be used with fts.
5643 (process_files): New function.
5645 2003-10-18 Jim Meyering <jim@meyering.net>
5647 * tests/du/deref-args: Ensure that du -D now dereferences all
5648 symlinks specified on the command line, not just those that
5649 reference directories.
5651 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5652 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5653 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5654 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5655 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5656 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5657 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5658 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5659 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
5660 Update the call to parse_long_options so that `AUTHORS, NULL' are the
5662 * src/true.c (main): Append NULL to version_etc argument list.
5663 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5665 2003-10-17 Andreas Schwab <schwab@suse.de>
5667 * tests/mk-script: Get $srcdir from first parameter instead of
5669 (main): Update usage.
5671 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5672 first argument of mk-script.
5673 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
5675 2003-10-17 Jim Meyering <jim@meyering.net>
5677 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5678 generated `man' page is more readable. Suggestion from Dan Jacobson.
5680 * src/chown-core.c (change_file_owner): Handle the cases in
5681 which fts_info indicates an error with the given entry.
5683 * src/du.c (main): Simply assign to bit_flags.
5684 Don't bother with bit arithmetic.
5686 * tests/chmod/no-x: New file.
5687 * tests/chgrp/no-x: New file.
5688 * tests/chmod/Makefile.am (TESTS): Add no-x.
5689 * tests/chgrp/Makefile.am (TESTS): Likewise.
5691 * src/du.c: Include "xfts.h".
5692 (du_files): Use xfts_open, rather than fts_open.
5693 * src/chown-core.c (chown_files): Likewise.
5695 2003-10-16 Jim Meyering <jim@meyering.net>
5697 * src/chgrp.c (main): Simply assign to bit_flags.
5698 Don't bother with bit arithmetic.
5699 * src/chown.c (main): Likewise.
5700 Rename a couple of local variables.
5701 Remove unnecessary casts.
5703 * src/tail.c (start_bytes): Rename local, remainder, to avoid
5704 gcc's warning about shadowing a global.
5706 2003-10-15 Jim Meyering <jim@meyering.net>
5708 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5709 use fts to perform a directory traversal when -R is specified.
5710 Before, they operated on full path names, and as such would
5711 encounter the PATH_MAX (often 4096) limit.
5712 They are more efficient. For example, before, chgrp -R would
5713 take almost 5 seconds to change about 2000 directories and fail
5714 (with `File name too long'), while now it succeeds on a hierarchy
5715 of depth 20,000 in 1/10 the time.
5717 * src/chown.c: Include "userspec.h" and "fts_.h".
5718 (WRITTEN_BY): Add my name.
5719 (getpwnam, getgrnam, getgrgid): Remove declarations.
5720 (endpwent): Remove definition.
5722 (main): Handle new options.
5723 Call new function, chown_files rather than change_file_owner.
5725 * src/chgrp.c: Include "fts_.h".
5726 (WRITTEN_BY): Add my name.
5727 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
5730 (main): Handle new options.
5731 Call new function, chown_files rather than change_file_owner.
5733 Rewrite to iterate through hierarchies using fts rather than
5734 via explicit recursion.
5735 * src/chown-core.c: Include "fts_.h"
5736 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
5737 on a single file at a time.
5738 (chown_files): New function.
5739 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
5740 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
5741 [struct Chown_option] (dereference): Remove member with ambiguous name.
5742 [struct Chown_option] (affect_symlink_referent): New member.
5743 (chown_files): New prototype.
5745 * tests/chgrp/recurse: Update tests accordingly.
5746 * tests/chgrp/posix-H: New tests for the above.
5747 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
5749 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
5750 work even for superuser. Suggestion from Dan Jacobson.
5752 2003-10-14 Paul Eggert <eggert@twinsun.com>
5754 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
5756 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
5757 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
5758 * src/sort.c (parse_field_count): Handle the case where overflow
5759 and invalid suffix char are both reported.
5761 2003-10-14 Jim Meyering <jim@meyering.net>
5763 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
5764 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
5767 2003-10-13 Paul Eggert <eggert@twinsun.com>
5769 Fix to avoid a denial-of-service attack if the display width is
5770 enormous. Also, clean up the code a bit by removing duplicate code.
5772 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
5773 (calculate_columns): New function, that contains code that used
5774 to be common to print_many_per_line and print_horizontal.
5775 (print_many_per_line, print_horizontal): Use it.
5776 (decode_switches): Set max_idx here, not in calculate_columns.
5777 (print_current_files): Don't call init_column_info; calculate_columns
5779 (init_column_info): Don't allocate a lot more space than is needed
5780 to represent the current set of files. Allocate all the new
5781 size_t cells in one call to xnmalloc, rather than a row at a time.
5783 2003-10-13 Jim Meyering <jim@meyering.net>
5785 * src/ls.c (init_column_info): Add another FIXME comment.
5787 2003-10-13 Paul Eggert <eggert@twinsun.com>
5789 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
5790 Remove several arbitrary limits on hosts where int cannot represent
5793 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
5794 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
5795 struct column_info.col_arr[0], max_idx):
5796 Now size_t, not int.
5797 (get_funky_string): Return bool indicating success, instead of
5798 a negative count to indicate failure. Store number of columns
5799 through new parameter OUTPUT_COUNT; that way, they can never
5800 go negative. Change equals_end from int to bool. All uses
5802 (struct column_info.valid_len): Now bool, not int. All uses changed.
5803 (dired_dump_obstack, get_funky_string, clear_files,
5804 extract_dirs_from_files, print_current_files,
5805 print_many_per_line, print_horizontal, init_column_info,
5806 put_indicator, length_of_file_name_and_frills,
5807 print_with_commas): Use size_t, not int, for local variables
5809 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
5810 Check for TIOCGWINSZ returing negative values (or values greater
5812 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
5814 Use xmalloc and xnmalloc, not XMALLOC.
5815 (gobble_file): Use xnrealloc, not XREALLOC.
5816 (print_color_indicator): Remove now-unnecessary cast to size_t.
5818 2003-10-12 Paul Eggert <eggert@twinsun.com>
5820 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
5821 * tests/sort/sort-tests: Remove from CVS; assume that people
5822 brave enough to check coreutils out from CVS can rebuild it.
5824 2003-10-12 Jim Meyering <jim@meyering.net>
5826 New options: --preserve-root and --no-preserve-root.
5827 * src/chmod.c (change_file_mode): Honor new option.
5828 (change_file_mode): Strip trailing slashes on directory
5829 argument passed to change_dir_mode.
5830 (get_root_dev_ino): New function.
5831 (main): Initialize global, root_dev_ino.
5833 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
5834 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
5836 * src/chmod.c (change_file_mode): Likewise.
5838 2003-10-08 Jim Meyering <jim@meyering.net>
5840 * src/csplit.c (main): Remove obsolete FIXME.
5842 2003-10-07 Jim Meyering <jim@meyering.net>
5844 * Use automake-1.7.8. Regenerate dependent files.
5846 2003-09-29 Paul Eggert <eggert@twinsun.com>
5850 * doc/coreutils.texi (csplit invocation):
5851 The regexp offset need not have a sign; POSIX requires support
5852 for signless offets.
5854 Be more careful about int widths. For example, remove some
5855 arbitrary limits by replacing 'unsigned' with 'size_t',
5856 'uintmax_t', etc. Use standard bool rather than a homegrown type.
5857 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
5858 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
5859 to <stdbool.h> usage.
5860 (struct control): offset is now intmax_t, not int.
5861 repeat_forever is now bool, not int.
5862 (struct cstring): len is now size_t, not unsigned int.
5863 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
5864 size_t, not unsigned. start_line, first_available are now
5865 uintmax_t, not unsigned.
5866 (hold_count, control_used): Now size_t, not unsigned.
5867 (last_line_number, current_line, bytes_written):
5868 Now uintmax_t, not unsigned.
5869 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
5870 create_new_buffer, get_new_buffer, load_buffer, find_line,
5871 process_regexp, split_file, new_control_record, extract_regexp,
5872 get_format_width, get_format_prec, max_out):
5873 size args, locals, and returned values are now size_t, not unsigned
5875 (get_first_line_in_buffer, find_line, write_to_file,
5876 handle_line_error, process_line_count, regexp_error, process_regexp,
5878 File line, byte, and repetition counts are now uintmax_t, not unsigned.
5879 (check_for_offset): Don't require a sign before the offset.
5880 Use xstrtoimax to do the real work.
5881 (extract_regexp): Remove harmful cast of size to unsigned.
5882 256 -> 1<<CHAR_BIT, for clarity.
5883 (get_format_flags): Return at most 3, to avoid worries about overflow.
5885 (bytes_to_octal_digits): Remove.
5887 (cleanup): Don't check whether output_stream is NULL, since
5888 close_output_file does that for us.
5890 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
5891 (sizeof *p);" instead of the more long-winded alternatives.
5893 (get_new_buffer): Use O(1) algorithm for resizing a buffer
5894 to a much larger size, instead of an O(N) algorithm.
5896 (process_regexp): Use plain NULL rather than casted 0.
5898 (make_filename): Use %u, not %d, to format unsigned file number.
5900 (new_control_record): Use xrealloc exclusively, since it handles
5903 (extract_regexp): Change misspelled word in diagnostic.
5905 (get_format_width): Even if a minimum field width is specified,
5906 allow room for enough octal digits to represent the value of
5907 the maximum representible integer. This fixes a potential
5908 buffer overrun. Calculate this room at compile-time, not
5909 at run-time; this removes the need for bytes_to_octal_digits.
5910 Check for overflow; this removes a FIXME.
5912 (get_format_prec): Don't allow precision to be signed; it's
5913 not ANSI. Check for overflow. Remove hardcoded "11" as
5914 default precision; this fixes a potential buffer overrun
5915 on hosts with wider size_t.
5917 (get_format_conv_type): Change local variable to be of type
5918 unsigned char, not int; this removes a potential subscript
5919 violation on hosts where char is signed.
5921 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
5922 Allow "%%" in format. Don't overflow when
5923 counting lots of percents.
5925 (usage): Default sprintf format is %02u, not %d.
5927 2003-10-05 Jim Meyering <jim@meyering.net>
5929 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
5931 * src/du.c (du_files): Mark diagnostic for translation.
5933 2003-10-04 Jim Meyering <jim@meyering.net>
5935 * src/du.c (du_files): Ignore any failure of fts_close.
5936 Give better diagnostics for failed fts_open.
5938 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
5940 Deprecate existing use of -H (aka --si).
5941 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
5942 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
5943 (main): Warn that the meaning of -H will soon change to be
5946 2003-10-03 Jim Meyering <jim@meyering.net>
5948 * src/du.c: Accept --no-dereference (-P).
5950 2003-10-02 Jim Meyering <jim@meyering.net>
5952 * tests/du/trailing-slash: Adjust for slightly different output.
5954 Rewrite du.c to use fts.
5955 * src/du.c: Include "fts_.h", not ftw.h.
5956 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
5957 (IS_FTW_DIR_TYPE): Remove definition.
5958 (IS_DIR_TYPE): Define.
5959 (is_symlink_to_dir): Remove now-unnecessary function.
5960 (process_file, du_files): Rewrite to use fts.
5962 * tests/du/inaccessible-cwd: Ensure that even when run from an
5963 inaccessible directory, du can still operate on accessible
5964 directories elsewhere.
5965 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
5967 * tests/rm/deep-1: Ensure that du can process a hierarchy
5968 of depth 400 while using no more than 50KB of stack space.
5970 2003-10-01 Akim Demaille <akim@epita.fr>
5972 * announce-gen (print_news_deltas): New function, extracted from main.
5973 (main): Make `news_file' an array.
5974 Use '...=s' => \@var for --news and --url-directory specs.
5975 Before there were a couple of portability problems.
5977 2003-09-28 Jim Meyering <jim@meyering.net>
5979 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
5980 (syntax-check-rules): Add it.
5982 * src/copy.c: Remove unnecessary cast of alloca, since now it's
5983 guaranteed to be (void *).
5984 * src/cp.c: Likewise.
5985 * src/join.c: Likewise.
5986 * src/ln.c: Likewise.
5987 * src/ls.c: Likewise.
5988 * src/od.c: Likewise.
5989 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
5991 2003-09-27 Jim Meyering <jim@meyering.net>
5993 Don't exhaust virtual memory when processing large inputs.
5994 Fix this by removing csplit's internal free-list management;
5995 instead rely on malloc for that.
5997 * src/csplit.c (free_list): Remove global.
5998 (clear_all_line_control): Remove function.
5999 (get_new_buffer): Always use create_new_buffer to obtain a
6000 new buffer, rather than searching free_list.
6001 (free_buffer): Just call free.
6002 Reported by Nikola Milutinovic.
6004 2003-09-26 Jim Meyering <jim@meyering.net>
6006 * man/rm.x: Also list `chattr' in SEE ALSO section.
6007 Suggestion from Mark Hubbart.
6009 2003-09-25 Jim Meyering <jim@meyering.net>
6011 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6012 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6014 * Use autoconf-2.57d. Regenerate dependent files.
6016 2003-09-24 Jim Meyering <jim@meyering.net>
6018 Minor efficiency tweak.
6019 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6020 (do_link): Likewise.
6022 2003-09-23 Jim Meyering <jim@meyering.net>
6024 * src/paste.c (paste_serial): Save errno after input error,
6025 to report proper errno value.
6026 Based on a patch from Paul Eggert.
6028 * src/tee.c (tee): Adjust fwrite arguments so that the return
6029 value is the number of bytes written.
6031 2003-09-16 Paul Eggert <eggert@twinsun.com>
6033 Don't assume ferror sets errno. Bug reported by Bruno Haible.
6035 * src/comm.c (compare_files): Save errno after input error,
6036 to report proper errno value.
6037 * src/fold.c (fold_file): Likewise.
6038 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6039 * src/unexpand.c (unexpand): Likewise.
6041 * src/csplit.c (close_output_file): Don't report bogus errno value
6042 after ferror discovers an output error. We don't know the proper
6043 errno value, since it might have been caused by any of a whole
6044 bunch of calls, and it might have been trashed in the meantime.
6045 Fixing this problem will require much more extensive changes;
6046 in the meantime just say "write error".
6047 * src/od.c (check_and_close, dump, dump_strings): Likewise.
6048 * src/uniq.c (check_file): Likewise.
6050 * src/join.c (get_line): Report error right away if I/O fails,
6051 so that the proper errno value is used.
6052 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6053 * src/tee.c (tee): Likewise.
6054 * src/uniq.c (check_file): Likewise.
6056 * src/od.c (skip): If a read fails, don't retry it later, so
6057 that we report the proper errno.
6059 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6061 * src/tee.c (tee): Once a write failure has occurred, don't bother
6062 writing anything more to that stream.
6064 * src/uniq.c (check_file): Check for ferror (stdout) even if
6067 * src/yes.c (UNROLL): Remove.
6068 (main): Exit immediately when write failure is detected.
6069 Simplify code by assigning to argv when argc == 1.
6071 2003-09-21 Paul Eggert <eggert@twinsun.com>
6073 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6074 (WRITTEN_BY): Change "Franc,ois" (actually using
6075 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6078 2003-09-19 Jim Meyering <jim@meyering.net>
6080 `du -D symlink-to-dir' would mistakenly omit the slash in
6081 lines like this: 24 symlink-to-dir/subdir
6082 * src/du.c (process_file): Fix offset calculation.
6083 Reported by Jeff Sheinberg as Debian bug #211591;
6084 http://bugs.debian.org/205251
6086 * tests/du/deref-args: New file/test for the above.
6087 * tests/du/Makefile.am (TESTS): Add deref-args.
6089 * src/du.c (process_file): Remove useless disjunct.
6091 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6093 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6094 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6095 Mark each WRITTEN_BY string as translatable.
6097 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6098 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6099 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6100 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6101 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6102 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6103 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6104 * who.c, whoami.c, yes.c: Revert yesterday's changes.
6105 Instead, a subsequent change will embed `Written by ' in
6106 each string along with the author names.
6108 * src/true.c: Revert yesterday's changes.
6109 * src/sys2.h: Likewise.
6111 2003-09-18 Jim Meyering <jim@meyering.net>
6113 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6114 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6115 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6116 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6117 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6118 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6119 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6120 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6121 comma-separated list of strings and/or update the call to
6122 parse_long_options so that `AUTHORS, NULL' are the last parameters.
6123 * src/true.c (main): Append NULL to version_etc argument list.
6124 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6126 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6127 shadowing the math function name. Also rename loga to log_a.
6129 2003-09-14 Jim Meyering <jim@meyering.net>
6131 * src/factor.c (print_factors): Give a separate diagnostic
6132 for numbers that are too large, but otherwise valid.
6133 Reported by Dániel Varga.
6135 2003-09-10 Jim Meyering <jim@meyering.net>
6137 * Use automake-1.7.7. Regenerate dependent files.
6139 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6140 of `fmt -1'. Using the just-built tr is a little cleaner.
6141 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6142 * man/Makefile.am (programs, check-x-vs-1): Likewise.
6144 2003-09-09 Jim Meyering <jim@meyering.net>
6146 * src/copy.c: Alphabetize includes.
6147 Remove duplicate inclusion of "same.h".
6149 2003-09-08 Jim Meyering <jim@meyering.net>
6151 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6152 Didn't give enough of a benefit, mainly because it's not yet
6157 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6158 (check-programs-vs-x): Fail if $(programs) is empty.
6160 * src/remove.c: Add a comment.
6162 2003-09-07 Jim Meyering <jim@meyering.net>
6164 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6165 Don't define. These symbols are no longer used.
6167 * tests/misc/tty-eof: Write ^D as \cD.
6168 Complete the change of 2003-08-02.
6170 * Makefile.maint (po-check): Use cvsu, so that a temporary source
6171 file in lib/ or src/ doesn't induce an unwarranted failure.
6172 Add a kludge to filter out the sole generated source file that
6173 also has translatable messages: src/false.c.
6175 2003-09-06 Jim Meyering <jim@meyering.net>
6177 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6178 (parse_options): Give a diagnostic for (but still accept) the
6179 deprecated --allow-missing option.
6181 2003-09-04 Paul Eggert <eggert@twinsun.com>
6183 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
6184 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6186 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
6187 size_bound ourselves. if an input file is a pipe and the user
6188 specified a size, use that size instead of trying to guess the
6189 pipe size. This has the beneficial side effect of avoiding the
6190 overhead of default_sort_size in that case. All callers changed.
6191 (sort): Remove static var size; now done by sort_buffer_size.
6193 2003-09-05 Jim Meyering <jim@meyering.net>
6195 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
6197 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6198 to start, rather than just .1. Upon failure, print unexpected state.
6200 2003-09-04 Paul Eggert <eggert@twinsun.com>
6202 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6203 SAFE_READ_ERROR to tmp->nbytes.
6204 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6206 * src/head.c (struct linebuffer): Change nbytes and nlines
6207 from unsigned int to size_t. unsigned int is safe (after the
6208 2003-09-03 patch) but size_t is cleaner.
6209 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6210 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6212 Standardize on BUFSIZ as opposed to other macro names and values.
6213 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
6214 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6215 stdio.h has always defined it,
6216 and other code already assumes it's defined.
6217 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6218 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6219 (io_buf): IO_BUF_SIZE -> BUFSIZ.
6221 2003-09-04 Paul Eggert <eggert@twinsun.com>
6223 * src/seq.c (step): Default to 1.
6224 (print_numbers): Allow the output to be empty.
6225 (main): The default step is 1, even if LAST < FIRST;
6226 as per documentation.
6227 * tests/seq/basic (onearg-2): Output should be empty.
6229 2003-09-05 Jim Meyering <jim@meyering.net>
6231 * Makefile.cfg (wget_files): Temporarily disable, until master
6232 versions are restored to ftp.gnu.org.
6234 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6236 Make seq's --width (-w) option work properly even when the
6237 endpoint requiring the larger width is negative and smaller than
6239 * src/seq.c (get_width_format): Include `-' in the set of bytes
6240 allowed in a `simple' number (no decimal point, no exponent).
6241 Reported by Patrick Mauritz.
6243 2003-09-02 Paul Eggert <eggert@twinsun.com>
6245 * NEWS: sort -t '\0' now uses a NUL tab.
6246 sort option order no longer matters, unless POSIX requires it.
6247 * src/sort.c (usage): Say "blanks" instead of "whitespace",
6248 Similar fixes for many comments.
6249 (TAB_DEFAULT): New constant, so that we can support NUL as
6250 the field separator.
6251 (tab): Now int, not char. Initialize to TAB_DEFAULT.
6252 (specify_sort_size): If multiple sizes are specified, use the largest.
6253 (begfield, limfield): Support NUL tab char.
6254 (set_ordering): Do not let -i override -d.
6255 (main): Report an error if incompatible -o or -t options are given.
6256 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
6258 2003-09-05 Jim Meyering <jim@meyering.net>
6260 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6262 2003-09-03 Andreas Schwab <schwab@suse.de>
6264 Bug report and patch here:
6265 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6266 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6267 * src/head.c (elide_tail_lines_pipe): Likewise.
6269 2003-09-03 Jim Meyering <jim@meyering.net>
6271 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6272 small amount of code from him was first moved to lib/human.c, and was
6273 subsequently rewritten entirely.
6274 * src/df.c (AUTHORS): Likewise.
6276 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
6278 * src/md5sum.c (split_3): Accept the BSD format for generic
6279 message digest modes. Currently works with BSD's MD5 and SHA1
6280 formats since these are the two algorithms presently used in
6281 coreutils. Updated comments to reflect this change.
6282 (bsd_split_3): Updated comments.
6284 * tests/md5sum/basic-1: New test to make sure that
6285 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6286 from `check-bsd' test in tests/sha1sum/basic-1).
6288 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6289 --check exit status and BSD SHA1 format (adapted from tests
6290 in tests/md5sum/basic-1).
6292 2003-08-30 Jim Meyering <jim@meyering.net>
6294 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6296 When source and destination arguments refer to the same file, reside
6297 on a partition (e.g. VFAT) on which distinct names may refer to the
6298 same directory entry (often due to variations in case), and when the
6299 link count for the file is 1, mv no longer unlinks the file. Instead,
6300 it gives the expected diagnostic that the source and destination are
6301 the same. WARNING: this is an incomplete fix. If the file happens
6302 to have a link count of 2 or greater, such an erroneous mv command
6303 will still unlink it.
6304 Although that is not possible on vfat or umsdos, it is possible on
6305 other file system types, e.g., ntfs, and hpfs.
6306 * src/copy.c (same_file_ok): Invoke same_name (which might still
6307 return false for names that refer to the same directory entry)
6308 only if the link count is 2 or more.
6309 * tests/mv/vfat: Show how to demonstrate the above problem.
6310 This test is not run.
6311 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6313 2003-08-27 Jim Meyering <jim@meyering.net>
6315 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6316 who's -l option has been eliciting an unconditional warning about
6317 this impending change since sh-utils-2.0.12 (April 2002).
6319 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6320 This would happen for nonempty files not ending with a newline.
6321 Reported by Dan Jacobson.
6322 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
6323 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6325 * src/stat.c (print_it): Avoid buffer overrun that would
6326 occur when the user-specified format string ends with `%'.
6327 Patch by Tommi Kyntola.
6328 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
6329 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6331 2003-08-26 Jim Meyering <jim@meyering.net>
6333 Apply changes from bison.
6334 * GNUmakefile (SHELL): Define to `sh', if necessary.
6336 * Makefile.maint (WGETFLAGS): Define to `-C off'.
6337 Update all uses of $(WGET).
6339 2003-08-22 Akim Demaille <akim@epita.fr>
6341 * Makefile.cfg (local-checks-to-skip): New.
6342 * Makefile.maint (local-check): Rename as...
6343 (local-checks-available): this.
6346 2003-08-26 Akim Demaille <akim@epita.fr>
6348 * announce-gen (print_changelog_deltas): Neutralize "<#" as
6349 "<\#" to avoid magic from Gnus when posting parts of this script.
6351 2003-08-25 Jim Meyering <jim@meyering.net>
6353 * src/stat.c (main): Warn about use of deprecated `-l' option.
6355 2003-08-22 Jim Meyering <jim@meyering.net>
6357 * src/stat.c (do_stat): For link count at end of line, use %h format,
6358 instead of %-5h. The latter would make stat emit trailing spaces.
6359 Reported by Dan Jacobson.
6361 2003-08-20 Jim Meyering <jim@meyering.net>
6363 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6365 2003-08-19 Jim Meyering <jim@meyering.net>
6367 * src/system.h: Include stdlib.h unconditionally,
6368 as we're now assuming that part of hosted C89.
6370 2003-08-18 Jim Meyering <jim@meyering.net>
6372 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6373 to avoid warnings from gcc.
6375 2003-08-17 Jim Meyering <jim@meyering.net>
6377 Avoid unnecessary and sometimes time-consuming hostname lookups.
6378 * src/who.c (print_user): Use strchr, not strrchr.
6379 * src/pinky.c (print_entry): Likewise.
6380 Patch by Michael Stone.
6381 This fixes a typo I introduced in who-users.c on 1996-02-23.
6383 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6384 disallowed between `@...@'.
6386 2003-08-16 Paul Eggert <eggert@twinsun.com>
6388 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6389 done by gnulib .m4 files.
6390 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6391 * src/sys2.h (strtoull): Remove unused declaration.
6393 2003-08-16 Jim Meyering <jim@meyering.net>
6395 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6398 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6399 race condition bug. The bug would be triggered when tailing a file
6400 with file pointer not at beginning of file, and where the file was
6401 truncated to have a length of less than the initial offset at just
6402 the right moment (between the two lseek calls in this function).
6404 An invalid initial value for *read_pos would result in
6405 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6406 busy-wait rather than sleeping between iterations. The bug manifests
6407 itself only when tailing regular files that are initially nonempty.
6408 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6410 (tail_lines): Likewise, after lseek calls.
6411 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
6412 * tests/tail-2/tail-n0f: New file. Test for above fix.
6413 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6415 2003-08-15 Jim Meyering <jim@meyering.net>
6417 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6418 (sc_sun_os_names): Likewise.
6419 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6421 * man/help2man: Remove some SPACEs before TAB.
6423 2003-08-14 Paul Eggert <eggert@twinsun.com>
6425 * Makefile.maint (LC_ALL): Set to C.
6426 * man/Makefile.am (ASSORT): New var.
6427 (check-x-vs-1, programs): Use it.
6428 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6429 * tests/Makefile.am (ASSORT, all_programs): Likewise.
6431 2003-08-11 Jim Meyering <jim@meyering.net>
6433 fold -s -wN would infloop for N < 8 with TABs in the input.
6434 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6435 * src/fold.c (fold_file): Move contents of `else'-block
6436 out of conditional so it's used also for --spaces (-s).
6437 * tests/misc/fold: Test for the above fix.
6438 * tests/misc/Makefile.am (TESTS): Add fold.
6440 2003-08-10 Jim Meyering <jim@meyering.net>
6442 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6443 system.h so the types from time.h and sys/time.h are available.
6444 It appears that this is necessary for OpenBSD, NetBSD, and
6445 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
6447 2003-08-06 Paul Eggert <eggert@twinsun.com>
6449 * NEWS: Add support for setting file timestamps to microsecond
6450 resolution, on hosts that support this.
6451 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6452 * src/copy.c (copy_internal):
6453 Set file timestamps with utimens, not utime.
6454 * src/cp.c (re_protect): Likewise.
6455 * src/install.c (change_timestamps): Likewise.
6456 * src/touch.c (newtime, touch, main): Likewise.
6458 2003-08-09 Jim Meyering <jim@meyering.net>
6460 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6462 (syntax-check-rules): Add it.
6464 * src/tail.c (main): Tweak Solaris OS version number in comment.
6465 * src/wc.c (wc): Likewise
6466 * tests/tail-2/fflush: Likewise.
6468 * src/tail.c: Add new undocumented option, --presume-input-pipe.
6469 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6471 2003-08-08 Paul Eggert <eggert@twinsun.com>
6473 Use new gnulib 'extensions' module.
6474 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6477 2003-08-08 Paul Eggert <eggert@twinsun.com>
6479 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6481 2003-08-09 Jim Meyering <jim@meyering.net>
6483 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6484 For tests of obsolete behavior, don't presume that unsetting
6485 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6487 2003-08-07 Paul Eggert <eggert@twinsun.com>
6489 * doc/coreutils.texi (split invocation):
6490 Add -d or --numeric-suffixes option to 'split'.
6491 From a suggestion by Jesse Kornblum.
6492 * src/split.c (suffix_alphabet): New var.
6493 (longopts, usage, next_file_name, main): Support -d.
6494 (next_file_name, main): Allow -a0, as POSIX requires.
6495 (next_file_name): Don't assume ASCII-like encoding;
6496 'a' through 'z' are not contiguous in EBCDIC.
6498 2003-08-05 Paul Eggert <eggert@twinsun.com>
6500 Merge getline from gnulib.
6501 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6502 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6503 New files, from gnulib.
6504 * lib/getdelim2.c, lib/getdelim2.h: Remove.
6505 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6506 getdelim2.h to getndelim2.c and getndelim2.h.
6507 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6508 checking for getdelim.
6509 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6510 than rolling our own.
6511 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6512 (cut_fields): Invoke getndelim2 rather than getdelim2.
6514 2003-08-04 Jim Meyering <jim@meyering.net>
6516 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6517 and for the indices to iterate through nsigs.
6519 2003-08-02 Paul Eggert <eggert@twinsun.com>
6521 * src/sort.c: Minor code cleanups, mostly to use more accurate
6522 types and to remove unnecessary casts.
6523 (min, max): Remove. All uses changed to MIN and MAX.
6524 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6525 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6526 keyfield.numeric, struct keyfield.general_numeric, struct
6527 keyfield.month, struct keyfield.reverse, reverse, unique,
6528 have_read_stdin): Now bool, not int. All uses changed.
6529 (eolchar): Now char, not int.
6530 (struct keyfield.ignore): Now bool const *, not int *.
6531 (struct keyfield.translate): Now char const *, not char *.
6532 (struct month.name): Likewise.
6533 (blanks, nonprinting, nondictionary): Now bool[], not int[].
6534 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6535 check, sort, main): Use const * pointers when possible.
6536 (month_cmp): Rewrite to avoid casts.
6537 (inittables): Initialize tables unconditionally, to avoid branches.
6538 (fillbuf): Return bool, not int. All uses changed.
6539 (fillbuf, keycompare, new_key, main):
6540 Use SIZE_MAX rather than (size_t) -1.
6541 (trailing_blanks): Renamed from trim_trailing_blanks.
6542 Return the number of blanks to trim. All uses changed.
6543 (getmonth): Use trailing_blanks rather than open code.
6544 (keycompare): Do not cast char * to unsigned char *; not needed.
6545 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6547 (compare, main): Use | rather than || to avoid jumps.
6548 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6550 (check, first_same_file, sort, main):
6551 Use bool instead of int local vars when possible.
6552 (check): Merge the old 'checkfp' and 'check' into a single function,
6553 that returns a boolean (true if the file was ordered).
6555 (main): Use int instead of unsigned for iterating through nsigs.
6556 Rename local var "posix_pedantic" to "posixly_correct".
6558 2003-08-02 Jim Meyering <jim@meyering.net>
6560 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6561 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6563 * src/cut.c (cut_fields): Don't read again after encountering an
6564 initial EOF. E.g., `cut -f2' would do so.
6565 * tests/misc/tty-eof: Add a test for the above fix.
6567 * src/sort.c (sortlines): Add description and references.
6570 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6571 the tests in help-version will use the just-built binaries.
6572 Reported by Christian Krackowizer.
6574 2003-07-31 Paul Eggert <eggert@twinsun.com>
6576 * NEWS: Add --rfc-2822 option to GNU date.
6577 * doc/coreutils.texi (Time directives, Options for date, Examples
6579 * src/date.c (long_options, usage, main): Likewise.
6580 * doc/getdate.texi (General date syntax): Likewise.
6581 * doc/coreutils.texi (Options for date): Fix a typo in format:
6582 it's now %d not %_d. Add URLs.
6584 2003-08-01 Jim Meyering <jim@meyering.net>
6586 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6587 Otherwise, with at least the /bin/sh from HPUX 10.20,
6588 the trap code would end up converting that to exit 1 and thus an
6589 unexpected test failure. Reported by Christian Krackowizer.
6591 2003-07-31 Paul Eggert <eggert@twinsun.com>
6593 * src/ptx.c: Do not include bumpalloc.h.
6594 (WORD_TABLE): New member alloc.
6595 (ALLOC_NEW_WORD): Remove.
6596 (occurs_alloc): New var.
6597 (digest_word_file, find_occurs_in_text): Check for arithmetic
6598 overflow when computing table size. Use xrealloc rather than
6599 bumpalloc primitives.
6601 2003-07-29 Jim Meyering <jim@meyering.net>
6605 * README: When running tests as root, suggest using
6606 sudo with NON_ROOT_USERNAME=$USER.
6608 * tests/Makefile.am (all_programs): Makefile is in ../src, not
6611 2003-07-28 Jim Meyering <jim@meyering.net>
6613 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6615 2003-07-28 Paul Eggert <eggert@twinsun.com>
6617 * lib/stdbool.hin (_Bool): Make it signed char, instead of
6618 an enum type, so that it's guaranteed to promote to int.
6619 * src/sort.c (sortlines_temp): Undo previous change.
6621 2003-07-28 Jim Meyering <jim@meyering.net>
6623 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6624 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6625 would cause lines[-1 - swap] (with swap = false) to evaluate to
6628 2003-07-27 Jim Meyering <jim@meyering.net>
6630 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6631 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6633 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6634 directories, as required by POSIX. Reported by Karl Berry.
6635 * tests/rm/dir-no-w: New file. Test for the above fix.
6636 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6638 * tests/mk-script: Emit `$xx', not its expansion.
6640 2003-07-27 Paul Eggert <eggert@twinsun.com>
6642 This change was inspired by a similar proposal by Stepan Kasal.
6643 * src/sort.c (mergelines, sortlines_temp): New functions.
6644 (sortlines): Use them, to reduce the number of times that
6645 we need to copy 'struct line' values. This improved CPU
6646 performance by about 30% on one 18 MB test.
6647 (sort): Don't invoke sortlines unless we have 2 or more lines.
6649 2003-07-26 Stepan Kasal <kasal@ucw.cz>
6651 * src/sort.c (sort): Don't require two `struct line's per text line,
6652 the new sort algorithm requires just 1.5.
6654 2003-07-27 Jim Meyering <jim@meyering.net>
6656 * src/pathchk.c (validate_path): Use %lu, not %ld.
6658 * src/cut.c (is_printable_field): Simplify bit arithmetic.
6660 * src/ls.c (sort_files): Put `volatile' in the right place.
6663 2003-07-26 Jim Meyering <jim@meyering.net>
6665 Use only one bit per field/offset in array, not one `int'.
6666 * src/cut.c (printable_field): Change type to `unsigned char'.
6667 (mark_printable_field, is_printable_field): New functions.
6668 Use them in place of all direct accesses of `printable_field'.
6670 * src/expand.c (parse_tabstops): Detect overflow properly.
6671 * src/cut.c (set_fields): Likewise.
6673 * src/rm.c: Include "dirname.h".
6674 (usage): Use base_name (program_name) in body of --help output.
6676 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6677 Idea from Brendan O'Dea, who suggested using
6678 `program_name = basename (argv[0]);' everywhere --
6679 can't do that, but using base_name works just fine here.
6681 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6683 2003-07-24 Paul Eggert <eggert@twinsun.com>
6685 Fix some POSIX-compliance problems with 'test'. This makes
6686 'test' more compatible with Bash.
6688 * NEWS, doc/coreutils.texi: Document the following.
6689 * src/test.c: Include exitfail.h.
6690 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6691 (test-syntax_error): Use it.
6692 (binary_operator): Now takes bool arg specifying whether left operand
6693 is -l ARG, so that caller determines this rather than us.
6695 (term): Use posixtest to evaluate parenthesized subexpressions.
6696 (unary_operator, one_argument): Remove support for -t without operand.
6697 (one_argument): Take argument from argv[pos].
6698 (one_argument, two_arguments, three_arguments): Advance pos.
6699 All callers changed.
6700 (three_arguments): Look for binary ops before "!". Then look
6701 for parenthesized one_argument expressions, instead of trusting
6702 expr () to do the right thing.
6703 (posixtest): Now takes number of args. All callers changed.
6704 Treat "( A B )" like "A B".
6705 (main): Set exit_failure to TEST_FAILURE. Don't depend on
6706 POSIXLY_CORRECT, as we now conform to POSIX by default.
6707 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6708 * tests/test/Test.pm (test_vector): Add several tests to check
6709 the above. Syntax errors now exit with status 2, not 1.
6710 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6712 2003-07-26 Jim Meyering <jim@meyering.net>
6714 * tests/help-version: Adjust for above change in test behavior:
6715 `[' exits with 2, not 1, and test doesn't accept --help or --version.
6717 * Makefile.maint (ME): Don't use trick suggested in Make manual.
6718 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
6720 * Makefile.maint (sc_system_h_headers): Another syntax check.
6721 (syntax-check-rules): Add it to the list.
6723 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
6724 so it matches `%ld' format even on 32-bit systems.
6726 * src/fmt.c (flush_paragraph): Cast field width to `int' to
6727 avoid warning on 64-bit systems.
6729 * src/ls.c (sort_files): Make `func' volatile, so it can't be
6730 clobbered by a `longjmp' into this function.
6732 2003-07-25 Jim Meyering <jim@meyering.net>
6734 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
6737 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
6738 because it'd evoke spurious failure on 64-bit systems.
6740 2003-07-24 Jim Meyering <jim@meyering.net>
6742 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
6743 output its current record counts. Reported by Jurriaan.
6745 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
6746 `wc' with no options. This goes along with the change of 2003-07-20.
6748 2003-07-23 Jim Meyering <jim@meyering.net>
6750 Don't include headers already included by system.h:
6751 * src/tr.c: Don't include errno.h.
6752 * src/true.c: Don't include version-etc.h.
6753 * src/test.c: Don't include limits.h or error.h.
6754 * src/stat.c: Don't include unistd.h or time.h.
6755 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
6756 * src/pr.c: Don't include time.h.
6757 * src/pathchk.c: Don't include errno.h.
6758 * src/nice.c: Don't include sys/time.h.
6759 * src/ls.c: Don't include stdlib.h.
6761 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
6762 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
6763 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
6764 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
6765 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
6766 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
6767 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
6768 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
6769 Don't include closeout.h.
6771 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
6772 can access the required version of rm.
6773 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6775 * tests/cut/Test.pm (out-delim3a): New test.
6777 * man/help2man: Update to version 1.33.
6779 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
6781 * src/dircolors.c: Include xstrndup.h.
6782 (xstrndup): Remove function, now that it's been factored out into
6785 2003-07-22 Paul Eggert <eggert@twinsun.com>
6787 * src/wc.c (wc): Fix typo in computation of file from file_x,
6788 which caused the former to be used uninitialized if file_x was
6791 2003-07-22 Jim Meyering <jim@meyering.net>
6793 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
6795 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
6796 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
6797 Thomas Luzat. See http://bugs.debian.org/202413 for details.
6799 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
6801 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
6803 * src/cut.c (set_fields): Mark all selected indices before trying to
6804 determine range endpoints.
6805 * tests/cut/Test.pm: New test for the above fix.
6807 Begin to address this comment: What if someone wants to
6808 extract the 1,000,000-th field of some huge input file?
6809 The first step is to rearrange things so that the values
6810 in the printable_field array are all 0/1 rather than 0/1/2.
6811 * src/cut.c (RANGE_START_SENTINEL): Remove.
6812 Store range-start indices in a hash table, rather than
6813 overloading the `printable_field' array.
6814 (range_start_ht): New global.
6815 (hash_int, hash_compare_ints, is_range_start_index): New functions.
6816 (print_kth): Use is_range_start_index; don't test printable_field.
6817 (set_fields): Detect overflow.
6818 (set_fields): Insert each range-start index into range_start_ht.
6819 (main): Call set_fields only once, and only after
6820 output_delimiter_specified and (if required) range_start_ht have
6823 2003-07-20 Paul Eggert <eggert@twinsun.com>
6825 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
6826 invoked with a null pointer when there were no file arguments.
6828 2003-07-20 Jim Meyering <jim@meyering.net>
6830 * Makefile.maint (sc_changelog): Add another nit-picky check.
6832 * src/wc.c (write_counts): Add a comment.
6833 (wc): Rename `file' parameter.
6834 Set new local, `file', to be the file name, or (when it's NULL)
6835 _("standard output") so that all uses of `file' use the proper value.
6836 Use STREQ, not strcmp.
6838 2003-07-20 Paul Eggert <eggert@twinsun.com>
6840 wc count field widths now are heuristically adjusted depending
6841 on the input size, if known. If only one count is printed, it
6842 is guaranteed to be printed without leading spaces.
6844 Previously, wc did not align the count fields if
6845 POSIXLY_CORRECT was set, but POSIX did not actually require
6846 this undesirable behavior, so it has been removed.
6848 * NEWS: Document this.
6849 * doc/coreutils.texi (wc invocation): Likewise.
6851 * src/wc.c (number_width): New var.
6852 (posixly_correct): Remove.
6853 (struct fstatus): New struct.
6854 (write_counts): Output fields of width number_width.
6855 Do not worry about POSIXLY_CORRECT.
6856 Use null file, not empty-string file, to denote stdin,
6857 since "" is a valid file name on some hosts.
6858 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
6860 (wc): Avoid problems if end_pos - current_pos overflows.
6861 Do not print odd message if stdin has a read error.
6862 (get_input_fstatus, compute_number_width): New functions.
6863 (main): Use them to implement the new behavior.
6864 Ignore POSIXLY_CORRECT.
6866 * tests/wc/Test.pm: Adjust to the new output widths.
6868 2003-07-19 Jim Meyering <jim@meyering.net>
6870 * tests/rm/fail-eperm: Don't create temporary directory --
6873 * tests/shred/remove: Don't open-code test for UID != 0.
6874 Use priv-check's require-non-root instead.
6875 Update to use newer framework.
6877 * tests/help-version (expected_failure_status_expr): Record that
6878 expr exits with status of 3 for e.g., a write error.
6880 * tests/priv-check: Use `id -u' to see if we're running as root,
6881 rather than trying go write to an write-protected file.
6882 When running as root, ensure $NON_ROOT_USERNAME is valid.
6883 When running as root with `require-non-root', ensure that `.'
6884 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
6885 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
6887 * src/printenv.c: Include "exitfail.h".
6888 (main): Set exit_failure rather than calling close_stdout_set_status.
6889 * src/date.c: Likewise.
6890 * src/sort.c: Likewise.
6891 * src/tty.c: Likewise.
6893 2003-07-18 Jim Meyering <jim@meyering.net>
6895 * tests/touch/not-owner: Update to use newer framework.
6897 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
6898 directory, and remove Perl-coded `you may not run as root' test.
6899 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
6900 hard-coding something not quite equivalent.
6901 Paul Jarc reported the inconsistent diagnostics.
6903 * src/sort.c (main): Use close_stdout via atexit.
6904 Now `sort --version' and `sort --help' fail, as they should
6905 when their output is redirected to /dev/full.
6907 * src/su.c (usage): Don't call close_stdout here.
6908 (main): Use close_stdout via atexit.
6909 Now `su --version > /dev/full' fails, as it should.
6910 Somehow, the change of 2000-05-07 that purports to fix this
6913 * tests/help-version (--help/--version vs. /dev/full): Special-case
6914 `[' to protect it from expected_failure_status-`eval'.
6916 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
6917 count and the corresponding line, as required by POSIX.
6918 Reported by Clement Wang.
6919 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
6921 * tests/expr/basic: Add tests for when exit status is 2.
6923 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
6924 Use an anonymous `enum', rather than #define.
6926 2003-07-17 Paul Eggert <eggert@twinsun.com>
6928 * src/expr.c: Include "exitfail.h", "quotearg.h".
6929 (EXPR_INVALID, EXPR_ERROR): New constants.
6930 (nomoreargs, null, toarith, nextarg): Return bool, not int.
6931 (syntax_error): New function, exiting with status 2. Use it
6932 insteading of printing "syntax error" ourselves.
6933 (main): Initialize exit_failure to EXPR_ERROR.
6934 Exit with EXPR_INVALID on syntax error (too few arguments).
6935 (nextarg): Use strcmp, not strcoll; strcoll might return
6936 an undesirable 0, or might fail.
6937 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
6938 or other such error.
6939 (eval2): Report an error if strcoll fails in a string comparison.
6940 * src/sort.c: Include "exitfail.h".
6941 (main): Set exit_failure, not xalloc_exit_failure and
6942 xmemcoll_exit_failure.
6943 * tests/expr/basic: Invalid value exits with status 3, not 2.
6945 2003-07-16 Jim Meyering <jim@meyering.net>
6947 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
6948 per GNU maintainer guidelines. The next non-beta release will be 5.1.
6950 This script would have caught at least two recent bugs:
6951 those in [ and kill.
6952 * tests/help-version: Revive this script.
6953 It wasn't doing anything useful, since $all_programs wasn't being
6954 defined by the invoking Makefile.am.
6955 Reflect that nohup is no longer a script, so don't exclude it.
6956 Add framework to handle the programs added since it was last run:
6957 kill, stat, unlink, [, link, readlink.
6958 Fix path-related problems deriving from the move of this script
6959 from src/ to its present location.
6960 * tests/Makefile.am (all_programs): Define.
6961 (TESTS_ENVIRONMENT): Use it.
6963 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
6964 whereby kill would always attempt to operate on argv[0] and fail.
6966 * src/test.c (integer_expected_error): Improve diagnostic -- now,
6967 it also matches the one from bash's builtin test.
6968 (binary_operator): Add \n at end of diagnostic.
6970 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
6971 * tests/priv-check: Move setuidgid-related and
6972 NON_ROOT_USERNAME-checking code to this file.
6974 * README: Update section on testing as `root'.
6975 Suggestion from Paul Jarc.
6977 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
6978 names of authors that I just found in bash's builtins/test.def.
6980 Running `[' with no arguments would evoke a segfault.
6981 * src/test.c (main) [LBRACKET]: Move initialization of argv to
6982 precede potential use via test_syntax_error.
6984 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
6985 warning from automake -Wall.
6987 2003-07-15 Jim Meyering <jim@meyering.net>
6991 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
6994 * announce-gen (print_changelog_deltas): Relax tests for matching
6995 version-number line in NEWS.
6996 Change the .sig suffix to .asc here, too.
6998 2003-07-14 Jim Meyering <jim@meyering.net>
7000 * Makefile.maint (%.asc): Renamed from %.sig.
7001 Generate and use ascii-armored signatures.
7002 Use gpg's -o option.
7004 2003-07-13 Jim Meyering <jim@meyering.net>
7006 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7009 * Makefile.maint (syntax-check): Move each individual check into
7011 (syntax-check-rules): This is the list of syntax-check targets.
7012 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7013 (sc_cast_of_x_alloc_return_value, sc_space_tab):
7014 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
7016 2003-07-12 Jim Meyering <jim@meyering.net>
7018 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7019 traces of the nohup script.
7021 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7022 $(OPTIONAL_BIN_ZCRIPTS).
7024 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7025 target, not before the `>'.
7027 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7028 now that that function no longer calls `error'.
7030 * src/df.c (find_mount_point): Emit a diagnostic for each
7031 failed syscall, rather than relying on caller to do that.
7032 The caller couldn't do a good job, anyhow -- too many different
7033 ways to fail (each with a different referent).
7034 Give a diagnostic upon failed save_cwd, now that that function
7035 no longer calls `error'.
7036 (show_point): Don't diagnose find_mount_point's errors, now that
7037 it handles them itself.
7039 * src/df.c (find_mount_point): Don't let free clobber errno upon
7042 * src/sys2.h: Remove alloca-related block.
7043 * src/system.h: Include <alloca.h> here, instead.
7045 It appears that the `#pragma alloca' included via "system.h" is
7046 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7047 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7048 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7050 * src/chown-core.c (change_file_owner): Do not restore any special
7051 permission bits (e.g., set-user-ID, set-group-ID) that are reset
7052 by chown(2) on some systems. Suggestion and insistence :-) from
7055 * tests/input-tty: Also check `test -t 1'.
7056 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
7057 test would block when run in the background.
7059 2003-07-11 Jim Meyering <jim@meyering.net>
7061 * tests/sample-test: Also fail if cat-to-create-expected-output
7062 fails. Otherwise, if both `exp' and `out' were to end up empty
7063 because of e.g., a full disk, they would mistakenly compare equal.
7065 * src/nohup.c: New file. Rewrite of nohup.sh in C.
7066 This solves a portability problem: on at least Solaris systems,
7067 when nohup.sh used the vendor /bin/sh, it would exit with status
7068 of `1' rather than the required 126 or 127 upon failure to exec
7069 the specified program.
7071 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7072 (bin_PROGRAMS): Add nohup.
7073 (EXTRA_DIST): Remove nohup.sh.
7074 (all_programs): Remove use of $(EXTRA_SCRIPTS).
7075 * src/nohup.sh: Remove file.
7076 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7078 * tests/misc/nohup: Tests for the above.
7079 * tests/misc/Makefile.am (TESTS): Add nohup.
7081 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7082 the macro, COPY_FD_DIAGNOSE.
7083 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7084 (head_file): Likewise.
7086 * src/date.c: Include "quote.h".
7087 (batch_convert): Use the quote function rather than using literal `...'
7090 * src/setuidgid.c (main): Enclose diagnostic in _(...).
7091 * src/fmt.c (main): Likewise.
7092 * src/mknod.c (main): Likewise.
7093 * src/tac.c (tac_seekable): Likewise.
7094 * src/yes.c (main): Likewise.
7095 * src/od.c (main): Likewise.
7096 * src/install.c (change_attributes): Likewise.
7098 2003-07-10 Jim Meyering <jim@meyering.net>
7100 * src/head.c (usage): Use 1024*1024 in place of 1048576.
7101 * src/tail.c (usage): Likewise.
7103 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7104 place of the kludge in this test. Suggestion from Paul Jarc.
7106 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7107 * src/setuidgid.c: New program, solely for testing (not installed).
7109 * src/chown-core.c (change_file_owner): Don't leak file descriptors
7110 when dereferencing symlinks.
7112 2003-07-09 Jim Meyering <jim@meyering.net>
7114 * tests/du/slash: New file/test for today's lib/ftw.c fix.
7115 * tests/du/Makefile.am (TESTS): Add slash
7117 * src/tail.c (xlseek): Avoid warning about ``return without value
7118 from function returning non-void''.
7120 2003-07-08 Jim Meyering <jim@meyering.net>
7122 * man/help2man: Update to version 1.29.
7124 * man/help2man: Add END handler to close STDOUT and check for errors.
7126 2003-06-30 Paul Eggert <eggert@twinsun.com>
7128 Add support for a "[" that conforms to the GNU coding standards,
7129 i.e., that does not depend on its name.
7130 * src/lbracket.c: New file.
7132 * man/Makefile.am (programs): Ignore "[", since it doesn't have
7133 a separate man page.
7134 * src/Makefile.am (bin_PROGRAMS): Add "[".
7135 (__SOURCES): New var.
7136 * src/test.c (LBRACKET): Define to 0 if not defined.
7137 (main): Use LBRACKET rather than argv[0].
7139 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7140 Reported by Paul Jarc and Dan Jacobson.
7142 * src/test.c (main): Do not recognize --help or --version if
7143 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
7144 Do not bother testing that margv[margc] is non-null.
7146 2003-07-04 Jim Meyering <jim@meyering.net>
7148 * src/who.c (print_line): Rewrite to use asprintf, in order to be
7149 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
7151 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7152 option, and perform the +1600 invocations of head IFF the envvar
7153 RUN_EXPENSIVE_TESTS is set.
7155 2003-07-03 Jim Meyering <jim@meyering.net>
7157 * src/cp.c (do_copy): Give a better diagnostic when failing due
7158 to nonexistent destination directory. Reported by Dmitry Rutsky.
7159 See http://bugs.debian.org/199730 for details.
7161 2003-06-27 Jim Meyering <jim@meyering.net>
7163 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7164 * src/split.c (longopts): Use `1', not `0' as the value for
7165 for &verbose. Reported by Keith Thompson.
7167 Test for the above fix.
7168 * tests/misc/split-a: Also use --verbose and compare stderr
7169 output with what we'd expect.
7171 2003-06-20 Jim Meyering <jim@meyering.net>
7173 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7174 Use `error_t' (rather than int) as type for local `err'.
7175 From Alfred M. Szmidt.
7177 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
7179 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7180 Fix author preservation code.
7182 2003-06-19 Jim Meyering <jim@meyering.net>
7184 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7185 (do_link): Don't warn about hard link to symlink.
7187 2003-06-18 Jim Meyering <jim@meyering.net>
7189 * src/cut.c: Include "getdelim2.h", not "getstr.h".
7190 Reflect renaming: getstr -> getdelim2.
7192 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7193 readline -> readlinebuffer.
7195 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
7197 * src/readlink.c: Include <sys/types.h> before system.h (because
7198 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
7200 2003-06-17 Jim Meyering <jim@meyering.net>
7202 * src/system.h (initialize_main): Define.
7203 Use it in every `main'. Applied via this:
7204 p='initialize_main (&argc, &argv);'
7205 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
7206 $(grep -l program_name.=.argv.0 *.c)
7207 test.c uses margc/margv, so I made the change manually for that file.
7208 Based on a patch from Bernard Giroud.
7210 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
7212 Fix for build failure on Ultrix 4.3.
7213 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7214 Include sys/param.h and sys/mount.h on ultrix.
7216 2003-06-16 Jim Meyering <jim@meyering.net>
7218 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7220 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7221 them here instead, but with one change: define EISDIR to -1, not 0.
7223 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7224 guaranteed to be defined.
7225 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7227 * README: Mention the CVS repository.
7228 Encourage addition of test cases.
7230 2003-06-12 Jim Meyering <jim@meyering.net>
7232 * src/touch.c (touch): Call close only if necessary.
7235 * src/wc.c (usage): Correct wording: wc prints counts in the order
7236 `newline, word, byte'. Reported by Keith M. Briggs.
7237 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
7239 2003-06-10 Jim Meyering <jim@meyering.net>
7241 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7243 2003-06-07 Jim Meyering <jim@meyering.net>
7245 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7248 2003-06-06 Jim Meyering <jim@meyering.net>
7250 * src/extract-magic (main): Avoid newer 3-arg form of open,
7251 so this script works also with e.g., perl5.005_03.
7252 Patch by John David Anglin.
7254 2003-06-04 Paul Eggert <eggert@twinsun.com>
7256 * src/system.h: Include <stdbool.h> unconditionally.
7258 2003-06-04 Jim Meyering <jim@meyering.net>
7260 * man/Makefile.am (check-programs-vs-x): Rename target
7261 from check-programs-vs-1. Adjust rule to check for the
7262 primary (.x) file, not the generated one (.1).
7264 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7266 * man/kill.x: New file.
7267 * man/Makefile.am (dist_man_MANS): Add kill.1.
7270 2003-06-04 Jim Meyering <jim@meyering.net>
7272 Ensure that the .x file for a new program is never forgotten again.
7273 * man/Makefile.am (programs): Define.
7274 (check-programs-vs-1): New phony target.
7275 (check-local): Depend on it.
7277 2003-06-03 Jim Meyering <jim@meyering.net>
7279 Avoid unnecessary copying of environment.
7280 * src/env.c (main): Rather than clearing the environment and --
7281 unless told to ignore environment -- copying all settings from
7282 the saved, original environment, clear the environment only when
7283 that is requested. Suggested by Jens Elkner.
7285 2003-06-02 Jim Meyering <jim@meyering.net>
7287 * src/system.h: Always include <string.h>, since we assume C89.
7288 Include <limits.h> without checking for HAVE_LIMITS_H.
7290 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7291 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7293 2003-06-01 Jim Meyering <jim@meyering.net>
7295 Avoid a race condition in `tail -f' described by Ken Raeburn in
7296 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7297 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7298 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7299 (tail_bytes, tail_lines, tail): Likewise.
7300 (tail_file): Use the new `read_pos' value as the size,
7301 rather than stats.st_size from the fstat call.
7303 2003-05-28 Jim Meyering <jim@meyering.net>
7305 * src/extract-magic: Allow expansion of `$file' in the here-
7306 document corresponding to the comment at the top of fs.h.
7308 2003-05-26 Jim Meyering <jim@meyering.net>
7310 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7311 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7312 Use #if/#elif/... cascade so we get only one set of include files.
7313 Reported by Nelson Beebe.
7315 2003-05-24 Jim Meyering <jim@meyering.net>
7317 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7318 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7319 accept the BSD format.
7321 2003-03-28 Joe Orton <jorton@redhat.com>
7323 * src/md5sum.c (bsd_split_3): New function.
7324 (split_3): Detect checksums from BSD 'md5' command and handle them
7327 * tests/md5sum/basic-1: New tests for --check exit status, and for
7328 BSD-style checksum files.
7330 2003-05-21 Jim Meyering <jim@meyering.net>
7332 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7333 This sort of thing is why it'd be *Really Good* to factor
7334 out the common code used here and in tail.c.
7336 2003-05-14 Jim Meyering <jim@meyering.net>
7338 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7340 * tests/du/slink: Skip this test if `.' is on an XFS file system.
7342 * tests/du/fd-leak: New file. Test for the bug in du that
7343 was fixed by the 2003-05-12 change to lib/ftw.c.
7344 * tests/du/Makefile.am (TESTS): Add fd-leak.
7346 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7347 includes a translatable word, `and'.
7349 * src/dd.c (usage): Don't use `,' as the thousands separator
7350 in e.g. 1,000,000 and 1,048,576. Instead, do this:
7351 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7352 * src/df.c (usage): Likewise.
7353 * src/du.c (usage): Likewise.
7354 * src/ls.c (usage): Likewise.
7356 * Makefile.maint (syntax-check): Add another check.
7358 2003-05-13 Paul Eggert <eggert@twinsun.com>
7360 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7361 must output nothing. Problem reported by Josh Hyman.
7363 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7364 (output_unique, output_first_repeated, output_later_repeated):
7365 New vars. All uses of "mode" changed to use these variables,
7366 which are not mutually exclusive as "mode" was.
7367 (writeline): New arg "match", used to control whether to
7368 obey output_first_repeated or output_later_repeated.
7369 All callers changed.
7370 (check_file, main): Adjust to above changes.
7372 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7374 2003-05-14 Jim Meyering <jim@meyering.net>
7376 * tests/rm/rm3: Use tr's \n notation rather than \012.
7377 This package can afford to do that, since its tests are guaranteed use
7378 GNU tr, which has accepted the more modern notation for 10 years.
7379 * tests/rm/rm5: Likewise.
7380 * tests/cp/same-file: Likewise.
7381 * tests/stty/row-col-1: Likewise.
7382 * tests/stty/basic-1: Likewise.
7383 * tests/rm/deep-1: Likewise.
7384 * tests/mv/part-symlink: Likewise.
7385 * tests/mkdir/perm: Likewise.
7386 * tests/misc/nice: Likewise.
7388 2003-05-13 Jim Meyering <jim@meyering.net>
7390 * src/copy.c (struct F_triple) [name]: Remove const attribute.
7391 (triple_free): Don't apply cast to argument of free.
7392 (seen_file): Add cast here instead.
7394 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7395 (src_to_dest_free): Don't apply cast to argument of free.
7397 * src/sort.c (zaptemp): Don't apply cast to argument of free.
7398 * src/pr.c (init_fps, init_store_cols): Likewise.
7399 * src/join.c (delseq, freeline): Likewise.
7400 * src/expr.c (OLD): Likewise.
7401 * src/sort.c (sort): Likewise.
7402 * src/head.c (elide_tail_lines_pipe): Likewise.
7404 * src/tail.c: Include "quote.h".
7405 Use quote in diagnostics. Change many error format strings
7406 from just `%s' to e.g., `error reading %s'.
7407 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7408 Rewrite newline-counting loop to use memchr.
7410 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7411 Now that assert is no longer used, don't include <assert.h>.
7413 2003-05-12 Jim Meyering <jim@meyering.net>
7415 * src/head.c: Include <assert.h>.
7416 (AUTHORS): Add my name.
7417 (elide_tail_lines_pipe): New function.
7419 2003-05-10 Jim Meyering <jim@meyering.net>
7421 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7423 * src/readlink.c (main): Set program_name before first use.
7424 Remove that (redundant) first use.
7425 Don't exit successfully just because --verbose was specified.
7426 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7427 parameter is 0, error does not exit.
7429 * src/uname.c (main): When failing due to too many arguments, also say
7430 that, rather than just "Try `uname --help' for more information.".
7431 * src/comm.c (main): Likewise, but for too few arguments.
7432 * src/logname.c: Include error.h.
7433 (main): Say why we're failing.
7435 * src/uniq.c (main): Don't segfault when argc < optind.
7436 * src/who.c (main): Handle argc < optind.
7437 * src/df.c (main): Likewise.
7438 * src/install.c (main): Likewise.
7439 * src/mv.c (main): Likewise.
7440 * src/pwd.c (main): Likewise.
7441 * src/tty.c (main): Likewise.
7442 * src/chroot.c (main): Likewise.
7443 * src/hostname.c: Likewise.
7444 * src/du.c (main): Likewise.
7445 * src/expand.c (main): Likewise.
7446 * src/env.c (main): Likewise.
7447 * src/unexpand.c (main): Likewise.
7448 * src/printenv.c (main): Likewise.
7449 * src/sync.c (main): Handle argc == 0.
7450 * src/expr.c (main): Likewise.
7451 * src/printf.c (main): Likewise.
7452 * src/basename.c (main): Likewise.
7453 * src/ln.c (main): Test for `missing argument' before computing n_files.
7454 * src/tail.c (main): Test for the case of no arguments before
7457 * src/kill.c (send_signals): Don't check command line arguments here.
7458 (main): Check them here instead. Handle argc < optind.
7460 * src/logname.c (main): Use error, rather than fprintf, for the sake
7463 * src/rm.c (main): Don't overrun array bound if argc is 0.
7465 2003-05-09 Jim Meyering <jim@meyering.net>
7467 * src/sort.c (main): Don't overrun array bound if argc is 0.
7468 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7469 Reported by Wartan Hachaturow.
7471 2003-05-07 Jim Meyering <jim@meyering.net>
7473 Implement support so that `head --lines=-N' works on seekable files.
7474 * src/head.c (enum Copy_fd_status): Define.
7475 (COPY_FD_DIAGNOSE): New macro.
7476 (elide_tail_lines_seekable): New funtion.
7477 (elide_tail_lines_file): Call it here.
7479 2003-05-06 Jim Meyering <jim@meyering.net>
7481 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7483 2003-05-04 Jim Meyering <jim@meyering.net>
7485 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7486 caused the addition of thousands of small files to the tar archive.
7487 * tests/misc/head-elide-tail: New file. Add them here instead.
7488 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7490 2003-05-04 Paul Eggert <eggert@twinsun.com>
7492 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7493 (IF_READDIR_NEEDS_REWINDDIR): Remove.
7494 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7495 which was a bit weird because it couldn't be emulated by a function.
7497 2003-05-03 Jim Meyering <jim@meyering.net>
7499 Extend head to accept --lines=-N (--bytes=-N) and to print all
7500 but the N lines (bytes) at the end of the file.
7501 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7502 Use quote() in diagnostics, rather than literal `' marks.
7503 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7505 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7506 (head_file): Reorganize so as to call head from only one place.
7507 (main): Likewise, for head_file.
7508 Handle new, undocumented option, --presume-input-pipe.
7509 Handle negative line and byte counts.
7510 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7512 * tests/du/8gb: Skip test if the file system of `.' doesn't support
7513 sparse files -- otherwise it'd create a file of size 8GB.
7515 2003-05-02 Jim Meyering <jim@meyering.net>
7517 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7518 Instead explain about `-' and standard input.
7519 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7520 Reported by Keith Thompson.
7521 * tests/fmt/basic: Add test for the above fix.
7523 * src/fmt.c: Include "quote.h".
7524 Use quote() in diagnostics, rather than literal `' marks.
7525 (main): Exit nonzero when unable to open an input file.
7526 * tests/fmt/basic: Add test for the above fix.
7528 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7529 specifications like `-72x'.
7530 * tests/fmt/basic: Add test for the above fix.
7532 Work around nasty readdir bug on Darwin6.5.
7533 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7534 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7535 returned NULL and there has been at least one successful unlink or
7536 rmdir call since the opendir or previous rewinddir, then call
7537 rewinddir and reiterate the loop.
7539 Factor out common code.
7540 * src/remove.c (readdir_ignoring_dotdirs): New function.
7541 (is_empty_dir): Use it here.
7542 (remove_cwd_entries): Use it here.
7544 2003-05-01 Jim Meyering <jim@meyering.net>
7546 * tests/rm/r-3: Create 500 rather than just 300 files.
7547 There's a bug in Darwin6.5's readdir that shows up only with
7549 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7553 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7554 (dump_remainder): Move two declarations `down' into the scope
7555 where they are used.
7556 (xlseek): Return the resulting offset.
7557 (file_lines): Rename parameter, file_length, to end_pos.
7558 (pipe_lines): Don't coerce safe_read return value to `int'.
7559 Adapt tests accordingly.
7560 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7562 Change type of `total_bytes' from `int' to `size_t',
7563 since the former wouldn't always be wide enough.
7564 Don't coerce safe_read return value to `int',
7565 and adapt tests accordingly.
7566 Now that testing for a read error no longer involves
7567 using `tmp', handle that case *after* freeing `tmp'.
7568 (start_bytes): Clean up.
7569 (tail_bytes): Now that `n_bytes' may be larger than
7570 OFF_T_MAX, test for that condition and, if it's true, don't
7571 use lseek optimizations.
7572 (parse_options): Don't fail just because N_UNITS is larger than
7573 the maximum size of a file -- tail may be applied to an input
7574 stream (e.g., a pipe) with more data than that.
7576 * Makefile.maint (syntax-check): Rename from alloc-check.
7577 Also check for SPACE-TAB sequences.
7578 Also check for malloc/calloc/realloc casts.
7580 2003-05-01 Jim Meyering <jim@meyering.net>
7582 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
7584 2003-04-28 Jim Meyering <jim@meyering.net>
7586 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7587 make the now-more-picky tsort fail.
7589 2003-04-24 Jim Meyering <jim@meyering.net>
7591 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7592 (main): Minor syntactic clean-up.
7594 * src/tsort.c (tsort): Fail if the input contains an odd number of
7595 tokens. Reported by junkio@cox.net.
7597 * tests/tsort/basic-1: Test for the above fix.
7599 2003-04-21 Jim Meyering <jim@meyering.net>
7601 * tests/misc/printf: Add tests for the printf fixes below.
7603 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7605 2003-04-20 Paul Eggert <eggert@twinsun.com>
7607 Fix printf POSIX compatibility bug reported by Ben Harris in
7608 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7609 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7610 \0NNN in the %b operand.
7611 * src/printf.c (usage): Likewise.
7612 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7613 is desired. All uses changed. Behave like Bash printf if %b
7614 operand uses \NNN where the initial N is not 0.
7616 2003-04-17 Jim Meyering <jim@meyering.net>
7618 * src/stty.c: Remove uses of PROTOTYPE macro.
7620 2003-04-15 Jim Meyering <jim@meyering.net>
7622 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7623 each sequence of spaces before a TAB character.
7625 2003-04-13 Jim Meyering <jim@meyering.net>
7627 * src/remove.c (is_empty_dir): Don't closedir (NULL).
7629 2003-04-12 Jim Meyering <jim@meyering.net>
7631 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7632 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7633 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7634 * src/nl.c (main): Fix those problems and remove literal quote marks
7635 (e.g., "`%s'") from format string; instead use "%s" in each format
7636 string and `quote (optarg)' as the corresponding argument.
7637 Also, diagnose all invalid command line options before failing.
7639 * src/nl.c (proc_text): Fix a bug that would make nl output extra
7640 newlines in some cases. Details here: http://bugs.debian.org/177256.
7641 This bug was introduced on 2001-11-10 for textutils-2.0.17.
7642 * tests/misc/nl: Add test for the above-fixed bug.
7644 * tests/misc/readlink: New file. Test the --canonicalize option.
7645 * tests/misc/Makefile.am (TESTS): Add readlink.
7647 2003-04-11 Jim Meyering <jim@meyering.net>
7650 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7651 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7652 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7653 retain alignment) each sequence of spaces before a TAB character.
7655 * src/ls.c: Include <stdlib.h> unconditionally.
7657 * Makefile.maint (xalloc-check): Rename from header-check.
7659 * src/yes.c: Include error.h after system.h, not before.
7662 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7663 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7664 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7665 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7666 * src/tr.c: * src/unexpand.c, src/users.c:
7667 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7668 return values and of xrealloc's first argument.
7669 Fix the former with this:
7670 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7672 2003-04-10 Jim Meyering <jim@meyering.net>
7674 * src/stty.c (wrapf): Declare with format attribute.
7676 The S_MAGIC_... names shouldn't be maintained in two places (prior
7677 to this change, one would have to keep stat.c and fs.h in sync).
7678 This change makes it so those names and the corresponding
7679 hexadecimal constants all reside in stat.c. fs.h is now generated.
7680 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7681 (BUILT_SOURCES): Add fs.h, now that it's generated.
7682 (EXTRA_DIST): Add extract-magic.
7683 * src/extract-magic: New script to extract fs.h definitions from stat.c.
7684 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7685 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7687 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7688 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
7690 * man/unexpand.x: Add `SEE ALSO' reference to expand.
7691 * man/expand.x: Add `SEE ALSO' reference to unexpand.
7692 Suggestion from Dan Jacobson.
7694 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
7696 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7697 * src/stat.c (human_fstype): Handle Linux's devpts.
7699 2003-04-09 Paul Eggert <eggert@twinsun.com>
7701 * src/split.c (line_bytes_split): Arg is of type size_t, since
7702 that's all that is supported for now.
7703 (main): Check for overflow in obsolescent line count option.
7705 2003-04-09 Jim Meyering <jim@meyering.net>
7707 * tests/misc/split-fail: Add a new test for the above fix.
7709 * src/split.c (bytes_split): Use size_t temporary (rather than
7710 uintmax_t original) in remaining computations. From Paul Eggert.
7712 Handle command line option arguments larger than 2^31.
7713 This allows e.g., splitting into files of size 2GB and larger,
7714 and running split --lines=N with N=2^31 or more.
7715 But for --line-bytes=N, the restriction that N <= SIZE_MAX
7716 remains (for now), due to the way it is implemented.
7718 * src/split.c: Include "inttostr.h".
7719 (bytes_split, lines_split, line_bytes_split, main):
7720 Use uintmax_t, not size_t, for file sizes.
7721 (main): Give a better diagnostic for option arguments == 0.
7722 Use umaxtostr to print file sizes.
7723 Reported by Luke Hassell.
7725 2003-04-08 Jim Meyering <jim@meyering.net>
7727 * src/rm.c (usage): Mention that --directory (-d) works only
7728 on some systems. Suggestion from Samuel Tardieu.
7730 * tests/basename/basic: Run $PERL to see if it is available,
7731 rather than testing its value.
7732 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
7733 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
7734 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
7735 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
7736 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
7737 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
7738 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
7739 * tests/sum/basic-1, tests/seq/basic: Likewise.
7741 * tests/misc/Makefile.am (TESTS): Add split-fail.
7742 * tests/misc/split-fail: New file.
7744 * src/split.c: Rename local variables: nchars -> n_bytes.
7745 (lines_split): Rename local, nlines -> n_lines.
7746 (main): Rename local variable: s/accum/n_units/.
7747 (main): Use STDIN_FILENO, not literal `0'.
7749 2003-04-07 Jim Meyering <jim@meyering.net>
7751 * src/stat.c: Add #include directives for Ultrix 4.4.
7752 Based on a suggested change from Bert Deknuydt.
7754 2003-04-06 Jim Meyering <jim@meyering.net>
7756 * Makefile.maint (makefile-check): New rule.
7757 (local-check): Add it.
7759 2003-04-05 Jim Meyering <jim@meyering.net>
7761 * Makefile.am (nearly all of them):
7762 Use $(VAR) rather than @VAR@, now that we can rely on automake to
7763 emit a definition for each substituted variable.
7764 * tests/Makefile.am.in: Likewise.
7766 * tests/rm/rm5: Add a comment explaining why this test fails when
7767 using Tru64's broken sed.
7768 * tests/rm/rm3: Likewise.
7770 Make `kill -t' output signal descriptions (not `?') on Tru64.
7771 * src/kill.c (sys_siglist): Also check for __sys_siglist.
7772 Patch by Tony Leneis.
7773 * configure.ac: Also check for declaration of __sys_siglist.
7774 Required for Tru64 4.0D, 4.0F, and 5.1.
7775 Reported by Tony Leneis.
7777 2003-04-04 Jim Meyering <jim@meyering.net>
7779 * src/Makefile.am (PERL): Remove unnecessary definition.
7781 Because of inappropriate (but POSIX-mandated) behavior of rename,
7782 `mv a b' would not remove `a' in some unusual cases. Work around
7783 this by unlinking `a' when necessary.
7785 * src/copy.c (same_file_ok): Add an output parameter.
7786 Set it in the offending case.
7787 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
7788 Reported by Ed Avis.
7789 * tests/mv/hard-4: New test for the above.
7790 * tests/mv/Makefile.am (TESTS): Add hard-4.
7792 Clean up rules for automatically generated sources:
7793 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
7794 Make each generated file be read-only.
7795 Add each file name to BUILT_SOURCES separately.
7796 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
7798 Put LOCALEDIR macro definition in new file: localedir.h.
7799 * src/Makefile.am (DEFS): Remove definition.
7800 (localedir.h): New rule.
7801 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
7802 * src/system.h: Include "localedir.h".
7804 2003-04-02 Jim Meyering <jim@meyering.net>
7808 * tests/misc/Makefile.am (TESTS): Add false.
7810 * Makefile.maint (TMPDIR): Make sure it's defined.
7811 (my-distcheck): Build in $(TMPDIR), not `.'.
7813 * src/Makefile.am (false.c): Change all occurrences of
7814 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
7815 unsuccessfully also with --help. Reported by Paul Jarc,
7816 * tests/misc/false: New test for the above.
7818 2003-03-30 Jim Meyering <jim@meyering.net>
7820 * NEWS: Note the location of older NEWS files.
7822 * src/remove.c (is_empty_dir): Don't let a failing closedir
7823 clobber errno. Spotted by Arnold Robbins.
7825 * src/env.c: Fix typo in comment. From Arnold Robbins.
7827 2003-03-29 Jim Meyering <jim@meyering.net>
7831 * README: Note to expect build problems for stat.c on Ultrix 4.3.
7832 Note that there are some harmless test failures when running
7833 `make check' as root on some systems.
7835 2003-03-28 Jim Meyering <jim@meyering.net>
7837 * tests/stty/row-col-1: Skip this test if stty can't get window size.
7838 This happens when connecting to sparc-solaris5.7 via ssh from within
7839 emacs. Reported by Karl Berry.
7841 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
7842 Otherwise, on systems (DJGPP) that emulate pipes using files,
7843 this test would never complete, waiting for `yes' to terminate.
7844 * tests/du/slink: As above, use seq, not `yes' to generate link target.
7845 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
7846 Reported by Rich Dawe.
7848 2003-03-27 Jim Meyering <jim@meyering.net>
7850 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
7851 from `written by...' comment, at his request.
7853 2003-03-24 Paul Eggert <eggert@twinsun.com>
7855 Fix buffer overrun problem reported by TAKAI Kousuke, along
7856 with some other POSIX incompatibilities.
7858 * src/printf.c (print_esc): Do not treat \x specially if
7859 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
7860 in backslash. Treat incomplete escape sequences as strings
7861 of characters, as POSIX requires.
7862 (print_formatted): Allow multiple flags. Avoid buffer overrun
7863 if the format is incomplete.
7865 2003-03-24 Jim Meyering <jim@meyering.net>
7867 * tests/misc/printf: Add tests for the above fixes and changes.
7869 2003-03-26 Jim Meyering <jim@meyering.net>
7871 * src/copy.h (struct cp_options): Add a comment.
7873 2003-03-23 Jim Meyering <jim@meyering.net>
7875 * README: Describe problem with 64-bit mode on HPUX 11.x,
7876 with patch for /usr/include/inttypes.h.
7877 * TODO: Plan to add an autoconf test to work around the bug.
7879 2003-03-22 Jim Meyering <jim@meyering.net>
7881 * src/stat.c: Don't include <sys/sysmacros.h>.
7882 That is already done via system.h. Otherwise, the multiple
7883 inclusion would evoke redefinition warnings from Cray's /bin/cc,
7884 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
7885 (human_fstype): Factor some directives `up', out of this function.
7886 Cast away `const' to avoid error from Cray's /bin/cc.
7888 2003-03-20 Jim Meyering <jim@meyering.net>
7890 * announce-gen (print_changelog_deltas): Ensure that a newline
7891 precedes each row of `*'s.
7893 2003-03-20 Jim Meyering <jim@meyering.net>
7897 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
7898 format flag characters.
7899 Do not require that a field width be specified.
7900 Do not fail when given a field width of `0'.
7901 Reported by Dan Jacobson.
7902 * tests/seq/basic: Add new tests for the above-fixed bug.
7904 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
7905 (install-root): Likewise.
7906 (install-exec-local): Likewise.
7907 Based on a patch from Richard Dawe.
7909 2003-03-19 Jim Meyering <jim@meyering.net>
7911 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
7912 because the DJGPP 2.03 port of 'ln -s' doesn't work.
7913 Include $(EXEEXT) in program names.
7914 Since $(LN_S) may degenerate to `cp -p', be careful
7915 to invoke it from the destination directory.
7916 Mostly from Richard Dawe.
7917 * configure.ac: Use AC_PROG_LN_S.
7919 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
7920 CDPATH shell variable set could cause this test to fail.
7921 Reported by Karl Berry.
7923 2003-03-18 Jim Meyering <jim@meyering.net>
7925 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
7926 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
7927 AIX 5.1's xlc could not compile the former.
7928 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
7930 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
7932 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
7933 program names, since automake only adds $(EXEEXT) to programs
7936 2003-03-16 Jim Meyering <jim@meyering.net>
7938 * src/remove.c (rm): Put two local variables in static storage,
7939 so they can't be clobbered by the potential longjmp.
7941 2003-03-15 Jim Meyering <jim@meyering.net>
7943 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
7944 so that a version number with a two-digit component can still count
7945 as an alpha release. Reported by Richard A Downing.
7946 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
7948 2003-03-14 Jim Meyering <jim@meyering.net>
7950 * src/ansi2knr.c: Remove no-longer-used file.
7951 * src/ansi2knr.1: Likewise.
7953 * Makefile.maint (prev_version_file): Don't use ?= for this particular
7954 assignment, since it causes trouble with old versions of GNU make
7955 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
7956 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
7957 Patch from Alexandre Duret-Lutz.
7959 * Use patched automake-1.7.3. Regenerate Makefile.in files in
7960 subdirectories so that each includes a definition of ACLOCAL_M4.
7962 * announce-gen (main): Label the compressed source URLs.
7966 * tests/du/slink: Relax the test for the `local'ness of a file system,
7967 so that now it works also for tmpfs.
7969 * tests/du/hard-link: Transform output from first du, so that this
7970 test doesn't fail on file systems like tmpfs that order directory
7971 entries differently.
7973 2003-03-13 Jim Meyering <jim@meyering.net>
7975 * tests/du/8gb: Work around what appears to be an NFS failure that
7976 would make this test fail on some systems.
7978 2003-03-11 Jim Meyering <jim@meyering.net>
7980 * tests/du/basic: Make the test file exactly 4k bytes long.
7982 * src/split.c (longopts): Don't hard-code `2' here.
7983 Instead, just specify `&verbose', and ...
7984 (main): ... remove the `case 2:' block for --verbose.
7986 * tests/du/basic: Make the test file larger than 64 bytes, so that
7987 we don't immediately disqualify file systems (e.g., NetApp) on which
7988 smaller files take up zero disk blocks. Reported by Vin Shelton.
7990 2003-03-10 Jim Meyering <jim@meyering.net>
7992 Don't segfault for a negative field width or precision in format string.
7993 Note that this is just a stopgap fix. The longer term solution may
7994 involve adapting bash's builtins/printf.def.
7996 * src/printf.c: (UNSPECIFIED): Define.
7997 (print_direc): Use the special value, UNSPECIFIED, to indicate
7998 that field_width or precision has not been specified.
7999 (print_formatted): Fail if field_width or precision is the
8000 special value, UNSPECIFIED.
8001 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8003 * src/sys2.h (INT_MIN): Define, if necessary.
8004 * tests/misc/printf: Add a test for the above-fixed bug.
8006 2003-03-09 Jim Meyering <jim@meyering.net>
8008 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8009 changing its sign. This avoids a warning from gcc on 64-bit systems.
8010 Reported by Bob Proulx.
8011 (pop_dir): Reverse order of sign change and cast, to be consistent
8014 2003-03-08 Jim Meyering <jim@meyering.net>
8016 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8017 shell variable, but only in the environment. With /bin/sh->bash, the
8018 shell variable is set to `y', and that would cause a spurious warning.
8019 Reported by Bob Proulx.
8021 * tests/Makefile.am (check-root): Remove touch/fifo.
8022 It doesn't appear to have to be run as root.
8024 * tests/rm/fail-2eperm: Rather than simply using the first non-root
8025 user name, make sure that the selected user name has a usable shell.
8026 Reported by Paul Jarc.
8028 Before, when using shred on a device, one had to specify --exact,
8029 or be careful to choose a size that would not be rounded up and
8030 exceed the maximum value; that could result in a failure of
8032 * src/shred.c (do_wipefd): --exact is now the default for non-regular
8033 files. Suggestion from Ben Elliston.
8036 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8037 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8038 Patch by Bob Proulx.
8040 * src/Makefile.am (check-misc): Check for use of `defined' in
8042 Change to $(srcdir) before running grep.
8044 * src/sleep.c: Remove now-unused #include and #define directives.
8046 * src/du.c (process_file): If a file's size is not being counted
8047 e.g., because it's a hard link to a file we've already counted,
8048 then don't print a line for it.
8050 * tests/du/hard-link: New test for the above-fixed bug.
8051 * tests/du/Makefile.am (TESTS): Add hard-link.
8054 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8055 and make the two-array approach work.
8057 * tests/du/basic: Correct/add tests for the above fix.
8058 Set LC_ALL, etc., now that we use sort.
8059 Check the block/size of a small file, too.
8060 Correct expected results for simple dir1/dir2/file case.
8061 Add another test of du -S.
8063 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
8065 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8066 middle-end/9986). As one of GCC's optimizations, it transforms a
8067 fputs_unlocked call to a fputc_unlocked call when the string is
8068 one character long. However, hpux doesn't have fputc_unlocked.
8070 * expr.c (usage): Use putchar, not fputs, to output a single character.
8071 * ls.c (dired_dump_obstack): Likewise.
8072 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8073 * stat.c (print_it): Likewise.
8075 2003-03-07 Jim Meyering <jim@meyering.net>
8077 * src/cp.c: Remove everything associated with mmap-stack.c.
8078 This reverts the two changes of 2003-02-21.
8079 * src/du.c: Remove everything associated with mmap-stack.c.
8080 This reverts the change of 2003-02-19.
8082 2003-03-06 Jim Meyering <jim@meyering.net>
8084 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
8085 CDPATH shell variable set could cause this test to fail.
8086 Reported by Karl Berry.
8088 2003-03-05 Jim Meyering <jim@meyering.net>
8092 * src/printf.c (print_esc): Remove pointless comparison of unsigned
8093 integer with zero, to avoid a warning from Intel's ecc.
8094 Reported by Nelson Beebe.
8096 * src/du.c (process_file): Sizes must all be of type uintmax_t.
8097 Otherwise, for files or totals that are too big, numbers would
8098 be truncated. Patch mostly by Michael Stone.
8099 Reported by Ingo Saitz as Debian bug #183210.
8101 * tests/du/8gb: New test for the above-fixed bug.
8102 * tests/du/Makefile.am (TESTS): Add 8gb.
8104 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8105 rather than UTILS_OPEN_MAX - 10.
8107 2003-03-04 Jim Meyering <jim@meyering.net>
8109 * README: Refer new feature discussion to bug-coreutils@gnu.org,
8110 rather than bug-gnu-utils, now that the former is better known.
8111 Suggestion from Göran Uddeborg.
8113 * src/stat.c (usage): Capitalize consistently.
8114 Reported by Göran Uddeborg.
8116 * Makefile.maint (rel-files): Include $(signatures), so that
8117 those files are also copied into $(release_archive_dir).
8119 * src/df.c (find_mount_point): Call error here, now that restore_cwd
8121 * src/remove.c (AD_pop_and_chdir): Likewise.
8123 * tests/Makefile.am (check-root): Add fail-2eperm.
8125 2003-03-03 Jim Meyering <jim@meyering.net>
8127 * src/remove.c (remove_cwd_entries): Include the full filename of
8128 the offending file, not just the basename.
8130 * tests/misc/tty-eof: Set $ME properly.
8132 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8133 Remove now-unused variables.
8134 (tag-prev-version, prev-cvs-tag): Likewise.
8136 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8137 accurate diagnostic when failing to remove a file owned by some other
8138 user. Reported by Ivo Timmermans via Michael Stone.
8139 This fixes Debian bug# 178471.
8141 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8142 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8143 Based on a report from Ivo Timmermans.
8145 2003-03-02 Jim Meyering <jim@meyering.net>
8147 * src/copy.c (copy_internal) [un_backup]: When recovering from a
8148 failure to create a hard link, do not remove the entry associating
8149 the source dev/ino with the destination file name.
8150 * tests/mv/Makefile.am (TESTS): Add hard-3.
8151 * tests/mv/hard-3: New test, for the above-fixed bug.
8152 Inspired by a report from Iida Yosiaki.
8154 2003-03-01 Jim Meyering <jim@meyering.net>
8156 * src/df.c (print_header): Don't embed spaces in a separate `Type'
8157 header string. Instead, put `Filesystem' and `Type' headers in the
8158 same string, so translators can use horizontal space as needed.
8159 Reported by Jean Charles Delepine.
8161 2003-02-28 Jim Meyering <jim@meyering.net>
8163 * src/copy.c (copy_internal): When link fails because of an
8164 existing destination file, unlink that file and try again.
8165 Reported by Iida Yosiaki.
8167 * tests/mv/Makefile.am (TESTS): Add hard-2.
8168 * tests/mv/hard-2: New test for the above-fixed bug.
8169 Based on a test case from Iida Yosiaki.
8171 2003-02-26 Jim Meyering <jim@meyering.net>
8173 * tests/du/basic: Don't test du's -b option here. Directory byte
8174 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8175 and IBM AIX 4.2. Reported by Nelson Beebe.
8177 2003-02-25 Jim Meyering <jim@meyering.net>
8179 * Makefile.maint (announcement): Now that ChangeLog entries
8180 are output by announce-gen, don't do it here.
8181 * announce-gen (print_changelog_deltas): New function.
8184 2003-02-22 Jim Meyering <jim@meyering.net>
8186 * announce-gen: New option: --release-type=TYPE
8187 * Makefile.maint (beta, major): New targets. Remove `release'.
8188 Put them all together on a line.
8189 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8190 invocation of `announcement'.
8191 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8193 * announce-gen: New option: --news=NEWS_FILE.
8194 Extract NEWS entries here, not via rules in Makefile.maint.
8195 * Makefile.maint (announcement): Now that NEWS entries are
8196 extracted by announce-gen, don't do it here.
8197 (news-r1, news-r2): Remove now-unused definitions.
8199 2003-02-21 Jim Meyering <jim@meyering.net>
8203 Merge in changes from autoconf's version of this file.
8204 * Makefile.maint (www-gnu): Define.
8205 (standards.texi-url_prefix): Use $(www-gnu).
8206 (make-stds.texi-url_prefix): Likewise.
8208 * src/cp.c: Include "mmap-stack.h".
8209 (main): Invoke `run' through a macro that (when possible) runs it
8210 with a large, mmap'd stack.
8212 * src/cp.c (run): New function, preparing for the above.
8213 Exit from this function, not from main
8216 * src/du.c: New option: --apparent-size.
8217 (enum) [APPARENT_SIZE_OPTION]: New member.
8218 (long_options): Add it.
8219 (usage): Describe it.
8221 ['b']: Set apparent_size.
8222 David Eisner reported that the behavior of --bytes had changed.
8223 Paul Eggert proposed the use of a new option, --apparent-size.
8225 * src/du.c (apparent_size): New global.
8226 (print_only_size): Reflect the fact that we're printing byte counts,
8227 not ST_NBLOCKSIZE-byte-block counts.
8228 (print_size): Call print_only_size rather than duplicating its code.
8229 (process_file): Accumulate byte counts, rather than block counts.
8231 * src/du.c (process_file): Always reset size_to_propagate_to_parent
8232 for --separate-dirs (-S).
8234 2003-02-20 Jim Meyering <jim@meyering.net>
8236 * Use automake-1.7.3. Regenerate dependent files.
8238 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8239 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8240 (usage) [%B]: Describe it.
8243 * src/du.c (process_file): Reorganize the code to use only
8244 one `sum' array, and change how -S works back to the way it was
8245 before 2003-01-31. Patch by Bruno Haible.
8247 * tests/du/basic: New test.
8248 * tests/du/Makefile.am (TESTS): Add basic.
8250 * tests/envvar-check: Add checks for the following:
8251 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8253 * tests/Makefile.am: Rename phony target envvar-check to evar-check
8254 so as not to conflict with the distributed file by the same name.
8256 * src/du.c (process_file): Set info->skip before any possible return.
8258 Report correct usage for directories, not 0.
8259 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8260 _before_ recording the dev/ino of a directory.
8261 Reported by Bruno Haible.
8263 Now, df always displays the device file name corresponding to the
8264 listed mount point under `Filesystem'. Before, for an unmounted
8265 block- or character-special file argument, it would display the
8266 command-line argument instead.
8267 * src/df.c (show_disk): Return a value indicating whether
8268 there was a match. Don't try to find a mount point here.
8269 (show_entry): If show_disk doesn't find a match, call show_point.
8271 2003-02-19 Jim Meyering <jim@meyering.net>
8273 * src/du.c: Include "mmap-stack.h".
8274 (du_files): Add prototype with ATTRIBUTE_NORETURN.
8275 Exit from this function, not from...
8277 Instead, if possible, invoke du_files through a macro that
8278 runs it with a large, mmap'd stack.
8280 * src/join.c (usage): Change wording in --help output:
8281 use FILENUM instead of `SIDE' and say what FILENUM means.
8282 Reported by Bernhard Gabler.
8284 * src/df.c (print_header): Rather than using a hard-coded literal
8285 string of spaces matching the length of the English `...Type' header,
8286 output the right number of spaces to match the selected translation.
8287 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8289 * src/split.c (bytes_split): Remove unnecessary `else' after break.
8290 (lines_split): Likewise. and correct misleading indentation.
8292 * src/split.c: Include "full-read.h".
8293 (bytes_split, lines_split, line_bytes_split): Use full_read,
8294 not safe_read. The way split was using the latter, a short read
8295 could cause split to terminate before EOF.
8297 * tests/misc/tty-eof: Test all programs that can read stdin,
8298 requiring no arguments and that write to standard output.
8300 * tests/misc/tty-eof: New file. Renamed from ...
8301 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
8302 * tests/misc/Makefile.am (TESTS): Reflect renaming.
8304 2003-02-18 Jim Meyering <jim@meyering.net>
8306 cksum would perform an extra read after encountering EOF
8307 * src/cksum.c (cksum): Exit the loop upon EOF, too.
8308 Patch by Michael Bacarella.
8310 Test for the bug fixed today in cksum, md5sum, and sha1sum.
8311 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8312 cat, cksum, md5sum, and sha1sum all in the same loop.
8314 2003-02-14 Jim Meyering <jim@meyering.net>
8316 * src/remove.c: Include "euidaccess.h".
8317 Remove declaration of euidaccess.
8319 2003-02-12 Jim Meyering <jim@meyering.net>
8321 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8322 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
8324 2003-02-10 Jim Meyering <jim@meyering.net>
8326 * src/test.c: Don't include group-member.h.
8327 Include euidaccess.h.
8328 (eaccess): Rewrite function to set the real uid and gid temporarily
8329 to the effective uid and gid, then invoke 'access', and then set the
8330 real uid and gid back. On systems that lack setreuid or setregid,
8331 fall back on the kludges in euidaccess. Before, it would not work
8332 for e.g., files with ACLs, files that were marked immutable,
8333 or on file systems mounted read-only. Nelson Beebe raised the issue.
8334 Paul Eggert suggested the new implementation.
8336 2003-02-09 Jim Meyering <jim@meyering.net>
8338 * src/test.c (test_stat): Remove function. It's job is done (only
8339 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
8341 2003-02-08 Jim Meyering <jim@meyering.net>
8345 * tests/mv/part-symlink: Don't assume that the file owner username
8346 length is less than 9 in ls output: instead, omit that field
8347 altogether. Reported by, and suggested fix from, Ferdinand.
8349 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8350 * tests/du/Makefile.am (TESTS): Add restore-wd.
8352 * src/rm.c: Correct now-invalid comment about cycle-detection.
8354 2003-02-06 Jim Meyering <jim@meyering.net>
8356 * NEWS: Add entries from old/*/NEWS
8357 from fileutils-4.1 through 4.1.11 and
8358 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
8362 * src/du.c (process_file): Don't return early for excluded files
8363 or for files whose dev/inode we've already seen.
8365 2003-02-05 Jim Meyering <jim@meyering.net>
8367 * tests/du/exclude: New file.
8368 * tests/du/Makefile.am (TESTS): Add exclude.
8370 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
8372 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8373 Fix memory allocation arithmetic.
8375 2003-02-04 Jim Meyering <jim@meyering.net>
8377 `df /dev/block-or-char-device-file--not-mounted' now reports
8378 the name of the file system on which the file resides, usually `/'.
8379 Before, it would leave the `Mounted on' field blank.
8380 * src/df.c (show_disk): Move function to precede find_mount_point.
8381 (show_disk): Add parameter: STATP.
8382 If we don't find a matching device name, then resort to calling
8383 find_mount_point. Reported by Bob Proulx.
8385 2003-02-03 Andreas Schwab <schwab@suse.de>
8387 * tests/rm/cycle: Require non-root.
8388 * tests/rm/isatty: Likewise.
8390 2003-02-02 Jim Meyering <jim@meyering.net>
8394 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8396 Ensure that there are no offending uses of `:'.
8397 * Makefile.maint (makefile_path_separator_check): New rule.
8398 (local-check): Add it to the list.
8400 2003-02-01 Jim Meyering <jim@meyering.net>
8402 * src/du.c (MAX_N_DESCRIPTORS): Define.
8404 * src/stat.c (G_fail): New global.
8405 (human_time): Diagnose failed localtime, not failed nstrftime.
8406 (main): Fail if G_fail is set.
8408 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
8410 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8411 hard-coding the path-separator. Also double-quote the new PATH,
8412 to avoid problems when the path-separator is a semi-colon or when
8413 `pwd` contains e.g. a space.
8414 * tests/chgrp/Makefile.am: Likewise.
8415 * tests/chmod/Makefile.am: Likewise.
8416 * tests/chown/Makefile.am: Likewise.
8417 * tests/cp/Makefile.am: Likewise.
8418 * tests/dd/Makefile.am: Likewise.
8419 * tests/dircolors/Makefile.am: Likewise.
8420 * tests/du/Makefile.am: Likewise.
8421 * tests/expr/Makefile.am: Likewise.
8422 * tests/factor/Makefile.am: Likewise.
8423 * tests/fmt/Makefile.am: Likewise.
8424 * tests/install/Makefile.am: Likewise.
8425 * tests/ln/Makefile.am: Likewise.
8426 * tests/ls/Makefile.am: Likewise.
8427 * tests/ls-2/Makefile.am: Likewise.
8428 * tests/md5sum/Makefile.am: Likewise.
8429 * tests/misc/Makefile.am: Likewise.
8430 * tests/mkdir/Makefile.am: Likewise.
8431 * tests/mv/Makefile.am: Likewise.
8432 * tests/od/Makefile.am: Likewise.
8433 * tests/rm/Makefile.am: Likewise.
8434 * tests/rmdir/Makefile.am: Likewise.
8435 * tests/seq/Makefile.am: Likewise.
8436 * tests/sha1sum/Makefile.am: Likewise.
8437 * tests/shred/Makefile.am: Likewise.
8438 * tests/stty/Makefile.am: Likewise.
8439 * tests/sum/Makefile.am: Likewise.
8440 * tests/tail-2/Makefile.am: Likewise.
8441 * tests/touch/Makefile.am: Likewise.
8442 * tests/tsort/Makefile.am: Likewise.
8443 * tests/unexpand/Makefile.am: Likewise.
8445 2003-01-31 Jim Meyering <jim@meyering.net>
8447 * src/stat.c: Include "file-type.h"
8448 (print_human_type): Remove function.
8449 (human_access): Rename from print_human_access. Return a string.
8450 (human_time): Rename from print_human_time. Return a string.
8451 (print_stat): Arrange so that field width and an alignment specifier
8452 are honored for the %A, %F, %x, %y, and %z formats.
8453 [%F]: Use file_type; this gives slightly different file type strings,
8454 e.g., `directory' instead of `Directory' and `regular file' or
8455 `regular empty file' instead of `Regular file'.
8456 Prompted by a report from Richard Dawe that the uses of
8457 S_IFSOCK and S_IFIFO in print_human_time were not portable
8458 to systems using e.g., DJGPP.
8460 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
8462 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8463 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
8465 2003-01-31 Jim Meyering <jim@meyering.net>
8467 * src/du.c (main): Upon processing an invalid option or an invalid
8468 --exclude-from or --max-depth option argument, don't exit right away,
8469 in case there are others. Rather record the failure and exit after
8470 processing other options.
8472 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8473 tar archive easier to reproduce.
8475 Rewrite to perform directory traversal using nftw.
8477 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8478 (AUTHORS): Add self.
8479 (opt_one_file_system): Move global into `main'.
8480 (path, xstat, exit_status): Remove declarations.
8481 (arg_length, suffix_length): New globals.
8482 (G_fail): New global, sort of like the old `exit_status'.
8483 (IS_FTW_DIR_TYPE): Define.
8484 (print_only_size): New function.
8485 (process_file): New function.
8486 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8487 (str_trunc, pop_dir, count_entry): Likewise.
8488 (du_files): Rewrite to use nftw.
8490 2003-01-30 Jim Meyering <jim@meyering.net>
8492 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8493 symlink-to-directory with -L, even without the trailing slash.
8495 2003-01-27 Jim Meyering <jim@meyering.net>
8497 * src/Makefile.am (check-misc): Check for st_blocks, too.
8499 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8500 Reported by Richard Dawe.
8502 2003-01-27 Andreas Schwab <schwab@suse.de>
8504 * src/ls.c (quote_name): Add fourth parameter, width, into which to
8505 store the screen columns, and return the number of bytes instead.
8506 (print_dir): Pass NULL as fourth parameter of quote_name.
8507 (print_name_with_quoting): Likewise.
8508 (length_of_file_name_and_frills): Get the width from the fourth
8509 parameter of quote_name instead of return value.
8511 2003-01-27 Jim Meyering <jim@meyering.net>
8513 * src/ls.c (decode_switches): If `dired' is set without
8514 `format == long_format', then silently reset dired. This doesn't
8515 change the behavior of ls (all prior uses of dired were protected
8516 by `&& format == long_format'), and lets us...
8517 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8518 (PUSH_CURRENT_DIRED_POS): Likewise.
8521 2003-01-22 Jim Meyering <jim@meyering.net>
8523 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8524 * tests/du/Makefile.am (TESTS): Add no-x.
8526 2003-01-21 Jim Meyering <jim@meyering.net>
8528 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8529 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8530 it may still be a directory -- or not (e.g., with FreeBSD on an
8531 NFS-mounted file system), so resort to calling lstat to find out.
8532 Based on a patch by Michael van Elst.
8534 * tests/cp/same-file: Don't assume that the file owner username
8535 length is less than 9 in ls output: instead, omit that field
8536 altogether. Reported by, and suggested fix from, Ferdinand.
8538 2003-01-20 Jim Meyering <jim@meyering.net>
8540 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8541 large format widths no longer cause strftime to infloop.
8543 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8545 2003-01-19 Jim Meyering <jim@meyering.net>
8547 * src/readlink.c: Include "canonicalize.h".
8549 2003-01-18 Jim Meyering <jim@meyering.net>
8551 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8553 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8554 (long_options): Add option --dereference-command-line-symlink-to-dir.
8555 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8556 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8557 -d, -F, -l options is specified.
8558 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8559 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8560 Change --dereference-command-line (-H) to dereference *all*
8561 command line arguments, including broken symlinks.
8563 2003-01-15 Paul Eggert <eggert@twinsun.com>
8565 Change ls -H back to the way it was yesterday, since this is
8566 compatible with FreeBSD and the POSIX spec is confusing
8567 and somewhat contradictory.
8569 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8570 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8571 (long_options): Change the long option name back.
8572 (usage): Change the usage back.
8573 (gobble_file): When -H is specified, dereference a top-level
8574 arg even if it points to a non-directory.
8576 2003-01-15 Jim Meyering <jim@meyering.net>
8578 * src/ls.c (gobble_file): Fall back on using lstat when required:
8579 when --dereference (-L) is not specified, and
8580 - when operating on a dangling symlink
8581 - when operating on command-line-symlink-to-directories
8582 This fixes numerous problems. Here are examples:
8583 - `ls dangling-symlink' would fail with `no such file...'
8584 Now it prints `dangling-symlink'.
8585 - `ls -i symlink' would mistakenly print the inode of the referent.
8586 Now it prints the inode of the symlink. Likewise for --size (-s).
8587 Based on a patch from Michael Stone.
8588 Reported by Deepak Goel as Debian bug #173793.
8590 Rename ls's --dereference-command-line (-H)
8591 option to --dereference-command-line-symlink-to-dir.
8592 * src/ls.c [enum Dereference_symlink]
8593 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8594 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
8595 (long_options): Rename the long option.
8596 (usage): Say that --dereference-... changes how ls treats
8597 only symlinks to directories specified on the command line.
8599 2003-01-14 Jim Meyering <jim@meyering.net>
8601 * tests/ls/dangle: New file/test, for the above fix.
8602 * tests/ls/inode: Another new file/test, for the above fix.
8603 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8605 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8606 so that ls --color would no longer highlight the names of files with
8607 the execute bit set when not specified on the command line.
8608 Patch by Michael Stone. Reported by Stephen Depooter as
8611 * tests/ls-2/tests (color-exe): New test, for the above fix.
8613 2003-01-13 Jim Meyering <jim@meyering.net>
8615 * tests/shred/exact: Also test for just fixed bug with --zero.
8617 * src/shred.c (long_opts): --zero does not require an argument.
8618 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
8620 2003-01-12 Jim Meyering <jim@meyering.net>
8622 * Makefile.maint (cvs-update): Skip any file with local modifications.
8624 * src/unexpand.c (usage): Document --first-only and mention that
8625 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
8627 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
8629 * src/df.c: Include "canonicalize.h".
8630 Use canonicalize_file_name unconditionally.
8632 2003-01-09 Jim Meyering <jim@meyering.net>
8634 * README: Add readlink.
8636 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
8638 * src/df.c: Include "xgetcwd.h".
8639 * src/pwd.c: Likewise.
8641 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
8643 * src/shred.c: Remove declaration of xstrdup.
8644 We already get it via xalloc.h which is included via system.h.
8646 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
8648 New program: readlink.
8650 * src/Makefile.am (bin_PROGRAMS): Add readlink.
8651 * src/readlink.c: New file.
8653 * man/readlink.x: New file.
8654 * man/Makefile.am (dist_man_MANS): Add readlink.1.
8655 (readlink.1): New rule.
8657 2003-01-09 Jim Meyering <jim@meyering.net>
8659 When selecting ranges of byte offsets (as opposed to ranges of fields)
8660 and when --output-delimiter=STRING is specified, output STRING between
8661 ranges of selected bytes.
8662 * src/cut.c (RANGE_START_SENTINEL): Define.
8663 (output_delimiter_specified): New global.
8664 (print_kth): Add parameter. Adjust all callers.
8665 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8666 (cut_bytes): When requested, output STRING between ranges of
8668 (main): Make a diagnostic a little clearer.
8669 Based on a patch from Jan Nieuwenhuizen.
8671 * tests/cut/Test.pm: New tests for the above.
8673 * src/cut.c (set_fields): Make code agree with comment:
8674 Don't merge abutting ranges like 4- and 2-3. This makes no
8675 difference currently, but is required to support an upcoming change.
8677 2003-01-07 Jim Meyering <jim@meyering.net>
8679 * src/cut.c (set_fields): Fix typo in comment.
8681 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8682 * tests/touch/Makefile.am (TESTS): Add not-owner.
8683 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8684 Now, this tests only the nonexistent-directory diagnostic.
8685 Suggestion from Michael Stone.
8687 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8689 2003-01-04 Jim Meyering <jim@meyering.net>
8691 * src/copy.h: Remove use of PARAMS.
8692 * src/remove.h: Likewise.
8693 * src/chown-core.h: Likewise.
8695 rm could be tricked into mistakenly reporting a cycle.
8696 * src/remove.c: [cycle_check_state]: New global.
8697 (remove_cwd_entries): Adapt to new semantics of cycle_check.
8698 (rm): Call cycle_check_init and cycle_check_free for each file.
8699 * tests/rm/cycle (rm): New test, for the above fix.
8700 * tests/rm/Makefile.am (TESTS): Add cycle.
8702 When rm detects a cycle, don't abort the entire command,
8703 but rather just the affected command line argument.
8704 * src/remove.c: Include <setjmp.h>
8705 (struct dirstack_state) [current_arg_jumpbuf]: New member.
8706 (remove_cwd_entries): Call longjmp if we detect a cycle.
8707 (rm): Call setjmp here.
8709 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8710 Instead, include cycle-check.h and use it.
8712 * src/remove.h (struct dev_ino): Remove declaration.
8714 * src/remove.c (remove_cwd_entries): Fix typos in comment.
8716 Don't include trailing /. in diagnostics about directories.
8717 * src/remove.c (full_filename_): When FILENAME is just `.'
8718 and there is a nonempty directory-name part, don't append `/.'.
8719 * tests/rm/unread2: Remove trailing /. from diagnostic.
8720 * tests/rm/rm2: Likewise.
8722 * src/remove.c (struct dirstack_state): Define.
8723 To be used in place of these file-scoped globals ...
8724 (dir_stack, len_stack, Active_dir): Remove globals.
8725 (ds_init, ds_free): New functions.
8726 (full_filename): Define.
8727 (full_filename_): Rename from full_filename.
8729 Begin to make AD_* functions more generic.
8730 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8731 (AD_push): Likewise.
8732 (AD_INIT_OTHER_MEMBERS): Define.
8733 (remove_dir): Define the `status' member manually after each
8734 call to AD_push or AD_push_initial.
8736 * src/Makefile.am (check-misc): New rule, to ensure that no more
8737 S_IS* macro definitions sneak into the code.
8738 (check): Depend on check-misc.
8740 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
8741 * src/du.c (count_entry) [S_ISLNK]: Don't define.
8742 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
8744 2003-01-03 Jim Meyering <jim@meyering.net>
8746 * src/true.c: Add copyright.
8747 (AUTHORS): I suppose I've written it.
8749 * src/Makefile.am (false.c): Make the generated file be read-only.
8751 2003-01-04 Jim Meyering <jim@meyering.net>
8753 * src/ls.c: Include "dev-ino.h".
8754 [struct dev_ino]: Remove declaration.
8756 2003-01-02 Jim Meyering <jim@meyering.net>
8758 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
8759 from mv: s/missing file arguments/missing file argument/.
8760 With --target-directory=DIR, cp and mv work with a single file argument.
8761 Reported by Karl Berry.
8763 * tests/rm/isatty: Enable this test.
8765 2002-12-31 Jim Meyering <jim@meyering.net>
8767 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8768 (AD_push): Likewise.
8769 (AD_INIT_OTHER_MEMBERS): Define.
8770 (remove_dir): Define the `status' member manually after each
8771 call to AD_push or AD_push_initial.
8773 * src/ls.c [struct dev_ino]: Remove definition.
8774 Include "dev-ino.h" instead.
8776 2002-12-28 Jim Meyering <jim@meyering.net>
8778 * tests/du/Makefile.am (TESTS): Add no-deref.
8779 * tests/du/no-deref: New script.
8781 2002-12-23 Jim Meyering <jim@meyering.net>
8783 * src/remove.c (remove_cwd_entries): Fix typo in comment.
8785 2002-12-21 Jim Meyering <jim@meyering.net>
8787 * announce-gen: Generate MML-formatted announcement.
8788 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
8790 2002-12-20 Jim Meyering <jim@meyering.net>
8792 * src/touch.c (touch): Change the wording of a diagnostic so
8793 that it makes sense both when the file exists and when it doesn't.
8794 Suggestion from Michael Stone.
8796 2002-12-18 Jim Meyering <jim@meyering.net>
8798 * src/stty.c (valid_options): Declare to be static.
8800 2002-12-15 Jim Meyering <jim@meyering.net>
8802 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
8804 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
8805 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
8806 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
8807 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
8808 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
8810 * src/remove.c (PARAMS): Remove definition.
8811 * src/sys2.h: Likewise.
8813 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
8814 Include strftime.h instead.
8816 2002-12-14 Jim Meyering <jim@meyering.net>
8818 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
8820 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
8821 This is necessary at least for Irix6.5 when using c89.
8822 Reported by Nelson Beebe.
8824 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
8826 * tests/misc/cat-tty-eof: New test.
8828 * src/mknod.c (usage): Specify how major and minor mode numbers
8829 are interpreted. Report forwarded by Kristin E Thomas.
8830 * src/mknod.c: Remove now-redundant usage-specifying comment.
8832 2002-12-13 Jim Meyering <jim@meyering.net>
8836 * tests/du/trailing-slash: Allow for a directory of size `0'.
8837 That happens at least on file systems of type tmpfs on linux-2.4.18.
8839 * announce-gen: New script to begin replacing the commands
8840 associated with the rule here...
8841 * Makefile.maint (announcement): Invoke announce-gen.
8842 * Makefile.am (EXTRA_DIST): Add announce-gen.
8844 * tests/cp/preserve-2: New file/test, for latest fix.
8845 * tests/cp/Makefile.am (TESTS): Add preserve-2.
8847 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
8849 Fix a bug whereby cp would fail to parse an option like
8850 --preserve=mode,ownership.
8851 * src/cp.c (decode_preserve_arg): Advance `comma' to
8852 point the character following the comma.
8854 2002-12-11 Jim Meyering <jim@meyering.net>
8856 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
8857 in case it's already defined.
8859 2002-12-09 Jim Meyering <jim@meyering.net>
8861 * tests/touch/fail-diag: Don't get a test failure if /no exists.
8862 Instead, evoke a framework failure if /no-$$ exists.
8863 Reported by Michael Stone.
8865 2002-12-08 Jim Meyering <jim@meyering.net>
8867 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
8868 Define to rpl_lstat, so that even on systems like Solaris 5.8,
8869 du honors (per POSIX) the trailing slash on an argument referring
8870 to a symlink-to-directory.
8872 2002-12-06 Jim Meyering <jim@meyering.net>
8874 * Use autoconf-2.57. Regenerate dependent files.
8875 * Use automake-1.7.2. Regenerate dependent files.
8877 * src/ls.c (gobble_file): Also stat the file if it's a
8878 regular file and --indicator-style=classify (aka -F).
8879 Thanks to Ed Santiago for opening my eyes.
8881 * tests/ls/file-type: New file. Test for the above.
8882 A test to contrast ls -F and ls --indicator-style=file-type.
8883 * tests/ls/Makefile.am (TESTS): Add file-type.
8885 2002-12-04 Jim Meyering <jim@meyering.net>
8887 * tests/ls/follow-slink: Make sure the symlink was created.
8888 Richard Dawe reported that `ln -s link link' succeeds, but creates
8889 no file on systems running some version of the DJGPP libc.
8891 2002-12-03 Jim Meyering <jim@meyering.net>
8893 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
8894 since this package no longer panders to K&R compilers.
8896 2002-12-02 Jim Meyering <jim@meyering.net>
8898 * tests/du/slink: Skip this test if `.' is on a non-local file system.
8900 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
8901 something to replace.
8903 2002-12-01 Jim Meyering <jim@meyering.net>
8905 * src/stat.c: Don't include <string.h> or <ctype.h>.
8906 That's already done via system.h.
8907 * src/dircolors.c: Don't include <ctype.h>.
8909 2002-11-30 Jim Meyering <jim@meyering.net>
8911 * ls.c (gobble_file): Remove the block of code that caused
8912 `ls --color -F symlink-to-dir' to list the files in
8913 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
8914 like `ls -F symlink-to-dir') but with the addition of highlighting.
8915 Similarly, `ls --color -dF symlink-to-dir' would print
8916 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
8917 Reported by Jeff Sheinberg as Debian bug #168203.
8918 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
8920 ls is now more efficient: with certain options, it no longer needs
8921 to stat each directory entry on systems with valid dirent.d_type.
8922 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
8923 (main): Make --recursive set format_needs_type, not format_needs_stat.
8924 (gobble_file): Remove a FIXME comment, now that it's fixed.
8926 2002-11-24 Jim Meyering <jim@meyering.net>
8928 * src/du.c (du_files): Don't strip any trailing slash.
8929 Rewrite so that `/' is no longer represented internally as
8931 (count_entry): When appending a file name component,
8932 account for the fact that the current path may end in `/'.
8933 François Pinard reported that `du symlink-to-dir/' was not
8934 equivalent to `du symlink-to-dir/.'. Now it is.
8935 * tests/du/trailing-slash: New file/test, for the above fix.
8936 * tests/du/Makefile.am (TESTS): Add trailing-slash.
8938 2002-11-23 Jim Meyering <jim@meyering.net>
8940 * src/tac.c (output): Declare some local variables to be of type size_t,
8941 rather than `int' to avoid warnings from gcc.
8943 2002-11-21 Paul Eggert <eggert@twinsun.com>
8945 * src/ls.c (decode_switches): Use case-sensitive matching to
8946 decode the QUOTING_STYLE environment variable. This is more
8947 consistent with the documentation, and with --quoting-style.
8949 2002-11-21 Martin Buck <martin.buck@ascom.ch
8951 * src/stty.c (struct speeds): Add support for all baud rates defined
8954 2002-11-19 Jim Meyering <jim@meyering.net>
8956 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
8957 run in a UTF locale. Report and suggested fix by Bruno Haible.
8958 * tests/fmt/basic: Likewise.
8960 2002-11-17 Jim Meyering <jim@meyering.net>
8962 * configure.ac: Update via autoupdate.
8963 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
8965 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
8966 Reported by Hans Ginzel.
8968 2002-11-15 Jim Meyering <jim@meyering.net>
8970 * Makefile.cfg (gnu_rel_host): Define.
8971 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
8972 on whether $(VERSION) looks like a major release number.
8974 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
8975 (release): Rename from `alpha'.
8976 (alpha): Depend on release.
8978 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
8980 2002-11-14 Jim Meyering <jim@meyering.net>
8982 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
8983 (announcement): Use the new variable.
8985 * Makefile.maint: Sync with Bison, i.e.:
8986 (po-check): Scan .l and .y files instead of the
8987 .c and the .h files that they generate. This fixes the bug
8988 reported by Tim Van Holder in:
8989 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
8990 Look for N_ as well as for _. Try to avoid matching #define for
8994 2002-11-12 Jim Meyering <jim@meyering.net>
8996 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
8997 Replace sole use with equivalent `#ifdef S_ISLNK'.
8998 Inconsistency reported by Dmitry V. Levin.
9000 2002-11-11 Jim Meyering <jim@meyering.net>
9002 * src/stat.c (usage): Transform --help items output via s/ - / /,
9003 so that help2man produces properly formatted man pages.
9004 Reported by Herbert Xu as Debian bug #168400.
9006 2002-11-10 Jim Meyering <jim@meyering.net>
9008 * src/ls.c (sighandler): Handle SIGTSTP specially.
9009 Based on suggestions from Solar Designer and Dmitry V. Levin.
9012 * Makefile.cfg (cvs_files): Define. From autoconf.
9013 (local_updates): Likewise.
9015 * src/ls.c (restore_default_color_handler, sigtstp_handler):
9017 (sighandler): New function, based on the one in sort.c.
9018 (main): Use sigaction, if possible; otherwise signal.
9019 Handle these signals:
9020 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9021 Don't register our handler if the signal is already being ignored.
9023 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9024 * src/csplit.c (interrupt_handler): Likewise.
9025 * src/sort.c (sighandler): Likewise.
9026 (main): Declare `i' and `nsigs' to be unsigned, not int.
9028 2002-11-09 Jim Meyering <jim@meyering.net>
9030 ls --color: restore terminal text color upon signal.
9031 * src/ls.c: Include "full-write.h" and <signal.h>.
9032 (restore_default_color, restore_default_color_handler): New functions.
9033 (sigtstp_handler, put_indicator_direct): New functions.
9034 (main) [print_with_color]: Register signal handlers.
9035 Patch mostly by Solar Designer and Stanislav Ievlev.
9037 Update from autoconf.
9038 * Makefile.maint (AMTAR): Remove definition.
9039 (update, cvs-update, po-update, do-po-update): New rules.
9040 (wget-update): Update (thus renaming to cvs-update).
9041 (automake_repo): Use anoncvs@sources.redhat.com.
9043 2002-11-06 Jim Meyering <jim@meyering.net>
9045 * tests/misc/Makefile.am (TESTS): Add printf-hex.
9047 * tests/misc/printf: Be careful to test the code in this package,
9048 not the shell built-in function.
9050 * src/printf.c (print_esc): A hexadecimal escape sequence has
9051 at most two hex. digits, not three. Reported by Padraig Brady.
9052 (usage): Update description.
9053 * tests/misc/printf-hex: New file/test, for the above fix.
9055 2002-10-07 Paul Eggert <eggert@twinsun.com>
9057 Add support for locale-specific size indications (e.g.,
9058 thousands-separators) and for explicit size suffixes on output.
9060 * doc/coreutils.texi (Block size): Say that:
9061 This affects display format as well as block size.
9062 Fractional block counts are rounded up.
9063 ls file size blocksize defaults to 1.
9064 A block size spec preceded by ' generates thousands separators.
9065 A suffix without a preceding integer generates suffixes.
9066 (tail invocation): 32k -> 32 KiB.
9067 (What information is listed): ls -h is now equivalent to
9068 ls --block-size=human, and ls -H is now equivalent to
9069 ls --block-size=si. Displayed file size is now always affected by
9072 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9073 lib/umaxtostr.c: New files, taken from GNU tar.
9075 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9077 (EXTRA_DIST): Add inttostr.c.
9079 * lib/human.c, lib/human.h: Rewrite to support locale-specific
9080 notations like thousands separators.
9081 Specify what includer of include.h must include beforehand.
9082 (human_group_digits, human_suppress_point_zero, human_autoscale,
9083 human_base_1024, human_SI, human_B): New enum values.
9084 (human_readable): Rename from human_readable_inexact; put the
9085 options before the sizes. All uses changed. The old human_readable
9086 function has been removed; use inttostr.h instead.
9087 (human_options): Renamed from human_block_size, with new signature
9088 that allows block sizes up to UINTMAX_MAX. All callers changed.
9090 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9091 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
9092 freestanding C89. No need to check for stdlib.h or string.h since
9093 autoconf does this now.
9095 * src/cksum.c (cksum): Use primitives from inttostr.h, not
9096 human.h, to print large numbers simply.
9097 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9098 * src/dd.c (print_stats, main): Likewise.
9099 * src/df.c (print_header): Likewise.
9100 * src/factor.c (print_factors): Likewise.
9101 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9102 * src/shred.c (dopass): Likewise.
9103 * src/sort.c (checkfp): Likewise.
9104 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9105 * src/tail.c (xlseek): Likewise.
9106 * src/wc.c (write_counts, wc): Likewise.
9108 * src/df.c (human_output_opts): New var.
9109 (output_block_size): Now uintmax_t, not int, to handle larger
9110 block sizes. All uses changed.
9111 * src/du.c: Likewise.
9112 * src/ls.c: Likewise.
9114 * src/df.c (print_header): In the header line, prefer SI to human
9115 representation if it's shorter; if neither is shorter, try to
9116 intuit what the user would prefer.
9118 * src/expr.c (inttostr): Remove; use new imaxtostr library
9121 * src/ls.c (file_output_block_size): New var, to distinguish
9122 file sizes from other sizes.
9123 (decode_switches): Set it.
9125 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9126 (dopass): When printing progress, use floor for what has been done
9127 so far (since we should be conservative there), and ceiling for
9128 what needs to be done (since that's what other programs use).
9130 2002-10-19 Jim Meyering <jim@meyering.net>
9132 * src/pinky.c (print_heading): Align TTY and Name headings.
9133 Reported by Karl Eichwalder.
9135 2002-10-18 Jim Meyering <jim@meyering.net>
9137 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9138 Remove now-useless cast.
9139 (stdread): Remove function.
9140 (bytes_split): Use size_t instead of int.
9141 Use safe_read, not stdread.
9142 (lines_split): Likewise.
9143 Use memchr rather than a `while' loop.
9144 (line_bytes_split): Use size_t instead of int.
9145 Use safe_read, not stdread.
9146 (main): Add some FIXME comments to remind me to remove casts.
9148 * src/system.h (ST_BLKSIZE): Correct comment describing how to
9149 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
9151 2002-10-17 Jim Meyering <jim@meyering.net>
9153 Fix a problem that could make e.g., `cat' misbehave on systems which
9154 give invalid (unreasonably large) values for stat.st_blksize.
9155 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9156 Reported by Petter Reinholdtsen.
9158 2002-10-14 Jim Meyering <jim@meyering.net>
9160 Specifying a printf conversion specifer as nl's separator string
9161 could cause nl to segfault.
9162 * src/nl.c (build_print_fmt): Don't include separator string
9163 in the printf format; it might contain `%'.
9164 Use a better bound on the length of the print_fmt buffer.
9165 (print_lineno): Print the separator here instead.
9166 Reported by Doug Coleman.
9168 * tests/misc/nl: New file/tests, including a test for the above.
9169 * tests/misc/Makefile.am (TESTS): Add nl.
9171 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9172 * tests/misc/Makefile.am (TESTS): Add split-l.
9174 2002-10-13 Jim Meyering <jim@meyering.net>
9178 * src/du.c (usage): Tweak description of --dereference-args/-D.
9180 * src/du.c (count_entry): Also save cwd when dereferencing (via
9181 --dereference-args, -D) a command-line argument.
9182 Reported by Michal Svec. Based on a patch by Andreas Schwab.
9184 * src/Makefile.am (../AUTHORS): New target/rule.
9186 2002-10-12 Jim Meyering <jim@meyering.net>
9188 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9189 of type size_t, since that's the way it's used and avoids a warning.
9191 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9192 since that's how it's always used and avoids a new warning from gcc.
9193 (read_input): Adapt to new safe_read ABI.
9195 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9198 * src/pinky.c (print_long_entry): fread returns size_t.
9199 Declare local `bytes' accordingly, to avoid warning.
9201 tail -c +N would perform an extra read after encountering EOF
9202 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9203 * src/tail.c (start_bytes): Detect EOF, inform caller.
9204 (tail_bytes): Upon EOF in start_bytes, return immediately.
9205 (file_lines): Reorganize to use memrchr rather than an explicit loop.
9206 Adapt to new safe_read ABI.
9208 2002-10-11 Jim Meyering <jim@meyering.net>
9210 * tests/du/deref: New file/test, for the above fix.
9211 * tests/du/Makefile.am (TESTS): Add deref.
9213 2002-10-10 Jim Meyering <jim@meyering.net>
9215 * tests/ln/Makefile.am (TESTS): Add target-1.
9216 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9218 2002-10-09 Jim Meyering <jim@meyering.net>
9220 * tests/cp/backup-is-src: Ensure that certain environment variables
9221 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
9223 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9224 consume 4GB of disk space on systems without support for sparse files.
9225 Fix a logic error that'd make it `cat err' even though dd didn't fail.
9227 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9228 Patch by steven@magelico.net, forwarded by Michael Stone.
9230 * tests/ls/dired: Ensure that ls produces English messages.
9231 Patch by Alexey Vyskubov, forwarded by Michael Stone.
9233 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
9235 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9237 2002-10-08 Jim Meyering <jim@meyering.net>
9239 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9240 Fix syntax in test: use =, not ==.
9241 Reported by Bob Proulx.
9242 Change all the rest like this: grep -lR "testing framework'" .\
9243 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9245 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9246 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9247 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9248 * src/wc.c (wc): Likewise.
9250 2002-10-07 Paul Eggert <eggert@twinsun.com>
9253 Don't advance the write pointer past the end of the write buffer.
9254 * src/sort.c (begfield, limfield): Likewise.
9256 2002-10-07 Jim Meyering <jim@meyering.net>
9258 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9259 * src/head.c (head_bytes, head_lines): Likewise.
9261 2002-10-06 Jim Meyering <jim@meyering.net>
9263 * src/dd.c (scanargs): Ensure that specified block sizes (specified
9264 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9265 (skip, dd_copy): Adapt to new safe_read ABI.
9267 * Makefile.maint (signatures): Define.
9269 (announcement): Depend on $(signatures).
9271 * Makefile.maint (announcement): Output all URLs for detached
9272 signatures, not just the last one from the previous loop.
9274 2002-10-05 Jim Meyering <jim@meyering.net>
9278 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9279 don't recurse into directory, DIR. Prompted by a report from
9282 * tests/rm/i-no-r: New file/test, for the above fix.
9283 * tests/rm/Makefile.am (TESTS): Add i-no-r.
9285 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9286 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9288 2002-10-03 Jim Meyering <jim@meyering.net>
9290 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9291 * src/df.c (AUTHORS): Likewise.
9292 * src/du.c (AUTHORS): Likewise.
9293 * src/tail.c (AUTHORS): Likewise.
9294 * src/touch.c (AUTHORS): Likewise.
9296 2002-10-02 Jim Meyering <jim@meyering.net>
9298 * Makefile.am (SUBDIRS): Remove `old'.
9299 (EXTRA_DIST): List the files in old/.
9300 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9301 Suggestion from Akim Demaille.
9303 2002-10-01 Jim Meyering <jim@meyering.net>
9305 * src/sys2.h (SSIZE_MAX): Define.
9307 2002-09-30 Jim Meyering <jim@meyering.net>
9309 * src/csplit.c: Don't include stdlib.h here. It's already included
9312 2002-09-29 Jim Meyering <jim@meyering.net>
9314 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9315 expression to avoid bogus warning from gcc.
9317 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9318 (cat): Declare insize and outsize to be of type size_t, not int.
9319 Rearrange pointer/integer expressions to avoid bogus warnings.
9320 (main): Declare insize and outsize to be of type size_t, not int.
9322 * src/tail.c (parse_options): Give a sensible diagnostic for
9323 an invalid byte or line count. Reported by Mikko Tuumanen.
9325 * src/touch.c (main): Split a long line.
9327 * tests/du/Makefile.am (TESTS): Add slink.
9328 * tests/du/slink: New test for system.h change of 2002-08-31.
9330 In move mode, always first try to rename. Before, upon failure to
9331 rename a directory, this code would never attempt to rename any
9332 other file in that directory, but would thenceforth always copy.
9333 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9334 may fail with EXDEV, yet renaming files within that directory to
9335 a newly-created destination directory succeeds.
9336 * src/copy.c (copy_internal): Remove local, move_mode;
9337 use x->move_mode instead. Based on a patch from Tom Haynes.
9339 2002-09-28 Jim Meyering <jim@meyering.net>
9341 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9342 Factor out some duplication.
9344 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9346 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9348 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9349 to avoid compiler warnings.
9351 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9354 Fix things so `mkdir -p' can create very deep directories, e.g.,
9355 mkdir -p $(perl -e 'print "a/" x 40000') now works.
9356 * src/mkdir.c (main): For --parents (-p), call make_path with the
9357 entire directory name, so we don't ever require that file operations
9358 like stat or chmod be performed on the entire command line argument.
9359 * makepath.c (make_path): Restore umask *before* creating the final
9362 2002-09-27 Andreas Schwab <schwab@suse.de>
9364 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9365 to avoid overflow. Reported by Hans Lermen.
9367 2002-09-26 Jim Meyering <jim@meyering.net>
9369 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
9371 2002-09-25 Jim Meyering <jim@meyering.net>
9373 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9374 and add a cast, to avoid a warning about `signed and unsigned type in
9375 conditional expression'.
9377 2002-09-22 Jim Meyering <jim@meyering.net>
9379 * src/rmdir.c: Include "dirname.h", for declaration of
9380 strip_trailing_slashes.
9382 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9383 Now they're defined through system.h.
9385 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9386 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9387 since it's already included from sys2.h via system.h.
9389 * Use automake-1.6f. Regenerate dependent files.
9391 * src/Makefile.am (PERL): Remove duplicate definition.
9393 fmt's -s, -t, -c options didn't work properly for long lines.
9394 Since get_line may end up calling put_paragraph (for long lines),
9395 be sure to set global, `other_indent', before it is used there.
9397 * src/fmt.c (set_other_indent): New function, factored out of...
9398 (get_paragraph): ... here. Call it.
9399 (get_line): Call set_other_indent before calling flush_paragraph,
9400 which calls fmt_paragraph, which in turn calls put_paragraph,
9401 which uses other_indent.
9403 * tests/fmt/Makefile.am (TESTS): Add long-line.
9404 * tests/fmt/long-line: New file/test, for the above fix.
9406 2002-09-21 Jim Meyering <jim@meyering.net>
9408 * src/od.c: No longer include deprecated <values.h>.
9409 It was required solely for now-removed reference to BITSPERBYTE.
9410 * src/install.c: Likewise.
9411 Suggestion from Bruno Haible.
9413 2002-09-06 Andreas Schwab <schwab@suse.de>
9415 `rmdir -p dir-specified-with-trailing-slash/' would fail.
9416 * src/rmdir.c (remove_parents): Strip trailing slashes.
9418 2002-09-20 Jim Meyering <jim@meyering.net>
9420 * tests/rmdir/t-slash: New file/test, for the above fix.
9421 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9423 * Makefile.maint (announcement): Arrange to gpg-sign the message.
9424 Add a URL for each detached signature file.
9426 2002-09-07 Bruno Haible <bruno@clisp.org>
9428 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9430 2002-09-18 Jim Meyering <jim@meyering.net>
9432 `od -t x8' used the wrong (`l'-prefixed) printf format.
9433 Likewise for the o8 and u8 formats.
9434 * src/od.c (ISPEC_TO_FORMAT): Define macro.
9435 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9436 Reported by Arun Sharma.
9438 2002-09-17 Jim Meyering <jim@meyering.net>
9440 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9441 From gettext's intl/loadmsgcat.c.
9443 * tests/od/x8: New file/test, for the above fix.
9444 * tests/od/Makefile.am (TESTS): Add x8.
9446 2002-09-15 Jim Meyering <jim@meyering.net>
9448 * Use autoconf-2.54. Regenerate dependent files.
9450 * src/csplit.c (get_format_width): Add cast to avoid
9451 warning about `signed and unsigned type in conditional expression'.
9453 2002-09-14 Jim Meyering <jim@meyering.net>
9455 * src/who.c (print_user): Change type of local to size_t
9456 to avoid warnings about `comparison between signed and unsigned'.
9457 * src/ptx.c (generate_all_output): Likewise.
9459 * src/dd.c (main, skip): Add casts to avoid warnings about
9460 `comparison between signed and unsigned'.
9462 * src/id.c (print_full_info, print_group_list): Add casts to avoid
9463 warnings about `signed and unsigned type in conditional expression'.
9465 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9466 to avoid warnings about `comparison between signed and unsigned'.
9467 (split_3): Change parameter names to be readable and add comment.
9468 Clean up the test for whether a line may be ignored.
9470 2002-09-13 Jim Meyering <jim@meyering.net>
9472 * src/printf.c (main): Handle leading command line argument of `--'.
9473 Reported by Raul: DervishD <raul@pleyades.net>
9474 * tests/misc/printf: New file: test for the above.
9475 * tests/misc/Makefile.am (TESTS): Add printf.
9477 * src/date.c (usage): Explain that %S's range of [0..60] is required --
9478 rather than 0..59 -- to accommodate the occasional positive leap second.
9479 Reported by Richard Neill.
9481 2002-09-12 Jim Meyering <jim@meyering.net>
9483 * src/Makefile.am (nanosec_libs): Define.
9484 (sleep_LDADD, tail_LDADD): Use it here.
9486 Factor nanosleep-related code into ../lib/xnanosleep.c.
9487 * src/sleep.c: Include xnanosleep.h.
9488 Factor out fenv.h-related code.
9489 (timespec_subtract): Remove function.
9490 (main): Remove code that deals with computing start and stop times
9491 as well as the loop around nanosleep. Now that's in xnanosleep.c.
9493 Allow S (in --sleep-interval=S) to be a floating point value.
9494 * src/tail.c: Include xnanosleep.h and xstrtod.h.
9495 Move declaration of global variable, sleep_interval, to ...
9497 (usage): Update description of --sleep-interval option.
9498 (tail_forever): New parameter, sleep_interval. Update caller.
9499 Use xnanosleep, rather than sleep.
9500 (parse_options): New parameter, sleep_interval. Update caller.
9501 Use xstrtod, now that we accept floating point values.
9502 Prompted by a patch from Augey Mikus.
9504 2002-09-06 Jim Meyering <jim@meyering.net>
9506 * src/remove.c (prompt): Change comment to give a better note to
9507 translators. From Michael Piefel.
9509 2002-09-02 Jim Meyering <jim@meyering.net>
9511 * README: A good problem report/patch includes diffs against
9512 the most recent test release.
9514 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9515 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9517 * src/kill.c (print_table_row): Use an unsigned type for widths
9518 to avoid warning about comparison between signed and unsigned.
9519 (list_signals): Likewise.
9521 * src/od.c (skip): Add a cast to avoid warning about comparison
9522 between signed and unsigned.
9523 * src/install.c (get_ids): Likewise. Also rearrange range-checking
9524 comparisons to make them more readable.
9526 2002-09-01 Jim Meyering <jim@meyering.net>
9530 2002-08-31 Jim Meyering <jim@meyering.net>
9532 Symlinks were always reported as using 0 blocks.
9533 * src/system.h (ST_NBLOCKS): Don't depend on file type.
9534 This reverts the change of 2000-01-30.
9535 Based on a report and patch from Neil Brown via Michael Stone.
9536 This fixes Debian Bug#156358.
9538 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9539 `exit (1)' to `exit (EXIT_FAILURE)', and
9540 `usage (1)' to `usage (EXIT_FAILURE)'.
9542 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9543 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9544 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9545 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9546 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9547 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9548 error never exits successfully.
9550 2002-08-29 Jim Meyering <jim@meyering.net>
9552 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9553 when ignoring any return value.
9555 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9556 failures. On some systems (at least EMC Celerra and Solaris5.8),
9557 this appears to be necessary.
9558 (is_empty_dir): Likewise. Also, always close directory handle.
9559 * src/ls.c (print_dir): Likewise.
9560 (print_dir): Rename local variable: reading -> dirp.
9561 Reported by Mike Coleman.
9563 2002-08-28 Jim Meyering <jim@meyering.net>
9565 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9566 Give a diagnostic and fail if closedir fails.
9568 2002-08-26 Jim Meyering <jim@meyering.net>
9570 * Makefile.am (THANKS-to-translators): New rule.
9571 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9572 * THANKStt.in: New file.
9574 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9576 (main): Register it with atexit.
9577 Close STDOUT_FILENO, to avoid a problem when writing to
9578 /dev/audio on at least Solaris 5.7 and 5.8 systems.
9579 Reported by Shing-Shong Shei.
9581 2002-08-25 Jim Meyering <jim@meyering.net>
9583 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9584 * src/tac.c (main): Likewise.
9585 * src/tail.c (main): Likewise.
9586 * src/tee.c (main): Likewise.
9587 * src/tr.c (main): Likewise.
9588 * src/wc.c (main): Likewise.
9590 2002-08-20 Jim Meyering <jim@meyering.net>
9592 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9594 2002-08-10 Paul Eggert <eggert@twinsun.com>
9596 * src/nohup.sh: Don't use "exec --"; it's not portable and
9597 shouldn't be needed.
9599 2002-08-09 Jim Meyering <jim@meyering.net>
9601 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9602 (usage): Clarify help text for the -COLUMN option.
9603 Patch by Padraig Brady.
9604 * tests/pr/Test.pm [col-last]: New test for the above.
9606 * configure.ac: Start with version 4.5.1, chosen so that it's larger
9607 than the latest version numbers of the component packages.
9609 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9612 2002-08-08 Jim Meyering <jim@meyering.net>
9614 * src/date.c: Guard inclusion of <langinfo.h> with
9615 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9616 * src/sort.c: Likewise.
9617 Patch by GOTO Masanori.
9619 2002-08-05 Paul Eggert <eggert@twinsun.com>
9621 Fix some minor time-related bugs with POSIX time arguments.
9622 Some valid time stamps were being rejected (notably -1, and
9623 time stamps before 1900 on 64-bit hosts). And some invalid
9624 time stamps were being accepted, e.g. September 31.
9626 * src/date.c (main): Adjust to posixtime signature change.
9627 * src/touch.c (main): Likewise. Remove unnecessary initialization.
9628 Use localtime, not posixtm, to warn about obsolete "touch".
9630 2002-08-05 Jim Meyering <jim@meyering.net>
9632 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9634 2002-08-04 Jim Meyering <jim@meyering.net>
9636 * src/Makefile.am (check-README): New target/rule.
9637 (check): Depend on it.
9639 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9641 2002-08-03 Jim Meyering <jim@meyering.net>
9643 * Makefile.am (SUBDIRS): Add old.
9644 * old/: New directory, containing legacy ChangeLog* and NEWS files
9645 from the fileutils, sh-utils, and textutils packages.
9647 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9649 2002-08-02 Paul Eggert <eggert@twinsun.com>
9651 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9653 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9654 (hard_LC_COLLATE): New var.
9655 (different): Args are now char *, not const char *.
9656 Use xmemcoll instead of memcmp to compare lines, so that
9657 LC_COLLATE has effect. However, use memcmp if it is an
9659 (check_file): Do not include newline in comparison, so that
9660 xmemcoll has a byte to stomp on temporarily.
9661 (main): Set hard_LC_COLLATE.
9663 2002-07-29 Jim Meyering <jim@meyering.net>
9665 * Makefile.am (SUBDIRS): Remove djgpp, for now.
9667 2002-07-20 Jim Meyering <jim@meyering.net>
9669 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9670 into EXIT_FAILURE. Otherwise, false --help and false --version
9673 2002-07-08 Jim Meyering <jim@meyering.net>
9675 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9676 rather than the hard-coded `sh-utils'.
9678 2002-07-01 Jim Meyering <jim@meyering.net>
9680 * configure.ac: Merge the three files from fileutils,
9681 textutils, and sh-utils.
9682 * Makefile.am: Likewise.
9683 * src/Makefile.am: Likewise.