1 2005-06-16 Jim Meyering <jim@meyering.net>
5 * src/mv.c: Finally remove support for --version-control=S (-V).
6 It was deprecated nearly 6 years ago and has been warning
7 users to switch to --backup=S since fileutils-4.0j.
8 * src/cp.c, src/install.c, src/ln.c: Likewise.
10 2005-06-15 Jim Meyering <jim@meyering.net>
12 * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
13 * tests/install/basic-1: Ensure that each `-d'-specified directory
14 is created. Ensure that rel-named dirs are not created when
17 * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
19 2005-06-14 Paul Eggert <eggert@cs.ucla.edu>
21 Improve diagnostics for restore_cwd failure.
22 * src/install.c (main): Standardize on a diagnostic for
23 restore_cwd failure, and report errno.
24 (install_file_in_file_parents): Fail if restore_cwd fails and
25 one of the files is relative. This fixes a bug (albeit unlikely).
26 * src/mkdir.c (create_parents): Remove static var (now local to 'main').
27 (main): Standardize on a diagnostic for restore_cwd failure,
29 Don't bother to check cwd_errno unless create_parents.
30 Use mkdir rather than make_dir; it's simpler.
32 * src/install.c (main): Adjust to new make_dir_parents convention.
33 * src/mkdir.c (main): Likewise.
35 2005-06-14 Jim Meyering <jim@meyering.net>
37 * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
38 is an absolute directory name.
40 * Makefile.maint (my-distcheck): Add -Wall to the list of options that
41 are used with -Werror. This target is not intended for general use.
43 2005-06-13 Jim Meyering <jim@meyering.net>
45 * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
46 relative directory name after make_dir_parents fails to restore
47 the working directory. Before, `mkdir -p' could create directories
48 in the wrong place in unusual circumstances.
49 * src/install.c (main): Likewise.
50 (install_file_in_file_parents): Update make_dir_parents caller.
51 * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
52 * tests/mkdir/Makefile.am (TESTS): Add p-3.
54 2005-06-10 Paul Eggert <eggert@cs.ucla.edu>
56 Act on the Austin Group's response yesterday to XCU ERN 63; see
57 <http://www.opengroup.org/austin/docs/austin_260.txt>.
58 * NEWS: ls no longer outputs an extra space between mode and link count.
59 * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
60 * src/ls.c (any_has_acl): New var.
61 (clear_files): Clear it.
62 (gobble_file): Set it if a file has an ACL.
63 (print_long_format): Omit needless space unless some file has an ACL.
65 2005-06-10 Jim Meyering <jim@meyering.net>
67 * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
69 2005-06-02 Jim Meyering <jim@meyering.net>
71 * src/sort.c (usage): Put `Ordering options:' line where it belongs.
73 2005-06-01 Paul Eggert <eggert@cs.ucla.edu>
75 Use "file name" when talking about file names, instead of "filename"
76 or "path", as per the GNU coding standards.
77 * src/basename.c: Don't use "path" or "filename".
78 * src/copy.c: Likewise.
79 * src/copy.h: Likewise.
80 * src/cp-hash.c: Likewise.
83 * src/install.c: Likewise.
85 * src/pinky.c: Likewise.
87 * src/pwd.c: Likewise.
88 * src/remove.c: Likewise.
89 * src/rmdir.c: Likewise.
90 * src/sort.c: Likewise.
91 * src/system.h: Likewise.
92 * src/tty.c: Likewise.
93 * src/who.c: Likewise.
94 * src/cp.c (parents_option): Renamed from flag_path. All uses changed.
95 (make_dir_parents_private): Renamed from make_path_private.
97 * src/cp.c (usage): Don't use "path" to describe a file name.
98 * src/readlink.c (usage): Likewise.
99 * src/rmdir.c (usage): Likewise.
100 * src/df.c: Don't include "path-concat.h"; not needed.
101 * src/install.c (install_file_in_file_parents): Renamed from
102 install_file_to_path. All uses changed.
103 * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
105 * src/ls.c (make_link_name): Renamed from make_link_path.
107 * src/pwd.c (struct file_name): Renamed from struct Path.
109 (file_name_free): Renamed from path_free. All uses changed.
110 (file_name_init): Renamed from path_init. All uses changed.
111 (file_name_prepend): Renamed from path_prepend. All uses changed.
112 * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
114 (longopts): Add comment that --path is deprecated.
116 2005-05-31 Jim Meyering <jim@meyering.net>
118 * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
119 This is a crutch so that `make distcheck's sc_tight_scope rule
120 knows that they really are deliberately declared that way.
122 2005-05-30 Paul Eggert <eggert@cs.ucla.edu>
124 Port to Solaris 10's rules for whether programs can chown files.
125 * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
126 (DO_CHOWN): Remove. Replaced by chown_failure_ok. All callers
128 (copy_internal): If chown failed, don't worry about what happened
129 to the mode bits; they can't have changed.
130 (chown_privileges, chown_failure_ok): New functions.
131 * src/copy.h: Add copyright notice.
132 (struct cp_options): Remove myeuid member. Add chown_privileges
134 (chown_privileges, chown_failure_ok): New function decls.
135 * src/cp.c (re_protect): Remove unnecessary call to geteuid.
136 Use chown_failure_ok rather than our own code.
137 * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
138 * src/install.c (cp_option_init): Likewise.
139 * src/mv.c (cp_option_init): Likewise.
141 2005-05-29 Paul Eggert <eggert@cs.ucla.edu>
143 * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
144 * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
146 * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
147 * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
148 [!defined _POSIX_VERSION]: Remove decls.
149 * src/install.c (getpwnam, getgrnam): Remove decl.
150 (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
151 * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
152 (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
153 * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
154 * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
156 Don't include <sys/file.h>; no longer needed.
157 (getegid, geteuid): Remove no-longer-necessary decls.
159 * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
160 Define to 256, not 255, as per modern POSIX.
162 2005-05-27 Paul Eggert <eggert@cs.ucla.edu>
164 * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
165 * src/dd.c (skip): Return the number of records that were not
166 skipped due to encountering EOF.
167 (dd_copy): If the file wasn't seekable and EOF was encountered,
168 write zeros past EOF until the desired offset is reached.
170 * NEWS: expr and test now correctly compare integers of unlimited size.
171 (Also, correct a comment that claimed that expr detects integer
172 overflow; it does so only when converting from strings.)
173 * src/expr.c: Include strnumcmp.h, xstrtol.h.
174 (looks_like_integer): New function.
175 (toarith): Use it. Also, use xstrtoimax rather than rolling our
177 (eval2): Don't look for trouble if !evaluate; this simplifies things.
178 Compare numbers using string comparison, so that overflow is
180 * src/sort.c: Refactor so that others can use large-integer
181 comparison functions.
182 Include "strnumcmp.h".
183 (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
184 Remove; moved to strnumcmp.
185 (decimal_point): Now int, to simplify converison overhead with
186 new API. All uses changed.
187 (thousands_sep): Now -1 if there isn't one, as per new API.
189 (numcompare): Move contents to strnumcmp module, except for
191 * src/test.c: Include inttostr.h, strnumcmp.h.
192 (whitespace, digit, digit_value, integer_expected_error): Remove.
193 (is_int): Remove; replaced by...
194 (find_int): New function.
195 (binary_operator): Don't let integers overflow in comparisons;
196 return the correct answer instead. Simplify the code.
197 (unary_operator): Convert the integer ourself, since find_int
199 * tests/expr/basic (bigcmp): New test.
200 * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
202 2005-05-26 Paul Eggert <eggert@cs.ucla.edu>
204 * NEWS: nohup now redirects a tty stdin to an unreadable fd
205 instead of closing it.
206 * doc/coreutils.texi (nohup invocation): Document this.
207 * src/nohup.c (main): Implement this.
209 2005-05-26 Jim Meyering <jim@meyering.net>
211 * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
212 Reported by David Alan Gilbert.
213 * tests/expr/basic: Add tests using arithmetic on negative integers.
215 2005-05-19 Jim Meyering <jim@meyering.net>
217 * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
218 Remove inaccurate-but-harmless `const' attributes.
220 * src/join.c (decode_field_spec): Add an abort after
221 `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
222 about variables being used uninitialized.
224 2005-05-18 Paul Eggert <eggert@cs.ucla.edu>
226 * configure.ac: Add copyright notice. gl_LIB_CHECK -> cu_LIB_CHECK.
227 * src/Makefile.am: Add copyright notice.
228 (factor_LDADD): Remove, as factor no longer needs sqrt.
229 * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
230 it's always true now.
232 2005-05-16 Paul Eggert <eggert@cs.ucla.edu>
234 Fix Cygwin porting problem reported by Eric Blake.
235 * src/remove.c (DT_IS_DIR): Remove.
236 (DT_IS_KNOWN, DT_MUST_BE): New macros.
237 (remove_entry): Use them.
239 2005-05-14 Paul Eggert <eggert@cs.ucla.edu>
241 * src/remove.c: Include unlinkdir.h.
242 (UNLINK_CAN_UNLINK_DIRS): Remove.
243 (remove_entry): Use cannot_unlink_dirs () rather than
244 UNLINK_CAN_UNLINK_DIRS.
246 2005-05-14 Jim Meyering <jim@meyering.net>
248 Update FSF postal mail address.
249 * Makefile.maint, Makefile.cfg, gnupload
250 * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
251 * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
252 * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
253 * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
254 * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
255 * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
256 * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
257 * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
258 * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
259 * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
260 * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
261 * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
262 * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
263 * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
264 * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
265 * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
266 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
267 * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
268 * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
269 * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
270 * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
271 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
273 2005-05-13 Jim Meyering <jim@meyering.net>
275 * NEWS: `rm -r' now removes all of the files it should, even on
276 systems with a buggy readdir affecting file systems inaccessible
279 In some unusual circumstances `rm -r' would fail to remove --
280 or even consider -- all entries in a directory with more than 254
281 (SunOS) or 338 (Darwin) entries. This could cause trouble even on
282 other types of systems when using an affected file system via e.g.,
283 NFS. The underlying cause was a bug in readdir on those systems.
284 Coreutils-5.2.1 and earlier used a configure-time test designed
285 to detect precisely those problem systems, but it would detect
286 the problem and enable remove.c's work-around code only when its
287 configure-time test was run on a losing file system. Obviously,
288 it couldn't detect a problem if the offending file system wasn't
289 tested or even mounted at coreutils configure time. Now, rm itself
290 performs a minimal-cost run-time test to detect the problem.
292 * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
293 (remove_cwd_entries): When readdir returns NULL for a directory from
294 which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
295 entries, call rewinddir and then resume the readdir/unlink loop.
296 (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
298 2005-05-12 Paul Eggert <eggert@cs.ucla.edu>
300 * NEWS: nohup now closes stdin if it is a terminal, unless
301 POSIXLY_CORRECT is set. This fixes a glitch noted by Wayne Pollock in
302 <https://www.opengroup.org/sophocles/show_mail.tpl?
303 source=L&listname=austin-group-l&id=8341>.
304 * doc/coreutils.texi (nohup invocation): Document this.
305 * src/nohup.c (main): Implement this.
307 2005-05-12 Jim Meyering <jim@meyering.net>
309 * src/date.c: Assume `free (NULL)' works.
310 * src/dd.c: Likewise.
312 * src/dircolors.c:Likewise.
313 * src/head.c: Likewise.
314 * src/ls.c: Likewise.
315 * src/md5sum.c: Likewise.
316 * src/pr.c: Likewise.
317 * src/sort.c: Likewise.
319 2005-05-10 Jim Meyering <jim@meyering.net>
321 * tests/touch/not-owner: Skip this test if the user running it
322 owns `/' or has write access to it.
324 * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
325 This makes `mv -i --reply=no f1 f2' work as expected (in not
326 performing the move operation). But note that specifying `-i'
327 after `--reply=no' does *not* work.
328 Tiny patch from Vlada Macek.
330 * tests/mv/reply-no: New file. Test for the above fix.
331 * tests/mv/Makefile.am (TESTS): Add reply-no.
333 * tests/ls-2/tests: Don't print PATH to stderr.
335 2005-05-08 Paul Eggert <eggert@cs.ucla.edu>
337 * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
340 2005-05-06 Paul Eggert <eggert@cs.ucla.edu>
342 * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
343 * src/dd.c (flags, usage): Add support for "binary" and "text".
345 2005-05-04 Paul Eggert <eggert@cs.ucla.edu>
347 * NEWS: chmod -w now complains if it differs from chmod a-w.
348 * src/chmod.c: Include quotearg.h.
349 (diagnose_surprises): New var.
350 (process_file): Diagnose surprises. Simplify the logic a bit,
352 (main): Prepare to diagnose surprises. Remove useless code for
354 * tests/chmod/Makefile.am (TESTS): Add umask-x.
355 * tests/chmod/umask-x: New file.
357 2005-05-02 Paul Eggert <eggert@cs.ucla.edu>
359 * NEWS: ls --indicator-style=directory renamed to ls
360 --indicator-style=slash, to avoid confusion with ls --directory.
361 * src/ls.c (usage): Likewise.
362 (slash): Renamed from directory_only. All uses changed.
364 2005-05-01 Paul Eggert <eggert@cs.ucla.edu>
366 * NEWS: "chmod +1 foo" is now diagnosed.
368 2005-04-29 Paul Eggert <eggert@cs.ucla.edu>
370 * NEWS: ls -p now marks only directories. New option
371 --indicator-style=directory equivalent to -p.
372 * doc/coreutils.texi (ls invocation): Document this.
373 Also, mention ">" is for doors.
374 * src/ls.c (enum indicator_style): New constant directory_only,
376 (indicator_style_args, indicator_style_types): Set it appropriately.
377 (decode_switches, gobble_file, print_type_indicator):
378 (length_of_file_name_and_frills):
379 Implement the change described in NEWS.
380 (decode_switches): Quote ">", too.
381 (usage): Update to match the new behavior. Describe ">".
382 * tests/ls/file-type: Test for new behavior. Omit -1 option.
383 The "ls --color" test wasn't being checked; add a check for
384 "ls --color=auto" instead.
386 * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
387 * tests/misc/split-fail: Likewise.
388 * tests/pr/Test.pm: Likewise.
389 * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
390 * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
391 if they use file names starting with +.
392 (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
393 * tests/uniq/Test.pm (tv, test_vector): Likewise.
395 The following was partly derived from a tiny change by Eric Blake:
396 * tests/misc/nice: Don't use 'set -'. It's not portable to strict
397 POSIX 1003.1-2001 hosts. Also, don't set _POSIX2_VERSION.
398 * tests/mkdir/perm: Don't use 'set -'. Simplify test construction.
399 Work even if the underyling system attaches ACLs to new dirs.
400 * tests/mv/part-hardlink: Don't use 'set -'.
401 * tests/stty/row-col-1: Don't use 'set -'.
403 2005-04-28 Paul Eggert <eggert@cs.ucla.edu>
405 * NEWS: Document fixes described below.
406 * src/chmod.c (change, umask_value): New static vars.
407 (reference_file): Move this static var to inside "main".
408 (process_file, process_files): Remove CHANGES arg; now taken from
409 static var. All uses changed.
410 (usage): Fix incorrect description of MODE operand.
411 (main): For invalid mode usages, output a brief usage message.
412 Adjust to new modechange API.
413 * install.c (main): Adjust to new modechange API.
414 Also, free the mode_change object when done.
415 * mkdir.c (main): Likewise.
416 * mkfifo.c (main): Likewise.
417 * mknod.c (main): Likewise.
418 * tests/chmod/equal-X: Check for =xX bug.
419 * tests/chmod/equals: Check for =u bug.
420 * tests/chmod/usage: Check for u+gr and ug,+x bugs.
422 2005-04-26 Paul Eggert <eggert@cs.ucla.edu>
424 Restore support for usages like "head -1" and "tail -1",
425 even when conforming to POSIX 1003.1-2001.
426 Fix bug with "POSIXLY_CORRECT=1 fold file -3".
427 join now supports a NUL field separator, e.g., "join -t '\0'".
428 join now detects and reports incompatible options, e.g.,
430 * NEWS: Document this.
431 * src/date.c: Remove posixver.h and its uses.
432 (COMMON_SHORT_OPTIONS): Remove.
433 (short_options): New constant.
434 (short_options, usage): -I now always takes an optional arg.
435 * src/expand.c: Remove posixver.h and its uses.
436 (shortopts): New constant. -DIGIT now always takes an optional arg.
437 (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
438 Don't complain about -DIGIT.
439 * src/fold.c: Remove posixver.h and its uses.
440 (shortopts): New constant. -DIGIT now always takes an optional arg.
441 (main): Don't preprocess arg list; that was buggy. Use method
443 * src/head.c: Remove posixver.h and its uses.
444 (header_mode_option): Remove.
445 (main): Don't complain about obsolete -NUM args.
446 * src/join.c: Remove posixver.h and its uses.
447 (obsolete_usage): Remove.
448 (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
449 they haven't been set yet.
450 (tab): Now int, not char. Initialize to -1 to indicate white space
451 separates columns, so that we can use NUL as a separator.
453 (OBSOLETE_LONG_OPTIONS, get_option): Remove.
454 (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
455 suffices. Use xstrtoul for sizes; it suffices.
456 (decode_field_spec): Report an error and exit on failure. Return void,
458 (add_field_list): Likewise.
459 (set_join_field): New function.
460 (enum operand_status): New enum.
461 (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
462 PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
463 possibilities with obsolete option parsing.
464 (main): Use it. Do not depend on POSIX version.
465 Check for conflicting options. Parse obsolete options -j1 and -j2
466 so that it is a pure extension to POSIX 1003.1-2001.
467 Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
468 * src/nice.c: Remove posixver.h and its uses.
469 (main): Always support -NUM option.
470 * src/od.c: Remove posixver.h and its uses.
471 (short_options): New constant, which always supports -w[num].
472 (COMMON_SHORT_OPTIONS): Remove.
473 * src/pr.c: Remove posixver.h and its uses.
474 (short_options): New constant, which always supports -S[string].
475 (COMMON_SHORT_OPTIONS): Remove.
476 * src/sort.c: Remove posixver.h and its uses.
477 (short_options): New constant, which always supports -y arg.
478 (COMMON_SHORT_OPTIONS): Remove.
479 (main): Redo workaround for Solaris compatibility with -y.
480 This change isn't visible to the user; it just cleans up the
481 code so that we don't need posixver.h.
482 * src/split.c: Remove posixver.h and its uses.
483 (main): Don't complain about -NUM option.
484 * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
485 * src/unexpand.c: Remove posixver.h and its uses.
486 (main): Don't complain about -TAB.
487 * src/uniq.c (main): Don't complain about -NUM.
489 2005-04-22 Paul Eggert <eggert@cs.ucla.edu>
491 * src/nohup.c (main): If getopt fails, exit with status 127,
492 not status 1. POSIX requires this.
493 * NEWS: Document this.
495 * src/nice.c (main): Report proper program name when getopt finds
496 trouble. Problem reported by Behdad Esfahbod.
498 * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
499 when the "+x" was being evaluated.
500 * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
501 * mkfifo.c (main): Likewise.
502 * mknod.c (main): Likewise.
503 * tests/mkdir/perm: Test for the above bug.
505 2005-04-20 Paul Eggert <eggert@cs.ucla.edu>
507 Port test cases to Microsoft-Windows-related environments,
508 following suggestions from Eric Blake.
509 * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
510 * tests/install/basic-1: Undo previous change.
511 (dd, dd2): New vars, which use $EXEEXT. All uses of dd and dd2 changed.
512 * tests/install/trap: Undo previous change.
513 (sig): New var. Use it insted of "trap '' CHLD".
514 Append $EXEEXT to executable name.
516 "fetish" -> "coreutils" in more places.
517 * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
518 (package Coreutils): Renamed from package Fetish. All uses changed.
519 * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
522 2005-04-19 Paul Eggert <eggert@cs.ucla.edu>
524 * tests/mv/setup (dot_mount_point): Use stat -L, in case the
525 directory is actually a symbolic link. Problem reported by
528 * tests/mv/mv-special-1: Use test -p to test for fifos, rather
529 than the (incorrect) test -f and the (inadequate) ls. ls is
530 inadequate because on some hosts a buggy mv will create a file of
531 the wrong type (problem reported by Eric Blake). Skip this test
532 if test -p doesn't work.
534 * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
535 since the latter can have shell metacharacters in them (e.g., spaces).
536 This follows up to the 2005-01-17 patch, which missed this occurrence.
538 2005-04-18 Paul Eggert <eggert@cs.ucla.edu>
540 "fetish" -> "coreutils" in several places.
541 * Makefile.cfg (ftp): Remove fetish.sf.net.
542 * Makefile.maint (emit_upload_commands): Likewise.
543 * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
544 * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
545 * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
547 * tests/install/basic-1: Use "cat", not "test", to test for
548 ../../src/dd. Problem reported by Eric Blake.
550 2005-04-18 Jim Meyering <jim@meyering.net>
552 * src/dd.c: Don't include stat-macros.h directly. system.h does that.
554 2005-04-17 Paul Eggert <eggert@cs.ucla.edu>
556 Work around a couple of "make check" failures reported for Cygwin
557 and ash by Eric Blake.
558 * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
559 * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
561 2005-04-16 Jim Meyering <jim@meyering.net>
563 * src/dd.c (S_TYPEISSHM): Remove definition.
564 Get the definition by including "stat-macros.h", instead.
566 2005-04-14 Paul Eggert <eggert@cs.ucla.edu>
568 Fix test suite problems reported by Eric Blake on Cygwin.
569 * tests/mv/mv-special-1: Ignore chatter about when files are removed,
570 since POSIX doesn't require rename to fail across file systems.
571 * tests/mv/setup (dot_mount_point): Use stat rather than df, as
573 (other_partition_tmpdir): Remove df from name as that would be
576 2005-04-14 Jim Meyering <jim@meyering.net>
578 * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
580 2005-04-12 Paul Eggert <eggert@cs.ucla.edu>
582 * src/ls.c (usage): "uid" -> "user ID".
584 2005-04-12 Jim Meyering <jim@meyering.net>
586 * src/tsort.c (tsort): Use "%s" as the format string,
587 rather than a diagnostic or a file name.
589 * src/comm.c (compare_files): Remove declaration of unused local.
591 * src/chown-core.c (chopt_free): Mark parameter as unused.
593 2005-04-11 Paul Eggert <eggert@cs.ucla.edu>
595 * man/chown.x: Reword to match user manual.
596 * man/id.x: Likewise.
597 * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
599 * src/whoami.c (usage, main): Likewise.
601 Add bulletproofing for cases where stdin, stdout, or stderr are closed.
602 * src/comm.c: Include stdio-safer.h.
603 (compare_files): Exit right away on I/O error rather than continuing
604 and producing confusing output and error messages.
605 Return void, not int; all callers changed.
606 Use fopen_safer to avoid confusion with file descriptors.
607 * src/copy.c: Include unistd-safer.h.
608 (copy_reg): Use fd_safer.
609 * src/csplit.c: Include stdio-safer.h.
610 (input_desc): Remove unnecessary static initialization.
611 (set_input_file): Use STDIN_FILENO, not 0.
612 (create_output_file): Use fopen_safer.
613 * src/dircolors.c (dc_parse_file): Don't assume fopen does not
615 * src/head.c (head_file): Don't assume open does not return 0.
616 * src/join.c: Include stdio-safer.h.
617 (main): Use fopen_safer. Simplify the resulting code.
618 * src/md5sum.c (digest_file, digest_check):
619 Don't assume that fopen does not return stdin.
620 * src/nohup.c: Include unistd-safer.h.
621 (main): Don't dup stderr to stdin or stdout by mistake.
622 * src/od.c (check_and_close): Don't assume fopen does not return stdin.
623 * src/paste.c (paste_serial): Likewise.
624 * src/pr.c: Include stdio-safer.h.
625 (open_file): Use fopen_safer.
626 (close_file): Don't assume fopen does not return stdin.
627 * src/ptx.c (main): Don't assume fopen returns stdout after closing
628 stdout. Use freopen instead.
629 * src/shred.c: Include unistd-safer.h.
630 (wipename): Use fd_safer on directory file descriptor.
631 (wipefile): Remove special case for /dev/fd/* on older hosts.
632 It didn't work in general, and wasn't documented.
634 * src/sort.c: Include unistd-safer.h.
635 (create_temp_file): Use fd_safer.
636 (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
637 * src/split.c: Include unistd-safer.h.
638 (cwrite): Use fd_safer. Replace mystery constant 0666 with symbolic
639 version, as POSIX requires.
640 * src/sum.c (bsd_sum_file, sysv_sym_file):
641 Use same pattern as elsewhere for checking for stdin.
642 * src/tac.c: Include unistd-safer.h.
643 (copy_to_temp): Use fd_safer.
644 (tac_file): Don't assume fopen cannot return stdin.
645 * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
646 (recheck, tail_file): Use fd_safer rather than open_safer.
647 * src/tee.c: Include stdio-safer.h.
648 (tee): Use fopen_safer.
649 * src/touch.c: Include unistd-safer.h.
650 (touch): Use fd_safer.
651 * src/tsort.c (have_read_stdin): Remove; no longer needed. All uses
653 (tsort): Do not assume fopen can't return stdin.
654 Close stdin before returning. All uses changed.
655 * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
656 * src/uniq.c: Include stdio_safer.h.
657 (check_file): Don't assume fopen cannot return stdin or stdout.
659 2005-04-09 Jim Meyering <jim@meyering.net>
661 * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
663 Now that close_stdout closes standard output unconditionally,
664 these workarounds for dd and cat are no longer necessary.
665 * src/dd.c (close_stdout_wrapper): Remove function.
666 (main): Call atexit with close_stdout, instead.
667 * src/cat.c (close_stdout_wrapper): Likewise.
668 Don't close STDOUT_FILENO explicitly; close_stdout does it.
670 * src/system.h (__attribute__): Readability nit:
672 # define __attribute__(x)
674 # define __attribute__(x) /* empty */
676 2005-04-09 Jim Meyering <jim@meyering.net>
678 * src/rm.c (usage): Mention that --recursive removes listed
679 directories too, not just their contents.
680 Say that by default, rm does not remove directories.
682 * src/pr.c: Don't include "timespec.h". system.h does that.
683 * Makefile.maint (sc_system_h_headers): Propagate exit status
686 2005-04-08 Paul Eggert <eggert@cs.ucla.edu>
688 * NEWS: Document that dd no longer treats QUIT or PIPE specially,
689 and when conforming to POSIX no longer treats USR1 specially.
690 Document that dd no longer dumps core when handling signals.
691 * src/system.h (RETSIGTYPE): Remove; no longer needed. All uses
693 * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
695 (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
696 (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
697 behavior when called from a signal handler. All uses changed.
698 (main) [!defined SA_NOCLDSTOP]:
699 Use siginterrupt to specify that system calls should be interrupted.
700 * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
701 (process_signals): Add forward decl.
702 (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
704 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
705 (SA_NODEFER) [!defined SA_NODEFER]: New macro.
706 (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
707 (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
709 (usage): Mention -USR1 versus -INFO.
710 (cleanup): Don't invoke print_stats; the caller must do it now.
712 (quit): Process signals just before exiting.
713 (interrupt_handler): Simply record the signal and return.
714 (siginfo_handler): Simply increment the signal counter and return.
715 (install_handler): Remove, replacing with:
716 (install_signal_handlers, process_signals, iread, iwrite):
717 New functions. All callers to safe_read and full_write replaced
718 by iread and iwrite. All callers to install_handler replaced by
720 * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
722 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
723 (main) [! SA_NOCLDSTOP]: Use it.
724 * src/shred.c: Remove all uses of signals; modern hosts have
725 /dev/random and don't need this gorp.
726 Do not include signal.h.
727 (env, sigill_handler, isaac_seed_machdep): Remove. All uses removed.
728 * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
730 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
731 (main) [! SA_NOCLDSTOP]: Use it.
733 * src/dd.c: Do not include inttostr.h, no longer needed.
734 (print_stats, main): Rewrite and simplify formats to use PRIuMAX
735 instead of umaxtostr.
736 (print_stats): Work even in languages that have special
737 forms for two of things, for r_truncate and w_bytes. We can't
738 fix delta_s in this way, since ngettext doesn't support floating-point.
739 (main): Rewrite to avoid casts.
741 2005-04-07 Jim Meyering <jim@meyering.net>
743 Placate gcc-4's -Wuninitialized.
744 * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
745 * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
747 * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
749 (binop): Move function definition to precede first use so we can...
750 (binop): ...remove prototype.
752 2005-04-05 Paul Eggert <eggert@cs.ucla.edu>
754 * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
755 * src/basename.c (usage): Add examples.
756 * src/cat.c (usage): Likewise.
757 * src/chgrp.c (usage): Likewise.
758 * src/chown.c (usage): Likewise.
759 * src/dirname.c (usage): Likewise.
761 2005-04-05 Jim Meyering <jim@meyering.net>
763 * src/nice.c (usage): Mention that some shells provide a
764 built-in function by the same name.
765 * src/nohup.c (usage): Likewise.
766 * src/printenv.c (usage):Likewise.
768 2005-04-04 Dmitry V. Levin <ldv@altlinux.org>
770 * src/tee.c (tee): When closing files, do not close stdout,
771 leave this job to close_stdout() instead.
772 * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
773 * tests/Makefile.am (SUBDIRS): Add tee.
774 * tests/tee/Makefile.am: New file.
775 * tests/tee/.cvsignore: Likewise.
776 * tests/tee/{basic,dash}: New tee tests.
778 2005-04-04 Jim Meyering <jim@meyering.net>
780 * src/echo.c (usage): Mention that some shells provide a
781 built-in function by the same name.
782 * src/kill.c (usage): Likewise
783 * src/printf.c (usage): Likewise.
784 * src/pwd.c (usage): Likewise.
785 * src/stat.c (usage): Likewise.
786 * src/test.c (usage): Likewise.
787 * src/true.c (usage):
788 * src/system.h (USAGE_BUILTIN_WARNING): New macro.
790 * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
791 * man/printf.x: Likewise.
792 * man/pwd.x: Likewise.
794 2005-04-03 Jim Meyering <jim@meyering.net>
796 * src/pr.c (main): Fix off-by-one error.
797 pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
798 end of a malloc'd buffer.
800 2005-04-01 Jim Meyering <jim@meyering.net>
802 * src/pr.c (main): Free column_count_string when done with it.
804 Don't let pr treat +1:-1 like +1:18446744073709551615.
805 * src/pr.c (strtoumax): Remove declaration.
806 (first_last_page): Use xstrtoumax in place of strtoumax,
807 so we don't interpret a negative page number (e.g., in an option
808 like --pages=1:-1) as valid.
809 * tests/pr/Test.pm (neg-page): Add a test for this.
811 2005-03-30 Paul Eggert <eggert@cs.ucla.edu>
813 * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
814 * src/uptime.c (uptime): New arg OPTIONS. All uses changed.
815 * src/users.c (users): Likewise.
816 * src/who.c (who): Likewise.
817 * src/uptime.c (main): Check PIDs when invoked with zero arguments.
818 * src/users.c (main): Likewise.
819 * src/who.c (main): Likewise. Also with two arguments.
820 Omit duplicate code in 2-arg case.
821 (UT_PID): Moved to ../lib/readutmp.h.
823 2005-03-29 Jim Meyering <jim@meyering.net>
825 * src/system.h (ptr_align): Declare `ptr' parameter to be a
826 `const' pointer, since this function never writes through it.
828 * src/uname.c: Indent cpp directives to reflect nesting.
830 2005-03-28 Jim Meyering <jim@meyering.net>
832 * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
833 Add `void' to make this an ANSI-style function declaration.
834 * src/remove.c (ds_init): Likewise.
835 * src/pr.c (print_sep_string): Likewise.
837 * src/stty.c (speeds): Declare this array to be static.
838 * src/Makefile.am (sc_tight_scope): Adjust to catch any
839 new declarations like that of stty.c's `speeds'.
841 * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
842 (GETOPT_VERSION_OPTION_DECL): Likewise.
843 * src/chown.c (long_options): Likewise.
844 * src/chgrp.c (long_options): Likewise.
845 * src/chmod.c (long_options): Likewise.
846 * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
848 * src/chown-core.c (chopt_init): Likewise.
849 * src/comm.c (long_options): Likewise.
850 * src/copy.c (copy_reg): Likewise.
851 * src/csplit.c (extract_regexp): Likewise.
852 * src/cut.c (longopts): Likewise.
853 * src/date.c (time_spec_string): Likewise.
854 * src/df.c (find_mount_point, show_point): Likewise.
855 * src/expr.c (docolon): Likewise.
856 * src/fmt.c (long_options): Likewise.
857 * src/ls.c (time_style_args, indicator_style_args, long_options)
858 (format_args, sort_args, time_args, decode_switches)
859 (gobble_file): Likewise.
860 * src/md5sum.c (long_options): Likewise.
861 * src/mv.c (reply_args): Likewise.
862 * src/paste.c (longopts): Likewise.
863 * src/pinky.c (print_entry): Likewise.
864 * src/pr.c (long_options): Likewise.
865 * src/ptx.c (long_options, format_args): Likewise.
866 * src/readlink.c (longopts): Likewise.
867 * src/sort.c (long_options, mergefps): Likewise.
868 * src/stat.c (long_options): Likewise.
869 * src/tac.c (main): Likewise.
870 * src/tail.c (follow_mode_string): Likewise.
871 * src/touch.c (longopts, time_args): Likewise.
872 * src/uniq.c (delimit_method_string): Likewise.
873 * src/uptime.c (print_uptime): Likewise.
874 * src/who.c (print_user): Likewise.
876 2005-03-27 Jim Meyering <jim@meyering.net>
878 * src/dcgen: Simplify further, clean up.
879 Add a standard-output-closing global destructor.
881 * src/wheel-gen.pl: Use the same global destructor as dcgen.
883 2005-03-26 Paul Eggert <eggert@cs.ucla.edu>
885 * src/dcgen: Squeeze multiple blanks into one. Output a simple
886 array of adjacent strings rather than a more complicated data
887 structure; this saves space in the dircolors executable.
888 * src/dircolors.c (parse_line): Use char *, not unsigned char *.
890 (dc_parse_stream, main): Avoid casts.
891 Adjust to simpler data structure generated by new dcgen.
893 2005-03-25 Eric Blake <ebb9@byu.net> (tiny change)
895 * src/ls.c (usage): Document usage of LS_COLORS.
897 2005-03-25 Paul Eggert <eggert@cs.ucla.edu>
899 * src/dircolors.hin: Add "TERM cygwin".
901 2005-03-25 Jim Meyering <jim@meyering.net>
903 * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
904 the return value, and update callers:
905 * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
906 * src/expand.c (parse_tab_stops, main): Likewise.
907 * src/split.c (main): Likewise.
908 * src/unexpand.c (parse_tab_stops, main): Likewise.
909 * src/uniq.c (main): Likewise.
911 2005-03-22 Jim Meyering <jim@meyering.net>
913 * build-aux: New directory. Renamed from config.
914 * configure.ac: Reflect renaming: config -> build-aux.
915 * Makefile.am (dist-hook): Likewise.
916 * Makefile.maint: Likewise.
917 * Makefile.cfg (cvs_files): Likewise.
918 * .x-sc_sun_os_names: Likewise.
919 * .x-sc_trailing_blank: Likewise.
921 * src/ls.c (get_funky_string): Use '\a', rather than 7, for
922 portability to EBCDIC hosts.
924 2005-03-20 Jim Meyering <jim@meyering.net>
926 * src/pr.c (init_header): Add missing `%' in new format string.
927 (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
929 2005-03-19 Jim Meyering <jim@meyering.net>
931 * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
932 $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
934 2005-03-18 Paul Eggert <eggert@cs.ucla.edu>
936 * NEWS: pr -D "FORMAT" now accepts the same formats that
938 * src/pr.c: Include strftime.h, timespec.h.
939 (init_header): Obtain and format nanosecond part of time stamp.
941 * NEWS: nohup now ignores the umask when creating nohup.out.
942 nohup now closes stderr if it is a terminal and stdout is closed.
943 * src/nohup.c (main): Likewise. Be a little more paranoid about
944 return values; e.g., check for any negative return from open.
945 Assume free (NULL) works.
946 Close file descriptor leak when redirecting standard output to a file.
948 2005-03-17 Jim Meyering <jim@meyering.net>
950 * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
951 in place of functionally-equivalent code.
952 * src/expand.c (parse_tab_stops, main): Likewise.
953 * src/split.c (main): Likewise.
954 * src/unexpand.c (parse_tab_stops, main): Likewise.
955 * src/uniq.c (main): Likewise.
956 * src/od.c: Use VERIFY macro in place of an equivalent open-coded
958 * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
961 Before, this command would make uniq skip 11 fields and print
963 $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
966 * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
967 not like `uniq -f11'.
969 2005-03-15 Jim Meyering <jim@meyering.net>
971 Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
972 `pr -0' should give a better diagnostic and `pr -03' should be
973 equivalent to `pr -3'.
974 * src/pr.c (parse_column_count): Change return type to void.
975 Call error (EXIT_FAILURE, ... for an invalid string.
976 (main): Allocate space for column_count_string using malloc.
977 Accumulate all old-style column-count digits before converting.
978 When the number of columns is specified via both old-style,
979 (e.g., -3), and a long option (--columns=5), ensure that only
980 the last one specified takes effect.
981 * tests/pr/Test.pm: Add tests for the above.
983 2005-03-15 Corinna Vinschen <corinna@vinschen.de> (tiny change)
985 * src/copy.c (copy_reg): Copy regular files in binary mode.
987 2005-03-14 Paul Eggert <eggert@cs.ucla.edu>
989 * NEWS: Restate why ls limits time stamp lengths.
991 2005-03-12 Jim Meyering <jim@meyering.net>
993 Add a little infrastructure to help prevent future bugs like the
995 * src/stat.c (xstrcat): New function.
996 (print_statfs, print_stat): Add buf_len parameter and convert all
997 uses of strcat to xstrcat. Update callers.
998 (print_it): Call print_func with buf_len parameter.
1000 Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
1001 could cause a buffer overrun error.
1002 * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
1003 conversion of the stat %s format string to the longer printf %llu one.
1004 Patch from Guochun Shi.
1006 2005-03-11 Paul Eggert <eggert@cs.ucla.edu>
1008 * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
1009 (long_time_expected_width, print_long_format): Use it, to avoid
1010 some possible denial-of-service attacks.
1011 * NEWS: Document this.
1013 2005-03-11 Jim Meyering <jim@meyering.net>
1015 Prompt once again for `mv -i A B' when A and B are hard links
1016 to the same file. This fixes a bug introduced by my 2003-04-04
1017 (coreutils-5.0.1) change. Reported by Thomas Wolff via Eric Blake.
1018 * src/copy.c (abandon_move): New function, factored out of
1019 copy_internal, now that this code is being used from two places.
1020 (copy_internal): Perform the same interactive-related test for
1021 whether it's alright to proceed and (usually) overwrite the
1023 * tests/mv/i-4: Add tests for the above.
1025 Don't segfault for a very long date format string, e.g.,
1026 ls -ld --time-style=+%99999999H .
1027 * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
1028 so format string abuse cannot provoke stack overflow.
1029 (print_long_format): Likewise.
1031 Don't segfault for a long header date string, e.g.,
1032 echo a|pr -D +%9999999A
1033 * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
1034 Don't bother with fixed-sized initial buffer; always use x*alloc.
1036 * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
1037 in place of equivalent INT_STRLEN_BOUND + 1.
1038 * src/expr.c (tostring, printv): Likewise.
1040 2005-03-09 Paul Eggert <eggert@cs.ucla.edu>
1042 * src/system.h: Include intprops.h.
1043 (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1044 they are now defined in intprops.h.
1046 2005-03-09 Jim Meyering <jim@meyering.net>
1048 * TODO: Remove entry about named pipes. It was fixed in 5.3.0.
1050 2005-03-08 Paul Eggert <eggert@cs.ucla.edu>
1052 * src/date.c (usage): Redo to match recent documentation changes.
1053 Don't bother documenting which usages are GNU extensions; the list
1054 wasn't correct, and is better left to the printed manual anyway.
1056 2005-03-06 Jim Meyering <jim@meyering.net>
1058 Factor out column-count processing.
1059 * src/pr.c: Include "inttostr.h".
1060 (parse_column_count): New function.
1061 (main): Use the new function for both old-style, -9, and long,
1062 --columns=-9, options.
1064 * src/cksum.c: Remove `register' keyword.
1065 * src/cut.c: Likewise.
1066 * src/dd.c: Likewise.
1067 * src/env.c: Likewise.
1068 * src/factor.c: Likewise.
1069 * src/fmt.c: Likewise.
1070 * src/fold.c: Likewise.
1071 * src/id.c: Likewise.
1072 * src/logname.c: Likewise.
1073 * src/ls.c: Likewise.
1074 * src/pr.c: Likewise.
1075 * src/printf.c: Likewise.
1076 * src/shred.c: Likewise.
1077 * src/sort.c: Likewise.
1078 * src/sum.c: Likewise.
1079 * src/test.c: Likewise.
1080 * src/tsort.c: Likewise.
1081 * src/uniq.c: Likewise.
1082 * src/wc.c: Likewise.
1083 * src/whoami.c: Likewise.
1085 2005-03-01 Paul Eggert <eggert@cs.ucla.edu>
1087 * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1090 2005-03-01 Jim Meyering <jim@meyering.net>
1092 * src/copy.c (copy_internal): Change test of source type from
1093 !S_ISREG to S_ISLNK. Reported by Paul Eggert in
1094 http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1096 2005-02-28 Jim Meyering <jim@meyering.net>
1098 * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1100 2005-02-21 Paul Eggert <eggert@cs.ucla.edu>
1102 * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1103 (nanosec_libs): Add $(LIB_XNANOSLEEP). Needed for newer GNU/Linux
1104 hosts with clock_gettime.
1106 2005-02-20 Paul Eggert <eggert@cs.ucla.edu>
1108 * NEWS: Describe user-visible change to dd.
1109 * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1110 Remove $(LIB_CLOCK_GETTIME). These functions now use
1112 * src/dd.c: Include gethrxtime.h, xtime.h.
1113 (start_time): Now of type xtime_t, not struct timespec.
1114 (print_stats, main): Use gethrxtime rather than gettime.
1115 * src/ls.c (time): Remove obsolete decl.
1116 (get_current_time): gettimeofday always returns 0, so don't
1118 * src/shred.c: Include gethrxtime.h.
1119 (isaac_seed): Use gethrxtime rather than a mishmash.
1120 * src/touch.c (time): Remove obsolete decl.
1122 * tests/misc/split-fail: Don't assume that the current host
1123 supports integers wider than 32 bits. Fix comment typo.
1124 * tests/od/x8: Likewise.
1126 * src/chown-core.c (enum RCH_status): Remove trailing comma,
1127 as it's not valid in standard C89.
1129 2005-02-15 Jim Meyering <jim@meyering.net>
1131 * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1132 so that file systems of type `xfs' are recognized as such.
1133 * src/fs.h: Regenerate.
1134 Reported by Bernd Eckenfels.
1135 * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1136 * src/fs.h: Regenerate.
1137 Reported by Andreas Schwab.
1139 * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1140 to work around the invalid definition from Darwin 7.7.0.
1141 Test failure reported by Sébastien Maret.
1143 2005-02-14 Paul Eggert <eggert@cs.ucla.edu>
1145 * src/sort.c (mergefps): Use binary search rather than linear one
1146 when comparing new line to lines already in main memory.
1147 Idea suggested by James Lemley.
1149 2005-02-09 Jim Meyering <jim@meyering.net>
1151 * src/copy.c (valid_options): Add an assertion that
1152 not both hard_link and symbolic_link are set.
1154 2005-02-08 Paul Eggert <eggert@cs.ucla.edu>
1156 * NEWS: Document stat -f -c %S, plus changes to default formats.
1157 * doc/coreutils.texi (stat invocation): Normalize terminology,
1158 capitalization, and sort order to match --help output. Mention %c
1159 for file systems. Add new -f -c format %S, and document %s versus %S;
1160 problem reported by Jeroen van Wolffelaar.
1161 * src/stat.c (usage): Likewise.
1162 (STATFS_FRSIZE): New macro.
1163 (print_statfs): Use it, for stat -f -c %S.
1164 (do_statfs): Change default formats to output %S.
1166 2005-02-03 Paul Eggert <eggert@cs.ucla.edu>
1168 * src/system.h: Include "memrchr.h".
1169 (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1171 2005-02-02 Jim Meyering <jim@meyering.net>
1173 * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1174 systems that don't support sparse files.
1175 Check for $2 -ge 128, rather than $2 = 128, in case
1176 there is a file system type that doesn't support sparse files,
1177 yet for which metadata takes up additional space.
1178 Both reported by Andreas Schwab.
1180 2005-02-01 Eric Blake <ebb9@byu.net> (tiny change)
1182 * tests/du/8gb: Create a larger test file, so we properly
1183 detect that sparse files can be created on NTFS under cygwin.
1185 2005-01-30 Jim Meyering <jim@meyering.net>
1187 * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1189 * src/stty.c: Remove unnecessary parentheses in all #if directives.
1191 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
1193 * .cvsignore: Ignore config.cache and config.status.lineno.
1194 * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1195 instead of VSWTCH, for use with CSWTCH.
1197 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
1199 * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1200 * tests/rwx-to-mode: Ignore ACL designation.
1201 * tests/setgid-check: Likewise.
1202 * tests/chown/separator: Quote user and group names.
1204 2005-01-24 Jim Meyering <jim@meyering.net>
1206 * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1207 Suggestion from Johan Boule.
1209 2005-01-17 Eric Blake <ebb9@byu.net> (tiny change)
1211 * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1213 * man/Makefile.am (all_programs): Revert previous patch; updated
1214 all_programs.list fixes this.
1215 (.x.1): No need to add $(EXEEXT).
1217 2005-01-03 Corinna Vinschen <corinna@vinschen.de> (tiny change)
1219 * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1222 2005-01-22 Jim Meyering <jim@meyering.net>
1224 * Makefile.maint (v_etc_file): The version string has moved to
1225 version-etc-fsf.c, search that new file, not version-etc.c.
1227 2005-01-17 Paul Eggert <eggert@cs.ucla.edu>
1229 * tests/group-names: Use numeric group ids, not symbolic group names,
1230 since the latter can have shell metacharacters in them (e.g., spaces).
1231 Problem reported by Eric Blake.
1232 * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1233 * tests/chgrp/deref: Likewise.
1234 * tests/chgrp/posix-H: Likewise.
1235 * tests/chgrp/recurse: Likewise.
1237 2005-01-15 Jim Meyering <jim@meyering.net>
1239 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1240 because just calling gethrtime evokes an `illegal instruction'
1241 failure when compiled with Sun's c89 on Solaris 8 and 9.
1242 Reported by Nelson Beebe.
1244 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1245 twice with the same value of `t'.
1246 Replace nested #if-#else blocks with #if-#elif-#elif chain.
1248 2005-01-14 Jim Meyering <jim@meyering.net>
1250 The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1251 * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1252 sockets, since that's what you get when reading from a command-line-
1253 supplied pipe on Darwin 7.7.
1254 (IS_PIPE_LIKE_FILE_TYPE): Define.
1255 (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1256 Reported by Nelson Beebe.
1257 This same change is also required on NetBSD/sparc-1.5.
1258 Reported by Adrian Bunk.
1260 * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1261 rather than suffering silently.
1262 Before, expr would silently overflow and wrap around:
1263 $ expr 9223372036854775808 = 0 # $(echo 2^63|bc)
1265 Now it detects the problem and exits nonzero:
1266 $ ./expr $(echo 2^63|bc) = 0
1267 ./expr: 9223372036854775808: integer is too large
1269 * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1270 failure, so that doesn't cause `make check' to stop. Nelson Beebe
1271 reported that this test would fail with the diagnostic,
1272 `cannot find name for group ID 10', on one of his systems.
1274 2005-01-13 Jim Meyering <jim@meyering.net>
1276 * src/test.c (is_int): Don't overflow when evaluating integer
1277 constants. Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1280 * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1281 names of temporary files that would clash on 8.3 file systems.
1282 * tests/mk-script (validate): Likewise.
1284 2005-01-12 Jim Meyering <jim@meyering.net>
1286 * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1288 * tests/tr/Test.pm (repeat-xC): Change test name from
1289 `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1290 Reported by Eric Blake.
1291 (repeat-000): Rename to `repeat-zeros' for the same reason.
1293 2005-01-11 Jim Meyering <jim@meyering.net>
1295 * configure.ac: Update version to 5.3.1.
1297 2005-01-11 Eric Blake <ebb9@byu.net>
1299 * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1300 * man/Makefile.am (all_programs): Account for $(EXEEXT).
1302 2005-01-11 Jim Meyering <jim@meyering.net>
1304 * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1305 with decreasing values.
1307 * src/expand.c (main): Likewise.
1308 * src/unexpand.c (main): Check for overflow in tabstop values
1309 specified via the obsolete form. E.g., now this command fails:
1310 _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1311 Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1312 * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1314 2005-01-10 Paul Eggert <eggert@cs.ucla.edu>
1316 Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1317 * NEWS: Document the changes.
1318 * doc/coreutils.texi (pathchk invocation): Likewise.
1319 * src/pathchk.c (PORTABILITY_OPTION): New constant.
1320 (longopts, usage, main, validate_file_name):
1321 Add support for new -P option.
1322 Reject empty file names (unless -p is not specified and the
1323 current system allows empty file names).
1324 Change --portability so that is now equivalent to -p -P.
1325 Don't test whether file name is too long, if it is known to exist.
1326 (no_leading_hyphen): New function.
1327 * tests/misc/pathchk1: Add tests for empty file names and
1330 2005-01-08 Jim Meyering <jim@meyering.net>
1334 `pr --columns=N' was not equivalent to `pr -N' when also using
1337 * src/pr.c (main): Set `explicit_columns' for --columns=N,
1338 not just for -N. This bug has existed since the introduction
1339 of the --columns=N option on 1998-08-15.
1340 * NEWS: Document this.
1341 * tests/pr/Test.pm (test_vector): For each -N test, automatically
1342 create a new test vector using --columns=N.
1344 2005-01-07 Paul Eggert <eggert@twinsun.com>
1346 * src/pr.c (main): Check for column count overflow with
1347 usages like "pr -2147483648".
1349 2005-01-07 Jim Meyering <jim@meyering.net>
1351 * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1353 2005-01-06 Jim Meyering <jim@meyering.net>
1355 * README: List the precise HP-UX version numbers that are affected.
1356 Suggestion from Bob Proulx.
1358 * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1359 predicate before `-name ChangeLog' to avoid a harmless warning
1362 2005-01-05 Jim Meyering <jim@meyering.net>
1364 * tests/help-version: Punt on the uptime test, since it fails when
1365 it can't get boot time, and I don't want that to stop `make check'.
1367 * src/du.c (process_file): Evaluate exclusion rules against
1368 the entire file name, not just the last component.
1369 Reported by Robert Lindgren.
1370 * tests/du/exclude: Test for this.
1371 * NEWS: Document this.
1373 Ensure that tests/Makefile.am's check-root actions stay up to date.
1374 * Makefile.maint (sc_root_tests): New rule.
1375 (syntax-check-rules): Add it to the list.
1377 2005-01-04 Jim Meyering <jim@meyering.net>
1379 * man/shred.x: Change one-line summary to reflect that shred does
1380 not remove files by default. Suggestion from Helen Faulkner in
1381 http://bugs.debian.org/288552
1383 * README: Request VERBOSE=yes output when reporting test failures.
1384 Other minor changes.
1386 * tests/Makefile.am (check-root): Update.
1388 2005-01-03 Paul Eggert <eggert@cs.ucla.edu>
1390 * src/system.h: Undo previous change; we now use Autoconf.
1392 2005-01-03 Jim Meyering <jim@meyering.net>
1394 * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1395 a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems. Setting
1396 either (or both) to zero would succeed, but subsequent `stty size'
1397 would say `no size information for this device' due to the ioctl
1398 failing with EINVAL.
1400 * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1401 not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1402 then fail at compile-time rather than let tools like od produce
1403 invalid results at run time.
1405 2004-12-21 Jim Meyering <jim@meyering.net>
1407 * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1408 not `xx01, xx02, ...'.
1409 Reported by Matt Kraai in http://bugs.debian.org/286605
1411 * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1414 2004-12-20 Paul Eggert <eggert@cs.ucla.edu>
1416 * src/split.c (usage): Mention default size. Suggested by Dan Jacobson.
1418 2004-12-19 Paul Eggert <eggert@cs.ucla.edu>
1420 * NEWS: Mention that one should eval "`dircolors`" rather than
1423 2004-12-17 Jim Meyering <jim@meyering.net>
1425 * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1426 so temporary directories aren't left behind upon e.g., interrupt.
1428 2004-12-16 Paul Eggert <eggert@cs.ucla.edu>
1430 * src/ls.c (print_dir): Use "%s: not listing already-listed
1431 directory", not "not listing already-listed directory: %s", to
1432 format already-listed directories, to be consistent with other
1433 diagnostics involving file names and colons.
1435 2004-12-15 Jim Meyering <jim@meyering.net>
1437 * src/Makefile.am (__LDADD): Define, so that building `[' on
1438 Solaris still uses the -lgen library that it requires in order
1439 to get a definition of eaccess.
1441 2004-12-14 Jim Meyering <jim@meyering.net>
1443 tac would exit immediately upon I/O or temp-file creation failure.
1444 Now it continues on, processing any remaining command line arguments.
1446 * src/tac.c: Include quotearg.h.
1447 Use quotearg_colon in most diagnostics.
1448 (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1449 failure. Before, this command (with /full/tmp being a full partition)
1450 TMPDIR=/full/tmp ./tac /proc/modules tac.c
1451 would exit immediately upon the write error while trying to copy
1452 non-seekable /proc/modules to the full partition. Now it still
1453 reports the failure but continues on with the remaining file.
1454 (tac_nonseekable): Return false also if copy_to_temp fails.
1455 [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1456 using atexit like this is wrong.
1457 * NEWS: Document this.
1458 * tests/misc/tac-continue: New test for this.
1459 * tests/misc/Makefile.am (TESTS): Add tac-continue.
1461 * tests/chown/basic: Add a few more tests.
1463 2004-12-13 Paul Eggert <eggert@cs.ucla.edu>
1465 * src/ls.c (gobble_file): Change arg name to be command_line_arg
1466 rather than explicit_arg, for consistency with copy.c.
1467 (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1468 it is deducible from dirname arg. All callers changed.
1469 (extract_dirs_from_files, print_dir, queue_directory):
1470 Add command_line_arg arg. All callers changed.
1471 (struct pending): Add command_line_arg member.
1472 (main): Use NULL rather than 0 when appropriate.
1473 (set_exit_status, file_failure): New functions.
1474 (queue_directory): Store command_line_arg into new structure.
1475 (print_dir, gobble_file, get_link_name):
1476 Use file_failure to report problems in accessing files,
1477 so that the exit status is set consistently.
1478 (print_dir): Simplify readdir failure code yet again.
1479 If closedir fails, report "closing directory" rather than "reading
1481 (xstrcoll): Use set_exit_status to set status on failure.
1482 * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1485 2004-12-11 Jim Meyering <jim@meyering.net>
1487 Avoid a race condition vulnerability in chown, when used with
1488 --from=O:G and without the (-h) --no-dereference option.
1489 * src/chown-core.c (restricted_chown): New function.
1490 (change_file_owner): Call it.
1491 Reported by Ulrich Drepper.
1492 * NEWS: Mention this.
1494 2004-12-09 Paul Eggert <eggert@cs.ucla.edu>
1496 * ls now exits with status 1 on minor problems, 2 if serious trouble.
1497 * NEWS: Document this.
1498 * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1499 All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1501 (main): Initialize exit failure to LS_FAILURE.
1502 (print_dir, gobble_file, get_link_name, xstrcoll):
1503 Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1504 (print_dir): Do not give up on entire directory merely because readdir
1506 (usage): Explain exit status.
1507 * tests/help-version: ls and variants now exit with status 2
1510 2004-12-08 Paul Eggert <eggert@cs.ucla.edu>
1512 * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1515 2004-12-07 Paul Eggert <eggert@cs.ucla.edu>
1517 * src/factor.c (factor): Don't list 1 as a factor of 1.
1518 Problem reported by Thomas Folz-Donahue.
1520 2004-12-06 Jim Meyering <jim@meyering.net>
1522 * tests/du/files0-from: Sanitize environment.
1523 Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1524 setting is the default (exported from /etc/profile) on at least one
1526 * tests/du/no-deref: Likewise.
1527 * tests/cp/symlink-slash: Likewise.
1528 * tests/ls/symlink-slash: Likewise
1530 2004-12-05 Jim Meyering <jim@meyering.net>
1532 * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1533 _POSIX2_VERSION=199209 is in the environment, or when building on
1536 2004-12-04 Jim Meyering <jim@meyering.net>
1538 * NEWS: Mention cut's new --complement option.
1540 2004-10-01 Paolo Bonzini <bonzini@gnu.org>
1542 * cut.c (complement, COMPLEMENT_OPTION): New.
1543 (longopts): Add --complement.
1544 (usage): Say not that -b, -c, and -f `print' fields,
1545 but rather that they `select' fields for printing.
1546 Describe the new --complement option.
1547 (mark_range_start): Extracted from set_fields.
1548 (print_kth): Support --complement.
1549 (compare_ranges): New function.
1550 (set_fields): Rewrite the part that populates range_start_ht,
1551 merging it with the part that populates printable_field.
1552 (main): Handle --complement.
1554 2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
1556 * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1557 failed. This works around an assertion failure reported by
1559 http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1561 2004-12-02 Jim Meyering <jim@meyering.net>
1563 With using --color and with LS_COLORS saying not to color
1564 executables, don't stat every file.
1565 * src/ls.c (is_colored): New function.
1566 (gobble_file): Use it.
1567 (main): Use it here, in place of too-strict tests against NULL:
1568 if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1569 old test would fail.
1571 2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
1573 * src/comm.c (compare_files): Assume setlocale exists.
1574 * src/join.c (keycmp): Likewise.
1575 * src/seq.c (decimal_point): Treat like sort. Now char.
1577 (main): Assume localeconv exists. Use same code as sort.
1578 * src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
1579 Assume setlocale exists.
1580 (thousands_sep): Renamed from th_sep.
1581 (IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
1582 (NONZERO): Parenthesize use of arg.
1583 (numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
1584 consistency. Avoid unnecessary negation by reversing
1586 (main): Rewrite localeconv call to match seq.c.
1587 * src/system.h: Assume locale.h exists.
1588 (HAVE_SETLOCALE): Remove.
1589 * src/uniq.c (different): Assume setlocale exists.
1591 * src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
1592 'volatile' on a local variable. Rewrite to avoid unnecessary
1593 double-assignment to 'func' in the usual case where strcoll does
1596 2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
1598 * src/pinky.c (gethostname): Remove decl.
1599 (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1600 * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1601 UT_TYPE_BOOT_TIME instead of by-hand code.
1602 * src/users.c (list_entries_users): Use IS_USER_PROCESS
1603 instead of by-hand code.
1604 * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1605 DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1606 (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1607 (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1608 UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1609 (gethostname): Remove decl.
1610 (list_entries_who, scan_entries): Use the new macros defined above,
1611 for consistency with pinky, uptime, and users.
1613 2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
1615 Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1616 HP's ANSI C compiler. Declaring int functions causes warnings on
1617 some modern systems and shouldn't be needed to compile on ancient
1619 * src/copy.h (stat, lstat, rename): Remove decls.
1620 * src/install.c (stat): Remove decl.
1621 * src/ln.c (link, symlink): Remove decls.
1623 2004-11-25 Jim Meyering <jim@meyering.net>
1625 * man/help2man: Import help2man-1.35.1.
1626 * man/Makefile.am (.x.1): Remove now-unnecessary use of
1627 locally-added --program-name=NAME option. Now, help2man gets
1628 the name from the [NAME] section (i.e. from our .x file).
1629 * man/install.x: Use `install', not `ginstall' in the one-line
1630 description. Reported by Brendan O'Dea.
1631 * man/sha1sum.x: Use `sha1sum', not `shasum'.
1633 2004-11-24 Jim Meyering <jim@meyering.net>
1635 Since the changes of 2004-05-22, the u.saved_cwd member at
1636 the bottom of the active-directory stack was no longer
1637 strictly necessary. This change removes that member and uses
1638 the newer cwd_state parameter for the final restore_cwd.
1640 * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1641 [dev_ino]: Rename from `a'.
1642 (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1643 bottom-of-stack cwd-state member.
1644 (AD_pop_and_chdir): No longer return boolean. Adjust caller.
1645 (AD_push_initial): Remove CWD parameter. Adjust caller.
1647 2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
1649 Minor performance improvements and cleanups for "touch".
1650 * src/touch.c (posix_date): Remove; not needed as a static var.
1652 (touch): Use new futimens function to operate more efficiently
1653 in some cases. Don't stat/fstat existing file when
1654 (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1655 old time stamps aren't needed in that case.
1656 (main): change_times is int, not bool. Simplify test for
1659 2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
1661 * src/install.c (usage): Avoid usage that runs afoul of Docbook
1662 translation. Problem reported by Eric S. Raymond.
1664 Restore dd's noctty flag, reverting the change of 2004-04-08.
1665 POSIX does not allow "dd" to use O_NOCTTY by default.
1666 * NEWS: Add noctty flag to dd.
1667 * doc/coreutils.texi (dd invocation): Likewise.
1668 * src/dd.c (flags, usage, main): Likewise.
1670 2004-11-19 Alfred M. Szmidt <ams@gnu.org>
1672 * src/ls.c (usage): Clarified description of --no-group (-G),
1673 --human-readable (-h), --inode (-i), --size (-s), --time,
1676 2004-11-19 Jim Meyering <jim@meyering.net>
1678 * src/ls.c (usage): Clarify description of --author.
1679 Tweak indentation so that help2man creates better nroff.
1680 Reported by Dan Jacobson.
1682 * src/uniq.c (check_file): Don't check stdout for errors here.
1684 * src/pwd.c (find_dir_entry): Update comment to match reality.
1686 2004-11-18 Jim Meyering <jim@meyering.net>
1688 * src/pwd.c (robust_getcwd): Correct the comment: this function
1689 constructs the directory name. The caller prints it.
1691 2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
1693 * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1694 (do_statfs): Use it.
1696 * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1697 src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1698 src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1699 src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1700 src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1701 * src/readlink.c (main): argv is not const.
1703 * src/cut.c (usage): Improve documentation along the lines suggested
1705 * src/echo.c (usage): Likewise.
1706 * src/expr.c (usage): Likewise.
1708 * src/dircolors.hin: Add putty, screen-bce.
1710 * src/pinky.c (print_entry): Fix memory leak.
1711 * src/who.c (print_user): Likewise.
1713 2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
1715 * NEWS: New dd operand "status=noxfer".
1716 * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1717 C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1718 C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1720 (STATUS_NOXFER, statuses): New constants.
1721 (usage, print_stats, scanargs): Add support for status=noxfer.
1722 (usage): Update status output to match new behavior.
1723 (print_stats): Always output complete byte count.
1724 Put space between numbers and units, as SI requires.
1725 Use ngettext so that i18n can use plurals for "byte" and "second".
1726 Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1727 (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1729 * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1730 problems with regression testing.
1732 2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
1734 * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1735 * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1736 * src/dd.c: Include "human.h".
1737 (w_bytes, start_time): New vars.
1738 (usage): Document new I/O statistics output
1739 (print_stats): Output new I/O statistics.
1740 (cleanup): Do statistics after closing stdin and stdout, so that
1741 the times are more accurate.
1742 (write_output, dd_copy): Count output bytes.
1743 (main): Get initial value of clock.
1745 2004-11-14 Jim Meyering <jim@meyering.net>
1747 Backslash-escape `-'s in email addresses, so that they are
1748 rendered properly in UTF-locales.
1749 * man/help2man (escape_hyphens): New function.
1750 (main): Call it on email addresses.
1752 * src/sort.c (zaptemp): Mark new diagnostic for translation.
1754 * tests/misc/close-stdout: New file. Test today's closeout.c change.
1755 * tests/misc/Makefile.am (TESTS): Add close-stdout.
1757 2004-11-13 Jim Meyering <jim@meyering.net>
1759 * src/test.c (usage): Put the description of `[-n] STRING'
1760 on two lines, one for `-n STRING' and one for `STRING' so that
1761 help2man properly escapes the `-'. Otherwise, the hyphen is
1762 rendered inappropriately in UTF-8 locales.
1763 Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1765 2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
1767 * NEWS: Document the following changes.
1769 * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1771 (temptail): New variable, so that we can easily append to list.
1772 (create_temp_file): Create new files at end of list, so that
1773 searching the list has O(N*NMERGE) behavior instead of O(N**2).
1774 (zaptemp): Update temptail if needed.
1775 (mergefps, merge): Accept new arg that counts temp files, and keep it
1776 up to date as we create and remove temporaries. This is for
1777 efficiency, so that we don't call zaptemp so often.
1778 All callers changed.
1779 (sort): Don't create array in reverse order, since the list of
1780 temporaries is now in the correct order.
1782 (zaptemp): Protect against race condition: if 'sort' is
1783 interrupted in the middle of zaptemp, it might unlink the
1784 temporary file twice, and the second time this happens the file
1785 might already have been created by some other process.
1787 (zaptemp): Warn if a temporary file is not removed.
1789 (create_temp_file): Use offsetof for clarity.
1790 (die): Move it up earlier, to clean up the code a bit.
1792 * src/pr.c (strtoumax): Declare if not declared.
1793 (skip_to_page, first_page_number, last_page_number, page_number,
1794 first_last_page, print_header):
1795 Use uintmax_t for page numbers.
1796 (first_last_page): Remove unnecessary forward declaration.
1797 Do not modify arg (it is now a const pointer).
1798 Return a true if successful, false (without print a diagnostic)
1800 (main): If +XXX does not specify a valid page range, treat it
1801 as a file name. This follows the response to Open Group XCU ERN 41
1802 <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1803 which says the behavior is allowed.
1804 (skip_to_page): When starting page number exceeds page count,
1805 print both numbers in the diagnostic.
1806 (print_header): Detect page number overflow.
1808 2004-11-07 Jim Meyering <jim@meyering.net>
1810 * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1811 (main) [__APPLE__]: Get the processor type via syscall rather than
1812 hard-coding "powerpc". From Toby Peterson.
1814 * src/sort.c (merge): Remove declarations of now-unused variables.
1816 2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
1818 * src/sort.c (first_same_file): Remove. Move most of the code to....
1819 (avoid_trashing_input): New function.
1820 (merge): Avoid some silly merges, e.g., copying a single file to
1821 a temporary file when there are exactly 17 input files to merge.
1822 Take a count of temporary files rather than a max_merge arg.
1825 2004-11-06 Jim Meyering <jim@meyering.net>
1827 * src/sort.c (xfclose): Don't close stdout here (just flush it),
1828 since close_stdout now closes stdout unconditionally.
1830 2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
1832 * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
1833 first_same_file, merge, sort, main): Use size_t for indexes to arrays.
1834 This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
1836 (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
1837 thus avoiding unchecked stack overflow in some cases. As a side
1838 effect this improve the performance of "sort -M" by a factor of 4
1841 2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
1843 * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
1845 * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
1846 expression; it's not portable. Problem reported by Albert Chin.
1847 Don't invoke a program more than once.
1848 * src/groups.sh (version): New variable, containing author info,
1849 for benefit of AUTHORS check. Use it when acting on --version option.
1850 * AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
1853 * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
1854 as this breaks the new regime that does "#define getopt rpl_getopt".
1855 Problem reported by Albert Chin for Solaris 9 with Sun cc in:
1856 http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
1857 I suppose this may cause problems on ancient hosts with
1858 incompatible getopt declarations, but we'll cross that bridge if
1859 the problem gets reported to us by someone who can test the fix.
1861 2004-11-03 Jim Meyering <jim@meyering.net>
1863 * src/tac.c: quote(...) file names in diagnostics.
1865 2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
1867 * NEWS: Document getdate changes.
1869 2004-10-29 Jim Meyering <jim@meyering.net>
1871 * src/tac.c (tac_file): Remove temporary prototype and move this
1872 function `down' so that it precedes definition of tac_nonseekable.
1874 `tac /proc/modules' would print nothing
1875 Reported by Harald Dunkel in http://bugs.debian.org/278604.
1877 * src/tac.c (copy_to_temp): Renamed from save_stdin, since
1878 now it copies a general file descriptor, not just stdin.
1879 (tac_nonseekable): Renamed/adapted from tac_stdin.
1880 (tac_file): Get fd via `open' directly rather than via fopen/fileno,
1881 since we never used the stream. Perform "-" to stdin mapping here
1882 rather than in main. Determine whether a file is seekable,
1883 by trying to `lseek' to its end, and dispatch to tac_seekable or
1884 tac_nonseekable accordingly.
1885 (main): Rewrite argument handling now that it uses only tac_file.
1886 * NEWS: Mention it here.
1888 2004-10-21 Jim Meyering <jim@meyering.net>
1890 * tests/mv/leak-fd: New file.
1891 * tests/mv/Makefile.am (TESTS): Add it.
1892 * tests/rm/dot-rel: New file.
1893 * tests/rm/Makefile.am (TESTS): Add it.
1895 Correct my patch of 2004-10-18.
1896 * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
1897 if necessary, not in remove_dir. Otherwise, removing multiple
1898 `.'-relative nonempty directories no longer worked.
1900 2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
1902 * src/fmt.c (usage): Improve description of --prefix.
1903 Problem reported by Edward Welbourne.
1905 * man/uniq.x: Change summary so that it doesn't imply that
1906 uniq writes to its input file. Problem reported by
1909 2004-10-18 Jim Meyering <jim@meyering.net>
1911 Plug a leak that would cause a cross-device mv to fail when
1912 operating on too many command-line-specified nonempty directories.
1913 * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
1914 top of the stack before returning. This usually closes the file
1915 descriptor that was used to return to the original working directory.
1916 Reported by Cyril Bouthors in
1917 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
1918 * NEWS: Mention it here.
1920 * src/pathchk.c (validate_file_name): Give a more descriptive
1921 diagnostic when pathconf fails. This also avoids an unwarranted
1922 warning from gcc-3.3.5 about a format not being a string literal.
1924 * src/sleep.c (main): Remove declaration of unused local, c.
1925 * src/printenv.c (main): Likewise.
1926 * src/logname.c (main): Likewise.
1927 * src/uptime.c (main): Likewise, for optc.
1928 * src/tsort.c (main): Likewise, for opt.
1930 2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
1932 * AUTHORS: Add self to pathchk.
1933 * src/pathchk.c (AUTHORS): Add self.
1934 Change "path" to "file name" whenever possible.
1935 Remove usage comment, as it was a duplication of the code or doc.
1936 Include <wchar.h> if available.
1937 (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
1938 (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
1939 pathconf_wrapper, portable_chars, dir_ok): Remove.
1940 (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
1941 (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
1942 (portable_chars_only): New arg FILELEN.
1943 Don't assume ASCII; we might be on an EBCDIC host.
1944 Don't assume unibyte locale in diagnostic.
1945 (component_start, component_len): New functions.
1946 (validate_file_name): Renamed from validate_path. All uses changed.
1947 Pretty much a complete rewrite.
1948 Don't make copy of file arg. Always append trailing slash to
1949 pathconf arg, just in case it's a symlink (this is pure paranoia;
1950 we don't know of any hosts where the trailing slash is required).
1951 Use size_t instead of long int when possible.
1952 Avoid need to call pathconf in most practical cases.
1953 Don't use euidaccess several times to test searchability;
1954 just use lstat once. Reword diagnostic to put the (often very long)
1957 2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
1959 * src/printf.c (usage): Mention Unicode, and use H for hex digits.
1961 2004-10-13 Jim Meyering <jim@meyering.net>
1963 * NEWS: Mention today's fts.c fix.
1965 2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
1967 * tests/stty/row-col-1: Set LC_ALL=C.
1969 2004-10-12 Jim Meyering <jim@meyering.net>
1971 * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
1972 From Jesus Climent in http://bugs.debian.org/276149.
1974 2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
1976 * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
1977 problems. All uses changed.
1979 2004-10-05 Jim Meyering <jim@meyering.net>
1981 * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
1982 since Karl says its trailing blanks are there to stay :-)
1984 2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
1986 * src/expr.c (NEW, OLD): Remove, partly to avoid
1987 reference to obsolescent macro XMALLOC.
1988 All uses replaced by xmalloc and free.
1990 2004-09-28 Jim Meyering <jim@meyering.net>
1992 * src/tail.c (usage): Clarify: --retry works only with --follow=name.
1993 Reported by Nik A. Melchior in http://bugs.debian.org/273781.
1995 2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
1997 * src/od.c (format_address_paren): c is optional, so don't output
2000 2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
2002 Add support for ls --hide. Idea suggested by Bardur Arantsson.
2003 * NEWS: Document this.
2004 * src/ls.c (file_ignored): Renamed from file_interesting, with
2005 inverted return value. Accept the file name, not a struct dirent *.
2006 All uses changed. Avoid the expense of calling fnmatch if the
2007 file is ignorable due to leading '.'.
2008 (all_files, really_all_files): Removed; replaced by:
2009 (ignore): New variable. All uses changed.
2010 (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
2012 (hide_patterns): New variable.
2013 (long_options, decode_switches, file_ignored, usage):
2014 Add support for --hide.
2015 (patterns_match): New function.
2016 (usage): Replace "hide" with "ignore" in explanation, to avoid
2019 2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
2021 * src/ls.c (gobble_file, print_long_format): Don't assume that
2022 human-readable output has a byte count equal to its column width;
2023 this isn't always true in locales where the radix character is not
2025 (format_user_or_group): Revamp code to match the above fix;
2026 this avoids the (very faint) possibility of integer overflow.
2028 2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
2030 * NEWS: Mention that "chmod -r -w x" now works as expected.
2031 * src/chmod.c (main): Revamp option processing to support this.
2032 * tests/chmod/Makefile.am (TESTS): Add 'usage'.
2033 * tests/chmod/usage: New set of tests for usage like that.
2035 2004-09-24 Jim Meyering <jim@meyering.net>
2037 * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
2038 it lists only cvs-controlled regular files.
2040 * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2041 to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
2043 2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
2045 * Makefile.maint (CVS_LIST): New macro.
2046 (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2047 sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2048 sc_trailing_blank, po-check): Use it instead of the
2049 nonstandard "cvsu --list".
2051 * src/tail.c (parse_obsolete_option): Bring back support
2052 for obsolete option followed by non-obsolete, or by more
2053 than one file. When obsolete, conform to SUSv2 rather than
2054 original POSIX 1003.2-1992, as SUSv2 corrected the case of
2055 "tail -c". Add support for the SUSv2 "b" modifier.
2056 * NEWS: Mention the above.
2057 * tests/tail/Test.pm: New test case obs-b to check the above.
2058 err-[134] no longer need _POSIX2_VERSION=199209.
2059 Fix comments to match revised behavior.
2061 2004-09-22 Jim Meyering <jim@meyering.net>
2063 * Use automake-1.9.2. Regenerate dependent files.
2065 * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2066 Improve the comment.
2068 Clean up scoping etc. so that some make `distcheck' tests pass.
2069 * src/csplit.c (xalloc_die): Declare to be static.
2070 * src/chown-core.c (chown_files): Declare as `extern'.
2071 * src/cp-hash.c (remember_created): Likewise.
2072 * src/copy.c (copy): Likewise.
2073 * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2075 * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2076 * src/unexpand.c: Likewise.
2078 * src/Makefile.am (check-AUTHORS): New rule.
2079 (check): Depend on it.
2082 * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2083 (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2085 2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
2087 * src/ls.c (decode_switches): Don't compare a short value
2088 to SIZE_MAX: GCC sometimes complains.
2090 2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
2092 * NEWS: The following commands now reject unknown options:
2093 basename dirname factor hostname link nohup sync unlink yes
2094 Also, pathchk no longer accepts trailing options.
2096 * src/basename.c: Include <getopt.h>.
2097 * src/chroot.c: Likewise.
2098 * src/dirname.c: Likewise.
2099 * src/factor.c: Likewise.
2100 * src/hostid.c: Likewise.
2101 * src/hostname.c: Likewise.
2102 * src/nohup.c: Likewise.
2103 * src/pwd.c: Likewise.
2104 * src/setuidgid.c: Likewise.
2105 * src/sync.c: Likewise.
2107 * src/basename.c (main): Reject unknown options.
2108 * src/dirname.c (main): Likewise.
2109 * src/factor.c (main): Likewise.
2110 * src/hostid.c (main): Likewise.
2111 * src/hostname.c (main): Likewise.
2112 * src/link.c (main): Likewise.
2113 * src/nohup.c (main): Likewise.
2114 * src/pwd.c (main): Likewise.
2115 * src/setuidgid.c (main): Likewise.
2116 * src/sync.c (main): Likewise.
2117 * src/unlink.c (main): Likewise.
2118 * src/yes.c (main): Likewise.
2120 * src/cat.c (main): Remove unused "case 0".
2121 * src/chgrp.c (main): Likewise.
2122 * src/chmod.c (main): Likewise.
2123 * src/chown.c (main): Likewise.
2124 * src/comm.c (main): Likewise.
2125 * src/cp.c (main): Likewise.
2126 * src/csplit.c (main): Likewise.
2127 * src/cut.c (main): Likewise.
2128 * src/date.c (main): Likewise.
2129 * src/df.c (main): Likewise.
2130 * src/du.c (main): Likewise.
2131 * src/env.c (main): Likewise.
2132 * src/expand.c (main): Likewise.
2133 * src/fold.c (main): Likewise.
2134 * src/head.c (main): Likewise.
2135 * src/id.c (main): Likewise.
2136 * src/install.c (main): Likewise.
2137 * src/join.c (main): Likewise.
2138 * src/ln.c (main): Likewise.
2139 * src/ls.c (decode_switches): Likewise.
2140 * src/mkdir.c (main): Likewise.
2141 * src/mkfifo.c (main): Likewise.
2142 * src/mknode.c (main): Likewise.
2143 * src/mv.c (main): Likewise.
2144 * src/nl.c (main): Likewise.
2145 * src/paste.c (main): Likewise.
2146 * src/pinky.c (main): Likewise.
2147 * src/pr.c (main): Likewise.
2148 * src/ptx.c (main): Likewise.
2149 * src/readlink.c (main): Likewise.
2150 * src/rm.c (main): Likewise.
2151 * src/rmdir.c (main): Likewise.
2152 * src/seq.c (main): Likewise.
2153 * src/shred.c (main): Likewise.
2154 * src/split.c (main): Likewise.
2155 * src/sum.c (main): Likewise.
2156 * src/tac.c (main): Likewise.
2157 * src/tail.c (main): Likewise.
2158 * src/tee.c (main): Likewise.
2159 * src/touch.c (main): Likewise.
2160 * src/tr.c (main): Likewise.
2161 * src/tty.c (main): Likewise.
2162 * src/uname.c (main): Likewise.
2163 * src/unexpand.c (main): Likewise.
2164 * src/wc.c (main): Likewise.
2165 * src/who.c (main): Likewise.
2167 * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2168 * src/cksum.c (main): Likewise.
2169 * src/dd.c (main): Likewise.
2170 * src/logname.c (main): Likewise.
2171 * src/printenv.c (main): Likewise.
2172 * src/sleep.c (main): Likewise.
2173 * src/tsort.c (main): Likewise.
2174 * src/uptime.c (main): Likewise.
2175 * src/users.c (main): Likewise.
2176 * src/whoami.c (main): Likewise.
2178 * src/du.c (long_options): Standardize on NULL vs 0.
2179 * src/rm.c (long_opts): Likewise.
2181 * src/logname.c (long_options): Remove.
2182 * src/printenv.c (long_options): Likewise.
2183 * src/sleep.c (long_options): Likewise.
2184 * src/tsort.c (long_options): Likewise.
2185 * src/uptime.c (longopts): Likewise.
2186 * src/users.c (longopts): Likewise.
2187 * src/whoami.c (long_options): Likewise.
2189 * src/pathchk.c (longopts): Add --help, --version.
2190 (main): Use longopts rather than parse_long_options.
2191 * src/stty.c (longpts, main): Likewise.
2193 * src/pathchk.c (main): Don't reorder arguments, so that
2194 we can check weird file names.
2196 * src/readlink.c: Don't include "long-options.h".
2197 * src/sort.c: Likewise.
2198 * src/stty.c: Likewise.
2200 * src/split.c (verbose): Now bool, not int.
2201 (VERBOSE_OPTION): New enum.
2202 (longopts, main): Use it.
2204 * tests/factor/basic: Adjust to new wording in diagnostic
2205 that results from the above changes.
2207 2004-09-21 Jim Meyering <jim@meyering.net>
2209 * man/rm.x: Say "the response is affirmative" rather than "the
2210 response begins with y or Y", so that the documentation is
2211 accurate in non-English locales. Problem reported by Munzir Taha.
2213 2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
2215 * src/echo.c (main): Don't pass NULL to strcmp when
2216 POSIXLY_CORRECT and given no arguments.
2218 * src/md5sum.c (STRING_OPTION): Remove.
2219 (long_options, main): Remove support for undocumented and
2220 obsolete --string option, as suggested in the 1996-09-26 patch.
2221 * NEWS: Document this.
2223 * tests/rm/fail-eperm: Don't try to remove writeable files in a
2224 sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2225 you remove such files. Problem reported by Bert Fischer in:
2226 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2228 2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
2230 * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2231 (long_options, main): Use them instead of magic numbers 2 and 1.
2232 For --string, optarg can't possibly be NULL.
2234 * src/dd.c (usage): Distinguish between options and operands.
2235 (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2236 Say "operands" for operands, not "options".
2237 (main): Use getopt_long, so that "dd --" works as POSIX requires.
2238 * tests/dd/misc: Check for "dd --".
2240 * src/chroot.c (main): Reject unknown options instead of
2241 interpreting them as a directory to chroot to.
2243 * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2244 The current standard (POSIX 1003.1-2004) is correct.
2245 (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2246 collision with builtin function.
2247 (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2248 output the first 0 as 8 digits, to make it easier to compare to
2249 the text of the standard. Output crctab to be a const array.
2250 (crctab): Use result of above changes.
2251 (long_options): Remove; not needed if empty.
2252 (main): getopt_long can't return 0 here, so simplify the code.
2254 2004-09-13 Jim Meyering <jim@meyering.net>
2256 * src/Makefile.am (localedir.h): Don't redirect directly to target.
2258 2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
2260 * src/id.c (print_full_info): Don't exit with failure status simply
2261 because a user or group number can't be turned into a name.
2262 Problem reported by Felipe Kellermann in:
2263 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2265 2004-09-12 Jim Meyering <jim@meyering.net>
2267 * Makefile.maint (my-distcheck): When building with -Werror, also
2270 2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
2272 * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2273 * src/tail.c (parse_obsolete_option): Renamed from
2274 parse_obsolescent_option, since the options are obsolete now.
2275 Remove bool *arg; just exit if there's an error. Revamp to follow
2276 POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2277 file" and "tail -10 -- file" correctly when we are conforming to
2279 (main): Adjust to this change.
2280 * tests/tail/Test.pm (test_vector): minus-* requires
2281 _POSIX2_VERSION=199209 now, to work correctly if there is
2282 an input file. err-1 and err-3 no longer errors if there
2285 2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
2287 * src/test.c (usage): Document -r, -w, -x more carefully.
2289 2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
2291 * src/test.c (usage): Document "test" (with no args) and "[ ]".
2292 Document that -h and -L don't dereference.
2294 * NEWS: Document that "tr xy -z" now works as per POSIX.
2295 Sort the descriptions.
2296 * src/tr.c (main): Don't reorder options.
2297 * tests/tr/Test.pm (fowler-1): New test case.
2299 2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
2301 * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2302 MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2303 conforming to pre-2001 POSIX.
2304 * NEWS: Document this.
2305 * tests/touch/obsolescent: Test for this bug. Also, set
2306 _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2307 a better test for obsolescent features.
2309 * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2310 "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2313 * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2314 (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2315 (long_options, main): --strings is now -S, not -s.
2316 (usage): Reflect the usage changes.
2317 (parse_old_offset): Do not issue a diagnostic on failure;
2318 callers now do this as necessary.
2319 (main): Support POSIX syntax. Remove unused case 0 from getopt_long.
2320 Add support for new short options (many undocumented) for
2321 compatibility with FreeBSD. Remove FIXME for -s; it's now
2322 POSIX-compatible. Default format is now oS, not o2.
2323 * NEWS: Describe the above.
2325 2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
2327 * src/stty.c (valid_options): Remove.
2328 (main): Fix some bugs in handling invalid option-combinations
2330 (recover_mode): Arg is now char const *, not char *.
2331 (main): Use STDIN_FILENO, not 0.
2332 Simplify option-parsing code a tad.
2333 * tests/stty/basic-1: Check for the fixed bugs.
2335 2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
2337 * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2338 it from ever being nonzero. Reported by Pozsar Balazs in:
2339 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2340 (human_fstype): Add ramfs, squashfs, sysfs.
2341 Reported by Pozsar Balazs in:
2342 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2343 (human_fstype): Return char const *, not char *.
2344 Simplify internals a bit, and avoid casts.
2346 * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2347 (bit_count): Remove. All uses changed to....
2348 (multiple_bits_set): New function.
2349 (scanargs): Use it, and check separately for each set of
2350 incompatible options, to improve diagnostics.
2352 (apply_translations): Move checks for incompatible options
2353 to scanargs, so that they're done consistently.
2355 2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
2357 Output correct errno-related diagnostic on "paste" I/O errors.
2358 * src/paste.c (write_error, xputchar): New functions.
2359 (paste_parallel): Use correct errno value after input error.
2360 (paste_parallel, paste_serial): Report errno value after output error.
2362 Port to diet libc. Problem reported by Felix von Leitner in:
2363 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2364 * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2365 it's not portable C to assume FILE is a complete type.
2366 (paste_parallel): Use index test instead of ENDLIST, and NULL
2369 2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
2371 POSIX-conformance fixes for "expand" and "unexpand".
2372 Also, consistently use "tab stop" rather than "tabstop".
2373 * NEWS: Document fixes.
2374 * src/expand.c: Revamp to resemble the new unexpand.c better.
2375 (usage): -i does not convert tabs after non-tabs.
2376 (add_tab_stop): Renamed from add_tabstop. All uses changed.
2377 (parse_tab_stop): Renamed from parse_tabstop. All uses changed.
2378 (validate_tab_stop): Renamed from validate_tabstop. All uses changed.
2379 (next_file, main): Check fclose against 0, not EOF.
2380 (expand): Remove unnecessary casts.
2381 Add another loop nesting level, for lines, so that per-line variables
2382 are initialized cleanly.
2383 Revamp tab checking. Check for write error immediately, rather
2384 than just once at the end of the program.
2385 * src/unexpand.c: Lkewise (for the expand.c changes).
2386 (TAB_STOP_SENTINEL): Remove.
2387 (tab_size): Now size_t, not uintmax_t, since we need to store
2388 the sequences of blanks.
2389 (max_column_width): New var.
2390 (usage): Say "blank" where POSIX requires this.
2391 (add_tab_stop): Calculate maximum column width.
2392 (unexpand): Store the pending blanks, instead of merely counting them.
2393 Follow POSIX's rules about -a requiring two blanks before a tab stop.
2394 Get rid of internal label and goto.
2395 * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2396 Add blanks-1 through blanks-13.
2398 2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
2400 * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2401 succeed without changing the uid and gid, like FreeBSD.
2402 * src/chgrp.c (parse_group): Return gid_t rather than storing it
2403 through a pointer. Treat "chgrp '' file" as a no-op change,
2405 (main): Set chopt.group_name to NULL if the group is the empty
2407 * src/chown-core.c (describe_change): Describe changes to -1:-1
2408 without using "to OWNERSHIP" phrase.
2409 * src/chown.c (usage): "chown '' file" is now allowed.
2410 (main): Do not set user name to the empty string if the group
2412 * tests/chgrp/basic: Test "chgrp '' file".
2413 * tests/chown/Makefile.am (TESTS): Add separator.
2414 * tests/chown/separator: New file, partly taken from
2415 Dmitry V. Levin's suggestion in
2416 <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2418 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
2420 * tests/install/basic-1: Test for the -d regression.
2422 2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
2424 * src/install.c (main): Fix -d regression introduced with
2425 --target-directory support at 2004-06-25.
2427 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
2429 * src/copy.c (copy_internal): When preserving links, unlink
2430 a destination with link count greater than one. This is so
2431 that commands like "cp -a" don't get confused when copying into
2432 a destination that already contains many hard links. Problem
2433 reported by Tim Waugh in:
2434 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2436 2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
2438 Convert all files to UTF-8.
2439 * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2440 * tests/sort/Test.pm (16a): Likewise.
2441 * tests/uniq/Test.pm (8): Likewise.
2442 * tests/misc/printf-hex: Use ASCII, not Latin-1.
2444 * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2445 * src/shred.c (usage): "-" is an operand, not an option.
2446 * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2447 A null file arg means standard output.
2448 (main): "-o -" means to write to a file named "-",
2449 not to standard output.
2450 * src/tee.c (usage, tee): "tee -" writes to standard output, not
2451 to a file named "-".
2453 2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
2455 * src/install.c (change_timestamps): Fix int->bool conversion
2456 bugs introduced on 2004-07-29.
2458 2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
2460 * src/shred.c (wipename): Work even if the directory is writeable
2461 and not readable. Prefer write access, since this should work
2462 better with fdatasync.
2464 * src/csplit.c (xalloc_die): New function.
2465 (main): Remove now-obsolete initialization of xalloc_fail_func.
2467 * src/md5sum.c: Adjust to sha->sha1 renaming.
2469 2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
2472 * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2473 (can_mode): Make variable local.
2475 2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
2477 * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2478 Do not define, to avoid annoying compiler messages on QNX 6.3.
2479 Problem reported by Johan in:
2480 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2482 2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
2484 * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2485 Define to a concatenation of string literals, not to an expression;
2486 needed for concatenation contexts.
2487 (INTMAX_MAX, INTMAX_MIN): New macros.
2489 * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2490 unsigned long; this isn't true for st_ino on Solaris 9.
2492 2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
2494 * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2495 whether to include files. Include <sys/param.h> if
2496 HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2497 (main) [defined __POWERPC__]: Add a kludge to work around a
2498 Mac OS X bug, so that uname -p defaults to "powerpc" if
2499 sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2500 fails. Problem reported by Petter Reinholdtsen in:
2501 http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2503 * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2504 main): Use bool for booleans.
2505 (writeline, check_file): Use uintmax_t for line counts.
2506 (check_file): Check for and report line number overflow,
2508 * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2509 (print_lines, print_words, print_chars, print_bytes, print_linelength,
2510 have_read_stdin, wc, wc_file, main):
2511 Use bool for booleans.
2512 (exit_status): Remove.
2513 (wc, wc_file): Return bool status. All callers changed.
2514 * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2515 * src/whoami.c (main): Print uids using unsigned long int, not
2518 * src/unexpand.c: Int cleanup and minor reorganization to be more
2520 Include quote.h, xstrndup.h.
2521 (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2522 (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2524 Use bool for booleans.
2525 (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2526 Use uintmax_t for column counts.
2527 (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2528 (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2530 (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2531 Detect overflow in tab stop string.
2532 (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2533 (unexpand): Concatenate input files the same way expand does.
2535 * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2536 touch, main): Use bool for booleans.
2537 (main): Avoid integer overflow when given more than INT_MAX
2539 * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2540 (have_read_stdin, count_items, scan_zeros, detect_loop,
2541 recurse_tree, walk_tree, tsort, main):
2542 Use bool for booleans.
2543 (exit_status): Remove.
2544 (tsort): Return a success flag instead of storing into a global.
2546 * src/tty.c (silent, main): Use bool for booleans.
2547 (main): 0 -> STDIN_FILENO.
2548 * src/uname.c (print_element): Use bool for booleans.
2550 * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2551 Remove. All uses replaced by C99 boolean primitives.
2552 (TEST_TRUE, TEST_FALSE): New constants, for readability.
2553 (test_unop, binop, unary_operator, binary_operator, two_arguments,
2554 three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2555 one_argument, main): Use bool for booleans.
2556 (advance, unary_advance): Now inline procedures rather than a macros.
2557 (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2558 (term, and, or): When it's easy, loop instead of recursing.
2559 (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2560 (binary_operator, unary_operator): Simplify by systematically rewriting
2561 true==FOO to FOO (where FOO is a boolean).
2562 (unary_operator): Don't consider a file to be a regular file
2563 merely because its mode&S_IFMT is zero. Just use S_ISREG.
2564 Remove unnecessary casts. Remove ifdefs for things like
2565 S_ISSOCK that are no longer needed, since stat-macros.h always
2568 * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2569 Use bool for booleans.
2570 (buf_init_from_stdin, buf_free, find_bol, print_line):
2571 Use size_t for sizes.
2572 * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2573 tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2574 (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2575 (tac_seekable): Use ptrdiff_t for pointer subtraction.
2576 Report an error if the result is out of range.
2577 (tac_seekable, main): Check for integer overflow in buffer size
2579 (main): Remove unnecessary casts.
2581 * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2582 the callee doesn't have to count 'em. All callers changed.
2583 Don't allocate more space for the arg vector than we'll need.
2584 Use memcpy to copy the args rather than rolling our own loop.
2585 Use size_t for sizes.
2586 (fast_startup, simulate_login, change_environment, log_su,
2587 correct_password, restricted_shell, main): Use bool for booleans.
2588 (longopts): Don't assume change_environment is an int.
2589 Use NULL, not 0, for pointers.
2590 (xsetenv): New function, replacing xputenv and concat.
2591 All callers changed.
2592 (elements): Remove; no longer needed.
2593 (log_su, correct_passwd, main): Prefer !x to x==NULL.
2594 (log_su): 2 -> STDERR_FILENO.
2595 (modify_environment, main): Don't assume that getenv's returned value
2596 has an indefinite lifetime.
2597 (modify_environment): Allocate a larger environ.
2598 (main): Remove an impossible 'case 0'; if it happens now, it'll
2599 get diagnosed. Don't assume getpwnam results outlive endpwent.
2600 Check for null or empty pw_name, pw_dir and for null pw_passwd.
2602 * src/stty.c (VA_START): Remove. All callers now use va_start.
2603 (_POSIX_VDISABLE): Remove unnecessary cast.
2604 (struct control_info, visible): Use cc_t for control chars.
2605 (struct control_info): Use size_t for sizes.
2606 (recover_mode, set_mode, display_speed, display_window_size,
2607 valid_options, main, display_changed):
2608 Use bool for booleans.
2609 (integer_arg): Return unsigned long int, not long int.
2610 Accept new max arg; all callers changed, to specify a maximum
2611 value for integer parameters instead of silently overflowing.
2612 (wrap): Do not overrun the stack buffer if the output contains
2613 more than 1024 bytes. Instead, malloc a buffer.
2614 (main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
2615 Remove unnecessary casts.
2616 (set_control_char): Allow int values only up to cc_t range.
2617 (screen_columns): Don't reject INT_MAX.
2618 (display_changed, display_all, display_speed, recover_mode):
2619 Don't assume cc_t fits in int.
2621 * src/remove.h: Add copyright notice.
2622 (struct rm_options): Use bool for booleans.
2623 * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2624 errno_rmdir_non_empty, remove_parents, main): Likewise.
2625 * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2627 (main): Don't dump core if invoked with argv[0]==NULL.
2628 * src/tee.c (tee, append, ignore_interrupts, main, tee):
2629 Use bool for booleans.
2630 (tee): Use ssize_t for read returns.
2632 * src/ptx.c: Add a FIXME mentioning that there are many
2633 unchecked integer overflows in this file.
2634 (gnu_extensions, auto_reference, input_reference, right_reference,
2635 ignore_case, initialize_regex, fix_output_parameters,
2636 output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2637 Use bool for booleans.
2638 (SKIP_SOMETHING, compare_words, digest_break_file,
2639 find_occurs_in_text, fix_output_parameters):
2640 Use to_uchar instead of a caset.
2641 (print_field): Rewrite to avoid cast.
2643 * src/printf.c (posixly_correct): Use bool for booleans.
2644 (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2645 (STRTOX): Rewrite to avoid casts.
2646 (print_esc_char): Arg is char, not int.
2647 * src/readlink.c (canonicalize): Remove. All uses now merely inspect
2649 (no_newline, verbose): Use bool for booleans.
2650 (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2651 * src/shred.c (struct Options, main): Use bool for booleans.
2652 (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2653 * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2654 Use bool for booleans.
2655 * src/stat.c (G_fail): Remove.
2656 (print_statfs): Print various gotta-be-nonnegative values using
2657 unsigned long int, not long int or int.
2658 (do_statfs, do_stat): Return a boolean success flag.
2659 (do_stat, main): Use bool for booleans.
2661 * src/pr.c: Add a FIXME mentioning that there are many
2662 unchecked integer overflows in this file.
2663 (TRUE, FALSE): Remove. All uses replaced by true and false.
2664 (struct COLUMN, read_line, print_page, print_stored, open_file,
2665 skip_to_page, init_fps, parallel_files, align_empty_cols,
2666 empty_line, FF_only, explicit_columns, extremities, keep_FF,
2667 print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2668 print_across_flag, storing_columns, balance_columns,
2669 truncate_lines, join_lines, untabify_input, failed_opens,
2670 numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2671 double_space, ignore_failed_opens, use_col_separator,
2672 pad_vertically, last_line, main, init_parameters, skip_read,
2673 read_line, print_stored):
2674 Use bool for booleans.
2675 (struct COLUMN, char_to_clump, store_char, print_char):
2677 (clump_buff, print_clump): Use char[], not int[], for an array whose
2678 elements are always chars.
2679 (first_last_page, main, getoptarg, balance, add_line_number,
2680 char_to_uclump): Remove unnecessary casts.
2681 (init_parameters): Allocate chars, not ints, for clump_buff.
2682 (print_char): Use to_uchar before invoking ISPRINT.
2683 (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2685 * src/nohup.c (main): Use bool for booleans.
2686 * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2687 * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2688 (portable_chars_only): Use to_uchar rather than a cast.
2689 * src/printenv.c (main): Use bool for booleans.
2690 Do not assume that the environ has at most one matching entry
2691 for each option (integer overflow was possible otherwise).
2693 * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2694 constant. Do not assume PRIdMAX etc. are strings of length 3 or
2696 (struct tspec): Use it. fmt_string is now an array, not
2697 a pointer, as there's little point to the indirection here.
2698 (struct tspec, flag_dump_strings,
2699 traditional, flag_pseudo_start, limit_bytes_to_format,
2700 abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2701 decode_one_format, open_next_file, check_and_close,
2702 decode_format_string, skip, write_block, read_char, read_block,
2703 parse_old_offset, dump, dump_strings, main):
2704 Use bool for booleans.
2705 (struct tspec): Use void *, not char *, for generic pointers.
2706 (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2707 bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2708 Use char, not unsigned int, since char suffices.
2709 (print_s_char, print_char, print_s_short, print_short,
2710 print_int, print_long, print_long_long, print_float,
2711 print_double, print_long_double): Rewrite to avoid casts.
2712 These now take void * arguments, instead of char *.
2713 Use the same body for all functions, except for the choice
2714 of type. Assume C89 to simplify handling of signed char.
2715 (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2716 Rewrite to avoid casts.
2717 (print_named_ascii, print_ascii): Now takes void *, not char *.
2718 (decode_one_format): Use int for printf field widths, not
2719 unsigned int. Pass void * to subsidiary printers,
2720 not char *. Simplify handling of floating-point formats
2721 by factoring out common code dealing with precision and field width.
2722 (decode_format_string): Avoid need for temporary copy of
2723 each decoded struct tspec.
2724 (get_lcm): Remove unnecessary cast.
2725 (main): Fix bug where more than INT_MAX failed decodes were ignored.
2727 2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
2729 * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2730 (enum number_format): Remove.
2731 (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2733 (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2734 (section_del): Now const.
2735 (print_fmt): Remove.
2736 (starting_line_number, page_incr, blank_join, line_no,
2737 print_lineno, proc_text, main):
2738 Use intmax_t for line numbers.
2739 (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2740 Use bool for booleans.
2741 (lineno_format): Now a string, not an enum value.
2742 (build_print_fmt): Remove. All calls removed. This work is
2743 now done within print_lineno.
2744 (build_type_arg): Use size_t for sizes.
2745 (print_lineno): Check for line number overflow.
2746 (proc_text, main): Remove unnecessary cast.
2748 * src/ln.c (symbolic_link, interactive, remove_existing_files,
2749 verbose, hard_dir_link, dereference_dest_dir_symlinks,
2750 do_link, main): Use bool for booleans.
2752 * src/ls.c (struct fileinfo, file_interesting,
2753 extract_dirs_from_files, color_symlink_as_referent,
2754 FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2755 numeric_ids, print_block_size, dired, print_with_color,
2756 check_symlink_color, print_inode, recursive, immediate_dirs,
2757 all_files, really_all_files, qmark_funny_chars,
2758 print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2759 main, decode_switches, parse_ls_color, print_dir, file_interesting,
2760 gobble_file, make_link_path, basename_is_dot_or_dotdot,
2761 extract_dirs_from_files, print_long_format):
2762 Use bool for booleans.
2763 (dir_defaulted): Remove; no longer needed.
2764 (main): Use int to count files, since it suffices for argv.
2765 Rewrite to avoid need for dir_defaulted.
2766 (main, print_dir, gobble_file, get_link_name,
2768 Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2769 (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2770 Remove unnecessary cast to int. Use int instead of unsigned
2771 int to count from 0 to 1.
2772 (get_funky_string, print_type_indicator): Use char for bytes, not int.
2773 (make_link_path): Use NULL for null pointers.
2774 (quote_name): Use to_uchar instead of cast.
2776 * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2777 print_full_info): Use bool for booleans.
2778 (problems): Remove, replacing with....
2779 (ok): New var (inverted from old sense).
2780 (print_user, print_group, print_full_info):
2781 Print uids/gids with %lu, not %u.
2782 (xgetgroups): Don't run out of memory if getgroups or getugroups
2784 * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2786 * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2787 int, since it suffices.
2788 (factor, print_factors): Use size_t for sizes.
2789 (print_factors, do_stdin, main): Use bool for booleans.
2790 * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2791 (fold_file, main): Use bool for booleans.
2792 (fold_file, main): Use size_t for sizes.
2793 (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2794 of prohibiting widths greater than INT_MAX.
2795 * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2796 write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2797 elide_tail_lines_pipe, elide_tail_lines_seekable,
2798 elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2799 string_to_integer, main):
2800 Use bool for booleans.
2801 (main): Rewrite to avoid cast.
2803 * src/csplit.c (struct line): Use size_t for sizes.
2804 (main): Remove unnecessary cast.
2805 * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2806 * src/cut.c (cut_file, main): Use bool for booleans.
2807 * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2808 * src/env.c (main): Likewise.
2809 * src/expr.c (nextarg): Likewise.
2810 * src/env.c (main): Remove unused and nonstandard envp arg.
2812 * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2813 fmt's arbitrary limits.
2814 (TRUE, FALSE): Remove; all uses changed to (true, false).
2815 (main): Use bool for booleans.
2816 Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
2818 (copy_rest): Remove unnecessary cast.
2819 (get_prefix): Rewrite to avoid cast.
2820 (check_punctuation): Use char *, not unsigned char *; C89 requires
2821 this. Avoid off-by-one buffer read overrun when line is empty.
2822 (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2823 Remove unnecessary casts.
2824 * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2827 * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2828 next_file, expand, main):
2829 Use bool for booleans.
2830 (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
2832 Use uintmax_t for column counts.
2833 (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
2834 All callers changed.
2835 (parse_tabstops): Don't pass a negative char to isblank.
2836 Avoid memory leak with large tab stops.
2837 (validate_tabstops, expand): Don't assume number of tab stops is
2839 (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
2840 storing values into exit_status.
2841 (expand): Use same pattern as unexpand for reading chars.
2842 Report an error when input line is too long, instead of silently
2843 screwing up. Do not mishandle tab stops when backspacing left
2846 * src/dircolors.c (have_read_stdin, append_quoted,
2847 dc_parse_stream, dc_parse_file, main): Use bool for booleans.
2848 (dc_parse_stream): Use enum for state, rather than int.
2849 Use ssize_t to store getline result.
2851 * src/dd.c (translation_needed, parse_integer, scanargs,
2852 apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
2853 Use bool for booleans.
2854 (translate_buffer): Use to_uchar rather than a cast.
2855 (swab_buffer, copy_simple, copy_with_unblock):
2856 Use size_t for sizes.
2858 * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
2859 * src/sleep.c (apply_suffix): Likewise.
2860 * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
2861 forever, from_start, print_headers, have_read_stdin, valid_file_spec,
2862 write_header, file_lines, pipe_lines, pipe_bytes, recheck,
2863 tail_forever, tail_bytes, tail_lines, tail, tail_file,
2864 parse_obsolescent_option, parse_options, main): Likewise.
2865 * src/sleep.c (apply_suffix): Invert sense of result.
2866 Use int (not unsigned int) for multiplier, as this generates better
2867 code with some compilers. Simplify code a bit.
2868 * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
2869 parse_options): Use uintmax_t, not unsigned int or unsigned long int,
2871 (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
2872 make it a bit clearer.
2874 * src/hostname.c: Include "xgethostname.h".
2875 (xgethostname): Remove decl; xgethostname.h has it.
2876 (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
2877 && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
2878 prototypes rather than K&R form. Assume any negative value from
2879 sysinfo denotes failure, not just -1.
2880 (main): Simplify use of sethostname.
2882 * src/pinky.c (include_idle, include_heading, include_fullname,
2883 include_project, include_plan, include_home_and_shell, do_short_format,
2884 include_where, main): Use bool for booleans.
2885 (count_ampersands, create_fullname, scan_entries, short_pinky):
2886 Use size_t for sizes.
2887 (create_fullname): Check for overflow in size calculations.
2888 (idle_string): Don't assume that the number of idle days
2889 is less than 10**8 and/or INT_MAX/(24*60*60).
2890 (main): No need to pass a non-NULL last arg to getopt_long.
2891 * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
2892 (print_uptime): Remove unused local variable.
2893 (main): No need to pass a non-NULL last arg to getopt_long.
2894 * src/users.c (list_entries_users, users): Use size_t for sizes.
2895 (list_entries_users): Use char for bytes.
2896 (main): No need to pass a non-NULL last arg to getopt_long.
2897 * src/who.c (do_lookup, short_list, short_output, include_idle,
2898 include_heading, include_mesg, include_exit, need_boottime,
2899 need_deadprocs, need_login, need_initspawn, need_clockchange,
2900 need_runlevel, need_users, my_line_only, main): Use bool for booleans.
2901 (print_runlevel): Use unsigned char for bytes.
2902 (list_entries_who, scan_entries, who): Use size_t for sizes.
2903 (main): No need to pass a non-NULL last arg to getopt_long.
2905 * src/install.c (isdir): Remove decl.
2906 (install_file_to_path): Rely on make_path to fail if the destination
2907 is not a directory, by passing preserve_existing==true to it.
2908 Hence we no longer need to call isdir.
2909 Free dest_dir immediately when it's no longer needed, rather than
2910 waiting until the end of the function.
2911 (copy_file): Don't bother calling isdir, as copy will do the
2912 right thing if the destination is a directory.
2914 * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
2915 print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
2916 Use bool for booleans.
2917 (max_depth): Now size_t, not int, to avoid an arbitrary limit
2918 of INT_MAX on depth.
2919 (G_fail): Remove: no longer needed, now that the relevant
2920 functions return bool.
2921 (process_file): Use return value to signal success rather than
2922 setting a global. Remove first_call static var; not needed, since
2923 we can look at n_alloc. Use size_t for depths. Remove FIXME
2924 about size_t casts, as it's now fixed. Use xnrealloc rather
2925 than the obsolescent XREALLOC. Don't bother to check whether
2926 reallocation is needed unless level > prev_level.
2927 (du_files): Invert sense of result, for consistency with
2928 other coreutils code. All callers changed.
2929 (main): Allow --max-depth values up to SIZE_MAX.
2931 * src/df.c (inode_format, show_all_fs, show_local_fs,
2932 show_listed_fs, posix_format, require_sync, print_type,
2933 selected_fstype, excluded_fstype, show_dev, show_point, main):
2934 Use bool for booleans.
2935 (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
2936 (show_dev, show_point, main):
2937 Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2938 Don't assume disk name lengths are <= INT_MAX.
2939 Rewrite pct calculation to avoid cast.
2940 (show_point): Don't assume resolved length is <= SSIZE_MAX.
2942 * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
2943 instead of uintptr_t.
2944 * src/shred.c (UINT_MAX_32_BITS): Remove.
2945 (word32): Remove. All uses changed to uint32_t.
2946 (isaac_seed_data): Remove unnecessary cast.
2947 * src/system.h (ptr_align): Use size_t; in practice, this is just as
2948 good as uintptr_t in checking for alignments, and has fewer
2949 configuration hassles.
2951 * src/Makefile.am (localedir.h): Make it readonly; this
2952 undoes part of the 2004-07-27 patch.
2954 2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
2956 * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
2957 (IS_THOUSANDS_SEP): Use bool when appropriate.
2958 (numcompare, main): Use char, not int, when the value is always a char.
2959 (numcompare): Remove "register"; compilers are smart enough these days.
2960 * src/system.h (errno, CHAR_BIT): Remove decls;
2961 no longer needed now we assume C89 or better.
2962 Include <inttypes.h> before <stdint.h>, as it's the
2963 Autoconf-recommended pattern.
2964 (to_uchar): New inline function, moved here from tr.c.
2965 Use full names for int types, e.g. "long int" rather than "long".
2966 * src/tr.c (to_uchar): Remove; now in system.h.
2967 (is_char_class_member): Use bool when appropriate.
2969 * src/mkdir.c (create_parents, main): Use bool when appropriate.
2970 (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
2972 2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
2974 * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
2976 * src/chmod.c (recurse, force_silent, process_file, process_files,
2977 main): Use bool when appropriate.
2978 * src/cksum.c (cksum, main): Likewise.
2979 * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
2980 compare_files, main): Likewise.
2982 * src/copy.h (struct cp_options): Likewise.
2983 * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
2984 same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
2985 * src/cp-hash.h (remember_created): Likewise.
2986 * src/cp-hash.c (remember_created): Likewise.
2987 * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
2988 re_protect, make_path_private, target_directory_operand, do_copy,
2989 cp_option_init, decode_preserve_arg, main): Likewise.
2990 * src/install.c (isdir, change_timestamps, change_attributes,
2991 copy_file, install_file_to_path, install_file_in_dir,
2992 install_file_in_file, strip_files, dir_arg, cp_option_init, main,
2993 change_attributes, change_timestamps): Likewise.
2994 * src/mv.c (remove_trailing_slashes, rm_option_init,
2995 cp_option_init, do_move, movefile, main): Likewise.
2996 * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
2997 AD_push, prompt, remove_dir): Likewise.
2998 * src/rm.c (rm_option_init, main): Likewise.
3000 * src/remove.c (top_dir, pop_dir, full_filename_):
3001 Use size_t for sizes.
3002 * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
3003 succeeds. It's not necessary in that case, as *NEW_DST is always
3005 (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
3006 (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
3007 * src/rm.c (main): Likewise.
3009 md5sum, sha1sum integer cleanups.
3011 * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
3013 (ALG_UNSPECIFIED): Remove.
3014 (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
3015 * src/md5.c: Don't include any files other than checksum.h.
3016 * src/sha1sum.c: Likewise.
3017 * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
3018 bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
3019 Use bool when appropriate.
3020 (digest_check): Increase limit of number of input lines to
3021 UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
3022 Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
3024 2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
3026 * src/cat.c (exit_status): Remove. Now done by passing a boolean
3028 (simple_cat, cat): Return true if successful. All callers changed.
3029 (simple_cat, cat, main): Use bool for booleans.
3030 (simple_cat): Use size_t for sizes.
3031 (cat, main): Use the same names for parameters that we use for
3032 long options, to avoid confusion. This inverts the sense of the
3033 show_tabs (formerly output_tabs) and number_nonblank
3034 (formerly numbers_at_empty_lines) variables.
3035 (main): Don't mess up (due to integer overflow) if we are given
3036 INT_MAX - INT_MIN + 1 options.
3037 [O_BINARY]: Don't invoke isatty unless the other options require it.
3038 (main): When deciding whether to use simple_cat, don't worry
3039 about binary option; it's irrelevant.
3041 * src/dcgen: Remove comments, trailing white space, and empty
3042 lines from the output strings, to save space.
3043 Use a narrower type like 'unsigned char' for line lengths, if
3045 Make the output variables static, not extern.
3047 * src/chgrp.c (parse_group): Require base 10 when parsing
3049 (main): int -> bool when appropriate.
3050 * src/chown.c (main): Likewise.
3051 * src/chown-core.c: Include inttostr.h.
3052 (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3053 (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3054 instead of uint_to_string).
3055 (describe_change): Instead of an int flag, use a char *
3056 auxiliary; this avoids the need for casts.
3057 Assume free (NULL) works.
3058 (change_file_owner): Return true/false, not 0/-1, since
3059 we don't set errno. All callers changed.
3060 Use bool when appropriate.
3061 (chown_files): Likewise.
3062 * src/chown-core.h (chown_files): Likewise.
3064 * tests/chown/basic: Test for proper handling of uids like
3065 "010", which must be parsed as decimal.
3067 * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3068 pwd when there are multiple names for the working directory
3069 (which can happen with an automounter, sigh).
3071 * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3072 this causes Solaris 8 'make' to refuse to build "groups".
3073 (localedir.h): Don't depend on Makefile: this causes Solaris
3074 8 'make' to build localedir.h unnecessarily. The dependence
3075 on Makefile is ineffective anyway, since $(localedir) might
3076 change even if Makefile hasn't.
3078 * src/remove.c (remove_dir): If we can't save the state of the
3079 working directory, pretend we started from "/", not ".".
3080 This avoids a bug on hosts like Solaris that don't let you
3081 remove the working directory.
3083 2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
3085 * src/printf.c (strtiomax, strtoumax): Declare if not already
3086 declared: this fixes a portability bug with Solaris 8 + GCC.
3087 (STRTOX): Parenthesize use of macro arg as expression.
3088 (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3090 * configure.ac: Check for declaration of strtoumax, for
3093 * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3094 pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3096 * tests/readlink/can-e: Don't assume that we can remove the
3097 working directory: this isn't possible under Solaris 8, say.
3098 * tests/readlink/can-f: Likewise.
3099 * tests/readlink/can-m: Likewise.
3101 * src/copy.c (copy_internal): find_backup_file_name no longer
3102 returns NULL, so don't bother to check for this.
3103 * src/cp.c (do_copy): Likewise.
3104 * src/ln.c (do_link): Likewise.
3106 2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
3108 * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3110 (NZERO): New macro, if system doesn't define it already.
3111 (usage): Distinguish priorities from nice values.
3112 Don't assume NZERO is 20.
3113 (main): Use bool instead of int where appropriate.
3114 If user specifies an adjustment out of range, always truncate it
3115 to an inrange value instead of sometimes giving an error message
3117 Do not assume that -1 is an error return from "nice" or
3118 "getpriority", as it might be the current nice value minus NZERO.
3119 If nice/setpriority fails with errno == EPERM, go ahead and run
3120 the command anyway; POSIX requires this.
3122 * src/pathchk.c: Include euidaccess.h.
3123 (dir_ok): Use euidaccess, not access.
3124 * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3125 (eaccess): Remove. All users changed to use euidaccess instead.
3127 2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
3129 * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3130 Don't assume ut_line is null-terminated.
3131 * src/who.c (print_line): New arguments USERLEN and LINELEN,
3132 since USER and LINE might not be null terminated. All callers
3135 2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
3137 Fix bug with "tail -f" reported by Rob Holland in
3138 <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3139 Also, remove the undocumented and unsupported-since-2000
3140 --max-consecutive-size-changes options. Fix another related bug:
3141 "tail" got confused if stdin, stdout, or stderr were closed.
3142 Also, use output buffering even with "tail -f".
3144 * NEWS: Document this, plus yesterday's patch.
3145 * doc/coreutils.texi (tail invocation): "size has remained the same"
3146 -> "file has not changed", which is more accurate for fifos.
3147 * src/tail.c: Include fcntl-safer.h.
3148 (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3149 (COPY_A_BUFFER): New macro.
3150 (struct File_spec): New members mtime, mode, blocking.
3151 Remove member n_consecutive_size_changes.
3152 (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3153 max_n_consecutive_size_changes_between_opens,
3154 MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3155 (long_options, tail_forever, parse_options):
3156 Remove (non-)support for --max-consecutive-size-changes.
3157 (record_open_fd): New function.
3158 (recheck, tail_file): Use it. Don't assume that stdin is open.
3159 (dump_remainder): Add support for new COPY_A_BUFFER special value.
3160 Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3161 (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3163 (n_live_files): Remove, replacing with...
3164 (any_live_files): New function. All uses changed.
3165 (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3166 is safe; this avoids some hangs when reading from a fifo.
3167 Avoid invoking fstat or sleep when using blocking I/O.
3168 Do not check for changes to size if the file is not a regular file,
3169 as the size is undefined in that case.
3170 Check for changes to mtime or mode, too; this works for non-regular
3172 (tail_forever, main): Redo fflush strategy to work even when input
3173 is nonblocking. Don't use unbuffered output; just flush when needed.
3175 2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
3177 * src/tail.c (main): Ignore -f if no file operand is specified
3178 and standard input is a pipe.
3179 * doc/coreutils.texi (tail invocation): Do not ignore -f for
3180 all pipes, just for when standard input is a pipe and no
3181 file operand is specified.
3182 * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3183 Add a new commented-out f-2 test, which we still fail.
3184 (test_vector): All f-* tests are special cases, not just f-1.
3186 2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
3188 * src/uptime.c: Include c-strtod.h.
3189 (print_uptime): Use c_strtod instead of setlocale and sscanf.
3190 Use long int rather than int to count days (for 64-bit hosts),
3191 and check for arithmetic overflow when converting double to time_t.
3193 2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
3195 * src/printf.c (vstrtold): Renamed from vstrtod.
3196 Now returns long double. All uses changed.
3197 (print_direc): Use "L" length modifier when printing floating point
3198 numbers, since we're now printing long double.
3200 2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
3202 printf cleanup, to avoid undefined behavior, to add support for
3203 formats that Bash supports, and to support wide integers like
3206 * NEWS: Document this.
3207 * src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
3208 booleans, so that we don't reserve any values for precision or
3210 (STRTOX): Use prototype, not K&R-style definition.
3211 (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3212 in ../lib), with type change to intmax_t.
3214 (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3216 (vstrtod): Renamed from xstrtod. All uses changed.
3217 (print_direc): Use boolean arg instead of special value to indicate
3218 a missing precision or width. LENGTH no longer includes
3219 length modifiers or conversion character. New arg CONVERSION
3220 now specifies conversion character.
3221 Use intmax_t-width formatting for integers (like Bash).
3222 Add support for C99 %a, %A, %F (like Bash).
3223 Add support for field width with %c (POSIX requires this).
3224 Add a FIXME for lack of support for field width and precision
3226 Add support for '\'', '0' flags.
3227 Check for invalid combinations of flags, field width, precision,
3228 and conversion, to prevent use of undefined behavior.
3229 Allow multiple length modifiers, for formats like "%lld" (like Bash).
3230 Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3231 In error message, output entire invalid conversion specification,
3232 instead of merely outputting % followed by the conversion char.
3233 * tests/misc/printf: Add tests for the above.
3235 2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
3237 Change "readlink -f" to be more compatible with prior implementations.
3238 Add more canonicalize options, -e and -m.
3239 Add comprehensive tests for all readlink modes.
3241 * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3242 Do not add canonicalize.c here.
3244 * src/readlink.c (longopts): Add new options.
3245 (usage): Document them.
3246 (canonicalize_fname): New proxy function.
3247 (main): Handle new options.
3248 * doc/coreutils.texi (readlink invocation): Document new
3249 "readlink -f" behaviour and new canonicalize options, -e and -m.
3251 * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3252 * tests/Makefile.am (SUBDIRS): Add readlink.
3253 * tests/readlink/Makefile.am: New file.
3254 * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3255 * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3256 * tests/misc/readlink: Remove file.
3258 2004-07-04 Jim Meyering <jim@meyering.net>
3260 * src/copy.c (copy_internal): Add a FIXME comment.
3262 2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
3264 * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3265 * src/cp.c (do_copy): Likewise.
3266 * src/mv.c (movefile): Likewise.
3268 * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3269 to avoid problem when path_concat dir name is longer than 2 GiB (!).
3271 * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3272 This cleans up the semantics a bit, as we no longer try to open the
3275 2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
3277 * NEWS: Add short names -t and -T for --target-directory
3278 and --no-target-directory options, respectively.
3280 * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3281 Remove. All uses changed to 'T' and 't', respectively.
3282 * src/install.c, src/ln.c, src/mv.c: Likewise.
3284 * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3285 aliases for --target-directory and --no-target-directory,
3287 * src/install.c (long_options, main, usage): Likewise.
3288 * src/ln.c, src/mv.c: Likewise.
3290 2004-07-01 Jim Meyering <jim@meyering.net>
3292 * Makefile.maint (sc_file_system): New target.
3293 (syntax-check-rules): Add it.
3294 .x-sc_file_system: New file.
3295 * Makefile.am (EXTRA_DIST): Add it.
3297 * man/sync.x: Use "file system" rather than "filesystem".
3298 * man/stat.x, man/df.x: Likewise.
3300 2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
3302 * src/df.c (usage, main): Output "file system" rather than
3304 * src/du.c (usage): Likewise.
3305 * src/shred.c (usage): Likewise.
3306 * src/stat.c (usage): Likewise.
3307 * src/stat.c (long_options, usage): Rename "--filesystem" to
3308 "--file-system". But keep the old name around, for compatibility
3311 2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
3313 Add support for --no-target-directory option.
3315 * NEWS: Document it.
3316 * doc/coreutils.texi (Common options, Target directory, cp
3317 invocation, install invocation, mv invocation, ln invocation):
3319 (link invocation): Explain how to rewrite link using ln now
3320 that we have --no-target-directory.
3321 (ln invocation): Explain that --no-target-directory subsumes
3323 (unlink invocation): Modify wording to match new wording in
3326 * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3327 (long_opts, usage, do_copy, main): Add support for
3328 --no-target-directory,
3329 * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3331 * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3333 * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3335 * src/mv.c (enum): Sort values.
3337 2004-06-29 Jim Meyering <jim@meyering.net>
3339 Don't let verbose-mode output from a subshell obscure actual differences.
3340 * tests/rm/inaccessible: Turn off command-echoing just before
3341 invoking subshell, then turn it back on if VERBOSE=yes afterward.
3343 2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
3345 Add support for 'install --target-directory', an option
3346 that has been documented for years but not implemented (!).
3347 * doc/coreutils.texi (install invocation): Document
3348 --target-directory in synopsis, too.
3349 * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3350 (long_options, main, usage): Add --target-directory.
3351 (target_directory_operand): New function, stolen from mv.c.
3352 (main): Use it. Check for -d and --target-directory.
3353 Alter wording of diagnostics to match other programs.
3355 2004-06-28 Jim Meyering <jim@meyering.net>
3357 * src/cp.c (usage): Fix copy+paste error in description of
3358 --target-directory: s/move/copy/. From Paul Jarc.
3360 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
3362 Use more-consistent rules among cp, ln, and mv when dealing with
3363 last operands that are (or look like) directories.
3365 * src/cp.c (target_directory_operand): New, nearly-common function,
3366 It reports an error if the destination appears to be a directory
3367 (e.g., because it has a trailing slash) but is not.
3368 * src/ln.c, src/mv.c: Likewise.
3369 * src/cp.c (do_copy): Use it.
3370 * src/ln.c (main): Likewise.
3371 * src/mv.c (main): Likewise.
3373 * src/cp.c (do_copy): Don't assume argc is positive.
3374 Don't bother to lstat dest, since copy() will do that for us.
3375 Use "const" to avoid the need for cast.
3377 * src/cp.c (do_copy): Don't output a usage message because of file
3378 problems (e.g., an operand is not a directory). Use it only for
3379 syntax. Standardize on "target %s is not a directory" for the
3381 * src/ln.c (main): Likewise.
3382 * src/mv.c (main): Likewise.
3384 * src/cp.c (do_copy): Remove test for trailing slash, since
3385 target_directory_operand now does this.
3386 * src/ln.c (main): Likewise.
3387 * src/mv.c (movefile): Likewise.
3389 * src/cp.c (main): Reject multiple target directories.
3390 Check whether a specified target is a directory when parsing the
3391 options, using stat. This gives more-accurate diagnostics.
3392 * src/ln.c (main): Likewise.
3394 * src/ln.c (isdir): Remove decl; no longer needed.
3395 * src/mv.c (isdir, lstat): Likewise.
3397 * src/ln.c (do_link): New arg dest_is_dir. All uses changed.
3398 Don't check the destination ourself; rely on dest_is_dir.
3399 This way we can avoid lstatting the destination in the
3400 usual case, and in the worst case we lstat 1, not 3 times.
3401 Don't bother to unlink unless link failed; this saves a syscall.
3402 Remove unnecessary backup_succeeded flag;
3403 it was identical to "dest_backup != NULL".
3405 * src/ln.c (main): Use int to count to argc, not unsigned int.
3406 This handles negative operand counts.
3407 * src/mv.c (main): Likewise.
3409 * src/mv.c (do_move): Don't call hash_init; expect the caller to
3410 do it, for consistency with cp.c and ln.c. All callers changed.
3411 (movefile): dest_is_dir parameter is now bool, not int.
3412 (main): Standardize on "missing destination file operand after %s"
3413 for the diagnostic, for consistency with cp.c.
3415 * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3416 will complain about the arg count.
3417 Adjust to new (briefer) diagnostics.
3418 * tests/cp/fail-perm: Add a test to verify that we get the new
3419 diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3421 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
3423 Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3424 d/" incorrectly created a link d/x/x. It also saves some system
3427 * NEWS: Document the fix.
3429 * src/ln.c (main): Don't append basename to dest if this
3430 results in an existing directory name.
3431 * tests/ln/misc: See whether a trailing slash is followed too far.
3433 2004-06-26 Jim Meyering <jim@meyering.net>
3435 * src/printf.c (main): When given no arguments, print the standard
3436 "missing operand\nTry printf --help..." message -- to be consistent.
3438 2004-06-26 Jim Meyering <jim@meyering.net>
3440 * src/mknod.c (main): Add \n at the end of message output via fprintf.
3442 2004-06-25 Jim Meyering <jim@meyering.net>
3444 * tests/ln/misc: Add test for ln subscript error.
3446 2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
3448 * src/ln.c (do_link): Remove unnecessary call to lstat.
3449 (main): Avoid subscript error when the destination is "".
3451 2004-06-23 Jim Meyering <jim@meyering.net>
3453 * tests/*: Replace all occurrences of `(exit N); exit' with
3454 `(exit N); exit N'. Otherwise, those many tests could exit with
3455 improper exit status when exiting via e.g., a trapped interrupt.
3456 Thanks to a report from Bob Proulx.
3458 2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
3460 * src/who.c (idle_string, print_user): New arg boottime,
3461 specifying the most recent boot time. All uses changed.
3462 (idle_string) Consider a line to be "old" if it hasn't been used
3463 since the last boot time. Watch out for overflow when computing
3464 times, and for times in the future.
3465 (idle_string): Record latest boot time.
3467 2004-06-22 Jim Meyering <jim@meyering.net>
3469 * src/test.c (usage): Correct description of `-t FD'. The file
3470 descriptor, FD, is no longer optional. Reported by Ton Nijkes.
3472 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
3474 The 2004-06-19 fix for who and pinky was incomplete, as ctime
3475 has undefined behavior if the year precedes -999 or follows 9999.
3476 Since we have to stop using ctime anyway, we might as well use
3477 strftime and fix the FIXME, and support internationalized dates.
3479 * NEWS: Document the new behavior.
3480 * src/who.c: Include "hard-locale.h".
3481 (time_format, time_format_width): New vars.
3482 (time_string, print_line): Use them.
3484 (time_string): Use localtime + strftime instead of
3485 ctime, to avoid problems with years before -999 or after 9999.
3486 * src/pinky.c: Likewise.
3488 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
3490 Fix bug: GNU 'ls' didn't count columns correctly if user or group
3491 names contained multibyte characters where the column count
3492 differed from the byte count. This patch also corrects
3495 * src/ls.c (format_user_or_group): New function, which counts
3497 (format_user, format_group): Use it.
3498 (format_user_or_group_width): New function, which counts columns
3500 (format_user_width, format_group_width): Use it.
3502 2004-06-21 Jim Meyering <jim@meyering.net>
3504 * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3505 Suggestion from Andreas Schwab.
3507 * tests/priv-check: When running as root, be sure to propagate
3508 PATH through to the process we exec as non-root.
3509 Reported by michael@aplatform.com.
3511 * src/mknod.c (main): Don't segfault when calculating the
3512 expected number of operands for `mknod NAME'.
3514 2004-06-20 Jim Meyering <jim@meyering.net>
3516 * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3518 2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
3520 * src/basename.c (main):
3521 Standardize on the diagnostics given when someone gives
3522 too few operands ("missing operand after `xxx'") or
3523 too many operands ("extra operand `xxx'").
3524 Include "quote.h" and/or "error.h" if it wasn't already being included.
3525 * src/chgrp.c (main): Likewise.
3526 * src/chmod.c (main): Likewise.
3527 * src/chown.c (main): Likewise.
3528 * src/chroot.c (main): Likewise.
3529 * src/comm.c (main): Likewise.
3530 * src/cp.c (do_copy): Likewise.
3531 * src/csplit.c (main): Likewise.
3532 * src/date.c (main): Likewise.
3533 * src/dircolors.c (main): Likewise.
3534 * src/dirname.c (main): Likewise.
3535 * src/du.c (main): Likewise.
3536 * src/expr.c (main): Likewise.
3537 * src/hostid.c (main): Likewise.
3538 * src/hostname.c (main): Likewise.
3539 * src/id.c (main): Likewise.
3540 * src/install.c (main): Likewise.
3541 * src/join.c (add_file_name, main): Likewise.
3542 * src/link.c (main): Likewise.
3543 * src/ln.c (main): Likewise.
3544 * src/logname.c (main): Likewise.
3545 * src/md5sum.c (main): Likewise.
3546 * src/mkdir.c (main): Likewise.
3547 * src/mkfifo.c (main): Likewise.
3548 * src/mknod.c (main): Likewise.
3549 * src/mv.c (main): Likewise.
3550 * src/nohup.c (main): Likewise.
3551 * src/od.c (main): Likewise.
3552 * src/pathchk.c (main): Likewise.
3553 * src/ptx.c (main): Likewise.
3554 * src/readlink.c (main): Likewise.
3555 * src/rm.c (main): Likewise.
3556 * src/rmdir.c (main): Likewise.
3557 * src/seq.c (main): Likewise.
3558 * src/setuidgid.c (main): Likewise.
3559 * src/shred.c (main): Likewise.
3560 * src/sleep.c (main): Likewise.
3561 * src/sort.c (main): Likewise.
3562 * src/split.c (main): Likewise.
3563 * src/stat.c (main): Likewise.
3564 * src/test.c (beyond, main): Likewise.
3565 * src/touch.c (main): Likewise.
3566 * src/tr.c (main): Likewise.
3567 * src/tsort.c (main): Likewise.
3568 * src/tty.c (main): Likewise.
3569 * src/uname.c (main): Likewise.
3570 * src/uniq.c (main): Likewise.
3571 * src/unlink.c (main): Likewise.
3572 * src/uptime.c (main): Likewise.
3573 * src/users.c (main): Likewise.
3574 * src/who.c (main): Likewise.
3575 * src/whoami.c (main): Likewise.
3577 * tests/basename/basic: Adjust to new diagnostics.
3578 * tests/du/files0-from: Likewise.
3579 * tests/expr/basic: Likewise.
3580 * tests/mv/diag: Likewise.
3581 * tests/tsort/basic-1: Likewise.
3583 2004-06-20 Jim Meyering <jim@meyering.net>
3585 * src/ln.c: Remove declaration of yesno.
3586 Instead, include yesno.h.
3587 * src/copy.c: Likewise.
3589 * src/remove.c: Remove declaration of yesno.
3590 Instead, include yesno.h.
3591 (top_dir): Remove now-unnecessary cast of obstack_base.
3592 (pop_dir): Likewise.
3593 (full_filename_): Likewise.
3595 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
3597 Don't dump core if ctime returns NULL; this is possible on
3598 hosts with 64-bit time_t and 32-bit int.
3599 * src/who.c: Include "inttostr.h".
3600 (time_string): If ctime fails, print the raw time as an integer
3601 instead of dumping core.
3602 * src/pinky.c: Likewise, as follows:
3603 Include "inttostr.h".
3604 (time_string): New function, copied from who.c.
3605 (print_entry): Use it.
3607 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
3609 * src/who.c (print_line): Don't truncate user names at 8 bytes.
3610 Problem reported by Guido Leenders in:
3611 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3612 * NEWS: document this.
3614 2004-06-19 Jim Meyering <jim@meyering.net>
3616 * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3617 using GNU_PACKAGE (from PACKAGE) once again. This restores
3618 `GNU' to the parenthesized package name in --version output.
3619 Before, the first argument from AC_INIT, `GNU coreutils', would
3620 be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
3621 Reported by Richard Stallman.
3623 2004-06-17 Jim Meyering <jim@meyering.net>
3625 * src/tr.c (to_uchar): Rename function from `uchar'. The latter
3626 would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
3628 2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
3630 * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3631 allows the GNU behavior. "--" is now supported by chroot, hostid,
3632 hosname, pwd, sync, yes.
3633 * doc/coreutils.texi (yes invocation, false invocation,
3634 true invocation): Document this.
3635 * src/chroot.c (main): Handle "--".
3636 * src/hostid.c (main): Likewise.
3637 * src/hostname.c (main): Likewise.
3638 * src/pwd.c (main): Likewise.
3639 * src/sync.c (main): Likewise.
3640 * src/yes.c (main): Likewise.
3641 * src/true.c (main): Recognize --help and --version even if
3642 POSIXLY_CORRECT is set.
3643 * src/yes.c (main): Likewise.
3645 2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
3647 * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3649 * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3650 * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3651 POSIXLY_CORRECT is set. POSIX reserves upper-case environment
3652 variables to the implementation, so it's OK for ls to depend on
3654 * src/pr.c: Include "hard-locale.h".
3655 (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3656 POSIX specifies the behavior only in the POSIX locale.
3657 * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3658 since POSIX says the behavior is unspecified here.
3659 * src/tail.c (parse_obsolescent_option): Support multiple file operands
3660 even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3661 * src/printf.c (main): Recognize --help, --version even if
3662 POSIXLY_CORRECT. POSIX does not specify any options, but it
3663 does not prohibit options either, so "printf" is like "expr" here.
3664 * src/unlink.c (main): Likewise.
3665 * tests/misc/printf: Adjust to the new semantics for \x if
3668 2004-06-14 Jim Meyering <jim@meyering.net>
3670 * tests/misc/pwd: New test, for fix of 2004-04-19.
3671 * tests/misc/Makefile.am (TESTS): Add pwd.
3672 (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3674 * src/copy.c: Remove declaration of euidaccess.
3675 Instead, include "euidaccess.h".
3677 2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
3679 * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3680 (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3681 as (sizeof "??") reliably returns 3.
3682 (print_line): Guard against idle and pid being too long
3683 (which is possible when printing headers).
3684 (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
3685 Avoid unnecessary cast of sizeof to int.
3686 (make_id_equals_comment): Do not assume that UT_ID returns
3687 a string; it might return a non-null-terminated array.
3688 Use strncat instead. It's not very often where strncat is
3689 exactly what you want, but this is one of those rare cases.
3691 2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
3693 * src/who.c (list_entries_who): Don't output a trailing space.
3695 2004-06-09 Jim Meyering <jim@meyering.net>
3697 * src/touch.c (usage): Improve wording in description of the
3698 --time=WORD option. Reported by Dan Jacobson.
3700 * src/chown-core.c (change_file_owner): Change names of parameters
3701 old_uid and old_gid to required_uid and required_gid respectively.
3703 * src/chmod.c (mode_changed): Return false, not 0, now that the
3704 function returns `bool'.
3706 2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
3708 Adjust chmod and chown to be similar if -c or -v are given. In
3709 particular, a no-op chown is no longer reported as a change; this
3710 reverts to previous behavior. Also, fix both commands so that -v
3711 report failures even if the failure is not due to the chmod or
3714 * src/chmod.c (CH_NOT_APPLIED): New constant.
3715 (describe_change): Handle it.
3716 (process_file): Use it, if a symlink wasn't changed.
3717 (mode_changed): Return bool, not int. Accept new argument
3718 NEW_MODE; all callers changed. This lets us avoid statting the
3719 file unless the new mode has unusual bits.
3720 (process_file): Return -1 on error. With -v, report all errors
3721 verbosely, not just some.
3723 * src/chown-core.c (change_file_owner): Return -1 on error, not
3724 1 sometimes and -1 on others. Our caller ORs together our results,
3725 and (-1 | 1) == 0 on ones-complement hosts.
3726 With -v report all errors verbosely, not just some.
3727 Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3728 file_stats wasn't set properly in that case.
3730 * tests/chgrp/basic: Adjust to above changes.
3732 2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
3734 * tests/chgrp/basic: Test that chgrp -h does not fail on
3735 symlinks, even on hosts where that's not supported.
3736 Test that if -R is specified without -H or L, -h is assumed.
3737 Test that chown() is not optimized away.
3739 2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
3741 Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3743 Check for incompatible options. When -R and --dereference are
3744 both used, then either -H or -L must also be used. When -R and -h
3745 are both used, then -P must be in effect.
3747 -H, -L, and -P have no effect unless -R is also specified.
3748 If -P and -R are both specified, -h is assumed.
3750 Do not optimize away the chown() system call when the file's owner
3751 and group already have the desired value. This optimization was
3752 incorrect, as it failed to updated the last-changed time and reset
3753 special permission bits, as POSIX requires.
3755 Do not report an error if the owner or group of a
3756 recursively-encountered symbolic link cannot be updated because
3757 the file system does not support it.
3759 * NEWS: Document the above.
3761 * src/chgrp.c (main): Check for incompatible options. -R --dereference
3762 requires either -H or -L, and -R -h requires -P. If -H, specify
3763 FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
3764 file as much like chown.c as possible.
3765 * src/chown.c (main): Likewise.
3767 * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3768 needed. Chown a directory only after chowning its children; this
3769 avoids problems if the new directory ownership doesn't permit
3770 access to the children. Dereference symlinks before doing
3771 ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3772 Do not optimize away the chown() system call when the file's owner
3773 and group already have the desired value. POSIX does not permit
3774 this optimization. Rely on chown and lchown to do the right
3775 thing with symlinks and/or -1 arguments, now that we have wrappers
3776 to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3777 errors, not just command-line errors.
3778 (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3780 * src/system.h (ENOTSUP): Remove.
3782 * tests/chgrp/basic: Use chown --from to discover whether the
3783 group changed, since chgrp now changes unconditionally. This
3784 complicates the sed script a bit. Do not specify --dereference,
3785 since it's the default (and we want to test this). Adjust output
3786 to match the fact that chgrp no longer optimizes the case of
3787 changing a file's group to the same value as before.
3788 * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3789 options are incompatible, and their behavior is undefined with POSIX.
3790 (changed, not_changed): Adjust to match the fact that -h is no longer
3791 specified. Sort names.
3792 * tests/chown/deref: Adjust error-diagnostic spelling to match new
3795 2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
3797 * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3798 prevented a diagnostic of any operands.
3800 2004-06-08 Jim Meyering <jim@meyering.net>
3802 * src/shred.c (direct_mode): Turn it on/off with directio, too.
3804 2004-06-07 Jim Meyering <jim@meyering.net>
3806 Enable direct-mode I/O (bypassing the buffer cache), if possible.
3807 Prompted by a suggestion from Kalle Olavi Niemitalo
3808 in http://bugs.debian.org/207035.
3809 * src/shred.c (direct_mode): New function.
3810 (do_wipefd): Turn on direct-mode I/O.
3811 (dopass): If a file's first write fails with EINVAL,
3812 turn off direct-mode I/O and retry the write.
3814 2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
3816 * src/tr.c (main): "tr -d a b" is now a fatal error even if
3817 POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
3820 2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
3822 * src/shred.c (dopass): Don't subtract 1 from the offset after
3823 a write error. Problem reported by Jon Peatfield in:
3824 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3826 2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
3828 Fix bug reported by Buciuman Adrian in
3829 <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3830 where 'dd' created a file that was too large. The bug was that dd
3831 assumed that the input file offset does not advance after a failed
3832 read; but POSIX says that the input file offset is undefined after
3835 * src/dd.c (MAX_BLOCKSIZE): New macro.
3836 (input_seekable, input_seek_errno, input_offset,
3837 input_offset_overflow): New vars.
3838 (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
3839 (advance_input_offset): New function.
3840 (skip_via_lseek): Set errno to zero when reporting our failure,
3841 so that we don't report based on garbage errno.
3842 (skip): If fdesc is standard input, advance the input offset.
3843 Do not quit if reading, and if noerror was specified;
3844 POSIX seems to require this.
3845 If read fails on output file, report the earlier lseek failure
3846 instead; this fixes a FIXME in dd_copy.
3847 (advance_input_after_read_error): New function.
3848 (dd_copy): Use it, instead of assuming that failed reads
3849 do not advance the file pointer. Advance input offset
3850 after nonfailed reads. Advance only a partial block if
3851 the previous read (before the failed read) succeeded, and
3852 do not generate an output block of zeros in this case.
3853 (main): Determine initial input offset, seekability of input,
3854 and error if it wasn't seekable.
3856 2004-06-02 Jim Meyering <jim@meyering.net>
3858 rm (without -f) could hang unnecessarily when attempting to
3859 remove a symlink to a file on an off-line NFS-mounted partition.
3860 Reported by David Howells in https://bugzilla.redhat.com/124699.
3861 * src/remove.c (write_protected_non_symlink): New function.
3862 Don't invoke euidaccess on symlinks.
3863 (prompt): Use write_protected_non_symlink rather than using
3864 euidaccess directly, being careful not to call lstat twice for a file.
3866 Fix a bug in how the --output-delimiter=D option works with
3867 abutting byte or character ranges. Reported by David Krider in
3868 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
3869 * src/cut.c (print_kth): Remove special case for open-ended range.
3870 (set_fields): Record the range start index for an interval even
3871 when it abuts another interval on its low side.
3872 Also record the range start index of the longest right-open-interval.
3873 * tests/cut/Test.pm: Add tests of --output-delimiter=S with
3874 abutting and overlapping byte ranges.
3876 2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
3878 Some POSIX-conformance cleanups for tr.
3880 * src/tr.c (posix_pedantic): Remove; no longer needed since
3881 we need to test this in just one place now.
3882 (usage): Mention -C.
3883 (unquote): Note that \055, \n, etc are escaped.
3884 Do not worry about POSIXLY_CORRECT when warning about ambiguous
3886 \ at end of string stands for itself.
3887 Do not diagnose invalid backslash escapes: POSIX says the behavior
3888 is unspecified in this case, so we don't need to diagnose it.
3889 (main): Add support for -C (currently an alias for -c).
3890 Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
3892 * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
3893 Fix comment for range-a-a.
3895 2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
3897 Improve the efficiency (and in one case, correctness) of code
3898 that reads symlinks.
3900 * src/copy.c (copy_internal): Don't use alloca, as it can mess up
3901 royally if the link length is long (e.g., GNU/Hurd). Use
3902 xreadlink instead, it's safer. Don't bother to read the link if
3903 it's the wrong size. Add a FIXME because this area is a bit murky
3905 * src/ls.c (get_link_name): Update use of xreadlink.
3906 * src/readlink.c (main): Likewise.
3907 * src/stat.c (print_stat): Likewise.
3909 2004-06-01 Jim Meyering <jim@meyering.net>
3911 * src/env.c (main): Prefer the notation `STREQ (a, b)'
3912 over `!strcmp (a, b)'.
3913 * src/sort.c (main, sort_buffer_size): Prefer the notation
3914 `STREQ (a, b)' over `strcmp (a, b) == 0'.
3915 * src/date.c (batch_convert): Likewise.
3916 * src/expr.c (nextarg): Likewise.
3917 * src/su.c (correct_password, restricted_shell, main): Likewise.
3918 * src/ptx.c (swallow_file_in_memory, main): Likewise.
3919 * src/test.c (binary_operator, and, or, main): Likewise.
3921 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
3923 * NEWS: echo compatibility cleanup.
3924 * doc/coreutils.texi (echo invocation): Document the changes.
3925 * src/echo.c (V9_ECHO): Remove; always enabled.
3926 (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
3927 we use the same naming convention as bash. Now an enum,
3929 (usage): Reword to mention -e/-E more accurately.
3930 Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
3931 (hextobin): New function.
3932 (main): Use bool rather than int for local vars when appropriate.
3933 Do not allow options if POSIXLY_CORRECT, unless we are using
3934 BSD semantics and the first argument is "-n".
3935 Don't pass unnecessary extra arg to parse_long_options.
3936 do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
3937 Do not look for options if !allow_options.
3938 Use size_t rather than int when appropriate.
3939 Open-code option test rather than using strrchr.
3940 Use faster test for "-".
3941 Avoid redundant argc test.
3942 Add support for \x, for Bash compatibility.
3943 Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
3944 When '\c' is encountered, stop printing immediately, as POSIX
3946 Add support for \xhh syntax.
3947 Add support for \0ooo syntax; POSIX requires this.
3949 2004-06-01 Jim Meyering <jim@meyering.net>
3951 * Use automake-1.8b. Regenerate dependent files.
3953 2004-05-31 Jim Meyering <jim@meyering.net>
3955 * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
3956 the build src/ directory -- at the front.
3957 ($(srcdir)/$x-tests): Depend on Makefile.am.
3958 Use $x as the program name, except when it would be `test' (test is
3959 the sole program tested via mk-script that is also a shell built-in).
3960 In that case, use the old ../../src/$x.
3962 2004-05-30 Jim Meyering <jim@meyering.net>
3964 Work around HPUX /bin/cc compiler bug that is exposed, now that
3965 sets are arrays of type `bool'. More details here:
3966 http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
3967 FIXME: verify that the above URL points to the right message
3969 * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
3970 rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
3971 (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
3972 system, those two expressions are not the same (256 vs. 1024).
3973 The effect of this problem was that `tr -c x y' would fail:
3974 tr: when not truncating set1, string2 must be non-empty
3975 (set_initialize): Remove unnecessary initialization of the `in_set'
3976 buffer; that initialization triggered the same compiler bug as above.
3978 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
3980 tr cleanup, mostly having to do with integer type ranges.
3983 * tests/tr/Test.pm: Add a few tests for the below. Alas, most of
3984 the test cases wouldn't be portable, or would take too much CPU
3987 * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
3988 This is safe since the code already assumes N_CHARS fits in int.
3989 (Filter): Remove: we want to prototype everything.
3990 (ORD, CHR): Remove. All uses removed. Some replaced with:
3991 (uchar): New function. All places where a char must be converted
3992 to an unsigned char are now done this way, not by ad-hoc methods.
3993 (count): New type. Use it whenever counts or states are needed.
3994 (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
3995 since we used it in an unsigned int context) to UINTMAX_MAX - 1.
3996 (REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
3997 whenever appropriate.
3998 (NOT_A_CHAR): Remove global macro; now a local enum.
3999 (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
4000 the rest of the code no longer depends on them.
4001 (class_ok): Remove; all uses changed to use inline comparisons.
4002 (RE_NO_TYPE): Remove; wasn't used or needed.
4003 (struct List_element): normal_char and equiv_code are now unsigned
4005 first_char, last_char, and the_repeated_char are now unsigned char,
4006 not unsigned int. repeat_count is now count, not size_t.
4008 (struct Spec_list): state is now count, not unsigned int.
4009 lengthis now count, not size_t.
4010 n_indefinite_repeats is now size_t, not int.
4011 has_equiv_class, has_char_class, and has_restricted_char_class
4012 are now bool, not int. All uses changed.
4013 (struct E_string): s is now char *, not unsigned char *.
4014 escaped is now bool *, not int *. All uses changed.
4015 (ES_MATCH): Remove macro, replacing with:
4016 (es_match): New inline function. All uses changed.
4017 (squeeze_repeats, complement, posix_pedantic, truncate_set1,
4018 translating): Now bool, not int.
4019 (io_buf): Now char array, not unsigned char.
4020 (SET_TYPE): Remove. All uses replaced with bool.
4021 (is_equiv_class_member, unquote, append_range, append_char_class,
4022 append_equiv_class, find_closing_delim, star_digits_closebracket,
4023 build_spec_list, parse_str, homogeneous_spec_list):
4024 Now returns bool, not int. All uses changed.
4025 (is_equiv_class_member): Now inline.
4026 (is_equiv_class_member, is_char_class_member, make_printable_str,
4027 append_normal_char, append_range, append_repeated_char,
4029 Args are now of proper integer type.
4030 (unquote, look_up_char_class, make_printable_str,
4031 append_equiv_class, build_spec_list, squeeze_filter):
4032 Avoid unsigned char *p; gently convert *p to unsigned char instead.
4033 (unquote, get_spec_stats): Do not jump past declarations and then
4034 use them; C doesn't allow this in portable programs.
4035 (make_printable_str): Check for overflow in size calculations.
4036 (xmemdup): Remove. All uses rewritten.
4037 (find_bracketed_repeat): Args are now of proper pointer-to-integer
4038 type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
4039 (find_bracketed_repeat, star_digits_closebracket): Check that the
4040 digits are not escaped.
4041 (build_spec_list): Don't bother to copy opnd_str; not needed.
4042 (build_spec_list, get_next): Simplify internal logic a bit.
4043 (card_of_complement): Fix bug due to char overflow.
4044 (get_spec_stats): Don't assume len fits into int.
4045 Check for integer overflow. Use abort() rather than assert(0).
4046 (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4048 (squeeze_filter): READER is never null now; simplify code.
4049 READER arg now has a simpler type. Remove unnecessary casts.
4050 (squeeze_filter, main): Calls to fwrite improperly checked result
4051 against zero, rather than against requested size.
4052 (plain_read): New function.
4053 (read_and_delete, read_and_xlate):
4054 Remove unused filter arg, and don't worry about hit_eof.
4055 Simplify by using plain_read.
4056 (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4057 (main): Always pass a non-null procedure to squeeze_filter.
4058 Rewrite so that class_ok isn't needed.
4060 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
4062 * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4063 fdatasync reports EBADF when syncing (unwritable) directories.
4064 Problem reported by Albert Chin-A-Young in:
4065 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4067 2004-05-29 Jim Meyering <jim@meyering.net>
4069 * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4070 Patch from Albert Chin.
4072 * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4074 * src/remove.c (push_dir): Merge declaration and adjacent assignment
4075 into a single statement.
4077 2004-05-28 Jim Meyering <jim@meyering.net>
4079 * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4081 2004-05-22 Jim Meyering <jim@meyering.net>
4083 rm -r would get a failed assertion when run from an inaccessible
4084 directory and with two or more command line arguments including an
4085 absolute-named directory followed by a relative-named directory.
4087 * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4088 * src/remove.c (struct cwd_state): Define.
4089 (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4090 can be detected by the caller. Instead of returning a malloc'd
4091 directory name, communicate it to caller via a new parameter, and
4092 return an indication of whether restore_cwd failed. Update caller.
4093 Eliminate an unnecessary call to AC_stack_top.
4094 (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4095 so we can now communicate to caller whether/how functions like
4096 restore_cwd have failed. Update caller.
4097 (rm_1): Fail if we've failed to restore the working directory
4098 and the name of the next file to remove is `.'-relative.
4099 (rm): Fail if the require_restore_cwd flag is true and we've
4100 failed to restore the working directory.
4101 * src/mv.c (rm_option_init): Initialize new member,
4102 x->require_restore_cwd.
4103 * src/rm.c (rm_option_init): Likewise.
4105 2004-05-21 Jim Meyering <jim@meyering.net>
4107 * tests/rm/inaccessible: New test for the above fix.
4108 * tests/rm/Makefile.am (TESTS): Add inaccessible.
4110 * src/remove.c (rm): Use free rather than XFREE.
4111 (remove_dir): Use xmalloc, not XMALLOC.
4112 (ds_init): Likewise.
4114 2004-05-20 Jim Meyering <jim@meyering.net>
4116 * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4117 diagnostics in shred.c have been fixed, don't exempt shred.c from
4120 * src/shred.c: Use translatable diagnostics, e.g.
4121 change "%s: remove" to _("%s: failed to remove") and
4122 change "%s: close" to _("%s: failed to close").
4124 2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
4126 * src/shred.c (names): Bring back lower-case letters, "_", and
4127 ".". But continue to omit +, =, %, @, #, as they're either
4128 shell metacharacters (for some shells) or are not in some
4129 character sets, or (in the case of '%') must be a
4130 metacharacter somewhere.
4132 2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
4134 * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4136 2004-05-17 Jim Meyering <jim@meyering.net>
4138 * src/shred.c (incname): Decrement `len' only once per loop iteration.
4140 chgrp and chown now dereference symlinks by default, per POSIX.
4141 Reported by Michal Politowski as http://bugs.debian.org/249177.
4143 * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4144 * src/chown.c (usage): Update to reflect this.
4145 * src/chgrp.c (usage): Likewise.
4146 * NEWS: Describe the change.
4147 Adapt tests accordingly.
4148 * tests/chgrp/basic: Use -h where necessary to retain semantics.
4149 * tests/chgrp/deref: Likewise.
4150 * tests/chgrp/posix-H: Likewise.
4152 2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
4154 In shred, check for errors from fdatasync more carefully. If
4155 fdatasync fails with errno==EINVAL, it means this implementation
4156 does not support synchronized I/O for this file. Do not report
4157 this as an error, as (for example) AIX 5.2 fdatasync reports it
4158 for raw disk devices. Problem reported by Albert Chin in
4159 <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4161 Check for write errors, though: the old code ignored them.
4162 Improve error checking in a few other cases, too (e.g., close of a
4165 Also, change several 'int' values to 'bool', so that the error
4166 checking is a bit clearer. Similarly, change unsigned values
4167 to size_t where appropriate.
4169 * src/shred.c: Include "dirname.h".
4170 (datasync) [!HAVE_FDATASYNC]: Remove.
4171 (dosync): New function.
4172 (dopass): Use it. Return 1 on write error, -1 on other error.
4173 All callers changed. Report write error if dosync does.
4174 (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4175 not int (0/-1). All callers changed. Return false if there's a
4177 (incname): Return bool (true/false), not int (0/1). Accept
4178 size_t length, not unsigned. All callers changed. Do not
4179 bother checking for non-digits; it can't happen. Replace
4180 recursion with iteration.
4181 (wipename): Use dir_name, base_name, etc. instead of assuming
4182 Unix file names. Use size_t for length, not unsigned.
4183 Report error if unlink or close fails.
4184 (wipename, main): Use bool for booleans.
4186 (names): Use only digits and uppercase letters, for greater
4189 2004-05-16 Jim Meyering <jim@meyering.net>
4191 * tests/chown/deref: New test for the yesterday's change.
4192 * tests/chown/Makefile.am (TESTS): Add deref.
4194 2004-05-15 Jim Meyering <jim@meyering.net>
4196 chown --dereference did nothing when the owner/group of a
4197 symlink matched the desired owner/group. Reported by David Malone.
4198 Also reported in 1999 as http://bugs.debian.org/39642.
4200 * src/chown-core.c (change_file_owner): When --dereference has
4201 been specified, and when processing a symlink, stat it to get the
4202 owner and group of the referent.
4204 2004-05-14 Jim Meyering <jim@meyering.net>
4206 * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4207 s/supercede/supersede/ reported by Andrew Fabbro.
4209 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
4211 Improve performance of `sort -m' on large files, at the cost of
4212 making some contrived examples unsafe. POSIX allows this
4213 optimization. Performance problem reported by Jonathan Baker in
4214 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4216 * src/sort.c (first_same_file): Do not treat input pipes
4217 differently from other files.
4218 * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4219 might write F before reading all the input.
4222 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
4224 * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4225 '\007', for portability to EBCDIC hosts.
4226 * src/printf.c (print_esc_char): Likewise.
4227 * src/tr.c (unquote, make_printable_str): Likewise.
4229 2004-05-12 Jim Meyering <jim@meyering.net>
4231 * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4232 where the result is used. This avoids one unnecessary lstat call
4233 per command line argument.
4235 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
4237 Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4239 * src/Makefile.am (all_programs.list): New rule, copied from
4240 man/Makefile.am and tests/Makefile.am, except that we use the
4241 system tr rather than ./tr and we don't use tr -s.
4242 * tests/Makefile.am (all_programs): Use it.
4243 * man/Makefile.am (all_programs): Likewise. Renamed from programs,
4244 for consistency. All uses changed.
4246 2004-05-11 Jim Meyering <jim@meyering.net>
4248 * tests/rm/unread3: New test, for the above fix and today's
4249 lib/save-cwd.c improvement.
4250 * tests/rm/Makefile.am (TESTS): Add unread3.
4252 * src/rm.c: Don't include "save-cwd.h". It's no longer used.
4254 2004-05-10 Jim Meyering <jim@meyering.net>
4256 * tests/install/trap: New file. Test for bug fix of 2004-04-18.
4257 * tests/install/Makefile.am (TESTS): Add trap.
4259 * src/remove.c (AD_push): Don't use errno in diagnostic about
4262 Remove these generated files from CVS.
4263 * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4264 * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4265 * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4266 * tests/tr/tr-tests, tests/wc/wc-tests:
4268 2004-05-09 Jim Meyering <jim@meyering.net>
4270 * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4271 a loop initializing the just-allocated memory to zero.
4273 2004-05-08 Jim Meyering <jim@meyering.net>
4275 * tests/rm/no-give-up: New file; check for today's fix.
4276 * tests/rm/Makefile.am (TESTS): Add no-give-up.
4278 2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
4280 Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4281 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4283 * src/remove.c (remove_entry): Check for errno values like ENOENT
4284 that show the file cannot be directory, instead of for errno
4285 values like EPERM that show the file might be a directory. This
4286 is necessary because, when a single unlink() call has multiple
4287 reasons to fail, it can set errno to any of those reasons; it's
4288 only the rare errno value like ENOENT that excludes all the other
4289 possible reasons to fail even when the file is a directory.
4290 (remove_cwd_entries): Don't attempt chdir if the file is known
4291 to not be a directory.
4292 (remove_dir): Use the same method that remove_cwd_entries uses
4293 (for some reason they differed). Don't assert that saved_errno
4294 must be EPERM; it might be just about anything.
4296 2004-05-06 Jim Meyering <jim@meyering.net>
4298 * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4299 Don't add `1' to the buffer size (it was to protect against malloc
4300 implementations that fail to allocate a buffer of size zero).
4301 That is no longer necessary, since we use a malloc wrapper
4304 * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4305 * src/head.c (elide_tail_bytes_pipe): Likewise.
4306 * src/df.c (main): Likewise.
4307 * src/shred.c (do_wipefd): Likewise.
4308 * src/users.c (list_entries_users): Likewise.
4309 * src/tail.c (main): Likewise.
4310 * src/md5sum.c (main): Likewise.
4312 2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
4314 * src/df.c (show_disk, show_point): If several filesystems are
4315 mounted on the same mount point, prefer the last one, not the first.
4316 Problem reported by Christian Jones in
4317 <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4318 (show_disk): Remove unused statp arg. Return bool, not int.
4319 (show_point): Rewrite to avoid gotos. Use the same algorithm
4320 for lofs and dummies for each pass through the mount table,
4321 rather than subtly different algorithms (which are probably
4324 2004-05-03 Jim Meyering <jim@meyering.net>
4326 * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4329 2004-05-01 Jim Meyering <jim@meyering.net>
4331 When chown or chgrp is modifying the referent of a symlink,
4332 use the chown(2) function, if possible.
4333 * src/chown-core.c (change_file_owner): Don't hard-code the
4334 open/fchown/close kludge here. Use `chown' instead.
4335 The chown function works just fine on conforming systems.
4336 Other systems now go through the new chown wrapper that
4337 resorts to the old kludge.
4339 * src/chown-core.c (change_file_owner): Add a comment.
4341 2004-04-27 Jim Meyering <jim@meyering.net>
4343 * src/ptx.c: Make over 40 global extern variables `static'.
4344 (syntax_table, re_syntax_table): Remove declarations of two unused
4345 variables (they were exposed by the above change).
4347 * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4348 * src/ln.c (backup_type): Likewise.
4350 * src/remove.c (rm): Add `extern' keyword.
4351 * src/cp-hash.c (forget_created, remember_created)
4352 (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4353 * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4354 * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4355 (uid_to_name, chown_files): Likewise.
4357 * src/Makefile.am (sc_tight_scope): New rule.
4358 * Makefile.maint (sc_tight_scope): New rule.
4359 (syntax-check-rules): Add it.
4361 2004-04-26 Jim Meyering <jim@meyering.net>
4363 * Use automake-1.8.4. Regenerate dependent files.
4365 * src/sort.c (limfield): Make a comment clearer.
4367 2004-04-25 Paul Eggert <eggert@twinsun.com>
4369 Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4370 leading blanks when computing the location of the field end;
4371 it is not supposed to skip trailing blanks. Solaris 8 "sort"
4372 does conform to POSIX. Also fix the documentation to clarify
4373 this and related issues.
4375 * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4376 that the options are in alphabetical order. Describe how -b works
4377 more-accurately; this involves fixing some examples, too. Mention
4378 what happens if the start field falls after an end field or after
4379 a line end. Warn about using -k without -b, -g, -M, -n, or -t.
4380 Add an example of how to sort IPv4 addresses and Apache Common
4381 Log Format dates. Remove a duplicate example.
4382 (Putting the tools together): Use separate options rather
4383 than agglomerating them.
4384 * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4385 decode whether to skip leading blanks.
4386 (trailing_blanks): Remove.
4387 (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4389 * tests/pr/Test.pm: Fix typo in env_default comment.
4390 * tests/sort/Test.pm: Likewise.
4391 (18c, 18d): Reverse the order of output lines, so that the
4392 test cases conform to POSIX.
4394 2004-04-22 Paul Eggert <eggert@twinsun.com>
4396 More signal-handling cleanup for ls.c. Do not allow signals to
4397 happen between arbitrary output bytes, as the
4398 restore-default-color sequence can bollix up multibyte chars or
4399 color-change sequences in the ordinary output. Instead, process
4400 signals only between printing a file name and changing the color
4401 back to non_filename_text color. That way, if the signal handler
4402 changes the color (to the default), 'ls' will change it back when
4403 'ls' continues (after being suspended).
4405 Also, do not bother with signal-handling unless stdout is a
4406 controlling terminal; this lets stdio buffer better when "ls
4407 --color" is piped or sent to a file.
4409 * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4410 Do not include "full-write.h"; no longer needed.
4411 (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4412 (put_indicator_direct): Remove. All callers changed to use
4414 (caught_signals, interrupt_signal, stop_signal_count): New vars.
4415 (restore_default_color): Don't bother checking for put_indicator
4417 (sighandler): Don't handle SIGTSTP; that's another handler now.
4418 Simply set interrupt_signal to the signal, then exit.
4419 (stophandler, process_signals): New functions.
4420 (main): Don't output any color changes until _after_ the signal
4421 handlers are set up. This fixes a race condition where 'ls'
4422 could be interrupted while initializing colors, and leaving the
4423 terminal in an undesirable state.
4424 Don't mess with signal-handling if standard output is not a
4425 controlling terminal.
4426 When exiting, restore the default color, then restore the
4427 default signal handling, then act on any signals that weren't
4429 Do not print //DIRED// etc. in colors; this avoids the need
4430 to catch signals when printing them.
4431 (print_name_with_quoting): Process signals just before switching
4432 color back to non_filename_text.
4434 2004-04-23 Jim Meyering <jim@meyering.net>
4436 Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4437 * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4438 of quotearg_buffer. Patch by Mikulas Patocka.
4440 2004-04-18 Paul Eggert <eggert@twinsun.com>
4442 tee ignored SIGPIPE, but POSIX doesn't allow this.
4444 * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4445 does not allow this. This undoes the 1996-10-24 patch.
4447 2004-04-18 Paul Eggert <eggert@twinsun.com>
4449 Signal-handling cleanup for coreutils. Here are the highlights:
4451 - csplit sometimes failed to remove files when interrupted.
4452 - csplit didn't clean up if two signals arrived nearly simultaneously.
4453 - install -s would infloop on System V if SIGCHLD was ignored.
4454 - ls could incorrectly restore color if multiple signals
4455 arrived nearly simultaneously.
4457 * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4459 (filename_space, prefix, suffix, digits, files_created, remove_files):
4461 (caught_signals): New var.
4462 (cleanup): Block signals while deleting all files.
4463 (cleanup_fatal, handle_line_error, regexp_error):
4464 Mark with ATTRIBUTE_NORETURN.
4465 (create_output_file, close_output_file, interrupt_handler):
4466 Block signals while changing the number of output files,
4467 to fix some race conditions.
4468 (delete_all_files): Do nothing if remove_files is zero.
4469 Clear files_created.
4470 (main): Don't mess with signals until after argument processing
4473 * src/csplit.c (main): Rewrite signal-catching code to make it
4474 similar to other coreutils programs. When processing signals,
4475 block all signals that we catch, but do not block signals that we
4476 don't catch. Avoid problems with unsigned int warnings.
4477 * src/ls.c (main): Likewise.
4478 * src/sort.c (main): Likewise.
4480 * src/csplit.c (interrupt_handler):
4481 Use void, not (obsolete) RETSIGTYPE.
4482 * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4484 * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4485 Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4486 * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4487 * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4488 * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4490 * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4492 * src/install.c: Include <signal.h>.
4493 (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4494 given, since System V fork+wait does not work if SIGCHLD is ignored.
4496 * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4497 handler to self, not to SIG_IGN, since SIGTSTP can be received
4499 (main): Use SA_RESTART, as that is simpler than checking for EINTR
4500 failures all over the place.
4502 2004-04-20 Jim Meyering <jim@meyering.net>
4504 * src/remove.c (is_empty_dir): Clarify comment.
4506 * man/help2man: Accept new option: --program-name=NAME, so that we
4507 can override the one in --version output. This is needed solely
4508 so that test.1 doesn't refer to `[' as the program name.
4509 Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4510 * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4512 * src/pwd.c: Don't include pathmax.h; system.h already does it.
4514 * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4516 2004-04-19 Jim Meyering <jim@meyering.net>
4518 * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4519 Initialize a buffer to avoid warnings from tools like valgrind.
4521 * Makefile.maint (sc_trailing_blank): New rule.
4522 (syntax-check-rules): Add it.
4523 * .x-sc_trailing_blank: New file.
4525 Make pwd work even if the resulting name is so long that getcwd fails.
4526 * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4527 (nth_parent, find_dir_entry, robust_getcwd): New functions.
4528 (main): First try getcwd, then, upon failure, robust_getcwd.
4530 2004-04-18 Jim Meyering <jim@meyering.net>
4532 * src/who.c (print_user): Use xrealloc here, rather than
4533 unchecked realloc. Remove anachronistic casts.
4535 * src/remove.c (full_filename_): Don't leak upon failed realloc.
4537 * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4539 * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4540 renaming it. Update uses.
4542 2004-04-17 Jim Meyering <jim@meyering.net>
4544 * configure.ac: Depend on automake-1.8.3.
4546 * src/join.c (add_file_name): Declare function to be `static'.
4547 (string_to_join_field): Likewise.
4548 * src/remove.c (ds_init, ds_free): Likewise.
4550 * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4551 (syntax-check-rules): Add to the list.
4553 2004-04-13 Paul Eggert <eggert@twinsun.com>
4555 Use page-aligned buffers whenever we bother to do I/O using buffer
4556 sizes that are tailored for the files.
4558 * src/cat.c: Include getpagesize.h.
4559 * src/copy.c: Likewise.
4560 * src/shred.c: Likewise.
4561 * src/split.c: Likewise.
4562 * src/cat.c (main): Align I/O buffers to page boundaries.
4563 * src/copy.c (copy_reg): Likewise.
4564 * src/shred.c (dopass): Likewise.
4565 * src/split.c (main): Likewise.
4566 * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4567 All uses replaced by ptr_align.
4568 * src/od.c (gcd, lcm): Remove; now in system.h.
4569 * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4571 2004-04-14 Jim Meyering <jim@meyering.net>
4573 Remove m4/Makefile.am: it's no longer needed, with newer automake
4574 * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4575 * Makefile.am (SUBDIRS): Remove `m4' from the list.
4577 2004-04-13 Jim Meyering <jim@meyering.net>
4579 * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4581 2004-03-27 Paul Eggert <eggert@twinsun.com>
4583 * NEWS: cp -pu and mv -u (when copying) now take the destination
4584 file system time stamp resolution into account.
4585 * doc/coreutils.texi (mv invocation): Document this.
4586 (cp invocation): Document -u (it was missing!) with new behavior.
4588 * src/copy.c: Include "utimecmp.h".
4589 (copy_internal): Compare time stamps using utimecmp rather than
4592 2004-04-09 Jim Meyering <jim@meyering.net>
4594 * Makefile.maint (.re-list): New rule/file, to replace
4595 hard-coded list of header file names.
4596 (sc_system_h_headers): Use the new file.
4597 Don't look for sys2.h anymore.
4599 * src/system.h: Include new "stat-macros.h" rather than hard-coding
4600 all of its macro definitions -- the list was slightly out of date.
4601 Suggestion from Dmitry V. Levin.
4603 2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
4605 * NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
4606 * doc/coreutils.texi (dd invocation): Likewise.
4607 * src/shred.c (O_NOCTTY): Remove redundant decl.
4608 * src/dd.c (flags, usage): Remove noctty flag.
4609 (main): Always use O_NOCTTY when opening files.
4611 2004-04-08 Jim Meyering <jim@meyering.net>
4613 * src/dd.c (dd_copy): Mark two diagnostics for translations.
4614 (set_fd_flags): Undo part of today's change: it's a little
4615 cleaner -- and more efficient in the common case -- to go
4616 ahead and OR in the -1 when fcntl fails.
4618 * Makefile.maint (sc_dd_max_sym_length): New target.
4619 (syntax-check-rules): Add it.
4621 * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4622 Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
4624 * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4625 Rename parameter, flags, to avoid shadowing global.
4626 (LONGEST_SYMBOL): Tweak comment.
4628 2004-04-07 Paul Eggert <eggert@twinsun.com>
4630 * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4631 and new dd options iflag= and oflag=.
4632 * src/dd.c (usage): Likewise.
4633 * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4634 * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4635 (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4636 (input_flags, output_flags): New vars.
4637 (LONGEST_SYMBOL): New macro.
4638 (struct symbol_value): Renamed from struct conversion. Members
4639 symbol and value renamed from convname and conversion. The
4640 symbol value is now an array instead of a pointer; this saves
4641 a bit of space and time in practice. All uses changed.
4642 (conversions): Add nocreat, excl, fdatasync, fsync. Now const.
4643 (flags): New constant array.
4644 (iflag_error_msgid, oflag_error_msgid): New constants.
4645 (parse_symbols): Renamed from parse_conversion and generalized
4646 to handle either conversion or flag symbols.
4647 (scanargs): Adjust uses of parse_symbols accodingly. Add
4648 support for iflag= and oflag=. Reject attempts to use
4649 both excl and nocreat.
4650 (set_fd_flags): New function.
4651 (dd_copy): Just return X rather than calling quit (X), since our
4652 caller invokes quit with the returned value. Add support for
4653 fdatasync and fsync.
4654 (main): Add support for iflag=, oflag=, and new conv= symbols.
4655 * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4656 O_RSYNC, O_SYNC): Define to 0 if not already defined.
4658 * NEWS: Remove duplicate mention of BLOCKSIZE.
4660 2004-04-02 Andreas Schwab <schwab@suse.de>
4662 * src/stty.c: Add support for IUTF8 input flag.
4664 2004-04-06 Jim Meyering <jim@meyering.net>
4666 * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4667 Interix spells it `mkdev'. Reported by Mark Funkenhauser.
4669 2004-04-04 Jim Meyering <jim@meyering.net>
4671 A specified format is no longer automatically newline terminated.
4672 If you want a newline at the end of your format, use `\n'.
4673 * src/stat.c (print_it): Don't print a newline at the end of
4675 (do_statfs): Add a newline at end of each default format string.
4677 2004-03-30 Paul Eggert <eggert@twinsun.com>
4679 * src/nohup.c (main): Adjust to new calling convention
4680 for set_cloexec_flag.
4682 2004-03-31 Jim Meyering <jim@meyering.net>
4684 * tests/Fetish.pm (run_tests): Remove `.orig' file.
4685 Remove debugging diagnostic.
4687 Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4688 would not elicit an error.
4689 * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4690 (main): Don't use atoi. Use xstrtoul instead.
4692 2004-03-30 Jim Meyering <jim@meyering.net>
4694 * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4695 (syntax-check-rules): Add it.
4696 * .x-sc_prohibit_atoi_atof: New file.
4698 2004-03-29 Jim Meyering <jim@meyering.net>
4700 * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4701 test is not sensitive to system-dependent block size differences.
4702 Prompted by a report of Solaris 8 differences from Paul Eggert.
4704 * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4705 Rename `%tmp' to `%actual'. Reverse order of last two args to
4706 _compare_files (to $actual, $expected) so as to match declaration.
4708 2004-03-28 Paul Eggert <eggert@twinsun.com>
4710 Fix some gotchas encountered when porting to Solaris 8, using
4711 the Forte 6u2 compiler.
4713 * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4714 Declare sethostname, since no Solaris header does it.
4715 * src/who.c: Include "vasprintf.h", for asprintf.
4717 2004-03-28 Jim Meyering <jim@meyering.net>
4720 * src/du.c (process_file): Don't record dev/inode for directories.
4722 Under some circumstances, without -c, du would mistakenly count the
4723 space of hard-linked files, not just the first one it encountered.
4724 Reported by Anthony Thyssen.
4725 * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4727 * src/du.c: Rename global `print_totals' to `print_grand_total'.
4729 * src/du.c (main): Rearrange filtering loop to be a tiny bit
4732 * src/chown-core.c: Don't include savedir.h -- no longer needed.
4733 * src/chmod.c: Likewise.
4735 2004-03-25 Jim Meyering <jim@meyering.net>
4737 * src/du.c (main): Remove now-unused declaration of `i'.
4739 2004-03-24 Paul Eggert <eggert@twinsun.com>
4741 * src/du.c (main): Filter out file names of length zero before
4742 invoking fts, so that they don't cause fatal errors.
4744 2004-03-25 Jim Meyering <jim@meyering.net>
4746 * tests/du/files0-from (zero-len): Add a test for the above.
4748 2004-02-25 Paul Eggert <eggert@twinsun.com>
4750 * NEWS: New environment var BLOCKSIZE.
4751 * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4752 * tests/envvar-check: Test for it. Factor the code to simplify it.
4754 2004-03-23 Paul Eggert <eggert@twinsun.com>
4756 * NEWS: Shorten the du --files0-from announcement, and say
4757 "NUL-terminated" rather than "NUL-separated".
4758 * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4760 (usage): Say "NUL-terminated", not "NUL-separated".
4761 (main): Check for I/O error when istream is closed.
4762 Allow --files0-from=F even if F is empty; this specifies no files.
4763 (du_files): Now that we allow the list of files to be empty,
4765 * tests/du/files0-from: Adjust to above changes to src/du.c.
4767 2004-03-24 Jim Meyering <jim@meyering.net>
4769 * tests/tail-2/assert: Avoid race condition that could cause
4770 spurious failure. Based on a patch from Andreas Schwab.
4772 2004-03-23 Jim Meyering <jim@meyering.net>
4774 * src/du.c (main): Free the hash table, too.
4776 2004-03-22 Jim Meyering <jim@meyering.net>
4778 * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4779 the change of 2004-01-22. I can no longer reproduce the problem
4780 that prompted that change, and `info coreutils pr' would display the
4781 `printing text' section of the manual, not the one on `pr invocation'.
4783 * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4784 to match corrected output.
4786 * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4787 (main): Use readtoken0 functions rather than readtokens.
4788 Don't use errno when diagnosing readtokens0 failure.
4789 Fix off-by-one error in the token number reported in a diagnostic.
4790 (du_files): Return bool, rather than int.
4791 (main): Call readtokens0_free.
4793 2004-03-21 Jim Meyering <jim@meyering.net>
4795 * src/remove.c (ds_free): Plug a small leak.
4797 * tests/Fetish.pm: Fix typo in comment.
4799 2004-03-07 Jim Meyering <jim@meyering.net>
4801 * NEWS: du accepts a new option --files0-from=FILE, where FILE
4802 contains a list of NUL-separated file names.
4804 * src/du.c: Include "readtokens.h".
4805 (usage): Describe the new option, and adjust the `Usage':
4806 with this option, no FILE may be specified on the command line.
4807 (main): Handle the new option.
4809 * tests/du/files0-from: New tests, for the above.
4810 * tests/du/Makefile.am (TESTS): Add files0-from.
4812 * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4813 * src/tsort.c (tsort): Likewise.
4815 2004-02-29 Paul Eggert <eggert@twinsun.com>
4817 * NEWS: Add support for a new notation @N to get_date to represent
4818 the time stamp with numeric value N. Improve support for
4819 fractional time stamps. date's -d and -f options now accept them.
4820 Likewise for touch -t. date has a new option --iso-8601=ns.
4822 * doc/coreutils.texi (touch invocation):
4823 Describe use of fractional seconds.
4824 (date invocation, Options for date): Likewise.
4825 * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4826 * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4827 (Options for date): Describe new --iso-8601=ns option.
4829 * doc/getdate.texi: Add copyright notice. Change getdate to
4830 get_date when talking about the function name.
4831 (Seconds since the Epoch): New section, containing the time_t
4832 info moved from Date input formats section, along with new
4833 info about the @ syntax. Mention negative time stamps,
4834 fractional time stamps, and leap seconds.
4835 (General date syntax): Modernize examples a bit to reflect new
4837 (General date syntax, Relative items in date strings):
4838 Use ' rather than " to quote formats.
4839 (Time of day items): Add an example with fractional seconds.
4840 Describe fractional-second syntax.
4842 * src/Makefile.am (touch_LDADD): New macro, since `touch' now
4843 needs clock_gettime.
4845 * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
4846 (time_spec_string, time_spec, show_date): Support it.
4847 (usage): Remove description of -ITIMESPEC, as it's obsolete and
4848 confusing. Mention --iso-8601=ns.
4849 (batch_convert): getline returns ssize_t, not int.
4851 * src/touch.c (newtime): Now an array of two timespecs, one
4852 for access and one for modification.
4853 (ref_stats): Remove.
4854 (get_reldate): Use get_date's parameter profile.
4855 (touch, main): Adjust to above changes.
4856 (main): Work even if tm_year == INT_MAX (so long as long int is wider).
4857 Use gettime instead of gettimeofday, for new get_date signature.
4859 * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
4862 2004-03-15 Jim Meyering <jim@meyering.net>
4864 * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
4865 target before updating $(prev_version_file).
4867 * tests/misc/date-sec: New file, to test for just-fixed bug in date.
4868 See today's change in lib/getdate.y.
4869 * tests/misc/Makefile.am (TESTS): Add date-sec.
4871 2004-03-14 Jim Meyering <jim@meyering.net>
4873 * announce-gen (print_changelog_deltas): Use `.sig' suffix for
4874 signature files, not `.asc'. Reported by angico@yahoo.com.
4876 2004-03-13 Jim Meyering <jim@meyering.net>
4878 * src/cp.c (do_copy): Tweak wording in a diagnostic.
4879 Suggestion from Karl Berry.
4880 Include "quoatearg.h".
4881 (do_copy): Use quotearg_colon (not quote) for diagnostics
4882 that begin with `"%s:'.
4884 * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
4885 Suggestion from Dan Jacobson.
4887 2004-03-12 Jim Meyering <jim@meyering.net>
4891 Sometimes, when source and destination partition are different,
4892 mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
4894 * src/copy.c: When moving a set of N hard-linked files between
4895 partitions, via two or more command line arguments where the
4896 command line argument containing the Nth link contains no other
4897 link to that same file, mv would mistakenly copy the file, rather
4898 than hard-linking it to the other(s). That happens because when the
4899 final link is processed, its link count has been reduced to 1 since
4900 the other links have been `copied' to the destination partition
4901 and the source links have been removed.
4902 (copy_internal): When in move mode, use the source dev/inode
4903 pair to look up destination name even when st_nlink == 1.
4904 * src/cp-hash.c (src_to_dest_lookup): New function.
4905 * src/cp-hash.h (src_to_dest_lookup): Add prototype.
4906 * tests/mv/part-hardlink: New file. Test for the above fix.
4907 * tests/mv/Makefile.am (TESTS): Add part-hardlink.
4909 * announce-gen: Sync with autoconf.
4911 * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
4912 This was triggered on a Linux-2.2.19 system using a file system
4913 NFS-mounted from some sort of Sun.
4915 2004-03-11 Jim Meyering <jim@meyering.net>
4917 * Use automake-1.8.3. Regenerate dependent files.
4919 2004-03-10 Jim Meyering <jim@meyering.net>
4921 * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
4922 so that this test works with SELinux-enabled systems.
4923 Based on a patch from Tim Waugh.
4925 `join -1 x' would give a misleading diagnostic
4926 * src/join.c (string_to_join_field): Report that a non-numeric field
4927 number is invalid, rather than `so large that it is not representable'.
4928 * tests/join/Test.pm (invalid-j): New partial test for the above fix.
4930 2004-03-06 Jim Meyering <jim@meyering.net>
4932 cp --sparse=always sparse-image-file.img /dev/hda1 could
4933 produce an invalid copy on the destination device.
4935 * src/copy.c (copy_reg): Even with --sparse=always, try to
4936 make `holes' only if the destination is a regular file.
4937 Reported by Szakacsits Szabolcs.
4939 2004-03-03 Paul Eggert <eggert@twinsun.com>
4941 * src/nohup.c (main): Don't invoke set_cloexec_flag with
4942 a file descriptor of -1.
4944 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
4946 * src/nohup.c: Include "cloexec.h".
4947 (main): Set the copy of stderr to close on exec.
4949 2004-03-01 Paul Eggert <eggert@twinsun.com>
4951 * configure.ac: Include <signal.h> when checking for strsignal,
4952 sys_siglist, and friends. Problem reported by Tony Leneis in
4953 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
4955 2004-02-25 Paul Eggert <eggert@twinsun.com>
4957 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
4958 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
4961 2004-02-23 Paul Eggert <eggert@twinsun.com>
4963 * NEWS: Document how chown's USER.GROUP argument is now parsed.
4965 2004-02-23 Jim Meyering <jim@meyering.net>
4967 * src/seq.c (usage): Remove stray space after \n in --help output.
4969 2004-02-22 Jim Meyering <jim@meyering.net>
4971 * src/du.c (usage): Separate -H and --si. Say that the meaning
4972 of -H will soon change to that of --dereference-args (-D).
4974 2004-02-21 Jim Meyering <jim@meyering.net>
4976 * src/comm.c (usage): Tell what comm does when there are no options.
4977 Reword in terms of FILE1 and FILE2 rather than `left file' and
4978 `right file'. Suggestion from Dan Jacobson.
4980 2004-02-15 Paul Eggert <eggert@twinsun.com>
4982 Fix some POSIX-conformance bugs in expr.
4984 * NEWS: document the following changes to src/expr.c.
4985 * doc/coreutils.texi (expr invocation): Likewise.
4986 Document what forms integers may take, and say "integer"
4987 consistently instead of "number". Warn about operands
4988 that "expr" can misinterpret, and how to work around the
4990 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
4991 Accept a bool argument specifying whether to evaluate the
4992 expression. This is to allow short-circuit evaluation. All
4994 (null): Report that a string is zero even if it has
4995 a form like "-0" or "00".
4996 (eval1, eval): Use short-circuit evaluation for | and &.
4997 (eval): Return 0 if both arguments are null or zero, instead
4998 of returning the first argument.
4999 * tests/expr/basic: Add some tests for the above.
5001 2004-02-17 Jim Meyering <jim@meyering.net>
5005 `make check' from a build inside a chroot environment would fail
5006 * tests/help-version: Specify an argument (`/') for df, in the
5007 unusual event that there is no valid entry in /etc/mtab.
5008 Likewise for id: add the -u option, so we don't get spurious
5009 failures when there are no user or group names.
5012 * src/sort.c (usage) [-u]: Add punctuation so that the description in
5013 the help2man-generated (line-joined) man page is more readable.
5014 Reported by Tim Waugh.
5015 [-T]: Add a semicolon, for the same reason.
5017 2004-02-15 Jim Meyering <jim@meyering.net>
5019 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
5021 2004-02-11 Jim Meyering <jim@meyering.net>
5023 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
5024 $(srcdir)/../Makefile.am.in, rather than $<.
5025 Suggestion from Michael Elizabeth Chastain.
5027 2004-02-10 Jim Meyering <jim@meyering.net>
5029 * config/install-sh: Make this script executable.
5030 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
5031 is executable. Otherwise, on systems that lack a suitable install
5032 binary, `make install' would fail, because of the way this script
5033 is invoked (without `$SHELL ' prefix).
5034 Reported by Bob Proulx.
5036 2004-02-08 Jim Meyering <jim@meyering.net>
5040 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5041 that would cause an unwarranted test failure.
5042 * tests/rm/rm3: Likewise.
5044 2004-02-07 Jim Meyering <jim@meyering.net>
5046 Remove xstat function pointer member. The way it was used was not
5047 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5048 inline `stat' and `lstat' functions, thus making the tests of
5049 `xstat == lstat' in copy.c always fail.
5050 * src/copy.h (struct cp_options) [xstat]: Remove member.
5052 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5053 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5054 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5055 (valid_options): Remove now-obsolete FIXME comments.
5057 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5058 `*(x->xstat) (...)'.
5059 (do_copy): Declare/use local xstat rather than x->xstat.
5060 (main): Remove code that set x.xstat.
5061 * src/mv.c (cp_option_init): Don't initialize xstat member.
5062 * src/install.c (cp_option_init): Likewise.
5064 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5065 so that emit_upload_commands can use these variables, too.
5067 2004-02-06 Jim Meyering <jim@meyering.net>
5069 * tests/rm/deep-1: Remove `du' stack space test.
5070 Apparently, `ulimit -s N' isn't portable enough.
5071 This test will be restored (with a guard against losing ulimit)
5072 in its own file later.
5074 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5075 since this test doesn't take long enough to merit them.
5076 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5078 * Makefile.maint (signatures): Remove definition.
5079 Now, automake's gnupload handles this.
5080 (%.sig: %): Remove now-unused rule.
5081 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5082 `$(distdir).tar.bz2 $(distdir).tar.gz'.
5083 (emit-upload-commands): Adjust to use gnupload.
5085 2004-02-05 Jim Meyering <jim@meyering.net>
5087 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5088 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5089 Now, those are all defined in timespec.h.
5092 * src/date.c: Don't include timespec.h, now that system.h does it.
5094 2004-02-02 Paul Eggert <eggert@twinsun.com>
5096 Don't dump core if localtime returns NULL (possible on
5097 hosts with 64-bit time_t and 32-bit int).
5098 * src/date.c: Include "inttostr.h".
5099 (batch_convert, main):
5100 If time conversion fails, exit with nonzero status.
5101 (show_date): Return int to report conversion failure.
5102 Print the time as an int if localtime fails.
5103 * src/uptime.c: Print "??" if the current clock can't
5104 be converted by localtime. This won't happen until the year
5105 2*31 + 1900, but we don't want to dump core even if the current
5106 clock has the wrong value.
5108 * src/stat.c: Include "inttostr.h".
5109 (human_time): Print the date/time as a number of seconds since the
5110 epoch if it can't be converted by localtime. This is better than
5111 just saying "invalid", and is consistent with what "ls" does.
5112 Don't dump core if the year has more than 48 digits; this isn't
5113 possible on any contemporary host, but we might as well do it right.
5115 2004-01-31 Paul Eggert <eggert@twinsun.com>
5117 * src/stat.c (human_time): Accept time rather than
5118 pointer-to-const-time parameter, for clarity. All callers changed.
5120 2004-02-02 Jim Meyering <jim@meyering.net>
5122 * src/stat.c (do_stat): Remove extra trailing newline from
5123 default formats. Reported by Nelson H. F. Beebe.
5125 Print actual fractional seconds in time stamps, not just `.00000000'.
5126 * src/stat.c (human_time): Add and use new parameter, t_ns.
5127 (print_stat): Update callers.
5128 * src/ls.c (TIMESPEC_NS): Remove definition.
5129 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5130 also uses this macro.
5131 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5132 fractional seconds for files on an XFS file system, but that stat's
5133 fractional seconds were always zero.
5135 2004-01-28 Paul Eggert <eggert@twinsun.com>
5137 * src/seq.c (print_numbers): Use 'double' for loop index, not
5138 'int', to avoid problems with integer overflow. On almost all
5139 machines 'double' works in every case where 'int' works, and
5140 it works on other cases besides.
5142 2004-01-27 Jim Meyering <jim@meyering.net>
5144 * src/seq.c (usage): Mention that if INCREMENT is omitted,
5145 it defaults to 1, even when FIRST is larger than LAST.
5146 Reword so as not to exclude the possibility that INCREMENT be zero.
5148 2004-01-25 Jim Meyering <jim@meyering.net>
5152 * Makefile.maint (signatures): Comment out definition.
5154 2004-01-23 Jim Meyering <jim@meyering.net>
5156 * Makefile.maint (header_regexp): Add exitfail.
5158 * man/Makefile.am (EXTRA_DIST): Add help2man.
5159 Reported by Nelson H. F. Beebe.
5161 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5162 so it works on systems with Perl installed somewhere other than in
5165 * src/paste.c (paste_parallel): Declare local, chr, to be of type
5166 `int', not `char', since it must hold EOF. This bug would make
5167 paste infloop on some systems. Test failures reported by
5168 Nelson H. F. Beebe and Christian Krackowizer.
5170 2004-01-22 Jim Meyering <jim@meyering.net>
5172 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
5173 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5175 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5176 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5177 Use --info-page='coreutils PROG' option.
5178 Now, readlink.1 refers the user to `info coreutils readlink'
5179 rather than to `info readlink'. Reported by Matt Swift.
5181 2004-01-21 Paul Eggert <eggert@twinsun.com>
5183 Exit status cleanup.
5185 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5186 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5187 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5188 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5189 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5190 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5191 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5192 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5193 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5194 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5195 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5196 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5197 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5198 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5199 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5200 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5201 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5203 * src/cat.c (usage): Don't bother normalizing exit status
5204 since the arg is already the correct exit status now.
5205 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5206 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5207 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5208 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5209 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5211 * src/chown.c (main): Removed unused local 'fail'.
5213 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5216 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5217 * src/env.c, src/nice.c, src/su.c: Likewise.
5218 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5219 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5220 * src/expr.c (main): Use initialize_exit_failure rather than
5221 setting exit_failure directly; this optimizes away redundant
5223 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5225 * src/chroot.c (main): Exit with status 1 rather than 127
5226 if chroot itself fails, as per documentation.
5228 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5229 rather than roll-your-own symbols or integers.
5230 * src/env.c (main): Likewise.
5231 * src/nohup.c (main): Likewise.
5232 * src/su.c (run_shell): Likewise.
5234 * src/cp.c (exit_status): Remove static var....
5235 (main): Making it local here instead. Use =, not |=, to set it.
5237 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5239 * src/date.c (batch_convert, main): Likewise.
5240 * src/dd.c (dd_copy): Likewise.
5241 * src/pr.c (first_last_page, main, getoptarg): Likewise.
5242 * src/tr.c (main): Likewise.
5243 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5244 POSIX doesn't require it.
5245 * src/dd.c (write_output, skip, dd_copy): Likewise.
5246 * src/df.c (main): Likewise.
5247 * src/id.c (main): Likewise.
5248 * src/install.c (main): Likewise.
5249 * src/ln.c (main): Likewise.
5250 * src/ls.c (main): Likewise.
5251 * src/mv.c (main): Likewise.
5252 * src/shred.c (main): Likewise.
5254 * src/env.c (main): Exit with status 1, not 2, on errors detected
5256 * src/hostname.c (main): Likewise.
5257 * src/nl.c (main): Likewise.
5258 * src/stty.c (main): Likewise.
5260 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5261 consistency with the other programs' naming conventions.
5264 * src/factor.c (main): Do not report a usage error simply
5265 because stdin has bad numbers.
5267 * src/id.c (problems): Now a boolean int, not a counter,
5268 so that we don't have to worry about int overflow. All uses changed.
5269 * src/touch.c (err): Likewise.
5271 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5273 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5274 * src/mknod.c: Likewise.
5276 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5277 on error; this is in case EXIT_FAILURE is unusual.
5278 * src/su.c (main): Likewise.
5280 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5281 changed to EXIT_CANNOT_INVOKE.
5283 * src/printenv.c (PRINTENV_FAILURE): New constant.
5284 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5285 command-line syntax problems.
5287 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5288 (main): Avoid integer overflow when seeing whether errors occurred.
5290 * src/seq.c (print_numbers): Now returns void, not (zero) int.
5291 All callers changed.
5292 (main): Remove unused local variable 'errs'. Always exit successfully
5293 if we reach the end.
5295 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5296 for consistency with other programs here. All uses changed.
5297 (main): Use 'error' to exit rather than invoking 'exit' here.
5299 * src/sort.c: Don't include <assert.h>.
5300 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
5301 (usage): Don't use 'assert'.
5302 (main): Remove redundant assignment to exit_failure.
5304 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5306 (initialize_exit_failure): New inline function.
5307 Include exitfail.h here, since we refer to exit_failure.
5308 All callers changed to not include exitfail.h.
5310 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5311 substitute them for the corresponding integer constants.
5313 * tests/help-version (expected_failure_status_date): Remove, as
5314 'date' is now normal.
5315 (expected_failure_status_nohup): New var.
5317 2004-01-21 Jim Meyering <jim@meyering.net>
5319 * tests/touch/relative: Remove `command' syntax.
5320 Thanks to Nelson H. F. Beebe and Paul Eggert.
5322 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5323 so as to avoid problems with systems using TAI clocks.
5324 Although it's no longer necessary, set TZ=UTC0 also for the
5325 initial touch command. Reported by Paul Jarc here:
5326 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5328 2004-01-20 Diego Biurrun <diego@biurrun.de>
5330 * src/dircolors.hin: Add .mov to the list of media files.
5332 2004-01-19 Paul Eggert <eggert@twinsun.com>
5334 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5335 portable). Problem reported by Christian Krackowizer. Also, use
5336 +0000 rather than +0 to specify a time zone, as the documentation
5337 requires four digits.
5339 2004-01-19 Jim Meyering <jim@meyering.net>
5341 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5342 * tests/mv/backup-is-src: Likewise.
5343 Problem reported by Peter Horst
5345 2004-01-17 Jim Meyering <jim@meyering.net>
5347 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5351 2003-12-15 Paul Eggert <eggert@twinsun.com>
5353 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5354 with -r specifying the origin for -d.
5355 * src/touch.c (flexible_date): Remove static var.
5356 (get_reldate): New function.
5357 (main): Use it, to implement this new behavior.
5359 2004-01-16 Jim Meyering <jim@meyering.net>
5361 * tests/touch/relative: New test for the above.
5362 * tests/touch/Makefile.am (TESTS): Add relative.
5364 2004-01-13 Jim Meyering <jim@meyering.net>
5366 * src/system.h: Include contents of sys2.h.
5367 * src/sys2.h: Remove file.
5368 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5370 * Use automake-1.8.2. Regenerate dependent files.
5372 * Update to gettext-0.13.1.
5373 * configure.ac: Use gettext-0.13.1.
5374 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5376 2004-01-12 Jim Meyering <jim@meyering.net>
5378 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5380 * Makefile.maint (po-check): Ensure that cvsu works before using it.
5381 Reported by Alexandre Duret-Lutz.
5383 * src/tail.c (main): Warn about following stdin only when it's a tty.
5385 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5387 2004-01-10 Jim Meyering <jim@meyering.net>
5389 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5391 2004-01-09 Jim Meyering <jim@meyering.net>
5393 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5395 2004-01-08 Jim Meyering <jim@meyering.net>
5397 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5398 From Andreas Schwab.
5400 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5401 remnant) from PATH component. That would cause tests in this directory
5402 not to run the just-built binaries, but rather whatever happened
5403 to be in one's PATH. Reported by Christian Krackowizer.
5405 2004-01-04 Jim Meyering <jim@meyering.net>
5407 * src/csplit.c (new_control_record): Use x2nrealloc
5408 rather than xrealloc.
5410 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5412 (make_path_private): Likewise.
5414 2004-01-03 Jim Meyering <jim@meyering.net>
5416 * src/paste.c: Use `bool' (not int) as the type for a few
5418 (collapse_escapes): Rewrite to set globals rather than modifying
5420 Use size_t (not int) for all counters and related index variables.
5421 (paste_parallel): Remove needless complexity of
5422 using xrealloc in the loop; just allocate the buffers up front.
5423 Free the two temporary buffers.
5424 Move declarations of locals `down' into scope where used.
5425 (paste_serial): Remove `register' attributes.
5426 (main): Simplify delim-related code.
5427 Free `delims', now that it's malloc'd.
5429 2004-01-02 Jim Meyering <jim@meyering.net>
5431 * src/chroot.c: Include "quote.h".
5432 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5433 (main): Exit with status of 127, not 1, for too-few-args,
5434 chroot failure, or chdir failure.
5435 Give a better diagnostic upon execvp failure.
5437 * src/du.c (usage): Mention that, with its current meaning,
5440 * src/tail.c (main): Warn about following stdin when it's a tty.
5441 Fail when following by name but no names are specified.
5443 2003-12-30 Jim Meyering <jim@meyering.net>
5445 * src/fold.c (main): Use memcpy, not strcpy.
5447 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5450 2003-12-28 Jim Meyering <jim@meyering.net>
5452 * src/unexpand.c (n_tabs_allocated): New global.
5453 (add_tabstop): Use x2nrealloc rather than xrealloc.
5454 * src/expand.c: Likewise.
5456 * tests/misc/expand: New file.
5457 * tests/misc/Makefile.am (TESTS): Add expand.
5459 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5460 (fillbuf): Use x2nrealloc rather than xrealloc.
5461 (sort): Use xnmalloc rather than xmalloc.
5464 2003-12-27 Jim Meyering <jim@meyering.net>
5466 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5468 2003-12-29 Paul Eggert <eggert@twinsun.com>
5470 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5471 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5473 * doc/coreutils.texi (join invocation): Remove documentation
5474 accordingly. Document that -t makes all separators significant.
5476 * src/join.c: Include posixver.h.
5477 (obsolete_usage): New var.
5478 (longopts): Put obsolete options first.
5479 (OBSOLETE_LONG_OPTIONS): New constant.
5480 (get_option, add_file_name): New functions.
5481 (main): Use them to support new behavior.
5482 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5483 Do not mark -j FIELD as obsolescent; it is longstanding
5484 UNIX tradition and is a valid extension to POSIX.
5486 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5488 2003-12-28 Paul Eggert <eggert@twinsun.com>
5490 * src/join.c (add_field_list): Don't use alloca with unbounded
5491 size; just modify the argument, which is no longer const *.
5493 Various other minor cleanups, mostly to avoid the need for casts.
5495 (extract_field): Renamed from ADD_FIELD, as it's now a function.
5497 (struct field.beg): Now char *, not unsigned char const *. All
5498 uses changed. It shouldn't be const since xmemcoll writes on its
5500 (extract_field): Likewise, for 2nd arg.
5501 (keycmp): Remove now-unnecessary cast of xmemcoll args.
5503 (is_blank): New function, to avoid need to cast arg to unsigned char.
5504 (extract_field): Use it.
5506 (xfields): Rewrite pretty much from scratch.
5508 (hard_LC_COLLATE): Now bool, not int.
5509 (get_line, getseq, add_field_list): Now returns bool, not int.
5510 (decode_field_spec, add_field_list): Return true on success (not
5511 false), for consistency with the rest of the code. All uses changed.
5513 (tab): Now char, not unsigned char. This wasn't 100% necessary
5514 but is slightly cleaner.
5515 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5517 (empty_filler): Now const *.
5519 (make_blank): Remove; wasn't needed. Remove all calls.
5520 (main): Don't set uni_blank.nfields; zero is fine.
5522 2003-12-27 Jim Meyering <jim@meyering.net>
5524 * src/join.c: Include "quote.h".
5525 (min, max): Remove definitions.
5526 Make a few function parameters and corresponding
5527 locals `const'. Use bool for boolean variables.
5528 Use size_t (not int) for all counters and related index variables.
5529 (prjoin): Remove now-useless assertion.
5530 (string_to_join_field): New function.
5531 (main): Accept join fields as large as SIZE_MAX.
5532 (keycmp): Rename `min' to MIN and max to MAX.
5534 2003-12-26 Jim Meyering <jim@meyering.net>
5536 fold -s didn't work on e.g., alpha-based systems.
5537 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5538 x2nrealloc works properly on systems with differing sizes for int
5539 and size_t. Reported by Nelson Beebe.
5541 * src/fold.c: Use `bool' (not int) as the type for a few
5544 2003-12-23 Paul Eggert <eggert@twinsun.com>
5546 * src/ls.c (length_of_file_names_and_frills):
5547 Remove forward decl; not needed.
5548 (print_file_name_and_frills, length_of_file_name_and_frills):
5549 With -m, don't output spaces before inum or size.
5550 (print_with_commas): Don't output space just before newline.
5552 2003-12-24 Jim Meyering <jim@meyering.net>
5554 * tests/ls/Makefile.am (TESTS): Add m-option.
5555 * tests/ls/m-option: New file. Test for above fixes.
5557 2003-12-20 Jim Meyering <jim@meyering.net>
5561 * src/pr.c: Change type of global, buff_allocated, to size_t.
5563 * src/join.c [struct seq]: Change types of members count and alloc
5564 from `int' to `size_t'.
5566 * tests/Makefile.am (root-hint): Tweak wording.
5568 * src/du.c: Accept new option (-0, --null) that makes it so each
5569 output line is NUL-terminated rather than newline-terminated.
5571 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5572 Reported by Volker Paul.
5573 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5574 * tests/dd/unblock-sync: New test for the above.
5576 2003-12-19 Jim Meyering <jim@meyering.net>
5578 * tests/misc/nohup: Double quote back-ticked expression,
5579 in case it ends up having an unexpected value.
5581 * tests/ls/no-arg: Use ls's -1 option in both runs.
5583 * src/du.c (fts_debug): New global.
5584 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5585 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5586 (main) [DU_DEBUG]: Accept -d option.
5588 2003-12-18 Jim Meyering <jim@meyering.net>
5590 * src/ls.c (format_user): Increment dired_pos via two statements,
5591 `dired_pos += width; dired_pos++;' rather than one,
5592 `dired_pos += width + 1;' since the latter could conceivably overflow.
5593 (format_group): Likewise.
5596 * configure.ac: Require automake-1.8.
5598 2003-12-12 Jim Meyering <jim@meyering.net>
5600 * Use automake-1.8. Regenerate dependent files.
5602 2003-12-08 Jim Meyering <jim@meyering.net>
5604 * Makefile.maint (news-date-check): New rule.
5605 (alpha beta major): Depend on it.
5607 2003-12-03 Paul Eggert <eggert@twinsun.com>
5609 * NEWS: ls -l (and similar options) now adjust all columns to
5610 fit the data. Generalized from a suggestion by Leah Q for file sizes.
5611 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5612 (format_user_width, format_group_width, unsigned_file_size,
5613 format_group): New functions.
5614 (block_size_width): Renamed from block_size_size.
5615 (inode_number_width, nlink_width, owner_width, group_width,
5616 author_width, major_device_number_width, minor_device_number_width,
5617 file_size_width): New vars.
5618 (clear_files): Initialize them.
5619 (gobble_file): Set them. Don't ceiling block_size_width to 7.
5620 (print_long_file): Use them.
5621 (gobble_file): Use a new local variable 'f' to make the code
5622 smaller and more consistent with other functions.
5623 (format_user): Output to stdout, not to a buffer, so that we
5624 don't have to worry about buffer overrun. Update dired_pos.
5625 (print_long_file): Don't put owner, group, author into buffer;
5626 just print them directly. Don't assume link counts and
5627 major and minor numbers fit into unsigned long int.
5628 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5629 'ls' output is fixed-width.
5631 2003-12-02 Jim Meyering <jim@meyering.net>
5633 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5635 2003-11-27 Jim Meyering <jim@meyering.net>
5637 * Use automake-1.7f. Regenerate dependent files.
5639 2003-11-24 Paul Eggert <eggert@twinsun.com>
5641 Parse floating-point operands and options in the C locale.
5642 POSIX requires this for printf, and we might as well be
5643 consistent elsewhere (tail, sleep, seq).
5645 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5646 needed now that we assume C89. Include "c-strtod.h".
5647 (xstrtod): Call c_strtod, not strtod.
5648 * src/sleep.c: Include "c-strtod.h".
5649 (main): Update xstrtod call to include new argument, c_strtod.
5650 * src/seq.c (scan_double_arg): Likewise.
5651 * src/tail.c (parse_options): Likewise.
5653 2003-11-24 Jim Meyering <jim@meyering.net>
5655 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5656 Reported by Mark Conty.
5658 2003-11-22 Jim Meyering <jim@meyering.net>
5660 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
5661 (sc_system_h_headers): Do this test only if sys2.h exists.
5663 2003-11-20 Jim Meyering <jim@meyering.net>
5665 * tests/help-version: Ensure that the bug-reporting address is
5666 included in the --help output for every program.
5667 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5669 * src/ptx.c (usage): Output bug-reporting address.
5670 Reported by Dan Jacobson.
5672 2003-11-19 Jim Meyering <jim@meyering.net>
5674 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5675 on the join fields. Suggestion from Bruce Robertson.
5677 2003-11-18 Jim Meyering <jim@meyering.net>
5679 `od -c -w9999999' could segfault
5680 * src/od.c (dump): Use xnmalloc/free, not alloca.
5682 2003-11-16 Jim Meyering <jim@meyering.net>
5684 * Use autoconf-2.59. Regenerate dependent files.
5686 * tests/du/hard-link: Minor tweak: use mkdir -p.
5688 Fix read-from-free'd-buffer error detected by valgrind.
5689 * src/csplit.c (remove_line): Don't return a pointer to data in
5690 a freed buffer. Instead, arrange to free the buffer on the
5693 * tests/misc/csplit: New test for above fix.
5695 2003-11-11 Jim Meyering <jim@meyering.net>
5697 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5698 This avoids a warning from valgrind about memcpy with overlapping
5699 source and destination.
5701 * configure.ac: Require automake-1.7.8.
5703 2003-11-09 Jim Meyering <jim@meyering.net>
5705 * Use automake-1.7.9. Regenerate dependent files.
5707 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5708 * src/chown.c: Likewise.
5710 * src/chown-core.c: Include "root-dev-ino.h".
5711 (chopt_init): Initialize new member.
5712 (change_file_owner): Support rm's new --preserve-root option.
5714 * src/remove.c: Include "root-dev-ino.h".
5715 (remove_cwd_entries): Remove now-obsolete FIXME comment.
5716 (remove_dir): Support rm's new --preserve-root option.
5718 * src/chown.c: Include "root-dev-ino.h".
5719 Add new options: --preserve-root and --no-preserve-root.
5721 * src/chmod.c: Include "root-dev-ino.h".
5722 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5723 ROOT_DEV_INO_WARN macros.
5724 (get_root_dev_ino): Remove function definition, now that it's
5725 been moved to a separate file.
5726 (usage): Describe new options.
5728 * src/mv.c (rm_option_init): Initialized new member.
5730 * src/remove.h: Include "dev-ino.h".
5731 (struct rm_options): Add new member: root_dev_ino.
5732 * src/chown-core.h: Include "dev-ino.h".
5733 (struct Chown_option): Add new member: root_dev_ino.
5735 2003-11-06 Jim Meyering <jim@meyering.net>
5737 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5738 hard-coding `sizeof FILE*'.
5740 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
5742 * src/wc.c (main): Free `fstatus' so there is no confusion about
5743 whether it's leaked or not.
5744 * src/who.c (who): Likewise for `utmp_buf'.
5746 2003-11-05 Paul Eggert <eggert@twinsun.com>
5748 Fix 'cut' problems with size_t overflow and unsigned int.
5749 More generally, resize integer variables to fit use more precisely.
5750 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5751 (struct range_pair): Make members to be of type size_t, not unsigned.
5752 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5753 (suppress_non_delimited, output_delimiter_specified,
5754 have_read_stdin, print_kth, set_fields): Now bool, nt int.
5755 (delim): Now unsigned char, not int.
5756 (mark_printable_field, is_printable_field, is_range_start_index,
5757 set_fields, set_fields, cut_bytes, cut_fields):
5758 Use size_t, not unsigned, for field and byte counts.
5759 (hash_int): Use uintptr_t, not unsigned, for pointers converted
5760 to integers. This squeezes more info out of them.
5761 (set_fields, cut_bytes, cut_fields, main):
5762 Use bool, not int, for booleans.
5763 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5765 2003-11-05 Paul Eggert <eggert@twinsun.com>
5767 * man/Makefile.am (check-programs-vs-x):
5768 Work even if $(programs) contains '$'.
5769 Work even if 'missing=1' in environment.
5770 Don't report an error simply because $(programs) outputs nothing.
5772 2003-11-05 Jim Meyering <jim@meyering.net>
5774 * Use autoconf-2.58. Regenerate dependent files.
5776 * src/tr.c (spec_init): Fix typo in last change.
5778 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5779 call to variadic version_etc function, so that it works even on systems
5780 for which sizeof char* != sizeof int.
5781 * src/true.c (main): Likewise.
5782 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5783 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5784 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5785 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5786 Similarly, cast NULL to `(char *)' in call to variadic function,
5787 parse_long_options, so that it works even on systems for which
5788 sizeof char* != sizeof int.
5789 A similar problem was reported by Harti Brandt in
5790 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5792 * src/users.c (users): Free `utmp_buf' explicitly so that people
5793 don't mistake this for a real leak.
5794 Patch by Dennis Smit <ds@nerds-incorporated.org.
5796 2003-11-04 Paul Eggert <eggert@twinsun.com>
5798 * README: Document _POSIX2_VERSION.
5800 2003-11-04 Jim Meyering <jim@meyering.net>
5802 * src/tac.c (memrchr): Remove #if-0'd function.
5803 (tac_stdin_to_mem): Clean up #if-0'd code.
5805 * src/od.c (decode_format_string): Remove unnecessary casts.
5806 Use more maintainable `sizeof *var'.
5807 (main): Call decode_format_string rather than decode_one_format,
5808 now that `spec' may be NULL.
5810 * src/chmod.c (AUTHORS): Add my name.
5812 * src/split.c (next_file_name): Use `sizeof *var' rather than
5813 hard-coding `sizeof size_t'.
5815 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5817 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5818 to avoid potential overflow in pointer arithmetic.
5819 (set_fields): Use not `1', but rather `sizeof *printable_field' as
5820 second argument to xcalloc.
5821 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5822 rather than xrealloc.
5823 * src/date.c (show_date): Likewise.
5824 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5825 * src/pr.c (store_char): Likewise.
5826 * src/fold.c (fold_file): Likewise.
5828 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5829 type changes (unsigned int -> size_t) in hash.c.
5830 * src/cp-hash.c (src_to_dest_hash): Likewise.
5831 * src/du.c (entry_hash): Likewise.
5832 * src/ls.c (dev_ino_hash): Likewise.
5833 * src/cut.c (hash_int): Likewise. Declare function as static.
5835 2003-11-03 Jim Meyering <jim@meyering.net>
5837 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5838 * tests/misc/fold: Fail the test immediately if we're not running
5839 the expected version of fold.
5841 2003-11-02 Jim Meyering <jim@meyering.net>
5843 * src/tr.c (append_normal_char, append_range, append_char_class)
5844 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
5845 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
5846 and usually shorter.
5847 * src/copy.c (copy_internal): Likewise.
5848 * src/join.c (initseq, add_field, make_blank): Likewise.
5849 * src/od.c (main): Likewise.
5850 * src/cp.c (make_path_private): Likewise.
5851 * src/tsort.c (new_item, record_relation): Likewise.
5853 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
5854 (main): Also remove anachronistic cast of xmalloc return value.
5855 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
5856 (main): Also remove anachronistic cast of xmalloc return value.
5857 * src/sort.c (inittables): Likewise.
5858 (sort): Also Split a long line.
5860 2003-10-25 Jim Meyering <jim@meyering.net>
5862 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5863 type changes (unsigned int -> size_t) in hash.c.
5864 * src/cp-hash.c (src_to_dest_hash): Likewise.
5865 * src/du.c (entry_hash): Likewise.
5866 * src/ls.c (dev_ino_hash): Likewise.
5867 * src/cut.c (hash_int): Likewise. Declare function as static.
5869 2003-10-21 Jim Meyering <jim@meyering.net>
5871 Don't fail when run with VERBOSE=yes.
5872 * tests/chgrp/basic: Do `set +x' before starting the subshell
5873 from which we invoke chgrp. Otherwise, the output from the
5874 VERBOSE=yes-induced `set -x' would result in spurious differences.
5875 Reported by Russel Coker via Michael Stone.
5877 2003-10-19 Jim Meyering <jim@meyering.net>
5879 chmod now uses fts to perform a directory traversal when -R is
5880 specified. Before, it operated on full path names, and as such
5881 would encounter the PATH_MAX (often 4096) limit.
5883 * src/chmod.c: Include "xfts.h".
5884 (process_file): Rename from change_file_mode.
5885 Adapt to be used with fts.
5886 (process_files): New function.
5888 2003-10-18 Jim Meyering <jim@meyering.net>
5890 * tests/du/deref-args: Ensure that du -D now dereferences all
5891 symlinks specified on the command line, not just those that
5892 reference directories.
5894 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
5895 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
5896 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
5897 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
5898 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
5899 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
5900 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
5901 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
5902 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
5903 Update the call to parse_long_options so that `AUTHORS, NULL' are the
5905 * src/true.c (main): Append NULL to version_etc argument list.
5906 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
5908 2003-10-17 Andreas Schwab <schwab@suse.de>
5910 * tests/mk-script: Get $srcdir from first parameter instead of
5912 (main): Update usage.
5914 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
5915 first argument of mk-script.
5916 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
5918 2003-10-17 Jim Meyering <jim@meyering.net>
5920 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
5921 generated `man' page is more readable. Suggestion from Dan Jacobson.
5923 * src/chown-core.c (change_file_owner): Handle the cases in
5924 which fts_info indicates an error with the given entry.
5926 * src/du.c (main): Simply assign to bit_flags.
5927 Don't bother with bit arithmetic.
5929 * tests/chmod/no-x: New file.
5930 * tests/chgrp/no-x: New file.
5931 * tests/chmod/Makefile.am (TESTS): Add no-x.
5932 * tests/chgrp/Makefile.am (TESTS): Likewise.
5934 * src/du.c: Include "xfts.h".
5935 (du_files): Use xfts_open, rather than fts_open.
5936 * src/chown-core.c (chown_files): Likewise.
5938 2003-10-16 Jim Meyering <jim@meyering.net>
5940 * src/chgrp.c (main): Simply assign to bit_flags.
5941 Don't bother with bit arithmetic.
5942 * src/chown.c (main): Likewise.
5943 Rename a couple of local variables.
5944 Remove unnecessary casts.
5946 * src/tail.c (start_bytes): Rename local, remainder, to avoid
5947 gcc's warning about shadowing a global.
5949 2003-10-15 Jim Meyering <jim@meyering.net>
5951 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
5952 use fts to perform a directory traversal when -R is specified.
5953 Before, they operated on full path names, and as such would
5954 encounter the PATH_MAX (often 4096) limit.
5955 They are more efficient. For example, before, chgrp -R would
5956 take almost 5 seconds to change about 2000 directories and fail
5957 (with `File name too long'), while now it succeeds on a hierarchy
5958 of depth 20,000 in 1/10 the time.
5960 * src/chown.c: Include "userspec.h" and "fts_.h".
5961 (WRITTEN_BY): Add my name.
5962 (getpwnam, getgrnam, getgrgid): Remove declarations.
5963 (endpwent): Remove definition.
5965 (main): Handle new options.
5966 Call new function, chown_files rather than change_file_owner.
5968 * src/chgrp.c: Include "fts_.h".
5969 (WRITTEN_BY): Add my name.
5970 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
5973 (main): Handle new options.
5974 Call new function, chown_files rather than change_file_owner.
5976 Rewrite to iterate through hierarchies using fts rather than
5977 via explicit recursion.
5978 * src/chown-core.c: Include "fts_.h"
5979 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
5980 on a single file at a time.
5981 (chown_files): New function.
5982 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
5983 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
5984 [struct Chown_option] (dereference): Remove member with ambiguous name.
5985 [struct Chown_option] (affect_symlink_referent): New member.
5986 (chown_files): New prototype.
5988 * tests/chgrp/recurse: Update tests accordingly.
5989 * tests/chgrp/posix-H: New tests for the above.
5990 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
5992 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
5993 work even for superuser. Suggestion from Dan Jacobson.
5995 2003-10-14 Paul Eggert <eggert@twinsun.com>
5997 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
5999 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
6000 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
6001 * src/sort.c (parse_field_count): Handle the case where overflow
6002 and invalid suffix char are both reported.
6004 2003-10-14 Jim Meyering <jim@meyering.net>
6006 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
6007 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
6010 2003-10-13 Paul Eggert <eggert@twinsun.com>
6012 Fix to avoid a denial-of-service attack if the display width is
6013 enormous. Also, clean up the code a bit by removing duplicate code.
6015 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
6016 (calculate_columns): New function, that contains code that used
6017 to be common to print_many_per_line and print_horizontal.
6018 (print_many_per_line, print_horizontal): Use it.
6019 (decode_switches): Set max_idx here, not in calculate_columns.
6020 (print_current_files): Don't call init_column_info; calculate_columns
6022 (init_column_info): Don't allocate a lot more space than is needed
6023 to represent the current set of files. Allocate all the new
6024 size_t cells in one call to xnmalloc, rather than a row at a time.
6026 2003-10-13 Jim Meyering <jim@meyering.net>
6028 * src/ls.c (init_column_info): Add another FIXME comment.
6030 2003-10-13 Paul Eggert <eggert@twinsun.com>
6032 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
6033 Remove several arbitrary limits on hosts where int cannot represent
6036 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
6037 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
6038 struct column_info.col_arr[0], max_idx):
6039 Now size_t, not int.
6040 (get_funky_string): Return bool indicating success, instead of
6041 a negative count to indicate failure. Store number of columns
6042 through new parameter OUTPUT_COUNT; that way, they can never
6043 go negative. Change equals_end from int to bool. All uses
6045 (struct column_info.valid_len): Now bool, not int. All uses changed.
6046 (dired_dump_obstack, get_funky_string, clear_files,
6047 extract_dirs_from_files, print_current_files,
6048 print_many_per_line, print_horizontal, init_column_info,
6049 put_indicator, length_of_file_name_and_frills,
6050 print_with_commas): Use size_t, not int, for local variables
6052 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6053 Check for TIOCGWINSZ returing negative values (or values greater
6055 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6057 Use xmalloc and xnmalloc, not XMALLOC.
6058 (gobble_file): Use xnrealloc, not XREALLOC.
6059 (print_color_indicator): Remove now-unnecessary cast to size_t.
6061 2003-10-12 Paul Eggert <eggert@twinsun.com>
6063 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6064 * tests/sort/sort-tests: Remove from CVS; assume that people
6065 brave enough to check coreutils out from CVS can rebuild it.
6067 2003-10-12 Jim Meyering <jim@meyering.net>
6069 New options: --preserve-root and --no-preserve-root.
6070 * src/chmod.c (change_file_mode): Honor new option.
6071 (change_file_mode): Strip trailing slashes on directory
6072 argument passed to change_dir_mode.
6073 (get_root_dev_ino): New function.
6074 (main): Initialize global, root_dev_ino.
6076 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6077 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
6079 * src/chmod.c (change_file_mode): Likewise.
6081 2003-10-08 Jim Meyering <jim@meyering.net>
6083 * src/csplit.c (main): Remove obsolete FIXME.
6085 2003-10-07 Jim Meyering <jim@meyering.net>
6087 * Use automake-1.7.8. Regenerate dependent files.
6089 2003-09-29 Paul Eggert <eggert@twinsun.com>
6093 * doc/coreutils.texi (csplit invocation):
6094 The regexp offset need not have a sign; POSIX requires support
6095 for signless offets.
6097 Be more careful about int widths. For example, remove some
6098 arbitrary limits by replacing 'unsigned' with 'size_t',
6099 'uintmax_t', etc. Use standard bool rather than a homegrown type.
6100 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6101 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
6102 to <stdbool.h> usage.
6103 (struct control): offset is now intmax_t, not int.
6104 repeat_forever is now bool, not int.
6105 (struct cstring): len is now size_t, not unsigned int.
6106 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6107 size_t, not unsigned. start_line, first_available are now
6108 uintmax_t, not unsigned.
6109 (hold_count, control_used): Now size_t, not unsigned.
6110 (last_line_number, current_line, bytes_written):
6111 Now uintmax_t, not unsigned.
6112 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6113 create_new_buffer, get_new_buffer, load_buffer, find_line,
6114 process_regexp, split_file, new_control_record, extract_regexp,
6115 get_format_width, get_format_prec, max_out):
6116 size args, locals, and returned values are now size_t, not unsigned
6118 (get_first_line_in_buffer, find_line, write_to_file,
6119 handle_line_error, process_line_count, regexp_error, process_regexp,
6121 File line, byte, and repetition counts are now uintmax_t, not unsigned.
6122 (check_for_offset): Don't require a sign before the offset.
6123 Use xstrtoimax to do the real work.
6124 (extract_regexp): Remove harmful cast of size to unsigned.
6125 256 -> 1<<CHAR_BIT, for clarity.
6126 (get_format_flags): Return at most 3, to avoid worries about overflow.
6128 (bytes_to_octal_digits): Remove.
6130 (cleanup): Don't check whether output_stream is NULL, since
6131 close_output_file does that for us.
6133 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6134 (sizeof *p);" instead of the more long-winded alternatives.
6136 (get_new_buffer): Use O(1) algorithm for resizing a buffer
6137 to a much larger size, instead of an O(N) algorithm.
6139 (process_regexp): Use plain NULL rather than casted 0.
6141 (make_filename): Use %u, not %d, to format unsigned file number.
6143 (new_control_record): Use xrealloc exclusively, since it handles
6146 (extract_regexp): Change misspelled word in diagnostic.
6148 (get_format_width): Even if a minimum field width is specified,
6149 allow room for enough octal digits to represent the value of
6150 the maximum representible integer. This fixes a potential
6151 buffer overrun. Calculate this room at compile-time, not
6152 at run-time; this removes the need for bytes_to_octal_digits.
6153 Check for overflow; this removes a FIXME.
6155 (get_format_prec): Don't allow precision to be signed; it's
6156 not ANSI. Check for overflow. Remove hardcoded "11" as
6157 default precision; this fixes a potential buffer overrun
6158 on hosts with wider size_t.
6160 (get_format_conv_type): Change local variable to be of type
6161 unsigned char, not int; this removes a potential subscript
6162 violation on hosts where char is signed.
6164 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6165 Allow "%%" in format. Don't overflow when
6166 counting lots of percents.
6168 (usage): Default sprintf format is %02u, not %d.
6170 2003-10-05 Jim Meyering <jim@meyering.net>
6172 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6174 * src/du.c (du_files): Mark diagnostic for translation.
6176 2003-10-04 Jim Meyering <jim@meyering.net>
6178 * src/du.c (du_files): Ignore any failure of fts_close.
6179 Give better diagnostics for failed fts_open.
6181 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6183 Deprecate existing use of -H (aka --si).
6184 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6185 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6186 (main): Warn that the meaning of -H will soon change to be
6189 2003-10-03 Jim Meyering <jim@meyering.net>
6191 * src/du.c: Accept --no-dereference (-P).
6193 2003-10-02 Jim Meyering <jim@meyering.net>
6195 * tests/du/trailing-slash: Adjust for slightly different output.
6197 Rewrite du.c to use fts.
6198 * src/du.c: Include "fts_.h", not ftw.h.
6199 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6200 (IS_FTW_DIR_TYPE): Remove definition.
6201 (IS_DIR_TYPE): Define.
6202 (is_symlink_to_dir): Remove now-unnecessary function.
6203 (process_file, du_files): Rewrite to use fts.
6205 * tests/du/inaccessible-cwd: Ensure that even when run from an
6206 inaccessible directory, du can still operate on accessible
6207 directories elsewhere.
6208 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6210 * tests/rm/deep-1: Ensure that du can process a hierarchy
6211 of depth 400 while using no more than 50KB of stack space.
6213 2003-10-01 Akim Demaille <akim@epita.fr>
6215 * announce-gen (print_news_deltas): New function, extracted from main.
6216 (main): Make `news_file' an array.
6217 Use '...=s' => \@var for --news and --url-directory specs.
6218 Before there were a couple of portability problems.
6220 2003-09-28 Jim Meyering <jim@meyering.net>
6222 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6223 (syntax-check-rules): Add it.
6225 * src/copy.c: Remove unnecessary cast of alloca, since now it's
6226 guaranteed to be (void *).
6227 * src/cp.c: Likewise.
6228 * src/join.c: Likewise.
6229 * src/ln.c: Likewise.
6230 * src/ls.c: Likewise.
6231 * src/od.c: Likewise.
6232 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6234 2003-09-27 Jim Meyering <jim@meyering.net>
6236 Don't exhaust virtual memory when processing large inputs.
6237 Fix this by removing csplit's internal free-list management;
6238 instead rely on malloc for that.
6240 * src/csplit.c (free_list): Remove global.
6241 (clear_all_line_control): Remove function.
6242 (get_new_buffer): Always use create_new_buffer to obtain a
6243 new buffer, rather than searching free_list.
6244 (free_buffer): Just call free.
6245 Reported by Nikola Milutinovic.
6247 2003-09-26 Jim Meyering <jim@meyering.net>
6249 * man/rm.x: Also list `chattr' in SEE ALSO section.
6250 Suggestion from Mark Hubbart.
6252 2003-09-25 Jim Meyering <jim@meyering.net>
6254 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6255 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6257 * Use autoconf-2.57d. Regenerate dependent files.
6259 2003-09-24 Jim Meyering <jim@meyering.net>
6261 Minor efficiency tweak.
6262 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6263 (do_link): Likewise.
6265 2003-09-23 Jim Meyering <jim@meyering.net>
6267 * src/paste.c (paste_serial): Save errno after input error,
6268 to report proper errno value.
6269 Based on a patch from Paul Eggert.
6271 * src/tee.c (tee): Adjust fwrite arguments so that the return
6272 value is the number of bytes written.
6274 2003-09-16 Paul Eggert <eggert@twinsun.com>
6276 Don't assume ferror sets errno. Bug reported by Bruno Haible.
6278 * src/comm.c (compare_files): Save errno after input error,
6279 to report proper errno value.
6280 * src/fold.c (fold_file): Likewise.
6281 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6282 * src/unexpand.c (unexpand): Likewise.
6284 * src/csplit.c (close_output_file): Don't report bogus errno value
6285 after ferror discovers an output error. We don't know the proper
6286 errno value, since it might have been caused by any of a whole
6287 bunch of calls, and it might have been trashed in the meantime.
6288 Fixing this problem will require much more extensive changes;
6289 in the meantime just say "write error".
6290 * src/od.c (check_and_close, dump, dump_strings): Likewise.
6291 * src/uniq.c (check_file): Likewise.
6293 * src/join.c (get_line): Report error right away if I/O fails,
6294 so that the proper errno value is used.
6295 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6296 * src/tee.c (tee): Likewise.
6297 * src/uniq.c (check_file): Likewise.
6299 * src/od.c (skip): If a read fails, don't retry it later, so
6300 that we report the proper errno.
6302 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6304 * src/tee.c (tee): Once a write failure has occurred, don't bother
6305 writing anything more to that stream.
6307 * src/uniq.c (check_file): Check for ferror (stdout) even if
6310 * src/yes.c (UNROLL): Remove.
6311 (main): Exit immediately when write failure is detected.
6312 Simplify code by assigning to argv when argc == 1.
6314 2003-09-21 Paul Eggert <eggert@twinsun.com>
6316 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6317 (WRITTEN_BY): Change "Franc,ois" (actually using
6318 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6321 2003-09-19 Jim Meyering <jim@meyering.net>
6323 `du -D symlink-to-dir' would mistakenly omit the slash in
6324 lines like this: 24 symlink-to-dir/subdir
6325 * src/du.c (process_file): Fix offset calculation.
6326 Reported by Jeff Sheinberg as Debian bug #211591;
6327 http://bugs.debian.org/205251
6329 * tests/du/deref-args: New file/test for the above.
6330 * tests/du/Makefile.am (TESTS): Add deref-args.
6332 * src/du.c (process_file): Remove useless disjunct.
6334 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6336 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6337 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6338 Mark each WRITTEN_BY string as translatable.
6340 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6341 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6342 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6343 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6344 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6345 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6346 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6347 * who.c, whoami.c, yes.c: Revert yesterday's changes.
6348 Instead, a subsequent change will embed `Written by ' in
6349 each string along with the author names.
6351 * src/true.c: Revert yesterday's changes.
6352 * src/sys2.h: Likewise.
6354 2003-09-18 Jim Meyering <jim@meyering.net>
6356 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6357 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6358 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6359 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6360 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6361 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6362 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6363 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6364 comma-separated list of strings and/or update the call to
6365 parse_long_options so that `AUTHORS, NULL' are the last parameters.
6366 * src/true.c (main): Append NULL to version_etc argument list.
6367 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6369 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6370 shadowing the math function name. Also rename loga to log_a.
6372 2003-09-14 Jim Meyering <jim@meyering.net>
6374 * src/factor.c (print_factors): Give a separate diagnostic
6375 for numbers that are too large, but otherwise valid.
6376 Reported by Dániel Varga.
6378 2003-09-10 Jim Meyering <jim@meyering.net>
6380 * Use automake-1.7.7. Regenerate dependent files.
6382 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6383 of `fmt -1'. Using the just-built tr is a little cleaner.
6384 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6385 * man/Makefile.am (programs, check-x-vs-1): Likewise.
6387 2003-09-09 Jim Meyering <jim@meyering.net>
6389 * src/copy.c: Alphabetize includes.
6390 Remove duplicate inclusion of "same.h".
6392 2003-09-08 Jim Meyering <jim@meyering.net>
6394 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6395 Didn't give enough of a benefit, mainly because it's not yet
6400 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6401 (check-programs-vs-x): Fail if $(programs) is empty.
6403 * src/remove.c: Add a comment.
6405 2003-09-07 Jim Meyering <jim@meyering.net>
6407 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6408 Don't define. These symbols are no longer used.
6410 * tests/misc/tty-eof: Write ^D as \cD.
6411 Complete the change of 2003-08-02.
6413 * Makefile.maint (po-check): Use cvsu, so that a temporary source
6414 file in lib/ or src/ doesn't induce an unwarranted failure.
6415 Add a kludge to filter out the sole generated source file that
6416 also has translatable messages: src/false.c.
6418 2003-09-06 Jim Meyering <jim@meyering.net>
6420 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6421 (parse_options): Give a diagnostic for (but still accept) the
6422 deprecated --allow-missing option.
6424 2003-09-04 Paul Eggert <eggert@twinsun.com>
6426 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
6427 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6429 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
6430 size_bound ourselves. if an input file is a pipe and the user
6431 specified a size, use that size instead of trying to guess the
6432 pipe size. This has the beneficial side effect of avoiding the
6433 overhead of default_sort_size in that case. All callers changed.
6434 (sort): Remove static var size; now done by sort_buffer_size.
6436 2003-09-05 Jim Meyering <jim@meyering.net>
6438 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
6440 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6441 to start, rather than just .1. Upon failure, print unexpected state.
6443 2003-09-04 Paul Eggert <eggert@twinsun.com>
6445 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6446 SAFE_READ_ERROR to tmp->nbytes.
6447 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6449 * src/head.c (struct linebuffer): Change nbytes and nlines
6450 from unsigned int to size_t. unsigned int is safe (after the
6451 2003-09-03 patch) but size_t is cleaner.
6452 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6453 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6455 Standardize on BUFSIZ as opposed to other macro names and values.
6456 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
6457 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6458 stdio.h has always defined it,
6459 and other code already assumes it's defined.
6460 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6461 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6462 (io_buf): IO_BUF_SIZE -> BUFSIZ.
6464 2003-09-04 Paul Eggert <eggert@twinsun.com>
6466 * src/seq.c (step): Default to 1.
6467 (print_numbers): Allow the output to be empty.
6468 (main): The default step is 1, even if LAST < FIRST;
6469 as per documentation.
6470 * tests/seq/basic (onearg-2): Output should be empty.
6472 2003-09-05 Jim Meyering <jim@meyering.net>
6474 * Makefile.cfg (wget_files): Temporarily disable, until master
6475 versions are restored to ftp.gnu.org.
6477 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6479 Make seq's --width (-w) option work properly even when the
6480 endpoint requiring the larger width is negative and smaller than
6482 * src/seq.c (get_width_format): Include `-' in the set of bytes
6483 allowed in a `simple' number (no decimal point, no exponent).
6484 Reported by Patrick Mauritz.
6486 2003-09-02 Paul Eggert <eggert@twinsun.com>
6488 * NEWS: sort -t '\0' now uses a NUL tab.
6489 sort option order no longer matters, unless POSIX requires it.
6490 * src/sort.c (usage): Say "blanks" instead of "whitespace",
6491 Similar fixes for many comments.
6492 (TAB_DEFAULT): New constant, so that we can support NUL as
6493 the field separator.
6494 (tab): Now int, not char. Initialize to TAB_DEFAULT.
6495 (specify_sort_size): If multiple sizes are specified, use the largest.
6496 (begfield, limfield): Support NUL tab char.
6497 (set_ordering): Do not let -i override -d.
6498 (main): Report an error if incompatible -o or -t options are given.
6499 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
6501 2003-09-05 Jim Meyering <jim@meyering.net>
6503 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6505 2003-09-03 Andreas Schwab <schwab@suse.de>
6507 Bug report and patch here:
6508 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6509 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6510 * src/head.c (elide_tail_lines_pipe): Likewise.
6512 2003-09-03 Jim Meyering <jim@meyering.net>
6514 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6515 small amount of code from him was first moved to lib/human.c, and was
6516 subsequently rewritten entirely.
6517 * src/df.c (AUTHORS): Likewise.
6519 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
6521 * src/md5sum.c (split_3): Accept the BSD format for generic
6522 message digest modes. Currently works with BSD's MD5 and SHA1
6523 formats since these are the two algorithms presently used in
6524 coreutils. Updated comments to reflect this change.
6525 (bsd_split_3): Updated comments.
6527 * tests/md5sum/basic-1: New test to make sure that
6528 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6529 from `check-bsd' test in tests/sha1sum/basic-1).
6531 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6532 --check exit status and BSD SHA1 format (adapted from tests
6533 in tests/md5sum/basic-1).
6535 2003-08-30 Jim Meyering <jim@meyering.net>
6537 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6539 When source and destination arguments refer to the same file, reside
6540 on a partition (e.g. VFAT) on which distinct names may refer to the
6541 same directory entry (often due to variations in case), and when the
6542 link count for the file is 1, mv no longer unlinks the file. Instead,
6543 it gives the expected diagnostic that the source and destination are
6544 the same. WARNING: this is an incomplete fix. If the file happens
6545 to have a link count of 2 or greater, such an erroneous mv command
6546 will still unlink it.
6547 Although that is not possible on vfat or umsdos, it is possible on
6548 other file system types, e.g., ntfs, and hpfs.
6549 * src/copy.c (same_file_ok): Invoke same_name (which might still
6550 return false for names that refer to the same directory entry)
6551 only if the link count is 2 or more.
6552 * tests/mv/vfat: Show how to demonstrate the above problem.
6553 This test is not run.
6554 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6556 2003-08-27 Jim Meyering <jim@meyering.net>
6558 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6559 who's -l option has been eliciting an unconditional warning about
6560 this impending change since sh-utils-2.0.12 (April 2002).
6562 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6563 This would happen for nonempty files not ending with a newline.
6564 Reported by Dan Jacobson.
6565 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
6566 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6568 * src/stat.c (print_it): Avoid buffer overrun that would
6569 occur when the user-specified format string ends with `%'.
6570 Patch by Tommi Kyntola.
6571 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
6572 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6574 2003-08-26 Jim Meyering <jim@meyering.net>
6576 Apply changes from bison.
6577 * GNUmakefile (SHELL): Define to `sh', if necessary.
6579 * Makefile.maint (WGETFLAGS): Define to `-C off'.
6580 Update all uses of $(WGET).
6582 2003-08-22 Akim Demaille <akim@epita.fr>
6584 * Makefile.cfg (local-checks-to-skip): New.
6585 * Makefile.maint (local-check): Rename as...
6586 (local-checks-available): this.
6589 2003-08-26 Akim Demaille <akim@epita.fr>
6591 * announce-gen (print_changelog_deltas): Neutralize "<#" as
6592 "<\#" to avoid magic from Gnus when posting parts of this script.
6594 2003-08-25 Jim Meyering <jim@meyering.net>
6596 * src/stat.c (main): Warn about use of deprecated `-l' option.
6598 2003-08-22 Jim Meyering <jim@meyering.net>
6600 * src/stat.c (do_stat): For link count at end of line, use %h format,
6601 instead of %-5h. The latter would make stat emit trailing spaces.
6602 Reported by Dan Jacobson.
6604 2003-08-20 Jim Meyering <jim@meyering.net>
6606 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6608 2003-08-19 Jim Meyering <jim@meyering.net>
6610 * src/system.h: Include stdlib.h unconditionally,
6611 as we're now assuming that part of hosted C89.
6613 2003-08-18 Jim Meyering <jim@meyering.net>
6615 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6616 to avoid warnings from gcc.
6618 2003-08-17 Jim Meyering <jim@meyering.net>
6620 Avoid unnecessary and sometimes time-consuming hostname lookups.
6621 * src/who.c (print_user): Use strchr, not strrchr.
6622 * src/pinky.c (print_entry): Likewise.
6623 Patch by Michael Stone.
6624 This fixes a typo I introduced in who-users.c on 1996-02-23.
6626 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6627 disallowed between `@...@'.
6629 2003-08-16 Paul Eggert <eggert@twinsun.com>
6631 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6632 done by gnulib .m4 files.
6633 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6634 * src/sys2.h (strtoull): Remove unused declaration.
6636 2003-08-16 Jim Meyering <jim@meyering.net>
6638 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6641 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6642 race condition bug. The bug would be triggered when tailing a file
6643 with file pointer not at beginning of file, and where the file was
6644 truncated to have a length of less than the initial offset at just
6645 the right moment (between the two lseek calls in this function).
6647 An invalid initial value for *read_pos would result in
6648 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6649 busy-wait rather than sleeping between iterations. The bug manifests
6650 itself only when tailing regular files that are initially nonempty.
6651 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6653 (tail_lines): Likewise, after lseek calls.
6654 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
6655 * tests/tail-2/tail-n0f: New file. Test for above fix.
6656 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6658 2003-08-15 Jim Meyering <jim@meyering.net>
6660 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6661 (sc_sun_os_names): Likewise.
6662 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6664 * man/help2man: Remove some SPACEs before TAB.
6666 2003-08-14 Paul Eggert <eggert@twinsun.com>
6668 * Makefile.maint (LC_ALL): Set to C.
6669 * man/Makefile.am (ASSORT): New var.
6670 (check-x-vs-1, programs): Use it.
6671 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6672 * tests/Makefile.am (ASSORT, all_programs): Likewise.
6674 2003-08-11 Jim Meyering <jim@meyering.net>
6676 fold -s -wN would infloop for N < 8 with TABs in the input.
6677 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6678 * src/fold.c (fold_file): Move contents of `else'-block
6679 out of conditional so it's used also for --spaces (-s).
6680 * tests/misc/fold: Test for the above fix.
6681 * tests/misc/Makefile.am (TESTS): Add fold.
6683 2003-08-10 Jim Meyering <jim@meyering.net>
6685 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6686 system.h so the types from time.h and sys/time.h are available.
6687 It appears that this is necessary for OpenBSD, NetBSD, and
6688 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
6690 2003-08-06 Paul Eggert <eggert@twinsun.com>
6692 * NEWS: Add support for setting file timestamps to microsecond
6693 resolution, on hosts that support this.
6694 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6695 * src/copy.c (copy_internal):
6696 Set file timestamps with utimens, not utime.
6697 * src/cp.c (re_protect): Likewise.
6698 * src/install.c (change_timestamps): Likewise.
6699 * src/touch.c (newtime, touch, main): Likewise.
6701 2003-08-09 Jim Meyering <jim@meyering.net>
6703 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6705 (syntax-check-rules): Add it.
6707 * src/tail.c (main): Tweak Solaris OS version number in comment.
6708 * src/wc.c (wc): Likewise
6709 * tests/tail-2/fflush: Likewise.
6711 * src/tail.c: Add new undocumented option, --presume-input-pipe.
6712 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6714 2003-08-08 Paul Eggert <eggert@twinsun.com>
6716 Use new gnulib 'extensions' module.
6717 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6720 2003-08-08 Paul Eggert <eggert@twinsun.com>
6722 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6724 2003-08-09 Jim Meyering <jim@meyering.net>
6726 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6727 For tests of obsolete behavior, don't presume that unsetting
6728 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6730 2003-08-07 Paul Eggert <eggert@twinsun.com>
6732 * doc/coreutils.texi (split invocation):
6733 Add -d or --numeric-suffixes option to 'split'.
6734 From a suggestion by Jesse Kornblum.
6735 * src/split.c (suffix_alphabet): New var.
6736 (longopts, usage, next_file_name, main): Support -d.
6737 (next_file_name, main): Allow -a0, as POSIX requires.
6738 (next_file_name): Don't assume ASCII-like encoding;
6739 'a' through 'z' are not contiguous in EBCDIC.
6741 2003-08-05 Paul Eggert <eggert@twinsun.com>
6743 Merge getline from gnulib.
6744 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6745 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6746 New files, from gnulib.
6747 * lib/getdelim2.c, lib/getdelim2.h: Remove.
6748 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6749 getdelim2.h to getndelim2.c and getndelim2.h.
6750 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6751 checking for getdelim.
6752 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6753 than rolling our own.
6754 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6755 (cut_fields): Invoke getndelim2 rather than getdelim2.
6757 2003-08-04 Jim Meyering <jim@meyering.net>
6759 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6760 and for the indices to iterate through nsigs.
6762 2003-08-02 Paul Eggert <eggert@twinsun.com>
6764 * src/sort.c: Minor code cleanups, mostly to use more accurate
6765 types and to remove unnecessary casts.
6766 (min, max): Remove. All uses changed to MIN and MAX.
6767 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6768 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6769 keyfield.numeric, struct keyfield.general_numeric, struct
6770 keyfield.month, struct keyfield.reverse, reverse, unique,
6771 have_read_stdin): Now bool, not int. All uses changed.
6772 (eolchar): Now char, not int.
6773 (struct keyfield.ignore): Now bool const *, not int *.
6774 (struct keyfield.translate): Now char const *, not char *.
6775 (struct month.name): Likewise.
6776 (blanks, nonprinting, nondictionary): Now bool[], not int[].
6777 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6778 check, sort, main): Use const * pointers when possible.
6779 (month_cmp): Rewrite to avoid casts.
6780 (inittables): Initialize tables unconditionally, to avoid branches.
6781 (fillbuf): Return bool, not int. All uses changed.
6782 (fillbuf, keycompare, new_key, main):
6783 Use SIZE_MAX rather than (size_t) -1.
6784 (trailing_blanks): Renamed from trim_trailing_blanks.
6785 Return the number of blanks to trim. All uses changed.
6786 (getmonth): Use trailing_blanks rather than open code.
6787 (keycompare): Do not cast char * to unsigned char *; not needed.
6788 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6790 (compare, main): Use | rather than || to avoid jumps.
6791 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6793 (check, first_same_file, sort, main):
6794 Use bool instead of int local vars when possible.
6795 (check): Merge the old 'checkfp' and 'check' into a single function,
6796 that returns a boolean (true if the file was ordered).
6798 (main): Use int instead of unsigned for iterating through nsigs.
6799 Rename local var "posix_pedantic" to "posixly_correct".
6801 2003-08-02 Jim Meyering <jim@meyering.net>
6803 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6804 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6806 * src/cut.c (cut_fields): Don't read again after encountering an
6807 initial EOF. E.g., `cut -f2' would do so.
6808 * tests/misc/tty-eof: Add a test for the above fix.
6810 * src/sort.c (sortlines): Add description and references.
6813 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6814 the tests in help-version will use the just-built binaries.
6815 Reported by Christian Krackowizer.
6817 2003-07-31 Paul Eggert <eggert@twinsun.com>
6819 * NEWS: Add --rfc-2822 option to GNU date.
6820 * doc/coreutils.texi (Time directives, Options for date, Examples
6822 * src/date.c (long_options, usage, main): Likewise.
6823 * doc/getdate.texi (General date syntax): Likewise.
6824 * doc/coreutils.texi (Options for date): Fix a typo in format:
6825 it's now %d not %_d. Add URLs.
6827 2003-08-01 Jim Meyering <jim@meyering.net>
6829 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6830 Otherwise, with at least the /bin/sh from HPUX 10.20,
6831 the trap code would end up converting that to exit 1 and thus an
6832 unexpected test failure. Reported by Christian Krackowizer.
6834 2003-07-31 Paul Eggert <eggert@twinsun.com>
6836 * src/ptx.c: Do not include bumpalloc.h.
6837 (WORD_TABLE): New member alloc.
6838 (ALLOC_NEW_WORD): Remove.
6839 (occurs_alloc): New var.
6840 (digest_word_file, find_occurs_in_text): Check for arithmetic
6841 overflow when computing table size. Use xrealloc rather than
6842 bumpalloc primitives.
6844 2003-07-29 Jim Meyering <jim@meyering.net>
6848 * README: When running tests as root, suggest using
6849 sudo with NON_ROOT_USERNAME=$USER.
6851 * tests/Makefile.am (all_programs): Makefile is in ../src, not
6854 2003-07-28 Jim Meyering <jim@meyering.net>
6856 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
6858 2003-07-28 Paul Eggert <eggert@twinsun.com>
6860 * lib/stdbool.hin (_Bool): Make it signed char, instead of
6861 an enum type, so that it's guaranteed to promote to int.
6862 * src/sort.c (sortlines_temp): Undo previous change.
6864 2003-07-28 Jim Meyering <jim@meyering.net>
6866 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
6867 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
6868 would cause lines[-1 - swap] (with swap = false) to evaluate to
6871 2003-07-27 Jim Meyering <jim@meyering.net>
6873 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
6874 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
6876 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
6877 directories, as required by POSIX. Reported by Karl Berry.
6878 * tests/rm/dir-no-w: New file. Test for the above fix.
6879 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
6881 * tests/mk-script: Emit `$xx', not its expansion.
6883 2003-07-27 Paul Eggert <eggert@twinsun.com>
6885 This change was inspired by a similar proposal by Stepan Kasal.
6886 * src/sort.c (mergelines, sortlines_temp): New functions.
6887 (sortlines): Use them, to reduce the number of times that
6888 we need to copy 'struct line' values. This improved CPU
6889 performance by about 30% on one 18 MB test.
6890 (sort): Don't invoke sortlines unless we have 2 or more lines.
6892 2003-07-26 Stepan Kasal <kasal@ucw.cz>
6894 * src/sort.c (sort): Don't require two `struct line's per text line,
6895 the new sort algorithm requires just 1.5.
6897 2003-07-27 Jim Meyering <jim@meyering.net>
6899 * src/pathchk.c (validate_path): Use %lu, not %ld.
6901 * src/cut.c (is_printable_field): Simplify bit arithmetic.
6903 * src/ls.c (sort_files): Put `volatile' in the right place.
6906 2003-07-26 Jim Meyering <jim@meyering.net>
6908 Use only one bit per field/offset in array, not one `int'.
6909 * src/cut.c (printable_field): Change type to `unsigned char'.
6910 (mark_printable_field, is_printable_field): New functions.
6911 Use them in place of all direct accesses of `printable_field'.
6913 * src/expand.c (parse_tabstops): Detect overflow properly.
6914 * src/cut.c (set_fields): Likewise.
6916 * src/rm.c: Include "dirname.h".
6917 (usage): Use base_name (program_name) in body of --help output.
6919 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
6920 Idea from Brendan O'Dea, who suggested using
6921 `program_name = basename (argv[0]);' everywhere --
6922 can't do that, but using base_name works just fine here.
6924 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
6926 2003-07-24 Paul Eggert <eggert@twinsun.com>
6928 Fix some POSIX-compliance problems with 'test'. This makes
6929 'test' more compatible with Bash.
6931 * NEWS, doc/coreutils.texi: Document the following.
6932 * src/test.c: Include exitfail.h.
6933 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
6934 (test-syntax_error): Use it.
6935 (binary_operator): Now takes bool arg specifying whether left operand
6936 is -l ARG, so that caller determines this rather than us.
6938 (term): Use posixtest to evaluate parenthesized subexpressions.
6939 (unary_operator, one_argument): Remove support for -t without operand.
6940 (one_argument): Take argument from argv[pos].
6941 (one_argument, two_arguments, three_arguments): Advance pos.
6942 All callers changed.
6943 (three_arguments): Look for binary ops before "!". Then look
6944 for parenthesized one_argument expressions, instead of trusting
6945 expr () to do the right thing.
6946 (posixtest): Now takes number of args. All callers changed.
6947 Treat "( A B )" like "A B".
6948 (main): Set exit_failure to TEST_FAILURE. Don't depend on
6949 POSIXLY_CORRECT, as we now conform to POSIX by default.
6950 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
6951 * tests/test/Test.pm (test_vector): Add several tests to check
6952 the above. Syntax errors now exit with status 2, not 1.
6953 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
6955 2003-07-26 Jim Meyering <jim@meyering.net>
6957 * tests/help-version: Adjust for above change in test behavior:
6958 `[' exits with 2, not 1, and test doesn't accept --help or --version.
6960 * Makefile.maint (ME): Don't use trick suggested in Make manual.
6961 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
6963 * Makefile.maint (sc_system_h_headers): Another syntax check.
6964 (syntax-check-rules): Add it to the list.
6966 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
6967 so it matches `%ld' format even on 32-bit systems.
6969 * src/fmt.c (flush_paragraph): Cast field width to `int' to
6970 avoid warning on 64-bit systems.
6972 * src/ls.c (sort_files): Make `func' volatile, so it can't be
6973 clobbered by a `longjmp' into this function.
6975 2003-07-25 Jim Meyering <jim@meyering.net>
6977 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
6980 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
6981 because it'd evoke spurious failure on 64-bit systems.
6983 2003-07-24 Jim Meyering <jim@meyering.net>
6985 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
6986 output its current record counts. Reported by Jurriaan.
6988 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
6989 `wc' with no options. This goes along with the change of 2003-07-20.
6991 2003-07-23 Jim Meyering <jim@meyering.net>
6993 Don't include headers already included by system.h:
6994 * src/tr.c: Don't include errno.h.
6995 * src/true.c: Don't include version-etc.h.
6996 * src/test.c: Don't include limits.h or error.h.
6997 * src/stat.c: Don't include unistd.h or time.h.
6998 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
6999 * src/pr.c: Don't include time.h.
7000 * src/pathchk.c: Don't include errno.h.
7001 * src/nice.c: Don't include sys/time.h.
7002 * src/ls.c: Don't include stdlib.h.
7004 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
7005 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
7006 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
7007 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
7008 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
7009 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
7010 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
7011 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
7012 Don't include closeout.h.
7014 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
7015 can access the required version of rm.
7016 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
7018 * tests/cut/Test.pm (out-delim3a): New test.
7020 * man/help2man: Update to version 1.33.
7022 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
7024 * src/dircolors.c: Include xstrndup.h.
7025 (xstrndup): Remove function, now that it's been factored out into
7028 2003-07-22 Paul Eggert <eggert@twinsun.com>
7030 * src/wc.c (wc): Fix typo in computation of file from file_x,
7031 which caused the former to be used uninitialized if file_x was
7034 2003-07-22 Jim Meyering <jim@meyering.net>
7036 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
7038 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
7039 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
7040 Thomas Luzat. See http://bugs.debian.org/202413 for details.
7042 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7044 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
7046 * src/cut.c (set_fields): Mark all selected indices before trying to
7047 determine range endpoints.
7048 * tests/cut/Test.pm: New test for the above fix.
7050 Begin to address this comment: What if someone wants to
7051 extract the 1,000,000-th field of some huge input file?
7052 The first step is to rearrange things so that the values
7053 in the printable_field array are all 0/1 rather than 0/1/2.
7054 * src/cut.c (RANGE_START_SENTINEL): Remove.
7055 Store range-start indices in a hash table, rather than
7056 overloading the `printable_field' array.
7057 (range_start_ht): New global.
7058 (hash_int, hash_compare_ints, is_range_start_index): New functions.
7059 (print_kth): Use is_range_start_index; don't test printable_field.
7060 (set_fields): Detect overflow.
7061 (set_fields): Insert each range-start index into range_start_ht.
7062 (main): Call set_fields only once, and only after
7063 output_delimiter_specified and (if required) range_start_ht have
7066 2003-07-20 Paul Eggert <eggert@twinsun.com>
7068 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7069 invoked with a null pointer when there were no file arguments.
7071 2003-07-20 Jim Meyering <jim@meyering.net>
7073 * Makefile.maint (sc_changelog): Add another nit-picky check.
7075 * src/wc.c (write_counts): Add a comment.
7076 (wc): Rename `file' parameter.
7077 Set new local, `file', to be the file name, or (when it's NULL)
7078 _("standard output") so that all uses of `file' use the proper value.
7079 Use STREQ, not strcmp.
7081 2003-07-20 Paul Eggert <eggert@twinsun.com>
7083 wc count field widths now are heuristically adjusted depending
7084 on the input size, if known. If only one count is printed, it
7085 is guaranteed to be printed without leading spaces.
7087 Previously, wc did not align the count fields if
7088 POSIXLY_CORRECT was set, but POSIX did not actually require
7089 this undesirable behavior, so it has been removed.
7091 * NEWS: Document this.
7092 * doc/coreutils.texi (wc invocation): Likewise.
7094 * src/wc.c (number_width): New var.
7095 (posixly_correct): Remove.
7096 (struct fstatus): New struct.
7097 (write_counts): Output fields of width number_width.
7098 Do not worry about POSIXLY_CORRECT.
7099 Use null file, not empty-string file, to denote stdin,
7100 since "" is a valid file name on some hosts.
7101 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
7103 (wc): Avoid problems if end_pos - current_pos overflows.
7104 Do not print odd message if stdin has a read error.
7105 (get_input_fstatus, compute_number_width): New functions.
7106 (main): Use them to implement the new behavior.
7107 Ignore POSIXLY_CORRECT.
7109 * tests/wc/Test.pm: Adjust to the new output widths.
7111 2003-07-19 Jim Meyering <jim@meyering.net>
7113 * tests/rm/fail-eperm: Don't create temporary directory --
7116 * tests/shred/remove: Don't open-code test for UID != 0.
7117 Use priv-check's require-non-root instead.
7118 Update to use newer framework.
7120 * tests/help-version (expected_failure_status_expr): Record that
7121 expr exits with status of 3 for e.g., a write error.
7123 * tests/priv-check: Use `id -u' to see if we're running as root,
7124 rather than trying go write to an write-protected file.
7125 When running as root, ensure $NON_ROOT_USERNAME is valid.
7126 When running as root with `require-non-root', ensure that `.'
7127 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7128 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
7130 * src/printenv.c: Include "exitfail.h".
7131 (main): Set exit_failure rather than calling close_stdout_set_status.
7132 * src/date.c: Likewise.
7133 * src/sort.c: Likewise.
7134 * src/tty.c: Likewise.
7136 2003-07-18 Jim Meyering <jim@meyering.net>
7138 * tests/touch/not-owner: Update to use newer framework.
7140 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7141 directory, and remove Perl-coded `you may not run as root' test.
7142 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7143 hard-coding something not quite equivalent.
7144 Paul Jarc reported the inconsistent diagnostics.
7146 * src/sort.c (main): Use close_stdout via atexit.
7147 Now `sort --version' and `sort --help' fail, as they should
7148 when their output is redirected to /dev/full.
7150 * src/su.c (usage): Don't call close_stdout here.
7151 (main): Use close_stdout via atexit.
7152 Now `su --version > /dev/full' fails, as it should.
7153 Somehow, the change of 2000-05-07 that purports to fix this
7156 * tests/help-version (--help/--version vs. /dev/full): Special-case
7157 `[' to protect it from expected_failure_status-`eval'.
7159 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7160 count and the corresponding line, as required by POSIX.
7161 Reported by Clement Wang.
7162 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7164 * tests/expr/basic: Add tests for when exit status is 2.
7166 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7167 Use an anonymous `enum', rather than #define.
7169 2003-07-17 Paul Eggert <eggert@twinsun.com>
7171 * src/expr.c: Include "exitfail.h", "quotearg.h".
7172 (EXPR_INVALID, EXPR_ERROR): New constants.
7173 (nomoreargs, null, toarith, nextarg): Return bool, not int.
7174 (syntax_error): New function, exiting with status 2. Use it
7175 insteading of printing "syntax error" ourselves.
7176 (main): Initialize exit_failure to EXPR_ERROR.
7177 Exit with EXPR_INVALID on syntax error (too few arguments).
7178 (nextarg): Use strcmp, not strcoll; strcoll might return
7179 an undesirable 0, or might fail.
7180 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7181 or other such error.
7182 (eval2): Report an error if strcoll fails in a string comparison.
7183 * src/sort.c: Include "exitfail.h".
7184 (main): Set exit_failure, not xalloc_exit_failure and
7185 xmemcoll_exit_failure.
7186 * tests/expr/basic: Invalid value exits with status 3, not 2.
7188 2003-07-16 Jim Meyering <jim@meyering.net>
7190 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7191 per GNU maintainer guidelines. The next non-beta release will be 5.1.
7193 This script would have caught at least two recent bugs:
7194 those in [ and kill.
7195 * tests/help-version: Revive this script.
7196 It wasn't doing anything useful, since $all_programs wasn't being
7197 defined by the invoking Makefile.am.
7198 Reflect that nohup is no longer a script, so don't exclude it.
7199 Add framework to handle the programs added since it was last run:
7200 kill, stat, unlink, [, link, readlink.
7201 Fix path-related problems deriving from the move of this script
7202 from src/ to its present location.
7203 * tests/Makefile.am (all_programs): Define.
7204 (TESTS_ENVIRONMENT): Use it.
7206 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7207 whereby kill would always attempt to operate on argv[0] and fail.
7209 * src/test.c (integer_expected_error): Improve diagnostic -- now,
7210 it also matches the one from bash's builtin test.
7211 (binary_operator): Add \n at end of diagnostic.
7213 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
7214 * tests/priv-check: Move setuidgid-related and
7215 NON_ROOT_USERNAME-checking code to this file.
7217 * README: Update section on testing as `root'.
7218 Suggestion from Paul Jarc.
7220 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7221 names of authors that I just found in bash's builtins/test.def.
7223 Running `[' with no arguments would evoke a segfault.
7224 * src/test.c (main) [LBRACKET]: Move initialization of argv to
7225 precede potential use via test_syntax_error.
7227 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7228 warning from automake -Wall.
7230 2003-07-15 Jim Meyering <jim@meyering.net>
7234 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7237 * announce-gen (print_changelog_deltas): Relax tests for matching
7238 version-number line in NEWS.
7239 Change the .sig suffix to .asc here, too.
7241 2003-07-14 Jim Meyering <jim@meyering.net>
7243 * Makefile.maint (%.asc): Renamed from %.sig.
7244 Generate and use ascii-armored signatures.
7245 Use gpg's -o option.
7247 2003-07-13 Jim Meyering <jim@meyering.net>
7249 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7252 * Makefile.maint (syntax-check): Move each individual check into
7254 (syntax-check-rules): This is the list of syntax-check targets.
7255 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7256 (sc_cast_of_x_alloc_return_value, sc_space_tab):
7257 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
7259 2003-07-12 Jim Meyering <jim@meyering.net>
7261 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7262 traces of the nohup script.
7264 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7265 $(OPTIONAL_BIN_ZCRIPTS).
7267 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7268 target, not before the `>'.
7270 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7271 now that that function no longer calls `error'.
7273 * src/df.c (find_mount_point): Emit a diagnostic for each
7274 failed syscall, rather than relying on caller to do that.
7275 The caller couldn't do a good job, anyhow -- too many different
7276 ways to fail (each with a different referent).
7277 Give a diagnostic upon failed save_cwd, now that that function
7278 no longer calls `error'.
7279 (show_point): Don't diagnose find_mount_point's errors, now that
7280 it handles them itself.
7282 * src/df.c (find_mount_point): Don't let free clobber errno upon
7285 * src/sys2.h: Remove alloca-related block.
7286 * src/system.h: Include <alloca.h> here, instead.
7288 It appears that the `#pragma alloca' included via "system.h" is
7289 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7290 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7291 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7293 * src/chown-core.c (change_file_owner): Do not restore any special
7294 permission bits (e.g., set-user-ID, set-group-ID) that are reset
7295 by chown(2) on some systems. Suggestion and insistence :-) from
7298 * tests/input-tty: Also check `test -t 1'.
7299 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
7300 test would block when run in the background.
7302 2003-07-11 Jim Meyering <jim@meyering.net>
7304 * tests/sample-test: Also fail if cat-to-create-expected-output
7305 fails. Otherwise, if both `exp' and `out' were to end up empty
7306 because of e.g., a full disk, they would mistakenly compare equal.
7308 * src/nohup.c: New file. Rewrite of nohup.sh in C.
7309 This solves a portability problem: on at least Solaris systems,
7310 when nohup.sh used the vendor /bin/sh, it would exit with status
7311 of `1' rather than the required 126 or 127 upon failure to exec
7312 the specified program.
7314 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7315 (bin_PROGRAMS): Add nohup.
7316 (EXTRA_DIST): Remove nohup.sh.
7317 (all_programs): Remove use of $(EXTRA_SCRIPTS).
7318 * src/nohup.sh: Remove file.
7319 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7321 * tests/misc/nohup: Tests for the above.
7322 * tests/misc/Makefile.am (TESTS): Add nohup.
7324 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7325 the macro, COPY_FD_DIAGNOSE.
7326 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7327 (head_file): Likewise.
7329 * src/date.c: Include "quote.h".
7330 (batch_convert): Use the quote function rather than using literal `...'
7333 * src/setuidgid.c (main): Enclose diagnostic in _(...).
7334 * src/fmt.c (main): Likewise.
7335 * src/mknod.c (main): Likewise.
7336 * src/tac.c (tac_seekable): Likewise.
7337 * src/yes.c (main): Likewise.
7338 * src/od.c (main): Likewise.
7339 * src/install.c (change_attributes): Likewise.
7341 2003-07-10 Jim Meyering <jim@meyering.net>
7343 * src/head.c (usage): Use 1024*1024 in place of 1048576.
7344 * src/tail.c (usage): Likewise.
7346 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7347 place of the kludge in this test. Suggestion from Paul Jarc.
7349 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7350 * src/setuidgid.c: New program, solely for testing (not installed).
7352 * src/chown-core.c (change_file_owner): Don't leak file descriptors
7353 when dereferencing symlinks.
7355 2003-07-09 Jim Meyering <jim@meyering.net>
7357 * tests/du/slash: New file/test for today's lib/ftw.c fix.
7358 * tests/du/Makefile.am (TESTS): Add slash
7360 * src/tail.c (xlseek): Avoid warning about ``return without value
7361 from function returning non-void''.
7363 2003-07-08 Jim Meyering <jim@meyering.net>
7365 * man/help2man: Update to version 1.29.
7367 * man/help2man: Add END handler to close STDOUT and check for errors.
7369 2003-06-30 Paul Eggert <eggert@twinsun.com>
7371 Add support for a "[" that conforms to the GNU coding standards,
7372 i.e., that does not depend on its name.
7373 * src/lbracket.c: New file.
7375 * man/Makefile.am (programs): Ignore "[", since it doesn't have
7376 a separate man page.
7377 * src/Makefile.am (bin_PROGRAMS): Add "[".
7378 (__SOURCES): New var.
7379 * src/test.c (LBRACKET): Define to 0 if not defined.
7380 (main): Use LBRACKET rather than argv[0].
7382 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7383 Reported by Paul Jarc and Dan Jacobson.
7385 * src/test.c (main): Do not recognize --help or --version if
7386 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
7387 Do not bother testing that margv[margc] is non-null.
7389 2003-07-04 Jim Meyering <jim@meyering.net>
7391 * src/who.c (print_line): Rewrite to use asprintf, in order to be
7392 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
7394 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7395 option, and perform the +1600 invocations of head IFF the envvar
7396 RUN_EXPENSIVE_TESTS is set.
7398 2003-07-03 Jim Meyering <jim@meyering.net>
7400 * src/cp.c (do_copy): Give a better diagnostic when failing due
7401 to nonexistent destination directory. Reported by Dmitry Rutsky.
7402 See http://bugs.debian.org/199730 for details.
7404 2003-06-27 Jim Meyering <jim@meyering.net>
7406 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7407 * src/split.c (longopts): Use `1', not `0' as the value for
7408 for &verbose. Reported by Keith Thompson.
7410 Test for the above fix.
7411 * tests/misc/split-a: Also use --verbose and compare stderr
7412 output with what we'd expect.
7414 2003-06-20 Jim Meyering <jim@meyering.net>
7416 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7417 Use `error_t' (rather than int) as type for local `err'.
7418 From Alfred M. Szmidt.
7420 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
7422 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7423 Fix author preservation code.
7425 2003-06-19 Jim Meyering <jim@meyering.net>
7427 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7428 (do_link): Don't warn about hard link to symlink.
7430 2003-06-18 Jim Meyering <jim@meyering.net>
7432 * src/cut.c: Include "getdelim2.h", not "getstr.h".
7433 Reflect renaming: getstr -> getdelim2.
7435 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7436 readline -> readlinebuffer.
7438 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
7440 * src/readlink.c: Include <sys/types.h> before system.h (because
7441 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
7443 2003-06-17 Jim Meyering <jim@meyering.net>
7445 * src/system.h (initialize_main): Define.
7446 Use it in every `main'. Applied via this:
7447 p='initialize_main (&argc, &argv);'
7448 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
7449 $(grep -l program_name.=.argv.0 *.c)
7450 test.c uses margc/margv, so I made the change manually for that file.
7451 Based on a patch from Bernard Giroud.
7453 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
7455 Fix for build failure on Ultrix 4.3.
7456 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7457 Include sys/param.h and sys/mount.h on ultrix.
7459 2003-06-16 Jim Meyering <jim@meyering.net>
7461 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7463 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7464 them here instead, but with one change: define EISDIR to -1, not 0.
7466 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7467 guaranteed to be defined.
7468 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7470 * README: Mention the CVS repository.
7471 Encourage addition of test cases.
7473 2003-06-12 Jim Meyering <jim@meyering.net>
7475 * src/touch.c (touch): Call close only if necessary.
7478 * src/wc.c (usage): Correct wording: wc prints counts in the order
7479 `newline, word, byte'. Reported by Keith M. Briggs.
7480 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
7482 2003-06-10 Jim Meyering <jim@meyering.net>
7484 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7486 2003-06-07 Jim Meyering <jim@meyering.net>
7488 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7491 2003-06-06 Jim Meyering <jim@meyering.net>
7493 * src/extract-magic (main): Avoid newer 3-arg form of open,
7494 so this script works also with e.g., perl5.005_03.
7495 Patch by John David Anglin.
7497 2003-06-04 Paul Eggert <eggert@twinsun.com>
7499 * src/system.h: Include <stdbool.h> unconditionally.
7501 2003-06-04 Jim Meyering <jim@meyering.net>
7503 * man/Makefile.am (check-programs-vs-x): Rename target
7504 from check-programs-vs-1. Adjust rule to check for the
7505 primary (.x) file, not the generated one (.1).
7507 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7509 * man/kill.x: New file.
7510 * man/Makefile.am (dist_man_MANS): Add kill.1.
7513 2003-06-04 Jim Meyering <jim@meyering.net>
7515 Ensure that the .x file for a new program is never forgotten again.
7516 * man/Makefile.am (programs): Define.
7517 (check-programs-vs-1): New phony target.
7518 (check-local): Depend on it.
7520 2003-06-03 Jim Meyering <jim@meyering.net>
7522 Avoid unnecessary copying of environment.
7523 * src/env.c (main): Rather than clearing the environment and --
7524 unless told to ignore environment -- copying all settings from
7525 the saved, original environment, clear the environment only when
7526 that is requested. Suggested by Jens Elkner.
7528 2003-06-02 Jim Meyering <jim@meyering.net>
7530 * src/system.h: Always include <string.h>, since we assume C89.
7531 Include <limits.h> without checking for HAVE_LIMITS_H.
7533 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7534 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7536 2003-06-01 Jim Meyering <jim@meyering.net>
7538 Avoid a race condition in `tail -f' described by Ken Raeburn in
7539 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7540 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7541 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7542 (tail_bytes, tail_lines, tail): Likewise.
7543 (tail_file): Use the new `read_pos' value as the size,
7544 rather than stats.st_size from the fstat call.
7546 2003-05-28 Jim Meyering <jim@meyering.net>
7548 * src/extract-magic: Allow expansion of `$file' in the here-
7549 document corresponding to the comment at the top of fs.h.
7551 2003-05-26 Jim Meyering <jim@meyering.net>
7553 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7554 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7555 Use #if/#elif/... cascade so we get only one set of include files.
7556 Reported by Nelson Beebe.
7558 2003-05-24 Jim Meyering <jim@meyering.net>
7560 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7561 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7562 accept the BSD format.
7564 2003-03-28 Joe Orton <jorton@redhat.com>
7566 * src/md5sum.c (bsd_split_3): New function.
7567 (split_3): Detect checksums from BSD 'md5' command and handle them
7570 * tests/md5sum/basic-1: New tests for --check exit status, and for
7571 BSD-style checksum files.
7573 2003-05-21 Jim Meyering <jim@meyering.net>
7575 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7576 This sort of thing is why it'd be *Really Good* to factor
7577 out the common code used here and in tail.c.
7579 2003-05-14 Jim Meyering <jim@meyering.net>
7581 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7583 * tests/du/slink: Skip this test if `.' is on an XFS file system.
7585 * tests/du/fd-leak: New file. Test for the bug in du that
7586 was fixed by the 2003-05-12 change to lib/ftw.c.
7587 * tests/du/Makefile.am (TESTS): Add fd-leak.
7589 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7590 includes a translatable word, `and'.
7592 * src/dd.c (usage): Don't use `,' as the thousands separator
7593 in e.g. 1,000,000 and 1,048,576. Instead, do this:
7594 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7595 * src/df.c (usage): Likewise.
7596 * src/du.c (usage): Likewise.
7597 * src/ls.c (usage): Likewise.
7599 * Makefile.maint (syntax-check): Add another check.
7601 2003-05-13 Paul Eggert <eggert@twinsun.com>
7603 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7604 must output nothing. Problem reported by Josh Hyman.
7606 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7607 (output_unique, output_first_repeated, output_later_repeated):
7608 New vars. All uses of "mode" changed to use these variables,
7609 which are not mutually exclusive as "mode" was.
7610 (writeline): New arg "match", used to control whether to
7611 obey output_first_repeated or output_later_repeated.
7612 All callers changed.
7613 (check_file, main): Adjust to above changes.
7615 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7617 2003-05-14 Jim Meyering <jim@meyering.net>
7619 * tests/rm/rm3: Use tr's \n notation rather than \012.
7620 This package can afford to do that, since its tests are guaranteed use
7621 GNU tr, which has accepted the more modern notation for 10 years.
7622 * tests/rm/rm5: Likewise.
7623 * tests/cp/same-file: Likewise.
7624 * tests/stty/row-col-1: Likewise.
7625 * tests/stty/basic-1: Likewise.
7626 * tests/rm/deep-1: Likewise.
7627 * tests/mv/part-symlink: Likewise.
7628 * tests/mkdir/perm: Likewise.
7629 * tests/misc/nice: Likewise.
7631 2003-05-13 Jim Meyering <jim@meyering.net>
7633 * src/copy.c (struct F_triple) [name]: Remove const attribute.
7634 (triple_free): Don't apply cast to argument of free.
7635 (seen_file): Add cast here instead.
7637 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7638 (src_to_dest_free): Don't apply cast to argument of free.
7640 * src/sort.c (zaptemp): Don't apply cast to argument of free.
7641 * src/pr.c (init_fps, init_store_cols): Likewise.
7642 * src/join.c (delseq, freeline): Likewise.
7643 * src/expr.c (OLD): Likewise.
7644 * src/sort.c (sort): Likewise.
7645 * src/head.c (elide_tail_lines_pipe): Likewise.
7647 * src/tail.c: Include "quote.h".
7648 Use quote in diagnostics. Change many error format strings
7649 from just `%s' to e.g., `error reading %s'.
7650 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7651 Rewrite newline-counting loop to use memchr.
7653 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7654 Now that assert is no longer used, don't include <assert.h>.
7656 2003-05-12 Jim Meyering <jim@meyering.net>
7658 * src/head.c: Include <assert.h>.
7659 (AUTHORS): Add my name.
7660 (elide_tail_lines_pipe): New function.
7662 2003-05-10 Jim Meyering <jim@meyering.net>
7664 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7666 * src/readlink.c (main): Set program_name before first use.
7667 Remove that (redundant) first use.
7668 Don't exit successfully just because --verbose was specified.
7669 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7670 parameter is 0, error does not exit.
7672 * src/uname.c (main): When failing due to too many arguments, also say
7673 that, rather than just "Try `uname --help' for more information.".
7674 * src/comm.c (main): Likewise, but for too few arguments.
7675 * src/logname.c: Include error.h.
7676 (main): Say why we're failing.
7678 * src/uniq.c (main): Don't segfault when argc < optind.
7679 * src/who.c (main): Handle argc < optind.
7680 * src/df.c (main): Likewise.
7681 * src/install.c (main): Likewise.
7682 * src/mv.c (main): Likewise.
7683 * src/pwd.c (main): Likewise.
7684 * src/tty.c (main): Likewise.
7685 * src/chroot.c (main): Likewise.
7686 * src/hostname.c: Likewise.
7687 * src/du.c (main): Likewise.
7688 * src/expand.c (main): Likewise.
7689 * src/env.c (main): Likewise.
7690 * src/unexpand.c (main): Likewise.
7691 * src/printenv.c (main): Likewise.
7692 * src/sync.c (main): Handle argc == 0.
7693 * src/expr.c (main): Likewise.
7694 * src/printf.c (main): Likewise.
7695 * src/basename.c (main): Likewise.
7696 * src/ln.c (main): Test for `missing argument' before computing n_files.
7697 * src/tail.c (main): Test for the case of no arguments before
7700 * src/kill.c (send_signals): Don't check command line arguments here.
7701 (main): Check them here instead. Handle argc < optind.
7703 * src/logname.c (main): Use error, rather than fprintf, for the sake
7706 * src/rm.c (main): Don't overrun array bound if argc is 0.
7708 2003-05-09 Jim Meyering <jim@meyering.net>
7710 * src/sort.c (main): Don't overrun array bound if argc is 0.
7711 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7712 Reported by Wartan Hachaturow.
7714 2003-05-07 Jim Meyering <jim@meyering.net>
7716 Implement support so that `head --lines=-N' works on seekable files.
7717 * src/head.c (enum Copy_fd_status): Define.
7718 (COPY_FD_DIAGNOSE): New macro.
7719 (elide_tail_lines_seekable): New funtion.
7720 (elide_tail_lines_file): Call it here.
7722 2003-05-06 Jim Meyering <jim@meyering.net>
7724 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7726 2003-05-04 Jim Meyering <jim@meyering.net>
7728 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7729 caused the addition of thousands of small files to the tar archive.
7730 * tests/misc/head-elide-tail: New file. Add them here instead.
7731 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7733 2003-05-04 Paul Eggert <eggert@twinsun.com>
7735 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7736 (IF_READDIR_NEEDS_REWINDDIR): Remove.
7737 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7738 which was a bit weird because it couldn't be emulated by a function.
7740 2003-05-03 Jim Meyering <jim@meyering.net>
7742 Extend head to accept --lines=-N (--bytes=-N) and to print all
7743 but the N lines (bytes) at the end of the file.
7744 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7745 Use quote() in diagnostics, rather than literal `' marks.
7746 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7748 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7749 (head_file): Reorganize so as to call head from only one place.
7750 (main): Likewise, for head_file.
7751 Handle new, undocumented option, --presume-input-pipe.
7752 Handle negative line and byte counts.
7753 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7755 * tests/du/8gb: Skip test if the file system of `.' doesn't support
7756 sparse files -- otherwise it'd create a file of size 8GB.
7758 2003-05-02 Jim Meyering <jim@meyering.net>
7760 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7761 Instead explain about `-' and standard input.
7762 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7763 Reported by Keith Thompson.
7764 * tests/fmt/basic: Add test for the above fix.
7766 * src/fmt.c: Include "quote.h".
7767 Use quote() in diagnostics, rather than literal `' marks.
7768 (main): Exit nonzero when unable to open an input file.
7769 * tests/fmt/basic: Add test for the above fix.
7771 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7772 specifications like `-72x'.
7773 * tests/fmt/basic: Add test for the above fix.
7775 Work around nasty readdir bug on Darwin6.5.
7776 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7777 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7778 returned NULL and there has been at least one successful unlink or
7779 rmdir call since the opendir or previous rewinddir, then call
7780 rewinddir and reiterate the loop.
7782 Factor out common code.
7783 * src/remove.c (readdir_ignoring_dotdirs): New function.
7784 (is_empty_dir): Use it here.
7785 (remove_cwd_entries): Use it here.
7787 2003-05-01 Jim Meyering <jim@meyering.net>
7789 * tests/rm/r-3: Create 500 rather than just 300 files.
7790 There's a bug in Darwin6.5's readdir that shows up only with
7792 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7796 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7797 (dump_remainder): Move two declarations `down' into the scope
7798 where they are used.
7799 (xlseek): Return the resulting offset.
7800 (file_lines): Rename parameter, file_length, to end_pos.
7801 (pipe_lines): Don't coerce safe_read return value to `int'.
7802 Adapt tests accordingly.
7803 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7805 Change type of `total_bytes' from `int' to `size_t',
7806 since the former wouldn't always be wide enough.
7807 Don't coerce safe_read return value to `int',
7808 and adapt tests accordingly.
7809 Now that testing for a read error no longer involves
7810 using `tmp', handle that case *after* freeing `tmp'.
7811 (start_bytes): Clean up.
7812 (tail_bytes): Now that `n_bytes' may be larger than
7813 OFF_T_MAX, test for that condition and, if it's true, don't
7814 use lseek optimizations.
7815 (parse_options): Don't fail just because N_UNITS is larger than
7816 the maximum size of a file -- tail may be applied to an input
7817 stream (e.g., a pipe) with more data than that.
7819 * Makefile.maint (syntax-check): Rename from alloc-check.
7820 Also check for SPACE-TAB sequences.
7821 Also check for malloc/calloc/realloc casts.
7823 2003-05-01 Jim Meyering <jim@meyering.net>
7825 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
7827 2003-04-28 Jim Meyering <jim@meyering.net>
7829 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7830 make the now-more-picky tsort fail.
7832 2003-04-24 Jim Meyering <jim@meyering.net>
7834 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
7835 (main): Minor syntactic clean-up.
7837 * src/tsort.c (tsort): Fail if the input contains an odd number of
7838 tokens. Reported by junkio@cox.net.
7840 * tests/tsort/basic-1: Test for the above fix.
7842 2003-04-21 Jim Meyering <jim@meyering.net>
7844 * tests/misc/printf: Add tests for the printf fixes below.
7846 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
7848 2003-04-20 Paul Eggert <eggert@twinsun.com>
7850 Fix printf POSIX compatibility bug reported by Ben Harris in
7851 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
7852 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
7853 \0NNN in the %b operand.
7854 * src/printf.c (usage): Likewise.
7855 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
7856 is desired. All uses changed. Behave like Bash printf if %b
7857 operand uses \NNN where the initial N is not 0.
7859 2003-04-17 Jim Meyering <jim@meyering.net>
7861 * src/stty.c: Remove uses of PROTOTYPE macro.
7863 2003-04-15 Jim Meyering <jim@meyering.net>
7865 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
7866 each sequence of spaces before a TAB character.
7868 2003-04-13 Jim Meyering <jim@meyering.net>
7870 * src/remove.c (is_empty_dir): Don't closedir (NULL).
7872 2003-04-12 Jim Meyering <jim@meyering.net>
7874 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
7875 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
7876 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
7877 * src/nl.c (main): Fix those problems and remove literal quote marks
7878 (e.g., "`%s'") from format string; instead use "%s" in each format
7879 string and `quote (optarg)' as the corresponding argument.
7880 Also, diagnose all invalid command line options before failing.
7882 * src/nl.c (proc_text): Fix a bug that would make nl output extra
7883 newlines in some cases. Details here: http://bugs.debian.org/177256.
7884 This bug was introduced on 2001-11-10 for textutils-2.0.17.
7885 * tests/misc/nl: Add test for the above-fixed bug.
7887 * tests/misc/readlink: New file. Test the --canonicalize option.
7888 * tests/misc/Makefile.am (TESTS): Add readlink.
7890 2003-04-11 Jim Meyering <jim@meyering.net>
7893 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
7894 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
7895 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
7896 retain alignment) each sequence of spaces before a TAB character.
7898 * src/ls.c: Include <stdlib.h> unconditionally.
7900 * Makefile.maint (xalloc-check): Rename from header-check.
7902 * src/yes.c: Include error.h after system.h, not before.
7905 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
7906 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
7907 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
7908 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
7909 * src/tr.c: * src/unexpand.c, src/users.c:
7910 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
7911 return values and of xrealloc's first argument.
7912 Fix the former with this:
7913 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
7915 2003-04-10 Jim Meyering <jim@meyering.net>
7917 * src/stty.c (wrapf): Declare with format attribute.
7919 The S_MAGIC_... names shouldn't be maintained in two places (prior
7920 to this change, one would have to keep stat.c and fs.h in sync).
7921 This change makes it so those names and the corresponding
7922 hexadecimal constants all reside in stat.c. fs.h is now generated.
7923 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
7924 (BUILT_SOURCES): Add fs.h, now that it's generated.
7925 (EXTRA_DIST): Add extract-magic.
7926 * src/extract-magic: New script to extract fs.h definitions from stat.c.
7927 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
7928 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
7930 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
7931 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
7933 * man/unexpand.x: Add `SEE ALSO' reference to expand.
7934 * man/expand.x: Add `SEE ALSO' reference to unexpand.
7935 Suggestion from Dan Jacobson.
7937 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
7939 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
7940 * src/stat.c (human_fstype): Handle Linux's devpts.
7942 2003-04-09 Paul Eggert <eggert@twinsun.com>
7944 * src/split.c (line_bytes_split): Arg is of type size_t, since
7945 that's all that is supported for now.
7946 (main): Check for overflow in obsolescent line count option.
7948 2003-04-09 Jim Meyering <jim@meyering.net>
7950 * tests/misc/split-fail: Add a new test for the above fix.
7952 * src/split.c (bytes_split): Use size_t temporary (rather than
7953 uintmax_t original) in remaining computations. From Paul Eggert.
7955 Handle command line option arguments larger than 2^31.
7956 This allows e.g., splitting into files of size 2GB and larger,
7957 and running split --lines=N with N=2^31 or more.
7958 But for --line-bytes=N, the restriction that N <= SIZE_MAX
7959 remains (for now), due to the way it is implemented.
7961 * src/split.c: Include "inttostr.h".
7962 (bytes_split, lines_split, line_bytes_split, main):
7963 Use uintmax_t, not size_t, for file sizes.
7964 (main): Give a better diagnostic for option arguments == 0.
7965 Use umaxtostr to print file sizes.
7966 Reported by Luke Hassell.
7968 2003-04-08 Jim Meyering <jim@meyering.net>
7970 * src/rm.c (usage): Mention that --directory (-d) works only
7971 on some systems. Suggestion from Samuel Tardieu.
7973 * tests/basename/basic: Run $PERL to see if it is available,
7974 rather than testing its value.
7975 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
7976 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
7977 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
7978 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
7979 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
7980 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
7981 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
7982 * tests/sum/basic-1, tests/seq/basic: Likewise.
7984 * tests/misc/Makefile.am (TESTS): Add split-fail.
7985 * tests/misc/split-fail: New file.
7987 * src/split.c: Rename local variables: nchars -> n_bytes.
7988 (lines_split): Rename local, nlines -> n_lines.
7989 (main): Rename local variable: s/accum/n_units/.
7990 (main): Use STDIN_FILENO, not literal `0'.
7992 2003-04-07 Jim Meyering <jim@meyering.net>
7994 * src/stat.c: Add #include directives for Ultrix 4.4.
7995 Based on a suggested change from Bert Deknuydt.
7997 2003-04-06 Jim Meyering <jim@meyering.net>
7999 * Makefile.maint (makefile-check): New rule.
8000 (local-check): Add it.
8002 2003-04-05 Jim Meyering <jim@meyering.net>
8004 * Makefile.am (nearly all of them):
8005 Use $(VAR) rather than @VAR@, now that we can rely on automake to
8006 emit a definition for each substituted variable.
8007 * tests/Makefile.am.in: Likewise.
8009 * tests/rm/rm5: Add a comment explaining why this test fails when
8010 using Tru64's broken sed.
8011 * tests/rm/rm3: Likewise.
8013 Make `kill -t' output signal descriptions (not `?') on Tru64.
8014 * src/kill.c (sys_siglist): Also check for __sys_siglist.
8015 Patch by Tony Leneis.
8016 * configure.ac: Also check for declaration of __sys_siglist.
8017 Required for Tru64 4.0D, 4.0F, and 5.1.
8018 Reported by Tony Leneis.
8020 2003-04-04 Jim Meyering <jim@meyering.net>
8022 * src/Makefile.am (PERL): Remove unnecessary definition.
8024 Because of inappropriate (but POSIX-mandated) behavior of rename,
8025 `mv a b' would not remove `a' in some unusual cases. Work around
8026 this by unlinking `a' when necessary.
8028 * src/copy.c (same_file_ok): Add an output parameter.
8029 Set it in the offending case.
8030 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
8031 Reported by Ed Avis.
8032 * tests/mv/hard-4: New test for the above.
8033 * tests/mv/Makefile.am (TESTS): Add hard-4.
8035 Clean up rules for automatically generated sources:
8036 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
8037 Make each generated file be read-only.
8038 Add each file name to BUILT_SOURCES separately.
8039 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8041 Put LOCALEDIR macro definition in new file: localedir.h.
8042 * src/Makefile.am (DEFS): Remove definition.
8043 (localedir.h): New rule.
8044 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8045 * src/system.h: Include "localedir.h".
8047 2003-04-02 Jim Meyering <jim@meyering.net>
8051 * tests/misc/Makefile.am (TESTS): Add false.
8053 * Makefile.maint (TMPDIR): Make sure it's defined.
8054 (my-distcheck): Build in $(TMPDIR), not `.'.
8056 * src/Makefile.am (false.c): Change all occurrences of
8057 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8058 unsuccessfully also with --help. Reported by Paul Jarc,
8059 * tests/misc/false: New test for the above.
8061 2003-03-30 Jim Meyering <jim@meyering.net>
8063 * NEWS: Note the location of older NEWS files.
8065 * src/remove.c (is_empty_dir): Don't let a failing closedir
8066 clobber errno. Spotted by Arnold Robbins.
8068 * src/env.c: Fix typo in comment. From Arnold Robbins.
8070 2003-03-29 Jim Meyering <jim@meyering.net>
8074 * README: Note to expect build problems for stat.c on Ultrix 4.3.
8075 Note that there are some harmless test failures when running
8076 `make check' as root on some systems.
8078 2003-03-28 Jim Meyering <jim@meyering.net>
8080 * tests/stty/row-col-1: Skip this test if stty can't get window size.
8081 This happens when connecting to sparc-solaris5.7 via ssh from within
8082 emacs. Reported by Karl Berry.
8084 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8085 Otherwise, on systems (DJGPP) that emulate pipes using files,
8086 this test would never complete, waiting for `yes' to terminate.
8087 * tests/du/slink: As above, use seq, not `yes' to generate link target.
8088 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8089 Reported by Rich Dawe.
8091 2003-03-27 Jim Meyering <jim@meyering.net>
8093 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8094 from `written by...' comment, at his request.
8096 2003-03-24 Paul Eggert <eggert@twinsun.com>
8098 Fix buffer overrun problem reported by TAKAI Kousuke, along
8099 with some other POSIX incompatibilities.
8101 * src/printf.c (print_esc): Do not treat \x specially if
8102 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
8103 in backslash. Treat incomplete escape sequences as strings
8104 of characters, as POSIX requires.
8105 (print_formatted): Allow multiple flags. Avoid buffer overrun
8106 if the format is incomplete.
8108 2003-03-24 Jim Meyering <jim@meyering.net>
8110 * tests/misc/printf: Add tests for the above fixes and changes.
8112 2003-03-26 Jim Meyering <jim@meyering.net>
8114 * src/copy.h (struct cp_options): Add a comment.
8116 2003-03-23 Jim Meyering <jim@meyering.net>
8118 * README: Describe problem with 64-bit mode on HPUX 11.x,
8119 with patch for /usr/include/inttypes.h.
8120 * TODO: Plan to add an autoconf test to work around the bug.
8122 2003-03-22 Jim Meyering <jim@meyering.net>
8124 * src/stat.c: Don't include <sys/sysmacros.h>.
8125 That is already done via system.h. Otherwise, the multiple
8126 inclusion would evoke redefinition warnings from Cray's /bin/cc,
8127 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
8128 (human_fstype): Factor some directives `up', out of this function.
8129 Cast away `const' to avoid error from Cray's /bin/cc.
8131 2003-03-20 Jim Meyering <jim@meyering.net>
8133 * announce-gen (print_changelog_deltas): Ensure that a newline
8134 precedes each row of `*'s.
8136 2003-03-20 Jim Meyering <jim@meyering.net>
8140 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8141 format flag characters.
8142 Do not require that a field width be specified.
8143 Do not fail when given a field width of `0'.
8144 Reported by Dan Jacobson.
8145 * tests/seq/basic: Add new tests for the above-fixed bug.
8147 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8148 (install-root): Likewise.
8149 (install-exec-local): Likewise.
8150 Based on a patch from Richard Dawe.
8152 2003-03-19 Jim Meyering <jim@meyering.net>
8154 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8155 because the DJGPP 2.03 port of 'ln -s' doesn't work.
8156 Include $(EXEEXT) in program names.
8157 Since $(LN_S) may degenerate to `cp -p', be careful
8158 to invoke it from the destination directory.
8159 Mostly from Richard Dawe.
8160 * configure.ac: Use AC_PROG_LN_S.
8162 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
8163 CDPATH shell variable set could cause this test to fail.
8164 Reported by Karl Berry.
8166 2003-03-18 Jim Meyering <jim@meyering.net>
8168 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8169 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8170 AIX 5.1's xlc could not compile the former.
8171 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
8173 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
8175 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8176 program names, since automake only adds $(EXEEXT) to programs
8179 2003-03-16 Jim Meyering <jim@meyering.net>
8181 * src/remove.c (rm): Put two local variables in static storage,
8182 so they can't be clobbered by the potential longjmp.
8184 2003-03-15 Jim Meyering <jim@meyering.net>
8186 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8187 so that a version number with a two-digit component can still count
8188 as an alpha release. Reported by Richard A Downing.
8189 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8191 2003-03-14 Jim Meyering <jim@meyering.net>
8193 * src/ansi2knr.c: Remove no-longer-used file.
8194 * src/ansi2knr.1: Likewise.
8196 * Makefile.maint (prev_version_file): Don't use ?= for this particular
8197 assignment, since it causes trouble with old versions of GNU make
8198 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
8199 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8200 Patch from Alexandre Duret-Lutz.
8202 * Use patched automake-1.7.3. Regenerate Makefile.in files in
8203 subdirectories so that each includes a definition of ACLOCAL_M4.
8205 * announce-gen (main): Label the compressed source URLs.
8209 * tests/du/slink: Relax the test for the `local'ness of a file system,
8210 so that now it works also for tmpfs.
8212 * tests/du/hard-link: Transform output from first du, so that this
8213 test doesn't fail on file systems like tmpfs that order directory
8214 entries differently.
8216 2003-03-13 Jim Meyering <jim@meyering.net>
8218 * tests/du/8gb: Work around what appears to be an NFS failure that
8219 would make this test fail on some systems.
8221 2003-03-11 Jim Meyering <jim@meyering.net>
8223 * tests/du/basic: Make the test file exactly 4k bytes long.
8225 * src/split.c (longopts): Don't hard-code `2' here.
8226 Instead, just specify `&verbose', and ...
8227 (main): ... remove the `case 2:' block for --verbose.
8229 * tests/du/basic: Make the test file larger than 64 bytes, so that
8230 we don't immediately disqualify file systems (e.g., NetApp) on which
8231 smaller files take up zero disk blocks. Reported by Vin Shelton.
8233 2003-03-10 Jim Meyering <jim@meyering.net>
8235 Don't segfault for a negative field width or precision in format string.
8236 Note that this is just a stopgap fix. The longer term solution may
8237 involve adapting bash's builtins/printf.def.
8239 * src/printf.c: (UNSPECIFIED): Define.
8240 (print_direc): Use the special value, UNSPECIFIED, to indicate
8241 that field_width or precision has not been specified.
8242 (print_formatted): Fail if field_width or precision is the
8243 special value, UNSPECIFIED.
8244 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8246 * src/sys2.h (INT_MIN): Define, if necessary.
8247 * tests/misc/printf: Add a test for the above-fixed bug.
8249 2003-03-09 Jim Meyering <jim@meyering.net>
8251 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8252 changing its sign. This avoids a warning from gcc on 64-bit systems.
8253 Reported by Bob Proulx.
8254 (pop_dir): Reverse order of sign change and cast, to be consistent
8257 2003-03-08 Jim Meyering <jim@meyering.net>
8259 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8260 shell variable, but only in the environment. With /bin/sh->bash, the
8261 shell variable is set to `y', and that would cause a spurious warning.
8262 Reported by Bob Proulx.
8264 * tests/Makefile.am (check-root): Remove touch/fifo.
8265 It doesn't appear to have to be run as root.
8267 * tests/rm/fail-2eperm: Rather than simply using the first non-root
8268 user name, make sure that the selected user name has a usable shell.
8269 Reported by Paul Jarc.
8271 Before, when using shred on a device, one had to specify --exact,
8272 or be careful to choose a size that would not be rounded up and
8273 exceed the maximum value; that could result in a failure of
8275 * src/shred.c (do_wipefd): --exact is now the default for non-regular
8276 files. Suggestion from Ben Elliston.
8279 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8280 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8281 Patch by Bob Proulx.
8283 * src/Makefile.am (check-misc): Check for use of `defined' in
8285 Change to $(srcdir) before running grep.
8287 * src/sleep.c: Remove now-unused #include and #define directives.
8289 * src/du.c (process_file): If a file's size is not being counted
8290 e.g., because it's a hard link to a file we've already counted,
8291 then don't print a line for it.
8293 * tests/du/hard-link: New test for the above-fixed bug.
8294 * tests/du/Makefile.am (TESTS): Add hard-link.
8297 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8298 and make the two-array approach work.
8300 * tests/du/basic: Correct/add tests for the above fix.
8301 Set LC_ALL, etc., now that we use sort.
8302 Check the block/size of a small file, too.
8303 Correct expected results for simple dir1/dir2/file case.
8304 Add another test of du -S.
8306 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
8308 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8309 middle-end/9986). As one of GCC's optimizations, it transforms a
8310 fputs_unlocked call to a fputc_unlocked call when the string is
8311 one character long. However, hpux doesn't have fputc_unlocked.
8313 * expr.c (usage): Use putchar, not fputs, to output a single character.
8314 * ls.c (dired_dump_obstack): Likewise.
8315 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8316 * stat.c (print_it): Likewise.
8318 2003-03-07 Jim Meyering <jim@meyering.net>
8320 * src/cp.c: Remove everything associated with mmap-stack.c.
8321 This reverts the two changes of 2003-02-21.
8322 * src/du.c: Remove everything associated with mmap-stack.c.
8323 This reverts the change of 2003-02-19.
8325 2003-03-06 Jim Meyering <jim@meyering.net>
8327 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
8328 CDPATH shell variable set could cause this test to fail.
8329 Reported by Karl Berry.
8331 2003-03-05 Jim Meyering <jim@meyering.net>
8335 * src/printf.c (print_esc): Remove pointless comparison of unsigned
8336 integer with zero, to avoid a warning from Intel's ecc.
8337 Reported by Nelson Beebe.
8339 * src/du.c (process_file): Sizes must all be of type uintmax_t.
8340 Otherwise, for files or totals that are too big, numbers would
8341 be truncated. Patch mostly by Michael Stone.
8342 Reported by Ingo Saitz as Debian bug #183210.
8344 * tests/du/8gb: New test for the above-fixed bug.
8345 * tests/du/Makefile.am (TESTS): Add 8gb.
8347 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8348 rather than UTILS_OPEN_MAX - 10.
8350 2003-03-04 Jim Meyering <jim@meyering.net>
8352 * README: Refer new feature discussion to bug-coreutils@gnu.org,
8353 rather than bug-gnu-utils, now that the former is better known.
8354 Suggestion from Göran Uddeborg.
8356 * src/stat.c (usage): Capitalize consistently.
8357 Reported by Göran Uddeborg.
8359 * Makefile.maint (rel-files): Include $(signatures), so that
8360 those files are also copied into $(release_archive_dir).
8362 * src/df.c (find_mount_point): Call error here, now that restore_cwd
8364 * src/remove.c (AD_pop_and_chdir): Likewise.
8366 * tests/Makefile.am (check-root): Add fail-2eperm.
8368 2003-03-03 Jim Meyering <jim@meyering.net>
8370 * src/remove.c (remove_cwd_entries): Include the full filename of
8371 the offending file, not just the basename.
8373 * tests/misc/tty-eof: Set $ME properly.
8375 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8376 Remove now-unused variables.
8377 (tag-prev-version, prev-cvs-tag): Likewise.
8379 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8380 accurate diagnostic when failing to remove a file owned by some other
8381 user. Reported by Ivo Timmermans via Michael Stone.
8382 This fixes Debian bug# 178471.
8384 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8385 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8386 Based on a report from Ivo Timmermans.
8388 2003-03-02 Jim Meyering <jim@meyering.net>
8390 * src/copy.c (copy_internal) [un_backup]: When recovering from a
8391 failure to create a hard link, do not remove the entry associating
8392 the source dev/ino with the destination file name.
8393 * tests/mv/Makefile.am (TESTS): Add hard-3.
8394 * tests/mv/hard-3: New test, for the above-fixed bug.
8395 Inspired by a report from Iida Yosiaki.
8397 2003-03-01 Jim Meyering <jim@meyering.net>
8399 * src/df.c (print_header): Don't embed spaces in a separate `Type'
8400 header string. Instead, put `Filesystem' and `Type' headers in the
8401 same string, so translators can use horizontal space as needed.
8402 Reported by Jean Charles Delepine.
8404 2003-02-28 Jim Meyering <jim@meyering.net>
8406 * src/copy.c (copy_internal): When link fails because of an
8407 existing destination file, unlink that file and try again.
8408 Reported by Iida Yosiaki.
8410 * tests/mv/Makefile.am (TESTS): Add hard-2.
8411 * tests/mv/hard-2: New test for the above-fixed bug.
8412 Based on a test case from Iida Yosiaki.
8414 2003-02-26 Jim Meyering <jim@meyering.net>
8416 * tests/du/basic: Don't test du's -b option here. Directory byte
8417 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8418 and IBM AIX 4.2. Reported by Nelson Beebe.
8420 2003-02-25 Jim Meyering <jim@meyering.net>
8422 * Makefile.maint (announcement): Now that ChangeLog entries
8423 are output by announce-gen, don't do it here.
8424 * announce-gen (print_changelog_deltas): New function.
8427 2003-02-22 Jim Meyering <jim@meyering.net>
8429 * announce-gen: New option: --release-type=TYPE
8430 * Makefile.maint (beta, major): New targets. Remove `release'.
8431 Put them all together on a line.
8432 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8433 invocation of `announcement'.
8434 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8436 * announce-gen: New option: --news=NEWS_FILE.
8437 Extract NEWS entries here, not via rules in Makefile.maint.
8438 * Makefile.maint (announcement): Now that NEWS entries are
8439 extracted by announce-gen, don't do it here.
8440 (news-r1, news-r2): Remove now-unused definitions.
8442 2003-02-21 Jim Meyering <jim@meyering.net>
8446 Merge in changes from autoconf's version of this file.
8447 * Makefile.maint (www-gnu): Define.
8448 (standards.texi-url_prefix): Use $(www-gnu).
8449 (make-stds.texi-url_prefix): Likewise.
8451 * src/cp.c: Include "mmap-stack.h".
8452 (main): Invoke `run' through a macro that (when possible) runs it
8453 with a large, mmap'd stack.
8455 * src/cp.c (run): New function, preparing for the above.
8456 Exit from this function, not from main
8459 * src/du.c: New option: --apparent-size.
8460 (enum) [APPARENT_SIZE_OPTION]: New member.
8461 (long_options): Add it.
8462 (usage): Describe it.
8464 ['b']: Set apparent_size.
8465 David Eisner reported that the behavior of --bytes had changed.
8466 Paul Eggert proposed the use of a new option, --apparent-size.
8468 * src/du.c (apparent_size): New global.
8469 (print_only_size): Reflect the fact that we're printing byte counts,
8470 not ST_NBLOCKSIZE-byte-block counts.
8471 (print_size): Call print_only_size rather than duplicating its code.
8472 (process_file): Accumulate byte counts, rather than block counts.
8474 * src/du.c (process_file): Always reset size_to_propagate_to_parent
8475 for --separate-dirs (-S).
8477 2003-02-20 Jim Meyering <jim@meyering.net>
8479 * Use automake-1.7.3. Regenerate dependent files.
8481 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8482 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8483 (usage) [%B]: Describe it.
8486 * src/du.c (process_file): Reorganize the code to use only
8487 one `sum' array, and change how -S works back to the way it was
8488 before 2003-01-31. Patch by Bruno Haible.
8490 * tests/du/basic: New test.
8491 * tests/du/Makefile.am (TESTS): Add basic.
8493 * tests/envvar-check: Add checks for the following:
8494 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8496 * tests/Makefile.am: Rename phony target envvar-check to evar-check
8497 so as not to conflict with the distributed file by the same name.
8499 * src/du.c (process_file): Set info->skip before any possible return.
8501 Report correct usage for directories, not 0.
8502 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8503 _before_ recording the dev/ino of a directory.
8504 Reported by Bruno Haible.
8506 Now, df always displays the device file name corresponding to the
8507 listed mount point under `Filesystem'. Before, for an unmounted
8508 block- or character-special file argument, it would display the
8509 command-line argument instead.
8510 * src/df.c (show_disk): Return a value indicating whether
8511 there was a match. Don't try to find a mount point here.
8512 (show_entry): If show_disk doesn't find a match, call show_point.
8514 2003-02-19 Jim Meyering <jim@meyering.net>
8516 * src/du.c: Include "mmap-stack.h".
8517 (du_files): Add prototype with ATTRIBUTE_NORETURN.
8518 Exit from this function, not from...
8520 Instead, if possible, invoke du_files through a macro that
8521 runs it with a large, mmap'd stack.
8523 * src/join.c (usage): Change wording in --help output:
8524 use FILENUM instead of `SIDE' and say what FILENUM means.
8525 Reported by Bernhard Gabler.
8527 * src/df.c (print_header): Rather than using a hard-coded literal
8528 string of spaces matching the length of the English `...Type' header,
8529 output the right number of spaces to match the selected translation.
8530 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8532 * src/split.c (bytes_split): Remove unnecessary `else' after break.
8533 (lines_split): Likewise. and correct misleading indentation.
8535 * src/split.c: Include "full-read.h".
8536 (bytes_split, lines_split, line_bytes_split): Use full_read,
8537 not safe_read. The way split was using the latter, a short read
8538 could cause split to terminate before EOF.
8540 * tests/misc/tty-eof: Test all programs that can read stdin,
8541 requiring no arguments and that write to standard output.
8543 * tests/misc/tty-eof: New file. Renamed from ...
8544 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
8545 * tests/misc/Makefile.am (TESTS): Reflect renaming.
8547 2003-02-18 Jim Meyering <jim@meyering.net>
8549 cksum would perform an extra read after encountering EOF
8550 * src/cksum.c (cksum): Exit the loop upon EOF, too.
8551 Patch by Michael Bacarella.
8553 Test for the bug fixed today in cksum, md5sum, and sha1sum.
8554 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8555 cat, cksum, md5sum, and sha1sum all in the same loop.
8557 2003-02-14 Jim Meyering <jim@meyering.net>
8559 * src/remove.c: Include "euidaccess.h".
8560 Remove declaration of euidaccess.
8562 2003-02-12 Jim Meyering <jim@meyering.net>
8564 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8565 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
8567 2003-02-10 Jim Meyering <jim@meyering.net>
8569 * src/test.c: Don't include group-member.h.
8570 Include euidaccess.h.
8571 (eaccess): Rewrite function to set the real uid and gid temporarily
8572 to the effective uid and gid, then invoke 'access', and then set the
8573 real uid and gid back. On systems that lack setreuid or setregid,
8574 fall back on the kludges in euidaccess. Before, it would not work
8575 for e.g., files with ACLs, files that were marked immutable,
8576 or on file systems mounted read-only. Nelson Beebe raised the issue.
8577 Paul Eggert suggested the new implementation.
8579 2003-02-09 Jim Meyering <jim@meyering.net>
8581 * src/test.c (test_stat): Remove function. It's job is done (only
8582 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
8584 2003-02-08 Jim Meyering <jim@meyering.net>
8588 * tests/mv/part-symlink: Don't assume that the file owner username
8589 length is less than 9 in ls output: instead, omit that field
8590 altogether. Reported by, and suggested fix from, Ferdinand.
8592 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8593 * tests/du/Makefile.am (TESTS): Add restore-wd.
8595 * src/rm.c: Correct now-invalid comment about cycle-detection.
8597 2003-02-06 Jim Meyering <jim@meyering.net>
8599 * NEWS: Add entries from old/*/NEWS
8600 from fileutils-4.1 through 4.1.11 and
8601 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
8605 * src/du.c (process_file): Don't return early for excluded files
8606 or for files whose dev/inode we've already seen.
8608 2003-02-05 Jim Meyering <jim@meyering.net>
8610 * tests/du/exclude: New file.
8611 * tests/du/Makefile.am (TESTS): Add exclude.
8613 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
8615 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8616 Fix memory allocation arithmetic.
8618 2003-02-04 Jim Meyering <jim@meyering.net>
8620 `df /dev/block-or-char-device-file--not-mounted' now reports
8621 the name of the file system on which the file resides, usually `/'.
8622 Before, it would leave the `Mounted on' field blank.
8623 * src/df.c (show_disk): Move function to precede find_mount_point.
8624 (show_disk): Add parameter: STATP.
8625 If we don't find a matching device name, then resort to calling
8626 find_mount_point. Reported by Bob Proulx.
8628 2003-02-03 Andreas Schwab <schwab@suse.de>
8630 * tests/rm/cycle: Require non-root.
8631 * tests/rm/isatty: Likewise.
8633 2003-02-02 Jim Meyering <jim@meyering.net>
8637 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8639 Ensure that there are no offending uses of `:'.
8640 * Makefile.maint (makefile_path_separator_check): New rule.
8641 (local-check): Add it to the list.
8643 2003-02-01 Jim Meyering <jim@meyering.net>
8645 * src/du.c (MAX_N_DESCRIPTORS): Define.
8647 * src/stat.c (G_fail): New global.
8648 (human_time): Diagnose failed localtime, not failed nstrftime.
8649 (main): Fail if G_fail is set.
8651 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
8653 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8654 hard-coding the path-separator. Also double-quote the new PATH,
8655 to avoid problems when the path-separator is a semi-colon or when
8656 `pwd` contains e.g. a space.
8657 * tests/chgrp/Makefile.am: Likewise.
8658 * tests/chmod/Makefile.am: Likewise.
8659 * tests/chown/Makefile.am: Likewise.
8660 * tests/cp/Makefile.am: Likewise.
8661 * tests/dd/Makefile.am: Likewise.
8662 * tests/dircolors/Makefile.am: Likewise.
8663 * tests/du/Makefile.am: Likewise.
8664 * tests/expr/Makefile.am: Likewise.
8665 * tests/factor/Makefile.am: Likewise.
8666 * tests/fmt/Makefile.am: Likewise.
8667 * tests/install/Makefile.am: Likewise.
8668 * tests/ln/Makefile.am: Likewise.
8669 * tests/ls/Makefile.am: Likewise.
8670 * tests/ls-2/Makefile.am: Likewise.
8671 * tests/md5sum/Makefile.am: Likewise.
8672 * tests/misc/Makefile.am: Likewise.
8673 * tests/mkdir/Makefile.am: Likewise.
8674 * tests/mv/Makefile.am: Likewise.
8675 * tests/od/Makefile.am: Likewise.
8676 * tests/rm/Makefile.am: Likewise.
8677 * tests/rmdir/Makefile.am: Likewise.
8678 * tests/seq/Makefile.am: Likewise.
8679 * tests/sha1sum/Makefile.am: Likewise.
8680 * tests/shred/Makefile.am: Likewise.
8681 * tests/stty/Makefile.am: Likewise.
8682 * tests/sum/Makefile.am: Likewise.
8683 * tests/tail-2/Makefile.am: Likewise.
8684 * tests/touch/Makefile.am: Likewise.
8685 * tests/tsort/Makefile.am: Likewise.
8686 * tests/unexpand/Makefile.am: Likewise.
8688 2003-01-31 Jim Meyering <jim@meyering.net>
8690 * src/stat.c: Include "file-type.h"
8691 (print_human_type): Remove function.
8692 (human_access): Rename from print_human_access. Return a string.
8693 (human_time): Rename from print_human_time. Return a string.
8694 (print_stat): Arrange so that field width and an alignment specifier
8695 are honored for the %A, %F, %x, %y, and %z formats.
8696 [%F]: Use file_type; this gives slightly different file type strings,
8697 e.g., `directory' instead of `Directory' and `regular file' or
8698 `regular empty file' instead of `Regular file'.
8699 Prompted by a report from Richard Dawe that the uses of
8700 S_IFSOCK and S_IFIFO in print_human_time were not portable
8701 to systems using e.g., DJGPP.
8703 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
8705 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8706 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
8708 2003-01-31 Jim Meyering <jim@meyering.net>
8710 * src/du.c (main): Upon processing an invalid option or an invalid
8711 --exclude-from or --max-depth option argument, don't exit right away,
8712 in case there are others. Rather record the failure and exit after
8713 processing other options.
8715 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8716 tar archive easier to reproduce.
8718 Rewrite to perform directory traversal using nftw.
8720 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8721 (AUTHORS): Add self.
8722 (opt_one_file_system): Move global into `main'.
8723 (path, xstat, exit_status): Remove declarations.
8724 (arg_length, suffix_length): New globals.
8725 (G_fail): New global, sort of like the old `exit_status'.
8726 (IS_FTW_DIR_TYPE): Define.
8727 (print_only_size): New function.
8728 (process_file): New function.
8729 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8730 (str_trunc, pop_dir, count_entry): Likewise.
8731 (du_files): Rewrite to use nftw.
8733 2003-01-30 Jim Meyering <jim@meyering.net>
8735 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8736 symlink-to-directory with -L, even without the trailing slash.
8738 2003-01-27 Jim Meyering <jim@meyering.net>
8740 * src/Makefile.am (check-misc): Check for st_blocks, too.
8742 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8743 Reported by Richard Dawe.
8745 2003-01-27 Andreas Schwab <schwab@suse.de>
8747 * src/ls.c (quote_name): Add fourth parameter, width, into which to
8748 store the screen columns, and return the number of bytes instead.
8749 (print_dir): Pass NULL as fourth parameter of quote_name.
8750 (print_name_with_quoting): Likewise.
8751 (length_of_file_name_and_frills): Get the width from the fourth
8752 parameter of quote_name instead of return value.
8754 2003-01-27 Jim Meyering <jim@meyering.net>
8756 * src/ls.c (decode_switches): If `dired' is set without
8757 `format == long_format', then silently reset dired. This doesn't
8758 change the behavior of ls (all prior uses of dired were protected
8759 by `&& format == long_format'), and lets us...
8760 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8761 (PUSH_CURRENT_DIRED_POS): Likewise.
8764 2003-01-22 Jim Meyering <jim@meyering.net>
8766 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8767 * tests/du/Makefile.am (TESTS): Add no-x.
8769 2003-01-21 Jim Meyering <jim@meyering.net>
8771 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8772 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8773 it may still be a directory -- or not (e.g., with FreeBSD on an
8774 NFS-mounted file system), so resort to calling lstat to find out.
8775 Based on a patch by Michael van Elst.
8777 * tests/cp/same-file: Don't assume that the file owner username
8778 length is less than 9 in ls output: instead, omit that field
8779 altogether. Reported by, and suggested fix from, Ferdinand.
8781 2003-01-20 Jim Meyering <jim@meyering.net>
8783 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8784 large format widths no longer cause strftime to infloop.
8786 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8788 2003-01-19 Jim Meyering <jim@meyering.net>
8790 * src/readlink.c: Include "canonicalize.h".
8792 2003-01-18 Jim Meyering <jim@meyering.net>
8794 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8796 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8797 (long_options): Add option --dereference-command-line-symlink-to-dir.
8798 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8799 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8800 -d, -F, -l options is specified.
8801 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8802 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8803 Change --dereference-command-line (-H) to dereference *all*
8804 command line arguments, including broken symlinks.
8806 2003-01-15 Paul Eggert <eggert@twinsun.com>
8808 Change ls -H back to the way it was yesterday, since this is
8809 compatible with FreeBSD and the POSIX spec is confusing
8810 and somewhat contradictory.
8812 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8813 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8814 (long_options): Change the long option name back.
8815 (usage): Change the usage back.
8816 (gobble_file): When -H is specified, dereference a top-level
8817 arg even if it points to a non-directory.
8819 2003-01-15 Jim Meyering <jim@meyering.net>
8821 * src/ls.c (gobble_file): Fall back on using lstat when required:
8822 when --dereference (-L) is not specified, and
8823 - when operating on a dangling symlink
8824 - when operating on command-line-symlink-to-directories
8825 This fixes numerous problems. Here are examples:
8826 - `ls dangling-symlink' would fail with `no such file...'
8827 Now it prints `dangling-symlink'.
8828 - `ls -i symlink' would mistakenly print the inode of the referent.
8829 Now it prints the inode of the symlink. Likewise for --size (-s).
8830 Based on a patch from Michael Stone.
8831 Reported by Deepak Goel as Debian bug #173793.
8833 Rename ls's --dereference-command-line (-H)
8834 option to --dereference-command-line-symlink-to-dir.
8835 * src/ls.c [enum Dereference_symlink]
8836 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
8837 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
8838 (long_options): Rename the long option.
8839 (usage): Say that --dereference-... changes how ls treats
8840 only symlinks to directories specified on the command line.
8842 2003-01-14 Jim Meyering <jim@meyering.net>
8844 * tests/ls/dangle: New file/test, for the above fix.
8845 * tests/ls/inode: Another new file/test, for the above fix.
8846 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
8848 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
8849 so that ls --color would no longer highlight the names of files with
8850 the execute bit set when not specified on the command line.
8851 Patch by Michael Stone. Reported by Stephen Depooter as
8854 * tests/ls-2/tests (color-exe): New test, for the above fix.
8856 2003-01-13 Jim Meyering <jim@meyering.net>
8858 * tests/shred/exact: Also test for just fixed bug with --zero.
8860 * src/shred.c (long_opts): --zero does not require an argument.
8861 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
8863 2003-01-12 Jim Meyering <jim@meyering.net>
8865 * Makefile.maint (cvs-update): Skip any file with local modifications.
8867 * src/unexpand.c (usage): Document --first-only and mention that
8868 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
8870 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
8872 * src/df.c: Include "canonicalize.h".
8873 Use canonicalize_file_name unconditionally.
8875 2003-01-09 Jim Meyering <jim@meyering.net>
8877 * README: Add readlink.
8879 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
8881 * src/df.c: Include "xgetcwd.h".
8882 * src/pwd.c: Likewise.
8884 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
8886 * src/shred.c: Remove declaration of xstrdup.
8887 We already get it via xalloc.h which is included via system.h.
8889 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
8891 New program: readlink.
8893 * src/Makefile.am (bin_PROGRAMS): Add readlink.
8894 * src/readlink.c: New file.
8896 * man/readlink.x: New file.
8897 * man/Makefile.am (dist_man_MANS): Add readlink.1.
8898 (readlink.1): New rule.
8900 2003-01-09 Jim Meyering <jim@meyering.net>
8902 When selecting ranges of byte offsets (as opposed to ranges of fields)
8903 and when --output-delimiter=STRING is specified, output STRING between
8904 ranges of selected bytes.
8905 * src/cut.c (RANGE_START_SENTINEL): Define.
8906 (output_delimiter_specified): New global.
8907 (print_kth): Add parameter. Adjust all callers.
8908 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
8909 (cut_bytes): When requested, output STRING between ranges of
8911 (main): Make a diagnostic a little clearer.
8912 Based on a patch from Jan Nieuwenhuizen.
8914 * tests/cut/Test.pm: New tests for the above.
8916 * src/cut.c (set_fields): Make code agree with comment:
8917 Don't merge abutting ranges like 4- and 2-3. This makes no
8918 difference currently, but is required to support an upcoming change.
8920 2003-01-07 Jim Meyering <jim@meyering.net>
8922 * src/cut.c (set_fields): Fix typo in comment.
8924 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
8925 * tests/touch/Makefile.am (TESTS): Add not-owner.
8926 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
8927 Now, this tests only the nonexistent-directory diagnostic.
8928 Suggestion from Michael Stone.
8930 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
8932 2003-01-04 Jim Meyering <jim@meyering.net>
8934 * src/copy.h: Remove use of PARAMS.
8935 * src/remove.h: Likewise.
8936 * src/chown-core.h: Likewise.
8938 rm could be tricked into mistakenly reporting a cycle.
8939 * src/remove.c: [cycle_check_state]: New global.
8940 (remove_cwd_entries): Adapt to new semantics of cycle_check.
8941 (rm): Call cycle_check_init and cycle_check_free for each file.
8942 * tests/rm/cycle (rm): New test, for the above fix.
8943 * tests/rm/Makefile.am (TESTS): Add cycle.
8945 When rm detects a cycle, don't abort the entire command,
8946 but rather just the affected command line argument.
8947 * src/remove.c: Include <setjmp.h>
8948 (struct dirstack_state) [current_arg_jumpbuf]: New member.
8949 (remove_cwd_entries): Call longjmp if we detect a cycle.
8950 (rm): Call setjmp here.
8952 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
8953 Instead, include cycle-check.h and use it.
8955 * src/remove.h (struct dev_ino): Remove declaration.
8957 * src/remove.c (remove_cwd_entries): Fix typos in comment.
8959 Don't include trailing /. in diagnostics about directories.
8960 * src/remove.c (full_filename_): When FILENAME is just `.'
8961 and there is a nonempty directory-name part, don't append `/.'.
8962 * tests/rm/unread2: Remove trailing /. from diagnostic.
8963 * tests/rm/rm2: Likewise.
8965 * src/remove.c (struct dirstack_state): Define.
8966 To be used in place of these file-scoped globals ...
8967 (dir_stack, len_stack, Active_dir): Remove globals.
8968 (ds_init, ds_free): New functions.
8969 (full_filename): Define.
8970 (full_filename_): Rename from full_filename.
8972 Begin to make AD_* functions more generic.
8973 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
8974 (AD_push): Likewise.
8975 (AD_INIT_OTHER_MEMBERS): Define.
8976 (remove_dir): Define the `status' member manually after each
8977 call to AD_push or AD_push_initial.
8979 * src/Makefile.am (check-misc): New rule, to ensure that no more
8980 S_IS* macro definitions sneak into the code.
8981 (check): Depend on check-misc.
8983 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
8984 * src/du.c (count_entry) [S_ISLNK]: Don't define.
8985 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
8987 2003-01-03 Jim Meyering <jim@meyering.net>
8989 * src/true.c: Add copyright.
8990 (AUTHORS): I suppose I've written it.
8992 * src/Makefile.am (false.c): Make the generated file be read-only.
8994 2003-01-04 Jim Meyering <jim@meyering.net>
8996 * src/ls.c: Include "dev-ino.h".
8997 [struct dev_ino]: Remove declaration.
8999 2003-01-02 Jim Meyering <jim@meyering.net>
9001 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
9002 from mv: s/missing file arguments/missing file argument/.
9003 With --target-directory=DIR, cp and mv work with a single file argument.
9004 Reported by Karl Berry.
9006 * tests/rm/isatty: Enable this test.
9008 2002-12-31 Jim Meyering <jim@meyering.net>
9010 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9011 (AD_push): Likewise.
9012 (AD_INIT_OTHER_MEMBERS): Define.
9013 (remove_dir): Define the `status' member manually after each
9014 call to AD_push or AD_push_initial.
9016 * src/ls.c [struct dev_ino]: Remove definition.
9017 Include "dev-ino.h" instead.
9019 2002-12-28 Jim Meyering <jim@meyering.net>
9021 * tests/du/Makefile.am (TESTS): Add no-deref.
9022 * tests/du/no-deref: New script.
9024 2002-12-23 Jim Meyering <jim@meyering.net>
9026 * src/remove.c (remove_cwd_entries): Fix typo in comment.
9028 2002-12-21 Jim Meyering <jim@meyering.net>
9030 * announce-gen: Generate MML-formatted announcement.
9031 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
9033 2002-12-20 Jim Meyering <jim@meyering.net>
9035 * src/touch.c (touch): Change the wording of a diagnostic so
9036 that it makes sense both when the file exists and when it doesn't.
9037 Suggestion from Michael Stone.
9039 2002-12-18 Jim Meyering <jim@meyering.net>
9041 * src/stty.c (valid_options): Declare to be static.
9043 2002-12-15 Jim Meyering <jim@meyering.net>
9045 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9047 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9048 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9049 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9050 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9051 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9053 * src/remove.c (PARAMS): Remove definition.
9054 * src/sys2.h: Likewise.
9056 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9057 Include strftime.h instead.
9059 2002-12-14 Jim Meyering <jim@meyering.net>
9061 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9063 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9064 This is necessary at least for Irix6.5 when using c89.
9065 Reported by Nelson Beebe.
9067 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9069 * tests/misc/cat-tty-eof: New test.
9071 * src/mknod.c (usage): Specify how major and minor mode numbers
9072 are interpreted. Report forwarded by Kristin E Thomas.
9073 * src/mknod.c: Remove now-redundant usage-specifying comment.
9075 2002-12-13 Jim Meyering <jim@meyering.net>
9079 * tests/du/trailing-slash: Allow for a directory of size `0'.
9080 That happens at least on file systems of type tmpfs on linux-2.4.18.
9082 * announce-gen: New script to begin replacing the commands
9083 associated with the rule here...
9084 * Makefile.maint (announcement): Invoke announce-gen.
9085 * Makefile.am (EXTRA_DIST): Add announce-gen.
9087 * tests/cp/preserve-2: New file/test, for latest fix.
9088 * tests/cp/Makefile.am (TESTS): Add preserve-2.
9090 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
9092 Fix a bug whereby cp would fail to parse an option like
9093 --preserve=mode,ownership.
9094 * src/cp.c (decode_preserve_arg): Advance `comma' to
9095 point the character following the comma.
9097 2002-12-11 Jim Meyering <jim@meyering.net>
9099 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9100 in case it's already defined.
9102 2002-12-09 Jim Meyering <jim@meyering.net>
9104 * tests/touch/fail-diag: Don't get a test failure if /no exists.
9105 Instead, evoke a framework failure if /no-$$ exists.
9106 Reported by Michael Stone.
9108 2002-12-08 Jim Meyering <jim@meyering.net>
9110 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9111 Define to rpl_lstat, so that even on systems like Solaris 5.8,
9112 du honors (per POSIX) the trailing slash on an argument referring
9113 to a symlink-to-directory.
9115 2002-12-06 Jim Meyering <jim@meyering.net>
9117 * Use autoconf-2.57. Regenerate dependent files.
9118 * Use automake-1.7.2. Regenerate dependent files.
9120 * src/ls.c (gobble_file): Also stat the file if it's a
9121 regular file and --indicator-style=classify (aka -F).
9122 Thanks to Ed Santiago for opening my eyes.
9124 * tests/ls/file-type: New file. Test for the above.
9125 A test to contrast ls -F and ls --indicator-style=file-type.
9126 * tests/ls/Makefile.am (TESTS): Add file-type.
9128 2002-12-04 Jim Meyering <jim@meyering.net>
9130 * tests/ls/follow-slink: Make sure the symlink was created.
9131 Richard Dawe reported that `ln -s link link' succeeds, but creates
9132 no file on systems running some version of the DJGPP libc.
9134 2002-12-03 Jim Meyering <jim@meyering.net>
9136 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9137 since this package no longer panders to K&R compilers.
9139 2002-12-02 Jim Meyering <jim@meyering.net>
9141 * tests/du/slink: Skip this test if `.' is on a non-local file system.
9143 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9144 something to replace.
9146 2002-12-01 Jim Meyering <jim@meyering.net>
9148 * src/stat.c: Don't include <string.h> or <ctype.h>.
9149 That's already done via system.h.
9150 * src/dircolors.c: Don't include <ctype.h>.
9152 2002-11-30 Jim Meyering <jim@meyering.net>
9154 * ls.c (gobble_file): Remove the block of code that caused
9155 `ls --color -F symlink-to-dir' to list the files in
9156 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
9157 like `ls -F symlink-to-dir') but with the addition of highlighting.
9158 Similarly, `ls --color -dF symlink-to-dir' would print
9159 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
9160 Reported by Jeff Sheinberg as Debian bug #168203.
9161 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9163 ls is now more efficient: with certain options, it no longer needs
9164 to stat each directory entry on systems with valid dirent.d_type.
9165 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9166 (main): Make --recursive set format_needs_type, not format_needs_stat.
9167 (gobble_file): Remove a FIXME comment, now that it's fixed.
9169 2002-11-24 Jim Meyering <jim@meyering.net>
9171 * src/du.c (du_files): Don't strip any trailing slash.
9172 Rewrite so that `/' is no longer represented internally as
9174 (count_entry): When appending a file name component,
9175 account for the fact that the current path may end in `/'.
9176 François Pinard reported that `du symlink-to-dir/' was not
9177 equivalent to `du symlink-to-dir/.'. Now it is.
9178 * tests/du/trailing-slash: New file/test, for the above fix.
9179 * tests/du/Makefile.am (TESTS): Add trailing-slash.
9181 2002-11-23 Jim Meyering <jim@meyering.net>
9183 * src/tac.c (output): Declare some local variables to be of type size_t,
9184 rather than `int' to avoid warnings from gcc.
9186 2002-11-21 Paul Eggert <eggert@twinsun.com>
9188 * src/ls.c (decode_switches): Use case-sensitive matching to
9189 decode the QUOTING_STYLE environment variable. This is more
9190 consistent with the documentation, and with --quoting-style.
9192 2002-11-21 Martin Buck <martin.buck@ascom.ch
9194 * src/stty.c (struct speeds): Add support for all baud rates defined
9197 2002-11-19 Jim Meyering <jim@meyering.net>
9199 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9200 run in a UTF locale. Report and suggested fix by Bruno Haible.
9201 * tests/fmt/basic: Likewise.
9203 2002-11-17 Jim Meyering <jim@meyering.net>
9205 * configure.ac: Update via autoupdate.
9206 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9208 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9209 Reported by Hans Ginzel.
9211 2002-11-15 Jim Meyering <jim@meyering.net>
9213 * Makefile.cfg (gnu_rel_host): Define.
9214 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9215 on whether $(VERSION) looks like a major release number.
9217 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9218 (release): Rename from `alpha'.
9219 (alpha): Depend on release.
9221 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9223 2002-11-14 Jim Meyering <jim@meyering.net>
9225 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9226 (announcement): Use the new variable.
9228 * Makefile.maint: Sync with Bison, i.e.:
9229 (po-check): Scan .l and .y files instead of the
9230 .c and the .h files that they generate. This fixes the bug
9231 reported by Tim Van Holder in:
9232 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9233 Look for N_ as well as for _. Try to avoid matching #define for
9237 2002-11-12 Jim Meyering <jim@meyering.net>
9239 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9240 Replace sole use with equivalent `#ifdef S_ISLNK'.
9241 Inconsistency reported by Dmitry V. Levin.
9243 2002-11-11 Jim Meyering <jim@meyering.net>
9245 * src/stat.c (usage): Transform --help items output via s/ - / /,
9246 so that help2man produces properly formatted man pages.
9247 Reported by Herbert Xu as Debian bug #168400.
9249 2002-11-10 Jim Meyering <jim@meyering.net>
9251 * src/ls.c (sighandler): Handle SIGTSTP specially.
9252 Based on suggestions from Solar Designer and Dmitry V. Levin.
9255 * Makefile.cfg (cvs_files): Define. From autoconf.
9256 (local_updates): Likewise.
9258 * src/ls.c (restore_default_color_handler, sigtstp_handler):
9260 (sighandler): New function, based on the one in sort.c.
9261 (main): Use sigaction, if possible; otherwise signal.
9262 Handle these signals:
9263 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9264 Don't register our handler if the signal is already being ignored.
9266 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9267 * src/csplit.c (interrupt_handler): Likewise.
9268 * src/sort.c (sighandler): Likewise.
9269 (main): Declare `i' and `nsigs' to be unsigned, not int.
9271 2002-11-09 Jim Meyering <jim@meyering.net>
9273 ls --color: restore terminal text color upon signal.
9274 * src/ls.c: Include "full-write.h" and <signal.h>.
9275 (restore_default_color, restore_default_color_handler): New functions.
9276 (sigtstp_handler, put_indicator_direct): New functions.
9277 (main) [print_with_color]: Register signal handlers.
9278 Patch mostly by Solar Designer and Stanislav Ievlev.
9280 Update from autoconf.
9281 * Makefile.maint (AMTAR): Remove definition.
9282 (update, cvs-update, po-update, do-po-update): New rules.
9283 (wget-update): Update (thus renaming to cvs-update).
9284 (automake_repo): Use anoncvs@sources.redhat.com.
9286 2002-11-06 Jim Meyering <jim@meyering.net>
9288 * tests/misc/Makefile.am (TESTS): Add printf-hex.
9290 * tests/misc/printf: Be careful to test the code in this package,
9291 not the shell built-in function.
9293 * src/printf.c (print_esc): A hexadecimal escape sequence has
9294 at most two hex. digits, not three. Reported by Padraig Brady.
9295 (usage): Update description.
9296 * tests/misc/printf-hex: New file/test, for the above fix.
9298 2002-10-07 Paul Eggert <eggert@twinsun.com>
9300 Add support for locale-specific size indications (e.g.,
9301 thousands-separators) and for explicit size suffixes on output.
9303 * doc/coreutils.texi (Block size): Say that:
9304 This affects display format as well as block size.
9305 Fractional block counts are rounded up.
9306 ls file size blocksize defaults to 1.
9307 A block size spec preceded by ' generates thousands separators.
9308 A suffix without a preceding integer generates suffixes.
9309 (tail invocation): 32k -> 32 KiB.
9310 (What information is listed): ls -h is now equivalent to
9311 ls --block-size=human, and ls -H is now equivalent to
9312 ls --block-size=si. Displayed file size is now always affected by
9315 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9316 lib/umaxtostr.c: New files, taken from GNU tar.
9318 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9320 (EXTRA_DIST): Add inttostr.c.
9322 * lib/human.c, lib/human.h: Rewrite to support locale-specific
9323 notations like thousands separators.
9324 Specify what includer of include.h must include beforehand.
9325 (human_group_digits, human_suppress_point_zero, human_autoscale,
9326 human_base_1024, human_SI, human_B): New enum values.
9327 (human_readable): Rename from human_readable_inexact; put the
9328 options before the sizes. All uses changed. The old human_readable
9329 function has been removed; use inttostr.h instead.
9330 (human_options): Renamed from human_block_size, with new signature
9331 that allows block sizes up to UINTMAX_MAX. All callers changed.
9333 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9334 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
9335 freestanding C89. No need to check for stdlib.h or string.h since
9336 autoconf does this now.
9338 * src/cksum.c (cksum): Use primitives from inttostr.h, not
9339 human.h, to print large numbers simply.
9340 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9341 * src/dd.c (print_stats, main): Likewise.
9342 * src/df.c (print_header): Likewise.
9343 * src/factor.c (print_factors): Likewise.
9344 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9345 * src/shred.c (dopass): Likewise.
9346 * src/sort.c (checkfp): Likewise.
9347 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9348 * src/tail.c (xlseek): Likewise.
9349 * src/wc.c (write_counts, wc): Likewise.
9351 * src/df.c (human_output_opts): New var.
9352 (output_block_size): Now uintmax_t, not int, to handle larger
9353 block sizes. All uses changed.
9354 * src/du.c: Likewise.
9355 * src/ls.c: Likewise.
9357 * src/df.c (print_header): In the header line, prefer SI to human
9358 representation if it's shorter; if neither is shorter, try to
9359 intuit what the user would prefer.
9361 * src/expr.c (inttostr): Remove; use new imaxtostr library
9364 * src/ls.c (file_output_block_size): New var, to distinguish
9365 file sizes from other sizes.
9366 (decode_switches): Set it.
9368 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9369 (dopass): When printing progress, use floor for what has been done
9370 so far (since we should be conservative there), and ceiling for
9371 what needs to be done (since that's what other programs use).
9373 2002-10-19 Jim Meyering <jim@meyering.net>
9375 * src/pinky.c (print_heading): Align TTY and Name headings.
9376 Reported by Karl Eichwalder.
9378 2002-10-18 Jim Meyering <jim@meyering.net>
9380 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9381 Remove now-useless cast.
9382 (stdread): Remove function.
9383 (bytes_split): Use size_t instead of int.
9384 Use safe_read, not stdread.
9385 (lines_split): Likewise.
9386 Use memchr rather than a `while' loop.
9387 (line_bytes_split): Use size_t instead of int.
9388 Use safe_read, not stdread.
9389 (main): Add some FIXME comments to remind me to remove casts.
9391 * src/system.h (ST_BLKSIZE): Correct comment describing how to
9392 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
9394 2002-10-17 Jim Meyering <jim@meyering.net>
9396 Fix a problem that could make e.g., `cat' misbehave on systems which
9397 give invalid (unreasonably large) values for stat.st_blksize.
9398 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9399 Reported by Petter Reinholdtsen.
9401 2002-10-14 Jim Meyering <jim@meyering.net>
9403 Specifying a printf conversion specifer as nl's separator string
9404 could cause nl to segfault.
9405 * src/nl.c (build_print_fmt): Don't include separator string
9406 in the printf format; it might contain `%'.
9407 Use a better bound on the length of the print_fmt buffer.
9408 (print_lineno): Print the separator here instead.
9409 Reported by Doug Coleman.
9411 * tests/misc/nl: New file/tests, including a test for the above.
9412 * tests/misc/Makefile.am (TESTS): Add nl.
9414 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9415 * tests/misc/Makefile.am (TESTS): Add split-l.
9417 2002-10-13 Jim Meyering <jim@meyering.net>
9421 * src/du.c (usage): Tweak description of --dereference-args/-D.
9423 * src/du.c (count_entry): Also save cwd when dereferencing (via
9424 --dereference-args, -D) a command-line argument.
9425 Reported by Michal Svec. Based on a patch by Andreas Schwab.
9427 * src/Makefile.am (../AUTHORS): New target/rule.
9429 2002-10-12 Jim Meyering <jim@meyering.net>
9431 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9432 of type size_t, since that's the way it's used and avoids a warning.
9434 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9435 since that's how it's always used and avoids a new warning from gcc.
9436 (read_input): Adapt to new safe_read ABI.
9438 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9441 * src/pinky.c (print_long_entry): fread returns size_t.
9442 Declare local `bytes' accordingly, to avoid warning.
9444 tail -c +N would perform an extra read after encountering EOF
9445 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9446 * src/tail.c (start_bytes): Detect EOF, inform caller.
9447 (tail_bytes): Upon EOF in start_bytes, return immediately.
9448 (file_lines): Reorganize to use memrchr rather than an explicit loop.
9449 Adapt to new safe_read ABI.
9451 2002-10-11 Jim Meyering <jim@meyering.net>
9453 * tests/du/deref: New file/test, for the above fix.
9454 * tests/du/Makefile.am (TESTS): Add deref.
9456 2002-10-10 Jim Meyering <jim@meyering.net>
9458 * tests/ln/Makefile.am (TESTS): Add target-1.
9459 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9461 2002-10-09 Jim Meyering <jim@meyering.net>
9463 * tests/cp/backup-is-src: Ensure that certain environment variables
9464 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
9466 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9467 consume 4GB of disk space on systems without support for sparse files.
9468 Fix a logic error that'd make it `cat err' even though dd didn't fail.
9470 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9471 Patch by steven@magelico.net, forwarded by Michael Stone.
9473 * tests/ls/dired: Ensure that ls produces English messages.
9474 Patch by Alexey Vyskubov, forwarded by Michael Stone.
9476 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
9478 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9480 2002-10-08 Jim Meyering <jim@meyering.net>
9482 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9483 Fix syntax in test: use =, not ==.
9484 Reported by Bob Proulx.
9485 Change all the rest like this: grep -lR "testing framework'" .\
9486 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9488 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9489 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9490 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9491 * src/wc.c (wc): Likewise.
9493 2002-10-07 Paul Eggert <eggert@twinsun.com>
9496 Don't advance the write pointer past the end of the write buffer.
9497 * src/sort.c (begfield, limfield): Likewise.
9499 2002-10-07 Jim Meyering <jim@meyering.net>
9501 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9502 * src/head.c (head_bytes, head_lines): Likewise.
9504 2002-10-06 Jim Meyering <jim@meyering.net>
9506 * src/dd.c (scanargs): Ensure that specified block sizes (specified
9507 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9508 (skip, dd_copy): Adapt to new safe_read ABI.
9510 * Makefile.maint (signatures): Define.
9512 (announcement): Depend on $(signatures).
9514 * Makefile.maint (announcement): Output all URLs for detached
9515 signatures, not just the last one from the previous loop.
9517 2002-10-05 Jim Meyering <jim@meyering.net>
9521 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9522 don't recurse into directory, DIR. Prompted by a report from
9525 * tests/rm/i-no-r: New file/test, for the above fix.
9526 * tests/rm/Makefile.am (TESTS): Add i-no-r.
9528 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9529 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9531 2002-10-03 Jim Meyering <jim@meyering.net>
9533 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9534 * src/df.c (AUTHORS): Likewise.
9535 * src/du.c (AUTHORS): Likewise.
9536 * src/tail.c (AUTHORS): Likewise.
9537 * src/touch.c (AUTHORS): Likewise.
9539 2002-10-02 Jim Meyering <jim@meyering.net>
9541 * Makefile.am (SUBDIRS): Remove `old'.
9542 (EXTRA_DIST): List the files in old/.
9543 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9544 Suggestion from Akim Demaille.
9546 2002-10-01 Jim Meyering <jim@meyering.net>
9548 * src/sys2.h (SSIZE_MAX): Define.
9550 2002-09-30 Jim Meyering <jim@meyering.net>
9552 * src/csplit.c: Don't include stdlib.h here. It's already included
9555 2002-09-29 Jim Meyering <jim@meyering.net>
9557 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9558 expression to avoid bogus warning from gcc.
9560 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9561 (cat): Declare insize and outsize to be of type size_t, not int.
9562 Rearrange pointer/integer expressions to avoid bogus warnings.
9563 (main): Declare insize and outsize to be of type size_t, not int.
9565 * src/tail.c (parse_options): Give a sensible diagnostic for
9566 an invalid byte or line count. Reported by Mikko Tuumanen.
9568 * src/touch.c (main): Split a long line.
9570 * tests/du/Makefile.am (TESTS): Add slink.
9571 * tests/du/slink: New test for system.h change of 2002-08-31.
9573 In move mode, always first try to rename. Before, upon failure to
9574 rename a directory, this code would never attempt to rename any
9575 other file in that directory, but would thenceforth always copy.
9576 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9577 may fail with EXDEV, yet renaming files within that directory to
9578 a newly-created destination directory succeeds.
9579 * src/copy.c (copy_internal): Remove local, move_mode;
9580 use x->move_mode instead. Based on a patch from Tom Haynes.
9582 2002-09-28 Jim Meyering <jim@meyering.net>
9584 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9585 Factor out some duplication.
9587 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9589 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9591 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9592 to avoid compiler warnings.
9594 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9597 Fix things so `mkdir -p' can create very deep directories, e.g.,
9598 mkdir -p $(perl -e 'print "a/" x 40000') now works.
9599 * src/mkdir.c (main): For --parents (-p), call make_path with the
9600 entire directory name, so we don't ever require that file operations
9601 like stat or chmod be performed on the entire command line argument.
9602 * makepath.c (make_path): Restore umask *before* creating the final
9605 2002-09-27 Andreas Schwab <schwab@suse.de>
9607 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9608 to avoid overflow. Reported by Hans Lermen.
9610 2002-09-26 Jim Meyering <jim@meyering.net>
9612 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
9614 2002-09-25 Jim Meyering <jim@meyering.net>
9616 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9617 and add a cast, to avoid a warning about `signed and unsigned type in
9618 conditional expression'.
9620 2002-09-22 Jim Meyering <jim@meyering.net>
9622 * src/rmdir.c: Include "dirname.h", for declaration of
9623 strip_trailing_slashes.
9625 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9626 Now they're defined through system.h.
9628 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9629 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9630 since it's already included from sys2.h via system.h.
9632 * Use automake-1.6f. Regenerate dependent files.
9634 * src/Makefile.am (PERL): Remove duplicate definition.
9636 fmt's -s, -t, -c options didn't work properly for long lines.
9637 Since get_line may end up calling put_paragraph (for long lines),
9638 be sure to set global, `other_indent', before it is used there.
9640 * src/fmt.c (set_other_indent): New function, factored out of...
9641 (get_paragraph): ... here. Call it.
9642 (get_line): Call set_other_indent before calling flush_paragraph,
9643 which calls fmt_paragraph, which in turn calls put_paragraph,
9644 which uses other_indent.
9646 * tests/fmt/Makefile.am (TESTS): Add long-line.
9647 * tests/fmt/long-line: New file/test, for the above fix.
9649 2002-09-21 Jim Meyering <jim@meyering.net>
9651 * src/od.c: No longer include deprecated <values.h>.
9652 It was required solely for now-removed reference to BITSPERBYTE.
9653 * src/install.c: Likewise.
9654 Suggestion from Bruno Haible.
9656 2002-09-06 Andreas Schwab <schwab@suse.de>
9658 `rmdir -p dir-specified-with-trailing-slash/' would fail.
9659 * src/rmdir.c (remove_parents): Strip trailing slashes.
9661 2002-09-20 Jim Meyering <jim@meyering.net>
9663 * tests/rmdir/t-slash: New file/test, for the above fix.
9664 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9666 * Makefile.maint (announcement): Arrange to gpg-sign the message.
9667 Add a URL for each detached signature file.
9669 2002-09-07 Bruno Haible <bruno@clisp.org>
9671 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9673 2002-09-18 Jim Meyering <jim@meyering.net>
9675 `od -t x8' used the wrong (`l'-prefixed) printf format.
9676 Likewise for the o8 and u8 formats.
9677 * src/od.c (ISPEC_TO_FORMAT): Define macro.
9678 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9679 Reported by Arun Sharma.
9681 2002-09-17 Jim Meyering <jim@meyering.net>
9683 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9684 From gettext's intl/loadmsgcat.c.
9686 * tests/od/x8: New file/test, for the above fix.
9687 * tests/od/Makefile.am (TESTS): Add x8.
9689 2002-09-15 Jim Meyering <jim@meyering.net>
9691 * Use autoconf-2.54. Regenerate dependent files.
9693 * src/csplit.c (get_format_width): Add cast to avoid
9694 warning about `signed and unsigned type in conditional expression'.
9696 2002-09-14 Jim Meyering <jim@meyering.net>
9698 * src/who.c (print_user): Change type of local to size_t
9699 to avoid warnings about `comparison between signed and unsigned'.
9700 * src/ptx.c (generate_all_output): Likewise.
9702 * src/dd.c (main, skip): Add casts to avoid warnings about
9703 `comparison between signed and unsigned'.
9705 * src/id.c (print_full_info, print_group_list): Add casts to avoid
9706 warnings about `signed and unsigned type in conditional expression'.
9708 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9709 to avoid warnings about `comparison between signed and unsigned'.
9710 (split_3): Change parameter names to be readable and add comment.
9711 Clean up the test for whether a line may be ignored.
9713 2002-09-13 Jim Meyering <jim@meyering.net>
9715 * src/printf.c (main): Handle leading command line argument of `--'.
9716 Reported by Raul: DervishD <raul@pleyades.net>
9717 * tests/misc/printf: New file: test for the above.
9718 * tests/misc/Makefile.am (TESTS): Add printf.
9720 * src/date.c (usage): Explain that %S's range of [0..60] is required --
9721 rather than 0..59 -- to accommodate the occasional positive leap second.
9722 Reported by Richard Neill.
9724 2002-09-12 Jim Meyering <jim@meyering.net>
9726 * src/Makefile.am (nanosec_libs): Define.
9727 (sleep_LDADD, tail_LDADD): Use it here.
9729 Factor nanosleep-related code into ../lib/xnanosleep.c.
9730 * src/sleep.c: Include xnanosleep.h.
9731 Factor out fenv.h-related code.
9732 (timespec_subtract): Remove function.
9733 (main): Remove code that deals with computing start and stop times
9734 as well as the loop around nanosleep. Now that's in xnanosleep.c.
9736 Allow S (in --sleep-interval=S) to be a floating point value.
9737 * src/tail.c: Include xnanosleep.h and xstrtod.h.
9738 Move declaration of global variable, sleep_interval, to ...
9740 (usage): Update description of --sleep-interval option.
9741 (tail_forever): New parameter, sleep_interval. Update caller.
9742 Use xnanosleep, rather than sleep.
9743 (parse_options): New parameter, sleep_interval. Update caller.
9744 Use xstrtod, now that we accept floating point values.
9745 Prompted by a patch from Augey Mikus.
9747 2002-09-06 Jim Meyering <jim@meyering.net>
9749 * src/remove.c (prompt): Change comment to give a better note to
9750 translators. From Michael Piefel.
9752 2002-09-02 Jim Meyering <jim@meyering.net>
9754 * README: A good problem report/patch includes diffs against
9755 the most recent test release.
9757 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9758 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9760 * src/kill.c (print_table_row): Use an unsigned type for widths
9761 to avoid warning about comparison between signed and unsigned.
9762 (list_signals): Likewise.
9764 * src/od.c (skip): Add a cast to avoid warning about comparison
9765 between signed and unsigned.
9766 * src/install.c (get_ids): Likewise. Also rearrange range-checking
9767 comparisons to make them more readable.
9769 2002-09-01 Jim Meyering <jim@meyering.net>
9773 2002-08-31 Jim Meyering <jim@meyering.net>
9775 Symlinks were always reported as using 0 blocks.
9776 * src/system.h (ST_NBLOCKS): Don't depend on file type.
9777 This reverts the change of 2000-01-30.
9778 Based on a report and patch from Neil Brown via Michael Stone.
9779 This fixes Debian Bug#156358.
9781 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9782 `exit (1)' to `exit (EXIT_FAILURE)', and
9783 `usage (1)' to `usage (EXIT_FAILURE)'.
9785 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9786 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9787 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9788 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9789 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9790 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9791 error never exits successfully.
9793 2002-08-29 Jim Meyering <jim@meyering.net>
9795 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9796 when ignoring any return value.
9798 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9799 failures. On some systems (at least EMC Celerra and Solaris5.8),
9800 this appears to be necessary.
9801 (is_empty_dir): Likewise. Also, always close directory handle.
9802 * src/ls.c (print_dir): Likewise.
9803 (print_dir): Rename local variable: reading -> dirp.
9804 Reported by Mike Coleman.
9806 2002-08-28 Jim Meyering <jim@meyering.net>
9808 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9809 Give a diagnostic and fail if closedir fails.
9811 2002-08-26 Jim Meyering <jim@meyering.net>
9813 * Makefile.am (THANKS-to-translators): New rule.
9814 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9815 * THANKStt.in: New file.
9817 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9819 (main): Register it with atexit.
9820 Close STDOUT_FILENO, to avoid a problem when writing to
9821 /dev/audio on at least Solaris 5.7 and 5.8 systems.
9822 Reported by Shing-Shong Shei.
9824 2002-08-25 Jim Meyering <jim@meyering.net>
9826 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9827 * src/tac.c (main): Likewise.
9828 * src/tail.c (main): Likewise.
9829 * src/tee.c (main): Likewise.
9830 * src/tr.c (main): Likewise.
9831 * src/wc.c (main): Likewise.
9833 2002-08-20 Jim Meyering <jim@meyering.net>
9835 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
9837 2002-08-10 Paul Eggert <eggert@twinsun.com>
9839 * src/nohup.sh: Don't use "exec --"; it's not portable and
9840 shouldn't be needed.
9842 2002-08-09 Jim Meyering <jim@meyering.net>
9844 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
9845 (usage): Clarify help text for the -COLUMN option.
9846 Patch by Padraig Brady.
9847 * tests/pr/Test.pm [col-last]: New test for the above.
9849 * configure.ac: Start with version 4.5.1, chosen so that it's larger
9850 than the latest version numbers of the component packages.
9852 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
9855 2002-08-08 Jim Meyering <jim@meyering.net>
9857 * src/date.c: Guard inclusion of <langinfo.h> with
9858 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
9859 * src/sort.c: Likewise.
9860 Patch by GOTO Masanori.
9862 2002-08-05 Paul Eggert <eggert@twinsun.com>
9864 Fix some minor time-related bugs with POSIX time arguments.
9865 Some valid time stamps were being rejected (notably -1, and
9866 time stamps before 1900 on 64-bit hosts). And some invalid
9867 time stamps were being accepted, e.g. September 31.
9869 * src/date.c (main): Adjust to posixtime signature change.
9870 * src/touch.c (main): Likewise. Remove unnecessary initialization.
9871 Use localtime, not posixtm, to warn about obsolete "touch".
9873 2002-08-05 Jim Meyering <jim@meyering.net>
9875 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
9877 2002-08-04 Jim Meyering <jim@meyering.net>
9879 * src/Makefile.am (check-README): New target/rule.
9880 (check): Depend on it.
9882 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
9884 2002-08-03 Jim Meyering <jim@meyering.net>
9886 * Makefile.am (SUBDIRS): Add old.
9887 * old/: New directory, containing legacy ChangeLog* and NEWS files
9888 from the fileutils, sh-utils, and textutils packages.
9890 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
9892 2002-08-02 Paul Eggert <eggert@twinsun.com>
9894 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
9896 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
9897 (hard_LC_COLLATE): New var.
9898 (different): Args are now char *, not const char *.
9899 Use xmemcoll instead of memcmp to compare lines, so that
9900 LC_COLLATE has effect. However, use memcmp if it is an
9902 (check_file): Do not include newline in comparison, so that
9903 xmemcoll has a byte to stomp on temporarily.
9904 (main): Set hard_LC_COLLATE.
9906 2002-07-29 Jim Meyering <jim@meyering.net>
9908 * Makefile.am (SUBDIRS): Remove djgpp, for now.
9910 2002-07-20 Jim Meyering <jim@meyering.net>
9912 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
9913 into EXIT_FAILURE. Otherwise, false --help and false --version
9916 2002-07-08 Jim Meyering <jim@meyering.net>
9918 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
9919 rather than the hard-coded `sh-utils'.
9921 2002-07-01 Jim Meyering <jim@meyering.net>
9923 * configure.ac: Merge the three files from fileutils,
9924 textutils, and sh-utils.
9925 * Makefile.am: Likewise.
9926 * src/Makefile.am: Likewise.