1 2005-05-13 Jim Meyering <jim@meyering.net>
5 * NEWS: `rm -r' now removes all of the files it should, even on
6 systems with a buggy readdir affecting file systems inaccessible
9 In some unusual circumstances `rm -r' would fail to remove --
10 or even consider -- all entries in a directory with more than 254
11 (SunOS) or 338 (Darwin) entries. This could cause trouble even on
12 other types of systems when using an affected file system via e.g.,
13 NFS. The underlying cause was a bug in readdir on those systems.
14 Coreutils-5.2.1 and earlier used a configure-time test designed
15 to detect precisely those problem systems, but it would detect
16 the problem and enable remove.c's work-around code only when its
17 configure-time test was run on a losing file system. Obviously,
18 it couldn't detect a problem if the offending file system wasn't
19 tested or even mounted at coreutils configure time. Now, rm itself
20 performs a minimal-cost run-time test to detect the problem.
22 * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
23 (remove_cwd_entries): When readdir returns NULL for a directory from
24 which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
25 entries, call rewinddir and then resume the readdir/unlink loop.
26 (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
28 2005-05-12 Paul Eggert <eggert@cs.ucla.edu>
30 * NEWS: nohup now closes stdin if it is a terminal, unless
31 POSIXLY_CORRECT is set. This fixes a glitch noted by Wayne Pollock in
32 <https://www.opengroup.org/sophocles/show_mail.tpl?
33 source=L&listname=austin-group-l&id=8341>.
34 * doc/coreutils.texi (nohup invocation): Document this.
35 * src/nohup.c (main): Implement this.
37 2005-05-12 Jim Meyering <jim@meyering.net>
39 * src/date.c: Assume `free (NULL)' works.
42 * src/dircolors.c:Likewise.
43 * src/head.c: Likewise.
45 * src/md5sum.c: Likewise.
47 * src/sort.c: Likewise.
49 2005-05-10 Jim Meyering <jim@meyering.net>
51 * tests/touch/not-owner: Skip this test if the user running it
52 owns `/' or has write access to it.
54 * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
55 This makes `mv -i --reply=no f1 f2' work as expected (in not
56 performing the move operation). But note that specifying `-i'
57 after `--reply=no' does *not* work.
58 Tiny patch from Vlada Macek.
60 * tests/mv/reply-no: New file. Test for the above fix.
61 * tests/mv/Makefile.am (TESTS): Add reply-no.
63 * tests/ls-2/tests: Don't print PATH to stderr.
65 2005-05-08 Paul Eggert <eggert@cs.ucla.edu>
67 * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
70 2005-05-06 Paul Eggert <eggert@cs.ucla.edu>
72 * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
73 * src/dd.c (flags, usage): Add support for "binary" and "text".
75 2005-05-04 Paul Eggert <eggert@cs.ucla.edu>
77 * NEWS: chmod -w now complains if it differs from chmod a-w.
78 * src/chmod.c: Include quotearg.h.
79 (diagnose_surprises): New var.
80 (process_file): Diagnose surprises. Simplify the logic a bit,
82 (main): Prepare to diagnose surprises. Remove useless code for
84 * tests/chmod/Makefile.am (TESTS): Add umask-x.
85 * tests/chmod/umask-x: New file.
87 2005-05-02 Paul Eggert <eggert@cs.ucla.edu>
89 * NEWS: ls --indicator-style=directory renamed to ls
90 --indicator-style=slash, to avoid confusion with ls --directory.
91 * src/ls.c (usage): Likewise.
92 (slash): Renamed from directory_only. All uses changed.
94 2005-05-01 Paul Eggert <eggert@cs.ucla.edu>
96 * NEWS: "chmod +1 foo" is now diagnosed.
98 2005-04-29 Paul Eggert <eggert@cs.ucla.edu>
100 * NEWS: ls -p now marks only directories. New option
101 --indicator-style=directory equivalent to -p.
102 * doc/coreutils.texi (ls invocation): Document this.
103 Also, mention ">" is for doors.
104 * src/ls.c (enum indicator_style): New constant directory_only,
106 (indicator_style_args, indicator_style_types): Set it appropriately.
107 (decode_switches, gobble_file, print_type_indicator):
108 (length_of_file_name_and_frills):
109 Implement the change described in NEWS.
110 (decode_switches): Quote ">", too.
111 (usage): Update to match the new behavior. Describe ">".
112 * tests/ls/file-type: Test for new behavior. Omit -1 option.
113 The "ls --color" test wasn't being checked; add a check for
114 "ls --color=auto" instead.
116 * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
117 * tests/misc/split-fail: Likewise.
118 * tests/pr/Test.pm: Likewise.
119 * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
120 * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
121 if they use file names starting with +.
122 (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
123 * tests/uniq/Test.pm (tv, test_vector): Likewise.
125 The following was partly derived from a tiny change by Eric Blake:
126 * tests/misc/nice: Don't use 'set -'. It's not portable to strict
127 POSIX 1003.1-2001 hosts. Also, don't set _POSIX2_VERSION.
128 * tests/mkdir/perm: Don't use 'set -'. Simplify test construction.
129 Work even if the underyling system attaches ACLs to new dirs.
130 * tests/mv/part-hardlink: Don't use 'set -'.
131 * tests/stty/row-col-1: Don't use 'set -'.
133 2005-04-28 Paul Eggert <eggert@cs.ucla.edu>
135 * NEWS: Document fixes described below.
136 * src/chmod.c (change, umask_value): New static vars.
137 (reference_file): Move this static var to inside "main".
138 (process_file, process_files): Remove CHANGES arg; now taken from
139 static var. All uses changed.
140 (usage): Fix incorrect description of MODE operand.
141 (main): For invalid mode usages, output a brief usage message.
142 Adjust to new modechange API.
143 * install.c (main): Adjust to new modechange API.
144 Also, free the mode_change object when done.
145 * mkdir.c (main): Likewise.
146 * mkfifo.c (main): Likewise.
147 * mknod.c (main): Likewise.
148 * tests/chmod/equal-X: Check for =xX bug.
149 * tests/chmod/equals: Check for =u bug.
150 * tests/chmod/usage: Check for u+gr and ug,+x bugs.
152 2005-04-26 Paul Eggert <eggert@cs.ucla.edu>
154 Restore support for usages like "head -1" and "tail -1",
155 even when conforming to POSIX 1003.1-2001.
156 Fix bug with "POSIXLY_CORRECT=1 fold file -3".
157 join now supports a NUL field separator, e.g., "join -t '\0'".
158 join now detects and reports incompatible options, e.g.,
160 * NEWS: Document this.
161 * src/date.c: Remove posixver.h and its uses.
162 (COMMON_SHORT_OPTIONS): Remove.
163 (short_options): New constant.
164 (short_options, usage): -I now always takes an optional arg.
165 * src/expand.c: Remove posixver.h and its uses.
166 (shortopts): New constant. -DIGIT now always takes an optional arg.
167 (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
168 Don't complain about -DIGIT.
169 * src/fold.c: Remove posixver.h and its uses.
170 (shortopts): New constant. -DIGIT now always takes an optional arg.
171 (main): Don't preprocess arg list; that was buggy. Use method
173 * src/head.c: Remove posixver.h and its uses.
174 (header_mode_option): Remove.
175 (main): Don't complain about obsolete -NUM args.
176 * src/join.c: Remove posixver.h and its uses.
177 (obsolete_usage): Remove.
178 (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
179 they haven't been set yet.
180 (tab): Now int, not char. Initialize to -1 to indicate white space
181 separates columns, so that we can use NUL as a separator.
183 (OBSOLETE_LONG_OPTIONS, get_option): Remove.
184 (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
185 suffices. Use xstrtoul for sizes; it suffices.
186 (decode_field_spec): Report an error and exit on failure. Return void,
188 (add_field_list): Likewise.
189 (set_join_field): New function.
190 (enum operand_status): New enum.
191 (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
192 PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
193 possibilities with obsolete option parsing.
194 (main): Use it. Do not depend on POSIX version.
195 Check for conflicting options. Parse obsolete options -j1 and -j2
196 so that it is a pure extension to POSIX 1003.1-2001.
197 Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
198 * src/nice.c: Remove posixver.h and its uses.
199 (main): Always support -NUM option.
200 * src/od.c: Remove posixver.h and its uses.
201 (short_options): New constant, which always supports -w[num].
202 (COMMON_SHORT_OPTIONS): Remove.
203 * src/pr.c: Remove posixver.h and its uses.
204 (short_options): New constant, which always supports -S[string].
205 (COMMON_SHORT_OPTIONS): Remove.
206 * src/sort.c: Remove posixver.h and its uses.
207 (short_options): New constant, which always supports -y arg.
208 (COMMON_SHORT_OPTIONS): Remove.
209 (main): Redo workaround for Solaris compatibility with -y.
210 This change isn't visible to the user; it just cleans up the
211 code so that we don't need posixver.h.
212 * src/split.c: Remove posixver.h and its uses.
213 (main): Don't complain about -NUM option.
214 * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
215 * src/unexpand.c: Remove posixver.h and its uses.
216 (main): Don't complain about -TAB.
217 * src/uniq.c (main): Don't complain about -NUM.
219 2005-04-22 Paul Eggert <eggert@cs.ucla.edu>
221 * src/nohup.c (main): If getopt fails, exit with status 127,
222 not status 1. POSIX requires this.
223 * NEWS: Document this.
225 * src/nice.c (main): Report proper program name when getopt finds
226 trouble. Problem reported by Behdad Esfahbod.
228 * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
229 when the "+x" was being evaluated.
230 * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
231 * mkfifo.c (main): Likewise.
232 * mknod.c (main): Likewise.
233 * tests/mkdir/perm: Test for the above bug.
235 2005-04-20 Paul Eggert <eggert@cs.ucla.edu>
237 Port test cases to Microsoft-Windows-related environments,
238 following suggestions from Eric Blake.
239 * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
240 * tests/install/basic-1: Undo previous change.
241 (dd, dd2): New vars, which use $EXEEXT. All uses of dd and dd2 changed.
242 * tests/install/trap: Undo previous change.
243 (sig): New var. Use it insted of "trap '' CHLD".
244 Append $EXEEXT to executable name.
246 "fetish" -> "coreutils" in more places.
247 * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
248 (package Coreutils): Renamed from package Fetish. All uses changed.
249 * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
252 2005-04-19 Paul Eggert <eggert@cs.ucla.edu>
254 * tests/mv/setup (dot_mount_point): Use stat -L, in case the
255 directory is actually a symbolic link. Problem reported by
258 * tests/mv/mv-special-1: Use test -p to test for fifos, rather
259 than the (incorrect) test -f and the (inadequate) ls. ls is
260 inadequate because on some hosts a buggy mv will create a file of
261 the wrong type (problem reported by Eric Blake). Skip this test
262 if test -p doesn't work.
264 * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
265 since the latter can have shell metacharacters in them (e.g., spaces).
266 This follows up to the 2005-01-17 patch, which missed this occurrence.
268 2005-04-18 Paul Eggert <eggert@cs.ucla.edu>
270 "fetish" -> "coreutils" in several places.
271 * Makefile.cfg (ftp): Remove fetish.sf.net.
272 * Makefile.maint (emit_upload_commands): Likewise.
273 * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
274 * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
275 * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
277 * tests/install/basic-1: Use "cat", not "test", to test for
278 ../../src/dd. Problem reported by Eric Blake.
280 2005-04-18 Jim Meyering <jim@meyering.net>
282 * src/dd.c: Don't include stat-macros.h directly. system.h does that.
284 2005-04-17 Paul Eggert <eggert@cs.ucla.edu>
286 Work around a couple of "make check" failures reported for Cygwin
287 and ash by Eric Blake.
288 * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
289 * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
291 2005-04-16 Jim Meyering <jim@meyering.net>
293 * src/dd.c (S_TYPEISSHM): Remove definition.
294 Get the definition by including "stat-macros.h", instead.
296 2005-04-14 Paul Eggert <eggert@cs.ucla.edu>
298 Fix test suite problems reported by Eric Blake on Cygwin.
299 * tests/mv/mv-special-1: Ignore chatter about when files are removed,
300 since POSIX doesn't require rename to fail across file systems.
301 * tests/mv/setup (dot_mount_point): Use stat rather than df, as
303 (other_partition_tmpdir): Remove df from name as that would be
306 2005-04-14 Jim Meyering <jim@meyering.net>
308 * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
310 2005-04-12 Paul Eggert <eggert@cs.ucla.edu>
312 * src/ls.c (usage): "uid" -> "user ID".
314 2005-04-12 Jim Meyering <jim@meyering.net>
316 * src/tsort.c (tsort): Use "%s" as the format string,
317 rather than a diagnostic or a file name.
319 * src/comm.c (compare_files): Remove declaration of unused local.
321 * src/chown-core.c (chopt_free): Mark parameter as unused.
323 2005-04-11 Paul Eggert <eggert@cs.ucla.edu>
325 * man/chown.x: Reword to match user manual.
326 * man/id.x: Likewise.
327 * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
329 * src/whoami.c (usage, main): Likewise.
331 Add bulletproofing for cases where stdin, stdout, or stderr are closed.
332 * src/comm.c: Include stdio-safer.h.
333 (compare_files): Exit right away on I/O error rather than continuing
334 and producing confusing output and error messages.
335 Return void, not int; all callers changed.
336 Use fopen_safer to avoid confusion with file descriptors.
337 * src/copy.c: Include unistd-safer.h.
338 (copy_reg): Use fd_safer.
339 * src/csplit.c: Include stdio-safer.h.
340 (input_desc): Remove unnecessary static initialization.
341 (set_input_file): Use STDIN_FILENO, not 0.
342 (create_output_file): Use fopen_safer.
343 * src/dircolors.c (dc_parse_file): Don't assume fopen does not
345 * src/head.c (head_file): Don't assume open does not return 0.
346 * src/join.c: Include stdio-safer.h.
347 (main): Use fopen_safer. Simplify the resulting code.
348 * src/md5sum.c (digest_file, digest_check):
349 Don't assume that fopen does not return stdin.
350 * src/nohup.c: Include unistd-safer.h.
351 (main): Don't dup stderr to stdin or stdout by mistake.
352 * src/od.c (check_and_close): Don't assume fopen does not return stdin.
353 * src/paste.c (paste_serial): Likewise.
354 * src/pr.c: Include stdio-safer.h.
355 (open_file): Use fopen_safer.
356 (close_file): Don't assume fopen does not return stdin.
357 * src/ptx.c (main): Don't assume fopen returns stdout after closing
358 stdout. Use freopen instead.
359 * src/shred.c: Include unistd-safer.h.
360 (wipename): Use fd_safer on directory file descriptor.
361 (wipefile): Remove special case for /dev/fd/* on older hosts.
362 It didn't work in general, and wasn't documented.
364 * src/sort.c: Include unistd-safer.h.
365 (create_temp_file): Use fd_safer.
366 (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
367 * src/split.c: Include unistd-safer.h.
368 (cwrite): Use fd_safer. Replace mystery constant 0666 with symbolic
369 version, as POSIX requires.
370 * src/sum.c (bsd_sum_file, sysv_sym_file):
371 Use same pattern as elsewhere for checking for stdin.
372 * src/tac.c: Include unistd-safer.h.
373 (copy_to_temp): Use fd_safer.
374 (tac_file): Don't assume fopen cannot return stdin.
375 * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
376 (recheck, tail_file): Use fd_safer rather than open_safer.
377 * src/tee.c: Include stdio-safer.h.
378 (tee): Use fopen_safer.
379 * src/touch.c: Include unistd-safer.h.
380 (touch): Use fd_safer.
381 * src/tsort.c (have_read_stdin): Remove; no longer needed. All uses
383 (tsort): Do not assume fopen can't return stdin.
384 Close stdin before returning. All uses changed.
385 * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
386 * src/uniq.c: Include stdio_safer.h.
387 (check_file): Don't assume fopen cannot return stdin or stdout.
389 2005-04-09 Jim Meyering <jim@meyering.net>
391 * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
393 Now that close_stdout closes standard output unconditionally,
394 these workarounds for dd and cat are no longer necessary.
395 * src/dd.c (close_stdout_wrapper): Remove function.
396 (main): Call atexit with close_stdout, instead.
397 * src/cat.c (close_stdout_wrapper): Likewise.
398 Don't close STDOUT_FILENO explicitly; close_stdout does it.
400 * src/system.h (__attribute__): Readability nit:
402 # define __attribute__(x)
404 # define __attribute__(x) /* empty */
406 2005-04-09 Jim Meyering <jim@meyering.net>
408 * src/rm.c (usage): Mention that --recursive removes listed
409 directories too, not just their contents.
410 Say that by default, rm does not remove directories.
412 * src/pr.c: Don't include "timespec.h". system.h does that.
413 * Makefile.maint (sc_system_h_headers): Propagate exit status
416 2005-04-08 Paul Eggert <eggert@cs.ucla.edu>
418 * NEWS: Document that dd no longer treats QUIT or PIPE specially,
419 and when conforming to POSIX no longer treats USR1 specially.
420 Document that dd no longer dumps core when handling signals.
421 * src/system.h (RETSIGTYPE): Remove; no longer needed. All uses
423 * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
425 (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
426 (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
427 behavior when called from a signal handler. All uses changed.
428 (main) [!defined SA_NOCLDSTOP]:
429 Use siginterrupt to specify that system calls should be interrupted.
430 * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
431 (process_signals): Add forward decl.
432 (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
434 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
435 (SA_NODEFER) [!defined SA_NODEFER]: New macro.
436 (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
437 (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
439 (usage): Mention -USR1 versus -INFO.
440 (cleanup): Don't invoke print_stats; the caller must do it now.
442 (quit): Process signals just before exiting.
443 (interrupt_handler): Simply record the signal and return.
444 (siginfo_handler): Simply increment the signal counter and return.
445 (install_handler): Remove, replacing with:
446 (install_signal_handlers, process_signals, iread, iwrite):
447 New functions. All callers to safe_read and full_write replaced
448 by iread and iwrite. All callers to install_handler replaced by
450 * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
452 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
453 (main) [! SA_NOCLDSTOP]: Use it.
454 * src/shred.c: Remove all uses of signals; modern hosts have
455 /dev/random and don't need this gorp.
456 Do not include signal.h.
457 (env, sigill_handler, isaac_seed_machdep): Remove. All uses removed.
458 * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
460 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
461 (main) [! SA_NOCLDSTOP]: Use it.
463 * src/dd.c: Do not include inttostr.h, no longer needed.
464 (print_stats, main): Rewrite and simplify formats to use PRIuMAX
465 instead of umaxtostr.
466 (print_stats): Work even in languages that have special
467 forms for two of things, for r_truncate and w_bytes. We can't
468 fix delta_s in this way, since ngettext doesn't support floating-point.
469 (main): Rewrite to avoid casts.
471 2005-04-07 Jim Meyering <jim@meyering.net>
473 Placate gcc-4's -Wuninitialized.
474 * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
475 * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
477 * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
479 (binop): Move function definition to precede first use so we can...
480 (binop): ...remove prototype.
482 2005-04-05 Paul Eggert <eggert@cs.ucla.edu>
484 * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
485 * src/basename.c (usage): Add examples.
486 * src/cat.c (usage): Likewise.
487 * src/chgrp.c (usage): Likewise.
488 * src/chown.c (usage): Likewise.
489 * src/dirname.c (usage): Likewise.
491 2005-04-05 Jim Meyering <jim@meyering.net>
493 * src/nice.c (usage): Mention that some shells provide a
494 built-in function by the same name.
495 * src/nohup.c (usage): Likewise.
496 * src/printenv.c (usage):Likewise.
498 2005-04-04 Dmitry V. Levin <ldv@altlinux.org>
500 * src/tee.c (tee): When closing files, do not close stdout,
501 leave this job to close_stdout() instead.
502 * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
503 * tests/Makefile.am (SUBDIRS): Add tee.
504 * tests/tee/Makefile.am: New file.
505 * tests/tee/.cvsignore: Likewise.
506 * tests/tee/{basic,dash}: New tee tests.
508 2005-04-04 Jim Meyering <jim@meyering.net>
510 * src/echo.c (usage): Mention that some shells provide a
511 built-in function by the same name.
512 * src/kill.c (usage): Likewise
513 * src/printf.c (usage): Likewise.
514 * src/pwd.c (usage): Likewise.
515 * src/stat.c (usage): Likewise.
516 * src/test.c (usage): Likewise.
517 * src/true.c (usage):
518 * src/system.h (USAGE_BUILTIN_WARNING): New macro.
520 * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
521 * man/printf.x: Likewise.
522 * man/pwd.x: Likewise.
524 2005-04-03 Jim Meyering <jim@meyering.net>
526 * src/pr.c (main): Fix off-by-one error.
527 pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
528 end of a malloc'd buffer.
530 2005-04-01 Jim Meyering <jim@meyering.net>
532 * src/pr.c (main): Free column_count_string when done with it.
534 Don't let pr treat +1:-1 like +1:18446744073709551615.
535 * src/pr.c (strtoumax): Remove declaration.
536 (first_last_page): Use xstrtoumax in place of strtoumax,
537 so we don't interpret a negative page number (e.g., in an option
538 like --pages=1:-1) as valid.
539 * tests/pr/Test.pm (neg-page): Add a test for this.
541 2005-03-30 Paul Eggert <eggert@cs.ucla.edu>
543 * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
544 * src/uptime.c (uptime): New arg OPTIONS. All uses changed.
545 * src/users.c (users): Likewise.
546 * src/who.c (who): Likewise.
547 * src/uptime.c (main): Check PIDs when invoked with zero arguments.
548 * src/users.c (main): Likewise.
549 * src/who.c (main): Likewise. Also with two arguments.
550 Omit duplicate code in 2-arg case.
551 (UT_PID): Moved to ../lib/readutmp.h.
553 2005-03-29 Jim Meyering <jim@meyering.net>
555 * src/system.h (ptr_align): Declare `ptr' parameter to be a
556 `const' pointer, since this function never writes through it.
558 * src/uname.c: Indent cpp directives to reflect nesting.
560 2005-03-28 Jim Meyering <jim@meyering.net>
562 * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
563 Add `void' to make this an ANSI-style function declaration.
564 * src/remove.c (ds_init): Likewise.
565 * src/pr.c (print_sep_string): Likewise.
567 * src/stty.c (speeds): Declare this array to be static.
568 * src/Makefile.am (sc_tight_scope): Adjust to catch any
569 new declarations like that of stty.c's `speeds'.
571 * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
572 (GETOPT_VERSION_OPTION_DECL): Likewise.
573 * src/chown.c (long_options): Likewise.
574 * src/chgrp.c (long_options): Likewise.
575 * src/chmod.c (long_options): Likewise.
576 * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
578 * src/chown-core.c (chopt_init): Likewise.
579 * src/comm.c (long_options): Likewise.
580 * src/copy.c (copy_reg): Likewise.
581 * src/csplit.c (extract_regexp): Likewise.
582 * src/cut.c (longopts): Likewise.
583 * src/date.c (time_spec_string): Likewise.
584 * src/df.c (find_mount_point, show_point): Likewise.
585 * src/expr.c (docolon): Likewise.
586 * src/fmt.c (long_options): Likewise.
587 * src/ls.c (time_style_args, indicator_style_args, long_options)
588 (format_args, sort_args, time_args, decode_switches)
589 (gobble_file): Likewise.
590 * src/md5sum.c (long_options): Likewise.
591 * src/mv.c (reply_args): Likewise.
592 * src/paste.c (longopts): Likewise.
593 * src/pinky.c (print_entry): Likewise.
594 * src/pr.c (long_options): Likewise.
595 * src/ptx.c (long_options, format_args): Likewise.
596 * src/readlink.c (longopts): Likewise.
597 * src/sort.c (long_options, mergefps): Likewise.
598 * src/stat.c (long_options): Likewise.
599 * src/tac.c (main): Likewise.
600 * src/tail.c (follow_mode_string): Likewise.
601 * src/touch.c (longopts, time_args): Likewise.
602 * src/uniq.c (delimit_method_string): Likewise.
603 * src/uptime.c (print_uptime): Likewise.
604 * src/who.c (print_user): Likewise.
606 2005-03-27 Jim Meyering <jim@meyering.net>
608 * src/dcgen: Simplify further, clean up.
609 Add a standard-output-closing global destructor.
611 * src/wheel-gen.pl: Use the same global destructor as dcgen.
613 2005-03-26 Paul Eggert <eggert@cs.ucla.edu>
615 * src/dcgen: Squeeze multiple blanks into one. Output a simple
616 array of adjacent strings rather than a more complicated data
617 structure; this saves space in the dircolors executable.
618 * src/dircolors.c (parse_line): Use char *, not unsigned char *.
620 (dc_parse_stream, main): Avoid casts.
621 Adjust to simpler data structure generated by new dcgen.
623 2005-03-25 Eric Blake <ebb9@byu.net> (tiny change)
625 * src/ls.c (usage): Document usage of LS_COLORS.
627 2005-03-25 Paul Eggert <eggert@cs.ucla.edu>
629 * src/dircolors.hin: Add "TERM cygwin".
631 2005-03-25 Jim Meyering <jim@meyering.net>
633 * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
634 the return value, and update callers:
635 * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
636 * src/expand.c (parse_tab_stops, main): Likewise.
637 * src/split.c (main): Likewise.
638 * src/unexpand.c (parse_tab_stops, main): Likewise.
639 * src/uniq.c (main): Likewise.
641 2005-03-22 Jim Meyering <jim@meyering.net>
643 * build-aux: New directory. Renamed from config.
644 * configure.ac: Reflect renaming: config -> build-aux.
645 * Makefile.am (dist-hook): Likewise.
646 * Makefile.maint: Likewise.
647 * Makefile.cfg (cvs_files): Likewise.
648 * .x-sc_sun_os_names: Likewise.
649 * .x-sc_trailing_blank: Likewise.
651 * src/ls.c (get_funky_string): Use '\a', rather than 7, for
652 portability to EBCDIC hosts.
654 2005-03-20 Jim Meyering <jim@meyering.net>
656 * src/pr.c (init_header): Add missing `%' in new format string.
657 (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
659 2005-03-19 Jim Meyering <jim@meyering.net>
661 * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
662 $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
664 2005-03-18 Paul Eggert <eggert@cs.ucla.edu>
666 * NEWS: pr -D "FORMAT" now accepts the same formats that
668 * src/pr.c: Include strftime.h, timespec.h.
669 (init_header): Obtain and format nanosecond part of time stamp.
671 * NEWS: nohup now ignores the umask when creating nohup.out.
672 nohup now closes stderr if it is a terminal and stdout is closed.
673 * src/nohup.c (main): Likewise. Be a little more paranoid about
674 return values; e.g., check for any negative return from open.
675 Assume free (NULL) works.
676 Close file descriptor leak when redirecting standard output to a file.
678 2005-03-17 Jim Meyering <jim@meyering.net>
680 * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
681 in place of functionally-equivalent code.
682 * src/expand.c (parse_tab_stops, main): Likewise.
683 * src/split.c (main): Likewise.
684 * src/unexpand.c (parse_tab_stops, main): Likewise.
685 * src/uniq.c (main): Likewise.
686 * src/od.c: Use VERIFY macro in place of an equivalent open-coded
688 * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
691 Before, this command would make uniq skip 11 fields and print
693 $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
696 * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
697 not like `uniq -f11'.
699 2005-03-15 Jim Meyering <jim@meyering.net>
701 Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
702 `pr -0' should give a better diagnostic and `pr -03' should be
703 equivalent to `pr -3'.
704 * src/pr.c (parse_column_count): Change return type to void.
705 Call error (EXIT_FAILURE, ... for an invalid string.
706 (main): Allocate space for column_count_string using malloc.
707 Accumulate all old-style column-count digits before converting.
708 When the number of columns is specified via both old-style,
709 (e.g., -3), and a long option (--columns=5), ensure that only
710 the last one specified takes effect.
711 * tests/pr/Test.pm: Add tests for the above.
713 2005-03-15 Corinna Vinschen <corinna@vinschen.de> (tiny change)
715 * src/copy.c (copy_reg): Copy regular files in binary mode.
717 2005-03-14 Paul Eggert <eggert@cs.ucla.edu>
719 * NEWS: Restate why ls limits time stamp lengths.
721 2005-03-12 Jim Meyering <jim@meyering.net>
723 Add a little infrastructure to help prevent future bugs like the
725 * src/stat.c (xstrcat): New function.
726 (print_statfs, print_stat): Add buf_len parameter and convert all
727 uses of strcat to xstrcat. Update callers.
728 (print_it): Call print_func with buf_len parameter.
730 Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
731 could cause a buffer overrun error.
732 * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
733 conversion of the stat %s format string to the longer printf %llu one.
734 Patch from Guochun Shi.
736 2005-03-11 Paul Eggert <eggert@cs.ucla.edu>
738 * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
739 (long_time_expected_width, print_long_format): Use it, to avoid
740 some possible denial-of-service attacks.
741 * NEWS: Document this.
743 2005-03-11 Jim Meyering <jim@meyering.net>
745 Prompt once again for `mv -i A B' when A and B are hard links
746 to the same file. This fixes a bug introduced by my 2003-04-04
747 (coreutils-5.0.1) change. Reported by Thomas Wolff via Eric Blake.
748 * src/copy.c (abandon_move): New function, factored out of
749 copy_internal, now that this code is being used from two places.
750 (copy_internal): Perform the same interactive-related test for
751 whether it's alright to proceed and (usually) overwrite the
753 * tests/mv/i-4: Add tests for the above.
755 Don't segfault for a very long date format string, e.g.,
756 ls -ld --time-style=+%99999999H .
757 * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
758 so format string abuse cannot provoke stack overflow.
759 (print_long_format): Likewise.
761 Don't segfault for a long header date string, e.g.,
762 echo a|pr -D +%9999999A
763 * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
764 Don't bother with fixed-sized initial buffer; always use x*alloc.
766 * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
767 in place of equivalent INT_STRLEN_BOUND + 1.
768 * src/expr.c (tostring, printv): Likewise.
770 2005-03-09 Paul Eggert <eggert@cs.ucla.edu>
772 * src/system.h: Include intprops.h.
773 (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
774 they are now defined in intprops.h.
776 2005-03-09 Jim Meyering <jim@meyering.net>
778 * TODO: Remove entry about named pipes. It was fixed in 5.3.0.
780 2005-03-08 Paul Eggert <eggert@cs.ucla.edu>
782 * src/date.c (usage): Redo to match recent documentation changes.
783 Don't bother documenting which usages are GNU extensions; the list
784 wasn't correct, and is better left to the printed manual anyway.
786 2005-03-06 Jim Meyering <jim@meyering.net>
788 Factor out column-count processing.
789 * src/pr.c: Include "inttostr.h".
790 (parse_column_count): New function.
791 (main): Use the new function for both old-style, -9, and long,
792 --columns=-9, options.
794 * src/cksum.c: Remove `register' keyword.
795 * src/cut.c: Likewise.
796 * src/dd.c: Likewise.
797 * src/env.c: Likewise.
798 * src/factor.c: Likewise.
799 * src/fmt.c: Likewise.
800 * src/fold.c: Likewise.
801 * src/id.c: Likewise.
802 * src/logname.c: Likewise.
803 * src/ls.c: Likewise.
804 * src/pr.c: Likewise.
805 * src/printf.c: Likewise.
806 * src/shred.c: Likewise.
807 * src/sort.c: Likewise.
808 * src/sum.c: Likewise.
809 * src/test.c: Likewise.
810 * src/tsort.c: Likewise.
811 * src/uniq.c: Likewise.
812 * src/wc.c: Likewise.
813 * src/whoami.c: Likewise.
815 2005-03-01 Paul Eggert <eggert@cs.ucla.edu>
817 * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
820 2005-03-01 Jim Meyering <jim@meyering.net>
822 * src/copy.c (copy_internal): Change test of source type from
823 !S_ISREG to S_ISLNK. Reported by Paul Eggert in
824 http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
826 2005-02-28 Jim Meyering <jim@meyering.net>
828 * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
830 2005-02-21 Paul Eggert <eggert@cs.ucla.edu>
832 * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
833 (nanosec_libs): Add $(LIB_XNANOSLEEP). Needed for newer GNU/Linux
834 hosts with clock_gettime.
836 2005-02-20 Paul Eggert <eggert@cs.ucla.edu>
838 * NEWS: Describe user-visible change to dd.
839 * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
840 Remove $(LIB_CLOCK_GETTIME). These functions now use
842 * src/dd.c: Include gethrxtime.h, xtime.h.
843 (start_time): Now of type xtime_t, not struct timespec.
844 (print_stats, main): Use gethrxtime rather than gettime.
845 * src/ls.c (time): Remove obsolete decl.
846 (get_current_time): gettimeofday always returns 0, so don't
848 * src/shred.c: Include gethrxtime.h.
849 (isaac_seed): Use gethrxtime rather than a mishmash.
850 * src/touch.c (time): Remove obsolete decl.
852 * tests/misc/split-fail: Don't assume that the current host
853 supports integers wider than 32 bits. Fix comment typo.
854 * tests/od/x8: Likewise.
856 * src/chown-core.c (enum RCH_status): Remove trailing comma,
857 as it's not valid in standard C89.
859 2005-02-15 Jim Meyering <jim@meyering.net>
861 * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
862 so that file systems of type `xfs' are recognized as such.
863 * src/fs.h: Regenerate.
864 Reported by Bernd Eckenfels.
865 * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
866 * src/fs.h: Regenerate.
867 Reported by Andreas Schwab.
869 * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
870 to work around the invalid definition from Darwin 7.7.0.
871 Test failure reported by Sébastien Maret.
873 2005-02-14 Paul Eggert <eggert@cs.ucla.edu>
875 * src/sort.c (mergefps): Use binary search rather than linear one
876 when comparing new line to lines already in main memory.
877 Idea suggested by James Lemley.
879 2005-02-09 Jim Meyering <jim@meyering.net>
881 * src/copy.c (valid_options): Add an assertion that
882 not both hard_link and symbolic_link are set.
884 2005-02-08 Paul Eggert <eggert@cs.ucla.edu>
886 * NEWS: Document stat -f -c %S, plus changes to default formats.
887 * doc/coreutils.texi (stat invocation): Normalize terminology,
888 capitalization, and sort order to match --help output. Mention %c
889 for file systems. Add new -f -c format %S, and document %s versus %S;
890 problem reported by Jeroen van Wolffelaar.
891 * src/stat.c (usage): Likewise.
892 (STATFS_FRSIZE): New macro.
893 (print_statfs): Use it, for stat -f -c %S.
894 (do_statfs): Change default formats to output %S.
896 2005-02-03 Paul Eggert <eggert@cs.ucla.edu>
898 * src/system.h: Include "memrchr.h".
899 (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
901 2005-02-02 Jim Meyering <jim@meyering.net>
903 * tests/du/8gb: Also adjust the test (s/64/128/) to detect
904 systems that don't support sparse files.
905 Check for $2 -ge 128, rather than $2 = 128, in case
906 there is a file system type that doesn't support sparse files,
907 yet for which metadata takes up additional space.
908 Both reported by Andreas Schwab.
910 2005-02-01 Eric Blake <ebb9@byu.net> (tiny change)
912 * tests/du/8gb: Create a larger test file, so we properly
913 detect that sparse files can be created on NTFS under cygwin.
915 2005-01-30 Jim Meyering <jim@meyering.net>
917 * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
919 * src/stty.c: Remove unnecessary parentheses in all #if directives.
921 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
923 * .cvsignore: Ignore config.cache and config.status.lineno.
924 * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
925 instead of VSWTCH, for use with CSWTCH.
927 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
929 * tests/Makefile.am (.PHONY): Add check-root and root-hint.
930 * tests/rwx-to-mode: Ignore ACL designation.
931 * tests/setgid-check: Likewise.
932 * tests/chown/separator: Quote user and group names.
934 2005-01-24 Jim Meyering <jim@meyering.net>
936 * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
937 Suggestion from Johan Boule.
939 2005-01-17 Eric Blake <ebb9@byu.net> (tiny change)
941 * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
943 * man/Makefile.am (all_programs): Revert previous patch; updated
944 all_programs.list fixes this.
945 (.x.1): No need to add $(EXEEXT).
947 2005-01-03 Corinna Vinschen <corinna@vinschen.de> (tiny change)
949 * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
952 2005-01-22 Jim Meyering <jim@meyering.net>
954 * Makefile.maint (v_etc_file): The version string has moved to
955 version-etc-fsf.c, search that new file, not version-etc.c.
957 2005-01-17 Paul Eggert <eggert@cs.ucla.edu>
959 * tests/group-names: Use numeric group ids, not symbolic group names,
960 since the latter can have shell metacharacters in them (e.g., spaces).
961 Problem reported by Eric Blake.
962 * tests/chgrp/basic: Assume groups are numeric, not symbolic.
963 * tests/chgrp/deref: Likewise.
964 * tests/chgrp/posix-H: Likewise.
965 * tests/chgrp/recurse: Likewise.
967 2005-01-15 Jim Meyering <jim@meyering.net>
969 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
970 because just calling gethrtime evokes an `illegal instruction'
971 failure when compiled with Sun's c89 on Solaris 8 and 9.
972 Reported by Nelson Beebe.
974 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
975 twice with the same value of `t'.
976 Replace nested #if-#else blocks with #if-#elif-#elif chain.
978 2005-01-14 Jim Meyering <jim@meyering.net>
980 The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
981 * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
982 sockets, since that's what you get when reading from a command-line-
983 supplied pipe on Darwin 7.7.
984 (IS_PIPE_LIKE_FILE_TYPE): Define.
985 (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
986 Reported by Nelson Beebe.
987 This same change is also required on NetBSD/sparc-1.5.
988 Reported by Adrian Bunk.
990 * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
991 rather than suffering silently.
992 Before, expr would silently overflow and wrap around:
993 $ expr 9223372036854775808 = 0 # $(echo 2^63|bc)
995 Now it detects the problem and exits nonzero:
996 $ ./expr $(echo 2^63|bc) = 0
997 ./expr: 9223372036854775808: integer is too large
999 * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1000 failure, so that doesn't cause `make check' to stop. Nelson Beebe
1001 reported that this test would fail with the diagnostic,
1002 `cannot find name for group ID 10', on one of his systems.
1004 2005-01-13 Jim Meyering <jim@meyering.net>
1006 * src/test.c (is_int): Don't overflow when evaluating integer
1007 constants. Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1010 * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1011 names of temporary files that would clash on 8.3 file systems.
1012 * tests/mk-script (validate): Likewise.
1014 2005-01-12 Jim Meyering <jim@meyering.net>
1016 * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1018 * tests/tr/Test.pm (repeat-xC): Change test name from
1019 `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1020 Reported by Eric Blake.
1021 (repeat-000): Rename to `repeat-zeros' for the same reason.
1023 2005-01-11 Jim Meyering <jim@meyering.net>
1025 * configure.ac: Update version to 5.3.1.
1027 2005-01-11 Eric Blake <ebb9@byu.net>
1029 * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1030 * man/Makefile.am (all_programs): Account for $(EXEEXT).
1032 2005-01-11 Jim Meyering <jim@meyering.net>
1034 * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1035 with decreasing values.
1037 * src/expand.c (main): Likewise.
1038 * src/unexpand.c (main): Check for overflow in tabstop values
1039 specified via the obsolete form. E.g., now this command fails:
1040 _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1041 Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1042 * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1044 2005-01-10 Paul Eggert <eggert@cs.ucla.edu>
1046 Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1047 * NEWS: Document the changes.
1048 * doc/coreutils.texi (pathchk invocation): Likewise.
1049 * src/pathchk.c (PORTABILITY_OPTION): New constant.
1050 (longopts, usage, main, validate_file_name):
1051 Add support for new -P option.
1052 Reject empty file names (unless -p is not specified and the
1053 current system allows empty file names).
1054 Change --portability so that is now equivalent to -p -P.
1055 Don't test whether file name is too long, if it is known to exist.
1056 (no_leading_hyphen): New function.
1057 * tests/misc/pathchk1: Add tests for empty file names and
1060 2005-01-08 Jim Meyering <jim@meyering.net>
1064 `pr --columns=N' was not equivalent to `pr -N' when also using
1067 * src/pr.c (main): Set `explicit_columns' for --columns=N,
1068 not just for -N. This bug has existed since the introduction
1069 of the --columns=N option on 1998-08-15.
1070 * NEWS: Document this.
1071 * tests/pr/Test.pm (test_vector): For each -N test, automatically
1072 create a new test vector using --columns=N.
1074 2005-01-07 Paul Eggert <eggert@twinsun.com>
1076 * src/pr.c (main): Check for column count overflow with
1077 usages like "pr -2147483648".
1079 2005-01-07 Jim Meyering <jim@meyering.net>
1081 * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1083 2005-01-06 Jim Meyering <jim@meyering.net>
1085 * README: List the precise HP-UX version numbers that are affected.
1086 Suggestion from Bob Proulx.
1088 * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1089 predicate before `-name ChangeLog' to avoid a harmless warning
1092 2005-01-05 Jim Meyering <jim@meyering.net>
1094 * tests/help-version: Punt on the uptime test, since it fails when
1095 it can't get boot time, and I don't want that to stop `make check'.
1097 * src/du.c (process_file): Evaluate exclusion rules against
1098 the entire file name, not just the last component.
1099 Reported by Robert Lindgren.
1100 * tests/du/exclude: Test for this.
1101 * NEWS: Document this.
1103 Ensure that tests/Makefile.am's check-root actions stay up to date.
1104 * Makefile.maint (sc_root_tests): New rule.
1105 (syntax-check-rules): Add it to the list.
1107 2005-01-04 Jim Meyering <jim@meyering.net>
1109 * man/shred.x: Change one-line summary to reflect that shred does
1110 not remove files by default. Suggestion from Helen Faulkner in
1111 http://bugs.debian.org/288552
1113 * README: Request VERBOSE=yes output when reporting test failures.
1114 Other minor changes.
1116 * tests/Makefile.am (check-root): Update.
1118 2005-01-03 Paul Eggert <eggert@cs.ucla.edu>
1120 * src/system.h: Undo previous change; we now use Autoconf.
1122 2005-01-03 Jim Meyering <jim@meyering.net>
1124 * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1125 a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems. Setting
1126 either (or both) to zero would succeed, but subsequent `stty size'
1127 would say `no size information for this device' due to the ioctl
1128 failing with EINVAL.
1130 * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1131 not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1132 then fail at compile-time rather than let tools like od produce
1133 invalid results at run time.
1135 2004-12-21 Jim Meyering <jim@meyering.net>
1137 * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1138 not `xx01, xx02, ...'.
1139 Reported by Matt Kraai in http://bugs.debian.org/286605
1141 * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1144 2004-12-20 Paul Eggert <eggert@cs.ucla.edu>
1146 * src/split.c (usage): Mention default size. Suggested by Dan Jacobson.
1148 2004-12-19 Paul Eggert <eggert@cs.ucla.edu>
1150 * NEWS: Mention that one should eval "`dircolors`" rather than
1153 2004-12-17 Jim Meyering <jim@meyering.net>
1155 * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1156 so temporary directories aren't left behind upon e.g., interrupt.
1158 2004-12-16 Paul Eggert <eggert@cs.ucla.edu>
1160 * src/ls.c (print_dir): Use "%s: not listing already-listed
1161 directory", not "not listing already-listed directory: %s", to
1162 format already-listed directories, to be consistent with other
1163 diagnostics involving file names and colons.
1165 2004-12-15 Jim Meyering <jim@meyering.net>
1167 * src/Makefile.am (__LDADD): Define, so that building `[' on
1168 Solaris still uses the -lgen library that it requires in order
1169 to get a definition of eaccess.
1171 2004-12-14 Jim Meyering <jim@meyering.net>
1173 tac would exit immediately upon I/O or temp-file creation failure.
1174 Now it continues on, processing any remaining command line arguments.
1176 * src/tac.c: Include quotearg.h.
1177 Use quotearg_colon in most diagnostics.
1178 (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1179 failure. Before, this command (with /full/tmp being a full partition)
1180 TMPDIR=/full/tmp ./tac /proc/modules tac.c
1181 would exit immediately upon the write error while trying to copy
1182 non-seekable /proc/modules to the full partition. Now it still
1183 reports the failure but continues on with the remaining file.
1184 (tac_nonseekable): Return false also if copy_to_temp fails.
1185 [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1186 using atexit like this is wrong.
1187 * NEWS: Document this.
1188 * tests/misc/tac-continue: New test for this.
1189 * tests/misc/Makefile.am (TESTS): Add tac-continue.
1191 * tests/chown/basic: Add a few more tests.
1193 2004-12-13 Paul Eggert <eggert@cs.ucla.edu>
1195 * src/ls.c (gobble_file): Change arg name to be command_line_arg
1196 rather than explicit_arg, for consistency with copy.c.
1197 (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1198 it is deducible from dirname arg. All callers changed.
1199 (extract_dirs_from_files, print_dir, queue_directory):
1200 Add command_line_arg arg. All callers changed.
1201 (struct pending): Add command_line_arg member.
1202 (main): Use NULL rather than 0 when appropriate.
1203 (set_exit_status, file_failure): New functions.
1204 (queue_directory): Store command_line_arg into new structure.
1205 (print_dir, gobble_file, get_link_name):
1206 Use file_failure to report problems in accessing files,
1207 so that the exit status is set consistently.
1208 (print_dir): Simplify readdir failure code yet again.
1209 If closedir fails, report "closing directory" rather than "reading
1211 (xstrcoll): Use set_exit_status to set status on failure.
1212 * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1215 2004-12-11 Jim Meyering <jim@meyering.net>
1217 Avoid a race condition vulnerability in chown, when used with
1218 --from=O:G and without the (-h) --no-dereference option.
1219 * src/chown-core.c (restricted_chown): New function.
1220 (change_file_owner): Call it.
1221 Reported by Ulrich Drepper.
1222 * NEWS: Mention this.
1224 2004-12-09 Paul Eggert <eggert@cs.ucla.edu>
1226 * ls now exits with status 1 on minor problems, 2 if serious trouble.
1227 * NEWS: Document this.
1228 * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1229 All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1231 (main): Initialize exit failure to LS_FAILURE.
1232 (print_dir, gobble_file, get_link_name, xstrcoll):
1233 Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1234 (print_dir): Do not give up on entire directory merely because readdir
1236 (usage): Explain exit status.
1237 * tests/help-version: ls and variants now exit with status 2
1240 2004-12-08 Paul Eggert <eggert@cs.ucla.edu>
1242 * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1245 2004-12-07 Paul Eggert <eggert@cs.ucla.edu>
1247 * src/factor.c (factor): Don't list 1 as a factor of 1.
1248 Problem reported by Thomas Folz-Donahue.
1250 2004-12-06 Jim Meyering <jim@meyering.net>
1252 * tests/du/files0-from: Sanitize environment.
1253 Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1254 setting is the default (exported from /etc/profile) on at least one
1256 * tests/du/no-deref: Likewise.
1257 * tests/cp/symlink-slash: Likewise.
1258 * tests/ls/symlink-slash: Likewise
1260 2004-12-05 Jim Meyering <jim@meyering.net>
1262 * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1263 _POSIX2_VERSION=199209 is in the environment, or when building on
1266 2004-12-04 Jim Meyering <jim@meyering.net>
1268 * NEWS: Mention cut's new --complement option.
1270 2004-10-01 Paolo Bonzini <bonzini@gnu.org>
1272 * cut.c (complement, COMPLEMENT_OPTION): New.
1273 (longopts): Add --complement.
1274 (usage): Say not that -b, -c, and -f `print' fields,
1275 but rather that they `select' fields for printing.
1276 Describe the new --complement option.
1277 (mark_range_start): Extracted from set_fields.
1278 (print_kth): Support --complement.
1279 (compare_ranges): New function.
1280 (set_fields): Rewrite the part that populates range_start_ht,
1281 merging it with the part that populates printable_field.
1282 (main): Handle --complement.
1284 2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
1286 * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1287 failed. This works around an assertion failure reported by
1289 http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1291 2004-12-02 Jim Meyering <jim@meyering.net>
1293 With using --color and with LS_COLORS saying not to color
1294 executables, don't stat every file.
1295 * src/ls.c (is_colored): New function.
1296 (gobble_file): Use it.
1297 (main): Use it here, in place of too-strict tests against NULL:
1298 if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1299 old test would fail.
1301 2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
1303 * src/comm.c (compare_files): Assume setlocale exists.
1304 * src/join.c (keycmp): Likewise.
1305 * src/seq.c (decimal_point): Treat like sort. Now char.
1307 (main): Assume localeconv exists. Use same code as sort.
1308 * src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
1309 Assume setlocale exists.
1310 (thousands_sep): Renamed from th_sep.
1311 (IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
1312 (NONZERO): Parenthesize use of arg.
1313 (numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
1314 consistency. Avoid unnecessary negation by reversing
1316 (main): Rewrite localeconv call to match seq.c.
1317 * src/system.h: Assume locale.h exists.
1318 (HAVE_SETLOCALE): Remove.
1319 * src/uniq.c (different): Assume setlocale exists.
1321 * src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
1322 'volatile' on a local variable. Rewrite to avoid unnecessary
1323 double-assignment to 'func' in the usual case where strcoll does
1326 2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
1328 * src/pinky.c (gethostname): Remove decl.
1329 (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1330 * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1331 UT_TYPE_BOOT_TIME instead of by-hand code.
1332 * src/users.c (list_entries_users): Use IS_USER_PROCESS
1333 instead of by-hand code.
1334 * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1335 DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1336 (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1337 (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1338 UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1339 (gethostname): Remove decl.
1340 (list_entries_who, scan_entries): Use the new macros defined above,
1341 for consistency with pinky, uptime, and users.
1343 2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
1345 Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1346 HP's ANSI C compiler. Declaring int functions causes warnings on
1347 some modern systems and shouldn't be needed to compile on ancient
1349 * src/copy.h (stat, lstat, rename): Remove decls.
1350 * src/install.c (stat): Remove decl.
1351 * src/ln.c (link, symlink): Remove decls.
1353 2004-11-25 Jim Meyering <jim@meyering.net>
1355 * man/help2man: Import help2man-1.35.1.
1356 * man/Makefile.am (.x.1): Remove now-unnecessary use of
1357 locally-added --program-name=NAME option. Now, help2man gets
1358 the name from the [NAME] section (i.e. from our .x file).
1359 * man/install.x: Use `install', not `ginstall' in the one-line
1360 description. Reported by Brendan O'Dea.
1361 * man/sha1sum.x: Use `sha1sum', not `shasum'.
1363 2004-11-24 Jim Meyering <jim@meyering.net>
1365 Since the changes of 2004-05-22, the u.saved_cwd member at
1366 the bottom of the active-directory stack was no longer
1367 strictly necessary. This change removes that member and uses
1368 the newer cwd_state parameter for the final restore_cwd.
1370 * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1371 [dev_ino]: Rename from `a'.
1372 (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1373 bottom-of-stack cwd-state member.
1374 (AD_pop_and_chdir): No longer return boolean. Adjust caller.
1375 (AD_push_initial): Remove CWD parameter. Adjust caller.
1377 2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
1379 Minor performance improvements and cleanups for "touch".
1380 * src/touch.c (posix_date): Remove; not needed as a static var.
1382 (touch): Use new futimens function to operate more efficiently
1383 in some cases. Don't stat/fstat existing file when
1384 (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1385 old time stamps aren't needed in that case.
1386 (main): change_times is int, not bool. Simplify test for
1389 2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
1391 * src/install.c (usage): Avoid usage that runs afoul of Docbook
1392 translation. Problem reported by Eric S. Raymond.
1394 Restore dd's noctty flag, reverting the change of 2004-04-08.
1395 POSIX does not allow "dd" to use O_NOCTTY by default.
1396 * NEWS: Add noctty flag to dd.
1397 * doc/coreutils.texi (dd invocation): Likewise.
1398 * src/dd.c (flags, usage, main): Likewise.
1400 2004-11-19 Alfred M. Szmidt <ams@gnu.org>
1402 * src/ls.c (usage): Clarified description of --no-group (-G),
1403 --human-readable (-h), --inode (-i), --size (-s), --time,
1406 2004-11-19 Jim Meyering <jim@meyering.net>
1408 * src/ls.c (usage): Clarify description of --author.
1409 Tweak indentation so that help2man creates better nroff.
1410 Reported by Dan Jacobson.
1412 * src/uniq.c (check_file): Don't check stdout for errors here.
1414 * src/pwd.c (find_dir_entry): Update comment to match reality.
1416 2004-11-18 Jim Meyering <jim@meyering.net>
1418 * src/pwd.c (robust_getcwd): Correct the comment: this function
1419 constructs the directory name. The caller prints it.
1421 2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
1423 * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1424 (do_statfs): Use it.
1426 * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1427 src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1428 src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1429 src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1430 src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1431 * src/readlink.c (main): argv is not const.
1433 * src/cut.c (usage): Improve documentation along the lines suggested
1435 * src/echo.c (usage): Likewise.
1436 * src/expr.c (usage): Likewise.
1438 * src/dircolors.hin: Add putty, screen-bce.
1440 * src/pinky.c (print_entry): Fix memory leak.
1441 * src/who.c (print_user): Likewise.
1443 2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
1445 * NEWS: New dd operand "status=noxfer".
1446 * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1447 C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1448 C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1450 (STATUS_NOXFER, statuses): New constants.
1451 (usage, print_stats, scanargs): Add support for status=noxfer.
1452 (usage): Update status output to match new behavior.
1453 (print_stats): Always output complete byte count.
1454 Put space between numbers and units, as SI requires.
1455 Use ngettext so that i18n can use plurals for "byte" and "second".
1456 Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1457 (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1459 * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1460 problems with regression testing.
1462 2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
1464 * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1465 * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1466 * src/dd.c: Include "human.h".
1467 (w_bytes, start_time): New vars.
1468 (usage): Document new I/O statistics output
1469 (print_stats): Output new I/O statistics.
1470 (cleanup): Do statistics after closing stdin and stdout, so that
1471 the times are more accurate.
1472 (write_output, dd_copy): Count output bytes.
1473 (main): Get initial value of clock.
1475 2004-11-14 Jim Meyering <jim@meyering.net>
1477 Backslash-escape `-'s in email addresses, so that they are
1478 rendered properly in UTF-locales.
1479 * man/help2man (escape_hyphens): New function.
1480 (main): Call it on email addresses.
1482 * src/sort.c (zaptemp): Mark new diagnostic for translation.
1484 * tests/misc/close-stdout: New file. Test today's closeout.c change.
1485 * tests/misc/Makefile.am (TESTS): Add close-stdout.
1487 2004-11-13 Jim Meyering <jim@meyering.net>
1489 * src/test.c (usage): Put the description of `[-n] STRING'
1490 on two lines, one for `-n STRING' and one for `STRING' so that
1491 help2man properly escapes the `-'. Otherwise, the hyphen is
1492 rendered inappropriately in UTF-8 locales.
1493 Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1495 2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
1497 * NEWS: Document the following changes.
1499 * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1501 (temptail): New variable, so that we can easily append to list.
1502 (create_temp_file): Create new files at end of list, so that
1503 searching the list has O(N*NMERGE) behavior instead of O(N**2).
1504 (zaptemp): Update temptail if needed.
1505 (mergefps, merge): Accept new arg that counts temp files, and keep it
1506 up to date as we create and remove temporaries. This is for
1507 efficiency, so that we don't call zaptemp so often.
1508 All callers changed.
1509 (sort): Don't create array in reverse order, since the list of
1510 temporaries is now in the correct order.
1512 (zaptemp): Protect against race condition: if 'sort' is
1513 interrupted in the middle of zaptemp, it might unlink the
1514 temporary file twice, and the second time this happens the file
1515 might already have been created by some other process.
1517 (zaptemp): Warn if a temporary file is not removed.
1519 (create_temp_file): Use offsetof for clarity.
1520 (die): Move it up earlier, to clean up the code a bit.
1522 * src/pr.c (strtoumax): Declare if not declared.
1523 (skip_to_page, first_page_number, last_page_number, page_number,
1524 first_last_page, print_header):
1525 Use uintmax_t for page numbers.
1526 (first_last_page): Remove unnecessary forward declaration.
1527 Do not modify arg (it is now a const pointer).
1528 Return a true if successful, false (without print a diagnostic)
1530 (main): If +XXX does not specify a valid page range, treat it
1531 as a file name. This follows the response to Open Group XCU ERN 41
1532 <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1533 which says the behavior is allowed.
1534 (skip_to_page): When starting page number exceeds page count,
1535 print both numbers in the diagnostic.
1536 (print_header): Detect page number overflow.
1538 2004-11-07 Jim Meyering <jim@meyering.net>
1540 * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1541 (main) [__APPLE__]: Get the processor type via syscall rather than
1542 hard-coding "powerpc". From Toby Peterson.
1544 * src/sort.c (merge): Remove declarations of now-unused variables.
1546 2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
1548 * src/sort.c (first_same_file): Remove. Move most of the code to....
1549 (avoid_trashing_input): New function.
1550 (merge): Avoid some silly merges, e.g., copying a single file to
1551 a temporary file when there are exactly 17 input files to merge.
1552 Take a count of temporary files rather than a max_merge arg.
1555 2004-11-06 Jim Meyering <jim@meyering.net>
1557 * src/sort.c (xfclose): Don't close stdout here (just flush it),
1558 since close_stdout now closes stdout unconditionally.
1560 2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
1562 * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1563 first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1564 This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1566 (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1567 thus avoiding unchecked stack overflow in some cases. As a side
1568 effect this improve the performance of "sort -M" by a factor of 4
1571 2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
1573 * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1575 * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1576 expression; it's not portable. Problem reported by Albert Chin.
1577 Don't invoke a program more than once.
1578 * src/groups.sh (version): New variable, containing author info,
1579 for benefit of AUTHORS check. Use it when acting on --version option.
1580 * AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
1583 * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1584 as this breaks the new regime that does "#define getopt rpl_getopt".
1585 Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1586 http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1587 I suppose this may cause problems on ancient hosts with
1588 incompatible getopt declarations, but we'll cross that bridge if
1589 the problem gets reported to us by someone who can test the fix.
1591 2004-11-03 Jim Meyering <jim@meyering.net>
1593 * src/tac.c: quote(...) file names in diagnostics.
1595 2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
1597 * NEWS: Document getdate changes.
1599 2004-10-29 Jim Meyering <jim@meyering.net>
1601 * src/tac.c (tac_file): Remove temporary prototype and move this
1602 function `down' so that it precedes definition of tac_nonseekable.
1604 `tac /proc/modules' would print nothing
1605 Reported by Harald Dunkel in http://bugs.debian.org/278604.
1607 * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1608 now it copies a general file descriptor, not just stdin.
1609 (tac_nonseekable): Renamed/adapted from tac_stdin.
1610 (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1611 since we never used the stream. Perform "-" to stdin mapping here
1612 rather than in main. Determine whether a file is seekable,
1613 by trying to `lseek' to its end, and dispatch to tac_seekable or
1614 tac_nonseekable accordingly.
1615 (main): Rewrite argument handling now that it uses only tac_file.
1616 * NEWS: Mention it here.
1618 2004-10-21 Jim Meyering <jim@meyering.net>
1620 * tests/mv/leak-fd: New file.
1621 * tests/mv/Makefile.am (TESTS): Add it.
1622 * tests/rm/dot-rel: New file.
1623 * tests/rm/Makefile.am (TESTS): Add it.
1625 Correct my patch of 2004-10-18.
1626 * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1627 if necessary, not in remove_dir. Otherwise, removing multiple
1628 `.'-relative nonempty directories no longer worked.
1630 2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
1632 * src/fmt.c (usage): Improve description of --prefix.
1633 Problem reported by Edward Welbourne.
1635 * man/uniq.x: Change summary so that it doesn't imply that
1636 uniq writes to its input file. Problem reported by
1639 2004-10-18 Jim Meyering <jim@meyering.net>
1641 Plug a leak that would cause a cross-device mv to fail when
1642 operating on too many command-line-specified nonempty directories.
1643 * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1644 top of the stack before returning. This usually closes the file
1645 descriptor that was used to return to the original working directory.
1646 Reported by Cyril Bouthors in
1647 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1648 * NEWS: Mention it here.
1650 * src/pathchk.c (validate_file_name): Give a more descriptive
1651 diagnostic when pathconf fails. This also avoids an unwarranted
1652 warning from gcc-3.3.5 about a format not being a string literal.
1654 * src/sleep.c (main): Remove declaration of unused local, c.
1655 * src/printenv.c (main): Likewise.
1656 * src/logname.c (main): Likewise.
1657 * src/uptime.c (main): Likewise, for optc.
1658 * src/tsort.c (main): Likewise, for opt.
1660 2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
1662 * AUTHORS: Add self to pathchk.
1663 * src/pathchk.c (AUTHORS): Add self.
1664 Change "path" to "file name" whenever possible.
1665 Remove usage comment, as it was a duplication of the code or doc.
1666 Include <wchar.h> if available.
1667 (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1668 (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1669 pathconf_wrapper, portable_chars, dir_ok): Remove.
1670 (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1671 (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1672 (portable_chars_only): New arg FILELEN.
1673 Don't assume ASCII; we might be on an EBCDIC host.
1674 Don't assume unibyte locale in diagnostic.
1675 (component_start, component_len): New functions.
1676 (validate_file_name): Renamed from validate_path. All uses changed.
1677 Pretty much a complete rewrite.
1678 Don't make copy of file arg. Always append trailing slash to
1679 pathconf arg, just in case it's a symlink (this is pure paranoia;
1680 we don't know of any hosts where the trailing slash is required).
1681 Use size_t instead of long int when possible.
1682 Avoid need to call pathconf in most practical cases.
1683 Don't use euidaccess several times to test searchability;
1684 just use lstat once. Reword diagnostic to put the (often very long)
1687 2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
1689 * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1691 2004-10-13 Jim Meyering <jim@meyering.net>
1693 * NEWS: Mention today's fts.c fix.
1695 2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
1697 * tests/stty/row-col-1: Set LC_ALL=C.
1699 2004-10-12 Jim Meyering <jim@meyering.net>
1701 * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
1702 From Jesus Climent in http://bugs.debian.org/276149.
1704 2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
1706 * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
1707 problems. All uses changed.
1709 2004-10-05 Jim Meyering <jim@meyering.net>
1711 * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
1712 since Karl says its trailing blanks are there to stay :-)
1714 2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
1716 * src/expr.c (NEW, OLD): Remove, partly to avoid
1717 reference to obsolescent macro XMALLOC.
1718 All uses replaced by xmalloc and free.
1720 2004-09-28 Jim Meyering <jim@meyering.net>
1722 * src/tail.c (usage): Clarify: --retry works only with --follow=name.
1723 Reported by Nik A. Melchior in http://bugs.debian.org/273781.
1725 2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
1727 * src/od.c (format_address_paren): c is optional, so don't output
1730 2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
1732 Add support for ls --hide. Idea suggested by Bardur Arantsson.
1733 * NEWS: Document this.
1734 * src/ls.c (file_ignored): Renamed from file_interesting, with
1735 inverted return value. Accept the file name, not a struct dirent *.
1736 All uses changed. Avoid the expense of calling fnmatch if the
1737 file is ignorable due to leading '.'.
1738 (all_files, really_all_files): Removed; replaced by:
1739 (ignore): New variable. All uses changed.
1740 (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
1742 (hide_patterns): New variable.
1743 (long_options, decode_switches, file_ignored, usage):
1744 Add support for --hide.
1745 (patterns_match): New function.
1746 (usage): Replace "hide" with "ignore" in explanation, to avoid
1749 2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
1751 * src/ls.c (gobble_file, print_long_format): Don't assume that
1752 human-readable output has a byte count equal to its column width;
1753 this isn't always true in locales where the radix character is not
1755 (format_user_or_group): Revamp code to match the above fix;
1756 this avoids the (very faint) possibility of integer overflow.
1758 2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
1760 * NEWS: Mention that "chmod -r -w x" now works as expected.
1761 * src/chmod.c (main): Revamp option processing to support this.
1762 * tests/chmod/Makefile.am (TESTS): Add 'usage'.
1763 * tests/chmod/usage: New set of tests for usage like that.
1765 2004-09-24 Jim Meyering <jim@meyering.net>
1767 * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
1768 it lists only cvs-controlled regular files.
1770 * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
1771 to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
1773 2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
1775 * Makefile.maint (CVS_LIST): New macro.
1776 (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
1777 sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
1778 sc_trailing_blank, po-check): Use it instead of the
1779 nonstandard "cvsu --list".
1781 * src/tail.c (parse_obsolete_option): Bring back support
1782 for obsolete option followed by non-obsolete, or by more
1783 than one file. When obsolete, conform to SUSv2 rather than
1784 original POSIX 1003.2-1992, as SUSv2 corrected the case of
1785 "tail -c". Add support for the SUSv2 "b" modifier.
1786 * NEWS: Mention the above.
1787 * tests/tail/Test.pm: New test case obs-b to check the above.
1788 err-[134] no longer need _POSIX2_VERSION=199209.
1789 Fix comments to match revised behavior.
1791 2004-09-22 Jim Meyering <jim@meyering.net>
1793 * Use automake-1.9.2. Regenerate dependent files.
1795 * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
1796 Improve the comment.
1798 Clean up scoping etc. so that some make `distcheck' tests pass.
1799 * src/csplit.c (xalloc_die): Declare to be static.
1800 * src/chown-core.c (chown_files): Declare as `extern'.
1801 * src/cp-hash.c (remember_created): Likewise.
1802 * src/copy.c (copy): Likewise.
1803 * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
1805 * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
1806 * src/unexpand.c: Likewise.
1808 * src/Makefile.am (check-AUTHORS): New rule.
1809 (check): Depend on it.
1812 * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
1813 (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
1815 2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
1817 * src/ls.c (decode_switches): Don't compare a short value
1818 to SIZE_MAX: GCC sometimes complains.
1820 2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
1822 * NEWS: The following commands now reject unknown options:
1823 basename dirname factor hostname link nohup sync unlink yes
1824 Also, pathchk no longer accepts trailing options.
1826 * src/basename.c: Include <getopt.h>.
1827 * src/chroot.c: Likewise.
1828 * src/dirname.c: Likewise.
1829 * src/factor.c: Likewise.
1830 * src/hostid.c: Likewise.
1831 * src/hostname.c: Likewise.
1832 * src/nohup.c: Likewise.
1833 * src/pwd.c: Likewise.
1834 * src/setuidgid.c: Likewise.
1835 * src/sync.c: Likewise.
1837 * src/basename.c (main): Reject unknown options.
1838 * src/dirname.c (main): Likewise.
1839 * src/factor.c (main): Likewise.
1840 * src/hostid.c (main): Likewise.
1841 * src/hostname.c (main): Likewise.
1842 * src/link.c (main): Likewise.
1843 * src/nohup.c (main): Likewise.
1844 * src/pwd.c (main): Likewise.
1845 * src/setuidgid.c (main): Likewise.
1846 * src/sync.c (main): Likewise.
1847 * src/unlink.c (main): Likewise.
1848 * src/yes.c (main): Likewise.
1850 * src/cat.c (main): Remove unused "case 0".
1851 * src/chgrp.c (main): Likewise.
1852 * src/chmod.c (main): Likewise.
1853 * src/chown.c (main): Likewise.
1854 * src/comm.c (main): Likewise.
1855 * src/cp.c (main): Likewise.
1856 * src/csplit.c (main): Likewise.
1857 * src/cut.c (main): Likewise.
1858 * src/date.c (main): Likewise.
1859 * src/df.c (main): Likewise.
1860 * src/du.c (main): Likewise.
1861 * src/env.c (main): Likewise.
1862 * src/expand.c (main): Likewise.
1863 * src/fold.c (main): Likewise.
1864 * src/head.c (main): Likewise.
1865 * src/id.c (main): Likewise.
1866 * src/install.c (main): Likewise.
1867 * src/join.c (main): Likewise.
1868 * src/ln.c (main): Likewise.
1869 * src/ls.c (decode_switches): Likewise.
1870 * src/mkdir.c (main): Likewise.
1871 * src/mkfifo.c (main): Likewise.
1872 * src/mknode.c (main): Likewise.
1873 * src/mv.c (main): Likewise.
1874 * src/nl.c (main): Likewise.
1875 * src/paste.c (main): Likewise.
1876 * src/pinky.c (main): Likewise.
1877 * src/pr.c (main): Likewise.
1878 * src/ptx.c (main): Likewise.
1879 * src/readlink.c (main): Likewise.
1880 * src/rm.c (main): Likewise.
1881 * src/rmdir.c (main): Likewise.
1882 * src/seq.c (main): Likewise.
1883 * src/shred.c (main): Likewise.
1884 * src/split.c (main): Likewise.
1885 * src/sum.c (main): Likewise.
1886 * src/tac.c (main): Likewise.
1887 * src/tail.c (main): Likewise.
1888 * src/tee.c (main): Likewise.
1889 * src/touch.c (main): Likewise.
1890 * src/tr.c (main): Likewise.
1891 * src/tty.c (main): Likewise.
1892 * src/uname.c (main): Likewise.
1893 * src/unexpand.c (main): Likewise.
1894 * src/wc.c (main): Likewise.
1895 * src/who.c (main): Likewise.
1897 * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
1898 * src/cksum.c (main): Likewise.
1899 * src/dd.c (main): Likewise.
1900 * src/logname.c (main): Likewise.
1901 * src/printenv.c (main): Likewise.
1902 * src/sleep.c (main): Likewise.
1903 * src/tsort.c (main): Likewise.
1904 * src/uptime.c (main): Likewise.
1905 * src/users.c (main): Likewise.
1906 * src/whoami.c (main): Likewise.
1908 * src/du.c (long_options): Standardize on NULL vs 0.
1909 * src/rm.c (long_opts): Likewise.
1911 * src/logname.c (long_options): Remove.
1912 * src/printenv.c (long_options): Likewise.
1913 * src/sleep.c (long_options): Likewise.
1914 * src/tsort.c (long_options): Likewise.
1915 * src/uptime.c (longopts): Likewise.
1916 * src/users.c (longopts): Likewise.
1917 * src/whoami.c (long_options): Likewise.
1919 * src/pathchk.c (longopts): Add --help, --version.
1920 (main): Use longopts rather than parse_long_options.
1921 * src/stty.c (longpts, main): Likewise.
1923 * src/pathchk.c (main): Don't reorder arguments, so that
1924 we can check weird file names.
1926 * src/readlink.c: Don't include "long-options.h".
1927 * src/sort.c: Likewise.
1928 * src/stty.c: Likewise.
1930 * src/split.c (verbose): Now bool, not int.
1931 (VERBOSE_OPTION): New enum.
1932 (longopts, main): Use it.
1934 * tests/factor/basic: Adjust to new wording in diagnostic
1935 that results from the above changes.
1937 2004-09-21 Jim Meyering <jim@meyering.net>
1939 * man/rm.x: Say "the response is affirmative" rather than "the
1940 response begins with y or Y", so that the documentation is
1941 accurate in non-English locales. Problem reported by Munzir Taha.
1943 2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
1945 * src/echo.c (main): Don't pass NULL to strcmp when
1946 POSIXLY_CORRECT and given no arguments.
1948 * src/md5sum.c (STRING_OPTION): Remove.
1949 (long_options, main): Remove support for undocumented and
1950 obsolete --string option, as suggested in the 1996-09-26 patch.
1951 * NEWS: Document this.
1953 * tests/rm/fail-eperm: Don't try to remove writeable files in a
1954 sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
1955 you remove such files. Problem reported by Bert Fischer in:
1956 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
1958 2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
1960 * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
1961 (long_options, main): Use them instead of magic numbers 2 and 1.
1962 For --string, optarg can't possibly be NULL.
1964 * src/dd.c (usage): Distinguish between options and operands.
1965 (scanargs): Don't mess with argc, argv; getopt_long handles this now.
1966 Say "operands" for operands, not "options".
1967 (main): Use getopt_long, so that "dd --" works as POSIX requires.
1968 * tests/dd/misc: Check for "dd --".
1970 * src/chroot.c (main): Reject unknown options instead of
1971 interpreting them as a directory to chroot to.
1973 * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
1974 The current standard (POSIX 1003.1-2004) is correct.
1975 (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
1976 collision with builtin function.
1977 (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
1978 output the first 0 as 8 digits, to make it easier to compare to
1979 the text of the standard. Output crctab to be a const array.
1980 (crctab): Use result of above changes.
1981 (long_options): Remove; not needed if empty.
1982 (main): getopt_long can't return 0 here, so simplify the code.
1984 2004-09-13 Jim Meyering <jim@meyering.net>
1986 * src/Makefile.am (localedir.h): Don't redirect directly to target.
1988 2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
1990 * src/id.c (print_full_info): Don't exit with failure status simply
1991 because a user or group number can't be turned into a name.
1992 Problem reported by Felipe Kellermann in:
1993 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
1995 2004-09-12 Jim Meyering <jim@meyering.net>
1997 * Makefile.maint (my-distcheck): When building with -Werror, also
2000 2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
2002 * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2003 * src/tail.c (parse_obsolete_option): Renamed from
2004 parse_obsolescent_option, since the options are obsolete now.
2005 Remove bool *arg; just exit if there's an error. Revamp to follow
2006 POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2007 file" and "tail -10 -- file" correctly when we are conforming to
2009 (main): Adjust to this change.
2010 * tests/tail/Test.pm (test_vector): minus-* requires
2011 _POSIX2_VERSION=199209 now, to work correctly if there is
2012 an input file. err-1 and err-3 no longer errors if there
2015 2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
2017 * src/test.c (usage): Document -r, -w, -x more carefully.
2019 2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
2021 * src/test.c (usage): Document "test" (with no args) and "[ ]".
2022 Document that -h and -L don't dereference.
2024 * NEWS: Document that "tr xy -z" now works as per POSIX.
2025 Sort the descriptions.
2026 * src/tr.c (main): Don't reorder options.
2027 * tests/tr/Test.pm (fowler-1): New test case.
2029 2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
2031 * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2032 MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2033 conforming to pre-2001 POSIX.
2034 * NEWS: Document this.
2035 * tests/touch/obsolescent: Test for this bug. Also, set
2036 _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2037 a better test for obsolescent features.
2039 * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2040 "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2043 * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2044 (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2045 (long_options, main): --strings is now -S, not -s.
2046 (usage): Reflect the usage changes.
2047 (parse_old_offset): Do not issue a diagnostic on failure;
2048 callers now do this as necessary.
2049 (main): Support POSIX syntax. Remove unused case 0 from getopt_long.
2050 Add support for new short options (many undocumented) for
2051 compatibility with FreeBSD. Remove FIXME for -s; it's now
2052 POSIX-compatible. Default format is now oS, not o2.
2053 * NEWS: Describe the above.
2055 2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
2057 * src/stty.c (valid_options): Remove.
2058 (main): Fix some bugs in handling invalid option-combinations
2060 (recover_mode): Arg is now char const *, not char *.
2061 (main): Use STDIN_FILENO, not 0.
2062 Simplify option-parsing code a tad.
2063 * tests/stty/basic-1: Check for the fixed bugs.
2065 2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
2067 * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2068 it from ever being nonzero. Reported by Pozsar Balazs in:
2069 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2070 (human_fstype): Add ramfs, squashfs, sysfs.
2071 Reported by Pozsar Balazs in:
2072 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2073 (human_fstype): Return char const *, not char *.
2074 Simplify internals a bit, and avoid casts.
2076 * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2077 (bit_count): Remove. All uses changed to....
2078 (multiple_bits_set): New function.
2079 (scanargs): Use it, and check separately for each set of
2080 incompatible options, to improve diagnostics.
2082 (apply_translations): Move checks for incompatible options
2083 to scanargs, so that they're done consistently.
2085 2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
2087 Output correct errno-related diagnostic on "paste" I/O errors.
2088 * src/paste.c (write_error, xputchar): New functions.
2089 (paste_parallel): Use correct errno value after input error.
2090 (paste_parallel, paste_serial): Report errno value after output error.
2092 Port to diet libc. Problem reported by Felix von Leitner in:
2093 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2094 * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2095 it's not portable C to assume FILE is a complete type.
2096 (paste_parallel): Use index test instead of ENDLIST, and NULL
2099 2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
2101 POSIX-conformance fixes for "expand" and "unexpand".
2102 Also, consistently use "tab stop" rather than "tabstop".
2103 * NEWS: Document fixes.
2104 * src/expand.c: Revamp to resemble the new unexpand.c better.
2105 (usage): -i does not convert tabs after non-tabs.
2106 (add_tab_stop): Renamed from add_tabstop. All uses changed.
2107 (parse_tab_stop): Renamed from parse_tabstop. All uses changed.
2108 (validate_tab_stop): Renamed from validate_tabstop. All uses changed.
2109 (next_file, main): Check fclose against 0, not EOF.
2110 (expand): Remove unnecessary casts.
2111 Add another loop nesting level, for lines, so that per-line variables
2112 are initialized cleanly.
2113 Revamp tab checking. Check for write error immediately, rather
2114 than just once at the end of the program.
2115 * src/unexpand.c: Lkewise (for the expand.c changes).
2116 (TAB_STOP_SENTINEL): Remove.
2117 (tab_size): Now size_t, not uintmax_t, since we need to store
2118 the sequences of blanks.
2119 (max_column_width): New var.
2120 (usage): Say "blank" where POSIX requires this.
2121 (add_tab_stop): Calculate maximum column width.
2122 (unexpand): Store the pending blanks, instead of merely counting them.
2123 Follow POSIX's rules about -a requiring two blanks before a tab stop.
2124 Get rid of internal label and goto.
2125 * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2126 Add blanks-1 through blanks-13.
2128 2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
2130 * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2131 succeed without changing the uid and gid, like FreeBSD.
2132 * src/chgrp.c (parse_group): Return gid_t rather than storing it
2133 through a pointer. Treat "chgrp '' file" as a no-op change,
2135 (main): Set chopt.group_name to NULL if the group is the empty
2137 * src/chown-core.c (describe_change): Describe changes to -1:-1
2138 without using "to OWNERSHIP" phrase.
2139 * src/chown.c (usage): "chown '' file" is now allowed.
2140 (main): Do not set user name to the empty string if the group
2142 * tests/chgrp/basic: Test "chgrp '' file".
2143 * tests/chown/Makefile.am (TESTS): Add separator.
2144 * tests/chown/separator: New file, partly taken from
2145 Dmitry V. Levin's suggestion in
2146 <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2148 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
2150 * tests/install/basic-1: Test for the -d regression.
2152 2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
2154 * src/install.c (main): Fix -d regression introduced with
2155 --target-directory support at 2004-06-25.
2157 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
2159 * src/copy.c (copy_internal): When preserving links, unlink
2160 a destination with link count greater than one. This is so
2161 that commands like "cp -a" don't get confused when copying into
2162 a destination that already contains many hard links. Problem
2163 reported by Tim Waugh in:
2164 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2166 2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
2168 Convert all files to UTF-8.
2169 * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2170 * tests/sort/Test.pm (16a): Likewise.
2171 * tests/uniq/Test.pm (8): Likewise.
2172 * tests/misc/printf-hex: Use ASCII, not Latin-1.
2174 * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2175 * src/shred.c (usage): "-" is an operand, not an option.
2176 * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2177 A null file arg means standard output.
2178 (main): "-o -" means to write to a file named "-",
2179 not to standard output.
2180 * src/tee.c (usage, tee): "tee -" writes to standard output, not
2181 to a file named "-".
2183 2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
2185 * src/install.c (change_timestamps): Fix int->bool conversion
2186 bugs introduced on 2004-07-29.
2188 2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
2190 * src/shred.c (wipename): Work even if the directory is writeable
2191 and not readable. Prefer write access, since this should work
2192 better with fdatasync.
2194 * src/csplit.c (xalloc_die): New function.
2195 (main): Remove now-obsolete initialization of xalloc_fail_func.
2197 * src/md5sum.c: Adjust to sha->sha1 renaming.
2199 2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
2202 * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2203 (can_mode): Make variable local.
2205 2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
2207 * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2208 Do not define, to avoid annoying compiler messages on QNX 6.3.
2209 Problem reported by Johan in:
2210 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2212 2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
2214 * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2215 Define to a concatenation of string literals, not to an expression;
2216 needed for concatenation contexts.
2217 (INTMAX_MAX, INTMAX_MIN): New macros.
2219 * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2220 unsigned long; this isn't true for st_ino on Solaris 9.
2222 2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
2224 * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2225 whether to include files. Include <sys/param.h> if
2226 HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2227 (main) [defined __POWERPC__]: Add a kludge to work around a
2228 Mac OS X bug, so that uname -p defaults to "powerpc" if
2229 sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2230 fails. Problem reported by Petter Reinholdtsen in:
2231 http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2233 * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2234 main): Use bool for booleans.
2235 (writeline, check_file): Use uintmax_t for line counts.
2236 (check_file): Check for and report line number overflow,
2238 * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2239 (print_lines, print_words, print_chars, print_bytes, print_linelength,
2240 have_read_stdin, wc, wc_file, main):
2241 Use bool for booleans.
2242 (exit_status): Remove.
2243 (wc, wc_file): Return bool status. All callers changed.
2244 * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2245 * src/whoami.c (main): Print uids using unsigned long int, not
2248 * src/unexpand.c: Int cleanup and minor reorganization to be more
2250 Include quote.h, xstrndup.h.
2251 (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2252 (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2254 Use bool for booleans.
2255 (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2256 Use uintmax_t for column counts.
2257 (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2258 (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2260 (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2261 Detect overflow in tab stop string.
2262 (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2263 (unexpand): Concatenate input files the same way expand does.
2265 * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2266 touch, main): Use bool for booleans.
2267 (main): Avoid integer overflow when given more than INT_MAX
2269 * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2270 (have_read_stdin, count_items, scan_zeros, detect_loop,
2271 recurse_tree, walk_tree, tsort, main):
2272 Use bool for booleans.
2273 (exit_status): Remove.
2274 (tsort): Return a success flag instead of storing into a global.
2276 * src/tty.c (silent, main): Use bool for booleans.
2277 (main): 0 -> STDIN_FILENO.
2278 * src/uname.c (print_element): Use bool for booleans.
2280 * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2281 Remove. All uses replaced by C99 boolean primitives.
2282 (TEST_TRUE, TEST_FALSE): New constants, for readability.
2283 (test_unop, binop, unary_operator, binary_operator, two_arguments,
2284 three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2285 one_argument, main): Use bool for booleans.
2286 (advance, unary_advance): Now inline procedures rather than a macros.
2287 (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2288 (term, and, or): When it's easy, loop instead of recursing.
2289 (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2290 (binary_operator, unary_operator): Simplify by systematically rewriting
2291 true==FOO to FOO (where FOO is a boolean).
2292 (unary_operator): Don't consider a file to be a regular file
2293 merely because its mode&S_IFMT is zero. Just use S_ISREG.
2294 Remove unnecessary casts. Remove ifdefs for things like
2295 S_ISSOCK that are no longer needed, since stat-macros.h always
2298 * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2299 Use bool for booleans.
2300 (buf_init_from_stdin, buf_free, find_bol, print_line):
2301 Use size_t for sizes.
2302 * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2303 tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2304 (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2305 (tac_seekable): Use ptrdiff_t for pointer subtraction.
2306 Report an error if the result is out of range.
2307 (tac_seekable, main): Check for integer overflow in buffer size
2309 (main): Remove unnecessary casts.
2311 * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2312 the callee doesn't have to count 'em. All callers changed.
2313 Don't allocate more space for the arg vector than we'll need.
2314 Use memcpy to copy the args rather than rolling our own loop.
2315 Use size_t for sizes.
2316 (fast_startup, simulate_login, change_environment, log_su,
2317 correct_password, restricted_shell, main): Use bool for booleans.
2318 (longopts): Don't assume change_environment is an int.
2319 Use NULL, not 0, for pointers.
2320 (xsetenv): New function, replacing xputenv and concat.
2321 All callers changed.
2322 (elements): Remove; no longer needed.
2323 (log_su, correct_passwd, main): Prefer !x to x==NULL.
2324 (log_su): 2 -> STDERR_FILENO.
2325 (modify_environment, main): Don't assume that getenv's returned value
2326 has an indefinite lifetime.
2327 (modify_environment): Allocate a larger environ.
2328 (main): Remove an impossible 'case 0'; if it happens now, it'll
2329 get diagnosed. Don't assume getpwnam results outlive endpwent.
2330 Check for null or empty pw_name, pw_dir and for null pw_passwd.
2332 * src/stty.c (VA_START): Remove. All callers now use va_start.
2333 (_POSIX_VDISABLE): Remove unnecessary cast.
2334 (struct control_info, visible): Use cc_t for control chars.
2335 (struct control_info): Use size_t for sizes.
2336 (recover_mode, set_mode, display_speed, display_window_size,
2337 valid_options, main, display_changed):
2338 Use bool for booleans.
2339 (integer_arg): Return unsigned long int, not long int.
2340 Accept new max arg; all callers changed, to specify a maximum
2341 value for integer parameters instead of silently overflowing.
2342 (wrap): Do not overrun the stack buffer if the output contains
2343 more than 1024 bytes. Instead, malloc a buffer.
2344 (main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
2345 Remove unnecessary casts.
2346 (set_control_char): Allow int values only up to cc_t range.
2347 (screen_columns): Don't reject INT_MAX.
2348 (display_changed, display_all, display_speed, recover_mode):
2349 Don't assume cc_t fits in int.
2351 * src/remove.h: Add copyright notice.
2352 (struct rm_options): Use bool for booleans.
2353 * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2354 errno_rmdir_non_empty, remove_parents, main): Likewise.
2355 * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2357 (main): Don't dump core if invoked with argv[0]==NULL.
2358 * src/tee.c (tee, append, ignore_interrupts, main, tee):
2359 Use bool for booleans.
2360 (tee): Use ssize_t for read returns.
2362 * src/ptx.c: Add a FIXME mentioning that there are many
2363 unchecked integer overflows in this file.
2364 (gnu_extensions, auto_reference, input_reference, right_reference,
2365 ignore_case, initialize_regex, fix_output_parameters,
2366 output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2367 Use bool for booleans.
2368 (SKIP_SOMETHING, compare_words, digest_break_file,
2369 find_occurs_in_text, fix_output_parameters):
2370 Use to_uchar instead of a caset.
2371 (print_field): Rewrite to avoid cast.
2373 * src/printf.c (posixly_correct): Use bool for booleans.
2374 (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2375 (STRTOX): Rewrite to avoid casts.
2376 (print_esc_char): Arg is char, not int.
2377 * src/readlink.c (canonicalize): Remove. All uses now merely inspect
2379 (no_newline, verbose): Use bool for booleans.
2380 (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2381 * src/shred.c (struct Options, main): Use bool for booleans.
2382 (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2383 * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2384 Use bool for booleans.
2385 * src/stat.c (G_fail): Remove.
2386 (print_statfs): Print various gotta-be-nonnegative values using
2387 unsigned long int, not long int or int.
2388 (do_statfs, do_stat): Return a boolean success flag.
2389 (do_stat, main): Use bool for booleans.
2391 * src/pr.c: Add a FIXME mentioning that there are many
2392 unchecked integer overflows in this file.
2393 (TRUE, FALSE): Remove. All uses replaced by true and false.
2394 (struct COLUMN, read_line, print_page, print_stored, open_file,
2395 skip_to_page, init_fps, parallel_files, align_empty_cols,
2396 empty_line, FF_only, explicit_columns, extremities, keep_FF,
2397 print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2398 print_across_flag, storing_columns, balance_columns,
2399 truncate_lines, join_lines, untabify_input, failed_opens,
2400 numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2401 double_space, ignore_failed_opens, use_col_separator,
2402 pad_vertically, last_line, main, init_parameters, skip_read,
2403 read_line, print_stored):
2404 Use bool for booleans.
2405 (struct COLUMN, char_to_clump, store_char, print_char):
2407 (clump_buff, print_clump): Use char[], not int[], for an array whose
2408 elements are always chars.
2409 (first_last_page, main, getoptarg, balance, add_line_number,
2410 char_to_uclump): Remove unnecessary casts.
2411 (init_parameters): Allocate chars, not ints, for clump_buff.
2412 (print_char): Use to_uchar before invoking ISPRINT.
2413 (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2415 * src/nohup.c (main): Use bool for booleans.
2416 * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2417 * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2418 (portable_chars_only): Use to_uchar rather than a cast.
2419 * src/printenv.c (main): Use bool for booleans.
2420 Do not assume that the environ has at most one matching entry
2421 for each option (integer overflow was possible otherwise).
2423 * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2424 constant. Do not assume PRIdMAX etc. are strings of length 3 or
2426 (struct tspec): Use it. fmt_string is now an array, not
2427 a pointer, as there's little point to the indirection here.
2428 (struct tspec, flag_dump_strings,
2429 traditional, flag_pseudo_start, limit_bytes_to_format,
2430 abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2431 decode_one_format, open_next_file, check_and_close,
2432 decode_format_string, skip, write_block, read_char, read_block,
2433 parse_old_offset, dump, dump_strings, main):
2434 Use bool for booleans.
2435 (struct tspec): Use void *, not char *, for generic pointers.
2436 (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2437 bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2438 Use char, not unsigned int, since char suffices.
2439 (print_s_char, print_char, print_s_short, print_short,
2440 print_int, print_long, print_long_long, print_float,
2441 print_double, print_long_double): Rewrite to avoid casts.
2442 These now take void * arguments, instead of char *.
2443 Use the same body for all functions, except for the choice
2444 of type. Assume C89 to simplify handling of signed char.
2445 (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2446 Rewrite to avoid casts.
2447 (print_named_ascii, print_ascii): Now takes void *, not char *.
2448 (decode_one_format): Use int for printf field widths, not
2449 unsigned int. Pass void * to subsidiary printers,
2450 not char *. Simplify handling of floating-point formats
2451 by factoring out common code dealing with precision and field width.
2452 (decode_format_string): Avoid need for temporary copy of
2453 each decoded struct tspec.
2454 (get_lcm): Remove unnecessary cast.
2455 (main): Fix bug where more than INT_MAX failed decodes were ignored.
2457 2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
2459 * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2460 (enum number_format): Remove.
2461 (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2463 (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2464 (section_del): Now const.
2465 (print_fmt): Remove.
2466 (starting_line_number, page_incr, blank_join, line_no,
2467 print_lineno, proc_text, main):
2468 Use intmax_t for line numbers.
2469 (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2470 Use bool for booleans.
2471 (lineno_format): Now a string, not an enum value.
2472 (build_print_fmt): Remove. All calls removed. This work is
2473 now done within print_lineno.
2474 (build_type_arg): Use size_t for sizes.
2475 (print_lineno): Check for line number overflow.
2476 (proc_text, main): Remove unnecessary cast.
2478 * src/ln.c (symbolic_link, interactive, remove_existing_files,
2479 verbose, hard_dir_link, dereference_dest_dir_symlinks,
2480 do_link, main): Use bool for booleans.
2482 * src/ls.c (struct fileinfo, file_interesting,
2483 extract_dirs_from_files, color_symlink_as_referent,
2484 FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2485 numeric_ids, print_block_size, dired, print_with_color,
2486 check_symlink_color, print_inode, recursive, immediate_dirs,
2487 all_files, really_all_files, qmark_funny_chars,
2488 print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2489 main, decode_switches, parse_ls_color, print_dir, file_interesting,
2490 gobble_file, make_link_path, basename_is_dot_or_dotdot,
2491 extract_dirs_from_files, print_long_format):
2492 Use bool for booleans.
2493 (dir_defaulted): Remove; no longer needed.
2494 (main): Use int to count files, since it suffices for argv.
2495 Rewrite to avoid need for dir_defaulted.
2496 (main, print_dir, gobble_file, get_link_name,
2498 Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2499 (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2500 Remove unnecessary cast to int. Use int instead of unsigned
2501 int to count from 0 to 1.
2502 (get_funky_string, print_type_indicator): Use char for bytes, not int.
2503 (make_link_path): Use NULL for null pointers.
2504 (quote_name): Use to_uchar instead of cast.
2506 * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2507 print_full_info): Use bool for booleans.
2508 (problems): Remove, replacing with....
2509 (ok): New var (inverted from old sense).
2510 (print_user, print_group, print_full_info):
2511 Print uids/gids with %lu, not %u.
2512 (xgetgroups): Don't run out of memory if getgroups or getugroups
2514 * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2516 * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2517 int, since it suffices.
2518 (factor, print_factors): Use size_t for sizes.
2519 (print_factors, do_stdin, main): Use bool for booleans.
2520 * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2521 (fold_file, main): Use bool for booleans.
2522 (fold_file, main): Use size_t for sizes.
2523 (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2524 of prohibiting widths greater than INT_MAX.
2525 * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2526 write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2527 elide_tail_lines_pipe, elide_tail_lines_seekable,
2528 elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2529 string_to_integer, main):
2530 Use bool for booleans.
2531 (main): Rewrite to avoid cast.
2533 * src/csplit.c (struct line): Use size_t for sizes.
2534 (main): Remove unnecessary cast.
2535 * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2536 * src/cut.c (cut_file, main): Use bool for booleans.
2537 * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2538 * src/env.c (main): Likewise.
2539 * src/expr.c (nextarg): Likewise.
2540 * src/env.c (main): Remove unused and nonstandard envp arg.
2542 * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2543 fmt's arbitrary limits.
2544 (TRUE, FALSE): Remove; all uses changed to (true, false).
2545 (main): Use bool for booleans.
2546 Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
2548 (copy_rest): Remove unnecessary cast.
2549 (get_prefix): Rewrite to avoid cast.
2550 (check_punctuation): Use char *, not unsigned char *; C89 requires
2551 this. Avoid off-by-one buffer read overrun when line is empty.
2552 (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2553 Remove unnecessary casts.
2554 * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2557 * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2558 next_file, expand, main):
2559 Use bool for booleans.
2560 (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2562 Use uintmax_t for column counts.
2563 (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2564 All callers changed.
2565 (parse_tabstops): Don't pass a negative char to isblank.
2566 Avoid memory leak with large tab stops.
2567 (validate_tabstops, expand): Don't assume number of tab stops is
2569 (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2570 storing values into exit_status.
2571 (expand): Use same pattern as unexpand for reading chars.
2572 Report an error when input line is too long, instead of silently
2573 screwing up. Do not mishandle tab stops when backspacing left
2576 * src/dircolors.c (have_read_stdin, append_quoted,
2577 dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2578 (dc_parse_stream): Use enum for state, rather than int.
2579 Use ssize_t to store getline result.
2581 * src/dd.c (translation_needed, parse_integer, scanargs,
2582 apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2583 Use bool for booleans.
2584 (translate_buffer): Use to_uchar rather than a cast.
2585 (swab_buffer, copy_simple, copy_with_unblock):
2586 Use size_t for sizes.
2588 * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2589 * src/sleep.c (apply_suffix): Likewise.
2590 * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2591 forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2592 write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2593 tail_forever, tail_bytes, tail_lines, tail, tail_file,
2594 parse_obsolescent_option, parse_options, main): Likewise.
2595 * src/sleep.c (apply_suffix): Invert sense of result.
2596 Use int (not unsigned int) for multiplier, as this generates better
2597 code with some compilers. Simplify code a bit.
2598 * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2599 parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2601 (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2602 make it a bit clearer.
2604 * src/hostname.c: Include "xgethostname.h".
2605 (xgethostname): Remove decl; xgethostname.h has it.
2606 (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2607 && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2608 prototypes rather than K&R form. Assume any negative value from
2609 sysinfo denotes failure, not just -1.
2610 (main): Simplify use of sethostname.
2612 * src/pinky.c (include_idle, include_heading, include_fullname,
2613 include_project, include_plan, include_home_and_shell, do_short_format,
2614 include_where, main): Use bool for booleans.
2615 (count_ampersands, create_fullname, scan_entries, short_pinky):
2616 Use size_t for sizes.
2617 (create_fullname): Check for overflow in size calculations.
2618 (idle_string): Don't assume that the number of idle days
2619 is less than 10**8 and/or INT_MAX/(24*60*60).
2620 (main): No need to pass a non-NULL last arg to getopt_long.
2621 * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2622 (print_uptime): Remove unused local variable.
2623 (main): No need to pass a non-NULL last arg to getopt_long.
2624 * src/users.c (list_entries_users, users): Use size_t for sizes.
2625 (list_entries_users): Use char for bytes.
2626 (main): No need to pass a non-NULL last arg to getopt_long.
2627 * src/who.c (do_lookup, short_list, short_output, include_idle,
2628 include_heading, include_mesg, include_exit, need_boottime,
2629 need_deadprocs, need_login, need_initspawn, need_clockchange,
2630 need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2631 (print_runlevel): Use unsigned char for bytes.
2632 (list_entries_who, scan_entries, who): Use size_t for sizes.
2633 (main): No need to pass a non-NULL last arg to getopt_long.
2635 * src/install.c (isdir): Remove decl.
2636 (install_file_to_path): Rely on make_path to fail if the destination
2637 is not a directory, by passing preserve_existing==true to it.
2638 Hence we no longer need to call isdir.
2639 Free dest_dir immediately when it's no longer needed, rather than
2640 waiting until the end of the function.
2641 (copy_file): Don't bother calling isdir, as copy will do the
2642 right thing if the destination is a directory.
2644 * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2645 print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2646 Use bool for booleans.
2647 (max_depth): Now size_t, not int, to avoid an arbitrary limit
2648 of INT_MAX on depth.
2649 (G_fail): Remove: no longer needed, now that the relevant
2650 functions return bool.
2651 (process_file): Use return value to signal success rather than
2652 setting a global. Remove first_call static var; not needed, since
2653 we can look at n_alloc. Use size_t for depths. Remove FIXME
2654 about size_t casts, as it's now fixed. Use xnrealloc rather
2655 than the obsolescent XREALLOC. Don't bother to check whether
2656 reallocation is needed unless level > prev_level.
2657 (du_files): Invert sense of result, for consistency with
2658 other coreutils code. All callers changed.
2659 (main): Allow --max-depth values up to SIZE_MAX.
2661 * src/df.c (inode_format, show_all_fs, show_local_fs,
2662 show_listed_fs, posix_format, require_sync, print_type,
2663 selected_fstype, excluded_fstype, show_dev, show_point, main):
2664 Use bool for booleans.
2665 (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2666 (show_dev, show_point, main):
2667 Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2668 Don't assume disk name lengths are <= INT_MAX.
2669 Rewrite pct calculation to avoid cast.
2670 (show_point): Don't assume resolved length is <= SSIZE_MAX.
2672 * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2673 instead of uintptr_t.
2674 * src/shred.c (UINT_MAX_32_BITS): Remove.
2675 (word32): Remove. All uses changed to uint32_t.
2676 (isaac_seed_data): Remove unnecessary cast.
2677 * src/system.h (ptr_align): Use size_t; in practice, this is just as
2678 good as uintptr_t in checking for alignments, and has fewer
2679 configuration hassles.
2681 * src/Makefile.am (localedir.h): Make it readonly; this
2682 undoes part of the 2004-07-27 patch.
2684 2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
2686 * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2687 (IS_THOUSANDS_SEP): Use bool when appropriate.
2688 (numcompare, main): Use char, not int, when the value is always a char.
2689 (numcompare): Remove "register"; compilers are smart enough these days.
2690 * src/system.h (errno, CHAR_BIT): Remove decls;
2691 no longer needed now we assume C89 or better.
2692 Include <inttypes.h> before <stdint.h>, as it's the
2693 Autoconf-recommended pattern.
2694 (to_uchar): New inline function, moved here from tr.c.
2695 Use full names for int types, e.g. "long int" rather than "long".
2696 * src/tr.c (to_uchar): Remove; now in system.h.
2697 (is_char_class_member): Use bool when appropriate.
2699 * src/mkdir.c (create_parents, main): Use bool when appropriate.
2700 (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2702 2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
2704 * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
2706 * src/chmod.c (recurse, force_silent, process_file, process_files,
2707 main): Use bool when appropriate.
2708 * src/cksum.c (cksum, main): Likewise.
2709 * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
2710 compare_files, main): Likewise.
2712 * src/copy.h (struct cp_options): Likewise.
2713 * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
2714 same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
2715 * src/cp-hash.h (remember_created): Likewise.
2716 * src/cp-hash.c (remember_created): Likewise.
2717 * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
2718 re_protect, make_path_private, target_directory_operand, do_copy,
2719 cp_option_init, decode_preserve_arg, main): Likewise.
2720 * src/install.c (isdir, change_timestamps, change_attributes,
2721 copy_file, install_file_to_path, install_file_in_dir,
2722 install_file_in_file, strip_files, dir_arg, cp_option_init, main,
2723 change_attributes, change_timestamps): Likewise.
2724 * src/mv.c (remove_trailing_slashes, rm_option_init,
2725 cp_option_init, do_move, movefile, main): Likewise.
2726 * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
2727 AD_push, prompt, remove_dir): Likewise.
2728 * src/rm.c (rm_option_init, main): Likewise.
2730 * src/remove.c (top_dir, pop_dir, full_filename_):
2731 Use size_t for sizes.
2732 * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
2733 succeeds. It's not necessary in that case, as *NEW_DST is always
2735 (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
2736 (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
2737 * src/rm.c (main): Likewise.
2739 md5sum, sha1sum integer cleanups.
2741 * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
2743 (ALG_UNSPECIFIED): Remove.
2744 (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
2745 * src/md5.c: Don't include any files other than checksum.h.
2746 * src/sha1sum.c: Likewise.
2747 * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
2748 bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
2749 Use bool when appropriate.
2750 (digest_check): Increase limit of number of input lines to
2751 UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
2752 Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
2754 2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
2756 * src/cat.c (exit_status): Remove. Now done by passing a boolean
2758 (simple_cat, cat): Return true if successful. All callers changed.
2759 (simple_cat, cat, main): Use bool for booleans.
2760 (simple_cat): Use size_t for sizes.
2761 (cat, main): Use the same names for parameters that we use for
2762 long options, to avoid confusion. This inverts the sense of the
2763 show_tabs (formerly output_tabs) and number_nonblank
2764 (formerly numbers_at_empty_lines) variables.
2765 (main): Don't mess up (due to integer overflow) if we are given
2766 INT_MAX - INT_MIN + 1 options.
2767 [O_BINARY]: Don't invoke isatty unless the other options require it.
2768 (main): When deciding whether to use simple_cat, don't worry
2769 about binary option; it's irrelevant.
2771 * src/dcgen: Remove comments, trailing white space, and empty
2772 lines from the output strings, to save space.
2773 Use a narrower type like 'unsigned char' for line lengths, if
2775 Make the output variables static, not extern.
2777 * src/chgrp.c (parse_group): Require base 10 when parsing
2779 (main): int -> bool when appropriate.
2780 * src/chown.c (main): Likewise.
2781 * src/chown-core.c: Include inttostr.h.
2782 (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
2783 (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
2784 instead of uint_to_string).
2785 (describe_change): Instead of an int flag, use a char *
2786 auxiliary; this avoids the need for casts.
2787 Assume free (NULL) works.
2788 (change_file_owner): Return true/false, not 0/-1, since
2789 we don't set errno. All callers changed.
2790 Use bool when appropriate.
2791 (chown_files): Likewise.
2792 * src/chown-core.h (chown_files): Likewise.
2794 * tests/chown/basic: Test for proper handling of uids like
2795 "010", which must be parsed as decimal.
2797 * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
2798 pwd when there are multiple names for the working directory
2799 (which can happen with an automounter, sigh).
2801 * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
2802 this causes Solaris 8 'make' to refuse to build "groups".
2803 (localedir.h): Don't depend on Makefile: this causes Solaris
2804 8 'make' to build localedir.h unnecessarily. The dependence
2805 on Makefile is ineffective anyway, since $(localedir) might
2806 change even if Makefile hasn't.
2808 * src/remove.c (remove_dir): If we can't save the state of the
2809 working directory, pretend we started from "/", not ".".
2810 This avoids a bug on hosts like Solaris that don't let you
2811 remove the working directory.
2813 2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
2815 * src/printf.c (strtiomax, strtoumax): Declare if not already
2816 declared: this fixes a portability bug with Solaris 8 + GCC.
2817 (STRTOX): Parenthesize use of macro arg as expression.
2818 (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
2820 * configure.ac: Check for declaration of strtoumax, for
2823 * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
2824 pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
2826 * tests/readlink/can-e: Don't assume that we can remove the
2827 working directory: this isn't possible under Solaris 8, say.
2828 * tests/readlink/can-f: Likewise.
2829 * tests/readlink/can-m: Likewise.
2831 * src/copy.c (copy_internal): find_backup_file_name no longer
2832 returns NULL, so don't bother to check for this.
2833 * src/cp.c (do_copy): Likewise.
2834 * src/ln.c (do_link): Likewise.
2836 2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
2838 * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
2840 (NZERO): New macro, if system doesn't define it already.
2841 (usage): Distinguish priorities from nice values.
2842 Don't assume NZERO is 20.
2843 (main): Use bool instead of int where appropriate.
2844 If user specifies an adjustment out of range, always truncate it
2845 to an inrange value instead of sometimes giving an error message
2847 Do not assume that -1 is an error return from "nice" or
2848 "getpriority", as it might be the current nice value minus NZERO.
2849 If nice/setpriority fails with errno == EPERM, go ahead and run
2850 the command anyway; POSIX requires this.
2852 * src/pathchk.c: Include euidaccess.h.
2853 (dir_ok): Use euidaccess, not access.
2854 * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
2855 (eaccess): Remove. All users changed to use euidaccess instead.
2857 2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
2859 * src/uptime.c (print_uptime) [defined BOOT_MSG]:
2860 Don't assume ut_line is null-terminated.
2861 * src/who.c (print_line): New arguments USERLEN and LINELEN,
2862 since USER and LINE might not be null terminated. All callers
2865 2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
2867 Fix bug with "tail -f" reported by Rob Holland in
2868 <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
2869 Also, remove the undocumented and unsupported-since-2000
2870 --max-consecutive-size-changes options. Fix another related bug:
2871 "tail" got confused if stdin, stdout, or stderr were closed.
2872 Also, use output buffering even with "tail -f".
2874 * NEWS: Document this, plus yesterday's patch.
2875 * doc/coreutils.texi (tail invocation): "size has remained the same"
2876 -> "file has not changed", which is more accurate for fifos.
2877 * src/tail.c: Include fcntl-safer.h.
2878 (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
2879 (COPY_A_BUFFER): New macro.
2880 (struct File_spec): New members mtime, mode, blocking.
2881 Remove member n_consecutive_size_changes.
2882 (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
2883 max_n_consecutive_size_changes_between_opens,
2884 MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
2885 (long_options, tail_forever, parse_options):
2886 Remove (non-)support for --max-consecutive-size-changes.
2887 (record_open_fd): New function.
2888 (recheck, tail_file): Use it. Don't assume that stdin is open.
2889 (dump_remainder): Add support for new COPY_A_BUFFER special value.
2890 Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
2891 (recheck): New arg BLOCKING, specifying whether to use blocking reads.
2893 (n_live_files): Remove, replacing with...
2894 (any_live_files): New function. All uses changed.
2895 (tail_forever): Use nonblocking I/O unless we know that blocking I/O
2896 is safe; this avoids some hangs when reading from a fifo.
2897 Avoid invoking fstat or sleep when using blocking I/O.
2898 Do not check for changes to size if the file is not a regular file,
2899 as the size is undefined in that case.
2900 Check for changes to mtime or mode, too; this works for non-regular
2902 (tail_forever, main): Redo fflush strategy to work even when input
2903 is nonblocking. Don't use unbuffered output; just flush when needed.
2905 2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
2907 * src/tail.c (main): Ignore -f if no file operand is specified
2908 and standard input is a pipe.
2909 * doc/coreutils.texi (tail invocation): Do not ignore -f for
2910 all pipes, just for when standard input is a pipe and no
2911 file operand is specified.
2912 * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
2913 Add a new commented-out f-2 test, which we still fail.
2914 (test_vector): All f-* tests are special cases, not just f-1.
2916 2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
2918 * src/uptime.c: Include c-strtod.h.
2919 (print_uptime): Use c_strtod instead of setlocale and sscanf.
2920 Use long int rather than int to count days (for 64-bit hosts),
2921 and check for arithmetic overflow when converting double to time_t.
2923 2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
2925 * src/printf.c (vstrtold): Renamed from vstrtod.
2926 Now returns long double. All uses changed.
2927 (print_direc): Use "L" length modifier when printing floating point
2928 numbers, since we're now printing long double.
2930 2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
2932 printf cleanup, to avoid undefined behavior, to add support for
2933 formats that Bash supports, and to support wide integers like
2936 * NEWS: Document this.
2937 * src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
2938 booleans, so that we don't reserve any values for precision or
2940 (STRTOX): Use prototype, not K&R-style definition.
2941 (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
2942 in ../lib), with type change to intmax_t.
2944 (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
2946 (vstrtod): Renamed from xstrtod. All uses changed.
2947 (print_direc): Use boolean arg instead of special value to indicate
2948 a missing precision or width. LENGTH no longer includes
2949 length modifiers or conversion character. New arg CONVERSION
2950 now specifies conversion character.
2951 Use intmax_t-width formatting for integers (like Bash).
2952 Add support for C99 %a, %A, %F (like Bash).
2953 Add support for field width with %c (POSIX requires this).
2954 Add a FIXME for lack of support for field width and precision
2956 Add support for '\'', '0' flags.
2957 Check for invalid combinations of flags, field width, precision,
2958 and conversion, to prevent use of undefined behavior.
2959 Allow multiple length modifiers, for formats like "%lld" (like Bash).
2960 Add support for C99 'j', 't', 'z' length modifiers (like Bash).
2961 In error message, output entire invalid conversion specification,
2962 instead of merely outputting % followed by the conversion char.
2963 * tests/misc/printf: Add tests for the above.
2965 2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
2967 Change "readlink -f" to be more compatible with prior implementations.
2968 Add more canonicalize options, -e and -m.
2969 Add comprehensive tests for all readlink modes.
2971 * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
2972 Do not add canonicalize.c here.
2974 * src/readlink.c (longopts): Add new options.
2975 (usage): Document them.
2976 (canonicalize_fname): New proxy function.
2977 (main): Handle new options.
2978 * doc/coreutils.texi (readlink invocation): Document new
2979 "readlink -f" behaviour and new canonicalize options, -e and -m.
2981 * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
2982 * tests/Makefile.am (SUBDIRS): Add readlink.
2983 * tests/readlink/Makefile.am: New file.
2984 * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
2985 * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
2986 * tests/misc/readlink: Remove file.
2988 2004-07-04 Jim Meyering <jim@meyering.net>
2990 * src/copy.c (copy_internal): Add a FIXME comment.
2992 2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
2994 * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
2995 * src/cp.c (do_copy): Likewise.
2996 * src/mv.c (movefile): Likewise.
2998 * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
2999 to avoid problem when path_concat dir name is longer than 2 GiB (!).
3001 * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3002 This cleans up the semantics a bit, as we no longer try to open the
3005 2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
3007 * NEWS: Add short names -t and -T for --target-directory
3008 and --no-target-directory options, respectively.
3010 * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3011 Remove. All uses changed to 'T' and 't', respectively.
3012 * src/install.c, src/ln.c, src/mv.c: Likewise.
3014 * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3015 aliases for --target-directory and --no-target-directory,
3017 * src/install.c (long_options, main, usage): Likewise.
3018 * src/ln.c, src/mv.c: Likewise.
3020 2004-07-01 Jim Meyering <jim@meyering.net>
3022 * Makefile.maint (sc_file_system): New target.
3023 (syntax-check-rules): Add it.
3024 .x-sc_file_system: New file.
3025 * Makefile.am (EXTRA_DIST): Add it.
3027 * man/sync.x: Use "file system" rather than "filesystem".
3028 * man/stat.x, man/df.x: Likewise.
3030 2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
3032 * src/df.c (usage, main): Output "file system" rather than
3034 * src/du.c (usage): Likewise.
3035 * src/shred.c (usage): Likewise.
3036 * src/stat.c (usage): Likewise.
3037 * src/stat.c (long_options, usage): Rename "--filesystem" to
3038 "--file-system". But keep the old name around, for compatibility
3041 2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
3043 Add support for --no-target-directory option.
3045 * NEWS: Document it.
3046 * doc/coreutils.texi (Common options, Target directory, cp
3047 invocation, install invocation, mv invocation, ln invocation):
3049 (link invocation): Explain how to rewrite link using ln now
3050 that we have --no-target-directory.
3051 (ln invocation): Explain that --no-target-directory subsumes
3053 (unlink invocation): Modify wording to match new wording in
3056 * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3057 (long_opts, usage, do_copy, main): Add support for
3058 --no-target-directory,
3059 * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3061 * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3063 * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3065 * src/mv.c (enum): Sort values.
3067 2004-06-29 Jim Meyering <jim@meyering.net>
3069 Don't let verbose-mode output from a subshell obscure actual differences.
3070 * tests/rm/inaccessible: Turn off command-echoing just before
3071 invoking subshell, then turn it back on if VERBOSE=yes afterward.
3073 2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
3075 Add support for 'install --target-directory', an option
3076 that has been documented for years but not implemented (!).
3077 * doc/coreutils.texi (install invocation): Document
3078 --target-directory in synopsis, too.
3079 * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3080 (long_options, main, usage): Add --target-directory.
3081 (target_directory_operand): New function, stolen from mv.c.
3082 (main): Use it. Check for -d and --target-directory.
3083 Alter wording of diagnostics to match other programs.
3085 2004-06-28 Jim Meyering <jim@meyering.net>
3087 * src/cp.c (usage): Fix copy+paste error in description of
3088 --target-directory: s/move/copy/. From Paul Jarc.
3090 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
3092 Use more-consistent rules among cp, ln, and mv when dealing with
3093 last operands that are (or look like) directories.
3095 * src/cp.c (target_directory_operand): New, nearly-common function,
3096 It reports an error if the destination appears to be a directory
3097 (e.g., because it has a trailing slash) but is not.
3098 * src/ln.c, src/mv.c: Likewise.
3099 * src/cp.c (do_copy): Use it.
3100 * src/ln.c (main): Likewise.
3101 * src/mv.c (main): Likewise.
3103 * src/cp.c (do_copy): Don't assume argc is positive.
3104 Don't bother to lstat dest, since copy() will do that for us.
3105 Use "const" to avoid the need for cast.
3107 * src/cp.c (do_copy): Don't output a usage message because of file
3108 problems (e.g., an operand is not a directory). Use it only for
3109 syntax. Standardize on "target %s is not a directory" for the
3111 * src/ln.c (main): Likewise.
3112 * src/mv.c (main): Likewise.
3114 * src/cp.c (do_copy): Remove test for trailing slash, since
3115 target_directory_operand now does this.
3116 * src/ln.c (main): Likewise.
3117 * src/mv.c (movefile): Likewise.
3119 * src/cp.c (main): Reject multiple target directories.
3120 Check whether a specified target is a directory when parsing the
3121 options, using stat. This gives more-accurate diagnostics.
3122 * src/ln.c (main): Likewise.
3124 * src/ln.c (isdir): Remove decl; no longer needed.
3125 * src/mv.c (isdir, lstat): Likewise.
3127 * src/ln.c (do_link): New arg dest_is_dir. All uses changed.
3128 Don't check the destination ourself; rely on dest_is_dir.
3129 This way we can avoid lstatting the destination in the
3130 usual case, and in the worst case we lstat 1, not 3 times.
3131 Don't bother to unlink unless link failed; this saves a syscall.
3132 Remove unnecessary backup_succeeded flag;
3133 it was identical to "dest_backup != NULL".
3135 * src/ln.c (main): Use int to count to argc, not unsigned int.
3136 This handles negative operand counts.
3137 * src/mv.c (main): Likewise.
3139 * src/mv.c (do_move): Don't call hash_init; expect the caller to
3140 do it, for consistency with cp.c and ln.c. All callers changed.
3141 (movefile): dest_is_dir parameter is now bool, not int.
3142 (main): Standardize on "missing destination file operand after %s"
3143 for the diagnostic, for consistency with cp.c.
3145 * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3146 will complain about the arg count.
3147 Adjust to new (briefer) diagnostics.
3148 * tests/cp/fail-perm: Add a test to verify that we get the new
3149 diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3151 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
3153 Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3154 d/" incorrectly created a link d/x/x. It also saves some system
3157 * NEWS: Document the fix.
3159 * src/ln.c (main): Don't append basename to dest if this
3160 results in an existing directory name.
3161 * tests/ln/misc: See whether a trailing slash is followed too far.
3163 2004-06-26 Jim Meyering <jim@meyering.net>
3165 * src/printf.c (main): When given no arguments, print the standard
3166 "missing operand\nTry printf --help..." message -- to be consistent.
3168 2004-06-26 Jim Meyering <jim@meyering.net>
3170 * src/mknod.c (main): Add \n at the end of message output via fprintf.
3172 2004-06-25 Jim Meyering <jim@meyering.net>
3174 * tests/ln/misc: Add test for ln subscript error.
3176 2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
3178 * src/ln.c (do_link): Remove unnecessary call to lstat.
3179 (main): Avoid subscript error when the destination is "".
3181 2004-06-23 Jim Meyering <jim@meyering.net>
3183 * tests/*: Replace all occurrences of `(exit N); exit' with
3184 `(exit N); exit N'. Otherwise, those many tests could exit with
3185 improper exit status when exiting via e.g., a trapped interrupt.
3186 Thanks to a report from Bob Proulx.
3188 2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
3190 * src/who.c (idle_string, print_user): New arg boottime,
3191 specifying the most recent boot time. All uses changed.
3192 (idle_string) Consider a line to be "old" if it hasn't been used
3193 since the last boot time. Watch out for overflow when computing
3194 times, and for times in the future.
3195 (idle_string): Record latest boot time.
3197 2004-06-22 Jim Meyering <jim@meyering.net>
3199 * src/test.c (usage): Correct description of `-t FD'. The file
3200 descriptor, FD, is no longer optional. Reported by Ton Nijkes.
3202 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
3204 The 2004-06-19 fix for who and pinky was incomplete, as ctime
3205 has undefined behavior if the year precedes -999 or follows 9999.
3206 Since we have to stop using ctime anyway, we might as well use
3207 strftime and fix the FIXME, and support internationalized dates.
3209 * NEWS: Document the new behavior.
3210 * src/who.c: Include "hard-locale.h".
3211 (time_format, time_format_width): New vars.
3212 (time_string, print_line): Use them.
3214 (time_string): Use localtime + strftime instead of
3215 ctime, to avoid problems with years before -999 or after 9999.
3216 * src/pinky.c: Likewise.
3218 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
3220 Fix bug: GNU 'ls' didn't count columns correctly if user or group
3221 names contained multibyte characters where the column count
3222 differed from the byte count. This patch also corrects
3225 * src/ls.c (format_user_or_group): New function, which counts
3227 (format_user, format_group): Use it.
3228 (format_user_or_group_width): New function, which counts columns
3230 (format_user_width, format_group_width): Use it.
3232 2004-06-21 Jim Meyering <jim@meyering.net>
3234 * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3235 Suggestion from Andreas Schwab.
3237 * tests/priv-check: When running as root, be sure to propagate
3238 PATH through to the process we exec as non-root.
3239 Reported by michael@aplatform.com.
3241 * src/mknod.c (main): Don't segfault when calculating the
3242 expected number of operands for `mknod NAME'.
3244 2004-06-20 Jim Meyering <jim@meyering.net>
3246 * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3248 2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
3250 * src/basename.c (main):
3251 Standardize on the diagnostics given when someone gives
3252 too few operands ("missing operand after `xxx'") or
3253 too many operands ("extra operand `xxx'").
3254 Include "quote.h" and/or "error.h" if it wasn't already being included.
3255 * src/chgrp.c (main): Likewise.
3256 * src/chmod.c (main): Likewise.
3257 * src/chown.c (main): Likewise.
3258 * src/chroot.c (main): Likewise.
3259 * src/comm.c (main): Likewise.
3260 * src/cp.c (do_copy): Likewise.
3261 * src/csplit.c (main): Likewise.
3262 * src/date.c (main): Likewise.
3263 * src/dircolors.c (main): Likewise.
3264 * src/dirname.c (main): Likewise.
3265 * src/du.c (main): Likewise.
3266 * src/expr.c (main): Likewise.
3267 * src/hostid.c (main): Likewise.
3268 * src/hostname.c (main): Likewise.
3269 * src/id.c (main): Likewise.
3270 * src/install.c (main): Likewise.
3271 * src/join.c (add_file_name, main): Likewise.
3272 * src/link.c (main): Likewise.
3273 * src/ln.c (main): Likewise.
3274 * src/logname.c (main): Likewise.
3275 * src/md5sum.c (main): Likewise.
3276 * src/mkdir.c (main): Likewise.
3277 * src/mkfifo.c (main): Likewise.
3278 * src/mknod.c (main): Likewise.
3279 * src/mv.c (main): Likewise.
3280 * src/nohup.c (main): Likewise.
3281 * src/od.c (main): Likewise.
3282 * src/pathchk.c (main): Likewise.
3283 * src/ptx.c (main): Likewise.
3284 * src/readlink.c (main): Likewise.
3285 * src/rm.c (main): Likewise.
3286 * src/rmdir.c (main): Likewise.
3287 * src/seq.c (main): Likewise.
3288 * src/setuidgid.c (main): Likewise.
3289 * src/shred.c (main): Likewise.
3290 * src/sleep.c (main): Likewise.
3291 * src/sort.c (main): Likewise.
3292 * src/split.c (main): Likewise.
3293 * src/stat.c (main): Likewise.
3294 * src/test.c (beyond, main): Likewise.
3295 * src/touch.c (main): Likewise.
3296 * src/tr.c (main): Likewise.
3297 * src/tsort.c (main): Likewise.
3298 * src/tty.c (main): Likewise.
3299 * src/uname.c (main): Likewise.
3300 * src/uniq.c (main): Likewise.
3301 * src/unlink.c (main): Likewise.
3302 * src/uptime.c (main): Likewise.
3303 * src/users.c (main): Likewise.
3304 * src/who.c (main): Likewise.
3305 * src/whoami.c (main): Likewise.
3307 * tests/basename/basic: Adjust to new diagnostics.
3308 * tests/du/files0-from: Likewise.
3309 * tests/expr/basic: Likewise.
3310 * tests/mv/diag: Likewise.
3311 * tests/tsort/basic-1: Likewise.
3313 2004-06-20 Jim Meyering <jim@meyering.net>
3315 * src/ln.c: Remove declaration of yesno.
3316 Instead, include yesno.h.
3317 * src/copy.c: Likewise.
3319 * src/remove.c: Remove declaration of yesno.
3320 Instead, include yesno.h.
3321 (top_dir): Remove now-unnecessary cast of obstack_base.
3322 (pop_dir): Likewise.
3323 (full_filename_): Likewise.
3325 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
3327 Don't dump core if ctime returns NULL; this is possible on
3328 hosts with 64-bit time_t and 32-bit int.
3329 * src/who.c: Include "inttostr.h".
3330 (time_string): If ctime fails, print the raw time as an integer
3331 instead of dumping core.
3332 * src/pinky.c: Likewise, as follows:
3333 Include "inttostr.h".
3334 (time_string): New function, copied from who.c.
3335 (print_entry): Use it.
3337 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
3339 * src/who.c (print_line): Don't truncate user names at 8 bytes.
3340 Problem reported by Guido Leenders in:
3341 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3342 * NEWS: document this.
3344 2004-06-19 Jim Meyering <jim@meyering.net>
3346 * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3347 using GNU_PACKAGE (from PACKAGE) once again. This restores
3348 `GNU' to the parenthesized package name in --version output.
3349 Before, the first argument from AC_INIT, `GNU coreutils', would
3350 be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
3351 Reported by Richard Stallman.
3353 2004-06-17 Jim Meyering <jim@meyering.net>
3355 * src/tr.c (to_uchar): Rename function from `uchar'. The latter
3356 would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
3358 2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
3360 * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3361 allows the GNU behavior. "--" is now supported by chroot, hostid,
3362 hosname, pwd, sync, yes.
3363 * doc/coreutils.texi (yes invocation, false invocation,
3364 true invocation): Document this.
3365 * src/chroot.c (main): Handle "--".
3366 * src/hostid.c (main): Likewise.
3367 * src/hostname.c (main): Likewise.
3368 * src/pwd.c (main): Likewise.
3369 * src/sync.c (main): Likewise.
3370 * src/yes.c (main): Likewise.
3371 * src/true.c (main): Recognize --help and --version even if
3372 POSIXLY_CORRECT is set.
3373 * src/yes.c (main): Likewise.
3375 2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
3377 * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3379 * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3380 * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3381 POSIXLY_CORRECT is set. POSIX reserves upper-case environment
3382 variables to the implementation, so it's OK for ls to depend on
3384 * src/pr.c: Include "hard-locale.h".
3385 (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3386 POSIX specifies the behavior only in the POSIX locale.
3387 * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3388 since POSIX says the behavior is unspecified here.
3389 * src/tail.c (parse_obsolescent_option): Support multiple file operands
3390 even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3391 * src/printf.c (main): Recognize --help, --version even if
3392 POSIXLY_CORRECT. POSIX does not specify any options, but it
3393 does not prohibit options either, so "printf" is like "expr" here.
3394 * src/unlink.c (main): Likewise.
3395 * tests/misc/printf: Adjust to the new semantics for \x if
3398 2004-06-14 Jim Meyering <jim@meyering.net>
3400 * tests/misc/pwd: New test, for fix of 2004-04-19.
3401 * tests/misc/Makefile.am (TESTS): Add pwd.
3402 (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3404 * src/copy.c: Remove declaration of euidaccess.
3405 Instead, include "euidaccess.h".
3407 2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
3409 * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3410 (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3411 as (sizeof "??") reliably returns 3.
3412 (print_line): Guard against idle and pid being too long
3413 (which is possible when printing headers).
3414 (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
3415 Avoid unnecessary cast of sizeof to int.
3416 (make_id_equals_comment): Do not assume that UT_ID returns
3417 a string; it might return a non-null-terminated array.
3418 Use strncat instead. It's not very often where strncat is
3419 exactly what you want, but this is one of those rare cases.
3421 2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
3423 * src/who.c (list_entries_who): Don't output a trailing space.
3425 2004-06-09 Jim Meyering <jim@meyering.net>
3427 * src/touch.c (usage): Improve wording in description of the
3428 --time=WORD option. Reported by Dan Jacobson.
3430 * src/chown-core.c (change_file_owner): Change names of parameters
3431 old_uid and old_gid to required_uid and required_gid respectively.
3433 * src/chmod.c (mode_changed): Return false, not 0, now that the
3434 function returns `bool'.
3436 2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
3438 Adjust chmod and chown to be similar if -c or -v are given. In
3439 particular, a no-op chown is no longer reported as a change; this
3440 reverts to previous behavior. Also, fix both commands so that -v
3441 report failures even if the failure is not due to the chmod or
3444 * src/chmod.c (CH_NOT_APPLIED): New constant.
3445 (describe_change): Handle it.
3446 (process_file): Use it, if a symlink wasn't changed.
3447 (mode_changed): Return bool, not int. Accept new argument
3448 NEW_MODE; all callers changed. This lets us avoid statting the
3449 file unless the new mode has unusual bits.
3450 (process_file): Return -1 on error. With -v, report all errors
3451 verbosely, not just some.
3453 * src/chown-core.c (change_file_owner): Return -1 on error, not
3454 1 sometimes and -1 on others. Our caller ORs together our results,
3455 and (-1 | 1) == 0 on ones-complement hosts.
3456 With -v report all errors verbosely, not just some.
3457 Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3458 file_stats wasn't set properly in that case.
3460 * tests/chgrp/basic: Adjust to above changes.
3462 2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
3464 * tests/chgrp/basic: Test that chgrp -h does not fail on
3465 symlinks, even on hosts where that's not supported.
3466 Test that if -R is specified without -H or L, -h is assumed.
3467 Test that chown() is not optimized away.
3469 2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
3471 Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3473 Check for incompatible options. When -R and --dereference are
3474 both used, then either -H or -L must also be used. When -R and -h
3475 are both used, then -P must be in effect.
3477 -H, -L, and -P have no effect unless -R is also specified.
3478 If -P and -R are both specified, -h is assumed.
3480 Do not optimize away the chown() system call when the file's owner
3481 and group already have the desired value. This optimization was
3482 incorrect, as it failed to updated the last-changed time and reset
3483 special permission bits, as POSIX requires.
3485 Do not report an error if the owner or group of a
3486 recursively-encountered symbolic link cannot be updated because
3487 the file system does not support it.
3489 * NEWS: Document the above.
3491 * src/chgrp.c (main): Check for incompatible options. -R --dereference
3492 requires either -H or -L, and -R -h requires -P. If -H, specify
3493 FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
3494 file as much like chown.c as possible.
3495 * src/chown.c (main): Likewise.
3497 * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3498 needed. Chown a directory only after chowning its children; this
3499 avoids problems if the new directory ownership doesn't permit
3500 access to the children. Dereference symlinks before doing
3501 ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3502 Do not optimize away the chown() system call when the file's owner
3503 and group already have the desired value. POSIX does not permit
3504 this optimization. Rely on chown and lchown to do the right
3505 thing with symlinks and/or -1 arguments, now that we have wrappers
3506 to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3507 errors, not just command-line errors.
3508 (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3510 * src/system.h (ENOTSUP): Remove.
3512 * tests/chgrp/basic: Use chown --from to discover whether the
3513 group changed, since chgrp now changes unconditionally. This
3514 complicates the sed script a bit. Do not specify --dereference,
3515 since it's the default (and we want to test this). Adjust output
3516 to match the fact that chgrp no longer optimizes the case of
3517 changing a file's group to the same value as before.
3518 * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3519 options are incompatible, and their behavior is undefined with POSIX.
3520 (changed, not_changed): Adjust to match the fact that -h is no longer
3521 specified. Sort names.
3522 * tests/chown/deref: Adjust error-diagnostic spelling to match new
3525 2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
3527 * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3528 prevented a diagnostic of any operands.
3530 2004-06-08 Jim Meyering <jim@meyering.net>
3532 * src/shred.c (direct_mode): Turn it on/off with directio, too.
3534 2004-06-07 Jim Meyering <jim@meyering.net>
3536 Enable direct-mode I/O (bypassing the buffer cache), if possible.
3537 Prompted by a suggestion from Kalle Olavi Niemitalo
3538 in http://bugs.debian.org/207035.
3539 * src/shred.c (direct_mode): New function.
3540 (do_wipefd): Turn on direct-mode I/O.
3541 (dopass): If a file's first write fails with EINVAL,
3542 turn off direct-mode I/O and retry the write.
3544 2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
3546 * src/tr.c (main): "tr -d a b" is now a fatal error even if
3547 POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
3550 2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
3552 * src/shred.c (dopass): Don't subtract 1 from the offset after
3553 a write error. Problem reported by Jon Peatfield in:
3554 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3556 2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
3558 Fix bug reported by Buciuman Adrian in
3559 <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3560 where 'dd' created a file that was too large. The bug was that dd
3561 assumed that the input file offset does not advance after a failed
3562 read; but POSIX says that the input file offset is undefined after
3565 * src/dd.c (MAX_BLOCKSIZE): New macro.
3566 (input_seekable, input_seek_errno, input_offset,
3567 input_offset_overflow): New vars.
3568 (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3569 (advance_input_offset): New function.
3570 (skip_via_lseek): Set errno to zero when reporting our failure,
3571 so that we don't report based on garbage errno.
3572 (skip): If fdesc is standard input, advance the input offset.
3573 Do not quit if reading, and if noerror was specified;
3574 POSIX seems to require this.
3575 If read fails on output file, report the earlier lseek failure
3576 instead; this fixes a FIXME in dd_copy.
3577 (advance_input_after_read_error): New function.
3578 (dd_copy): Use it, instead of assuming that failed reads
3579 do not advance the file pointer. Advance input offset
3580 after nonfailed reads. Advance only a partial block if
3581 the previous read (before the failed read) succeeded, and
3582 do not generate an output block of zeros in this case.
3583 (main): Determine initial input offset, seekability of input,
3584 and error if it wasn't seekable.
3586 2004-06-02 Jim Meyering <jim@meyering.net>
3588 rm (without -f) could hang unnecessarily when attempting to
3589 remove a symlink to a file on an off-line NFS-mounted partition.
3590 Reported by David Howells in https://bugzilla.redhat.com/124699.
3591 * src/remove.c (write_protected_non_symlink): New function.
3592 Don't invoke euidaccess on symlinks.
3593 (prompt): Use write_protected_non_symlink rather than using
3594 euidaccess directly, being careful not to call lstat twice for a file.
3596 Fix a bug in how the --output-delimiter=D option works with
3597 abutting byte or character ranges. Reported by David Krider in
3598 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3599 * src/cut.c (print_kth): Remove special case for open-ended range.
3600 (set_fields): Record the range start index for an interval even
3601 when it abuts another interval on its low side.
3602 Also record the range start index of the longest right-open-interval.
3603 * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3604 abutting and overlapping byte ranges.
3606 2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
3608 Some POSIX-conformance cleanups for tr.
3610 * src/tr.c (posix_pedantic): Remove; no longer needed since
3611 we need to test this in just one place now.
3612 (usage): Mention -C.
3613 (unquote): Note that \055, \n, etc are escaped.
3614 Do not worry about POSIXLY_CORRECT when warning about ambiguous
3616 \ at end of string stands for itself.
3617 Do not diagnose invalid backslash escapes: POSIX says the behavior
3618 is unspecified in this case, so we don't need to diagnose it.
3619 (main): Add support for -C (currently an alias for -c).
3620 Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3622 * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3623 Fix comment for range-a-a.
3625 2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
3627 Improve the efficiency (and in one case, correctness) of code
3628 that reads symlinks.
3630 * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3631 royally if the link length is long (e.g., GNU/Hurd). Use
3632 xreadlink instead, it's safer. Don't bother to read the link if
3633 it's the wrong size. Add a FIXME because this area is a bit murky
3635 * src/ls.c (get_link_name): Update use of xreadlink.
3636 * src/readlink.c (main): Likewise.
3637 * src/stat.c (print_stat): Likewise.
3639 2004-06-01 Jim Meyering <jim@meyering.net>
3641 * src/env.c (main): Prefer the notation `STREQ (a, b)'
3642 over `!strcmp (a, b)'.
3643 * src/sort.c (main, sort_buffer_size): Prefer the notation
3644 `STREQ (a, b)' over `strcmp (a, b) == 0'.
3645 * src/date.c (batch_convert): Likewise.
3646 * src/expr.c (nextarg): Likewise.
3647 * src/su.c (correct_password, restricted_shell, main): Likewise.
3648 * src/ptx.c (swallow_file_in_memory, main): Likewise.
3649 * src/test.c (binary_operator, and, or, main): Likewise.
3651 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
3653 * NEWS: echo compatibility cleanup.
3654 * doc/coreutils.texi (echo invocation): Document the changes.
3655 * src/echo.c (V9_ECHO): Remove; always enabled.
3656 (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3657 we use the same naming convention as bash. Now an enum,
3659 (usage): Reword to mention -e/-E more accurately.
3660 Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3661 (hextobin): New function.
3662 (main): Use bool rather than int for local vars when appropriate.
3663 Do not allow options if POSIXLY_CORRECT, unless we are using
3664 BSD semantics and the first argument is "-n".
3665 Don't pass unnecessary extra arg to parse_long_options.
3666 do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3667 Do not look for options if !allow_options.
3668 Use size_t rather than int when appropriate.
3669 Open-code option test rather than using strrchr.
3670 Use faster test for "-".
3671 Avoid redundant argc test.
3672 Add support for \x, for Bash compatibility.
3673 Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3674 When '\c' is encountered, stop printing immediately, as POSIX
3676 Add support for \xhh syntax.
3677 Add support for \0ooo syntax; POSIX requires this.
3679 2004-06-01 Jim Meyering <jim@meyering.net>
3681 * Use automake-1.8b. Regenerate dependent files.
3683 2004-05-31 Jim Meyering <jim@meyering.net>
3685 * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3686 the build src/ directory -- at the front.
3687 ($(srcdir)/$x-tests): Depend on Makefile.am.
3688 Use $x as the program name, except when it would be `test' (test is
3689 the sole program tested via mk-script that is also a shell built-in).
3690 In that case, use the old ../../src/$x.
3692 2004-05-30 Jim Meyering <jim@meyering.net>
3694 Work around HPUX /bin/cc compiler bug that is exposed, now that
3695 sets are arrays of type `bool'. More details here:
3696 http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
3697 FIXME: verify that the above URL points to the right message
3699 * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
3700 rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
3701 (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
3702 system, those two expressions are not the same (256 vs. 1024).
3703 The effect of this problem was that `tr -c x y' would fail:
3704 tr: when not truncating set1, string2 must be non-empty
3705 (set_initialize): Remove unnecessary initialization of the `in_set'
3706 buffer; that initialization triggered the same compiler bug as above.
3708 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
3710 tr cleanup, mostly having to do with integer type ranges.
3713 * tests/tr/Test.pm: Add a few tests for the below. Alas, most of
3714 the test cases wouldn't be portable, or would take too much CPU
3717 * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
3718 This is safe since the code already assumes N_CHARS fits in int.
3719 (Filter): Remove: we want to prototype everything.
3720 (ORD, CHR): Remove. All uses removed. Some replaced with:
3721 (uchar): New function. All places where a char must be converted
3722 to an unsigned char are now done this way, not by ad-hoc methods.
3723 (count): New type. Use it whenever counts or states are needed.
3724 (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
3725 since we used it in an unsigned int context) to UINTMAX_MAX - 1.
3726 (REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
3727 whenever appropriate.
3728 (NOT_A_CHAR): Remove global macro; now a local enum.
3729 (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
3730 the rest of the code no longer depends on them.
3731 (class_ok): Remove; all uses changed to use inline comparisons.
3732 (RE_NO_TYPE): Remove; wasn't used or needed.
3733 (struct List_element): normal_char and equiv_code are now unsigned
3735 first_char, last_char, and the_repeated_char are now unsigned char,
3736 not unsigned int. repeat_count is now count, not size_t.
3738 (struct Spec_list): state is now count, not unsigned int.
3739 lengthis now count, not size_t.
3740 n_indefinite_repeats is now size_t, not int.
3741 has_equiv_class, has_char_class, and has_restricted_char_class
3742 are now bool, not int. All uses changed.
3743 (struct E_string): s is now char *, not unsigned char *.
3744 escaped is now bool *, not int *. All uses changed.
3745 (ES_MATCH): Remove macro, replacing with:
3746 (es_match): New inline function. All uses changed.
3747 (squeeze_repeats, complement, posix_pedantic, truncate_set1,
3748 translating): Now bool, not int.
3749 (io_buf): Now char array, not unsigned char.
3750 (SET_TYPE): Remove. All uses replaced with bool.
3751 (is_equiv_class_member, unquote, append_range, append_char_class,
3752 append_equiv_class, find_closing_delim, star_digits_closebracket,
3753 build_spec_list, parse_str, homogeneous_spec_list):
3754 Now returns bool, not int. All uses changed.
3755 (is_equiv_class_member): Now inline.
3756 (is_equiv_class_member, is_char_class_member, make_printable_str,
3757 append_normal_char, append_range, append_repeated_char,
3759 Args are now of proper integer type.
3760 (unquote, look_up_char_class, make_printable_str,
3761 append_equiv_class, build_spec_list, squeeze_filter):
3762 Avoid unsigned char *p; gently convert *p to unsigned char instead.
3763 (unquote, get_spec_stats): Do not jump past declarations and then
3764 use them; C doesn't allow this in portable programs.
3765 (make_printable_str): Check for overflow in size calculations.
3766 (xmemdup): Remove. All uses rewritten.
3767 (find_bracketed_repeat): Args are now of proper pointer-to-integer
3768 type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
3769 (find_bracketed_repeat, star_digits_closebracket): Check that the
3770 digits are not escaped.
3771 (build_spec_list): Don't bother to copy opnd_str; not needed.
3772 (build_spec_list, get_next): Simplify internal logic a bit.
3773 (card_of_complement): Fix bug due to char overflow.
3774 (get_spec_stats): Don't assume len fits into int.
3775 Check for integer overflow. Use abort() rather than assert(0).
3776 (string2_extend): Fix subscript error: is_char_class_member (..., 255)
3778 (squeeze_filter): READER is never null now; simplify code.
3779 READER arg now has a simpler type. Remove unnecessary casts.
3780 (squeeze_filter, main): Calls to fwrite improperly checked result
3781 against zero, rather than against requested size.
3782 (plain_read): New function.
3783 (read_and_delete, read_and_xlate):
3784 Remove unused filter arg, and don't worry about hit_eof.
3785 Simplify by using plain_read.
3786 (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
3787 (main): Always pass a non-null procedure to squeeze_filter.
3788 Rewrite so that class_ok isn't needed.
3790 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
3792 * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
3793 fdatasync reports EBADF when syncing (unwritable) directories.
3794 Problem reported by Albert Chin-A-Young in:
3795 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
3797 2004-05-29 Jim Meyering <jim@meyering.net>
3799 * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
3800 Patch from Albert Chin.
3802 * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
3804 * src/remove.c (push_dir): Merge declaration and adjacent assignment
3805 into a single statement.
3807 2004-05-28 Jim Meyering <jim@meyering.net>
3809 * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
3811 2004-05-22 Jim Meyering <jim@meyering.net>
3813 rm -r would get a failed assertion when run from an inaccessible
3814 directory and with two or more command line arguments including an
3815 absolute-named directory followed by a relative-named directory.
3817 * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
3818 * src/remove.c (struct cwd_state): Define.
3819 (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
3820 can be detected by the caller. Instead of returning a malloc'd
3821 directory name, communicate it to caller via a new parameter, and
3822 return an indication of whether restore_cwd failed. Update caller.
3823 Eliminate an unnecessary call to AC_stack_top.
3824 (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
3825 so we can now communicate to caller whether/how functions like
3826 restore_cwd have failed. Update caller.
3827 (rm_1): Fail if we've failed to restore the working directory
3828 and the name of the next file to remove is `.'-relative.
3829 (rm): Fail if the require_restore_cwd flag is true and we've
3830 failed to restore the working directory.
3831 * src/mv.c (rm_option_init): Initialize new member,
3832 x->require_restore_cwd.
3833 * src/rm.c (rm_option_init): Likewise.
3835 2004-05-21 Jim Meyering <jim@meyering.net>
3837 * tests/rm/inaccessible: New test for the above fix.
3838 * tests/rm/Makefile.am (TESTS): Add inaccessible.
3840 * src/remove.c (rm): Use free rather than XFREE.
3841 (remove_dir): Use xmalloc, not XMALLOC.
3842 (ds_init): Likewise.
3844 2004-05-20 Jim Meyering <jim@meyering.net>
3846 * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
3847 diagnostics in shred.c have been fixed, don't exempt shred.c from
3850 * src/shred.c: Use translatable diagnostics, e.g.
3851 change "%s: remove" to _("%s: failed to remove") and
3852 change "%s: close" to _("%s: failed to close").
3854 2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
3856 * src/shred.c (names): Bring back lower-case letters, "_", and
3857 ".". But continue to omit +, =, %, @, #, as they're either
3858 shell metacharacters (for some shells) or are not in some
3859 character sets, or (in the case of '%') must be a
3860 metacharacter somewhere.
3862 2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
3864 * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
3866 2004-05-17 Jim Meyering <jim@meyering.net>
3868 * src/shred.c (incname): Decrement `len' only once per loop iteration.
3870 chgrp and chown now dereference symlinks by default, per POSIX.
3871 Reported by Michal Politowski as http://bugs.debian.org/249177.
3873 * src/chown-core.c (chopt_init): Affect each symlink referent by default.
3874 * src/chown.c (usage): Update to reflect this.
3875 * src/chgrp.c (usage): Likewise.
3876 * NEWS: Describe the change.
3877 Adapt tests accordingly.
3878 * tests/chgrp/basic: Use -h where necessary to retain semantics.
3879 * tests/chgrp/deref: Likewise.
3880 * tests/chgrp/posix-H: Likewise.
3882 2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
3884 In shred, check for errors from fdatasync more carefully. If
3885 fdatasync fails with errno==EINVAL, it means this implementation
3886 does not support synchronized I/O for this file. Do not report
3887 this as an error, as (for example) AIX 5.2 fdatasync reports it
3888 for raw disk devices. Problem reported by Albert Chin in
3889 <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
3891 Check for write errors, though: the old code ignored them.
3892 Improve error checking in a few other cases, too (e.g., close of a
3895 Also, change several 'int' values to 'bool', so that the error
3896 checking is a bit clearer. Similarly, change unsigned values
3897 to size_t where appropriate.
3899 * src/shred.c: Include "dirname.h".
3900 (datasync) [!HAVE_FDATASYNC]: Remove.
3901 (dosync): New function.
3902 (dopass): Use it. Return 1 on write error, -1 on other error.
3903 All callers changed. Report write error if dosync does.
3904 (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
3905 not int (0/-1). All callers changed. Return false if there's a
3907 (incname): Return bool (true/false), not int (0/1). Accept
3908 size_t length, not unsigned. All callers changed. Do not
3909 bother checking for non-digits; it can't happen. Replace
3910 recursion with iteration.
3911 (wipename): Use dir_name, base_name, etc. instead of assuming
3912 Unix file names. Use size_t for length, not unsigned.
3913 Report error if unlink or close fails.
3914 (wipename, main): Use bool for booleans.
3916 (names): Use only digits and uppercase letters, for greater
3919 2004-05-16 Jim Meyering <jim@meyering.net>
3921 * tests/chown/deref: New test for the yesterday's change.
3922 * tests/chown/Makefile.am (TESTS): Add deref.
3924 2004-05-15 Jim Meyering <jim@meyering.net>
3926 chown --dereference did nothing when the owner/group of a
3927 symlink matched the desired owner/group. Reported by David Malone.
3928 Also reported in 1999 as http://bugs.debian.org/39642.
3930 * src/chown-core.c (change_file_owner): When --dereference has
3931 been specified, and when processing a symlink, stat it to get the
3932 owner and group of the referent.
3934 2004-05-14 Jim Meyering <jim@meyering.net>
3936 * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
3937 s/supercede/supersede/ reported by Andrew Fabbro.
3939 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
3941 Improve performance of `sort -m' on large files, at the cost of
3942 making some contrived examples unsafe. POSIX allows this
3943 optimization. Performance problem reported by Jonathan Baker in
3944 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
3946 * src/sort.c (first_same_file): Do not treat input pipes
3947 differently from other files.
3948 * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
3949 might write F before reading all the input.
3952 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
3954 * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
3955 '\007', for portability to EBCDIC hosts.
3956 * src/printf.c (print_esc_char): Likewise.
3957 * src/tr.c (unquote, make_printable_str): Likewise.
3959 2004-05-12 Jim Meyering <jim@meyering.net>
3961 * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
3962 where the result is used. This avoids one unnecessary lstat call
3963 per command line argument.
3965 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
3967 Don't assume that "make -C" works; Solaris "make" doesn't have -C.
3969 * src/Makefile.am (all_programs.list): New rule, copied from
3970 man/Makefile.am and tests/Makefile.am, except that we use the
3971 system tr rather than ./tr and we don't use tr -s.
3972 * tests/Makefile.am (all_programs): Use it.
3973 * man/Makefile.am (all_programs): Likewise. Renamed from programs,
3974 for consistency. All uses changed.
3976 2004-05-11 Jim Meyering <jim@meyering.net>
3978 * tests/rm/unread3: New test, for the above fix and today's
3979 lib/save-cwd.c improvement.
3980 * tests/rm/Makefile.am (TESTS): Add unread3.
3982 * src/rm.c: Don't include "save-cwd.h". It's no longer used.
3984 2004-05-10 Jim Meyering <jim@meyering.net>
3986 * tests/install/trap: New file. Test for bug fix of 2004-04-18.
3987 * tests/install/Makefile.am (TESTS): Add trap.
3989 * src/remove.c (AD_push): Don't use errno in diagnostic about
3992 Remove these generated files from CVS.
3993 * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
3994 * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
3995 * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
3996 * tests/tr/tr-tests, tests/wc/wc-tests:
3998 2004-05-09 Jim Meyering <jim@meyering.net>
4000 * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4001 a loop initializing the just-allocated memory to zero.
4003 2004-05-08 Jim Meyering <jim@meyering.net>
4005 * tests/rm/no-give-up: New file; check for today's fix.
4006 * tests/rm/Makefile.am (TESTS): Add no-give-up.
4008 2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
4010 Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4011 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4013 * src/remove.c (remove_entry): Check for errno values like ENOENT
4014 that show the file cannot be directory, instead of for errno
4015 values like EPERM that show the file might be a directory. This
4016 is necessary because, when a single unlink() call has multiple
4017 reasons to fail, it can set errno to any of those reasons; it's
4018 only the rare errno value like ENOENT that excludes all the other
4019 possible reasons to fail even when the file is a directory.
4020 (remove_cwd_entries): Don't attempt chdir if the file is known
4021 to not be a directory.
4022 (remove_dir): Use the same method that remove_cwd_entries uses
4023 (for some reason they differed). Don't assert that saved_errno
4024 must be EPERM; it might be just about anything.
4026 2004-05-06 Jim Meyering <jim@meyering.net>
4028 * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4029 Don't add `1' to the buffer size (it was to protect against malloc
4030 implementations that fail to allocate a buffer of size zero).
4031 That is no longer necessary, since we use a malloc wrapper
4034 * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4035 * src/head.c (elide_tail_bytes_pipe): Likewise.
4036 * src/df.c (main): Likewise.
4037 * src/shred.c (do_wipefd): Likewise.
4038 * src/users.c (list_entries_users): Likewise.
4039 * src/tail.c (main): Likewise.
4040 * src/md5sum.c (main): Likewise.
4042 2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
4044 * src/df.c (show_disk, show_point): If several filesystems are
4045 mounted on the same mount point, prefer the last one, not the first.
4046 Problem reported by Christian Jones in
4047 <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4048 (show_disk): Remove unused statp arg. Return bool, not int.
4049 (show_point): Rewrite to avoid gotos. Use the same algorithm
4050 for lofs and dummies for each pass through the mount table,
4051 rather than subtly different algorithms (which are probably
4054 2004-05-03 Jim Meyering <jim@meyering.net>
4056 * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4059 2004-05-01 Jim Meyering <jim@meyering.net>
4061 When chown or chgrp is modifying the referent of a symlink,
4062 use the chown(2) function, if possible.
4063 * src/chown-core.c (change_file_owner): Don't hard-code the
4064 open/fchown/close kludge here. Use `chown' instead.
4065 The chown function works just fine on conforming systems.
4066 Other systems now go through the new chown wrapper that
4067 resorts to the old kludge.
4069 * src/chown-core.c (change_file_owner): Add a comment.
4071 2004-04-27 Jim Meyering <jim@meyering.net>
4073 * src/ptx.c: Make over 40 global extern variables `static'.
4074 (syntax_table, re_syntax_table): Remove declarations of two unused
4075 variables (they were exposed by the above change).
4077 * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4078 * src/ln.c (backup_type): Likewise.
4080 * src/remove.c (rm): Add `extern' keyword.
4081 * src/cp-hash.c (forget_created, remember_created)
4082 (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4083 * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4084 * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4085 (uid_to_name, chown_files): Likewise.
4087 * src/Makefile.am (sc_tight_scope): New rule.
4088 * Makefile.maint (sc_tight_scope): New rule.
4089 (syntax-check-rules): Add it.
4091 2004-04-26 Jim Meyering <jim@meyering.net>
4093 * Use automake-1.8.4. Regenerate dependent files.
4095 * src/sort.c (limfield): Make a comment clearer.
4097 2004-04-25 Paul Eggert <eggert@twinsun.com>
4099 Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4100 leading blanks when computing the location of the field end;
4101 it is not supposed to skip trailing blanks. Solaris 8 "sort"
4102 does conform to POSIX. Also fix the documentation to clarify
4103 this and related issues.
4105 * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4106 that the options are in alphabetical order. Describe how -b works
4107 more-accurately; this involves fixing some examples, too. Mention
4108 what happens if the start field falls after an end field or after
4109 a line end. Warn about using -k without -b, -g, -M, -n, or -t.
4110 Add an example of how to sort IPv4 addresses and Apache Common
4111 Log Format dates. Remove a duplicate example.
4112 (Putting the tools together): Use separate options rather
4113 than agglomerating them.
4114 * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4115 decode whether to skip leading blanks.
4116 (trailing_blanks): Remove.
4117 (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4119 * tests/pr/Test.pm: Fix typo in env_default comment.
4120 * tests/sort/Test.pm: Likewise.
4121 (18c, 18d): Reverse the order of output lines, so that the
4122 test cases conform to POSIX.
4124 2004-04-22 Paul Eggert <eggert@twinsun.com>
4126 More signal-handling cleanup for ls.c. Do not allow signals to
4127 happen between arbitrary output bytes, as the
4128 restore-default-color sequence can bollix up multibyte chars or
4129 color-change sequences in the ordinary output. Instead, process
4130 signals only between printing a file name and changing the color
4131 back to non_filename_text color. That way, if the signal handler
4132 changes the color (to the default), 'ls' will change it back when
4133 'ls' continues (after being suspended).
4135 Also, do not bother with signal-handling unless stdout is a
4136 controlling terminal; this lets stdio buffer better when "ls
4137 --color" is piped or sent to a file.
4139 * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4140 Do not include "full-write.h"; no longer needed.
4141 (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4142 (put_indicator_direct): Remove. All callers changed to use
4144 (caught_signals, interrupt_signal, stop_signal_count): New vars.
4145 (restore_default_color): Don't bother checking for put_indicator
4147 (sighandler): Don't handle SIGTSTP; that's another handler now.
4148 Simply set interrupt_signal to the signal, then exit.
4149 (stophandler, process_signals): New functions.
4150 (main): Don't output any color changes until _after_ the signal
4151 handlers are set up. This fixes a race condition where 'ls'
4152 could be interrupted while initializing colors, and leaving the
4153 terminal in an undesirable state.
4154 Don't mess with signal-handling if standard output is not a
4155 controlling terminal.
4156 When exiting, restore the default color, then restore the
4157 default signal handling, then act on any signals that weren't
4159 Do not print //DIRED// etc. in colors; this avoids the need
4160 to catch signals when printing them.
4161 (print_name_with_quoting): Process signals just before switching
4162 color back to non_filename_text.
4164 2004-04-23 Jim Meyering <jim@meyering.net>
4166 Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4167 * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4168 of quotearg_buffer. Patch by Mikulas Patocka.
4170 2004-04-18 Paul Eggert <eggert@twinsun.com>
4172 tee ignored SIGPIPE, but POSIX doesn't allow this.
4174 * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4175 does not allow this. This undoes the 1996-10-24 patch.
4177 2004-04-18 Paul Eggert <eggert@twinsun.com>
4179 Signal-handling cleanup for coreutils. Here are the highlights:
4181 - csplit sometimes failed to remove files when interrupted.
4182 - csplit didn't clean up if two signals arrived nearly simultaneously.
4183 - install -s would infloop on System V if SIGCHLD was ignored.
4184 - ls could incorrectly restore color if multiple signals
4185 arrived nearly simultaneously.
4187 * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4189 (filename_space, prefix, suffix, digits, files_created, remove_files):
4191 (caught_signals): New var.
4192 (cleanup): Block signals while deleting all files.
4193 (cleanup_fatal, handle_line_error, regexp_error):
4194 Mark with ATTRIBUTE_NORETURN.
4195 (create_output_file, close_output_file, interrupt_handler):
4196 Block signals while changing the number of output files,
4197 to fix some race conditions.
4198 (delete_all_files): Do nothing if remove_files is zero.
4199 Clear files_created.
4200 (main): Don't mess with signals until after argument processing
4203 * src/csplit.c (main): Rewrite signal-catching code to make it
4204 similar to other coreutils programs. When processing signals,
4205 block all signals that we catch, but do not block signals that we
4206 don't catch. Avoid problems with unsigned int warnings.
4207 * src/ls.c (main): Likewise.
4208 * src/sort.c (main): Likewise.
4210 * src/csplit.c (interrupt_handler):
4211 Use void, not (obsolete) RETSIGTYPE.
4212 * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4214 * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4215 Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4216 * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4217 * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4218 * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4220 * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4222 * src/install.c: Include <signal.h>.
4223 (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4224 given, since System V fork+wait does not work if SIGCHLD is ignored.
4226 * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4227 handler to self, not to SIG_IGN, since SIGTSTP can be received
4229 (main): Use SA_RESTART, as that is simpler than checking for EINTR
4230 failures all over the place.
4232 2004-04-20 Jim Meyering <jim@meyering.net>
4234 * src/remove.c (is_empty_dir): Clarify comment.
4236 * man/help2man: Accept new option: --program-name=NAME, so that we
4237 can override the one in --version output. This is needed solely
4238 so that test.1 doesn't refer to `[' as the program name.
4239 Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4240 * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4242 * src/pwd.c: Don't include pathmax.h; system.h already does it.
4244 * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4246 2004-04-19 Jim Meyering <jim@meyering.net>
4248 * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4249 Initialize a buffer to avoid warnings from tools like valgrind.
4251 * Makefile.maint (sc_trailing_blank): New rule.
4252 (syntax-check-rules): Add it.
4253 * .x-sc_trailing_blank: New file.
4255 Make pwd work even if the resulting name is so long that getcwd fails.
4256 * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4257 (nth_parent, find_dir_entry, robust_getcwd): New functions.
4258 (main): First try getcwd, then, upon failure, robust_getcwd.
4260 2004-04-18 Jim Meyering <jim@meyering.net>
4262 * src/who.c (print_user): Use xrealloc here, rather than
4263 unchecked realloc. Remove anachronistic casts.
4265 * src/remove.c (full_filename_): Don't leak upon failed realloc.
4267 * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4269 * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4270 renaming it. Update uses.
4272 2004-04-17 Jim Meyering <jim@meyering.net>
4274 * configure.ac: Depend on automake-1.8.3.
4276 * src/join.c (add_file_name): Declare function to be `static'.
4277 (string_to_join_field): Likewise.
4278 * src/remove.c (ds_init, ds_free): Likewise.
4280 * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4281 (syntax-check-rules): Add to the list.
4283 2004-04-13 Paul Eggert <eggert@twinsun.com>
4285 Use page-aligned buffers whenever we bother to do I/O using buffer
4286 sizes that are tailored for the files.
4288 * src/cat.c: Include getpagesize.h.
4289 * src/copy.c: Likewise.
4290 * src/shred.c: Likewise.
4291 * src/split.c: Likewise.
4292 * src/cat.c (main): Align I/O buffers to page boundaries.
4293 * src/copy.c (copy_reg): Likewise.
4294 * src/shred.c (dopass): Likewise.
4295 * src/split.c (main): Likewise.
4296 * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4297 All uses replaced by ptr_align.
4298 * src/od.c (gcd, lcm): Remove; now in system.h.
4299 * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4301 2004-04-14 Jim Meyering <jim@meyering.net>
4303 Remove m4/Makefile.am: it's no longer needed, with newer automake
4304 * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4305 * Makefile.am (SUBDIRS): Remove `m4' from the list.
4307 2004-04-13 Jim Meyering <jim@meyering.net>
4309 * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4311 2004-03-27 Paul Eggert <eggert@twinsun.com>
4313 * NEWS: cp -pu and mv -u (when copying) now take the destination
4314 file system time stamp resolution into account.
4315 * doc/coreutils.texi (mv invocation): Document this.
4316 (cp invocation): Document -u (it was missing!) with new behavior.
4318 * src/copy.c: Include "utimecmp.h".
4319 (copy_internal): Compare time stamps using utimecmp rather than
4322 2004-04-09 Jim Meyering <jim@meyering.net>
4324 * Makefile.maint (.re-list): New rule/file, to replace
4325 hard-coded list of header file names.
4326 (sc_system_h_headers): Use the new file.
4327 Don't look for sys2.h anymore.
4329 * src/system.h: Include new "stat-macros.h" rather than hard-coding
4330 all of its macro definitions -- the list was slightly out of date.
4331 Suggestion from Dmitry V. Levin.
4333 2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
4335 * NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
4336 * doc/coreutils.texi (dd invocation): Likewise.
4337 * src/shred.c (O_NOCTTY): Remove redundant decl.
4338 * src/dd.c (flags, usage): Remove noctty flag.
4339 (main): Always use O_NOCTTY when opening files.
4341 2004-04-08 Jim Meyering <jim@meyering.net>
4343 * src/dd.c (dd_copy): Mark two diagnostics for translations.
4344 (set_fd_flags): Undo part of today's change: it's a little
4345 cleaner -- and more efficient in the common case -- to go
4346 ahead and OR in the -1 when fcntl fails.
4348 * Makefile.maint (sc_dd_max_sym_length): New target.
4349 (syntax-check-rules): Add it.
4351 * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4352 Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
4354 * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4355 Rename parameter, flags, to avoid shadowing global.
4356 (LONGEST_SYMBOL): Tweak comment.
4358 2004-04-07 Paul Eggert <eggert@twinsun.com>
4360 * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4361 and new dd options iflag= and oflag=.
4362 * src/dd.c (usage): Likewise.
4363 * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4364 * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4365 (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4366 (input_flags, output_flags): New vars.
4367 (LONGEST_SYMBOL): New macro.
4368 (struct symbol_value): Renamed from struct conversion. Members
4369 symbol and value renamed from convname and conversion. The
4370 symbol value is now an array instead of a pointer; this saves
4371 a bit of space and time in practice. All uses changed.
4372 (conversions): Add nocreat, excl, fdatasync, fsync. Now const.
4373 (flags): New constant array.
4374 (iflag_error_msgid, oflag_error_msgid): New constants.
4375 (parse_symbols): Renamed from parse_conversion and generalized
4376 to handle either conversion or flag symbols.
4377 (scanargs): Adjust uses of parse_symbols accodingly. Add
4378 support for iflag= and oflag=. Reject attempts to use
4379 both excl and nocreat.
4380 (set_fd_flags): New function.
4381 (dd_copy): Just return X rather than calling quit (X), since our
4382 caller invokes quit with the returned value. Add support for
4383 fdatasync and fsync.
4384 (main): Add support for iflag=, oflag=, and new conv= symbols.
4385 * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4386 O_RSYNC, O_SYNC): Define to 0 if not already defined.
4388 * NEWS: Remove duplicate mention of BLOCKSIZE.
4390 2004-04-02 Andreas Schwab <schwab@suse.de>
4392 * src/stty.c: Add support for IUTF8 input flag.
4394 2004-04-06 Jim Meyering <jim@meyering.net>
4396 * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4397 Interix spells it `mkdev'. Reported by Mark Funkenhauser.
4399 2004-04-04 Jim Meyering <jim@meyering.net>
4401 A specified format is no longer automatically newline terminated.
4402 If you want a newline at the end of your format, use `\n'.
4403 * src/stat.c (print_it): Don't print a newline at the end of
4405 (do_statfs): Add a newline at end of each default format string.
4407 2004-03-30 Paul Eggert <eggert@twinsun.com>
4409 * src/nohup.c (main): Adjust to new calling convention
4410 for set_cloexec_flag.
4412 2004-03-31 Jim Meyering <jim@meyering.net>
4414 * tests/Fetish.pm (run_tests): Remove `.orig' file.
4415 Remove debugging diagnostic.
4417 Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4418 would not elicit an error.
4419 * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4420 (main): Don't use atoi. Use xstrtoul instead.
4422 2004-03-30 Jim Meyering <jim@meyering.net>
4424 * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4425 (syntax-check-rules): Add it.
4426 * .x-sc_prohibit_atoi_atof: New file.
4428 2004-03-29 Jim Meyering <jim@meyering.net>
4430 * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4431 test is not sensitive to system-dependent block size differences.
4432 Prompted by a report of Solaris 8 differences from Paul Eggert.
4434 * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4435 Rename `%tmp' to `%actual'. Reverse order of last two args to
4436 _compare_files (to $actual, $expected) so as to match declaration.
4438 2004-03-28 Paul Eggert <eggert@twinsun.com>
4440 Fix some gotchas encountered when porting to Solaris 8, using
4441 the Forte 6u2 compiler.
4443 * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4444 Declare sethostname, since no Solaris header does it.
4445 * src/who.c: Include "vasprintf.h", for asprintf.
4447 2004-03-28 Jim Meyering <jim@meyering.net>
4450 * src/du.c (process_file): Don't record dev/inode for directories.
4452 Under some circumstances, without -c, du would mistakenly count the
4453 space of hard-linked files, not just the first one it encountered.
4454 Reported by Anthony Thyssen.
4455 * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4457 * src/du.c: Rename global `print_totals' to `print_grand_total'.
4459 * src/du.c (main): Rearrange filtering loop to be a tiny bit
4462 * src/chown-core.c: Don't include savedir.h -- no longer needed.
4463 * src/chmod.c: Likewise.
4465 2004-03-25 Jim Meyering <jim@meyering.net>
4467 * src/du.c (main): Remove now-unused declaration of `i'.
4469 2004-03-24 Paul Eggert <eggert@twinsun.com>
4471 * src/du.c (main): Filter out file names of length zero before
4472 invoking fts, so that they don't cause fatal errors.
4474 2004-03-25 Jim Meyering <jim@meyering.net>
4476 * tests/du/files0-from (zero-len): Add a test for the above.
4478 2004-02-25 Paul Eggert <eggert@twinsun.com>
4480 * NEWS: New environment var BLOCKSIZE.
4481 * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4482 * tests/envvar-check: Test for it. Factor the code to simplify it.
4484 2004-03-23 Paul Eggert <eggert@twinsun.com>
4486 * NEWS: Shorten the du --files0-from announcement, and say
4487 "NUL-terminated" rather than "NUL-separated".
4488 * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4490 (usage): Say "NUL-terminated", not "NUL-separated".
4491 (main): Check for I/O error when istream is closed.
4492 Allow --files0-from=F even if F is empty; this specifies no files.
4493 (du_files): Now that we allow the list of files to be empty,
4495 * tests/du/files0-from: Adjust to above changes to src/du.c.
4497 2004-03-24 Jim Meyering <jim@meyering.net>
4499 * tests/tail-2/assert: Avoid race condition that could cause
4500 spurious failure. Based on a patch from Andreas Schwab.
4502 2004-03-23 Jim Meyering <jim@meyering.net>
4504 * src/du.c (main): Free the hash table, too.
4506 2004-03-22 Jim Meyering <jim@meyering.net>
4508 * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4509 the change of 2004-01-22. I can no longer reproduce the problem
4510 that prompted that change, and `info coreutils pr' would display the
4511 `printing text' section of the manual, not the one on `pr invocation'.
4513 * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4514 to match corrected output.
4516 * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4517 (main): Use readtoken0 functions rather than readtokens.
4518 Don't use errno when diagnosing readtokens0 failure.
4519 Fix off-by-one error in the token number reported in a diagnostic.
4520 (du_files): Return bool, rather than int.
4521 (main): Call readtokens0_free.
4523 2004-03-21 Jim Meyering <jim@meyering.net>
4525 * src/remove.c (ds_free): Plug a small leak.
4527 * tests/Fetish.pm: Fix typo in comment.
4529 2004-03-07 Jim Meyering <jim@meyering.net>
4531 * NEWS: du accepts a new option --files0-from=FILE, where FILE
4532 contains a list of NUL-separated file names.
4534 * src/du.c: Include "readtokens.h".
4535 (usage): Describe the new option, and adjust the `Usage':
4536 with this option, no FILE may be specified on the command line.
4537 (main): Handle the new option.
4539 * tests/du/files0-from: New tests, for the above.
4540 * tests/du/Makefile.am (TESTS): Add files0-from.
4542 * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4543 * src/tsort.c (tsort): Likewise.
4545 2004-02-29 Paul Eggert <eggert@twinsun.com>
4547 * NEWS: Add support for a new notation @N to get_date to represent
4548 the time stamp with numeric value N. Improve support for
4549 fractional time stamps. date's -d and -f options now accept them.
4550 Likewise for touch -t. date has a new option --iso-8601=ns.
4552 * doc/coreutils.texi (touch invocation):
4553 Describe use of fractional seconds.
4554 (date invocation, Options for date): Likewise.
4555 * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4556 * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4557 (Options for date): Describe new --iso-8601=ns option.
4559 * doc/getdate.texi: Add copyright notice. Change getdate to
4560 get_date when talking about the function name.
4561 (Seconds since the Epoch): New section, containing the time_t
4562 info moved from Date input formats section, along with new
4563 info about the @ syntax. Mention negative time stamps,
4564 fractional time stamps, and leap seconds.
4565 (General date syntax): Modernize examples a bit to reflect new
4567 (General date syntax, Relative items in date strings):
4568 Use ' rather than " to quote formats.
4569 (Time of day items): Add an example with fractional seconds.
4570 Describe fractional-second syntax.
4572 * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4573 needs clock_gettime.
4575 * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4576 (time_spec_string, time_spec, show_date): Support it.
4577 (usage): Remove description of -ITIMESPEC, as it's obsolete and
4578 confusing. Mention --iso-8601=ns.
4579 (batch_convert): getline returns ssize_t, not int.
4581 * src/touch.c (newtime): Now an array of two timespecs, one
4582 for access and one for modification.
4583 (ref_stats): Remove.
4584 (get_reldate): Use get_date's parameter profile.
4585 (touch, main): Adjust to above changes.
4586 (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4587 Use gettime instead of gettimeofday, for new get_date signature.
4589 * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4592 2004-03-15 Jim Meyering <jim@meyering.net>
4594 * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4595 target before updating $(prev_version_file).
4597 * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4598 See today's change in lib/getdate.y.
4599 * tests/misc/Makefile.am (TESTS): Add date-sec.
4601 2004-03-14 Jim Meyering <jim@meyering.net>
4603 * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4604 signature files, not `.asc'. Reported by angico@yahoo.com.
4606 2004-03-13 Jim Meyering <jim@meyering.net>
4608 * src/cp.c (do_copy): Tweak wording in a diagnostic.
4609 Suggestion from Karl Berry.
4610 Include "quoatearg.h".
4611 (do_copy): Use quotearg_colon (not quote) for diagnostics
4612 that begin with `"%s:'.
4614 * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4615 Suggestion from Dan Jacobson.
4617 2004-03-12 Jim Meyering <jim@meyering.net>
4621 Sometimes, when source and destination partition are different,
4622 mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
4624 * src/copy.c: When moving a set of N hard-linked files between
4625 partitions, via two or more command line arguments where the
4626 command line argument containing the Nth link contains no other
4627 link to that same file, mv would mistakenly copy the file, rather
4628 than hard-linking it to the other(s). That happens because when the
4629 final link is processed, its link count has been reduced to 1 since
4630 the other links have been `copied' to the destination partition
4631 and the source links have been removed.
4632 (copy_internal): When in move mode, use the source dev/inode
4633 pair to look up destination name even when st_nlink == 1.
4634 * src/cp-hash.c (src_to_dest_lookup): New function.
4635 * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4636 * tests/mv/part-hardlink: New file. Test for the above fix.
4637 * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4639 * announce-gen: Sync with autoconf.
4641 * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4642 This was triggered on a Linux-2.2.19 system using a file system
4643 NFS-mounted from some sort of Sun.
4645 2004-03-11 Jim Meyering <jim@meyering.net>
4647 * Use automake-1.8.3. Regenerate dependent files.
4649 2004-03-10 Jim Meyering <jim@meyering.net>
4651 * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4652 so that this test works with SELinux-enabled systems.
4653 Based on a patch from Tim Waugh.
4655 `join -1 x' would give a misleading diagnostic
4656 * src/join.c (string_to_join_field): Report that a non-numeric field
4657 number is invalid, rather than `so large that it is not representable'.
4658 * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4660 2004-03-06 Jim Meyering <jim@meyering.net>
4662 cp --sparse=always sparse-image-file.img /dev/hda1 could
4663 produce an invalid copy on the destination device.
4665 * src/copy.c (copy_reg): Even with --sparse=always, try to
4666 make `holes' only if the destination is a regular file.
4667 Reported by Szakacsits Szabolcs.
4669 2004-03-03 Paul Eggert <eggert@twinsun.com>
4671 * src/nohup.c (main): Don't invoke set_cloexec_flag with
4672 a file descriptor of -1.
4674 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
4676 * src/nohup.c: Include "cloexec.h".
4677 (main): Set the copy of stderr to close on exec.
4679 2004-03-01 Paul Eggert <eggert@twinsun.com>
4681 * configure.ac: Include <signal.h> when checking for strsignal,
4682 sys_siglist, and friends. Problem reported by Tony Leneis in
4683 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4685 2004-02-25 Paul Eggert <eggert@twinsun.com>
4687 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4688 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4691 2004-02-23 Paul Eggert <eggert@twinsun.com>
4693 * NEWS: Document how chown's USER.GROUP argument is now parsed.
4695 2004-02-23 Jim Meyering <jim@meyering.net>
4697 * src/seq.c (usage): Remove stray space after \n in --help output.
4699 2004-02-22 Jim Meyering <jim@meyering.net>
4701 * src/du.c (usage): Separate -H and --si. Say that the meaning
4702 of -H will soon change to that of --dereference-args (-D).
4704 2004-02-21 Jim Meyering <jim@meyering.net>
4706 * src/comm.c (usage): Tell what comm does when there are no options.
4707 Reword in terms of FILE1 and FILE2 rather than `left file' and
4708 `right file'. Suggestion from Dan Jacobson.
4710 2004-02-15 Paul Eggert <eggert@twinsun.com>
4712 Fix some POSIX-conformance bugs in expr.
4714 * NEWS: document the following changes to src/expr.c.
4715 * doc/coreutils.texi (expr invocation): Likewise.
4716 Document what forms integers may take, and say "integer"
4717 consistently instead of "number". Warn about operands
4718 that "expr" can misinterpret, and how to work around the
4720 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
4721 Accept a bool argument specifying whether to evaluate the
4722 expression. This is to allow short-circuit evaluation. All
4724 (null): Report that a string is zero even if it has
4725 a form like "-0" or "00".
4726 (eval1, eval): Use short-circuit evaluation for | and &.
4727 (eval): Return 0 if both arguments are null or zero, instead
4728 of returning the first argument.
4729 * tests/expr/basic: Add some tests for the above.
4731 2004-02-17 Jim Meyering <jim@meyering.net>
4735 `make check' from a build inside a chroot environment would fail
4736 * tests/help-version: Specify an argument (`/') for df, in the
4737 unusual event that there is no valid entry in /etc/mtab.
4738 Likewise for id: add the -u option, so we don't get spurious
4739 failures when there are no user or group names.
4742 * src/sort.c (usage) [-u]: Add punctuation so that the description in
4743 the help2man-generated (line-joined) man page is more readable.
4744 Reported by Tim Waugh.
4745 [-T]: Add a semicolon, for the same reason.
4747 2004-02-15 Jim Meyering <jim@meyering.net>
4749 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
4751 2004-02-11 Jim Meyering <jim@meyering.net>
4753 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
4754 $(srcdir)/../Makefile.am.in, rather than $<.
4755 Suggestion from Michael Elizabeth Chastain.
4757 2004-02-10 Jim Meyering <jim@meyering.net>
4759 * config/install-sh: Make this script executable.
4760 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
4761 is executable. Otherwise, on systems that lack a suitable install
4762 binary, `make install' would fail, because of the way this script
4763 is invoked (without `$SHELL ' prefix).
4764 Reported by Bob Proulx.
4766 2004-02-08 Jim Meyering <jim@meyering.net>
4770 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
4771 that would cause an unwarranted test failure.
4772 * tests/rm/rm3: Likewise.
4774 2004-02-07 Jim Meyering <jim@meyering.net>
4776 Remove xstat function pointer member. The way it was used was not
4777 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
4778 inline `stat' and `lstat' functions, thus making the tests of
4779 `xstat == lstat' in copy.c always fail.
4780 * src/copy.h (struct cp_options) [xstat]: Remove member.
4782 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
4783 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
4784 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
4785 (valid_options): Remove now-obsolete FIXME comments.
4787 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
4788 `*(x->xstat) (...)'.
4789 (do_copy): Declare/use local xstat rather than x->xstat.
4790 (main): Remove code that set x.xstat.
4791 * src/mv.c (cp_option_init): Don't initialize xstat member.
4792 * src/install.c (cp_option_init): Likewise.
4794 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
4795 so that emit_upload_commands can use these variables, too.
4797 2004-02-06 Jim Meyering <jim@meyering.net>
4799 * tests/rm/deep-1: Remove `du' stack space test.
4800 Apparently, `ulimit -s N' isn't portable enough.
4801 This test will be restored (with a guard against losing ulimit)
4802 in its own file later.
4804 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
4805 since this test doesn't take long enough to merit them.
4806 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
4808 * Makefile.maint (signatures): Remove definition.
4809 Now, automake's gnupload handles this.
4810 (%.sig: %): Remove now-unused rule.
4811 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
4812 `$(distdir).tar.bz2 $(distdir).tar.gz'.
4813 (emit-upload-commands): Adjust to use gnupload.
4815 2004-02-05 Jim Meyering <jim@meyering.net>
4817 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
4818 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
4819 Now, those are all defined in timespec.h.
4822 * src/date.c: Don't include timespec.h, now that system.h does it.
4824 2004-02-02 Paul Eggert <eggert@twinsun.com>
4826 Don't dump core if localtime returns NULL (possible on
4827 hosts with 64-bit time_t and 32-bit int).
4828 * src/date.c: Include "inttostr.h".
4829 (batch_convert, main):
4830 If time conversion fails, exit with nonzero status.
4831 (show_date): Return int to report conversion failure.
4832 Print the time as an int if localtime fails.
4833 * src/uptime.c: Print "??" if the current clock can't
4834 be converted by localtime. This won't happen until the year
4835 2*31 + 1900, but we don't want to dump core even if the current
4836 clock has the wrong value.
4838 * src/stat.c: Include "inttostr.h".
4839 (human_time): Print the date/time as a number of seconds since the
4840 epoch if it can't be converted by localtime. This is better than
4841 just saying "invalid", and is consistent with what "ls" does.
4842 Don't dump core if the year has more than 48 digits; this isn't
4843 possible on any contemporary host, but we might as well do it right.
4845 2004-01-31 Paul Eggert <eggert@twinsun.com>
4847 * src/stat.c (human_time): Accept time rather than
4848 pointer-to-const-time parameter, for clarity. All callers changed.
4850 2004-02-02 Jim Meyering <jim@meyering.net>
4852 * src/stat.c (do_stat): Remove extra trailing newline from
4853 default formats. Reported by Nelson H. F. Beebe.
4855 Print actual fractional seconds in time stamps, not just `.00000000'.
4856 * src/stat.c (human_time): Add and use new parameter, t_ns.
4857 (print_stat): Update callers.
4858 * src/ls.c (TIMESPEC_NS): Remove definition.
4859 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
4860 also uses this macro.
4861 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
4862 fractional seconds for files on an XFS file system, but that stat's
4863 fractional seconds were always zero.
4865 2004-01-28 Paul Eggert <eggert@twinsun.com>
4867 * src/seq.c (print_numbers): Use 'double' for loop index, not
4868 'int', to avoid problems with integer overflow. On almost all
4869 machines 'double' works in every case where 'int' works, and
4870 it works on other cases besides.
4872 2004-01-27 Jim Meyering <jim@meyering.net>
4874 * src/seq.c (usage): Mention that if INCREMENT is omitted,
4875 it defaults to 1, even when FIRST is larger than LAST.
4876 Reword so as not to exclude the possibility that INCREMENT be zero.
4878 2004-01-25 Jim Meyering <jim@meyering.net>
4882 * Makefile.maint (signatures): Comment out definition.
4884 2004-01-23 Jim Meyering <jim@meyering.net>
4886 * Makefile.maint (header_regexp): Add exitfail.
4888 * man/Makefile.am (EXTRA_DIST): Add help2man.
4889 Reported by Nelson H. F. Beebe.
4891 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
4892 so it works on systems with Perl installed somewhere other than in
4895 * src/paste.c (paste_parallel): Declare local, chr, to be of type
4896 `int', not `char', since it must hold EOF. This bug would make
4897 paste infloop on some systems. Test failures reported by
4898 Nelson H. F. Beebe and Christian Krackowizer.
4900 2004-01-22 Jim Meyering <jim@meyering.net>
4902 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
4903 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
4905 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
4906 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
4907 Use --info-page='coreutils PROG' option.
4908 Now, readlink.1 refers the user to `info coreutils readlink'
4909 rather than to `info readlink'. Reported by Matt Swift.
4911 2004-01-21 Paul Eggert <eggert@twinsun.com>
4913 Exit status cleanup.
4915 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
4916 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
4917 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
4918 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
4919 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
4920 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
4921 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
4922 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
4923 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
4924 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
4925 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
4926 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
4927 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
4928 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
4929 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
4930 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
4931 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
4933 * src/cat.c (usage): Don't bother normalizing exit status
4934 since the arg is already the correct exit status now.
4935 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
4936 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
4937 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
4938 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
4939 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
4941 * src/chown.c (main): Removed unused local 'fail'.
4943 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
4946 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
4947 * src/env.c, src/nice.c, src/su.c: Likewise.
4948 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
4949 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
4950 * src/expr.c (main): Use initialize_exit_failure rather than
4951 setting exit_failure directly; this optimizes away redundant
4953 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
4955 * src/chroot.c (main): Exit with status 1 rather than 127
4956 if chroot itself fails, as per documentation.
4958 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
4959 rather than roll-your-own symbols or integers.
4960 * src/env.c (main): Likewise.
4961 * src/nohup.c (main): Likewise.
4962 * src/su.c (run_shell): Likewise.
4964 * src/cp.c (exit_status): Remove static var....
4965 (main): Making it local here instead. Use =, not |=, to set it.
4967 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
4969 * src/date.c (batch_convert, main): Likewise.
4970 * src/dd.c (dd_copy): Likewise.
4971 * src/pr.c (first_last_page, main, getoptarg): Likewise.
4972 * src/tr.c (main): Likewise.
4973 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
4974 POSIX doesn't require it.
4975 * src/dd.c (write_output, skip, dd_copy): Likewise.
4976 * src/df.c (main): Likewise.
4977 * src/id.c (main): Likewise.
4978 * src/install.c (main): Likewise.
4979 * src/ln.c (main): Likewise.
4980 * src/ls.c (main): Likewise.
4981 * src/mv.c (main): Likewise.
4982 * src/shred.c (main): Likewise.
4984 * src/env.c (main): Exit with status 1, not 2, on errors detected
4986 * src/hostname.c (main): Likewise.
4987 * src/nl.c (main): Likewise.
4988 * src/stty.c (main): Likewise.
4990 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
4991 consistency with the other programs' naming conventions.
4994 * src/factor.c (main): Do not report a usage error simply
4995 because stdin has bad numbers.
4997 * src/id.c (problems): Now a boolean int, not a counter,
4998 so that we don't have to worry about int overflow. All uses changed.
4999 * src/touch.c (err): Likewise.
5001 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5003 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5004 * src/mknod.c: Likewise.
5006 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5007 on error; this is in case EXIT_FAILURE is unusual.
5008 * src/su.c (main): Likewise.
5010 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5011 changed to EXIT_CANNOT_INVOKE.
5013 * src/printenv.c (PRINTENV_FAILURE): New constant.
5014 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5015 command-line syntax problems.
5017 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5018 (main): Avoid integer overflow when seeing whether errors occurred.
5020 * src/seq.c (print_numbers): Now returns void, not (zero) int.
5021 All callers changed.
5022 (main): Remove unused local variable 'errs'. Always exit successfully
5023 if we reach the end.
5025 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5026 for consistency with other programs here. All uses changed.
5027 (main): Use 'error' to exit rather than invoking 'exit' here.
5029 * src/sort.c: Don't include <assert.h>.
5030 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
5031 (usage): Don't use 'assert'.
5032 (main): Remove redundant assignment to exit_failure.
5034 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5036 (initialize_exit_failure): New inline function.
5037 Include exitfail.h here, since we refer to exit_failure.
5038 All callers changed to not include exitfail.h.
5040 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5041 substitute them for the corresponding integer constants.
5043 * tests/help-version (expected_failure_status_date): Remove, as
5044 'date' is now normal.
5045 (expected_failure_status_nohup): New var.
5047 2004-01-21 Jim Meyering <jim@meyering.net>
5049 * tests/touch/relative: Remove `command' syntax.
5050 Thanks to Nelson H. F. Beebe and Paul Eggert.
5052 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5053 so as to avoid problems with systems using TAI clocks.
5054 Although it's no longer necessary, set TZ=UTC0 also for the
5055 initial touch command. Reported by Paul Jarc here:
5056 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5058 2004-01-20 Diego Biurrun <diego@biurrun.de>
5060 * src/dircolors.hin: Add .mov to the list of media files.
5062 2004-01-19 Paul Eggert <eggert@twinsun.com>
5064 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5065 portable). Problem reported by Christian Krackowizer. Also, use
5066 +0000 rather than +0 to specify a time zone, as the documentation
5067 requires four digits.
5069 2004-01-19 Jim Meyering <jim@meyering.net>
5071 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5072 * tests/mv/backup-is-src: Likewise.
5073 Problem reported by Peter Horst
5075 2004-01-17 Jim Meyering <jim@meyering.net>
5077 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5081 2003-12-15 Paul Eggert <eggert@twinsun.com>
5083 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5084 with -r specifying the origin for -d.
5085 * src/touch.c (flexible_date): Remove static var.
5086 (get_reldate): New function.
5087 (main): Use it, to implement this new behavior.
5089 2004-01-16 Jim Meyering <jim@meyering.net>
5091 * tests/touch/relative: New test for the above.
5092 * tests/touch/Makefile.am (TESTS): Add relative.
5094 2004-01-13 Jim Meyering <jim@meyering.net>
5096 * src/system.h: Include contents of sys2.h.
5097 * src/sys2.h: Remove file.
5098 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5100 * Use automake-1.8.2. Regenerate dependent files.
5102 * Update to gettext-0.13.1.
5103 * configure.ac: Use gettext-0.13.1.
5104 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5106 2004-01-12 Jim Meyering <jim@meyering.net>
5108 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5110 * Makefile.maint (po-check): Ensure that cvsu works before using it.
5111 Reported by Alexandre Duret-Lutz.
5113 * src/tail.c (main): Warn about following stdin only when it's a tty.
5115 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5117 2004-01-10 Jim Meyering <jim@meyering.net>
5119 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5121 2004-01-09 Jim Meyering <jim@meyering.net>
5123 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5125 2004-01-08 Jim Meyering <jim@meyering.net>
5127 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5128 From Andreas Schwab.
5130 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5131 remnant) from PATH component. That would cause tests in this directory
5132 not to run the just-built binaries, but rather whatever happened
5133 to be in one's PATH. Reported by Christian Krackowizer.
5135 2004-01-04 Jim Meyering <jim@meyering.net>
5137 * src/csplit.c (new_control_record): Use x2nrealloc
5138 rather than xrealloc.
5140 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5142 (make_path_private): Likewise.
5144 2004-01-03 Jim Meyering <jim@meyering.net>
5146 * src/paste.c: Use `bool' (not int) as the type for a few
5148 (collapse_escapes): Rewrite to set globals rather than modifying
5150 Use size_t (not int) for all counters and related index variables.
5151 (paste_parallel): Remove needless complexity of
5152 using xrealloc in the loop; just allocate the buffers up front.
5153 Free the two temporary buffers.
5154 Move declarations of locals `down' into scope where used.
5155 (paste_serial): Remove `register' attributes.
5156 (main): Simplify delim-related code.
5157 Free `delims', now that it's malloc'd.
5159 2004-01-02 Jim Meyering <jim@meyering.net>
5161 * src/chroot.c: Include "quote.h".
5162 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5163 (main): Exit with status of 127, not 1, for too-few-args,
5164 chroot failure, or chdir failure.
5165 Give a better diagnostic upon execvp failure.
5167 * src/du.c (usage): Mention that, with its current meaning,
5170 * src/tail.c (main): Warn about following stdin when it's a tty.
5171 Fail when following by name but no names are specified.
5173 2003-12-30 Jim Meyering <jim@meyering.net>
5175 * src/fold.c (main): Use memcpy, not strcpy.
5177 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5180 2003-12-28 Jim Meyering <jim@meyering.net>
5182 * src/unexpand.c (n_tabs_allocated): New global.
5183 (add_tabstop): Use x2nrealloc rather than xrealloc.
5184 * src/expand.c: Likewise.
5186 * tests/misc/expand: New file.
5187 * tests/misc/Makefile.am (TESTS): Add expand.
5189 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5190 (fillbuf): Use x2nrealloc rather than xrealloc.
5191 (sort): Use xnmalloc rather than xmalloc.
5194 2003-12-27 Jim Meyering <jim@meyering.net>
5196 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5198 2003-12-29 Paul Eggert <eggert@twinsun.com>
5200 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5201 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5203 * doc/coreutils.texi (join invocation): Remove documentation
5204 accordingly. Document that -t makes all separators significant.
5206 * src/join.c: Include posixver.h.
5207 (obsolete_usage): New var.
5208 (longopts): Put obsolete options first.
5209 (OBSOLETE_LONG_OPTIONS): New constant.
5210 (get_option, add_file_name): New functions.
5211 (main): Use them to support new behavior.
5212 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5213 Do not mark -j FIELD as obsolescent; it is longstanding
5214 UNIX tradition and is a valid extension to POSIX.
5216 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5218 2003-12-28 Paul Eggert <eggert@twinsun.com>
5220 * src/join.c (add_field_list): Don't use alloca with unbounded
5221 size; just modify the argument, which is no longer const *.
5223 Various other minor cleanups, mostly to avoid the need for casts.
5225 (extract_field): Renamed from ADD_FIELD, as it's now a function.
5227 (struct field.beg): Now char *, not unsigned char const *. All
5228 uses changed. It shouldn't be const since xmemcoll writes on its
5230 (extract_field): Likewise, for 2nd arg.
5231 (keycmp): Remove now-unnecessary cast of xmemcoll args.
5233 (is_blank): New function, to avoid need to cast arg to unsigned char.
5234 (extract_field): Use it.
5236 (xfields): Rewrite pretty much from scratch.
5238 (hard_LC_COLLATE): Now bool, not int.
5239 (get_line, getseq, add_field_list): Now returns bool, not int.
5240 (decode_field_spec, add_field_list): Return true on success (not
5241 false), for consistency with the rest of the code. All uses changed.
5243 (tab): Now char, not unsigned char. This wasn't 100% necessary
5244 but is slightly cleaner.
5245 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5247 (empty_filler): Now const *.
5249 (make_blank): Remove; wasn't needed. Remove all calls.
5250 (main): Don't set uni_blank.nfields; zero is fine.
5252 2003-12-27 Jim Meyering <jim@meyering.net>
5254 * src/join.c: Include "quote.h".
5255 (min, max): Remove definitions.
5256 Make a few function parameters and corresponding
5257 locals `const'. Use bool for boolean variables.
5258 Use size_t (not int) for all counters and related index variables.
5259 (prjoin): Remove now-useless assertion.
5260 (string_to_join_field): New function.
5261 (main): Accept join fields as large as SIZE_MAX.
5262 (keycmp): Rename `min' to MIN and max to MAX.
5264 2003-12-26 Jim Meyering <jim@meyering.net>
5266 fold -s didn't work on e.g., alpha-based systems.
5267 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5268 x2nrealloc works properly on systems with differing sizes for int
5269 and size_t. Reported by Nelson Beebe.
5271 * src/fold.c: Use `bool' (not int) as the type for a few
5274 2003-12-23 Paul Eggert <eggert@twinsun.com>
5276 * src/ls.c (length_of_file_names_and_frills):
5277 Remove forward decl; not needed.
5278 (print_file_name_and_frills, length_of_file_name_and_frills):
5279 With -m, don't output spaces before inum or size.
5280 (print_with_commas): Don't output space just before newline.
5282 2003-12-24 Jim Meyering <jim@meyering.net>
5284 * tests/ls/Makefile.am (TESTS): Add m-option.
5285 * tests/ls/m-option: New file. Test for above fixes.
5287 2003-12-20 Jim Meyering <jim@meyering.net>
5291 * src/pr.c: Change type of global, buff_allocated, to size_t.
5293 * src/join.c [struct seq]: Change types of members count and alloc
5294 from `int' to `size_t'.
5296 * tests/Makefile.am (root-hint): Tweak wording.
5298 * src/du.c: Accept new option (-0, --null) that makes it so each
5299 output line is NUL-terminated rather than newline-terminated.
5301 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5302 Reported by Volker Paul.
5303 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5304 * tests/dd/unblock-sync: New test for the above.
5306 2003-12-19 Jim Meyering <jim@meyering.net>
5308 * tests/misc/nohup: Double quote back-ticked expression,
5309 in case it ends up having an unexpected value.
5311 * tests/ls/no-arg: Use ls's -1 option in both runs.
5313 * src/du.c (fts_debug): New global.
5314 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5315 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5316 (main) [DU_DEBUG]: Accept -d option.
5318 2003-12-18 Jim Meyering <jim@meyering.net>
5320 * src/ls.c (format_user): Increment dired_pos via two statements,
5321 `dired_pos += width; dired_pos++;' rather than one,
5322 `dired_pos += width + 1;' since the latter could conceivably overflow.
5323 (format_group): Likewise.
5326 * configure.ac: Require automake-1.8.
5328 2003-12-12 Jim Meyering <jim@meyering.net>
5330 * Use automake-1.8. Regenerate dependent files.
5332 2003-12-08 Jim Meyering <jim@meyering.net>
5334 * Makefile.maint (news-date-check): New rule.
5335 (alpha beta major): Depend on it.
5337 2003-12-03 Paul Eggert <eggert@twinsun.com>
5339 * NEWS: ls -l (and similar options) now adjust all columns to
5340 fit the data. Generalized from a suggestion by Leah Q for file sizes.
5341 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5342 (format_user_width, format_group_width, unsigned_file_size,
5343 format_group): New functions.
5344 (block_size_width): Renamed from block_size_size.
5345 (inode_number_width, nlink_width, owner_width, group_width,
5346 author_width, major_device_number_width, minor_device_number_width,
5347 file_size_width): New vars.
5348 (clear_files): Initialize them.
5349 (gobble_file): Set them. Don't ceiling block_size_width to 7.
5350 (print_long_file): Use them.
5351 (gobble_file): Use a new local variable 'f' to make the code
5352 smaller and more consistent with other functions.
5353 (format_user): Output to stdout, not to a buffer, so that we
5354 don't have to worry about buffer overrun. Update dired_pos.
5355 (print_long_file): Don't put owner, group, author into buffer;
5356 just print them directly. Don't assume link counts and
5357 major and minor numbers fit into unsigned long int.
5358 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5359 'ls' output is fixed-width.
5361 2003-12-02 Jim Meyering <jim@meyering.net>
5363 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5365 2003-11-27 Jim Meyering <jim@meyering.net>
5367 * Use automake-1.7f. Regenerate dependent files.
5369 2003-11-24 Paul Eggert <eggert@twinsun.com>
5371 Parse floating-point operands and options in the C locale.
5372 POSIX requires this for printf, and we might as well be
5373 consistent elsewhere (tail, sleep, seq).
5375 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5376 needed now that we assume C89. Include "c-strtod.h".
5377 (xstrtod): Call c_strtod, not strtod.
5378 * src/sleep.c: Include "c-strtod.h".
5379 (main): Update xstrtod call to include new argument, c_strtod.
5380 * src/seq.c (scan_double_arg): Likewise.
5381 * src/tail.c (parse_options): Likewise.
5383 2003-11-24 Jim Meyering <jim@meyering.net>
5385 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5386 Reported by Mark Conty.
5388 2003-11-22 Jim Meyering <jim@meyering.net>
5390 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
5391 (sc_system_h_headers): Do this test only if sys2.h exists.
5393 2003-11-20 Jim Meyering <jim@meyering.net>
5395 * tests/help-version: Ensure that the bug-reporting address is
5396 included in the --help output for every program.
5397 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5399 * src/ptx.c (usage): Output bug-reporting address.
5400 Reported by Dan Jacobson.
5402 2003-11-19 Jim Meyering <jim@meyering.net>
5404 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5405 on the join fields. Suggestion from Bruce Robertson.
5407 2003-11-18 Jim Meyering <jim@meyering.net>
5409 `od -c -w9999999' could segfault
5410 * src/od.c (dump): Use xnmalloc/free, not alloca.
5412 2003-11-16 Jim Meyering <jim@meyering.net>
5414 * Use autoconf-2.59. Regenerate dependent files.
5416 * tests/du/hard-link: Minor tweak: use mkdir -p.
5418 Fix read-from-free'd-buffer error detected by valgrind.
5419 * src/csplit.c (remove_line): Don't return a pointer to data in
5420 a freed buffer. Instead, arrange to free the buffer on the
5423 * tests/misc/csplit: New test for above fix.
5425 2003-11-11 Jim Meyering <jim@meyering.net>
5427 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5428 This avoids a warning from valgrind about memcpy with overlapping
5429 source and destination.
5431 * configure.ac: Require automake-1.7.8.
5433 2003-11-09 Jim Meyering <jim@meyering.net>
5435 * Use automake-1.7.9. Regenerate dependent files.
5437 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5438 * src/chown.c: Likewise.
5440 * src/chown-core.c: Include "root-dev-ino.h".
5441 (chopt_init): Initialize new member.
5442 (change_file_owner): Support rm's new --preserve-root option.
5444 * src/remove.c: Include "root-dev-ino.h".
5445 (remove_cwd_entries): Remove now-obsolete FIXME comment.
5446 (remove_dir): Support rm's new --preserve-root option.
5448 * src/chown.c: Include "root-dev-ino.h".
5449 Add new options: --preserve-root and --no-preserve-root.
5451 * src/chmod.c: Include "root-dev-ino.h".
5452 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5453 ROOT_DEV_INO_WARN macros.
5454 (get_root_dev_ino): Remove function definition, now that it's
5455 been moved to a separate file.
5456 (usage): Describe new options.
5458 * src/mv.c (rm_option_init): Initialized new member.
5460 * src/remove.h: Include "dev-ino.h".
5461 (struct rm_options): Add new member: root_dev_ino.
5462 * src/chown-core.h: Include "dev-ino.h".
5463 (struct Chown_option): Add new member: root_dev_ino.
5465 2003-11-06 Jim Meyering <jim@meyering.net>
5467 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5468 hard-coding `sizeof FILE*'.
5470 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
5472 * src/wc.c (main): Free `fstatus' so there is no confusion about
5473 whether it's leaked or not.
5474 * src/who.c (who): Likewise for `utmp_buf'.
5476 2003-11-05 Paul Eggert <eggert@twinsun.com>
5478 Fix 'cut' problems with size_t overflow and unsigned int.
5479 More generally, resize integer variables to fit use more precisely.
5480 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5481 (struct range_pair): Make members to be of type size_t, not unsigned.
5482 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5483 (suppress_non_delimited, output_delimiter_specified,
5484 have_read_stdin, print_kth, set_fields): Now bool, nt int.
5485 (delim): Now unsigned char, not int.
5486 (mark_printable_field, is_printable_field, is_range_start_index,
5487 set_fields, set_fields, cut_bytes, cut_fields):
5488 Use size_t, not unsigned, for field and byte counts.
5489 (hash_int): Use uintptr_t, not unsigned, for pointers converted
5490 to integers. This squeezes more info out of them.
5491 (set_fields, cut_bytes, cut_fields, main):
5492 Use bool, not int, for booleans.
5493 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5495 2003-11-05 Paul Eggert <eggert@twinsun.com>
5497 * man/Makefile.am (check-programs-vs-x):
5498 Work even if $(programs) contains '$'.
5499 Work even if 'missing=1' in environment.
5500 Don't report an error simply because $(programs) outputs nothing.
5502 2003-11-05 Jim Meyering <jim@meyering.net>
5504 * Use autoconf-2.58. Regenerate dependent files.
5506 * src/tr.c (spec_init): Fix typo in last change.
5508 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5509 call to variadic version_etc function, so that it works even on systems
5510 for which sizeof char* != sizeof int.
5511 * src/true.c (main): Likewise.
5512 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5513 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5514 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5515 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5516 Similarly, cast NULL to `(char *)' in call to variadic function,
5517 parse_long_options, so that it works even on systems for which
5518 sizeof char* != sizeof int.
5519 A similar problem was reported by Harti Brandt in
5520 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5522 * src/users.c (users): Free `utmp_buf' explicitly so that people
5523 don't mistake this for a real leak.
5524 Patch by Dennis Smit <ds@nerds-incorporated.org.
5526 2003-11-04 Paul Eggert <eggert@twinsun.com>
5528 * README: Document _POSIX2_VERSION.
5530 2003-11-04 Jim Meyering <jim@meyering.net>
5532 * src/tac.c (memrchr): Remove #if-0'd function.
5533 (tac_stdin_to_mem): Clean up #if-0'd code.
5535 * src/od.c (decode_format_string): Remove unnecessary casts.
5536 Use more maintainable `sizeof *var'.
5537 (main): Call decode_format_string rather than decode_one_format,
5538 now that `spec' may be NULL.
5540 * src/chmod.c (AUTHORS): Add my name.
5542 * src/split.c (next_file_name): Use `sizeof *var' rather than
5543 hard-coding `sizeof size_t'.
5545 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5547 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5548 to avoid potential overflow in pointer arithmetic.
5549 (set_fields): Use not `1', but rather `sizeof *printable_field' as
5550 second argument to xcalloc.
5551 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5552 rather than xrealloc.
5553 * src/date.c (show_date): Likewise.
5554 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5555 * src/pr.c (store_char): Likewise.
5556 * src/fold.c (fold_file): Likewise.
5558 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5559 type changes (unsigned int -> size_t) in hash.c.
5560 * src/cp-hash.c (src_to_dest_hash): Likewise.
5561 * src/du.c (entry_hash): Likewise.
5562 * src/ls.c (dev_ino_hash): Likewise.
5563 * src/cut.c (hash_int): Likewise. Declare function as static.
5565 2003-11-03 Jim Meyering <jim@meyering.net>
5567 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5568 * tests/misc/fold: Fail the test immediately if we're not running
5569 the expected version of fold.
5571 2003-11-02 Jim Meyering <jim@meyering.net>
5573 * src/tr.c (append_normal_char, append_range, append_char_class)
5574 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5575 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
5576 and usually shorter.
5577 * src/copy.c (copy_internal): Likewise.
5578 * src/join.c (initseq, add_field, make_blank): Likewise.
5579 * src/od.c (main): Likewise.
5580 * src/cp.c (make_path_private): Likewise.
5581 * src/tsort.c (new_item, record_relation): Likewise.
5583 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5584 (main): Also remove anachronistic cast of xmalloc return value.
5585 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5586 (main): Also remove anachronistic cast of xmalloc return value.
5587 * src/sort.c (inittables): Likewise.
5588 (sort): Also Split a long line.
5590 2003-10-25 Jim Meyering <jim@meyering.net>
5592 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5593 type changes (unsigned int -> size_t) in hash.c.
5594 * src/cp-hash.c (src_to_dest_hash): Likewise.
5595 * src/du.c (entry_hash): Likewise.
5596 * src/ls.c (dev_ino_hash): Likewise.
5597 * src/cut.c (hash_int): Likewise. Declare function as static.
5599 2003-10-21 Jim Meyering <jim@meyering.net>
5601 Don't fail when run with VERBOSE=yes.
5602 * tests/chgrp/basic: Do `set +x' before starting the subshell
5603 from which we invoke chgrp. Otherwise, the output from the
5604 VERBOSE=yes-induced `set -x' would result in spurious differences.
5605 Reported by Russel Coker via Michael Stone.
5607 2003-10-19 Jim Meyering <jim@meyering.net>
5609 chmod now uses fts to perform a directory traversal when -R is
5610 specified. Before, it operated on full path names, and as such
5611 would encounter the PATH_MAX (often 4096) limit.
5613 * src/chmod.c: Include "xfts.h".
5614 (process_file): Rename from change_file_mode.
5615 Adapt to be used with fts.
5616 (process_files): New function.
5618 2003-10-18 Jim Meyering <jim@meyering.net>
5620 * tests/du/deref-args: Ensure that du -D now dereferences all
5621 symlinks specified on the command line, not just those that
5622 reference directories.
5624 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5625 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5626 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5627 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5628 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5629 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5630 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5631 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5632 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
5633 Update the call to parse_long_options so that `AUTHORS, NULL' are the
5635 * src/true.c (main): Append NULL to version_etc argument list.
5636 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5638 2003-10-17 Andreas Schwab <schwab@suse.de>
5640 * tests/mk-script: Get $srcdir from first parameter instead of
5642 (main): Update usage.
5644 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5645 first argument of mk-script.
5646 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
5648 2003-10-17 Jim Meyering <jim@meyering.net>
5650 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5651 generated `man' page is more readable. Suggestion from Dan Jacobson.
5653 * src/chown-core.c (change_file_owner): Handle the cases in
5654 which fts_info indicates an error with the given entry.
5656 * src/du.c (main): Simply assign to bit_flags.
5657 Don't bother with bit arithmetic.
5659 * tests/chmod/no-x: New file.
5660 * tests/chgrp/no-x: New file.
5661 * tests/chmod/Makefile.am (TESTS): Add no-x.
5662 * tests/chgrp/Makefile.am (TESTS): Likewise.
5664 * src/du.c: Include "xfts.h".
5665 (du_files): Use xfts_open, rather than fts_open.
5666 * src/chown-core.c (chown_files): Likewise.
5668 2003-10-16 Jim Meyering <jim@meyering.net>
5670 * src/chgrp.c (main): Simply assign to bit_flags.
5671 Don't bother with bit arithmetic.
5672 * src/chown.c (main): Likewise.
5673 Rename a couple of local variables.
5674 Remove unnecessary casts.
5676 * src/tail.c (start_bytes): Rename local, remainder, to avoid
5677 gcc's warning about shadowing a global.
5679 2003-10-15 Jim Meyering <jim@meyering.net>
5681 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5682 use fts to perform a directory traversal when -R is specified.
5683 Before, they operated on full path names, and as such would
5684 encounter the PATH_MAX (often 4096) limit.
5685 They are more efficient. For example, before, chgrp -R would
5686 take almost 5 seconds to change about 2000 directories and fail
5687 (with `File name too long'), while now it succeeds on a hierarchy
5688 of depth 20,000 in 1/10 the time.
5690 * src/chown.c: Include "userspec.h" and "fts_.h".
5691 (WRITTEN_BY): Add my name.
5692 (getpwnam, getgrnam, getgrgid): Remove declarations.
5693 (endpwent): Remove definition.
5695 (main): Handle new options.
5696 Call new function, chown_files rather than change_file_owner.
5698 * src/chgrp.c: Include "fts_.h".
5699 (WRITTEN_BY): Add my name.
5700 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
5703 (main): Handle new options.
5704 Call new function, chown_files rather than change_file_owner.
5706 Rewrite to iterate through hierarchies using fts rather than
5707 via explicit recursion.
5708 * src/chown-core.c: Include "fts_.h"
5709 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
5710 on a single file at a time.
5711 (chown_files): New function.
5712 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
5713 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
5714 [struct Chown_option] (dereference): Remove member with ambiguous name.
5715 [struct Chown_option] (affect_symlink_referent): New member.
5716 (chown_files): New prototype.
5718 * tests/chgrp/recurse: Update tests accordingly.
5719 * tests/chgrp/posix-H: New tests for the above.
5720 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
5722 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
5723 work even for superuser. Suggestion from Dan Jacobson.
5725 2003-10-14 Paul Eggert <eggert@twinsun.com>
5727 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
5729 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
5730 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
5731 * src/sort.c (parse_field_count): Handle the case where overflow
5732 and invalid suffix char are both reported.
5734 2003-10-14 Jim Meyering <jim@meyering.net>
5736 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
5737 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
5740 2003-10-13 Paul Eggert <eggert@twinsun.com>
5742 Fix to avoid a denial-of-service attack if the display width is
5743 enormous. Also, clean up the code a bit by removing duplicate code.
5745 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
5746 (calculate_columns): New function, that contains code that used
5747 to be common to print_many_per_line and print_horizontal.
5748 (print_many_per_line, print_horizontal): Use it.
5749 (decode_switches): Set max_idx here, not in calculate_columns.
5750 (print_current_files): Don't call init_column_info; calculate_columns
5752 (init_column_info): Don't allocate a lot more space than is needed
5753 to represent the current set of files. Allocate all the new
5754 size_t cells in one call to xnmalloc, rather than a row at a time.
5756 2003-10-13 Jim Meyering <jim@meyering.net>
5758 * src/ls.c (init_column_info): Add another FIXME comment.
5760 2003-10-13 Paul Eggert <eggert@twinsun.com>
5762 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
5763 Remove several arbitrary limits on hosts where int cannot represent
5766 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
5767 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
5768 struct column_info.col_arr[0], max_idx):
5769 Now size_t, not int.
5770 (get_funky_string): Return bool indicating success, instead of
5771 a negative count to indicate failure. Store number of columns
5772 through new parameter OUTPUT_COUNT; that way, they can never
5773 go negative. Change equals_end from int to bool. All uses
5775 (struct column_info.valid_len): Now bool, not int. All uses changed.
5776 (dired_dump_obstack, get_funky_string, clear_files,
5777 extract_dirs_from_files, print_current_files,
5778 print_many_per_line, print_horizontal, init_column_info,
5779 put_indicator, length_of_file_name_and_frills,
5780 print_with_commas): Use size_t, not int, for local variables
5782 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
5783 Check for TIOCGWINSZ returing negative values (or values greater
5785 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
5787 Use xmalloc and xnmalloc, not XMALLOC.
5788 (gobble_file): Use xnrealloc, not XREALLOC.
5789 (print_color_indicator): Remove now-unnecessary cast to size_t.
5791 2003-10-12 Paul Eggert <eggert@twinsun.com>
5793 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
5794 * tests/sort/sort-tests: Remove from CVS; assume that people
5795 brave enough to check coreutils out from CVS can rebuild it.
5797 2003-10-12 Jim Meyering <jim@meyering.net>
5799 New options: --preserve-root and --no-preserve-root.
5800 * src/chmod.c (change_file_mode): Honor new option.
5801 (change_file_mode): Strip trailing slashes on directory
5802 argument passed to change_dir_mode.
5803 (get_root_dev_ino): New function.
5804 (main): Initialize global, root_dev_ino.
5806 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
5807 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
5809 * src/chmod.c (change_file_mode): Likewise.
5811 2003-10-08 Jim Meyering <jim@meyering.net>
5813 * src/csplit.c (main): Remove obsolete FIXME.
5815 2003-10-07 Jim Meyering <jim@meyering.net>
5817 * Use automake-1.7.8. Regenerate dependent files.
5819 2003-09-29 Paul Eggert <eggert@twinsun.com>
5823 * doc/coreutils.texi (csplit invocation):
5824 The regexp offset need not have a sign; POSIX requires support
5825 for signless offets.
5827 Be more careful about int widths. For example, remove some
5828 arbitrary limits by replacing 'unsigned' with 'size_t',
5829 'uintmax_t', etc. Use standard bool rather than a homegrown type.
5830 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
5831 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
5832 to <stdbool.h> usage.
5833 (struct control): offset is now intmax_t, not int.
5834 repeat_forever is now bool, not int.
5835 (struct cstring): len is now size_t, not unsigned int.
5836 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
5837 size_t, not unsigned. start_line, first_available are now
5838 uintmax_t, not unsigned.
5839 (hold_count, control_used): Now size_t, not unsigned.
5840 (last_line_number, current_line, bytes_written):
5841 Now uintmax_t, not unsigned.
5842 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
5843 create_new_buffer, get_new_buffer, load_buffer, find_line,
5844 process_regexp, split_file, new_control_record, extract_regexp,
5845 get_format_width, get_format_prec, max_out):
5846 size args, locals, and returned values are now size_t, not unsigned
5848 (get_first_line_in_buffer, find_line, write_to_file,
5849 handle_line_error, process_line_count, regexp_error, process_regexp,
5851 File line, byte, and repetition counts are now uintmax_t, not unsigned.
5852 (check_for_offset): Don't require a sign before the offset.
5853 Use xstrtoimax to do the real work.
5854 (extract_regexp): Remove harmful cast of size to unsigned.
5855 256 -> 1<<CHAR_BIT, for clarity.
5856 (get_format_flags): Return at most 3, to avoid worries about overflow.
5858 (bytes_to_octal_digits): Remove.
5860 (cleanup): Don't check whether output_stream is NULL, since
5861 close_output_file does that for us.
5863 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
5864 (sizeof *p);" instead of the more long-winded alternatives.
5866 (get_new_buffer): Use O(1) algorithm for resizing a buffer
5867 to a much larger size, instead of an O(N) algorithm.
5869 (process_regexp): Use plain NULL rather than casted 0.
5871 (make_filename): Use %u, not %d, to format unsigned file number.
5873 (new_control_record): Use xrealloc exclusively, since it handles
5876 (extract_regexp): Change misspelled word in diagnostic.
5878 (get_format_width): Even if a minimum field width is specified,
5879 allow room for enough octal digits to represent the value of
5880 the maximum representible integer. This fixes a potential
5881 buffer overrun. Calculate this room at compile-time, not
5882 at run-time; this removes the need for bytes_to_octal_digits.
5883 Check for overflow; this removes a FIXME.
5885 (get_format_prec): Don't allow precision to be signed; it's
5886 not ANSI. Check for overflow. Remove hardcoded "11" as
5887 default precision; this fixes a potential buffer overrun
5888 on hosts with wider size_t.
5890 (get_format_conv_type): Change local variable to be of type
5891 unsigned char, not int; this removes a potential subscript
5892 violation on hosts where char is signed.
5894 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
5895 Allow "%%" in format. Don't overflow when
5896 counting lots of percents.
5898 (usage): Default sprintf format is %02u, not %d.
5900 2003-10-05 Jim Meyering <jim@meyering.net>
5902 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
5904 * src/du.c (du_files): Mark diagnostic for translation.
5906 2003-10-04 Jim Meyering <jim@meyering.net>
5908 * src/du.c (du_files): Ignore any failure of fts_close.
5909 Give better diagnostics for failed fts_open.
5911 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
5913 Deprecate existing use of -H (aka --si).
5914 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
5915 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
5916 (main): Warn that the meaning of -H will soon change to be
5919 2003-10-03 Jim Meyering <jim@meyering.net>
5921 * src/du.c: Accept --no-dereference (-P).
5923 2003-10-02 Jim Meyering <jim@meyering.net>
5925 * tests/du/trailing-slash: Adjust for slightly different output.
5927 Rewrite du.c to use fts.
5928 * src/du.c: Include "fts_.h", not ftw.h.
5929 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
5930 (IS_FTW_DIR_TYPE): Remove definition.
5931 (IS_DIR_TYPE): Define.
5932 (is_symlink_to_dir): Remove now-unnecessary function.
5933 (process_file, du_files): Rewrite to use fts.
5935 * tests/du/inaccessible-cwd: Ensure that even when run from an
5936 inaccessible directory, du can still operate on accessible
5937 directories elsewhere.
5938 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
5940 * tests/rm/deep-1: Ensure that du can process a hierarchy
5941 of depth 400 while using no more than 50KB of stack space.
5943 2003-10-01 Akim Demaille <akim@epita.fr>
5945 * announce-gen (print_news_deltas): New function, extracted from main.
5946 (main): Make `news_file' an array.
5947 Use '...=s' => \@var for --news and --url-directory specs.
5948 Before there were a couple of portability problems.
5950 2003-09-28 Jim Meyering <jim@meyering.net>
5952 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
5953 (syntax-check-rules): Add it.
5955 * src/copy.c: Remove unnecessary cast of alloca, since now it's
5956 guaranteed to be (void *).
5957 * src/cp.c: Likewise.
5958 * src/join.c: Likewise.
5959 * src/ln.c: Likewise.
5960 * src/ls.c: Likewise.
5961 * src/od.c: Likewise.
5962 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
5964 2003-09-27 Jim Meyering <jim@meyering.net>
5966 Don't exhaust virtual memory when processing large inputs.
5967 Fix this by removing csplit's internal free-list management;
5968 instead rely on malloc for that.
5970 * src/csplit.c (free_list): Remove global.
5971 (clear_all_line_control): Remove function.
5972 (get_new_buffer): Always use create_new_buffer to obtain a
5973 new buffer, rather than searching free_list.
5974 (free_buffer): Just call free.
5975 Reported by Nikola Milutinovic.
5977 2003-09-26 Jim Meyering <jim@meyering.net>
5979 * man/rm.x: Also list `chattr' in SEE ALSO section.
5980 Suggestion from Mark Hubbart.
5982 2003-09-25 Jim Meyering <jim@meyering.net>
5984 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
5985 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
5987 * Use autoconf-2.57d. Regenerate dependent files.
5989 2003-09-24 Jim Meyering <jim@meyering.net>
5991 Minor efficiency tweak.
5992 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
5993 (do_link): Likewise.
5995 2003-09-23 Jim Meyering <jim@meyering.net>
5997 * src/paste.c (paste_serial): Save errno after input error,
5998 to report proper errno value.
5999 Based on a patch from Paul Eggert.
6001 * src/tee.c (tee): Adjust fwrite arguments so that the return
6002 value is the number of bytes written.
6004 2003-09-16 Paul Eggert <eggert@twinsun.com>
6006 Don't assume ferror sets errno. Bug reported by Bruno Haible.
6008 * src/comm.c (compare_files): Save errno after input error,
6009 to report proper errno value.
6010 * src/fold.c (fold_file): Likewise.
6011 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6012 * src/unexpand.c (unexpand): Likewise.
6014 * src/csplit.c (close_output_file): Don't report bogus errno value
6015 after ferror discovers an output error. We don't know the proper
6016 errno value, since it might have been caused by any of a whole
6017 bunch of calls, and it might have been trashed in the meantime.
6018 Fixing this problem will require much more extensive changes;
6019 in the meantime just say "write error".
6020 * src/od.c (check_and_close, dump, dump_strings): Likewise.
6021 * src/uniq.c (check_file): Likewise.
6023 * src/join.c (get_line): Report error right away if I/O fails,
6024 so that the proper errno value is used.
6025 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6026 * src/tee.c (tee): Likewise.
6027 * src/uniq.c (check_file): Likewise.
6029 * src/od.c (skip): If a read fails, don't retry it later, so
6030 that we report the proper errno.
6032 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6034 * src/tee.c (tee): Once a write failure has occurred, don't bother
6035 writing anything more to that stream.
6037 * src/uniq.c (check_file): Check for ferror (stdout) even if
6040 * src/yes.c (UNROLL): Remove.
6041 (main): Exit immediately when write failure is detected.
6042 Simplify code by assigning to argv when argc == 1.
6044 2003-09-21 Paul Eggert <eggert@twinsun.com>
6046 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6047 (WRITTEN_BY): Change "Franc,ois" (actually using
6048 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6051 2003-09-19 Jim Meyering <jim@meyering.net>
6053 `du -D symlink-to-dir' would mistakenly omit the slash in
6054 lines like this: 24 symlink-to-dir/subdir
6055 * src/du.c (process_file): Fix offset calculation.
6056 Reported by Jeff Sheinberg as Debian bug #211591;
6057 http://bugs.debian.org/205251
6059 * tests/du/deref-args: New file/test for the above.
6060 * tests/du/Makefile.am (TESTS): Add deref-args.
6062 * src/du.c (process_file): Remove useless disjunct.
6064 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6066 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6067 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6068 Mark each WRITTEN_BY string as translatable.
6070 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6071 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6072 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6073 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6074 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6075 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6076 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6077 * who.c, whoami.c, yes.c: Revert yesterday's changes.
6078 Instead, a subsequent change will embed `Written by ' in
6079 each string along with the author names.
6081 * src/true.c: Revert yesterday's changes.
6082 * src/sys2.h: Likewise.
6084 2003-09-18 Jim Meyering <jim@meyering.net>
6086 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6087 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6088 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6089 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6090 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6091 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6092 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6093 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6094 comma-separated list of strings and/or update the call to
6095 parse_long_options so that `AUTHORS, NULL' are the last parameters.
6096 * src/true.c (main): Append NULL to version_etc argument list.
6097 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6099 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6100 shadowing the math function name. Also rename loga to log_a.
6102 2003-09-14 Jim Meyering <jim@meyering.net>
6104 * src/factor.c (print_factors): Give a separate diagnostic
6105 for numbers that are too large, but otherwise valid.
6106 Reported by Dániel Varga.
6108 2003-09-10 Jim Meyering <jim@meyering.net>
6110 * Use automake-1.7.7. Regenerate dependent files.
6112 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6113 of `fmt -1'. Using the just-built tr is a little cleaner.
6114 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6115 * man/Makefile.am (programs, check-x-vs-1): Likewise.
6117 2003-09-09 Jim Meyering <jim@meyering.net>
6119 * src/copy.c: Alphabetize includes.
6120 Remove duplicate inclusion of "same.h".
6122 2003-09-08 Jim Meyering <jim@meyering.net>
6124 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6125 Didn't give enough of a benefit, mainly because it's not yet
6130 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6131 (check-programs-vs-x): Fail if $(programs) is empty.
6133 * src/remove.c: Add a comment.
6135 2003-09-07 Jim Meyering <jim@meyering.net>
6137 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6138 Don't define. These symbols are no longer used.
6140 * tests/misc/tty-eof: Write ^D as \cD.
6141 Complete the change of 2003-08-02.
6143 * Makefile.maint (po-check): Use cvsu, so that a temporary source
6144 file in lib/ or src/ doesn't induce an unwarranted failure.
6145 Add a kludge to filter out the sole generated source file that
6146 also has translatable messages: src/false.c.
6148 2003-09-06 Jim Meyering <jim@meyering.net>
6150 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6151 (parse_options): Give a diagnostic for (but still accept) the
6152 deprecated --allow-missing option.
6154 2003-09-04 Paul Eggert <eggert@twinsun.com>
6156 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
6157 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6159 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
6160 size_bound ourselves. if an input file is a pipe and the user
6161 specified a size, use that size instead of trying to guess the
6162 pipe size. This has the beneficial side effect of avoiding the
6163 overhead of default_sort_size in that case. All callers changed.
6164 (sort): Remove static var size; now done by sort_buffer_size.
6166 2003-09-05 Jim Meyering <jim@meyering.net>
6168 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
6170 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6171 to start, rather than just .1. Upon failure, print unexpected state.
6173 2003-09-04 Paul Eggert <eggert@twinsun.com>
6175 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6176 SAFE_READ_ERROR to tmp->nbytes.
6177 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6179 * src/head.c (struct linebuffer): Change nbytes and nlines
6180 from unsigned int to size_t. unsigned int is safe (after the
6181 2003-09-03 patch) but size_t is cleaner.
6182 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6183 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6185 Standardize on BUFSIZ as opposed to other macro names and values.
6186 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
6187 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6188 stdio.h has always defined it,
6189 and other code already assumes it's defined.
6190 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6191 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6192 (io_buf): IO_BUF_SIZE -> BUFSIZ.
6194 2003-09-04 Paul Eggert <eggert@twinsun.com>
6196 * src/seq.c (step): Default to 1.
6197 (print_numbers): Allow the output to be empty.
6198 (main): The default step is 1, even if LAST < FIRST;
6199 as per documentation.
6200 * tests/seq/basic (onearg-2): Output should be empty.
6202 2003-09-05 Jim Meyering <jim@meyering.net>
6204 * Makefile.cfg (wget_files): Temporarily disable, until master
6205 versions are restored to ftp.gnu.org.
6207 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6209 Make seq's --width (-w) option work properly even when the
6210 endpoint requiring the larger width is negative and smaller than
6212 * src/seq.c (get_width_format): Include `-' in the set of bytes
6213 allowed in a `simple' number (no decimal point, no exponent).
6214 Reported by Patrick Mauritz.
6216 2003-09-02 Paul Eggert <eggert@twinsun.com>
6218 * NEWS: sort -t '\0' now uses a NUL tab.
6219 sort option order no longer matters, unless POSIX requires it.
6220 * src/sort.c (usage): Say "blanks" instead of "whitespace",
6221 Similar fixes for many comments.
6222 (TAB_DEFAULT): New constant, so that we can support NUL as
6223 the field separator.
6224 (tab): Now int, not char. Initialize to TAB_DEFAULT.
6225 (specify_sort_size): If multiple sizes are specified, use the largest.
6226 (begfield, limfield): Support NUL tab char.
6227 (set_ordering): Do not let -i override -d.
6228 (main): Report an error if incompatible -o or -t options are given.
6229 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
6231 2003-09-05 Jim Meyering <jim@meyering.net>
6233 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6235 2003-09-03 Andreas Schwab <schwab@suse.de>
6237 Bug report and patch here:
6238 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6239 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6240 * src/head.c (elide_tail_lines_pipe): Likewise.
6242 2003-09-03 Jim Meyering <jim@meyering.net>
6244 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6245 small amount of code from him was first moved to lib/human.c, and was
6246 subsequently rewritten entirely.
6247 * src/df.c (AUTHORS): Likewise.
6249 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
6251 * src/md5sum.c (split_3): Accept the BSD format for generic
6252 message digest modes. Currently works with BSD's MD5 and SHA1
6253 formats since these are the two algorithms presently used in
6254 coreutils. Updated comments to reflect this change.
6255 (bsd_split_3): Updated comments.
6257 * tests/md5sum/basic-1: New test to make sure that
6258 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6259 from `check-bsd' test in tests/sha1sum/basic-1).
6261 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6262 --check exit status and BSD SHA1 format (adapted from tests
6263 in tests/md5sum/basic-1).
6265 2003-08-30 Jim Meyering <jim@meyering.net>
6267 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6269 When source and destination arguments refer to the same file, reside
6270 on a partition (e.g. VFAT) on which distinct names may refer to the
6271 same directory entry (often due to variations in case), and when the
6272 link count for the file is 1, mv no longer unlinks the file. Instead,
6273 it gives the expected diagnostic that the source and destination are
6274 the same. WARNING: this is an incomplete fix. If the file happens
6275 to have a link count of 2 or greater, such an erroneous mv command
6276 will still unlink it.
6277 Although that is not possible on vfat or umsdos, it is possible on
6278 other file system types, e.g., ntfs, and hpfs.
6279 * src/copy.c (same_file_ok): Invoke same_name (which might still
6280 return false for names that refer to the same directory entry)
6281 only if the link count is 2 or more.
6282 * tests/mv/vfat: Show how to demonstrate the above problem.
6283 This test is not run.
6284 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6286 2003-08-27 Jim Meyering <jim@meyering.net>
6288 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6289 who's -l option has been eliciting an unconditional warning about
6290 this impending change since sh-utils-2.0.12 (April 2002).
6292 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6293 This would happen for nonempty files not ending with a newline.
6294 Reported by Dan Jacobson.
6295 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
6296 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6298 * src/stat.c (print_it): Avoid buffer overrun that would
6299 occur when the user-specified format string ends with `%'.
6300 Patch by Tommi Kyntola.
6301 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
6302 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6304 2003-08-26 Jim Meyering <jim@meyering.net>
6306 Apply changes from bison.
6307 * GNUmakefile (SHELL): Define to `sh', if necessary.
6309 * Makefile.maint (WGETFLAGS): Define to `-C off'.
6310 Update all uses of $(WGET).
6312 2003-08-22 Akim Demaille <akim@epita.fr>
6314 * Makefile.cfg (local-checks-to-skip): New.
6315 * Makefile.maint (local-check): Rename as...
6316 (local-checks-available): this.
6319 2003-08-26 Akim Demaille <akim@epita.fr>
6321 * announce-gen (print_changelog_deltas): Neutralize "<#" as
6322 "<\#" to avoid magic from Gnus when posting parts of this script.
6324 2003-08-25 Jim Meyering <jim@meyering.net>
6326 * src/stat.c (main): Warn about use of deprecated `-l' option.
6328 2003-08-22 Jim Meyering <jim@meyering.net>
6330 * src/stat.c (do_stat): For link count at end of line, use %h format,
6331 instead of %-5h. The latter would make stat emit trailing spaces.
6332 Reported by Dan Jacobson.
6334 2003-08-20 Jim Meyering <jim@meyering.net>
6336 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6338 2003-08-19 Jim Meyering <jim@meyering.net>
6340 * src/system.h: Include stdlib.h unconditionally,
6341 as we're now assuming that part of hosted C89.
6343 2003-08-18 Jim Meyering <jim@meyering.net>
6345 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6346 to avoid warnings from gcc.
6348 2003-08-17 Jim Meyering <jim@meyering.net>
6350 Avoid unnecessary and sometimes time-consuming hostname lookups.
6351 * src/who.c (print_user): Use strchr, not strrchr.
6352 * src/pinky.c (print_entry): Likewise.
6353 Patch by Michael Stone.
6354 This fixes a typo I introduced in who-users.c on 1996-02-23.
6356 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6357 disallowed between `@...@'.
6359 2003-08-16 Paul Eggert <eggert@twinsun.com>
6361 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6362 done by gnulib .m4 files.
6363 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6364 * src/sys2.h (strtoull): Remove unused declaration.
6366 2003-08-16 Jim Meyering <jim@meyering.net>
6368 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6371 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6372 race condition bug. The bug would be triggered when tailing a file
6373 with file pointer not at beginning of file, and where the file was
6374 truncated to have a length of less than the initial offset at just
6375 the right moment (between the two lseek calls in this function).
6377 An invalid initial value for *read_pos would result in
6378 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6379 busy-wait rather than sleeping between iterations. The bug manifests
6380 itself only when tailing regular files that are initially nonempty.
6381 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6383 (tail_lines): Likewise, after lseek calls.
6384 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
6385 * tests/tail-2/tail-n0f: New file. Test for above fix.
6386 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6388 2003-08-15 Jim Meyering <jim@meyering.net>
6390 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6391 (sc_sun_os_names): Likewise.
6392 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6394 * man/help2man: Remove some SPACEs before TAB.
6396 2003-08-14 Paul Eggert <eggert@twinsun.com>
6398 * Makefile.maint (LC_ALL): Set to C.
6399 * man/Makefile.am (ASSORT): New var.
6400 (check-x-vs-1, programs): Use it.
6401 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6402 * tests/Makefile.am (ASSORT, all_programs): Likewise.
6404 2003-08-11 Jim Meyering <jim@meyering.net>
6406 fold -s -wN would infloop for N < 8 with TABs in the input.
6407 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6408 * src/fold.c (fold_file): Move contents of `else'-block
6409 out of conditional so it's used also for --spaces (-s).
6410 * tests/misc/fold: Test for the above fix.
6411 * tests/misc/Makefile.am (TESTS): Add fold.
6413 2003-08-10 Jim Meyering <jim@meyering.net>
6415 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6416 system.h so the types from time.h and sys/time.h are available.
6417 It appears that this is necessary for OpenBSD, NetBSD, and
6418 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
6420 2003-08-06 Paul Eggert <eggert@twinsun.com>
6422 * NEWS: Add support for setting file timestamps to microsecond
6423 resolution, on hosts that support this.
6424 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6425 * src/copy.c (copy_internal):
6426 Set file timestamps with utimens, not utime.
6427 * src/cp.c (re_protect): Likewise.
6428 * src/install.c (change_timestamps): Likewise.
6429 * src/touch.c (newtime, touch, main): Likewise.
6431 2003-08-09 Jim Meyering <jim@meyering.net>
6433 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6435 (syntax-check-rules): Add it.
6437 * src/tail.c (main): Tweak Solaris OS version number in comment.
6438 * src/wc.c (wc): Likewise
6439 * tests/tail-2/fflush: Likewise.
6441 * src/tail.c: Add new undocumented option, --presume-input-pipe.
6442 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6444 2003-08-08 Paul Eggert <eggert@twinsun.com>
6446 Use new gnulib 'extensions' module.
6447 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6450 2003-08-08 Paul Eggert <eggert@twinsun.com>
6452 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6454 2003-08-09 Jim Meyering <jim@meyering.net>
6456 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6457 For tests of obsolete behavior, don't presume that unsetting
6458 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6460 2003-08-07 Paul Eggert <eggert@twinsun.com>
6462 * doc/coreutils.texi (split invocation):
6463 Add -d or --numeric-suffixes option to 'split'.
6464 From a suggestion by Jesse Kornblum.
6465 * src/split.c (suffix_alphabet): New var.
6466 (longopts, usage, next_file_name, main): Support -d.
6467 (next_file_name, main): Allow -a0, as POSIX requires.
6468 (next_file_name): Don't assume ASCII-like encoding;
6469 'a' through 'z' are not contiguous in EBCDIC.
6471 2003-08-05 Paul Eggert <eggert@twinsun.com>
6473 Merge getline from gnulib.
6474 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6475 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6476 New files, from gnulib.
6477 * lib/getdelim2.c, lib/getdelim2.h: Remove.
6478 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6479 getdelim2.h to getndelim2.c and getndelim2.h.
6480 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6481 checking for getdelim.
6482 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6483 than rolling our own.
6484 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6485 (cut_fields): Invoke getndelim2 rather than getdelim2.
6487 2003-08-04 Jim Meyering <jim@meyering.net>
6489 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6490 and for the indices to iterate through nsigs.
6492 2003-08-02 Paul Eggert <eggert@twinsun.com>
6494 * src/sort.c: Minor code cleanups, mostly to use more accurate
6495 types and to remove unnecessary casts.
6496 (min, max): Remove. All uses changed to MIN and MAX.
6497 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6498 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6499 keyfield.numeric, struct keyfield.general_numeric, struct
6500 keyfield.month, struct keyfield.reverse, reverse, unique,
6501 have_read_stdin): Now bool, not int. All uses changed.
6502 (eolchar): Now char, not int.
6503 (struct keyfield.ignore): Now bool const *, not int *.
6504 (struct keyfield.translate): Now char const *, not char *.
6505 (struct month.name): Likewise.
6506 (blanks, nonprinting, nondictionary): Now bool[], not int[].
6507 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6508 check, sort, main): Use const * pointers when possible.
6509 (month_cmp): Rewrite to avoid casts.
6510 (inittables): Initialize tables unconditionally, to avoid branches.
6511 (fillbuf): Return bool, not int. All uses changed.
6512 (fillbuf, keycompare, new_key, main):
6513 Use SIZE_MAX rather than (size_t) -1.
6514 (trailing_blanks): Renamed from trim_trailing_blanks.
6515 Return the number of blanks to trim. All uses changed.
6516 (getmonth): Use trailing_blanks rather than open code.
6517 (keycompare): Do not cast char * to unsigned char *; not needed.
6518 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6520 (compare, main): Use | rather than || to avoid jumps.
6521 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6523 (check, first_same_file, sort, main):
6524 Use bool instead of int local vars when possible.
6525 (check): Merge the old 'checkfp' and 'check' into a single function,
6526 that returns a boolean (true if the file was ordered).
6528 (main): Use int instead of unsigned for iterating through nsigs.
6529 Rename local var "posix_pedantic" to "posixly_correct".
6531 2003-08-02 Jim Meyering <jim@meyering.net>
6533 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6534 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6536 * src/cut.c (cut_fields): Don't read again after encountering an
6537 initial EOF. E.g., `cut -f2' would do so.
6538 * tests/misc/tty-eof: Add a test for the above fix.
6540 * src/sort.c (sortlines): Add description and references.
6543 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6544 the tests in help-version will use the just-built binaries.
6545 Reported by Christian Krackowizer.
6547 2003-07-31 Paul Eggert <eggert@twinsun.com>
6549 * NEWS: Add --rfc-2822 option to GNU date.
6550 * doc/coreutils.texi (Time directives, Options for date, Examples
6552 * src/date.c (long_options, usage, main): Likewise.
6553 * doc/getdate.texi (General date syntax): Likewise.
6554 * doc/coreutils.texi (Options for date): Fix a typo in format:
6555 it's now %d not %_d. Add URLs.
6557 2003-08-01 Jim Meyering <jim@meyering.net>
6559 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6560 Otherwise, with at least the /bin/sh from HPUX 10.20,
6561 the trap code would end up converting that to exit 1 and thus an
6562 unexpected test failure. Reported by Christian Krackowizer.
6564 2003-07-31 Paul Eggert <eggert@twinsun.com>
6566 * src/ptx.c: Do not include bumpalloc.h.
6567 (WORD_TABLE): New member alloc.
6568 (ALLOC_NEW_WORD): Remove.
6569 (occurs_alloc): New var.
6570 (digest_word_file, find_occurs_in_text): Check for arithmetic
6571 overflow when computing table size. Use xrealloc rather than
6572 bumpalloc primitives.
6574 2003-07-29 Jim Meyering <jim@meyering.net>
6578 * README: When running tests as root, suggest using
6579 sudo with NON_ROOT_USERNAME=$USER.
6581 * tests/Makefile.am (all_programs): Makefile is in ../src, not
6584 2003-07-28 Jim Meyering <jim@meyering.net>
6586 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6588 2003-07-28 Paul Eggert <eggert@twinsun.com>
6590 * lib/stdbool.hin (_Bool): Make it signed char, instead of
6591 an enum type, so that it's guaranteed to promote to int.
6592 * src/sort.c (sortlines_temp): Undo previous change.
6594 2003-07-28 Jim Meyering <jim@meyering.net>
6596 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6597 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6598 would cause lines[-1 - swap] (with swap = false) to evaluate to
6601 2003-07-27 Jim Meyering <jim@meyering.net>
6603 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6604 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6606 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6607 directories, as required by POSIX. Reported by Karl Berry.
6608 * tests/rm/dir-no-w: New file. Test for the above fix.
6609 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6611 * tests/mk-script: Emit `$xx', not its expansion.
6613 2003-07-27 Paul Eggert <eggert@twinsun.com>
6615 This change was inspired by a similar proposal by Stepan Kasal.
6616 * src/sort.c (mergelines, sortlines_temp): New functions.
6617 (sortlines): Use them, to reduce the number of times that
6618 we need to copy 'struct line' values. This improved CPU
6619 performance by about 30% on one 18 MB test.
6620 (sort): Don't invoke sortlines unless we have 2 or more lines.
6622 2003-07-26 Stepan Kasal <kasal@ucw.cz>
6624 * src/sort.c (sort): Don't require two `struct line's per text line,
6625 the new sort algorithm requires just 1.5.
6627 2003-07-27 Jim Meyering <jim@meyering.net>
6629 * src/pathchk.c (validate_path): Use %lu, not %ld.
6631 * src/cut.c (is_printable_field): Simplify bit arithmetic.
6633 * src/ls.c (sort_files): Put `volatile' in the right place.
6636 2003-07-26 Jim Meyering <jim@meyering.net>
6638 Use only one bit per field/offset in array, not one `int'.
6639 * src/cut.c (printable_field): Change type to `unsigned char'.
6640 (mark_printable_field, is_printable_field): New functions.
6641 Use them in place of all direct accesses of `printable_field'.
6643 * src/expand.c (parse_tabstops): Detect overflow properly.
6644 * src/cut.c (set_fields): Likewise.
6646 * src/rm.c: Include "dirname.h".
6647 (usage): Use base_name (program_name) in body of --help output.
6649 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6650 Idea from Brendan O'Dea, who suggested using
6651 `program_name = basename (argv[0]);' everywhere --
6652 can't do that, but using base_name works just fine here.
6654 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6656 2003-07-24 Paul Eggert <eggert@twinsun.com>
6658 Fix some POSIX-compliance problems with 'test'. This makes
6659 'test' more compatible with Bash.
6661 * NEWS, doc/coreutils.texi: Document the following.
6662 * src/test.c: Include exitfail.h.
6663 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6664 (test-syntax_error): Use it.
6665 (binary_operator): Now takes bool arg specifying whether left operand
6666 is -l ARG, so that caller determines this rather than us.
6668 (term): Use posixtest to evaluate parenthesized subexpressions.
6669 (unary_operator, one_argument): Remove support for -t without operand.
6670 (one_argument): Take argument from argv[pos].
6671 (one_argument, two_arguments, three_arguments): Advance pos.
6672 All callers changed.
6673 (three_arguments): Look for binary ops before "!". Then look
6674 for parenthesized one_argument expressions, instead of trusting
6675 expr () to do the right thing.
6676 (posixtest): Now takes number of args. All callers changed.
6677 Treat "( A B )" like "A B".
6678 (main): Set exit_failure to TEST_FAILURE. Don't depend on
6679 POSIXLY_CORRECT, as we now conform to POSIX by default.
6680 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6681 * tests/test/Test.pm (test_vector): Add several tests to check
6682 the above. Syntax errors now exit with status 2, not 1.
6683 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6685 2003-07-26 Jim Meyering <jim@meyering.net>
6687 * tests/help-version: Adjust for above change in test behavior:
6688 `[' exits with 2, not 1, and test doesn't accept --help or --version.
6690 * Makefile.maint (ME): Don't use trick suggested in Make manual.
6691 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
6693 * Makefile.maint (sc_system_h_headers): Another syntax check.
6694 (syntax-check-rules): Add it to the list.
6696 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
6697 so it matches `%ld' format even on 32-bit systems.
6699 * src/fmt.c (flush_paragraph): Cast field width to `int' to
6700 avoid warning on 64-bit systems.
6702 * src/ls.c (sort_files): Make `func' volatile, so it can't be
6703 clobbered by a `longjmp' into this function.
6705 2003-07-25 Jim Meyering <jim@meyering.net>
6707 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
6710 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
6711 because it'd evoke spurious failure on 64-bit systems.
6713 2003-07-24 Jim Meyering <jim@meyering.net>
6715 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
6716 output its current record counts. Reported by Jurriaan.
6718 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
6719 `wc' with no options. This goes along with the change of 2003-07-20.
6721 2003-07-23 Jim Meyering <jim@meyering.net>
6723 Don't include headers already included by system.h:
6724 * src/tr.c: Don't include errno.h.
6725 * src/true.c: Don't include version-etc.h.
6726 * src/test.c: Don't include limits.h or error.h.
6727 * src/stat.c: Don't include unistd.h or time.h.
6728 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
6729 * src/pr.c: Don't include time.h.
6730 * src/pathchk.c: Don't include errno.h.
6731 * src/nice.c: Don't include sys/time.h.
6732 * src/ls.c: Don't include stdlib.h.
6734 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
6735 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
6736 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
6737 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
6738 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
6739 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
6740 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
6741 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
6742 Don't include closeout.h.
6744 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
6745 can access the required version of rm.
6746 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6748 * tests/cut/Test.pm (out-delim3a): New test.
6750 * man/help2man: Update to version 1.33.
6752 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
6754 * src/dircolors.c: Include xstrndup.h.
6755 (xstrndup): Remove function, now that it's been factored out into
6758 2003-07-22 Paul Eggert <eggert@twinsun.com>
6760 * src/wc.c (wc): Fix typo in computation of file from file_x,
6761 which caused the former to be used uninitialized if file_x was
6764 2003-07-22 Jim Meyering <jim@meyering.net>
6766 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
6768 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
6769 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
6770 Thomas Luzat. See http://bugs.debian.org/202413 for details.
6772 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
6774 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
6776 * src/cut.c (set_fields): Mark all selected indices before trying to
6777 determine range endpoints.
6778 * tests/cut/Test.pm: New test for the above fix.
6780 Begin to address this comment: What if someone wants to
6781 extract the 1,000,000-th field of some huge input file?
6782 The first step is to rearrange things so that the values
6783 in the printable_field array are all 0/1 rather than 0/1/2.
6784 * src/cut.c (RANGE_START_SENTINEL): Remove.
6785 Store range-start indices in a hash table, rather than
6786 overloading the `printable_field' array.
6787 (range_start_ht): New global.
6788 (hash_int, hash_compare_ints, is_range_start_index): New functions.
6789 (print_kth): Use is_range_start_index; don't test printable_field.
6790 (set_fields): Detect overflow.
6791 (set_fields): Insert each range-start index into range_start_ht.
6792 (main): Call set_fields only once, and only after
6793 output_delimiter_specified and (if required) range_start_ht have
6796 2003-07-20 Paul Eggert <eggert@twinsun.com>
6798 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
6799 invoked with a null pointer when there were no file arguments.
6801 2003-07-20 Jim Meyering <jim@meyering.net>
6803 * Makefile.maint (sc_changelog): Add another nit-picky check.
6805 * src/wc.c (write_counts): Add a comment.
6806 (wc): Rename `file' parameter.
6807 Set new local, `file', to be the file name, or (when it's NULL)
6808 _("standard output") so that all uses of `file' use the proper value.
6809 Use STREQ, not strcmp.
6811 2003-07-20 Paul Eggert <eggert@twinsun.com>
6813 wc count field widths now are heuristically adjusted depending
6814 on the input size, if known. If only one count is printed, it
6815 is guaranteed to be printed without leading spaces.
6817 Previously, wc did not align the count fields if
6818 POSIXLY_CORRECT was set, but POSIX did not actually require
6819 this undesirable behavior, so it has been removed.
6821 * NEWS: Document this.
6822 * doc/coreutils.texi (wc invocation): Likewise.
6824 * src/wc.c (number_width): New var.
6825 (posixly_correct): Remove.
6826 (struct fstatus): New struct.
6827 (write_counts): Output fields of width number_width.
6828 Do not worry about POSIXLY_CORRECT.
6829 Use null file, not empty-string file, to denote stdin,
6830 since "" is a valid file name on some hosts.
6831 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
6833 (wc): Avoid problems if end_pos - current_pos overflows.
6834 Do not print odd message if stdin has a read error.
6835 (get_input_fstatus, compute_number_width): New functions.
6836 (main): Use them to implement the new behavior.
6837 Ignore POSIXLY_CORRECT.
6839 * tests/wc/Test.pm: Adjust to the new output widths.
6841 2003-07-19 Jim Meyering <jim@meyering.net>
6843 * tests/rm/fail-eperm: Don't create temporary directory --
6846 * tests/shred/remove: Don't open-code test for UID != 0.
6847 Use priv-check's require-non-root instead.
6848 Update to use newer framework.
6850 * tests/help-version (expected_failure_status_expr): Record that
6851 expr exits with status of 3 for e.g., a write error.
6853 * tests/priv-check: Use `id -u' to see if we're running as root,
6854 rather than trying go write to an write-protected file.
6855 When running as root, ensure $NON_ROOT_USERNAME is valid.
6856 When running as root with `require-non-root', ensure that `.'
6857 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
6858 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
6860 * src/printenv.c: Include "exitfail.h".
6861 (main): Set exit_failure rather than calling close_stdout_set_status.
6862 * src/date.c: Likewise.
6863 * src/sort.c: Likewise.
6864 * src/tty.c: Likewise.
6866 2003-07-18 Jim Meyering <jim@meyering.net>
6868 * tests/touch/not-owner: Update to use newer framework.
6870 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
6871 directory, and remove Perl-coded `you may not run as root' test.
6872 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
6873 hard-coding something not quite equivalent.
6874 Paul Jarc reported the inconsistent diagnostics.
6876 * src/sort.c (main): Use close_stdout via atexit.
6877 Now `sort --version' and `sort --help' fail, as they should
6878 when their output is redirected to /dev/full.
6880 * src/su.c (usage): Don't call close_stdout here.
6881 (main): Use close_stdout via atexit.
6882 Now `su --version > /dev/full' fails, as it should.
6883 Somehow, the change of 2000-05-07 that purports to fix this
6886 * tests/help-version (--help/--version vs. /dev/full): Special-case
6887 `[' to protect it from expected_failure_status-`eval'.
6889 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
6890 count and the corresponding line, as required by POSIX.
6891 Reported by Clement Wang.
6892 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
6894 * tests/expr/basic: Add tests for when exit status is 2.
6896 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
6897 Use an anonymous `enum', rather than #define.
6899 2003-07-17 Paul Eggert <eggert@twinsun.com>
6901 * src/expr.c: Include "exitfail.h", "quotearg.h".
6902 (EXPR_INVALID, EXPR_ERROR): New constants.
6903 (nomoreargs, null, toarith, nextarg): Return bool, not int.
6904 (syntax_error): New function, exiting with status 2. Use it
6905 insteading of printing "syntax error" ourselves.
6906 (main): Initialize exit_failure to EXPR_ERROR.
6907 Exit with EXPR_INVALID on syntax error (too few arguments).
6908 (nextarg): Use strcmp, not strcoll; strcoll might return
6909 an undesirable 0, or might fail.
6910 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
6911 or other such error.
6912 (eval2): Report an error if strcoll fails in a string comparison.
6913 * src/sort.c: Include "exitfail.h".
6914 (main): Set exit_failure, not xalloc_exit_failure and
6915 xmemcoll_exit_failure.
6916 * tests/expr/basic: Invalid value exits with status 3, not 2.
6918 2003-07-16 Jim Meyering <jim@meyering.net>
6920 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
6921 per GNU maintainer guidelines. The next non-beta release will be 5.1.
6923 This script would have caught at least two recent bugs:
6924 those in [ and kill.
6925 * tests/help-version: Revive this script.
6926 It wasn't doing anything useful, since $all_programs wasn't being
6927 defined by the invoking Makefile.am.
6928 Reflect that nohup is no longer a script, so don't exclude it.
6929 Add framework to handle the programs added since it was last run:
6930 kill, stat, unlink, [, link, readlink.
6931 Fix path-related problems deriving from the move of this script
6932 from src/ to its present location.
6933 * tests/Makefile.am (all_programs): Define.
6934 (TESTS_ENVIRONMENT): Use it.
6936 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
6937 whereby kill would always attempt to operate on argv[0] and fail.
6939 * src/test.c (integer_expected_error): Improve diagnostic -- now,
6940 it also matches the one from bash's builtin test.
6941 (binary_operator): Add \n at end of diagnostic.
6943 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
6944 * tests/priv-check: Move setuidgid-related and
6945 NON_ROOT_USERNAME-checking code to this file.
6947 * README: Update section on testing as `root'.
6948 Suggestion from Paul Jarc.
6950 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
6951 names of authors that I just found in bash's builtins/test.def.
6953 Running `[' with no arguments would evoke a segfault.
6954 * src/test.c (main) [LBRACKET]: Move initialization of argv to
6955 precede potential use via test_syntax_error.
6957 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
6958 warning from automake -Wall.
6960 2003-07-15 Jim Meyering <jim@meyering.net>
6964 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
6967 * announce-gen (print_changelog_deltas): Relax tests for matching
6968 version-number line in NEWS.
6969 Change the .sig suffix to .asc here, too.
6971 2003-07-14 Jim Meyering <jim@meyering.net>
6973 * Makefile.maint (%.asc): Renamed from %.sig.
6974 Generate and use ascii-armored signatures.
6975 Use gpg's -o option.
6977 2003-07-13 Jim Meyering <jim@meyering.net>
6979 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
6982 * Makefile.maint (syntax-check): Move each individual check into
6984 (syntax-check-rules): This is the list of syntax-check targets.
6985 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
6986 (sc_cast_of_x_alloc_return_value, sc_space_tab):
6987 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
6989 2003-07-12 Jim Meyering <jim@meyering.net>
6991 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
6992 traces of the nohup script.
6994 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
6995 $(OPTIONAL_BIN_ZCRIPTS).
6997 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
6998 target, not before the `>'.
7000 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7001 now that that function no longer calls `error'.
7003 * src/df.c (find_mount_point): Emit a diagnostic for each
7004 failed syscall, rather than relying on caller to do that.
7005 The caller couldn't do a good job, anyhow -- too many different
7006 ways to fail (each with a different referent).
7007 Give a diagnostic upon failed save_cwd, now that that function
7008 no longer calls `error'.
7009 (show_point): Don't diagnose find_mount_point's errors, now that
7010 it handles them itself.
7012 * src/df.c (find_mount_point): Don't let free clobber errno upon
7015 * src/sys2.h: Remove alloca-related block.
7016 * src/system.h: Include <alloca.h> here, instead.
7018 It appears that the `#pragma alloca' included via "system.h" is
7019 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7020 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7021 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7023 * src/chown-core.c (change_file_owner): Do not restore any special
7024 permission bits (e.g., set-user-ID, set-group-ID) that are reset
7025 by chown(2) on some systems. Suggestion and insistence :-) from
7028 * tests/input-tty: Also check `test -t 1'.
7029 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
7030 test would block when run in the background.
7032 2003-07-11 Jim Meyering <jim@meyering.net>
7034 * tests/sample-test: Also fail if cat-to-create-expected-output
7035 fails. Otherwise, if both `exp' and `out' were to end up empty
7036 because of e.g., a full disk, they would mistakenly compare equal.
7038 * src/nohup.c: New file. Rewrite of nohup.sh in C.
7039 This solves a portability problem: on at least Solaris systems,
7040 when nohup.sh used the vendor /bin/sh, it would exit with status
7041 of `1' rather than the required 126 or 127 upon failure to exec
7042 the specified program.
7044 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7045 (bin_PROGRAMS): Add nohup.
7046 (EXTRA_DIST): Remove nohup.sh.
7047 (all_programs): Remove use of $(EXTRA_SCRIPTS).
7048 * src/nohup.sh: Remove file.
7049 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7051 * tests/misc/nohup: Tests for the above.
7052 * tests/misc/Makefile.am (TESTS): Add nohup.
7054 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7055 the macro, COPY_FD_DIAGNOSE.
7056 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7057 (head_file): Likewise.
7059 * src/date.c: Include "quote.h".
7060 (batch_convert): Use the quote function rather than using literal `...'
7063 * src/setuidgid.c (main): Enclose diagnostic in _(...).
7064 * src/fmt.c (main): Likewise.
7065 * src/mknod.c (main): Likewise.
7066 * src/tac.c (tac_seekable): Likewise.
7067 * src/yes.c (main): Likewise.
7068 * src/od.c (main): Likewise.
7069 * src/install.c (change_attributes): Likewise.
7071 2003-07-10 Jim Meyering <jim@meyering.net>
7073 * src/head.c (usage): Use 1024*1024 in place of 1048576.
7074 * src/tail.c (usage): Likewise.
7076 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7077 place of the kludge in this test. Suggestion from Paul Jarc.
7079 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7080 * src/setuidgid.c: New program, solely for testing (not installed).
7082 * src/chown-core.c (change_file_owner): Don't leak file descriptors
7083 when dereferencing symlinks.
7085 2003-07-09 Jim Meyering <jim@meyering.net>
7087 * tests/du/slash: New file/test for today's lib/ftw.c fix.
7088 * tests/du/Makefile.am (TESTS): Add slash
7090 * src/tail.c (xlseek): Avoid warning about ``return without value
7091 from function returning non-void''.
7093 2003-07-08 Jim Meyering <jim@meyering.net>
7095 * man/help2man: Update to version 1.29.
7097 * man/help2man: Add END handler to close STDOUT and check for errors.
7099 2003-06-30 Paul Eggert <eggert@twinsun.com>
7101 Add support for a "[" that conforms to the GNU coding standards,
7102 i.e., that does not depend on its name.
7103 * src/lbracket.c: New file.
7105 * man/Makefile.am (programs): Ignore "[", since it doesn't have
7106 a separate man page.
7107 * src/Makefile.am (bin_PROGRAMS): Add "[".
7108 (__SOURCES): New var.
7109 * src/test.c (LBRACKET): Define to 0 if not defined.
7110 (main): Use LBRACKET rather than argv[0].
7112 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7113 Reported by Paul Jarc and Dan Jacobson.
7115 * src/test.c (main): Do not recognize --help or --version if
7116 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
7117 Do not bother testing that margv[margc] is non-null.
7119 2003-07-04 Jim Meyering <jim@meyering.net>
7121 * src/who.c (print_line): Rewrite to use asprintf, in order to be
7122 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
7124 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7125 option, and perform the +1600 invocations of head IFF the envvar
7126 RUN_EXPENSIVE_TESTS is set.
7128 2003-07-03 Jim Meyering <jim@meyering.net>
7130 * src/cp.c (do_copy): Give a better diagnostic when failing due
7131 to nonexistent destination directory. Reported by Dmitry Rutsky.
7132 See http://bugs.debian.org/199730 for details.
7134 2003-06-27 Jim Meyering <jim@meyering.net>
7136 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7137 * src/split.c (longopts): Use `1', not `0' as the value for
7138 for &verbose. Reported by Keith Thompson.
7140 Test for the above fix.
7141 * tests/misc/split-a: Also use --verbose and compare stderr
7142 output with what we'd expect.
7144 2003-06-20 Jim Meyering <jim@meyering.net>
7146 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7147 Use `error_t' (rather than int) as type for local `err'.
7148 From Alfred M. Szmidt.
7150 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
7152 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7153 Fix author preservation code.
7155 2003-06-19 Jim Meyering <jim@meyering.net>
7157 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7158 (do_link): Don't warn about hard link to symlink.
7160 2003-06-18 Jim Meyering <jim@meyering.net>
7162 * src/cut.c: Include "getdelim2.h", not "getstr.h".
7163 Reflect renaming: getstr -> getdelim2.
7165 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7166 readline -> readlinebuffer.
7168 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
7170 * src/readlink.c: Include <sys/types.h> before system.h (because
7171 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
7173 2003-06-17 Jim Meyering <jim@meyering.net>
7175 * src/system.h (initialize_main): Define.
7176 Use it in every `main'. Applied via this:
7177 p='initialize_main (&argc, &argv);'
7178 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
7179 $(grep -l program_name.=.argv.0 *.c)
7180 test.c uses margc/margv, so I made the change manually for that file.
7181 Based on a patch from Bernard Giroud.
7183 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
7185 Fix for build failure on Ultrix 4.3.
7186 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7187 Include sys/param.h and sys/mount.h on ultrix.
7189 2003-06-16 Jim Meyering <jim@meyering.net>
7191 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7193 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7194 them here instead, but with one change: define EISDIR to -1, not 0.
7196 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7197 guaranteed to be defined.
7198 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7200 * README: Mention the CVS repository.
7201 Encourage addition of test cases.
7203 2003-06-12 Jim Meyering <jim@meyering.net>
7205 * src/touch.c (touch): Call close only if necessary.
7208 * src/wc.c (usage): Correct wording: wc prints counts in the order
7209 `newline, word, byte'. Reported by Keith M. Briggs.
7210 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
7212 2003-06-10 Jim Meyering <jim@meyering.net>
7214 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7216 2003-06-07 Jim Meyering <jim@meyering.net>
7218 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7221 2003-06-06 Jim Meyering <jim@meyering.net>
7223 * src/extract-magic (main): Avoid newer 3-arg form of open,
7224 so this script works also with e.g., perl5.005_03.
7225 Patch by John David Anglin.
7227 2003-06-04 Paul Eggert <eggert@twinsun.com>
7229 * src/system.h: Include <stdbool.h> unconditionally.
7231 2003-06-04 Jim Meyering <jim@meyering.net>
7233 * man/Makefile.am (check-programs-vs-x): Rename target
7234 from check-programs-vs-1. Adjust rule to check for the
7235 primary (.x) file, not the generated one (.1).
7237 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7239 * man/kill.x: New file.
7240 * man/Makefile.am (dist_man_MANS): Add kill.1.
7243 2003-06-04 Jim Meyering <jim@meyering.net>
7245 Ensure that the .x file for a new program is never forgotten again.
7246 * man/Makefile.am (programs): Define.
7247 (check-programs-vs-1): New phony target.
7248 (check-local): Depend on it.
7250 2003-06-03 Jim Meyering <jim@meyering.net>
7252 Avoid unnecessary copying of environment.
7253 * src/env.c (main): Rather than clearing the environment and --
7254 unless told to ignore environment -- copying all settings from
7255 the saved, original environment, clear the environment only when
7256 that is requested. Suggested by Jens Elkner.
7258 2003-06-02 Jim Meyering <jim@meyering.net>
7260 * src/system.h: Always include <string.h>, since we assume C89.
7261 Include <limits.h> without checking for HAVE_LIMITS_H.
7263 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7264 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7266 2003-06-01 Jim Meyering <jim@meyering.net>
7268 Avoid a race condition in `tail -f' described by Ken Raeburn in
7269 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7270 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7271 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7272 (tail_bytes, tail_lines, tail): Likewise.
7273 (tail_file): Use the new `read_pos' value as the size,
7274 rather than stats.st_size from the fstat call.
7276 2003-05-28 Jim Meyering <jim@meyering.net>
7278 * src/extract-magic: Allow expansion of `$file' in the here-
7279 document corresponding to the comment at the top of fs.h.
7281 2003-05-26 Jim Meyering <jim@meyering.net>
7283 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7284 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7285 Use #if/#elif/... cascade so we get only one set of include files.
7286 Reported by Nelson Beebe.
7288 2003-05-24 Jim Meyering <jim@meyering.net>
7290 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7291 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7292 accept the BSD format.
7294 2003-03-28 Joe Orton <jorton@redhat.com>
7296 * src/md5sum.c (bsd_split_3): New function.
7297 (split_3): Detect checksums from BSD 'md5' command and handle them
7300 * tests/md5sum/basic-1: New tests for --check exit status, and for
7301 BSD-style checksum files.
7303 2003-05-21 Jim Meyering <jim@meyering.net>
7305 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7306 This sort of thing is why it'd be *Really Good* to factor
7307 out the common code used here and in tail.c.
7309 2003-05-14 Jim Meyering <jim@meyering.net>
7311 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7313 * tests/du/slink: Skip this test if `.' is on an XFS file system.
7315 * tests/du/fd-leak: New file. Test for the bug in du that
7316 was fixed by the 2003-05-12 change to lib/ftw.c.
7317 * tests/du/Makefile.am (TESTS): Add fd-leak.
7319 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7320 includes a translatable word, `and'.
7322 * src/dd.c (usage): Don't use `,' as the thousands separator
7323 in e.g. 1,000,000 and 1,048,576. Instead, do this:
7324 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7325 * src/df.c (usage): Likewise.
7326 * src/du.c (usage): Likewise.
7327 * src/ls.c (usage): Likewise.
7329 * Makefile.maint (syntax-check): Add another check.
7331 2003-05-13 Paul Eggert <eggert@twinsun.com>
7333 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7334 must output nothing. Problem reported by Josh Hyman.
7336 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7337 (output_unique, output_first_repeated, output_later_repeated):
7338 New vars. All uses of "mode" changed to use these variables,
7339 which are not mutually exclusive as "mode" was.
7340 (writeline): New arg "match", used to control whether to
7341 obey output_first_repeated or output_later_repeated.
7342 All callers changed.
7343 (check_file, main): Adjust to above changes.
7345 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7347 2003-05-14 Jim Meyering <jim@meyering.net>
7349 * tests/rm/rm3: Use tr's \n notation rather than \012.
7350 This package can afford to do that, since its tests are guaranteed use
7351 GNU tr, which has accepted the more modern notation for 10 years.
7352 * tests/rm/rm5: Likewise.
7353 * tests/cp/same-file: Likewise.
7354 * tests/stty/row-col-1: Likewise.
7355 * tests/stty/basic-1: Likewise.
7356 * tests/rm/deep-1: Likewise.
7357 * tests/mv/part-symlink: Likewise.
7358 * tests/mkdir/perm: Likewise.
7359 * tests/misc/nice: Likewise.
7361 2003-05-13 Jim Meyering <jim@meyering.net>
7363 * src/copy.c (struct F_triple) [name]: Remove const attribute.
7364 (triple_free): Don't apply cast to argument of free.
7365 (seen_file): Add cast here instead.
7367 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7368 (src_to_dest_free): Don't apply cast to argument of free.
7370 * src/sort.c (zaptemp): Don't apply cast to argument of free.
7371 * src/pr.c (init_fps, init_store_cols): Likewise.
7372 * src/join.c (delseq, freeline): Likewise.
7373 * src/expr.c (OLD): Likewise.
7374 * src/sort.c (sort): Likewise.
7375 * src/head.c (elide_tail_lines_pipe): Likewise.
7377 * src/tail.c: Include "quote.h".
7378 Use quote in diagnostics. Change many error format strings
7379 from just `%s' to e.g., `error reading %s'.
7380 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7381 Rewrite newline-counting loop to use memchr.
7383 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7384 Now that assert is no longer used, don't include <assert.h>.
7386 2003-05-12 Jim Meyering <jim@meyering.net>
7388 * src/head.c: Include <assert.h>.
7389 (AUTHORS): Add my name.
7390 (elide_tail_lines_pipe): New function.
7392 2003-05-10 Jim Meyering <jim@meyering.net>
7394 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7396 * src/readlink.c (main): Set program_name before first use.
7397 Remove that (redundant) first use.
7398 Don't exit successfully just because --verbose was specified.
7399 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7400 parameter is 0, error does not exit.
7402 * src/uname.c (main): When failing due to too many arguments, also say
7403 that, rather than just "Try `uname --help' for more information.".
7404 * src/comm.c (main): Likewise, but for too few arguments.
7405 * src/logname.c: Include error.h.
7406 (main): Say why we're failing.
7408 * src/uniq.c (main): Don't segfault when argc < optind.
7409 * src/who.c (main): Handle argc < optind.
7410 * src/df.c (main): Likewise.
7411 * src/install.c (main): Likewise.
7412 * src/mv.c (main): Likewise.
7413 * src/pwd.c (main): Likewise.
7414 * src/tty.c (main): Likewise.
7415 * src/chroot.c (main): Likewise.
7416 * src/hostname.c: Likewise.
7417 * src/du.c (main): Likewise.
7418 * src/expand.c (main): Likewise.
7419 * src/env.c (main): Likewise.
7420 * src/unexpand.c (main): Likewise.
7421 * src/printenv.c (main): Likewise.
7422 * src/sync.c (main): Handle argc == 0.
7423 * src/expr.c (main): Likewise.
7424 * src/printf.c (main): Likewise.
7425 * src/basename.c (main): Likewise.
7426 * src/ln.c (main): Test for `missing argument' before computing n_files.
7427 * src/tail.c (main): Test for the case of no arguments before
7430 * src/kill.c (send_signals): Don't check command line arguments here.
7431 (main): Check them here instead. Handle argc < optind.
7433 * src/logname.c (main): Use error, rather than fprintf, for the sake
7436 * src/rm.c (main): Don't overrun array bound if argc is 0.
7438 2003-05-09 Jim Meyering <jim@meyering.net>
7440 * src/sort.c (main): Don't overrun array bound if argc is 0.
7441 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7442 Reported by Wartan Hachaturow.
7444 2003-05-07 Jim Meyering <jim@meyering.net>
7446 Implement support so that `head --lines=-N' works on seekable files.
7447 * src/head.c (enum Copy_fd_status): Define.
7448 (COPY_FD_DIAGNOSE): New macro.
7449 (elide_tail_lines_seekable): New funtion.
7450 (elide_tail_lines_file): Call it here.
7452 2003-05-06 Jim Meyering <jim@meyering.net>
7454 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7456 2003-05-04 Jim Meyering <jim@meyering.net>
7458 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7459 caused the addition of thousands of small files to the tar archive.
7460 * tests/misc/head-elide-tail: New file. Add them here instead.
7461 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7463 2003-05-04 Paul Eggert <eggert@twinsun.com>
7465 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7466 (IF_READDIR_NEEDS_REWINDDIR): Remove.
7467 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7468 which was a bit weird because it couldn't be emulated by a function.
7470 2003-05-03 Jim Meyering <jim@meyering.net>
7472 Extend head to accept --lines=-N (--bytes=-N) and to print all
7473 but the N lines (bytes) at the end of the file.
7474 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7475 Use quote() in diagnostics, rather than literal `' marks.
7476 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7478 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7479 (head_file): Reorganize so as to call head from only one place.
7480 (main): Likewise, for head_file.
7481 Handle new, undocumented option, --presume-input-pipe.
7482 Handle negative line and byte counts.
7483 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7485 * tests/du/8gb: Skip test if the file system of `.' doesn't support
7486 sparse files -- otherwise it'd create a file of size 8GB.
7488 2003-05-02 Jim Meyering <jim@meyering.net>
7490 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7491 Instead explain about `-' and standard input.
7492 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7493 Reported by Keith Thompson.
7494 * tests/fmt/basic: Add test for the above fix.
7496 * src/fmt.c: Include "quote.h".
7497 Use quote() in diagnostics, rather than literal `' marks.
7498 (main): Exit nonzero when unable to open an input file.
7499 * tests/fmt/basic: Add test for the above fix.
7501 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7502 specifications like `-72x'.
7503 * tests/fmt/basic: Add test for the above fix.
7505 Work around nasty readdir bug on Darwin6.5.
7506 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7507 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7508 returned NULL and there has been at least one successful unlink or
7509 rmdir call since the opendir or previous rewinddir, then call
7510 rewinddir and reiterate the loop.
7512 Factor out common code.
7513 * src/remove.c (readdir_ignoring_dotdirs): New function.
7514 (is_empty_dir): Use it here.
7515 (remove_cwd_entries): Use it here.
7517 2003-05-01 Jim Meyering <jim@meyering.net>
7519 * tests/rm/r-3: Create 500 rather than just 300 files.
7520 There's a bug in Darwin6.5's readdir that shows up only with
7522 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7526 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7527 (dump_remainder): Move two declarations `down' into the scope
7528 where they are used.
7529 (xlseek): Return the resulting offset.
7530 (file_lines): Rename parameter, file_length, to end_pos.
7531 (pipe_lines): Don't coerce safe_read return value to `int'.
7532 Adapt tests accordingly.
7533 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7535 Change type of `total_bytes' from `int' to `size_t',
7536 since the former wouldn't always be wide enough.
7537 Don't coerce safe_read return value to `int',
7538 and adapt tests accordingly.
7539 Now that testing for a read error no longer involves
7540 using `tmp', handle that case *after* freeing `tmp'.
7541 (start_bytes): Clean up.
7542 (tail_bytes): Now that `n_bytes' may be larger than
7543 OFF_T_MAX, test for that condition and, if it's true, don't
7544 use lseek optimizations.
7545 (parse_options): Don't fail just because N_UNITS is larger than
7546 the maximum size of a file -- tail may be applied to an input
7547 stream (e.g., a pipe) with more data than that.
7549 * Makefile.maint (syntax-check): Rename from alloc-check.
7550 Also check for SPACE-TAB sequences.
7551 Also check for malloc/calloc/realloc casts.
7553 2003-05-01 Jim Meyering <jim@meyering.net>
7555 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
7557 2003-04-28 Jim Meyering <jim@meyering.net>
7559 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7560 make the now-more-picky tsort fail.
7562 2003-04-24 Jim Meyering <jim@meyering.net>
7564 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7565 (main): Minor syntactic clean-up.
7567 * src/tsort.c (tsort): Fail if the input contains an odd number of
7568 tokens. Reported by junkio@cox.net.
7570 * tests/tsort/basic-1: Test for the above fix.
7572 2003-04-21 Jim Meyering <jim@meyering.net>
7574 * tests/misc/printf: Add tests for the printf fixes below.
7576 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7578 2003-04-20 Paul Eggert <eggert@twinsun.com>
7580 Fix printf POSIX compatibility bug reported by Ben Harris in
7581 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7582 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7583 \0NNN in the %b operand.
7584 * src/printf.c (usage): Likewise.
7585 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7586 is desired. All uses changed. Behave like Bash printf if %b
7587 operand uses \NNN where the initial N is not 0.
7589 2003-04-17 Jim Meyering <jim@meyering.net>
7591 * src/stty.c: Remove uses of PROTOTYPE macro.
7593 2003-04-15 Jim Meyering <jim@meyering.net>
7595 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7596 each sequence of spaces before a TAB character.
7598 2003-04-13 Jim Meyering <jim@meyering.net>
7600 * src/remove.c (is_empty_dir): Don't closedir (NULL).
7602 2003-04-12 Jim Meyering <jim@meyering.net>
7604 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7605 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7606 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7607 * src/nl.c (main): Fix those problems and remove literal quote marks
7608 (e.g., "`%s'") from format string; instead use "%s" in each format
7609 string and `quote (optarg)' as the corresponding argument.
7610 Also, diagnose all invalid command line options before failing.
7612 * src/nl.c (proc_text): Fix a bug that would make nl output extra
7613 newlines in some cases. Details here: http://bugs.debian.org/177256.
7614 This bug was introduced on 2001-11-10 for textutils-2.0.17.
7615 * tests/misc/nl: Add test for the above-fixed bug.
7617 * tests/misc/readlink: New file. Test the --canonicalize option.
7618 * tests/misc/Makefile.am (TESTS): Add readlink.
7620 2003-04-11 Jim Meyering <jim@meyering.net>
7623 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7624 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7625 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7626 retain alignment) each sequence of spaces before a TAB character.
7628 * src/ls.c: Include <stdlib.h> unconditionally.
7630 * Makefile.maint (xalloc-check): Rename from header-check.
7632 * src/yes.c: Include error.h after system.h, not before.
7635 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7636 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7637 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7638 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7639 * src/tr.c: * src/unexpand.c, src/users.c:
7640 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7641 return values and of xrealloc's first argument.
7642 Fix the former with this:
7643 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7645 2003-04-10 Jim Meyering <jim@meyering.net>
7647 * src/stty.c (wrapf): Declare with format attribute.
7649 The S_MAGIC_... names shouldn't be maintained in two places (prior
7650 to this change, one would have to keep stat.c and fs.h in sync).
7651 This change makes it so those names and the corresponding
7652 hexadecimal constants all reside in stat.c. fs.h is now generated.
7653 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7654 (BUILT_SOURCES): Add fs.h, now that it's generated.
7655 (EXTRA_DIST): Add extract-magic.
7656 * src/extract-magic: New script to extract fs.h definitions from stat.c.
7657 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7658 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7660 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7661 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
7663 * man/unexpand.x: Add `SEE ALSO' reference to expand.
7664 * man/expand.x: Add `SEE ALSO' reference to unexpand.
7665 Suggestion from Dan Jacobson.
7667 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
7669 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7670 * src/stat.c (human_fstype): Handle Linux's devpts.
7672 2003-04-09 Paul Eggert <eggert@twinsun.com>
7674 * src/split.c (line_bytes_split): Arg is of type size_t, since
7675 that's all that is supported for now.
7676 (main): Check for overflow in obsolescent line count option.
7678 2003-04-09 Jim Meyering <jim@meyering.net>
7680 * tests/misc/split-fail: Add a new test for the above fix.
7682 * src/split.c (bytes_split): Use size_t temporary (rather than
7683 uintmax_t original) in remaining computations. From Paul Eggert.
7685 Handle command line option arguments larger than 2^31.
7686 This allows e.g., splitting into files of size 2GB and larger,
7687 and running split --lines=N with N=2^31 or more.
7688 But for --line-bytes=N, the restriction that N <= SIZE_MAX
7689 remains (for now), due to the way it is implemented.
7691 * src/split.c: Include "inttostr.h".
7692 (bytes_split, lines_split, line_bytes_split, main):
7693 Use uintmax_t, not size_t, for file sizes.
7694 (main): Give a better diagnostic for option arguments == 0.
7695 Use umaxtostr to print file sizes.
7696 Reported by Luke Hassell.
7698 2003-04-08 Jim Meyering <jim@meyering.net>
7700 * src/rm.c (usage): Mention that --directory (-d) works only
7701 on some systems. Suggestion from Samuel Tardieu.
7703 * tests/basename/basic: Run $PERL to see if it is available,
7704 rather than testing its value.
7705 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
7706 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
7707 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
7708 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
7709 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
7710 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
7711 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
7712 * tests/sum/basic-1, tests/seq/basic: Likewise.
7714 * tests/misc/Makefile.am (TESTS): Add split-fail.
7715 * tests/misc/split-fail: New file.
7717 * src/split.c: Rename local variables: nchars -> n_bytes.
7718 (lines_split): Rename local, nlines -> n_lines.
7719 (main): Rename local variable: s/accum/n_units/.
7720 (main): Use STDIN_FILENO, not literal `0'.
7722 2003-04-07 Jim Meyering <jim@meyering.net>
7724 * src/stat.c: Add #include directives for Ultrix 4.4.
7725 Based on a suggested change from Bert Deknuydt.
7727 2003-04-06 Jim Meyering <jim@meyering.net>
7729 * Makefile.maint (makefile-check): New rule.
7730 (local-check): Add it.
7732 2003-04-05 Jim Meyering <jim@meyering.net>
7734 * Makefile.am (nearly all of them):
7735 Use $(VAR) rather than @VAR@, now that we can rely on automake to
7736 emit a definition for each substituted variable.
7737 * tests/Makefile.am.in: Likewise.
7739 * tests/rm/rm5: Add a comment explaining why this test fails when
7740 using Tru64's broken sed.
7741 * tests/rm/rm3: Likewise.
7743 Make `kill -t' output signal descriptions (not `?') on Tru64.
7744 * src/kill.c (sys_siglist): Also check for __sys_siglist.
7745 Patch by Tony Leneis.
7746 * configure.ac: Also check for declaration of __sys_siglist.
7747 Required for Tru64 4.0D, 4.0F, and 5.1.
7748 Reported by Tony Leneis.
7750 2003-04-04 Jim Meyering <jim@meyering.net>
7752 * src/Makefile.am (PERL): Remove unnecessary definition.
7754 Because of inappropriate (but POSIX-mandated) behavior of rename,
7755 `mv a b' would not remove `a' in some unusual cases. Work around
7756 this by unlinking `a' when necessary.
7758 * src/copy.c (same_file_ok): Add an output parameter.
7759 Set it in the offending case.
7760 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
7761 Reported by Ed Avis.
7762 * tests/mv/hard-4: New test for the above.
7763 * tests/mv/Makefile.am (TESTS): Add hard-4.
7765 Clean up rules for automatically generated sources:
7766 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
7767 Make each generated file be read-only.
7768 Add each file name to BUILT_SOURCES separately.
7769 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
7771 Put LOCALEDIR macro definition in new file: localedir.h.
7772 * src/Makefile.am (DEFS): Remove definition.
7773 (localedir.h): New rule.
7774 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
7775 * src/system.h: Include "localedir.h".
7777 2003-04-02 Jim Meyering <jim@meyering.net>
7781 * tests/misc/Makefile.am (TESTS): Add false.
7783 * Makefile.maint (TMPDIR): Make sure it's defined.
7784 (my-distcheck): Build in $(TMPDIR), not `.'.
7786 * src/Makefile.am (false.c): Change all occurrences of
7787 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
7788 unsuccessfully also with --help. Reported by Paul Jarc,
7789 * tests/misc/false: New test for the above.
7791 2003-03-30 Jim Meyering <jim@meyering.net>
7793 * NEWS: Note the location of older NEWS files.
7795 * src/remove.c (is_empty_dir): Don't let a failing closedir
7796 clobber errno. Spotted by Arnold Robbins.
7798 * src/env.c: Fix typo in comment. From Arnold Robbins.
7800 2003-03-29 Jim Meyering <jim@meyering.net>
7804 * README: Note to expect build problems for stat.c on Ultrix 4.3.
7805 Note that there are some harmless test failures when running
7806 `make check' as root on some systems.
7808 2003-03-28 Jim Meyering <jim@meyering.net>
7810 * tests/stty/row-col-1: Skip this test if stty can't get window size.
7811 This happens when connecting to sparc-solaris5.7 via ssh from within
7812 emacs. Reported by Karl Berry.
7814 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
7815 Otherwise, on systems (DJGPP) that emulate pipes using files,
7816 this test would never complete, waiting for `yes' to terminate.
7817 * tests/du/slink: As above, use seq, not `yes' to generate link target.
7818 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
7819 Reported by Rich Dawe.
7821 2003-03-27 Jim Meyering <jim@meyering.net>
7823 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
7824 from `written by...' comment, at his request.
7826 2003-03-24 Paul Eggert <eggert@twinsun.com>
7828 Fix buffer overrun problem reported by TAKAI Kousuke, along
7829 with some other POSIX incompatibilities.
7831 * src/printf.c (print_esc): Do not treat \x specially if
7832 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
7833 in backslash. Treat incomplete escape sequences as strings
7834 of characters, as POSIX requires.
7835 (print_formatted): Allow multiple flags. Avoid buffer overrun
7836 if the format is incomplete.
7838 2003-03-24 Jim Meyering <jim@meyering.net>
7840 * tests/misc/printf: Add tests for the above fixes and changes.
7842 2003-03-26 Jim Meyering <jim@meyering.net>
7844 * src/copy.h (struct cp_options): Add a comment.
7846 2003-03-23 Jim Meyering <jim@meyering.net>
7848 * README: Describe problem with 64-bit mode on HPUX 11.x,
7849 with patch for /usr/include/inttypes.h.
7850 * TODO: Plan to add an autoconf test to work around the bug.
7852 2003-03-22 Jim Meyering <jim@meyering.net>
7854 * src/stat.c: Don't include <sys/sysmacros.h>.
7855 That is already done via system.h. Otherwise, the multiple
7856 inclusion would evoke redefinition warnings from Cray's /bin/cc,
7857 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
7858 (human_fstype): Factor some directives `up', out of this function.
7859 Cast away `const' to avoid error from Cray's /bin/cc.
7861 2003-03-20 Jim Meyering <jim@meyering.net>
7863 * announce-gen (print_changelog_deltas): Ensure that a newline
7864 precedes each row of `*'s.
7866 2003-03-20 Jim Meyering <jim@meyering.net>
7870 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
7871 format flag characters.
7872 Do not require that a field width be specified.
7873 Do not fail when given a field width of `0'.
7874 Reported by Dan Jacobson.
7875 * tests/seq/basic: Add new tests for the above-fixed bug.
7877 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
7878 (install-root): Likewise.
7879 (install-exec-local): Likewise.
7880 Based on a patch from Richard Dawe.
7882 2003-03-19 Jim Meyering <jim@meyering.net>
7884 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
7885 because the DJGPP 2.03 port of 'ln -s' doesn't work.
7886 Include $(EXEEXT) in program names.
7887 Since $(LN_S) may degenerate to `cp -p', be careful
7888 to invoke it from the destination directory.
7889 Mostly from Richard Dawe.
7890 * configure.ac: Use AC_PROG_LN_S.
7892 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
7893 CDPATH shell variable set could cause this test to fail.
7894 Reported by Karl Berry.
7896 2003-03-18 Jim Meyering <jim@meyering.net>
7898 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
7899 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
7900 AIX 5.1's xlc could not compile the former.
7901 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
7903 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
7905 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
7906 program names, since automake only adds $(EXEEXT) to programs
7909 2003-03-16 Jim Meyering <jim@meyering.net>
7911 * src/remove.c (rm): Put two local variables in static storage,
7912 so they can't be clobbered by the potential longjmp.
7914 2003-03-15 Jim Meyering <jim@meyering.net>
7916 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
7917 so that a version number with a two-digit component can still count
7918 as an alpha release. Reported by Richard A Downing.
7919 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
7921 2003-03-14 Jim Meyering <jim@meyering.net>
7923 * src/ansi2knr.c: Remove no-longer-used file.
7924 * src/ansi2knr.1: Likewise.
7926 * Makefile.maint (prev_version_file): Don't use ?= for this particular
7927 assignment, since it causes trouble with old versions of GNU make
7928 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
7929 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
7930 Patch from Alexandre Duret-Lutz.
7932 * Use patched automake-1.7.3. Regenerate Makefile.in files in
7933 subdirectories so that each includes a definition of ACLOCAL_M4.
7935 * announce-gen (main): Label the compressed source URLs.
7939 * tests/du/slink: Relax the test for the `local'ness of a file system,
7940 so that now it works also for tmpfs.
7942 * tests/du/hard-link: Transform output from first du, so that this
7943 test doesn't fail on file systems like tmpfs that order directory
7944 entries differently.
7946 2003-03-13 Jim Meyering <jim@meyering.net>
7948 * tests/du/8gb: Work around what appears to be an NFS failure that
7949 would make this test fail on some systems.
7951 2003-03-11 Jim Meyering <jim@meyering.net>
7953 * tests/du/basic: Make the test file exactly 4k bytes long.
7955 * src/split.c (longopts): Don't hard-code `2' here.
7956 Instead, just specify `&verbose', and ...
7957 (main): ... remove the `case 2:' block for --verbose.
7959 * tests/du/basic: Make the test file larger than 64 bytes, so that
7960 we don't immediately disqualify file systems (e.g., NetApp) on which
7961 smaller files take up zero disk blocks. Reported by Vin Shelton.
7963 2003-03-10 Jim Meyering <jim@meyering.net>
7965 Don't segfault for a negative field width or precision in format string.
7966 Note that this is just a stopgap fix. The longer term solution may
7967 involve adapting bash's builtins/printf.def.
7969 * src/printf.c: (UNSPECIFIED): Define.
7970 (print_direc): Use the special value, UNSPECIFIED, to indicate
7971 that field_width or precision has not been specified.
7972 (print_formatted): Fail if field_width or precision is the
7973 special value, UNSPECIFIED.
7974 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
7976 * src/sys2.h (INT_MIN): Define, if necessary.
7977 * tests/misc/printf: Add a test for the above-fixed bug.
7979 2003-03-09 Jim Meyering <jim@meyering.net>
7981 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
7982 changing its sign. This avoids a warning from gcc on 64-bit systems.
7983 Reported by Bob Proulx.
7984 (pop_dir): Reverse order of sign change and cast, to be consistent
7987 2003-03-08 Jim Meyering <jim@meyering.net>
7989 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
7990 shell variable, but only in the environment. With /bin/sh->bash, the
7991 shell variable is set to `y', and that would cause a spurious warning.
7992 Reported by Bob Proulx.
7994 * tests/Makefile.am (check-root): Remove touch/fifo.
7995 It doesn't appear to have to be run as root.
7997 * tests/rm/fail-2eperm: Rather than simply using the first non-root
7998 user name, make sure that the selected user name has a usable shell.
7999 Reported by Paul Jarc.
8001 Before, when using shred on a device, one had to specify --exact,
8002 or be careful to choose a size that would not be rounded up and
8003 exceed the maximum value; that could result in a failure of
8005 * src/shred.c (do_wipefd): --exact is now the default for non-regular
8006 files. Suggestion from Ben Elliston.
8009 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8010 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8011 Patch by Bob Proulx.
8013 * src/Makefile.am (check-misc): Check for use of `defined' in
8015 Change to $(srcdir) before running grep.
8017 * src/sleep.c: Remove now-unused #include and #define directives.
8019 * src/du.c (process_file): If a file's size is not being counted
8020 e.g., because it's a hard link to a file we've already counted,
8021 then don't print a line for it.
8023 * tests/du/hard-link: New test for the above-fixed bug.
8024 * tests/du/Makefile.am (TESTS): Add hard-link.
8027 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8028 and make the two-array approach work.
8030 * tests/du/basic: Correct/add tests for the above fix.
8031 Set LC_ALL, etc., now that we use sort.
8032 Check the block/size of a small file, too.
8033 Correct expected results for simple dir1/dir2/file case.
8034 Add another test of du -S.
8036 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
8038 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8039 middle-end/9986). As one of GCC's optimizations, it transforms a
8040 fputs_unlocked call to a fputc_unlocked call when the string is
8041 one character long. However, hpux doesn't have fputc_unlocked.
8043 * expr.c (usage): Use putchar, not fputs, to output a single character.
8044 * ls.c (dired_dump_obstack): Likewise.
8045 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8046 * stat.c (print_it): Likewise.
8048 2003-03-07 Jim Meyering <jim@meyering.net>
8050 * src/cp.c: Remove everything associated with mmap-stack.c.
8051 This reverts the two changes of 2003-02-21.
8052 * src/du.c: Remove everything associated with mmap-stack.c.
8053 This reverts the change of 2003-02-19.
8055 2003-03-06 Jim Meyering <jim@meyering.net>
8057 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
8058 CDPATH shell variable set could cause this test to fail.
8059 Reported by Karl Berry.
8061 2003-03-05 Jim Meyering <jim@meyering.net>
8065 * src/printf.c (print_esc): Remove pointless comparison of unsigned
8066 integer with zero, to avoid a warning from Intel's ecc.
8067 Reported by Nelson Beebe.
8069 * src/du.c (process_file): Sizes must all be of type uintmax_t.
8070 Otherwise, for files or totals that are too big, numbers would
8071 be truncated. Patch mostly by Michael Stone.
8072 Reported by Ingo Saitz as Debian bug #183210.
8074 * tests/du/8gb: New test for the above-fixed bug.
8075 * tests/du/Makefile.am (TESTS): Add 8gb.
8077 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8078 rather than UTILS_OPEN_MAX - 10.
8080 2003-03-04 Jim Meyering <jim@meyering.net>
8082 * README: Refer new feature discussion to bug-coreutils@gnu.org,
8083 rather than bug-gnu-utils, now that the former is better known.
8084 Suggestion from Göran Uddeborg.
8086 * src/stat.c (usage): Capitalize consistently.
8087 Reported by Göran Uddeborg.
8089 * Makefile.maint (rel-files): Include $(signatures), so that
8090 those files are also copied into $(release_archive_dir).
8092 * src/df.c (find_mount_point): Call error here, now that restore_cwd
8094 * src/remove.c (AD_pop_and_chdir): Likewise.
8096 * tests/Makefile.am (check-root): Add fail-2eperm.
8098 2003-03-03 Jim Meyering <jim@meyering.net>
8100 * src/remove.c (remove_cwd_entries): Include the full filename of
8101 the offending file, not just the basename.
8103 * tests/misc/tty-eof: Set $ME properly.
8105 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8106 Remove now-unused variables.
8107 (tag-prev-version, prev-cvs-tag): Likewise.
8109 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8110 accurate diagnostic when failing to remove a file owned by some other
8111 user. Reported by Ivo Timmermans via Michael Stone.
8112 This fixes Debian bug# 178471.
8114 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8115 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8116 Based on a report from Ivo Timmermans.
8118 2003-03-02 Jim Meyering <jim@meyering.net>
8120 * src/copy.c (copy_internal) [un_backup]: When recovering from a
8121 failure to create a hard link, do not remove the entry associating
8122 the source dev/ino with the destination file name.
8123 * tests/mv/Makefile.am (TESTS): Add hard-3.
8124 * tests/mv/hard-3: New test, for the above-fixed bug.
8125 Inspired by a report from Iida Yosiaki.
8127 2003-03-01 Jim Meyering <jim@meyering.net>
8129 * src/df.c (print_header): Don't embed spaces in a separate `Type'
8130 header string. Instead, put `Filesystem' and `Type' headers in the
8131 same string, so translators can use horizontal space as needed.
8132 Reported by Jean Charles Delepine.
8134 2003-02-28 Jim Meyering <jim@meyering.net>
8136 * src/copy.c (copy_internal): When link fails because of an
8137 existing destination file, unlink that file and try again.
8138 Reported by Iida Yosiaki.
8140 * tests/mv/Makefile.am (TESTS): Add hard-2.
8141 * tests/mv/hard-2: New test for the above-fixed bug.
8142 Based on a test case from Iida Yosiaki.
8144 2003-02-26 Jim Meyering <jim@meyering.net>
8146 * tests/du/basic: Don't test du's -b option here. Directory byte
8147 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8148 and IBM AIX 4.2. Reported by Nelson Beebe.
8150 2003-02-25 Jim Meyering <jim@meyering.net>
8152 * Makefile.maint (announcement): Now that ChangeLog entries
8153 are output by announce-gen, don't do it here.
8154 * announce-gen (print_changelog_deltas): New function.
8157 2003-02-22 Jim Meyering <jim@meyering.net>
8159 * announce-gen: New option: --release-type=TYPE
8160 * Makefile.maint (beta, major): New targets. Remove `release'.
8161 Put them all together on a line.
8162 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8163 invocation of `announcement'.
8164 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8166 * announce-gen: New option: --news=NEWS_FILE.
8167 Extract NEWS entries here, not via rules in Makefile.maint.
8168 * Makefile.maint (announcement): Now that NEWS entries are
8169 extracted by announce-gen, don't do it here.
8170 (news-r1, news-r2): Remove now-unused definitions.
8172 2003-02-21 Jim Meyering <jim@meyering.net>
8176 Merge in changes from autoconf's version of this file.
8177 * Makefile.maint (www-gnu): Define.
8178 (standards.texi-url_prefix): Use $(www-gnu).
8179 (make-stds.texi-url_prefix): Likewise.
8181 * src/cp.c: Include "mmap-stack.h".
8182 (main): Invoke `run' through a macro that (when possible) runs it
8183 with a large, mmap'd stack.
8185 * src/cp.c (run): New function, preparing for the above.
8186 Exit from this function, not from main
8189 * src/du.c: New option: --apparent-size.
8190 (enum) [APPARENT_SIZE_OPTION]: New member.
8191 (long_options): Add it.
8192 (usage): Describe it.
8194 ['b']: Set apparent_size.
8195 David Eisner reported that the behavior of --bytes had changed.
8196 Paul Eggert proposed the use of a new option, --apparent-size.
8198 * src/du.c (apparent_size): New global.
8199 (print_only_size): Reflect the fact that we're printing byte counts,
8200 not ST_NBLOCKSIZE-byte-block counts.
8201 (print_size): Call print_only_size rather than duplicating its code.
8202 (process_file): Accumulate byte counts, rather than block counts.
8204 * src/du.c (process_file): Always reset size_to_propagate_to_parent
8205 for --separate-dirs (-S).
8207 2003-02-20 Jim Meyering <jim@meyering.net>
8209 * Use automake-1.7.3. Regenerate dependent files.
8211 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8212 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8213 (usage) [%B]: Describe it.
8216 * src/du.c (process_file): Reorganize the code to use only
8217 one `sum' array, and change how -S works back to the way it was
8218 before 2003-01-31. Patch by Bruno Haible.
8220 * tests/du/basic: New test.
8221 * tests/du/Makefile.am (TESTS): Add basic.
8223 * tests/envvar-check: Add checks for the following:
8224 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8226 * tests/Makefile.am: Rename phony target envvar-check to evar-check
8227 so as not to conflict with the distributed file by the same name.
8229 * src/du.c (process_file): Set info->skip before any possible return.
8231 Report correct usage for directories, not 0.
8232 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8233 _before_ recording the dev/ino of a directory.
8234 Reported by Bruno Haible.
8236 Now, df always displays the device file name corresponding to the
8237 listed mount point under `Filesystem'. Before, for an unmounted
8238 block- or character-special file argument, it would display the
8239 command-line argument instead.
8240 * src/df.c (show_disk): Return a value indicating whether
8241 there was a match. Don't try to find a mount point here.
8242 (show_entry): If show_disk doesn't find a match, call show_point.
8244 2003-02-19 Jim Meyering <jim@meyering.net>
8246 * src/du.c: Include "mmap-stack.h".
8247 (du_files): Add prototype with ATTRIBUTE_NORETURN.
8248 Exit from this function, not from...
8250 Instead, if possible, invoke du_files through a macro that
8251 runs it with a large, mmap'd stack.
8253 * src/join.c (usage): Change wording in --help output:
8254 use FILENUM instead of `SIDE' and say what FILENUM means.
8255 Reported by Bernhard Gabler.
8257 * src/df.c (print_header): Rather than using a hard-coded literal
8258 string of spaces matching the length of the English `...Type' header,
8259 output the right number of spaces to match the selected translation.
8260 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8262 * src/split.c (bytes_split): Remove unnecessary `else' after break.
8263 (lines_split): Likewise. and correct misleading indentation.
8265 * src/split.c: Include "full-read.h".
8266 (bytes_split, lines_split, line_bytes_split): Use full_read,
8267 not safe_read. The way split was using the latter, a short read
8268 could cause split to terminate before EOF.
8270 * tests/misc/tty-eof: Test all programs that can read stdin,
8271 requiring no arguments and that write to standard output.
8273 * tests/misc/tty-eof: New file. Renamed from ...
8274 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
8275 * tests/misc/Makefile.am (TESTS): Reflect renaming.
8277 2003-02-18 Jim Meyering <jim@meyering.net>
8279 cksum would perform an extra read after encountering EOF
8280 * src/cksum.c (cksum): Exit the loop upon EOF, too.
8281 Patch by Michael Bacarella.
8283 Test for the bug fixed today in cksum, md5sum, and sha1sum.
8284 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8285 cat, cksum, md5sum, and sha1sum all in the same loop.
8287 2003-02-14 Jim Meyering <jim@meyering.net>
8289 * src/remove.c: Include "euidaccess.h".
8290 Remove declaration of euidaccess.
8292 2003-02-12 Jim Meyering <jim@meyering.net>
8294 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8295 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
8297 2003-02-10 Jim Meyering <jim@meyering.net>
8299 * src/test.c: Don't include group-member.h.
8300 Include euidaccess.h.
8301 (eaccess): Rewrite function to set the real uid and gid temporarily
8302 to the effective uid and gid, then invoke 'access', and then set the
8303 real uid and gid back. On systems that lack setreuid or setregid,
8304 fall back on the kludges in euidaccess. Before, it would not work
8305 for e.g., files with ACLs, files that were marked immutable,
8306 or on file systems mounted read-only. Nelson Beebe raised the issue.
8307 Paul Eggert suggested the new implementation.
8309 2003-02-09 Jim Meyering <jim@meyering.net>
8311 * src/test.c (test_stat): Remove function. It's job is done (only
8312 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
8314 2003-02-08 Jim Meyering <jim@meyering.net>
8318 * tests/mv/part-symlink: Don't assume that the file owner username
8319 length is less than 9 in ls output: instead, omit that field
8320 altogether. Reported by, and suggested fix from, Ferdinand.
8322 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8323 * tests/du/Makefile.am (TESTS): Add restore-wd.
8325 * src/rm.c: Correct now-invalid comment about cycle-detection.
8327 2003-02-06 Jim Meyering <jim@meyering.net>
8329 * NEWS: Add entries from old/*/NEWS
8330 from fileutils-4.1 through 4.1.11 and
8331 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
8335 * src/du.c (process_file): Don't return early for excluded files
8336 or for files whose dev/inode we've already seen.
8338 2003-02-05 Jim Meyering <jim@meyering.net>
8340 * tests/du/exclude: New file.
8341 * tests/du/Makefile.am (TESTS): Add exclude.
8343 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
8345 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8346 Fix memory allocation arithmetic.
8348 2003-02-04 Jim Meyering <jim@meyering.net>
8350 `df /dev/block-or-char-device-file--not-mounted' now reports
8351 the name of the file system on which the file resides, usually `/'.
8352 Before, it would leave the `Mounted on' field blank.
8353 * src/df.c (show_disk): Move function to precede find_mount_point.
8354 (show_disk): Add parameter: STATP.
8355 If we don't find a matching device name, then resort to calling
8356 find_mount_point. Reported by Bob Proulx.
8358 2003-02-03 Andreas Schwab <schwab@suse.de>
8360 * tests/rm/cycle: Require non-root.
8361 * tests/rm/isatty: Likewise.
8363 2003-02-02 Jim Meyering <jim@meyering.net>
8367 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8369 Ensure that there are no offending uses of `:'.
8370 * Makefile.maint (makefile_path_separator_check): New rule.
8371 (local-check): Add it to the list.
8373 2003-02-01 Jim Meyering <jim@meyering.net>
8375 * src/du.c (MAX_N_DESCRIPTORS): Define.
8377 * src/stat.c (G_fail): New global.
8378 (human_time): Diagnose failed localtime, not failed nstrftime.
8379 (main): Fail if G_fail is set.
8381 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
8383 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8384 hard-coding the path-separator. Also double-quote the new PATH,
8385 to avoid problems when the path-separator is a semi-colon or when
8386 `pwd` contains e.g. a space.
8387 * tests/chgrp/Makefile.am: Likewise.
8388 * tests/chmod/Makefile.am: Likewise.
8389 * tests/chown/Makefile.am: Likewise.
8390 * tests/cp/Makefile.am: Likewise.
8391 * tests/dd/Makefile.am: Likewise.
8392 * tests/dircolors/Makefile.am: Likewise.
8393 * tests/du/Makefile.am: Likewise.
8394 * tests/expr/Makefile.am: Likewise.
8395 * tests/factor/Makefile.am: Likewise.
8396 * tests/fmt/Makefile.am: Likewise.
8397 * tests/install/Makefile.am: Likewise.
8398 * tests/ln/Makefile.am: Likewise.
8399 * tests/ls/Makefile.am: Likewise.
8400 * tests/ls-2/Makefile.am: Likewise.
8401 * tests/md5sum/Makefile.am: Likewise.
8402 * tests/misc/Makefile.am: Likewise.
8403 * tests/mkdir/Makefile.am: Likewise.
8404 * tests/mv/Makefile.am: Likewise.
8405 * tests/od/Makefile.am: Likewise.
8406 * tests/rm/Makefile.am: Likewise.
8407 * tests/rmdir/Makefile.am: Likewise.
8408 * tests/seq/Makefile.am: Likewise.
8409 * tests/sha1sum/Makefile.am: Likewise.
8410 * tests/shred/Makefile.am: Likewise.
8411 * tests/stty/Makefile.am: Likewise.
8412 * tests/sum/Makefile.am: Likewise.
8413 * tests/tail-2/Makefile.am: Likewise.
8414 * tests/touch/Makefile.am: Likewise.
8415 * tests/tsort/Makefile.am: Likewise.
8416 * tests/unexpand/Makefile.am: Likewise.
8418 2003-01-31 Jim Meyering <jim@meyering.net>
8420 * src/stat.c: Include "file-type.h"
8421 (print_human_type): Remove function.
8422 (human_access): Rename from print_human_access. Return a string.
8423 (human_time): Rename from print_human_time. Return a string.
8424 (print_stat): Arrange so that field width and an alignment specifier
8425 are honored for the %A, %F, %x, %y, and %z formats.
8426 [%F]: Use file_type; this gives slightly different file type strings,
8427 e.g., `directory' instead of `Directory' and `regular file' or
8428 `regular empty file' instead of `Regular file'.
8429 Prompted by a report from Richard Dawe that the uses of
8430 S_IFSOCK and S_IFIFO in print_human_time were not portable
8431 to systems using e.g., DJGPP.
8433 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
8435 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8436 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
8438 2003-01-31 Jim Meyering <jim@meyering.net>
8440 * src/du.c (main): Upon processing an invalid option or an invalid
8441 --exclude-from or --max-depth option argument, don't exit right away,
8442 in case there are others. Rather record the failure and exit after
8443 processing other options.
8445 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8446 tar archive easier to reproduce.
8448 Rewrite to perform directory traversal using nftw.
8450 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8451 (AUTHORS): Add self.
8452 (opt_one_file_system): Move global into `main'.
8453 (path, xstat, exit_status): Remove declarations.
8454 (arg_length, suffix_length): New globals.
8455 (G_fail): New global, sort of like the old `exit_status'.
8456 (IS_FTW_DIR_TYPE): Define.
8457 (print_only_size): New function.
8458 (process_file): New function.
8459 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8460 (str_trunc, pop_dir, count_entry): Likewise.
8461 (du_files): Rewrite to use nftw.
8463 2003-01-30 Jim Meyering <jim@meyering.net>
8465 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8466 symlink-to-directory with -L, even without the trailing slash.
8468 2003-01-27 Jim Meyering <jim@meyering.net>
8470 * src/Makefile.am (check-misc): Check for st_blocks, too.
8472 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8473 Reported by Richard Dawe.
8475 2003-01-27 Andreas Schwab <schwab@suse.de>
8477 * src/ls.c (quote_name): Add fourth parameter, width, into which to
8478 store the screen columns, and return the number of bytes instead.
8479 (print_dir): Pass NULL as fourth parameter of quote_name.
8480 (print_name_with_quoting): Likewise.
8481 (length_of_file_name_and_frills): Get the width from the fourth
8482 parameter of quote_name instead of return value.
8484 2003-01-27 Jim Meyering <jim@meyering.net>
8486 * src/ls.c (decode_switches): If `dired' is set without
8487 `format == long_format', then silently reset dired. This doesn't
8488 change the behavior of ls (all prior uses of dired were protected
8489 by `&& format == long_format'), and lets us...
8490 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8491 (PUSH_CURRENT_DIRED_POS): Likewise.
8494 2003-01-22 Jim Meyering <jim@meyering.net>
8496 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8497 * tests/du/Makefile.am (TESTS): Add no-x.
8499 2003-01-21 Jim Meyering <jim@meyering.net>
8501 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8502 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8503 it may still be a directory -- or not (e.g., with FreeBSD on an
8504 NFS-mounted file system), so resort to calling lstat to find out.
8505 Based on a patch by Michael van Elst.
8507 * tests/cp/same-file: Don't assume that the file owner username
8508 length is less than 9 in ls output: instead, omit that field
8509 altogether. Reported by, and suggested fix from, Ferdinand.
8511 2003-01-20 Jim Meyering <jim@meyering.net>
8513 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8514 large format widths no longer cause strftime to infloop.
8516 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8518 2003-01-19 Jim Meyering <jim@meyering.net>
8520 * src/readlink.c: Include "canonicalize.h".
8522 2003-01-18 Jim Meyering <jim@meyering.net>
8524 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8526 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8527 (long_options): Add option --dereference-command-line-symlink-to-dir.
8528 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8529 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8530 -d, -F, -l options is specified.
8531 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8532 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8533 Change --dereference-command-line (-H) to dereference *all*
8534 command line arguments, including broken symlinks.
8536 2003-01-15 Paul Eggert <eggert@twinsun.com>
8538 Change ls -H back to the way it was yesterday, since this is
8539 compatible with FreeBSD and the POSIX spec is confusing
8540 and somewhat contradictory.
8542 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8543 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8544 (long_options): Change the long option name back.
8545 (usage): Change the usage back.
8546 (gobble_file): When -H is specified, dereference a top-level
8547 arg even if it points to a non-directory.
8549 2003-01-15 Jim Meyering <jim@meyering.net>
8551 * src/ls.c (gobble_file): Fall back on using lstat when required:
8552 when --dereference (-L) is not specified, and
8553 - when operating on a dangling symlink
8554 - when operating on command-line-symlink-to-directories
8555 This fixes numerous problems. Here are examples:
8556 - `ls dangling-symlink' would fail with `no such file...'
8557 Now it prints `dangling-symlink'.
8558 - `ls -i symlink' would mistakenly print the inode of the referent.
8559 Now it prints the inode of the symlink. Likewise for --size (-s).
8560 Based on a patch from Michael Stone.
8561 Reported by Deepak Goel as Debian bug #173793.
8563 Rename ls's --dereference-command-line (-H)
8564 option to --dereference-command-line-symlink-to-dir.
8565 * src/ls.c [enum Dereference_symlink]
8566 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8567 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
8568 (long_options): Rename the long option.
8569 (usage): Say that --dereference-... changes how ls treats
8570 only symlinks to directories specified on the command line.
8572 2003-01-14 Jim Meyering <jim@meyering.net>
8574 * tests/ls/dangle: New file/test, for the above fix.
8575 * tests/ls/inode: Another new file/test, for the above fix.
8576 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8578 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8579 so that ls --color would no longer highlight the names of files with
8580 the execute bit set when not specified on the command line.
8581 Patch by Michael Stone. Reported by Stephen Depooter as
8584 * tests/ls-2/tests (color-exe): New test, for the above fix.
8586 2003-01-13 Jim Meyering <jim@meyering.net>
8588 * tests/shred/exact: Also test for just fixed bug with --zero.
8590 * src/shred.c (long_opts): --zero does not require an argument.
8591 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
8593 2003-01-12 Jim Meyering <jim@meyering.net>
8595 * Makefile.maint (cvs-update): Skip any file with local modifications.
8597 * src/unexpand.c (usage): Document --first-only and mention that
8598 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
8600 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
8602 * src/df.c: Include "canonicalize.h".
8603 Use canonicalize_file_name unconditionally.
8605 2003-01-09 Jim Meyering <jim@meyering.net>
8607 * README: Add readlink.
8609 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
8611 * src/df.c: Include "xgetcwd.h".
8612 * src/pwd.c: Likewise.
8614 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
8616 * src/shred.c: Remove declaration of xstrdup.
8617 We already get it via xalloc.h which is included via system.h.
8619 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
8621 New program: readlink.
8623 * src/Makefile.am (bin_PROGRAMS): Add readlink.
8624 * src/readlink.c: New file.
8626 * man/readlink.x: New file.
8627 * man/Makefile.am (dist_man_MANS): Add readlink.1.
8628 (readlink.1): New rule.
8630 2003-01-09 Jim Meyering <jim@meyering.net>
8632 When selecting ranges of byte offsets (as opposed to ranges of fields)
8633 and when --output-delimiter=STRING is specified, output STRING between
8634 ranges of selected bytes.
8635 * src/cut.c (RANGE_START_SENTINEL): Define.
8636 (output_delimiter_specified): New global.
8637 (print_kth): Add parameter. Adjust all callers.
8638 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8639 (cut_bytes): When requested, output STRING between ranges of
8641 (main): Make a diagnostic a little clearer.
8642 Based on a patch from Jan Nieuwenhuizen.
8644 * tests/cut/Test.pm: New tests for the above.
8646 * src/cut.c (set_fields): Make code agree with comment:
8647 Don't merge abutting ranges like 4- and 2-3. This makes no
8648 difference currently, but is required to support an upcoming change.
8650 2003-01-07 Jim Meyering <jim@meyering.net>
8652 * src/cut.c (set_fields): Fix typo in comment.
8654 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8655 * tests/touch/Makefile.am (TESTS): Add not-owner.
8656 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8657 Now, this tests only the nonexistent-directory diagnostic.
8658 Suggestion from Michael Stone.
8660 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8662 2003-01-04 Jim Meyering <jim@meyering.net>
8664 * src/copy.h: Remove use of PARAMS.
8665 * src/remove.h: Likewise.
8666 * src/chown-core.h: Likewise.
8668 rm could be tricked into mistakenly reporting a cycle.
8669 * src/remove.c: [cycle_check_state]: New global.
8670 (remove_cwd_entries): Adapt to new semantics of cycle_check.
8671 (rm): Call cycle_check_init and cycle_check_free for each file.
8672 * tests/rm/cycle (rm): New test, for the above fix.
8673 * tests/rm/Makefile.am (TESTS): Add cycle.
8675 When rm detects a cycle, don't abort the entire command,
8676 but rather just the affected command line argument.
8677 * src/remove.c: Include <setjmp.h>
8678 (struct dirstack_state) [current_arg_jumpbuf]: New member.
8679 (remove_cwd_entries): Call longjmp if we detect a cycle.
8680 (rm): Call setjmp here.
8682 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8683 Instead, include cycle-check.h and use it.
8685 * src/remove.h (struct dev_ino): Remove declaration.
8687 * src/remove.c (remove_cwd_entries): Fix typos in comment.
8689 Don't include trailing /. in diagnostics about directories.
8690 * src/remove.c (full_filename_): When FILENAME is just `.'
8691 and there is a nonempty directory-name part, don't append `/.'.
8692 * tests/rm/unread2: Remove trailing /. from diagnostic.
8693 * tests/rm/rm2: Likewise.
8695 * src/remove.c (struct dirstack_state): Define.
8696 To be used in place of these file-scoped globals ...
8697 (dir_stack, len_stack, Active_dir): Remove globals.
8698 (ds_init, ds_free): New functions.
8699 (full_filename): Define.
8700 (full_filename_): Rename from full_filename.
8702 Begin to make AD_* functions more generic.
8703 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8704 (AD_push): Likewise.
8705 (AD_INIT_OTHER_MEMBERS): Define.
8706 (remove_dir): Define the `status' member manually after each
8707 call to AD_push or AD_push_initial.
8709 * src/Makefile.am (check-misc): New rule, to ensure that no more
8710 S_IS* macro definitions sneak into the code.
8711 (check): Depend on check-misc.
8713 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
8714 * src/du.c (count_entry) [S_ISLNK]: Don't define.
8715 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
8717 2003-01-03 Jim Meyering <jim@meyering.net>
8719 * src/true.c: Add copyright.
8720 (AUTHORS): I suppose I've written it.
8722 * src/Makefile.am (false.c): Make the generated file be read-only.
8724 2003-01-04 Jim Meyering <jim@meyering.net>
8726 * src/ls.c: Include "dev-ino.h".
8727 [struct dev_ino]: Remove declaration.
8729 2003-01-02 Jim Meyering <jim@meyering.net>
8731 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
8732 from mv: s/missing file arguments/missing file argument/.
8733 With --target-directory=DIR, cp and mv work with a single file argument.
8734 Reported by Karl Berry.
8736 * tests/rm/isatty: Enable this test.
8738 2002-12-31 Jim Meyering <jim@meyering.net>
8740 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8741 (AD_push): Likewise.
8742 (AD_INIT_OTHER_MEMBERS): Define.
8743 (remove_dir): Define the `status' member manually after each
8744 call to AD_push or AD_push_initial.
8746 * src/ls.c [struct dev_ino]: Remove definition.
8747 Include "dev-ino.h" instead.
8749 2002-12-28 Jim Meyering <jim@meyering.net>
8751 * tests/du/Makefile.am (TESTS): Add no-deref.
8752 * tests/du/no-deref: New script.
8754 2002-12-23 Jim Meyering <jim@meyering.net>
8756 * src/remove.c (remove_cwd_entries): Fix typo in comment.
8758 2002-12-21 Jim Meyering <jim@meyering.net>
8760 * announce-gen: Generate MML-formatted announcement.
8761 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
8763 2002-12-20 Jim Meyering <jim@meyering.net>
8765 * src/touch.c (touch): Change the wording of a diagnostic so
8766 that it makes sense both when the file exists and when it doesn't.
8767 Suggestion from Michael Stone.
8769 2002-12-18 Jim Meyering <jim@meyering.net>
8771 * src/stty.c (valid_options): Declare to be static.
8773 2002-12-15 Jim Meyering <jim@meyering.net>
8775 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
8777 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
8778 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
8779 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
8780 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
8781 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
8783 * src/remove.c (PARAMS): Remove definition.
8784 * src/sys2.h: Likewise.
8786 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
8787 Include strftime.h instead.
8789 2002-12-14 Jim Meyering <jim@meyering.net>
8791 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
8793 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
8794 This is necessary at least for Irix6.5 when using c89.
8795 Reported by Nelson Beebe.
8797 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
8799 * tests/misc/cat-tty-eof: New test.
8801 * src/mknod.c (usage): Specify how major and minor mode numbers
8802 are interpreted. Report forwarded by Kristin E Thomas.
8803 * src/mknod.c: Remove now-redundant usage-specifying comment.
8805 2002-12-13 Jim Meyering <jim@meyering.net>
8809 * tests/du/trailing-slash: Allow for a directory of size `0'.
8810 That happens at least on file systems of type tmpfs on linux-2.4.18.
8812 * announce-gen: New script to begin replacing the commands
8813 associated with the rule here...
8814 * Makefile.maint (announcement): Invoke announce-gen.
8815 * Makefile.am (EXTRA_DIST): Add announce-gen.
8817 * tests/cp/preserve-2: New file/test, for latest fix.
8818 * tests/cp/Makefile.am (TESTS): Add preserve-2.
8820 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
8822 Fix a bug whereby cp would fail to parse an option like
8823 --preserve=mode,ownership.
8824 * src/cp.c (decode_preserve_arg): Advance `comma' to
8825 point the character following the comma.
8827 2002-12-11 Jim Meyering <jim@meyering.net>
8829 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
8830 in case it's already defined.
8832 2002-12-09 Jim Meyering <jim@meyering.net>
8834 * tests/touch/fail-diag: Don't get a test failure if /no exists.
8835 Instead, evoke a framework failure if /no-$$ exists.
8836 Reported by Michael Stone.
8838 2002-12-08 Jim Meyering <jim@meyering.net>
8840 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
8841 Define to rpl_lstat, so that even on systems like Solaris 5.8,
8842 du honors (per POSIX) the trailing slash on an argument referring
8843 to a symlink-to-directory.
8845 2002-12-06 Jim Meyering <jim@meyering.net>
8847 * Use autoconf-2.57. Regenerate dependent files.
8848 * Use automake-1.7.2. Regenerate dependent files.
8850 * src/ls.c (gobble_file): Also stat the file if it's a
8851 regular file and --indicator-style=classify (aka -F).
8852 Thanks to Ed Santiago for opening my eyes.
8854 * tests/ls/file-type: New file. Test for the above.
8855 A test to contrast ls -F and ls --indicator-style=file-type.
8856 * tests/ls/Makefile.am (TESTS): Add file-type.
8858 2002-12-04 Jim Meyering <jim@meyering.net>
8860 * tests/ls/follow-slink: Make sure the symlink was created.
8861 Richard Dawe reported that `ln -s link link' succeeds, but creates
8862 no file on systems running some version of the DJGPP libc.
8864 2002-12-03 Jim Meyering <jim@meyering.net>
8866 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
8867 since this package no longer panders to K&R compilers.
8869 2002-12-02 Jim Meyering <jim@meyering.net>
8871 * tests/du/slink: Skip this test if `.' is on a non-local file system.
8873 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
8874 something to replace.
8876 2002-12-01 Jim Meyering <jim@meyering.net>
8878 * src/stat.c: Don't include <string.h> or <ctype.h>.
8879 That's already done via system.h.
8880 * src/dircolors.c: Don't include <ctype.h>.
8882 2002-11-30 Jim Meyering <jim@meyering.net>
8884 * ls.c (gobble_file): Remove the block of code that caused
8885 `ls --color -F symlink-to-dir' to list the files in
8886 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
8887 like `ls -F symlink-to-dir') but with the addition of highlighting.
8888 Similarly, `ls --color -dF symlink-to-dir' would print
8889 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
8890 Reported by Jeff Sheinberg as Debian bug #168203.
8891 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
8893 ls is now more efficient: with certain options, it no longer needs
8894 to stat each directory entry on systems with valid dirent.d_type.
8895 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
8896 (main): Make --recursive set format_needs_type, not format_needs_stat.
8897 (gobble_file): Remove a FIXME comment, now that it's fixed.
8899 2002-11-24 Jim Meyering <jim@meyering.net>
8901 * src/du.c (du_files): Don't strip any trailing slash.
8902 Rewrite so that `/' is no longer represented internally as
8904 (count_entry): When appending a file name component,
8905 account for the fact that the current path may end in `/'.
8906 François Pinard reported that `du symlink-to-dir/' was not
8907 equivalent to `du symlink-to-dir/.'. Now it is.
8908 * tests/du/trailing-slash: New file/test, for the above fix.
8909 * tests/du/Makefile.am (TESTS): Add trailing-slash.
8911 2002-11-23 Jim Meyering <jim@meyering.net>
8913 * src/tac.c (output): Declare some local variables to be of type size_t,
8914 rather than `int' to avoid warnings from gcc.
8916 2002-11-21 Paul Eggert <eggert@twinsun.com>
8918 * src/ls.c (decode_switches): Use case-sensitive matching to
8919 decode the QUOTING_STYLE environment variable. This is more
8920 consistent with the documentation, and with --quoting-style.
8922 2002-11-21 Martin Buck <martin.buck@ascom.ch
8924 * src/stty.c (struct speeds): Add support for all baud rates defined
8927 2002-11-19 Jim Meyering <jim@meyering.net>
8929 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
8930 run in a UTF locale. Report and suggested fix by Bruno Haible.
8931 * tests/fmt/basic: Likewise.
8933 2002-11-17 Jim Meyering <jim@meyering.net>
8935 * configure.ac: Update via autoupdate.
8936 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
8938 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
8939 Reported by Hans Ginzel.
8941 2002-11-15 Jim Meyering <jim@meyering.net>
8943 * Makefile.cfg (gnu_rel_host): Define.
8944 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
8945 on whether $(VERSION) looks like a major release number.
8947 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
8948 (release): Rename from `alpha'.
8949 (alpha): Depend on release.
8951 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
8953 2002-11-14 Jim Meyering <jim@meyering.net>
8955 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
8956 (announcement): Use the new variable.
8958 * Makefile.maint: Sync with Bison, i.e.:
8959 (po-check): Scan .l and .y files instead of the
8960 .c and the .h files that they generate. This fixes the bug
8961 reported by Tim Van Holder in:
8962 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
8963 Look for N_ as well as for _. Try to avoid matching #define for
8967 2002-11-12 Jim Meyering <jim@meyering.net>
8969 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
8970 Replace sole use with equivalent `#ifdef S_ISLNK'.
8971 Inconsistency reported by Dmitry V. Levin.
8973 2002-11-11 Jim Meyering <jim@meyering.net>
8975 * src/stat.c (usage): Transform --help items output via s/ - / /,
8976 so that help2man produces properly formatted man pages.
8977 Reported by Herbert Xu as Debian bug #168400.
8979 2002-11-10 Jim Meyering <jim@meyering.net>
8981 * src/ls.c (sighandler): Handle SIGTSTP specially.
8982 Based on suggestions from Solar Designer and Dmitry V. Levin.
8985 * Makefile.cfg (cvs_files): Define. From autoconf.
8986 (local_updates): Likewise.
8988 * src/ls.c (restore_default_color_handler, sigtstp_handler):
8990 (sighandler): New function, based on the one in sort.c.
8991 (main): Use sigaction, if possible; otherwise signal.
8992 Handle these signals:
8993 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
8994 Don't register our handler if the signal is already being ignored.
8996 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
8997 * src/csplit.c (interrupt_handler): Likewise.
8998 * src/sort.c (sighandler): Likewise.
8999 (main): Declare `i' and `nsigs' to be unsigned, not int.
9001 2002-11-09 Jim Meyering <jim@meyering.net>
9003 ls --color: restore terminal text color upon signal.
9004 * src/ls.c: Include "full-write.h" and <signal.h>.
9005 (restore_default_color, restore_default_color_handler): New functions.
9006 (sigtstp_handler, put_indicator_direct): New functions.
9007 (main) [print_with_color]: Register signal handlers.
9008 Patch mostly by Solar Designer and Stanislav Ievlev.
9010 Update from autoconf.
9011 * Makefile.maint (AMTAR): Remove definition.
9012 (update, cvs-update, po-update, do-po-update): New rules.
9013 (wget-update): Update (thus renaming to cvs-update).
9014 (automake_repo): Use anoncvs@sources.redhat.com.
9016 2002-11-06 Jim Meyering <jim@meyering.net>
9018 * tests/misc/Makefile.am (TESTS): Add printf-hex.
9020 * tests/misc/printf: Be careful to test the code in this package,
9021 not the shell built-in function.
9023 * src/printf.c (print_esc): A hexadecimal escape sequence has
9024 at most two hex. digits, not three. Reported by Padraig Brady.
9025 (usage): Update description.
9026 * tests/misc/printf-hex: New file/test, for the above fix.
9028 2002-10-07 Paul Eggert <eggert@twinsun.com>
9030 Add support for locale-specific size indications (e.g.,
9031 thousands-separators) and for explicit size suffixes on output.
9033 * doc/coreutils.texi (Block size): Say that:
9034 This affects display format as well as block size.
9035 Fractional block counts are rounded up.
9036 ls file size blocksize defaults to 1.
9037 A block size spec preceded by ' generates thousands separators.
9038 A suffix without a preceding integer generates suffixes.
9039 (tail invocation): 32k -> 32 KiB.
9040 (What information is listed): ls -h is now equivalent to
9041 ls --block-size=human, and ls -H is now equivalent to
9042 ls --block-size=si. Displayed file size is now always affected by
9045 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9046 lib/umaxtostr.c: New files, taken from GNU tar.
9048 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9050 (EXTRA_DIST): Add inttostr.c.
9052 * lib/human.c, lib/human.h: Rewrite to support locale-specific
9053 notations like thousands separators.
9054 Specify what includer of include.h must include beforehand.
9055 (human_group_digits, human_suppress_point_zero, human_autoscale,
9056 human_base_1024, human_SI, human_B): New enum values.
9057 (human_readable): Rename from human_readable_inexact; put the
9058 options before the sizes. All uses changed. The old human_readable
9059 function has been removed; use inttostr.h instead.
9060 (human_options): Renamed from human_block_size, with new signature
9061 that allows block sizes up to UINTMAX_MAX. All callers changed.
9063 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9064 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
9065 freestanding C89. No need to check for stdlib.h or string.h since
9066 autoconf does this now.
9068 * src/cksum.c (cksum): Use primitives from inttostr.h, not
9069 human.h, to print large numbers simply.
9070 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9071 * src/dd.c (print_stats, main): Likewise.
9072 * src/df.c (print_header): Likewise.
9073 * src/factor.c (print_factors): Likewise.
9074 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9075 * src/shred.c (dopass): Likewise.
9076 * src/sort.c (checkfp): Likewise.
9077 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9078 * src/tail.c (xlseek): Likewise.
9079 * src/wc.c (write_counts, wc): Likewise.
9081 * src/df.c (human_output_opts): New var.
9082 (output_block_size): Now uintmax_t, not int, to handle larger
9083 block sizes. All uses changed.
9084 * src/du.c: Likewise.
9085 * src/ls.c: Likewise.
9087 * src/df.c (print_header): In the header line, prefer SI to human
9088 representation if it's shorter; if neither is shorter, try to
9089 intuit what the user would prefer.
9091 * src/expr.c (inttostr): Remove; use new imaxtostr library
9094 * src/ls.c (file_output_block_size): New var, to distinguish
9095 file sizes from other sizes.
9096 (decode_switches): Set it.
9098 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9099 (dopass): When printing progress, use floor for what has been done
9100 so far (since we should be conservative there), and ceiling for
9101 what needs to be done (since that's what other programs use).
9103 2002-10-19 Jim Meyering <jim@meyering.net>
9105 * src/pinky.c (print_heading): Align TTY and Name headings.
9106 Reported by Karl Eichwalder.
9108 2002-10-18 Jim Meyering <jim@meyering.net>
9110 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9111 Remove now-useless cast.
9112 (stdread): Remove function.
9113 (bytes_split): Use size_t instead of int.
9114 Use safe_read, not stdread.
9115 (lines_split): Likewise.
9116 Use memchr rather than a `while' loop.
9117 (line_bytes_split): Use size_t instead of int.
9118 Use safe_read, not stdread.
9119 (main): Add some FIXME comments to remind me to remove casts.
9121 * src/system.h (ST_BLKSIZE): Correct comment describing how to
9122 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
9124 2002-10-17 Jim Meyering <jim@meyering.net>
9126 Fix a problem that could make e.g., `cat' misbehave on systems which
9127 give invalid (unreasonably large) values for stat.st_blksize.
9128 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9129 Reported by Petter Reinholdtsen.
9131 2002-10-14 Jim Meyering <jim@meyering.net>
9133 Specifying a printf conversion specifer as nl's separator string
9134 could cause nl to segfault.
9135 * src/nl.c (build_print_fmt): Don't include separator string
9136 in the printf format; it might contain `%'.
9137 Use a better bound on the length of the print_fmt buffer.
9138 (print_lineno): Print the separator here instead.
9139 Reported by Doug Coleman.
9141 * tests/misc/nl: New file/tests, including a test for the above.
9142 * tests/misc/Makefile.am (TESTS): Add nl.
9144 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9145 * tests/misc/Makefile.am (TESTS): Add split-l.
9147 2002-10-13 Jim Meyering <jim@meyering.net>
9151 * src/du.c (usage): Tweak description of --dereference-args/-D.
9153 * src/du.c (count_entry): Also save cwd when dereferencing (via
9154 --dereference-args, -D) a command-line argument.
9155 Reported by Michal Svec. Based on a patch by Andreas Schwab.
9157 * src/Makefile.am (../AUTHORS): New target/rule.
9159 2002-10-12 Jim Meyering <jim@meyering.net>
9161 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9162 of type size_t, since that's the way it's used and avoids a warning.
9164 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9165 since that's how it's always used and avoids a new warning from gcc.
9166 (read_input): Adapt to new safe_read ABI.
9168 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9171 * src/pinky.c (print_long_entry): fread returns size_t.
9172 Declare local `bytes' accordingly, to avoid warning.
9174 tail -c +N would perform an extra read after encountering EOF
9175 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9176 * src/tail.c (start_bytes): Detect EOF, inform caller.
9177 (tail_bytes): Upon EOF in start_bytes, return immediately.
9178 (file_lines): Reorganize to use memrchr rather than an explicit loop.
9179 Adapt to new safe_read ABI.
9181 2002-10-11 Jim Meyering <jim@meyering.net>
9183 * tests/du/deref: New file/test, for the above fix.
9184 * tests/du/Makefile.am (TESTS): Add deref.
9186 2002-10-10 Jim Meyering <jim@meyering.net>
9188 * tests/ln/Makefile.am (TESTS): Add target-1.
9189 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9191 2002-10-09 Jim Meyering <jim@meyering.net>
9193 * tests/cp/backup-is-src: Ensure that certain environment variables
9194 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
9196 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9197 consume 4GB of disk space on systems without support for sparse files.
9198 Fix a logic error that'd make it `cat err' even though dd didn't fail.
9200 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9201 Patch by steven@magelico.net, forwarded by Michael Stone.
9203 * tests/ls/dired: Ensure that ls produces English messages.
9204 Patch by Alexey Vyskubov, forwarded by Michael Stone.
9206 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
9208 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9210 2002-10-08 Jim Meyering <jim@meyering.net>
9212 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9213 Fix syntax in test: use =, not ==.
9214 Reported by Bob Proulx.
9215 Change all the rest like this: grep -lR "testing framework'" .\
9216 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9218 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9219 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9220 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9221 * src/wc.c (wc): Likewise.
9223 2002-10-07 Paul Eggert <eggert@twinsun.com>
9226 Don't advance the write pointer past the end of the write buffer.
9227 * src/sort.c (begfield, limfield): Likewise.
9229 2002-10-07 Jim Meyering <jim@meyering.net>
9231 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9232 * src/head.c (head_bytes, head_lines): Likewise.
9234 2002-10-06 Jim Meyering <jim@meyering.net>
9236 * src/dd.c (scanargs): Ensure that specified block sizes (specified
9237 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9238 (skip, dd_copy): Adapt to new safe_read ABI.
9240 * Makefile.maint (signatures): Define.
9242 (announcement): Depend on $(signatures).
9244 * Makefile.maint (announcement): Output all URLs for detached
9245 signatures, not just the last one from the previous loop.
9247 2002-10-05 Jim Meyering <jim@meyering.net>
9251 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9252 don't recurse into directory, DIR. Prompted by a report from
9255 * tests/rm/i-no-r: New file/test, for the above fix.
9256 * tests/rm/Makefile.am (TESTS): Add i-no-r.
9258 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9259 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9261 2002-10-03 Jim Meyering <jim@meyering.net>
9263 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9264 * src/df.c (AUTHORS): Likewise.
9265 * src/du.c (AUTHORS): Likewise.
9266 * src/tail.c (AUTHORS): Likewise.
9267 * src/touch.c (AUTHORS): Likewise.
9269 2002-10-02 Jim Meyering <jim@meyering.net>
9271 * Makefile.am (SUBDIRS): Remove `old'.
9272 (EXTRA_DIST): List the files in old/.
9273 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9274 Suggestion from Akim Demaille.
9276 2002-10-01 Jim Meyering <jim@meyering.net>
9278 * src/sys2.h (SSIZE_MAX): Define.
9280 2002-09-30 Jim Meyering <jim@meyering.net>
9282 * src/csplit.c: Don't include stdlib.h here. It's already included
9285 2002-09-29 Jim Meyering <jim@meyering.net>
9287 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9288 expression to avoid bogus warning from gcc.
9290 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9291 (cat): Declare insize and outsize to be of type size_t, not int.
9292 Rearrange pointer/integer expressions to avoid bogus warnings.
9293 (main): Declare insize and outsize to be of type size_t, not int.
9295 * src/tail.c (parse_options): Give a sensible diagnostic for
9296 an invalid byte or line count. Reported by Mikko Tuumanen.
9298 * src/touch.c (main): Split a long line.
9300 * tests/du/Makefile.am (TESTS): Add slink.
9301 * tests/du/slink: New test for system.h change of 2002-08-31.
9303 In move mode, always first try to rename. Before, upon failure to
9304 rename a directory, this code would never attempt to rename any
9305 other file in that directory, but would thenceforth always copy.
9306 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9307 may fail with EXDEV, yet renaming files within that directory to
9308 a newly-created destination directory succeeds.
9309 * src/copy.c (copy_internal): Remove local, move_mode;
9310 use x->move_mode instead. Based on a patch from Tom Haynes.
9312 2002-09-28 Jim Meyering <jim@meyering.net>
9314 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9315 Factor out some duplication.
9317 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9319 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9321 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9322 to avoid compiler warnings.
9324 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9327 Fix things so `mkdir -p' can create very deep directories, e.g.,
9328 mkdir -p $(perl -e 'print "a/" x 40000') now works.
9329 * src/mkdir.c (main): For --parents (-p), call make_path with the
9330 entire directory name, so we don't ever require that file operations
9331 like stat or chmod be performed on the entire command line argument.
9332 * makepath.c (make_path): Restore umask *before* creating the final
9335 2002-09-27 Andreas Schwab <schwab@suse.de>
9337 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9338 to avoid overflow. Reported by Hans Lermen.
9340 2002-09-26 Jim Meyering <jim@meyering.net>
9342 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
9344 2002-09-25 Jim Meyering <jim@meyering.net>
9346 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9347 and add a cast, to avoid a warning about `signed and unsigned type in
9348 conditional expression'.
9350 2002-09-22 Jim Meyering <jim@meyering.net>
9352 * src/rmdir.c: Include "dirname.h", for declaration of
9353 strip_trailing_slashes.
9355 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9356 Now they're defined through system.h.
9358 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9359 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9360 since it's already included from sys2.h via system.h.
9362 * Use automake-1.6f. Regenerate dependent files.
9364 * src/Makefile.am (PERL): Remove duplicate definition.
9366 fmt's -s, -t, -c options didn't work properly for long lines.
9367 Since get_line may end up calling put_paragraph (for long lines),
9368 be sure to set global, `other_indent', before it is used there.
9370 * src/fmt.c (set_other_indent): New function, factored out of...
9371 (get_paragraph): ... here. Call it.
9372 (get_line): Call set_other_indent before calling flush_paragraph,
9373 which calls fmt_paragraph, which in turn calls put_paragraph,
9374 which uses other_indent.
9376 * tests/fmt/Makefile.am (TESTS): Add long-line.
9377 * tests/fmt/long-line: New file/test, for the above fix.
9379 2002-09-21 Jim Meyering <jim@meyering.net>
9381 * src/od.c: No longer include deprecated <values.h>.
9382 It was required solely for now-removed reference to BITSPERBYTE.
9383 * src/install.c: Likewise.
9384 Suggestion from Bruno Haible.
9386 2002-09-06 Andreas Schwab <schwab@suse.de>
9388 `rmdir -p dir-specified-with-trailing-slash/' would fail.
9389 * src/rmdir.c (remove_parents): Strip trailing slashes.
9391 2002-09-20 Jim Meyering <jim@meyering.net>
9393 * tests/rmdir/t-slash: New file/test, for the above fix.
9394 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9396 * Makefile.maint (announcement): Arrange to gpg-sign the message.
9397 Add a URL for each detached signature file.
9399 2002-09-07 Bruno Haible <bruno@clisp.org>
9401 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9403 2002-09-18 Jim Meyering <jim@meyering.net>
9405 `od -t x8' used the wrong (`l'-prefixed) printf format.
9406 Likewise for the o8 and u8 formats.
9407 * src/od.c (ISPEC_TO_FORMAT): Define macro.
9408 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9409 Reported by Arun Sharma.
9411 2002-09-17 Jim Meyering <jim@meyering.net>
9413 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9414 From gettext's intl/loadmsgcat.c.
9416 * tests/od/x8: New file/test, for the above fix.
9417 * tests/od/Makefile.am (TESTS): Add x8.
9419 2002-09-15 Jim Meyering <jim@meyering.net>
9421 * Use autoconf-2.54. Regenerate dependent files.
9423 * src/csplit.c (get_format_width): Add cast to avoid
9424 warning about `signed and unsigned type in conditional expression'.
9426 2002-09-14 Jim Meyering <jim@meyering.net>
9428 * src/who.c (print_user): Change type of local to size_t
9429 to avoid warnings about `comparison between signed and unsigned'.
9430 * src/ptx.c (generate_all_output): Likewise.
9432 * src/dd.c (main, skip): Add casts to avoid warnings about
9433 `comparison between signed and unsigned'.
9435 * src/id.c (print_full_info, print_group_list): Add casts to avoid
9436 warnings about `signed and unsigned type in conditional expression'.
9438 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9439 to avoid warnings about `comparison between signed and unsigned'.
9440 (split_3): Change parameter names to be readable and add comment.
9441 Clean up the test for whether a line may be ignored.
9443 2002-09-13 Jim Meyering <jim@meyering.net>
9445 * src/printf.c (main): Handle leading command line argument of `--'.
9446 Reported by Raul: DervishD <raul@pleyades.net>
9447 * tests/misc/printf: New file: test for the above.
9448 * tests/misc/Makefile.am (TESTS): Add printf.
9450 * src/date.c (usage): Explain that %S's range of [0..60] is required --
9451 rather than 0..59 -- to accommodate the occasional positive leap second.
9452 Reported by Richard Neill.
9454 2002-09-12 Jim Meyering <jim@meyering.net>
9456 * src/Makefile.am (nanosec_libs): Define.
9457 (sleep_LDADD, tail_LDADD): Use it here.
9459 Factor nanosleep-related code into ../lib/xnanosleep.c.
9460 * src/sleep.c: Include xnanosleep.h.
9461 Factor out fenv.h-related code.
9462 (timespec_subtract): Remove function.
9463 (main): Remove code that deals with computing start and stop times
9464 as well as the loop around nanosleep. Now that's in xnanosleep.c.
9466 Allow S (in --sleep-interval=S) to be a floating point value.
9467 * src/tail.c: Include xnanosleep.h and xstrtod.h.
9468 Move declaration of global variable, sleep_interval, to ...
9470 (usage): Update description of --sleep-interval option.
9471 (tail_forever): New parameter, sleep_interval. Update caller.
9472 Use xnanosleep, rather than sleep.
9473 (parse_options): New parameter, sleep_interval. Update caller.
9474 Use xstrtod, now that we accept floating point values.
9475 Prompted by a patch from Augey Mikus.
9477 2002-09-06 Jim Meyering <jim@meyering.net>
9479 * src/remove.c (prompt): Change comment to give a better note to
9480 translators. From Michael Piefel.
9482 2002-09-02 Jim Meyering <jim@meyering.net>
9484 * README: A good problem report/patch includes diffs against
9485 the most recent test release.
9487 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9488 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9490 * src/kill.c (print_table_row): Use an unsigned type for widths
9491 to avoid warning about comparison between signed and unsigned.
9492 (list_signals): Likewise.
9494 * src/od.c (skip): Add a cast to avoid warning about comparison
9495 between signed and unsigned.
9496 * src/install.c (get_ids): Likewise. Also rearrange range-checking
9497 comparisons to make them more readable.
9499 2002-09-01 Jim Meyering <jim@meyering.net>
9503 2002-08-31 Jim Meyering <jim@meyering.net>
9505 Symlinks were always reported as using 0 blocks.
9506 * src/system.h (ST_NBLOCKS): Don't depend on file type.
9507 This reverts the change of 2000-01-30.
9508 Based on a report and patch from Neil Brown via Michael Stone.
9509 This fixes Debian Bug#156358.
9511 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9512 `exit (1)' to `exit (EXIT_FAILURE)', and
9513 `usage (1)' to `usage (EXIT_FAILURE)'.
9515 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9516 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9517 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9518 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9519 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9520 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9521 error never exits successfully.
9523 2002-08-29 Jim Meyering <jim@meyering.net>
9525 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9526 when ignoring any return value.
9528 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9529 failures. On some systems (at least EMC Celerra and Solaris5.8),
9530 this appears to be necessary.
9531 (is_empty_dir): Likewise. Also, always close directory handle.
9532 * src/ls.c (print_dir): Likewise.
9533 (print_dir): Rename local variable: reading -> dirp.
9534 Reported by Mike Coleman.
9536 2002-08-28 Jim Meyering <jim@meyering.net>
9538 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9539 Give a diagnostic and fail if closedir fails.
9541 2002-08-26 Jim Meyering <jim@meyering.net>
9543 * Makefile.am (THANKS-to-translators): New rule.
9544 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9545 * THANKStt.in: New file.
9547 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9549 (main): Register it with atexit.
9550 Close STDOUT_FILENO, to avoid a problem when writing to
9551 /dev/audio on at least Solaris 5.7 and 5.8 systems.
9552 Reported by Shing-Shong Shei.
9554 2002-08-25 Jim Meyering <jim@meyering.net>
9556 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9557 * src/tac.c (main): Likewise.
9558 * src/tail.c (main): Likewise.
9559 * src/tee.c (main): Likewise.
9560 * src/tr.c (main): Likewise.
9561 * src/wc.c (main): Likewise.
9563 2002-08-20 Jim Meyering <jim@meyering.net>
9565 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9567 2002-08-10 Paul Eggert <eggert@twinsun.com>
9569 * src/nohup.sh: Don't use "exec --"; it's not portable and
9570 shouldn't be needed.
9572 2002-08-09 Jim Meyering <jim@meyering.net>
9574 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9575 (usage): Clarify help text for the -COLUMN option.
9576 Patch by Padraig Brady.
9577 * tests/pr/Test.pm [col-last]: New test for the above.
9579 * configure.ac: Start with version 4.5.1, chosen so that it's larger
9580 than the latest version numbers of the component packages.
9582 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9585 2002-08-08 Jim Meyering <jim@meyering.net>
9587 * src/date.c: Guard inclusion of <langinfo.h> with
9588 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9589 * src/sort.c: Likewise.
9590 Patch by GOTO Masanori.
9592 2002-08-05 Paul Eggert <eggert@twinsun.com>
9594 Fix some minor time-related bugs with POSIX time arguments.
9595 Some valid time stamps were being rejected (notably -1, and
9596 time stamps before 1900 on 64-bit hosts). And some invalid
9597 time stamps were being accepted, e.g. September 31.
9599 * src/date.c (main): Adjust to posixtime signature change.
9600 * src/touch.c (main): Likewise. Remove unnecessary initialization.
9601 Use localtime, not posixtm, to warn about obsolete "touch".
9603 2002-08-05 Jim Meyering <jim@meyering.net>
9605 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9607 2002-08-04 Jim Meyering <jim@meyering.net>
9609 * src/Makefile.am (check-README): New target/rule.
9610 (check): Depend on it.
9612 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9614 2002-08-03 Jim Meyering <jim@meyering.net>
9616 * Makefile.am (SUBDIRS): Add old.
9617 * old/: New directory, containing legacy ChangeLog* and NEWS files
9618 from the fileutils, sh-utils, and textutils packages.
9620 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9622 2002-08-02 Paul Eggert <eggert@twinsun.com>
9624 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9626 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9627 (hard_LC_COLLATE): New var.
9628 (different): Args are now char *, not const char *.
9629 Use xmemcoll instead of memcmp to compare lines, so that
9630 LC_COLLATE has effect. However, use memcmp if it is an
9632 (check_file): Do not include newline in comparison, so that
9633 xmemcoll has a byte to stomp on temporarily.
9634 (main): Set hard_LC_COLLATE.
9636 2002-07-29 Jim Meyering <jim@meyering.net>
9638 * Makefile.am (SUBDIRS): Remove djgpp, for now.
9640 2002-07-20 Jim Meyering <jim@meyering.net>
9642 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9643 into EXIT_FAILURE. Otherwise, false --help and false --version
9646 2002-07-08 Jim Meyering <jim@meyering.net>
9648 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9649 rather than the hard-coded `sh-utils'.
9651 2002-07-01 Jim Meyering <jim@meyering.net>
9653 * configure.ac: Merge the three files from fileutils,
9654 textutils, and sh-utils.
9655 * Makefile.am: Likewise.
9656 * src/Makefile.am: Likewise.