1 2005-06-29 Jim Meyering <jim@meyering.net>
5 * src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
6 * src/du.c (show_date): Likewise.
7 * src/date.c (show_date): Likewise.
8 * src/od.c (dump_strings): Likewise.
9 * src/sort.c (fillbuf): Likewise.
10 * src/chmod.c (main): Likewise.
12 * src/system.h (VERIFY): Rewrite to use string-concatenation
13 and __LINE__ so as not to require a struct name parameter.
14 (GL_CONCAT, GL_CONCAT2): Define helper macros.
15 * src/od.c: Update sole use.
17 * src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
18 when computing the --author column width. This bug might have
19 resulted in misaligned columns when using the --author option
20 on the Hurd. Spotted by Arnold Robbins.
22 2005-06-28 Jim Meyering <jim@meyering.net>
24 * src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
25 not x2nrealloc. The former is a little more concise and readable.
26 N.B. this sort of transformation is ok only when the base type is
27 unlikely ever to change to a multibyte type.
28 * src/du.c (show_date): Likewise.
29 * src/date.c (show_date): Likewise.
30 * src/od.c (dump_strings): Likewise.
31 * src/sort.c (fillbuf): Likewise.
33 2005-06-24 Jim Meyering <jim@meyering.net>
35 * src/mv.c (usage): Clarify how --reply=no works.
37 2005-06-23 Paul Eggert <eggert@cs.ucla.edu>
39 Address the following "du" issues:
41 - The option name "--last-time=TYPE" is different from the ls's option
42 "--time=TYPE" with a similar meaning. I assume this wasn't intended.
44 - --time-style implies --time, but this is not true for "ls". It's
45 better to be consistent.
47 - Since we don't have POSIX compatibility concerns, there's no need
48 for the "posix-" styles, or for support of styles with newlines, or
49 for the "locale" style, except for parsing the TIME_STYLE
52 - It's cleaner (and these days, no less efficient) to use functions
53 rather than macros when possible.
55 - struct duinfo doesn't need a 'valid' flag; you can simply use a time
56 stamp that is less than all valid time stamps.
58 - The code needs a bit of reformatting to fit the usual GNU style.
60 * NEWS: du's --last-time option is now --time.
61 * doc/coreutils.texi (ls invocation): Fix typo: --time=use is
62 equivalent to --time=atime, not --time=ctime.
63 (ls invocation, du invocation): Fix typo: --time-style=long-iso
64 is equivalent to a time style with a leading "+".
65 (du invocation): --last-time is now --time.
66 --time-style no longer implies --time.
67 The locale and posix- stuff now works only for TIME_STYLE, not
68 for --time-style. Give equivalent format for --time-style=iso.
69 * src/du.c: Do not include hard-locale.h.
70 (struct duinfo): Remove 'valid' member. All uses changed to use
71 negative nsec instead.
72 (DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
73 (duinfo_init, duinfo_set, duinfo_add): New functions, taking the
74 role of the removed macros.
75 (opt_time): Renamed from opt_last_time. All uses changed.
76 (TIME_OPTION): Renamed from LAST_TIME_OPTION. All uses changed.
77 (long_options, usage): Rename --last-time to --time.
78 (locale_time_style): Remove.
79 (time_style_args, time_style_types, usage): Remove support for
81 (show_date): Now returns void, since nobody looked at the result.
82 Assume FORMAT is not null. An empty FORMAT now outputs an empty time.
83 Simplify nstrftime invocation.
84 (main): Put in ls compatibility workarounds only for TIME_STYLE,
85 not for --time-style. Omit unnecessary space in iso time style.
87 2005-06-23 Jim Meyering <jim@meyering.net>
89 * src/du.c (time_format): Add `const' attribute.
91 * src/date.c (show_date): Use puts rather than printf ("%s\n",.
93 * src/du.c (show_date): Rename local `time_format' so as not to
94 shadow the file-scoped global by that name.
95 (show_date): Add a FIXME comment.
97 * src/du.c: Include hard-locale.h and strftime.h.
98 (DUINFO_INI, DUINFO_SET, DUINFO_ADD):
99 Enclose body in `do {...} while (0)', not just `{...}'.
100 Adjust uses (add semicolons).
101 Adjust formatting, indentation.
102 (usage): Tweak formatting to maintain more or less constant indentation.
104 2005-06-14 William Brendling <wbrendling@gmail.com>
106 * src/du.c: Add --last-time and --time-style options.
108 2005-06-22 Paul Eggert <eggert@cs.ucla.edu>
110 * tests/umask-check: New file.
111 * tests/Makefile.am (EXTRA_DIST): Add umask-check.
112 * tests/mkdir/perm: Use umask-check.
113 * tests/cp/cp-parents: Likewise, instead of using chmod
114 as described below. Problem reported by Kevin Mudrick.
116 2005-06-22 Jim Meyering <jim@meyering.net>
118 Make rmdir produce diagnostics like this:
119 rmdir: /tmp: Permission denied
121 rmdir: `/tmp': Permission denied
123 * src/rmdir.c: Include "quotearg.h", not "quote.h".
124 (remove_parents, main): Use quotearg_colon, not quote.
126 2005-06-22 Paul Eggert <eggert@cs.ucla.edu>
128 * tests/cp/cp-parents: Use chmod to work around some hosts with
129 ACL problems. Problem reported by Kevin Mudrick.
131 2005-06-21 Jim Meyering <jim@meyering.net>
133 * tests/du/deref-args: Use --apparent-size to avoid the vagaries
134 of counting blocks. Kevin Mudrick reported that this test would
135 fail on an nfs-mounted directory where attribute-caching is
138 2005-06-19 Jim Meyering <jim@meyering.net>
140 * src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
142 * src/shred.c (usage): Use `file system', not `filesystem'.
144 2005-06-18 Jim Meyering <jim@meyering.net>
146 * src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
148 2005-06-17 Jim Meyering <jim@meyering.net>
150 * src/shred.c (usage): Clarify that shred works on an ext3 file
151 system as long as it's not in data=journal mode.
152 Tiny change by Mark Melahn.
154 2005-06-16 Paul Eggert <eggert@cs.ucla.edu>
156 * src/hostid.c (main): Don't print fewer than 8 digits, or spurious
157 leading "f"s. "f" problem reported by Tim Waugh.
158 * NEWS: Document this.
160 2005-06-16 Jim Meyering <jim@meyering.net>
162 Don't embed `this'-style quotes in format strings.
163 * src/tr.c: Rather than this: error (..., "...`%s'...", arg);
164 do this: error (..., "...%s...", quote (arg));
165 * src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
166 * src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
167 * src/split.c, src/tail.c: Likewise.
169 * src/sleep.c: Include "quote.h". Remove hard-coded quotes, as above.
170 * src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
171 * src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
173 * src/mv.c: Finally remove support for --version-control=S (-V).
174 It was deprecated nearly 6 years ago and has been warning
175 users to switch to --backup=S since fileutils-4.0j.
176 * src/cp.c, src/install.c, src/ln.c: Likewise.
178 2005-06-15 Jim Meyering <jim@meyering.net>
180 * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
181 * tests/install/basic-1: Ensure that each `-d'-specified directory
182 is created. Ensure that rel-named dirs are not created when
185 * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
187 2005-06-14 Paul Eggert <eggert@cs.ucla.edu>
189 Improve diagnostics for restore_cwd failure.
190 * src/install.c (main): Standardize on a diagnostic for
191 restore_cwd failure, and report errno.
192 (install_file_in_file_parents): Fail if restore_cwd fails and
193 one of the files is relative. This fixes a bug (albeit unlikely).
194 * src/mkdir.c (create_parents): Remove static var (now local to 'main').
195 (main): Standardize on a diagnostic for restore_cwd failure,
197 Don't bother to check cwd_errno unless create_parents.
198 Use mkdir rather than make_dir; it's simpler.
200 * src/install.c (main): Adjust to new make_dir_parents convention.
201 * src/mkdir.c (main): Likewise.
203 2005-06-14 Jim Meyering <jim@meyering.net>
205 * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
206 is an absolute directory name.
208 * Makefile.maint (my-distcheck): Add -Wall to the list of options that
209 are used with -Werror. This target is not intended for general use.
211 2005-06-13 Jim Meyering <jim@meyering.net>
213 * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
214 relative directory name after make_dir_parents fails to restore
215 the working directory. Before, `mkdir -p' could create directories
216 in the wrong place in unusual circumstances.
217 * src/install.c (main): Likewise.
218 (install_file_in_file_parents): Update make_dir_parents caller.
219 * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
220 * tests/mkdir/Makefile.am (TESTS): Add p-3.
222 2005-06-10 Paul Eggert <eggert@cs.ucla.edu>
224 Act on the Austin Group's response yesterday to XCU ERN 63; see
225 <http://www.opengroup.org/austin/docs/austin_260.txt>.
226 * NEWS: ls no longer outputs an extra space between mode and link count.
227 * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
228 * src/ls.c (any_has_acl): New var.
229 (clear_files): Clear it.
230 (gobble_file): Set it if a file has an ACL.
231 (print_long_format): Omit needless space unless some file has an ACL.
233 2005-06-10 Jim Meyering <jim@meyering.net>
235 * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
237 2005-06-02 Jim Meyering <jim@meyering.net>
239 * src/sort.c (usage): Put `Ordering options:' line where it belongs.
241 2005-06-01 Paul Eggert <eggert@cs.ucla.edu>
243 Use "file name" when talking about file names, instead of "filename"
244 or "path", as per the GNU coding standards.
245 * src/basename.c: Don't use "path" or "filename".
246 * src/copy.c: Likewise.
247 * src/copy.h: Likewise.
248 * src/cp-hash.c: Likewise.
249 * src/cp.c: Likewise.
250 * src/df.c: Likewise.
251 * src/install.c: Likewise.
252 * src/ls.c: Likewise.
253 * src/pinky.c: Likewise.
254 * src/pr.c: Likewise.
255 * src/pwd.c: Likewise.
256 * src/remove.c: Likewise.
257 * src/rmdir.c: Likewise.
258 * src/sort.c: Likewise.
259 * src/system.h: Likewise.
260 * src/tty.c: Likewise.
261 * src/who.c: Likewise.
262 * src/cp.c (parents_option): Renamed from flag_path. All uses changed.
263 (make_dir_parents_private): Renamed from make_path_private.
265 * src/cp.c (usage): Don't use "path" to describe a file name.
266 * src/readlink.c (usage): Likewise.
267 * src/rmdir.c (usage): Likewise.
268 * src/df.c: Don't include "path-concat.h"; not needed.
269 * src/install.c (install_file_in_file_parents): Renamed from
270 install_file_to_path. All uses changed.
271 * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
273 * src/ls.c (make_link_name): Renamed from make_link_path.
275 * src/pwd.c (struct file_name): Renamed from struct Path.
277 (file_name_free): Renamed from path_free. All uses changed.
278 (file_name_init): Renamed from path_init. All uses changed.
279 (file_name_prepend): Renamed from path_prepend. All uses changed.
280 * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
282 (longopts): Add comment that --path is deprecated.
284 2005-05-31 Jim Meyering <jim@meyering.net>
286 * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
287 This is a crutch so that `make distcheck's sc_tight_scope rule
288 knows that they really are deliberately declared that way.
290 2005-05-30 Paul Eggert <eggert@cs.ucla.edu>
292 Port to Solaris 10's rules for whether programs can chown files.
293 * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
294 (DO_CHOWN): Remove. Replaced by chown_failure_ok. All callers
296 (copy_internal): If chown failed, don't worry about what happened
297 to the mode bits; they can't have changed.
298 (chown_privileges, chown_failure_ok): New functions.
299 * src/copy.h: Add copyright notice.
300 (struct cp_options): Remove myeuid member. Add chown_privileges
302 (chown_privileges, chown_failure_ok): New function decls.
303 * src/cp.c (re_protect): Remove unnecessary call to geteuid.
304 Use chown_failure_ok rather than our own code.
305 * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
306 * src/install.c (cp_option_init): Likewise.
307 * src/mv.c (cp_option_init): Likewise.
309 2005-05-29 Paul Eggert <eggert@cs.ucla.edu>
311 * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
312 * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
314 * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
315 * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
316 [!defined _POSIX_VERSION]: Remove decls.
317 * src/install.c (getpwnam, getgrnam): Remove decl.
318 (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
319 * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
320 (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
321 * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
322 * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
324 Don't include <sys/file.h>; no longer needed.
325 (getegid, geteuid): Remove no-longer-necessary decls.
327 * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
328 Define to 256, not 255, as per modern POSIX.
330 2005-05-27 Paul Eggert <eggert@cs.ucla.edu>
332 * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
333 * src/dd.c (skip): Return the number of records that were not
334 skipped due to encountering EOF.
335 (dd_copy): If the file wasn't seekable and EOF was encountered,
336 write zeros past EOF until the desired offset is reached.
338 * NEWS: expr and test now correctly compare integers of unlimited size.
339 (Also, correct a comment that claimed that expr detects integer
340 overflow; it does so only when converting from strings.)
341 * src/expr.c: Include strnumcmp.h, xstrtol.h.
342 (looks_like_integer): New function.
343 (toarith): Use it. Also, use xstrtoimax rather than rolling our
345 (eval2): Don't look for trouble if !evaluate; this simplifies things.
346 Compare numbers using string comparison, so that overflow is
348 * src/sort.c: Refactor so that others can use large-integer
349 comparison functions.
350 Include "strnumcmp.h".
351 (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
352 Remove; moved to strnumcmp.
353 (decimal_point): Now int, to simplify converison overhead with
354 new API. All uses changed.
355 (thousands_sep): Now -1 if there isn't one, as per new API.
357 (numcompare): Move contents to strnumcmp module, except for
359 * src/test.c: Include inttostr.h, strnumcmp.h.
360 (whitespace, digit, digit_value, integer_expected_error): Remove.
361 (is_int): Remove; replaced by...
362 (find_int): New function.
363 (binary_operator): Don't let integers overflow in comparisons;
364 return the correct answer instead. Simplify the code.
365 (unary_operator): Convert the integer ourself, since find_int
367 * tests/expr/basic (bigcmp): New test.
368 * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
370 2005-05-26 Paul Eggert <eggert@cs.ucla.edu>
372 * NEWS: nohup now redirects a tty stdin to an unreadable fd
373 instead of closing it.
374 * doc/coreutils.texi (nohup invocation): Document this.
375 * src/nohup.c (main): Implement this.
377 2005-05-26 Jim Meyering <jim@meyering.net>
379 * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
380 Reported by David Alan Gilbert.
381 * tests/expr/basic: Add tests using arithmetic on negative integers.
383 2005-05-19 Jim Meyering <jim@meyering.net>
385 * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
386 Remove inaccurate-but-harmless `const' attributes.
388 * src/join.c (decode_field_spec): Add an abort after
389 `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
390 about variables being used uninitialized.
392 2005-05-18 Paul Eggert <eggert@cs.ucla.edu>
394 * configure.ac: Add copyright notice. gl_LIB_CHECK -> cu_LIB_CHECK.
395 * src/Makefile.am: Add copyright notice.
396 (factor_LDADD): Remove, as factor no longer needs sqrt.
397 * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
398 it's always true now.
400 2005-05-16 Paul Eggert <eggert@cs.ucla.edu>
402 Fix Cygwin porting problem reported by Eric Blake.
403 * src/remove.c (DT_IS_DIR): Remove.
404 (DT_IS_KNOWN, DT_MUST_BE): New macros.
405 (remove_entry): Use them.
407 2005-05-14 Paul Eggert <eggert@cs.ucla.edu>
409 * src/remove.c: Include unlinkdir.h.
410 (UNLINK_CAN_UNLINK_DIRS): Remove.
411 (remove_entry): Use cannot_unlink_dirs () rather than
412 UNLINK_CAN_UNLINK_DIRS.
414 2005-05-14 Jim Meyering <jim@meyering.net>
416 Update FSF postal mail address.
417 * Makefile.maint, Makefile.cfg, gnupload
418 * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
419 * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
420 * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
421 * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
422 * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
423 * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
424 * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
425 * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
426 * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
427 * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
428 * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
429 * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
430 * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
431 * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
432 * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
433 * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
434 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
435 * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
436 * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
437 * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
438 * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
439 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
441 2005-05-13 Jim Meyering <jim@meyering.net>
443 * NEWS: `rm -r' now removes all of the files it should, even on
444 systems with a buggy readdir affecting file systems inaccessible
447 In some unusual circumstances `rm -r' would fail to remove --
448 or even consider -- all entries in a directory with more than 254
449 (SunOS) or 338 (Darwin) entries. This could cause trouble even on
450 other types of systems when using an affected file system via e.g.,
451 NFS. The underlying cause was a bug in readdir on those systems.
452 Coreutils-5.2.1 and earlier used a configure-time test designed
453 to detect precisely those problem systems, but it would detect
454 the problem and enable remove.c's work-around code only when its
455 configure-time test was run on a losing file system. Obviously,
456 it couldn't detect a problem if the offending file system wasn't
457 tested or even mounted at coreutils configure time. Now, rm itself
458 performs a minimal-cost run-time test to detect the problem.
460 * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
461 (remove_cwd_entries): When readdir returns NULL for a directory from
462 which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
463 entries, call rewinddir and then resume the readdir/unlink loop.
464 (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
466 2005-05-12 Paul Eggert <eggert@cs.ucla.edu>
468 * NEWS: nohup now closes stdin if it is a terminal, unless
469 POSIXLY_CORRECT is set. This fixes a glitch noted by Wayne Pollock in
470 <https://www.opengroup.org/sophocles/show_mail.tpl?
471 source=L&listname=austin-group-l&id=8341>.
472 * doc/coreutils.texi (nohup invocation): Document this.
473 * src/nohup.c (main): Implement this.
475 2005-05-12 Jim Meyering <jim@meyering.net>
477 * src/date.c: Assume `free (NULL)' works.
478 * src/dd.c: Likewise.
480 * src/dircolors.c:Likewise.
481 * src/head.c: Likewise.
482 * src/ls.c: Likewise.
483 * src/md5sum.c: Likewise.
484 * src/pr.c: Likewise.
485 * src/sort.c: Likewise.
487 2005-05-10 Jim Meyering <jim@meyering.net>
489 * tests/touch/not-owner: Skip this test if the user running it
490 owns `/' or has write access to it.
492 * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
493 This makes `mv -i --reply=no f1 f2' work as expected (in not
494 performing the move operation). But note that specifying `-i'
495 after `--reply=no' does *not* work.
496 Tiny patch from Vlada Macek.
498 * tests/mv/reply-no: New file. Test for the above fix.
499 * tests/mv/Makefile.am (TESTS): Add reply-no.
501 * tests/ls-2/tests: Don't print PATH to stderr.
503 2005-05-08 Paul Eggert <eggert@cs.ucla.edu>
505 * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
508 2005-05-06 Paul Eggert <eggert@cs.ucla.edu>
510 * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
511 * src/dd.c (flags, usage): Add support for "binary" and "text".
513 2005-05-04 Paul Eggert <eggert@cs.ucla.edu>
515 * NEWS: chmod -w now complains if it differs from chmod a-w.
516 * src/chmod.c: Include quotearg.h.
517 (diagnose_surprises): New var.
518 (process_file): Diagnose surprises. Simplify the logic a bit,
520 (main): Prepare to diagnose surprises. Remove useless code for
522 * tests/chmod/Makefile.am (TESTS): Add umask-x.
523 * tests/chmod/umask-x: New file.
525 2005-05-02 Paul Eggert <eggert@cs.ucla.edu>
527 * NEWS: ls --indicator-style=directory renamed to ls
528 --indicator-style=slash, to avoid confusion with ls --directory.
529 * src/ls.c (usage): Likewise.
530 (slash): Renamed from directory_only. All uses changed.
532 2005-05-01 Paul Eggert <eggert@cs.ucla.edu>
534 * NEWS: "chmod +1 foo" is now diagnosed.
536 2005-04-29 Paul Eggert <eggert@cs.ucla.edu>
538 * NEWS: ls -p now marks only directories. New option
539 --indicator-style=directory equivalent to -p.
540 * doc/coreutils.texi (ls invocation): Document this.
541 Also, mention ">" is for doors.
542 * src/ls.c (enum indicator_style): New constant directory_only,
544 (indicator_style_args, indicator_style_types): Set it appropriately.
545 (decode_switches, gobble_file, print_type_indicator):
546 (length_of_file_name_and_frills):
547 Implement the change described in NEWS.
548 (decode_switches): Quote ">", too.
549 (usage): Update to match the new behavior. Describe ">".
550 * tests/ls/file-type: Test for new behavior. Omit -1 option.
551 The "ls --color" test wasn't being checked; add a check for
552 "ls --color=auto" instead.
554 * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
555 * tests/misc/split-fail: Likewise.
556 * tests/pr/Test.pm: Likewise.
557 * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
558 * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
559 if they use file names starting with +.
560 (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
561 * tests/uniq/Test.pm (tv, test_vector): Likewise.
563 The following was partly derived from a tiny change by Eric Blake:
564 * tests/misc/nice: Don't use 'set -'. It's not portable to strict
565 POSIX 1003.1-2001 hosts. Also, don't set _POSIX2_VERSION.
566 * tests/mkdir/perm: Don't use 'set -'. Simplify test construction.
567 Work even if the underyling system attaches ACLs to new dirs.
568 * tests/mv/part-hardlink: Don't use 'set -'.
569 * tests/stty/row-col-1: Don't use 'set -'.
571 2005-04-28 Paul Eggert <eggert@cs.ucla.edu>
573 * NEWS: Document fixes described below.
574 * src/chmod.c (change, umask_value): New static vars.
575 (reference_file): Move this static var to inside "main".
576 (process_file, process_files): Remove CHANGES arg; now taken from
577 static var. All uses changed.
578 (usage): Fix incorrect description of MODE operand.
579 (main): For invalid mode usages, output a brief usage message.
580 Adjust to new modechange API.
581 * install.c (main): Adjust to new modechange API.
582 Also, free the mode_change object when done.
583 * mkdir.c (main): Likewise.
584 * mkfifo.c (main): Likewise.
585 * mknod.c (main): Likewise.
586 * tests/chmod/equal-X: Check for =xX bug.
587 * tests/chmod/equals: Check for =u bug.
588 * tests/chmod/usage: Check for u+gr and ug,+x bugs.
590 2005-04-26 Paul Eggert <eggert@cs.ucla.edu>
592 Restore support for usages like "head -1" and "tail -1",
593 even when conforming to POSIX 1003.1-2001.
594 Fix bug with "POSIXLY_CORRECT=1 fold file -3".
595 join now supports a NUL field separator, e.g., "join -t '\0'".
596 join now detects and reports incompatible options, e.g.,
598 * NEWS: Document this.
599 * src/date.c: Remove posixver.h and its uses.
600 (COMMON_SHORT_OPTIONS): Remove.
601 (short_options): New constant.
602 (short_options, usage): -I now always takes an optional arg.
603 * src/expand.c: Remove posixver.h and its uses.
604 (shortopts): New constant. -DIGIT now always takes an optional arg.
605 (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
606 Don't complain about -DIGIT.
607 * src/fold.c: Remove posixver.h and its uses.
608 (shortopts): New constant. -DIGIT now always takes an optional arg.
609 (main): Don't preprocess arg list; that was buggy. Use method
611 * src/head.c: Remove posixver.h and its uses.
612 (header_mode_option): Remove.
613 (main): Don't complain about obsolete -NUM args.
614 * src/join.c: Remove posixver.h and its uses.
615 (obsolete_usage): Remove.
616 (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
617 they haven't been set yet.
618 (tab): Now int, not char. Initialize to -1 to indicate white space
619 separates columns, so that we can use NUL as a separator.
621 (OBSOLETE_LONG_OPTIONS, get_option): Remove.
622 (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
623 suffices. Use xstrtoul for sizes; it suffices.
624 (decode_field_spec): Report an error and exit on failure. Return void,
626 (add_field_list): Likewise.
627 (set_join_field): New function.
628 (enum operand_status): New enum.
629 (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
630 PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
631 possibilities with obsolete option parsing.
632 (main): Use it. Do not depend on POSIX version.
633 Check for conflicting options. Parse obsolete options -j1 and -j2
634 so that it is a pure extension to POSIX 1003.1-2001.
635 Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
636 * src/nice.c: Remove posixver.h and its uses.
637 (main): Always support -NUM option.
638 * src/od.c: Remove posixver.h and its uses.
639 (short_options): New constant, which always supports -w[num].
640 (COMMON_SHORT_OPTIONS): Remove.
641 * src/pr.c: Remove posixver.h and its uses.
642 (short_options): New constant, which always supports -S[string].
643 (COMMON_SHORT_OPTIONS): Remove.
644 * src/sort.c: Remove posixver.h and its uses.
645 (short_options): New constant, which always supports -y arg.
646 (COMMON_SHORT_OPTIONS): Remove.
647 (main): Redo workaround for Solaris compatibility with -y.
648 This change isn't visible to the user; it just cleans up the
649 code so that we don't need posixver.h.
650 * src/split.c: Remove posixver.h and its uses.
651 (main): Don't complain about -NUM option.
652 * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
653 * src/unexpand.c: Remove posixver.h and its uses.
654 (main): Don't complain about -TAB.
655 * src/uniq.c (main): Don't complain about -NUM.
657 2005-04-22 Paul Eggert <eggert@cs.ucla.edu>
659 * src/nohup.c (main): If getopt fails, exit with status 127,
660 not status 1. POSIX requires this.
661 * NEWS: Document this.
663 * src/nice.c (main): Report proper program name when getopt finds
664 trouble. Problem reported by Behdad Esfahbod.
666 * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
667 when the "+x" was being evaluated.
668 * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
669 * mkfifo.c (main): Likewise.
670 * mknod.c (main): Likewise.
671 * tests/mkdir/perm: Test for the above bug.
673 2005-04-20 Paul Eggert <eggert@cs.ucla.edu>
675 Port test cases to Microsoft-Windows-related environments,
676 following suggestions from Eric Blake.
677 * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
678 * tests/install/basic-1: Undo previous change.
679 (dd, dd2): New vars, which use $EXEEXT. All uses of dd and dd2 changed.
680 * tests/install/trap: Undo previous change.
681 (sig): New var. Use it insted of "trap '' CHLD".
682 Append $EXEEXT to executable name.
684 "fetish" -> "coreutils" in more places.
685 * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
686 (package Coreutils): Renamed from package Fetish. All uses changed.
687 * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
690 2005-04-19 Paul Eggert <eggert@cs.ucla.edu>
692 * tests/mv/setup (dot_mount_point): Use stat -L, in case the
693 directory is actually a symbolic link. Problem reported by
696 * tests/mv/mv-special-1: Use test -p to test for fifos, rather
697 than the (incorrect) test -f and the (inadequate) ls. ls is
698 inadequate because on some hosts a buggy mv will create a file of
699 the wrong type (problem reported by Eric Blake). Skip this test
700 if test -p doesn't work.
702 * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
703 since the latter can have shell metacharacters in them (e.g., spaces).
704 This follows up to the 2005-01-17 patch, which missed this occurrence.
706 2005-04-18 Paul Eggert <eggert@cs.ucla.edu>
708 "fetish" -> "coreutils" in several places.
709 * Makefile.cfg (ftp): Remove fetish.sf.net.
710 * Makefile.maint (emit_upload_commands): Likewise.
711 * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
712 * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
713 * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
715 * tests/install/basic-1: Use "cat", not "test", to test for
716 ../../src/dd. Problem reported by Eric Blake.
718 2005-04-18 Jim Meyering <jim@meyering.net>
720 * src/dd.c: Don't include stat-macros.h directly. system.h does that.
722 2005-04-17 Paul Eggert <eggert@cs.ucla.edu>
724 Work around a couple of "make check" failures reported for Cygwin
725 and ash by Eric Blake.
726 * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
727 * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
729 2005-04-16 Jim Meyering <jim@meyering.net>
731 * src/dd.c (S_TYPEISSHM): Remove definition.
732 Get the definition by including "stat-macros.h", instead.
734 2005-04-14 Paul Eggert <eggert@cs.ucla.edu>
736 Fix test suite problems reported by Eric Blake on Cygwin.
737 * tests/mv/mv-special-1: Ignore chatter about when files are removed,
738 since POSIX doesn't require rename to fail across file systems.
739 * tests/mv/setup (dot_mount_point): Use stat rather than df, as
741 (other_partition_tmpdir): Remove df from name as that would be
744 2005-04-14 Jim Meyering <jim@meyering.net>
746 * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
748 2005-04-12 Paul Eggert <eggert@cs.ucla.edu>
750 * src/ls.c (usage): "uid" -> "user ID".
752 2005-04-12 Jim Meyering <jim@meyering.net>
754 * src/tsort.c (tsort): Use "%s" as the format string,
755 rather than a diagnostic or a file name.
757 * src/comm.c (compare_files): Remove declaration of unused local.
759 * src/chown-core.c (chopt_free): Mark parameter as unused.
761 2005-04-11 Paul Eggert <eggert@cs.ucla.edu>
763 * man/chown.x: Reword to match user manual.
764 * man/id.x: Likewise.
765 * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
767 * src/whoami.c (usage, main): Likewise.
769 Add bulletproofing for cases where stdin, stdout, or stderr are closed.
770 * src/comm.c: Include stdio-safer.h.
771 (compare_files): Exit right away on I/O error rather than continuing
772 and producing confusing output and error messages.
773 Return void, not int; all callers changed.
774 Use fopen_safer to avoid confusion with file descriptors.
775 * src/copy.c: Include unistd-safer.h.
776 (copy_reg): Use fd_safer.
777 * src/csplit.c: Include stdio-safer.h.
778 (input_desc): Remove unnecessary static initialization.
779 (set_input_file): Use STDIN_FILENO, not 0.
780 (create_output_file): Use fopen_safer.
781 * src/dircolors.c (dc_parse_file): Don't assume fopen does not
783 * src/head.c (head_file): Don't assume open does not return 0.
784 * src/join.c: Include stdio-safer.h.
785 (main): Use fopen_safer. Simplify the resulting code.
786 * src/md5sum.c (digest_file, digest_check):
787 Don't assume that fopen does not return stdin.
788 * src/nohup.c: Include unistd-safer.h.
789 (main): Don't dup stderr to stdin or stdout by mistake.
790 * src/od.c (check_and_close): Don't assume fopen does not return stdin.
791 * src/paste.c (paste_serial): Likewise.
792 * src/pr.c: Include stdio-safer.h.
793 (open_file): Use fopen_safer.
794 (close_file): Don't assume fopen does not return stdin.
795 * src/ptx.c (main): Don't assume fopen returns stdout after closing
796 stdout. Use freopen instead.
797 * src/shred.c: Include unistd-safer.h.
798 (wipename): Use fd_safer on directory file descriptor.
799 (wipefile): Remove special case for /dev/fd/* on older hosts.
800 It didn't work in general, and wasn't documented.
802 * src/sort.c: Include unistd-safer.h.
803 (create_temp_file): Use fd_safer.
804 (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
805 * src/split.c: Include unistd-safer.h.
806 (cwrite): Use fd_safer. Replace mystery constant 0666 with symbolic
807 version, as POSIX requires.
808 * src/sum.c (bsd_sum_file, sysv_sym_file):
809 Use same pattern as elsewhere for checking for stdin.
810 * src/tac.c: Include unistd-safer.h.
811 (copy_to_temp): Use fd_safer.
812 (tac_file): Don't assume fopen cannot return stdin.
813 * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
814 (recheck, tail_file): Use fd_safer rather than open_safer.
815 * src/tee.c: Include stdio-safer.h.
816 (tee): Use fopen_safer.
817 * src/touch.c: Include unistd-safer.h.
818 (touch): Use fd_safer.
819 * src/tsort.c (have_read_stdin): Remove; no longer needed. All uses
821 (tsort): Do not assume fopen can't return stdin.
822 Close stdin before returning. All uses changed.
823 * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
824 * src/uniq.c: Include stdio_safer.h.
825 (check_file): Don't assume fopen cannot return stdin or stdout.
827 2005-04-09 Jim Meyering <jim@meyering.net>
829 * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
831 Now that close_stdout closes standard output unconditionally,
832 these workarounds for dd and cat are no longer necessary.
833 * src/dd.c (close_stdout_wrapper): Remove function.
834 (main): Call atexit with close_stdout, instead.
835 * src/cat.c (close_stdout_wrapper): Likewise.
836 Don't close STDOUT_FILENO explicitly; close_stdout does it.
838 * src/system.h (__attribute__): Readability nit:
840 # define __attribute__(x)
842 # define __attribute__(x) /* empty */
844 2005-04-09 Jim Meyering <jim@meyering.net>
846 * src/rm.c (usage): Mention that --recursive removes listed
847 directories too, not just their contents.
848 Say that by default, rm does not remove directories.
850 * src/pr.c: Don't include "timespec.h". system.h does that.
851 * Makefile.maint (sc_system_h_headers): Propagate exit status
854 2005-04-08 Paul Eggert <eggert@cs.ucla.edu>
856 * NEWS: Document that dd no longer treats QUIT or PIPE specially,
857 and when conforming to POSIX no longer treats USR1 specially.
858 Document that dd no longer dumps core when handling signals.
859 * src/system.h (RETSIGTYPE): Remove; no longer needed. All uses
861 * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
863 (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
864 (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
865 behavior when called from a signal handler. All uses changed.
866 (main) [!defined SA_NOCLDSTOP]:
867 Use siginterrupt to specify that system calls should be interrupted.
868 * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
869 (process_signals): Add forward decl.
870 (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
872 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
873 (SA_NODEFER) [!defined SA_NODEFER]: New macro.
874 (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
875 (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
877 (usage): Mention -USR1 versus -INFO.
878 (cleanup): Don't invoke print_stats; the caller must do it now.
880 (quit): Process signals just before exiting.
881 (interrupt_handler): Simply record the signal and return.
882 (siginfo_handler): Simply increment the signal counter and return.
883 (install_handler): Remove, replacing with:
884 (install_signal_handlers, process_signals, iread, iwrite):
885 New functions. All callers to safe_read and full_write replaced
886 by iread and iwrite. All callers to install_handler replaced by
888 * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
890 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
891 (main) [! SA_NOCLDSTOP]: Use it.
892 * src/shred.c: Remove all uses of signals; modern hosts have
893 /dev/random and don't need this gorp.
894 Do not include signal.h.
895 (env, sigill_handler, isaac_seed_machdep): Remove. All uses removed.
896 * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
898 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
899 (main) [! SA_NOCLDSTOP]: Use it.
901 * src/dd.c: Do not include inttostr.h, no longer needed.
902 (print_stats, main): Rewrite and simplify formats to use PRIuMAX
903 instead of umaxtostr.
904 (print_stats): Work even in languages that have special
905 forms for two of things, for r_truncate and w_bytes. We can't
906 fix delta_s in this way, since ngettext doesn't support floating-point.
907 (main): Rewrite to avoid casts.
909 2005-04-07 Jim Meyering <jim@meyering.net>
911 Placate gcc-4's -Wuninitialized.
912 * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
913 * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
915 * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
917 (binop): Move function definition to precede first use so we can...
918 (binop): ...remove prototype.
920 2005-04-05 Paul Eggert <eggert@cs.ucla.edu>
922 * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
923 * src/basename.c (usage): Add examples.
924 * src/cat.c (usage): Likewise.
925 * src/chgrp.c (usage): Likewise.
926 * src/chown.c (usage): Likewise.
927 * src/dirname.c (usage): Likewise.
929 2005-04-05 Jim Meyering <jim@meyering.net>
931 * src/nice.c (usage): Mention that some shells provide a
932 built-in function by the same name.
933 * src/nohup.c (usage): Likewise.
934 * src/printenv.c (usage):Likewise.
936 2005-04-04 Dmitry V. Levin <ldv@altlinux.org>
938 * src/tee.c (tee): When closing files, do not close stdout,
939 leave this job to close_stdout() instead.
940 * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
941 * tests/Makefile.am (SUBDIRS): Add tee.
942 * tests/tee/Makefile.am: New file.
943 * tests/tee/.cvsignore: Likewise.
944 * tests/tee/{basic,dash}: New tee tests.
946 2005-04-04 Jim Meyering <jim@meyering.net>
948 * src/echo.c (usage): Mention that some shells provide a
949 built-in function by the same name.
950 * src/kill.c (usage): Likewise
951 * src/printf.c (usage): Likewise.
952 * src/pwd.c (usage): Likewise.
953 * src/stat.c (usage): Likewise.
954 * src/test.c (usage): Likewise.
955 * src/true.c (usage):
956 * src/system.h (USAGE_BUILTIN_WARNING): New macro.
958 * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
959 * man/printf.x: Likewise.
960 * man/pwd.x: Likewise.
962 2005-04-03 Jim Meyering <jim@meyering.net>
964 * src/pr.c (main): Fix off-by-one error.
965 pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
966 end of a malloc'd buffer.
968 2005-04-01 Jim Meyering <jim@meyering.net>
970 * src/pr.c (main): Free column_count_string when done with it.
972 Don't let pr treat +1:-1 like +1:18446744073709551615.
973 * src/pr.c (strtoumax): Remove declaration.
974 (first_last_page): Use xstrtoumax in place of strtoumax,
975 so we don't interpret a negative page number (e.g., in an option
976 like --pages=1:-1) as valid.
977 * tests/pr/Test.pm (neg-page): Add a test for this.
979 2005-03-30 Paul Eggert <eggert@cs.ucla.edu>
981 * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
982 * src/uptime.c (uptime): New arg OPTIONS. All uses changed.
983 * src/users.c (users): Likewise.
984 * src/who.c (who): Likewise.
985 * src/uptime.c (main): Check PIDs when invoked with zero arguments.
986 * src/users.c (main): Likewise.
987 * src/who.c (main): Likewise. Also with two arguments.
988 Omit duplicate code in 2-arg case.
989 (UT_PID): Moved to ../lib/readutmp.h.
991 2005-03-29 Jim Meyering <jim@meyering.net>
993 * src/system.h (ptr_align): Declare `ptr' parameter to be a
994 `const' pointer, since this function never writes through it.
996 * src/uname.c: Indent cpp directives to reflect nesting.
998 2005-03-28 Jim Meyering <jim@meyering.net>
1000 * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
1001 Add `void' to make this an ANSI-style function declaration.
1002 * src/remove.c (ds_init): Likewise.
1003 * src/pr.c (print_sep_string): Likewise.
1005 * src/stty.c (speeds): Declare this array to be static.
1006 * src/Makefile.am (sc_tight_scope): Adjust to catch any
1007 new declarations like that of stty.c's `speeds'.
1009 * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
1010 (GETOPT_VERSION_OPTION_DECL): Likewise.
1011 * src/chown.c (long_options): Likewise.
1012 * src/chgrp.c (long_options): Likewise.
1013 * src/chmod.c (long_options): Likewise.
1014 * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
1016 * src/chown-core.c (chopt_init): Likewise.
1017 * src/comm.c (long_options): Likewise.
1018 * src/copy.c (copy_reg): Likewise.
1019 * src/csplit.c (extract_regexp): Likewise.
1020 * src/cut.c (longopts): Likewise.
1021 * src/date.c (time_spec_string): Likewise.
1022 * src/df.c (find_mount_point, show_point): Likewise.
1023 * src/expr.c (docolon): Likewise.
1024 * src/fmt.c (long_options): Likewise.
1025 * src/ls.c (time_style_args, indicator_style_args, long_options)
1026 (format_args, sort_args, time_args, decode_switches)
1027 (gobble_file): Likewise.
1028 * src/md5sum.c (long_options): Likewise.
1029 * src/mv.c (reply_args): Likewise.
1030 * src/paste.c (longopts): Likewise.
1031 * src/pinky.c (print_entry): Likewise.
1032 * src/pr.c (long_options): Likewise.
1033 * src/ptx.c (long_options, format_args): Likewise.
1034 * src/readlink.c (longopts): Likewise.
1035 * src/sort.c (long_options, mergefps): Likewise.
1036 * src/stat.c (long_options): Likewise.
1037 * src/tac.c (main): Likewise.
1038 * src/tail.c (follow_mode_string): Likewise.
1039 * src/touch.c (longopts, time_args): Likewise.
1040 * src/uniq.c (delimit_method_string): Likewise.
1041 * src/uptime.c (print_uptime): Likewise.
1042 * src/who.c (print_user): Likewise.
1044 2005-03-27 Jim Meyering <jim@meyering.net>
1046 * src/dcgen: Simplify further, clean up.
1047 Add a standard-output-closing global destructor.
1049 * src/wheel-gen.pl: Use the same global destructor as dcgen.
1051 2005-03-26 Paul Eggert <eggert@cs.ucla.edu>
1053 * src/dcgen: Squeeze multiple blanks into one. Output a simple
1054 array of adjacent strings rather than a more complicated data
1055 structure; this saves space in the dircolors executable.
1056 * src/dircolors.c (parse_line): Use char *, not unsigned char *.
1058 (dc_parse_stream, main): Avoid casts.
1059 Adjust to simpler data structure generated by new dcgen.
1061 2005-03-25 Eric Blake <ebb9@byu.net> (tiny change)
1063 * src/ls.c (usage): Document usage of LS_COLORS.
1065 2005-03-25 Paul Eggert <eggert@cs.ucla.edu>
1067 * src/dircolors.hin: Add "TERM cygwin".
1069 2005-03-25 Jim Meyering <jim@meyering.net>
1071 * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
1072 the return value, and update callers:
1073 * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
1074 * src/expand.c (parse_tab_stops, main): Likewise.
1075 * src/split.c (main): Likewise.
1076 * src/unexpand.c (parse_tab_stops, main): Likewise.
1077 * src/uniq.c (main): Likewise.
1079 2005-03-22 Jim Meyering <jim@meyering.net>
1081 * build-aux: New directory. Renamed from config.
1082 * configure.ac: Reflect renaming: config -> build-aux.
1083 * Makefile.am (dist-hook): Likewise.
1084 * Makefile.maint: Likewise.
1085 * Makefile.cfg (cvs_files): Likewise.
1086 * .x-sc_sun_os_names: Likewise.
1087 * .x-sc_trailing_blank: Likewise.
1089 * src/ls.c (get_funky_string): Use '\a', rather than 7, for
1090 portability to EBCDIC hosts.
1092 2005-03-20 Jim Meyering <jim@meyering.net>
1094 * src/pr.c (init_header): Add missing `%' in new format string.
1095 (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
1097 2005-03-19 Jim Meyering <jim@meyering.net>
1099 * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
1100 $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
1102 2005-03-18 Paul Eggert <eggert@cs.ucla.edu>
1104 * NEWS: pr -D "FORMAT" now accepts the same formats that
1105 date +"FORMAT" does.
1106 * src/pr.c: Include strftime.h, timespec.h.
1107 (init_header): Obtain and format nanosecond part of time stamp.
1109 * NEWS: nohup now ignores the umask when creating nohup.out.
1110 nohup now closes stderr if it is a terminal and stdout is closed.
1111 * src/nohup.c (main): Likewise. Be a little more paranoid about
1112 return values; e.g., check for any negative return from open.
1113 Assume free (NULL) works.
1114 Close file descriptor leak when redirecting standard output to a file.
1116 2005-03-17 Jim Meyering <jim@meyering.net>
1118 * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
1119 in place of functionally-equivalent code.
1120 * src/expand.c (parse_tab_stops, main): Likewise.
1121 * src/split.c (main): Likewise.
1122 * src/unexpand.c (parse_tab_stops, main): Likewise.
1123 * src/uniq.c (main): Likewise.
1124 * src/od.c: Use VERIFY macro in place of an equivalent open-coded
1126 * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
1129 Before, this command would make uniq skip 11 fields and print
1130 only the first line:
1131 $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
1134 * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
1135 not like `uniq -f11'.
1137 2005-03-15 Jim Meyering <jim@meyering.net>
1139 Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
1140 `pr -0' should give a better diagnostic and `pr -03' should be
1141 equivalent to `pr -3'.
1142 * src/pr.c (parse_column_count): Change return type to void.
1143 Call error (EXIT_FAILURE, ... for an invalid string.
1144 (main): Allocate space for column_count_string using malloc.
1145 Accumulate all old-style column-count digits before converting.
1146 When the number of columns is specified via both old-style,
1147 (e.g., -3), and a long option (--columns=5), ensure that only
1148 the last one specified takes effect.
1149 * tests/pr/Test.pm: Add tests for the above.
1151 2005-03-15 Corinna Vinschen <corinna@vinschen.de> (tiny change)
1153 * src/copy.c (copy_reg): Copy regular files in binary mode.
1155 2005-03-14 Paul Eggert <eggert@cs.ucla.edu>
1157 * NEWS: Restate why ls limits time stamp lengths.
1159 2005-03-12 Jim Meyering <jim@meyering.net>
1161 Add a little infrastructure to help prevent future bugs like the
1163 * src/stat.c (xstrcat): New function.
1164 (print_statfs, print_stat): Add buf_len parameter and convert all
1165 uses of strcat to xstrcat. Update callers.
1166 (print_it): Call print_func with buf_len parameter.
1168 Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
1169 could cause a buffer overrun error.
1170 * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
1171 conversion of the stat %s format string to the longer printf %llu one.
1172 Patch from Guochun Shi.
1174 2005-03-11 Paul Eggert <eggert@cs.ucla.edu>
1176 * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
1177 (long_time_expected_width, print_long_format): Use it, to avoid
1178 some possible denial-of-service attacks.
1179 * NEWS: Document this.
1181 2005-03-11 Jim Meyering <jim@meyering.net>
1183 Prompt once again for `mv -i A B' when A and B are hard links
1184 to the same file. This fixes a bug introduced by my 2003-04-04
1185 (coreutils-5.0.1) change. Reported by Thomas Wolff via Eric Blake.
1186 * src/copy.c (abandon_move): New function, factored out of
1187 copy_internal, now that this code is being used from two places.
1188 (copy_internal): Perform the same interactive-related test for
1189 whether it's alright to proceed and (usually) overwrite the
1191 * tests/mv/i-4: Add tests for the above.
1193 Don't segfault for a very long date format string, e.g.,
1194 ls -ld --time-style=+%99999999H .
1195 * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
1196 so format string abuse cannot provoke stack overflow.
1197 (print_long_format): Likewise.
1199 Don't segfault for a long header date string, e.g.,
1200 echo a|pr -D +%9999999A
1201 * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
1202 Don't bother with fixed-sized initial buffer; always use x*alloc.
1204 * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
1205 in place of equivalent INT_STRLEN_BOUND + 1.
1206 * src/expr.c (tostring, printv): Likewise.
1208 2005-03-09 Paul Eggert <eggert@cs.ucla.edu>
1210 * src/system.h: Include intprops.h.
1211 (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
1212 they are now defined in intprops.h.
1214 2005-03-09 Jim Meyering <jim@meyering.net>
1216 * TODO: Remove entry about named pipes. It was fixed in 5.3.0.
1218 2005-03-08 Paul Eggert <eggert@cs.ucla.edu>
1220 * src/date.c (usage): Redo to match recent documentation changes.
1221 Don't bother documenting which usages are GNU extensions; the list
1222 wasn't correct, and is better left to the printed manual anyway.
1224 2005-03-06 Jim Meyering <jim@meyering.net>
1226 Factor out column-count processing.
1227 * src/pr.c: Include "inttostr.h".
1228 (parse_column_count): New function.
1229 (main): Use the new function for both old-style, -9, and long,
1230 --columns=-9, options.
1232 * src/cksum.c: Remove `register' keyword.
1233 * src/cut.c: Likewise.
1234 * src/dd.c: Likewise.
1235 * src/env.c: Likewise.
1236 * src/factor.c: Likewise.
1237 * src/fmt.c: Likewise.
1238 * src/fold.c: Likewise.
1239 * src/id.c: Likewise.
1240 * src/logname.c: Likewise.
1241 * src/ls.c: Likewise.
1242 * src/pr.c: Likewise.
1243 * src/printf.c: Likewise.
1244 * src/shred.c: Likewise.
1245 * src/sort.c: Likewise.
1246 * src/sum.c: Likewise.
1247 * src/test.c: Likewise.
1248 * src/tsort.c: Likewise.
1249 * src/uniq.c: Likewise.
1250 * src/wc.c: Likewise.
1251 * src/whoami.c: Likewise.
1253 2005-03-01 Paul Eggert <eggert@cs.ucla.edu>
1255 * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
1258 2005-03-01 Jim Meyering <jim@meyering.net>
1260 * src/copy.c (copy_internal): Change test of source type from
1261 !S_ISREG to S_ISLNK. Reported by Paul Eggert in
1262 http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
1264 2005-02-28 Jim Meyering <jim@meyering.net>
1266 * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
1268 2005-02-21 Paul Eggert <eggert@cs.ucla.edu>
1270 * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
1271 (nanosec_libs): Add $(LIB_XNANOSLEEP). Needed for newer GNU/Linux
1272 hosts with clock_gettime.
1274 2005-02-20 Paul Eggert <eggert@cs.ucla.edu>
1276 * NEWS: Describe user-visible change to dd.
1277 * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
1278 Remove $(LIB_CLOCK_GETTIME). These functions now use
1280 * src/dd.c: Include gethrxtime.h, xtime.h.
1281 (start_time): Now of type xtime_t, not struct timespec.
1282 (print_stats, main): Use gethrxtime rather than gettime.
1283 * src/ls.c (time): Remove obsolete decl.
1284 (get_current_time): gettimeofday always returns 0, so don't
1286 * src/shred.c: Include gethrxtime.h.
1287 (isaac_seed): Use gethrxtime rather than a mishmash.
1288 * src/touch.c (time): Remove obsolete decl.
1290 * tests/misc/split-fail: Don't assume that the current host
1291 supports integers wider than 32 bits. Fix comment typo.
1292 * tests/od/x8: Likewise.
1294 * src/chown-core.c (enum RCH_status): Remove trailing comma,
1295 as it's not valid in standard C89.
1297 2005-02-15 Jim Meyering <jim@meyering.net>
1299 * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
1300 so that file systems of type `xfs' are recognized as such.
1301 * src/fs.h: Regenerate.
1302 Reported by Bernd Eckenfels.
1303 * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
1304 * src/fs.h: Regenerate.
1305 Reported by Andreas Schwab.
1307 * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
1308 to work around the invalid definition from Darwin 7.7.0.
1309 Test failure reported by Sébastien Maret.
1311 2005-02-14 Paul Eggert <eggert@cs.ucla.edu>
1313 * src/sort.c (mergefps): Use binary search rather than linear one
1314 when comparing new line to lines already in main memory.
1315 Idea suggested by James Lemley.
1317 2005-02-09 Jim Meyering <jim@meyering.net>
1319 * src/copy.c (valid_options): Add an assertion that
1320 not both hard_link and symbolic_link are set.
1322 2005-02-08 Paul Eggert <eggert@cs.ucla.edu>
1324 * NEWS: Document stat -f -c %S, plus changes to default formats.
1325 * doc/coreutils.texi (stat invocation): Normalize terminology,
1326 capitalization, and sort order to match --help output. Mention %c
1327 for file systems. Add new -f -c format %S, and document %s versus %S;
1328 problem reported by Jeroen van Wolffelaar.
1329 * src/stat.c (usage): Likewise.
1330 (STATFS_FRSIZE): New macro.
1331 (print_statfs): Use it, for stat -f -c %S.
1332 (do_statfs): Change default formats to output %S.
1334 2005-02-03 Paul Eggert <eggert@cs.ucla.edu>
1336 * src/system.h: Include "memrchr.h".
1337 (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
1339 2005-02-02 Jim Meyering <jim@meyering.net>
1341 * tests/du/8gb: Also adjust the test (s/64/128/) to detect
1342 systems that don't support sparse files.
1343 Check for $2 -ge 128, rather than $2 = 128, in case
1344 there is a file system type that doesn't support sparse files,
1345 yet for which metadata takes up additional space.
1346 Both reported by Andreas Schwab.
1348 2005-02-01 Eric Blake <ebb9@byu.net> (tiny change)
1350 * tests/du/8gb: Create a larger test file, so we properly
1351 detect that sparse files can be created on NTFS under cygwin.
1353 2005-01-30 Jim Meyering <jim@meyering.net>
1355 * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
1357 * src/stty.c: Remove unnecessary parentheses in all #if directives.
1359 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
1361 * .cvsignore: Ignore config.cache and config.status.lineno.
1362 * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
1363 instead of VSWTCH, for use with CSWTCH.
1365 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
1367 * tests/Makefile.am (.PHONY): Add check-root and root-hint.
1368 * tests/rwx-to-mode: Ignore ACL designation.
1369 * tests/setgid-check: Likewise.
1370 * tests/chown/separator: Quote user and group names.
1372 2005-01-24 Jim Meyering <jim@meyering.net>
1374 * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
1375 Suggestion from Johan Boule.
1377 2005-01-17 Eric Blake <ebb9@byu.net> (tiny change)
1379 * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
1381 * man/Makefile.am (all_programs): Revert previous patch; updated
1382 all_programs.list fixes this.
1383 (.x.1): No need to add $(EXEEXT).
1385 2005-01-03 Corinna Vinschen <corinna@vinschen.de> (tiny change)
1387 * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
1390 2005-01-22 Jim Meyering <jim@meyering.net>
1392 * Makefile.maint (v_etc_file): The version string has moved to
1393 version-etc-fsf.c, search that new file, not version-etc.c.
1395 2005-01-17 Paul Eggert <eggert@cs.ucla.edu>
1397 * tests/group-names: Use numeric group ids, not symbolic group names,
1398 since the latter can have shell metacharacters in them (e.g., spaces).
1399 Problem reported by Eric Blake.
1400 * tests/chgrp/basic: Assume groups are numeric, not symbolic.
1401 * tests/chgrp/deref: Likewise.
1402 * tests/chgrp/posix-H: Likewise.
1403 * tests/chgrp/recurse: Likewise.
1405 2005-01-15 Jim Meyering <jim@meyering.net>
1407 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
1408 because just calling gethrtime evokes an `illegal instruction'
1409 failure when compiled with Sun's c89 on Solaris 8 and 9.
1410 Reported by Nelson Beebe.
1412 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
1413 twice with the same value of `t'.
1414 Replace nested #if-#else blocks with #if-#elif-#elif chain.
1416 2005-01-14 Jim Meyering <jim@meyering.net>
1418 The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
1419 * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
1420 sockets, since that's what you get when reading from a command-line-
1421 supplied pipe on Darwin 7.7.
1422 (IS_PIPE_LIKE_FILE_TYPE): Define.
1423 (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
1424 Reported by Nelson Beebe.
1425 This same change is also required on NetBSD/sparc-1.5.
1426 Reported by Adrian Bunk.
1428 * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
1429 rather than suffering silently.
1430 Before, expr would silently overflow and wrap around:
1431 $ expr 9223372036854775808 = 0 # $(echo 2^63|bc)
1433 Now it detects the problem and exits nonzero:
1434 $ ./expr $(echo 2^63|bc) = 0
1435 ./expr: 9223372036854775808: integer is too large
1437 * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
1438 failure, so that doesn't cause `make check' to stop. Nelson Beebe
1439 reported that this test would fail with the diagnostic,
1440 `cannot find name for group ID 10', on one of his systems.
1442 2005-01-13 Jim Meyering <jim@meyering.net>
1444 * src/test.c (is_int): Don't overflow when evaluating integer
1445 constants. Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
1448 * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
1449 names of temporary files that would clash on 8.3 file systems.
1450 * tests/mk-script (validate): Likewise.
1452 2005-01-12 Jim Meyering <jim@meyering.net>
1454 * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
1456 * tests/tr/Test.pm (repeat-xC): Change test name from
1457 `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
1458 Reported by Eric Blake.
1459 (repeat-000): Rename to `repeat-zeros' for the same reason.
1461 2005-01-11 Jim Meyering <jim@meyering.net>
1463 * configure.ac: Update version to 5.3.1.
1465 2005-01-11 Eric Blake <ebb9@byu.net>
1467 * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
1468 * man/Makefile.am (all_programs): Account for $(EXEEXT).
1470 2005-01-11 Jim Meyering <jim@meyering.net>
1472 * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
1473 with decreasing values.
1475 * src/expand.c (main): Likewise.
1476 * src/unexpand.c (main): Check for overflow in tabstop values
1477 specified via the obsolete form. E.g., now this command fails:
1478 _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
1479 Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
1480 * tests/unexpand/basic-1 (obs-ovflo): New test for this.
1482 2005-01-10 Paul Eggert <eggert@cs.ucla.edu>
1484 Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
1485 * NEWS: Document the changes.
1486 * doc/coreutils.texi (pathchk invocation): Likewise.
1487 * src/pathchk.c (PORTABILITY_OPTION): New constant.
1488 (longopts, usage, main, validate_file_name):
1489 Add support for new -P option.
1490 Reject empty file names (unless -p is not specified and the
1491 current system allows empty file names).
1492 Change --portability so that is now equivalent to -p -P.
1493 Don't test whether file name is too long, if it is known to exist.
1494 (no_leading_hyphen): New function.
1495 * tests/misc/pathchk1: Add tests for empty file names and
1498 2005-01-08 Jim Meyering <jim@meyering.net>
1502 `pr --columns=N' was not equivalent to `pr -N' when also using
1505 * src/pr.c (main): Set `explicit_columns' for --columns=N,
1506 not just for -N. This bug has existed since the introduction
1507 of the --columns=N option on 1998-08-15.
1508 * NEWS: Document this.
1509 * tests/pr/Test.pm (test_vector): For each -N test, automatically
1510 create a new test vector using --columns=N.
1512 2005-01-07 Paul Eggert <eggert@twinsun.com>
1514 * src/pr.c (main): Check for column count overflow with
1515 usages like "pr -2147483648".
1517 2005-01-07 Jim Meyering <jim@meyering.net>
1519 * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
1521 2005-01-06 Jim Meyering <jim@meyering.net>
1523 * README: List the precise HP-UX version numbers that are affected.
1524 Suggestion from Bob Proulx.
1526 * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
1527 predicate before `-name ChangeLog' to avoid a harmless warning
1530 2005-01-05 Jim Meyering <jim@meyering.net>
1532 * tests/help-version: Punt on the uptime test, since it fails when
1533 it can't get boot time, and I don't want that to stop `make check'.
1535 * src/du.c (process_file): Evaluate exclusion rules against
1536 the entire file name, not just the last component.
1537 Reported by Robert Lindgren.
1538 * tests/du/exclude: Test for this.
1539 * NEWS: Document this.
1541 Ensure that tests/Makefile.am's check-root actions stay up to date.
1542 * Makefile.maint (sc_root_tests): New rule.
1543 (syntax-check-rules): Add it to the list.
1545 2005-01-04 Jim Meyering <jim@meyering.net>
1547 * man/shred.x: Change one-line summary to reflect that shred does
1548 not remove files by default. Suggestion from Helen Faulkner in
1549 http://bugs.debian.org/288552
1551 * README: Request VERBOSE=yes output when reporting test failures.
1552 Other minor changes.
1554 * tests/Makefile.am (check-root): Update.
1556 2005-01-03 Paul Eggert <eggert@cs.ucla.edu>
1558 * src/system.h: Undo previous change; we now use Autoconf.
1560 2005-01-03 Jim Meyering <jim@meyering.net>
1562 * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
1563 a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems. Setting
1564 either (or both) to zero would succeed, but subsequent `stty size'
1565 would say `no size information for this device' due to the ioctl
1566 failing with EINVAL.
1568 * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
1569 not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
1570 then fail at compile-time rather than let tools like od produce
1571 invalid results at run time.
1573 2004-12-21 Jim Meyering <jim@meyering.net>
1575 * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
1576 not `xx01, xx02, ...'.
1577 Reported by Matt Kraai in http://bugs.debian.org/286605
1579 * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
1582 2004-12-20 Paul Eggert <eggert@cs.ucla.edu>
1584 * src/split.c (usage): Mention default size. Suggested by Dan Jacobson.
1586 2004-12-19 Paul Eggert <eggert@cs.ucla.edu>
1588 * NEWS: Mention that one should eval "`dircolors`" rather than
1591 2004-12-17 Jim Meyering <jim@meyering.net>
1593 * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
1594 so temporary directories aren't left behind upon e.g., interrupt.
1596 2004-12-16 Paul Eggert <eggert@cs.ucla.edu>
1598 * src/ls.c (print_dir): Use "%s: not listing already-listed
1599 directory", not "not listing already-listed directory: %s", to
1600 format already-listed directories, to be consistent with other
1601 diagnostics involving file names and colons.
1603 2004-12-15 Jim Meyering <jim@meyering.net>
1605 * src/Makefile.am (__LDADD): Define, so that building `[' on
1606 Solaris still uses the -lgen library that it requires in order
1607 to get a definition of eaccess.
1609 2004-12-14 Jim Meyering <jim@meyering.net>
1611 tac would exit immediately upon I/O or temp-file creation failure.
1612 Now it continues on, processing any remaining command line arguments.
1614 * src/tac.c: Include quotearg.h.
1615 Use quotearg_colon in most diagnostics.
1616 (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
1617 failure. Before, this command (with /full/tmp being a full partition)
1618 TMPDIR=/full/tmp ./tac /proc/modules tac.c
1619 would exit immediately upon the write error while trying to copy
1620 non-seekable /proc/modules to the full partition. Now it still
1621 reports the failure but continues on with the remaining file.
1622 (tac_nonseekable): Return false also if copy_to_temp fails.
1623 [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
1624 using atexit like this is wrong.
1625 * NEWS: Document this.
1626 * tests/misc/tac-continue: New test for this.
1627 * tests/misc/Makefile.am (TESTS): Add tac-continue.
1629 * tests/chown/basic: Add a few more tests.
1631 2004-12-13 Paul Eggert <eggert@cs.ucla.edu>
1633 * src/ls.c (gobble_file): Change arg name to be command_line_arg
1634 rather than explicit_arg, for consistency with copy.c.
1635 (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
1636 it is deducible from dirname arg. All callers changed.
1637 (extract_dirs_from_files, print_dir, queue_directory):
1638 Add command_line_arg arg. All callers changed.
1639 (struct pending): Add command_line_arg member.
1640 (main): Use NULL rather than 0 when appropriate.
1641 (set_exit_status, file_failure): New functions.
1642 (queue_directory): Store command_line_arg into new structure.
1643 (print_dir, gobble_file, get_link_name):
1644 Use file_failure to report problems in accessing files,
1645 so that the exit status is set consistently.
1646 (print_dir): Simplify readdir failure code yet again.
1647 If closedir fails, report "closing directory" rather than "reading
1649 (xstrcoll): Use set_exit_status to set status on failure.
1650 * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
1653 2004-12-11 Jim Meyering <jim@meyering.net>
1655 Avoid a race condition vulnerability in chown, when used with
1656 --from=O:G and without the (-h) --no-dereference option.
1657 * src/chown-core.c (restricted_chown): New function.
1658 (change_file_owner): Call it.
1659 Reported by Ulrich Drepper.
1660 * NEWS: Mention this.
1662 2004-12-09 Paul Eggert <eggert@cs.ucla.edu>
1664 * ls now exits with status 1 on minor problems, 2 if serious trouble.
1665 * NEWS: Document this.
1666 * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
1667 All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
1669 (main): Initialize exit failure to LS_FAILURE.
1670 (print_dir, gobble_file, get_link_name, xstrcoll):
1671 Set exit status to LS_MINOR_PROBLEM if the failure is minor.
1672 (print_dir): Do not give up on entire directory merely because readdir
1674 (usage): Explain exit status.
1675 * tests/help-version: ls and variants now exit with status 2
1678 2004-12-08 Paul Eggert <eggert@cs.ucla.edu>
1680 * NEWS: Document new UTC+HH:MM date syntax, and put date changes
1683 2004-12-07 Paul Eggert <eggert@cs.ucla.edu>
1685 * src/factor.c (factor): Don't list 1 as a factor of 1.
1686 Problem reported by Thomas Folz-Donahue.
1688 2004-12-06 Jim Meyering <jim@meyering.net>
1690 * tests/du/files0-from: Sanitize environment.
1691 Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
1692 setting is the default (exported from /etc/profile) on at least one
1694 * tests/du/no-deref: Likewise.
1695 * tests/cp/symlink-slash: Likewise.
1696 * tests/ls/symlink-slash: Likewise
1698 2004-12-05 Jim Meyering <jim@meyering.net>
1700 * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
1701 _POSIX2_VERSION=199209 is in the environment, or when building on
1704 2004-12-04 Jim Meyering <jim@meyering.net>
1706 * NEWS: Mention cut's new --complement option.
1708 2004-10-01 Paolo Bonzini <bonzini@gnu.org>
1710 * cut.c (complement, COMPLEMENT_OPTION): New.
1711 (longopts): Add --complement.
1712 (usage): Say not that -b, -c, and -f `print' fields,
1713 but rather that they `select' fields for printing.
1714 Describe the new --complement option.
1715 (mark_range_start): Extracted from set_fields.
1716 (print_kth): Support --complement.
1717 (compare_ranges): New function.
1718 (set_fields): Rewrite the part that populates range_start_ht,
1719 merging it with the part that populates printable_field.
1720 (main): Handle --complement.
1722 2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
1724 * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
1725 failed. This works around an assertion failure reported by
1727 http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
1729 2004-12-02 Jim Meyering <jim@meyering.net>
1731 With using --color and with LS_COLORS saying not to color
1732 executables, don't stat every file.
1733 * src/ls.c (is_colored): New function.
1734 (gobble_file): Use it.
1735 (main): Use it here, in place of too-strict tests against NULL:
1736 if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
1737 old test would fail.
1739 2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
1741 * src/comm.c (compare_files): Assume setlocale exists.
1742 * src/join.c (keycmp): Likewise.
1743 * src/seq.c (decimal_point): Treat like sort. Now char.
1745 (main): Assume localeconv exists. Use same code as sort.
1746 * src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
1747 Assume setlocale exists.
1748 (thousands_sep): Renamed from th_sep.
1749 (IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
1750 (NONZERO): Parenthesize use of arg.
1751 (numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
1752 consistency. Avoid unnecessary negation by reversing
1754 (main): Rewrite localeconv call to match seq.c.
1755 * src/system.h: Assume locale.h exists.
1756 (HAVE_SETLOCALE): Remove.
1757 * src/uniq.c (different): Assume setlocale exists.
1759 * src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
1760 'volatile' on a local variable. Rewrite to avoid unnecessary
1761 double-assignment to 'func' in the usual case where strcoll does
1764 2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
1766 * src/pinky.c (gethostname): Remove decl.
1767 (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
1768 * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
1769 UT_TYPE_BOOT_TIME instead of by-hand code.
1770 * src/users.c (list_entries_users): Use IS_USER_PROCESS
1771 instead of by-hand code.
1772 * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
1773 DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
1774 (IS_USER_PROCESS): Move to ../lib/readutmp.h.
1775 (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
1776 UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
1777 (gethostname): Remove decl.
1778 (list_entries_who, scan_entries): Use the new macros defined above,
1779 for consistency with pinky, uptime, and users.
1781 2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
1783 Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
1784 HP's ANSI C compiler. Declaring int functions causes warnings on
1785 some modern systems and shouldn't be needed to compile on ancient
1787 * src/copy.h (stat, lstat, rename): Remove decls.
1788 * src/install.c (stat): Remove decl.
1789 * src/ln.c (link, symlink): Remove decls.
1791 2004-11-25 Jim Meyering <jim@meyering.net>
1793 * man/help2man: Import help2man-1.35.1.
1794 * man/Makefile.am (.x.1): Remove now-unnecessary use of
1795 locally-added --program-name=NAME option. Now, help2man gets
1796 the name from the [NAME] section (i.e. from our .x file).
1797 * man/install.x: Use `install', not `ginstall' in the one-line
1798 description. Reported by Brendan O'Dea.
1799 * man/sha1sum.x: Use `sha1sum', not `shasum'.
1801 2004-11-24 Jim Meyering <jim@meyering.net>
1803 Since the changes of 2004-05-22, the u.saved_cwd member at
1804 the bottom of the active-directory stack was no longer
1805 strictly necessary. This change removes that member and uses
1806 the newer cwd_state parameter for the final restore_cwd.
1808 * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
1809 [dev_ino]: Rename from `a'.
1810 (AD_pop_and_chdir): Add a parameter to play the role of just-removed
1811 bottom-of-stack cwd-state member.
1812 (AD_pop_and_chdir): No longer return boolean. Adjust caller.
1813 (AD_push_initial): Remove CWD parameter. Adjust caller.
1815 2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
1817 Minor performance improvements and cleanups for "touch".
1818 * src/touch.c (posix_date): Remove; not needed as a static var.
1820 (touch): Use new futimens function to operate more efficiently
1821 in some cases. Don't stat/fstat existing file when
1822 (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
1823 old time stamps aren't needed in that case.
1824 (main): change_times is int, not bool. Simplify test for
1827 2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
1829 * src/install.c (usage): Avoid usage that runs afoul of Docbook
1830 translation. Problem reported by Eric S. Raymond.
1832 Restore dd's noctty flag, reverting the change of 2004-04-08.
1833 POSIX does not allow "dd" to use O_NOCTTY by default.
1834 * NEWS: Add noctty flag to dd.
1835 * doc/coreutils.texi (dd invocation): Likewise.
1836 * src/dd.c (flags, usage, main): Likewise.
1838 2004-11-19 Alfred M. Szmidt <ams@gnu.org>
1840 * src/ls.c (usage): Clarified description of --no-group (-G),
1841 --human-readable (-h), --inode (-i), --size (-s), --time,
1844 2004-11-19 Jim Meyering <jim@meyering.net>
1846 * src/ls.c (usage): Clarify description of --author.
1847 Tweak indentation so that help2man creates better nroff.
1848 Reported by Dan Jacobson.
1850 * src/uniq.c (check_file): Don't check stdout for errors here.
1852 * src/pwd.c (find_dir_entry): Update comment to match reality.
1854 2004-11-18 Jim Meyering <jim@meyering.net>
1856 * src/pwd.c (robust_getcwd): Correct the comment: this function
1857 constructs the directory name. The caller prints it.
1859 2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
1861 * src/stat.c (STATFS): New macro, for portability to Solaris 9.
1862 (do_statfs): Use it.
1864 * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
1865 src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
1866 src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
1867 src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
1868 src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
1869 * src/readlink.c (main): argv is not const.
1871 * src/cut.c (usage): Improve documentation along the lines suggested
1873 * src/echo.c (usage): Likewise.
1874 * src/expr.c (usage): Likewise.
1876 * src/dircolors.hin: Add putty, screen-bce.
1878 * src/pinky.c (print_entry): Fix memory leak.
1879 * src/who.c (print_user): Likewise.
1881 2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
1883 * NEWS: New dd operand "status=noxfer".
1884 * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
1885 C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
1886 C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
1888 (STATUS_NOXFER, statuses): New constants.
1889 (usage, print_stats, scanargs): Add support for status=noxfer.
1890 (usage): Update status output to match new behavior.
1891 (print_stats): Always output complete byte count.
1892 Put space between numbers and units, as SI requires.
1893 Use ngettext so that i18n can use plurals for "byte" and "second".
1894 Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
1895 (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
1897 * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
1898 problems with regression testing.
1900 2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
1902 * NEWS: dd now outputs total bytes, seconds, and bytes per second.
1903 * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
1904 * src/dd.c: Include "human.h".
1905 (w_bytes, start_time): New vars.
1906 (usage): Document new I/O statistics output
1907 (print_stats): Output new I/O statistics.
1908 (cleanup): Do statistics after closing stdin and stdout, so that
1909 the times are more accurate.
1910 (write_output, dd_copy): Count output bytes.
1911 (main): Get initial value of clock.
1913 2004-11-14 Jim Meyering <jim@meyering.net>
1915 Backslash-escape `-'s in email addresses, so that they are
1916 rendered properly in UTF-locales.
1917 * man/help2man (escape_hyphens): New function.
1918 (main): Call it on email addresses.
1920 * src/sort.c (zaptemp): Mark new diagnostic for translation.
1922 * tests/misc/close-stdout: New file. Test today's closeout.c change.
1923 * tests/misc/Makefile.am (TESTS): Add close-stdout.
1925 2004-11-13 Jim Meyering <jim@meyering.net>
1927 * src/test.c (usage): Put the description of `[-n] STRING'
1928 on two lines, one for `-n STRING' and one for `STRING' so that
1929 help2man properly escapes the `-'. Otherwise, the hyphen is
1930 rendered inappropriately in UTF-8 locales.
1931 Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
1933 2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
1935 * NEWS: Document the following changes.
1937 * src/sort.c: Avoid O(N**2) behavior when there are many temporary
1939 (temptail): New variable, so that we can easily append to list.
1940 (create_temp_file): Create new files at end of list, so that
1941 searching the list has O(N*NMERGE) behavior instead of O(N**2).
1942 (zaptemp): Update temptail if needed.
1943 (mergefps, merge): Accept new arg that counts temp files, and keep it
1944 up to date as we create and remove temporaries. This is for
1945 efficiency, so that we don't call zaptemp so often.
1946 All callers changed.
1947 (sort): Don't create array in reverse order, since the list of
1948 temporaries is now in the correct order.
1950 (zaptemp): Protect against race condition: if 'sort' is
1951 interrupted in the middle of zaptemp, it might unlink the
1952 temporary file twice, and the second time this happens the file
1953 might already have been created by some other process.
1955 (zaptemp): Warn if a temporary file is not removed.
1957 (create_temp_file): Use offsetof for clarity.
1958 (die): Move it up earlier, to clean up the code a bit.
1960 * src/pr.c (strtoumax): Declare if not declared.
1961 (skip_to_page, first_page_number, last_page_number, page_number,
1962 first_last_page, print_header):
1963 Use uintmax_t for page numbers.
1964 (first_last_page): Remove unnecessary forward declaration.
1965 Do not modify arg (it is now a const pointer).
1966 Return a true if successful, false (without print a diagnostic)
1968 (main): If +XXX does not specify a valid page range, treat it
1969 as a file name. This follows the response to Open Group XCU ERN 41
1970 <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
1971 which says the behavior is allowed.
1972 (skip_to_page): When starting page number exceeds page count,
1973 print both numbers in the diagnostic.
1974 (print_header): Detect page number overflow.
1976 2004-11-07 Jim Meyering <jim@meyering.net>
1978 * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
1979 (main) [__APPLE__]: Get the processor type via syscall rather than
1980 hard-coding "powerpc". From Toby Peterson.
1982 * src/sort.c (merge): Remove declarations of now-unused variables.
1984 2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
1986 * src/sort.c (first_same_file): Remove. Move most of the code to....
1987 (avoid_trashing_input): New function.
1988 (merge): Avoid some silly merges, e.g., copying a single file to
1989 a temporary file when there are exactly 17 input files to merge.
1990 Take a count of temporary files rather than a max_merge arg.
1993 2004-11-06 Jim Meyering <jim@meyering.net>
1995 * src/sort.c (xfclose): Don't close stdout here (just flush it),
1996 since close_stdout now closes stdout unconditionally.
1998 2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
2000 * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
2001 first_same_file, merge, sort, main): Use size_t for indexes to arrays.
2002 This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
2004 (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
2005 thus avoiding unchecked stack overflow in some cases. As a side
2006 effect this improve the performance of "sort -M" by a factor of 4
2009 2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
2011 * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
2013 * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
2014 expression; it's not portable. Problem reported by Albert Chin.
2015 Don't invoke a program more than once.
2016 * src/groups.sh (version): New variable, containing author info,
2017 for benefit of AUTHORS check. Use it when acting on --version option.
2018 * AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
2021 * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
2022 as this breaks the new regime that does "#define getopt rpl_getopt".
2023 Problem reported by Albert Chin for Solaris 9 with Sun cc in:
2024 http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
2025 I suppose this may cause problems on ancient hosts with
2026 incompatible getopt declarations, but we'll cross that bridge if
2027 the problem gets reported to us by someone who can test the fix.
2029 2004-11-03 Jim Meyering <jim@meyering.net>
2031 * src/tac.c: quote(...) file names in diagnostics.
2033 2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
2035 * NEWS: Document getdate changes.
2037 2004-10-29 Jim Meyering <jim@meyering.net>
2039 * src/tac.c (tac_file): Remove temporary prototype and move this
2040 function `down' so that it precedes definition of tac_nonseekable.
2042 `tac /proc/modules' would print nothing
2043 Reported by Harald Dunkel in http://bugs.debian.org/278604.
2045 * src/tac.c (copy_to_temp): Renamed from save_stdin, since
2046 now it copies a general file descriptor, not just stdin.
2047 (tac_nonseekable): Renamed/adapted from tac_stdin.
2048 (tac_file): Get fd via `open' directly rather than via fopen/fileno,
2049 since we never used the stream. Perform "-" to stdin mapping here
2050 rather than in main. Determine whether a file is seekable,
2051 by trying to `lseek' to its end, and dispatch to tac_seekable or
2052 tac_nonseekable accordingly.
2053 (main): Rewrite argument handling now that it uses only tac_file.
2054 * NEWS: Mention it here.
2056 2004-10-21 Jim Meyering <jim@meyering.net>
2058 * tests/mv/leak-fd: New file.
2059 * tests/mv/Makefile.am (TESTS): Add it.
2060 * tests/rm/dot-rel: New file.
2061 * tests/rm/Makefile.am (TESTS): Add it.
2063 Correct my patch of 2004-10-18.
2064 * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
2065 if necessary, not in remove_dir. Otherwise, removing multiple
2066 `.'-relative nonempty directories no longer worked.
2068 2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
2070 * src/fmt.c (usage): Improve description of --prefix.
2071 Problem reported by Edward Welbourne.
2073 * man/uniq.x: Change summary so that it doesn't imply that
2074 uniq writes to its input file. Problem reported by
2077 2004-10-18 Jim Meyering <jim@meyering.net>
2079 Plug a leak that would cause a cross-device mv to fail when
2080 operating on too many command-line-specified nonempty directories.
2081 * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
2082 top of the stack before returning. This usually closes the file
2083 descriptor that was used to return to the original working directory.
2084 Reported by Cyril Bouthors in
2085 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
2086 * NEWS: Mention it here.
2088 * src/pathchk.c (validate_file_name): Give a more descriptive
2089 diagnostic when pathconf fails. This also avoids an unwarranted
2090 warning from gcc-3.3.5 about a format not being a string literal.
2092 * src/sleep.c (main): Remove declaration of unused local, c.
2093 * src/printenv.c (main): Likewise.
2094 * src/logname.c (main): Likewise.
2095 * src/uptime.c (main): Likewise, for optc.
2096 * src/tsort.c (main): Likewise, for opt.
2098 2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
2100 * AUTHORS: Add self to pathchk.
2101 * src/pathchk.c (AUTHORS): Add self.
2102 Change "path" to "file name" whenever possible.
2103 Remove usage comment, as it was a duplication of the code or doc.
2104 Include <wchar.h> if available.
2105 (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
2106 (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
2107 pathconf_wrapper, portable_chars, dir_ok): Remove.
2108 (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
2109 (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
2110 (portable_chars_only): New arg FILELEN.
2111 Don't assume ASCII; we might be on an EBCDIC host.
2112 Don't assume unibyte locale in diagnostic.
2113 (component_start, component_len): New functions.
2114 (validate_file_name): Renamed from validate_path. All uses changed.
2115 Pretty much a complete rewrite.
2116 Don't make copy of file arg. Always append trailing slash to
2117 pathconf arg, just in case it's a symlink (this is pure paranoia;
2118 we don't know of any hosts where the trailing slash is required).
2119 Use size_t instead of long int when possible.
2120 Avoid need to call pathconf in most practical cases.
2121 Don't use euidaccess several times to test searchability;
2122 just use lstat once. Reword diagnostic to put the (often very long)
2125 2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
2127 * src/printf.c (usage): Mention Unicode, and use H for hex digits.
2129 2004-10-13 Jim Meyering <jim@meyering.net>
2131 * NEWS: Mention today's fts.c fix.
2133 2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
2135 * tests/stty/row-col-1: Set LC_ALL=C.
2137 2004-10-12 Jim Meyering <jim@meyering.net>
2139 * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
2140 From Jesus Climent in http://bugs.debian.org/276149.
2142 2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
2144 * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
2145 problems. All uses changed.
2147 2004-10-05 Jim Meyering <jim@meyering.net>
2149 * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
2150 since Karl says its trailing blanks are there to stay :-)
2152 2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
2154 * src/expr.c (NEW, OLD): Remove, partly to avoid
2155 reference to obsolescent macro XMALLOC.
2156 All uses replaced by xmalloc and free.
2158 2004-09-28 Jim Meyering <jim@meyering.net>
2160 * src/tail.c (usage): Clarify: --retry works only with --follow=name.
2161 Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2163 2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
2165 * src/od.c (format_address_paren): c is optional, so don't output
2168 2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
2170 Add support for ls --hide. Idea suggested by Bardur Arantsson.
2171 * NEWS: Document this.
2172 * src/ls.c (file_ignored): Renamed from file_interesting, with
2173 inverted return value. Accept the file name, not a struct dirent *.
2174 All uses changed. Avoid the expense of calling fnmatch if the
2175 file is ignorable due to leading '.'.
2176 (all_files, really_all_files): Removed; replaced by:
2177 (ignore): New variable. All uses changed.
2178 (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
2180 (hide_patterns): New variable.
2181 (long_options, decode_switches, file_ignored, usage):
2182 Add support for --hide.
2183 (patterns_match): New function.
2184 (usage): Replace "hide" with "ignore" in explanation, to avoid
2187 2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
2189 * src/ls.c (gobble_file, print_long_format): Don't assume that
2190 human-readable output has a byte count equal to its column width;
2191 this isn't always true in locales where the radix character is not
2193 (format_user_or_group): Revamp code to match the above fix;
2194 this avoids the (very faint) possibility of integer overflow.
2196 2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
2198 * NEWS: Mention that "chmod -r -w x" now works as expected.
2199 * src/chmod.c (main): Revamp option processing to support this.
2200 * tests/chmod/Makefile.am (TESTS): Add 'usage'.
2201 * tests/chmod/usage: New set of tests for usage like that.
2203 2004-09-24 Jim Meyering <jim@meyering.net>
2205 * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
2206 it lists only cvs-controlled regular files.
2208 * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
2209 to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
2211 2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
2213 * Makefile.maint (CVS_LIST): New macro.
2214 (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
2215 sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
2216 sc_trailing_blank, po-check): Use it instead of the
2217 nonstandard "cvsu --list".
2219 * src/tail.c (parse_obsolete_option): Bring back support
2220 for obsolete option followed by non-obsolete, or by more
2221 than one file. When obsolete, conform to SUSv2 rather than
2222 original POSIX 1003.2-1992, as SUSv2 corrected the case of
2223 "tail -c". Add support for the SUSv2 "b" modifier.
2224 * NEWS: Mention the above.
2225 * tests/tail/Test.pm: New test case obs-b to check the above.
2226 err-[134] no longer need _POSIX2_VERSION=199209.
2227 Fix comments to match revised behavior.
2229 2004-09-22 Jim Meyering <jim@meyering.net>
2231 * Use automake-1.9.2. Regenerate dependent files.
2233 * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
2234 Improve the comment.
2236 Clean up scoping etc. so that some make `distcheck' tests pass.
2237 * src/csplit.c (xalloc_die): Declare to be static.
2238 * src/chown-core.c (chown_files): Declare as `extern'.
2239 * src/cp-hash.c (remember_created): Likewise.
2240 * src/copy.c (copy): Likewise.
2241 * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
2243 * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
2244 * src/unexpand.c: Likewise.
2246 * src/Makefile.am (check-AUTHORS): New rule.
2247 (check): Depend on it.
2250 * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
2251 (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2253 2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
2255 * src/ls.c (decode_switches): Don't compare a short value
2256 to SIZE_MAX: GCC sometimes complains.
2258 2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
2260 * NEWS: The following commands now reject unknown options:
2261 basename dirname factor hostname link nohup sync unlink yes
2262 Also, pathchk no longer accepts trailing options.
2264 * src/basename.c: Include <getopt.h>.
2265 * src/chroot.c: Likewise.
2266 * src/dirname.c: Likewise.
2267 * src/factor.c: Likewise.
2268 * src/hostid.c: Likewise.
2269 * src/hostname.c: Likewise.
2270 * src/nohup.c: Likewise.
2271 * src/pwd.c: Likewise.
2272 * src/setuidgid.c: Likewise.
2273 * src/sync.c: Likewise.
2275 * src/basename.c (main): Reject unknown options.
2276 * src/dirname.c (main): Likewise.
2277 * src/factor.c (main): Likewise.
2278 * src/hostid.c (main): Likewise.
2279 * src/hostname.c (main): Likewise.
2280 * src/link.c (main): Likewise.
2281 * src/nohup.c (main): Likewise.
2282 * src/pwd.c (main): Likewise.
2283 * src/setuidgid.c (main): Likewise.
2284 * src/sync.c (main): Likewise.
2285 * src/unlink.c (main): Likewise.
2286 * src/yes.c (main): Likewise.
2288 * src/cat.c (main): Remove unused "case 0".
2289 * src/chgrp.c (main): Likewise.
2290 * src/chmod.c (main): Likewise.
2291 * src/chown.c (main): Likewise.
2292 * src/comm.c (main): Likewise.
2293 * src/cp.c (main): Likewise.
2294 * src/csplit.c (main): Likewise.
2295 * src/cut.c (main): Likewise.
2296 * src/date.c (main): Likewise.
2297 * src/df.c (main): Likewise.
2298 * src/du.c (main): Likewise.
2299 * src/env.c (main): Likewise.
2300 * src/expand.c (main): Likewise.
2301 * src/fold.c (main): Likewise.
2302 * src/head.c (main): Likewise.
2303 * src/id.c (main): Likewise.
2304 * src/install.c (main): Likewise.
2305 * src/join.c (main): Likewise.
2306 * src/ln.c (main): Likewise.
2307 * src/ls.c (decode_switches): Likewise.
2308 * src/mkdir.c (main): Likewise.
2309 * src/mkfifo.c (main): Likewise.
2310 * src/mknode.c (main): Likewise.
2311 * src/mv.c (main): Likewise.
2312 * src/nl.c (main): Likewise.
2313 * src/paste.c (main): Likewise.
2314 * src/pinky.c (main): Likewise.
2315 * src/pr.c (main): Likewise.
2316 * src/ptx.c (main): Likewise.
2317 * src/readlink.c (main): Likewise.
2318 * src/rm.c (main): Likewise.
2319 * src/rmdir.c (main): Likewise.
2320 * src/seq.c (main): Likewise.
2321 * src/shred.c (main): Likewise.
2322 * src/split.c (main): Likewise.
2323 * src/sum.c (main): Likewise.
2324 * src/tac.c (main): Likewise.
2325 * src/tail.c (main): Likewise.
2326 * src/tee.c (main): Likewise.
2327 * src/touch.c (main): Likewise.
2328 * src/tr.c (main): Likewise.
2329 * src/tty.c (main): Likewise.
2330 * src/uname.c (main): Likewise.
2331 * src/unexpand.c (main): Likewise.
2332 * src/wc.c (main): Likewise.
2333 * src/who.c (main): Likewise.
2335 * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
2336 * src/cksum.c (main): Likewise.
2337 * src/dd.c (main): Likewise.
2338 * src/logname.c (main): Likewise.
2339 * src/printenv.c (main): Likewise.
2340 * src/sleep.c (main): Likewise.
2341 * src/tsort.c (main): Likewise.
2342 * src/uptime.c (main): Likewise.
2343 * src/users.c (main): Likewise.
2344 * src/whoami.c (main): Likewise.
2346 * src/du.c (long_options): Standardize on NULL vs 0.
2347 * src/rm.c (long_opts): Likewise.
2349 * src/logname.c (long_options): Remove.
2350 * src/printenv.c (long_options): Likewise.
2351 * src/sleep.c (long_options): Likewise.
2352 * src/tsort.c (long_options): Likewise.
2353 * src/uptime.c (longopts): Likewise.
2354 * src/users.c (longopts): Likewise.
2355 * src/whoami.c (long_options): Likewise.
2357 * src/pathchk.c (longopts): Add --help, --version.
2358 (main): Use longopts rather than parse_long_options.
2359 * src/stty.c (longpts, main): Likewise.
2361 * src/pathchk.c (main): Don't reorder arguments, so that
2362 we can check weird file names.
2364 * src/readlink.c: Don't include "long-options.h".
2365 * src/sort.c: Likewise.
2366 * src/stty.c: Likewise.
2368 * src/split.c (verbose): Now bool, not int.
2369 (VERBOSE_OPTION): New enum.
2370 (longopts, main): Use it.
2372 * tests/factor/basic: Adjust to new wording in diagnostic
2373 that results from the above changes.
2375 2004-09-21 Jim Meyering <jim@meyering.net>
2377 * man/rm.x: Say "the response is affirmative" rather than "the
2378 response begins with y or Y", so that the documentation is
2379 accurate in non-English locales. Problem reported by Munzir Taha.
2381 2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
2383 * src/echo.c (main): Don't pass NULL to strcmp when
2384 POSIXLY_CORRECT and given no arguments.
2386 * src/md5sum.c (STRING_OPTION): Remove.
2387 (long_options, main): Remove support for undocumented and
2388 obsolete --string option, as suggested in the 1996-09-26 patch.
2389 * NEWS: Document this.
2391 * tests/rm/fail-eperm: Don't try to remove writeable files in a
2392 sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
2393 you remove such files. Problem reported by Bert Fischer in:
2394 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2396 2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
2398 * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
2399 (long_options, main): Use them instead of magic numbers 2 and 1.
2400 For --string, optarg can't possibly be NULL.
2402 * src/dd.c (usage): Distinguish between options and operands.
2403 (scanargs): Don't mess with argc, argv; getopt_long handles this now.
2404 Say "operands" for operands, not "options".
2405 (main): Use getopt_long, so that "dd --" works as POSIX requires.
2406 * tests/dd/misc: Check for "dd --".
2408 * src/chroot.c (main): Reject unknown options instead of
2409 interpreting them as a directory to chroot to.
2411 * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
2412 The current standard (POSIX 1003.1-2004) is correct.
2413 (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
2414 collision with builtin function.
2415 (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
2416 output the first 0 as 8 digits, to make it easier to compare to
2417 the text of the standard. Output crctab to be a const array.
2418 (crctab): Use result of above changes.
2419 (long_options): Remove; not needed if empty.
2420 (main): getopt_long can't return 0 here, so simplify the code.
2422 2004-09-13 Jim Meyering <jim@meyering.net>
2424 * src/Makefile.am (localedir.h): Don't redirect directly to target.
2426 2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
2428 * src/id.c (print_full_info): Don't exit with failure status simply
2429 because a user or group number can't be turned into a name.
2430 Problem reported by Felipe Kellermann in:
2431 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2433 2004-09-12 Jim Meyering <jim@meyering.net>
2435 * Makefile.maint (my-distcheck): When building with -Werror, also
2438 2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
2440 * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
2441 * src/tail.c (parse_obsolete_option): Renamed from
2442 parse_obsolescent_option, since the options are obsolete now.
2443 Remove bool *arg; just exit if there's an error. Revamp to follow
2444 POSIX 1003.2-1992 more precisely, to handle cases like "tail -
2445 file" and "tail -10 -- file" correctly when we are conforming to
2447 (main): Adjust to this change.
2448 * tests/tail/Test.pm (test_vector): minus-* requires
2449 _POSIX2_VERSION=199209 now, to work correctly if there is
2450 an input file. err-1 and err-3 no longer errors if there
2453 2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
2455 * src/test.c (usage): Document -r, -w, -x more carefully.
2457 2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
2459 * src/test.c (usage): Document "test" (with no args) and "[ ]".
2460 Document that -h and -L don't dereference.
2462 * NEWS: Document that "tr xy -z" now works as per POSIX.
2463 Sort the descriptions.
2464 * src/tr.c (main): Don't reorder options.
2465 * tests/tr/Test.pm (fowler-1): New test case.
2467 2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
2469 * src/touch.c (main): Fix POSIX-conformance bug: "touch --
2470 MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
2471 conforming to pre-2001 POSIX.
2472 * NEWS: Document this.
2473 * tests/touch/obsolescent: Test for this bug. Also, set
2474 _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
2475 a better test for obsolescent features.
2477 * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
2478 "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
2481 * src/od.c: Several changes for POSIX and FreeBSD compatibility.
2482 (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
2483 (long_options, main): --strings is now -S, not -s.
2484 (usage): Reflect the usage changes.
2485 (parse_old_offset): Do not issue a diagnostic on failure;
2486 callers now do this as necessary.
2487 (main): Support POSIX syntax. Remove unused case 0 from getopt_long.
2488 Add support for new short options (many undocumented) for
2489 compatibility with FreeBSD. Remove FIXME for -s; it's now
2490 POSIX-compatible. Default format is now oS, not o2.
2491 * NEWS: Describe the above.
2493 2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
2495 * src/stty.c (valid_options): Remove.
2496 (main): Fix some bugs in handling invalid option-combinations
2498 (recover_mode): Arg is now char const *, not char *.
2499 (main): Use STDIN_FILENO, not 0.
2500 Simplify option-parsing code a tad.
2501 * tests/stty/basic-1: Check for the fixed bugs.
2503 2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
2505 * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
2506 it from ever being nonzero. Reported by Pozsar Balazs in:
2507 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
2508 (human_fstype): Add ramfs, squashfs, sysfs.
2509 Reported by Pozsar Balazs in:
2510 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
2511 (human_fstype): Return char const *, not char *.
2512 Simplify internals a bit, and avoid casts.
2514 * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
2515 (bit_count): Remove. All uses changed to....
2516 (multiple_bits_set): New function.
2517 (scanargs): Use it, and check separately for each set of
2518 incompatible options, to improve diagnostics.
2520 (apply_translations): Move checks for incompatible options
2521 to scanargs, so that they're done consistently.
2523 2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
2525 Output correct errno-related diagnostic on "paste" I/O errors.
2526 * src/paste.c (write_error, xputchar): New functions.
2527 (paste_parallel): Use correct errno value after input error.
2528 (paste_parallel, paste_serial): Report errno value after output error.
2530 Port to diet libc. Problem reported by Felix von Leitner in:
2531 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
2532 * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
2533 it's not portable C to assume FILE is a complete type.
2534 (paste_parallel): Use index test instead of ENDLIST, and NULL
2537 2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
2539 POSIX-conformance fixes for "expand" and "unexpand".
2540 Also, consistently use "tab stop" rather than "tabstop".
2541 * NEWS: Document fixes.
2542 * src/expand.c: Revamp to resemble the new unexpand.c better.
2543 (usage): -i does not convert tabs after non-tabs.
2544 (add_tab_stop): Renamed from add_tabstop. All uses changed.
2545 (parse_tab_stop): Renamed from parse_tabstop. All uses changed.
2546 (validate_tab_stop): Renamed from validate_tabstop. All uses changed.
2547 (next_file, main): Check fclose against 0, not EOF.
2548 (expand): Remove unnecessary casts.
2549 Add another loop nesting level, for lines, so that per-line variables
2550 are initialized cleanly.
2551 Revamp tab checking. Check for write error immediately, rather
2552 than just once at the end of the program.
2553 * src/unexpand.c: Lkewise (for the expand.c changes).
2554 (TAB_STOP_SENTINEL): Remove.
2555 (tab_size): Now size_t, not uintmax_t, since we need to store
2556 the sequences of blanks.
2557 (max_column_width): New var.
2558 (usage): Say "blank" where POSIX requires this.
2559 (add_tab_stop): Calculate maximum column width.
2560 (unexpand): Store the pending blanks, instead of merely counting them.
2561 Follow POSIX's rules about -a requiring two blanks before a tab stop.
2562 Get rid of internal label and goto.
2563 * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
2564 Add blanks-1 through blanks-13.
2566 2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
2568 * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
2569 succeed without changing the uid and gid, like FreeBSD.
2570 * src/chgrp.c (parse_group): Return gid_t rather than storing it
2571 through a pointer. Treat "chgrp '' file" as a no-op change,
2573 (main): Set chopt.group_name to NULL if the group is the empty
2575 * src/chown-core.c (describe_change): Describe changes to -1:-1
2576 without using "to OWNERSHIP" phrase.
2577 * src/chown.c (usage): "chown '' file" is now allowed.
2578 (main): Do not set user name to the empty string if the group
2580 * tests/chgrp/basic: Test "chgrp '' file".
2581 * tests/chown/Makefile.am (TESTS): Add separator.
2582 * tests/chown/separator: New file, partly taken from
2583 Dmitry V. Levin's suggestion in
2584 <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2586 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
2588 * tests/install/basic-1: Test for the -d regression.
2590 2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
2592 * src/install.c (main): Fix -d regression introduced with
2593 --target-directory support at 2004-06-25.
2595 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
2597 * src/copy.c (copy_internal): When preserving links, unlink
2598 a destination with link count greater than one. This is so
2599 that commands like "cp -a" don't get confused when copying into
2600 a destination that already contains many hard links. Problem
2601 reported by Tim Waugh in:
2602 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2604 2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
2606 Convert all files to UTF-8.
2607 * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
2608 * tests/sort/Test.pm (16a): Likewise.
2609 * tests/uniq/Test.pm (8): Likewise.
2610 * tests/misc/printf-hex: Use ASCII, not Latin-1.
2612 * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
2613 * src/shred.c (usage): "-" is an operand, not an option.
2614 * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
2615 A null file arg means standard output.
2616 (main): "-o -" means to write to a file named "-",
2617 not to standard output.
2618 * src/tee.c (usage, tee): "tee -" writes to standard output, not
2619 to a file named "-".
2621 2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
2623 * src/install.c (change_timestamps): Fix int->bool conversion
2624 bugs introduced on 2004-07-29.
2626 2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
2628 * src/shred.c (wipename): Work even if the directory is writeable
2629 and not readable. Prefer write access, since this should work
2630 better with fdatasync.
2632 * src/csplit.c (xalloc_die): New function.
2633 (main): Remove now-obsolete initialization of xalloc_fail_func.
2635 * src/md5sum.c: Adjust to sha->sha1 renaming.
2637 2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
2640 * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
2641 (can_mode): Make variable local.
2643 2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
2645 * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
2646 Do not define, to avoid annoying compiler messages on QNX 6.3.
2647 Problem reported by Johan in:
2648 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2650 2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
2652 * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
2653 Define to a concatenation of string literals, not to an expression;
2654 needed for concatenation contexts.
2655 (INTMAX_MAX, INTMAX_MIN): New macros.
2657 * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
2658 unsigned long; this isn't true for st_ino on Solaris 9.
2660 2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
2662 * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
2663 whether to include files. Include <sys/param.h> if
2664 HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
2665 (main) [defined __POWERPC__]: Add a kludge to work around a
2666 Mac OS X bug, so that uname -p defaults to "powerpc" if
2667 sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
2668 fails. Problem reported by Petter Reinholdtsen in:
2669 http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
2671 * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
2672 main): Use bool for booleans.
2673 (writeline, check_file): Use uintmax_t for line counts.
2674 (check_file): Check for and report line number overflow,
2676 * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
2677 (print_lines, print_words, print_chars, print_bytes, print_linelength,
2678 have_read_stdin, wc, wc_file, main):
2679 Use bool for booleans.
2680 (exit_status): Remove.
2681 (wc, wc_file): Return bool status. All callers changed.
2682 * src/who.c (scan_entries): 0 -> STDIN_FILENO.
2683 * src/whoami.c (main): Print uids using unsigned long int, not
2686 * src/unexpand.c: Int cleanup and minor reorganization to be more
2688 Include quote.h, xstrndup.h.
2689 (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
2690 (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
2692 Use bool for booleans.
2693 (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
2694 Use uintmax_t for column counts.
2695 (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
2696 (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
2698 (parse_tabstops): Don't use ISBLANK on possibly-signed char.
2699 Detect overflow in tab stop string.
2700 (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2701 (unexpand): Concatenate input files the same way expand does.
2703 * src/touch.c (no_create, use_ref, posix_date, amtime_now,
2704 touch, main): Use bool for booleans.
2705 (main): Avoid integer overflow when given more than INT_MAX
2707 * src/tsort.c (struct item, n_strings): Use size_t for sizes.
2708 (have_read_stdin, count_items, scan_zeros, detect_loop,
2709 recurse_tree, walk_tree, tsort, main):
2710 Use bool for booleans.
2711 (exit_status): Remove.
2712 (tsort): Return a success flag instead of storing into a global.
2714 * src/tty.c (silent, main): Use bool for booleans.
2715 (main): 0 -> STDIN_FILENO.
2716 * src/uname.c (print_element): Use bool for booleans.
2718 * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
2719 Remove. All uses replaced by C99 boolean primitives.
2720 (TEST_TRUE, TEST_FALSE): New constants, for readability.
2721 (test_unop, binop, unary_operator, binary_operator, two_arguments,
2722 three_arguments, posixtest, expr, term, and, or, is_int, age_of,
2723 one_argument, main): Use bool for booleans.
2724 (advance, unary_advance): Now inline procedures rather than a macros.
2725 (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
2726 (term, and, or): When it's easy, loop instead of recursing.
2727 (term): Avoid integer overflow if there are INT_MAX-3 args (!).
2728 (binary_operator, unary_operator): Simplify by systematically rewriting
2729 true==FOO to FOO (where FOO is a boolean).
2730 (unary_operator): Don't consider a file to be a regular file
2731 merely because its mode&S_IFMT is zero. Just use S_ISREG.
2732 Remove unnecessary casts. Remove ifdefs for things like
2733 S_ISSOCK that are no longer needed, since stat-macros.h always
2736 * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
2737 Use bool for booleans.
2738 (buf_init_from_stdin, buf_free, find_bol, print_line):
2739 Use size_t for sizes.
2740 * src/tac.c (separator_ends_record, tac_seekable, tac_file,
2741 tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
2742 (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
2743 (tac_seekable): Use ptrdiff_t for pointer subtraction.
2744 Report an error if the result is out of range.
2745 (tac_seekable, main): Check for integer overflow in buffer size
2747 (main): Remove unnecessary casts.
2749 * src/su.c (run_shell): Pass a new n_additional_args arg, so that
2750 the callee doesn't have to count 'em. All callers changed.
2751 Don't allocate more space for the arg vector than we'll need.
2752 Use memcpy to copy the args rather than rolling our own loop.
2753 Use size_t for sizes.
2754 (fast_startup, simulate_login, change_environment, log_su,
2755 correct_password, restricted_shell, main): Use bool for booleans.
2756 (longopts): Don't assume change_environment is an int.
2757 Use NULL, not 0, for pointers.
2758 (xsetenv): New function, replacing xputenv and concat.
2759 All callers changed.
2760 (elements): Remove; no longer needed.
2761 (log_su, correct_passwd, main): Prefer !x to x==NULL.
2762 (log_su): 2 -> STDERR_FILENO.
2763 (modify_environment, main): Don't assume that getenv's returned value
2764 has an indefinite lifetime.
2765 (modify_environment): Allocate a larger environ.
2766 (main): Remove an impossible 'case 0'; if it happens now, it'll
2767 get diagnosed. Don't assume getpwnam results outlive endpwent.
2768 Check for null or empty pw_name, pw_dir and for null pw_passwd.
2770 * src/stty.c (VA_START): Remove. All callers now use va_start.
2771 (_POSIX_VDISABLE): Remove unnecessary cast.
2772 (struct control_info, visible): Use cc_t for control chars.
2773 (struct control_info): Use size_t for sizes.
2774 (recover_mode, set_mode, display_speed, display_window_size,
2775 valid_options, main, display_changed):
2776 Use bool for booleans.
2777 (integer_arg): Return unsigned long int, not long int.
2778 Accept new max arg; all callers changed, to specify a maximum
2779 value for integer parameters instead of silently overflowing.
2780 (wrap): Do not overrun the stack buffer if the output contains
2781 more than 1024 bytes. Instead, malloc a buffer.
2782 (main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
2783 Remove unnecessary casts.
2784 (set_control_char): Allow int values only up to cc_t range.
2785 (screen_columns): Don't reject INT_MAX.
2786 (display_changed, display_all, display_speed, recover_mode):
2787 Don't assume cc_t fits in int.
2789 * src/remove.h: Add copyright notice.
2790 (struct rm_options): Use bool for booleans.
2791 * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
2792 errno_rmdir_non_empty, remove_parents, main): Likewise.
2793 * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
2795 (main): Don't dump core if invoked with argv[0]==NULL.
2796 * src/tee.c (tee, append, ignore_interrupts, main, tee):
2797 Use bool for booleans.
2798 (tee): Use ssize_t for read returns.
2800 * src/ptx.c: Add a FIXME mentioning that there are many
2801 unchecked integer overflows in this file.
2802 (gnu_extensions, auto_reference, input_reference, right_reference,
2803 ignore_case, initialize_regex, fix_output_parameters,
2804 output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
2805 Use bool for booleans.
2806 (SKIP_SOMETHING, compare_words, digest_break_file,
2807 find_occurs_in_text, fix_output_parameters):
2808 Use to_uchar instead of a caset.
2809 (print_field): Rewrite to avoid cast.
2811 * src/printf.c (posixly_correct): Use bool for booleans.
2812 (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
2813 (STRTOX): Rewrite to avoid casts.
2814 (print_esc_char): Arg is char, not int.
2815 * src/readlink.c (canonicalize): Remove. All uses now merely inspect
2817 (no_newline, verbose): Use bool for booleans.
2818 (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
2819 * src/shred.c (struct Options, main): Use bool for booleans.
2820 (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
2821 * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
2822 Use bool for booleans.
2823 * src/stat.c (G_fail): Remove.
2824 (print_statfs): Print various gotta-be-nonnegative values using
2825 unsigned long int, not long int or int.
2826 (do_statfs, do_stat): Return a boolean success flag.
2827 (do_stat, main): Use bool for booleans.
2829 * src/pr.c: Add a FIXME mentioning that there are many
2830 unchecked integer overflows in this file.
2831 (TRUE, FALSE): Remove. All uses replaced by true and false.
2832 (struct COLUMN, read_line, print_page, print_stored, open_file,
2833 skip_to_page, init_fps, parallel_files, align_empty_cols,
2834 empty_line, FF_only, explicit_columns, extremities, keep_FF,
2835 print_a_FF, print_a_header, use_form_feed, have_read_stdin,
2836 print_across_flag, storing_columns, balance_columns,
2837 truncate_lines, join_lines, untabify_input, failed_opens,
2838 numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
2839 double_space, ignore_failed_opens, use_col_separator,
2840 pad_vertically, last_line, main, init_parameters, skip_read,
2841 read_line, print_stored):
2842 Use bool for booleans.
2843 (struct COLUMN, char_to_clump, store_char, print_char):
2845 (clump_buff, print_clump): Use char[], not int[], for an array whose
2846 elements are always chars.
2847 (first_last_page, main, getoptarg, balance, add_line_number,
2848 char_to_uclump): Remove unnecessary casts.
2849 (init_parameters): Allocate chars, not ints, for clump_buff.
2850 (print_char): Use to_uchar before invoking ISPRINT.
2851 (char_to_clump): Convert to unsigned char before invoking ISPRINT.
2853 * src/nohup.c (main): Use bool for booleans.
2854 * src/paste.c (paste_parallel, paste_serial, main): Likewise.
2855 * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
2856 (portable_chars_only): Use to_uchar rather than a cast.
2857 * src/printenv.c (main): Use bool for booleans.
2858 Do not assume that the environ has at most one matching entry
2859 for each option (integer overflow was possible otherwise).
2861 * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
2862 constant. Do not assume PRIdMAX etc. are strings of length 3 or
2864 (struct tspec): Use it. fmt_string is now an array, not
2865 a pointer, as there's little point to the indirection here.
2866 (struct tspec, flag_dump_strings,
2867 traditional, flag_pseudo_start, limit_bytes_to_format,
2868 abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
2869 decode_one_format, open_next_file, check_and_close,
2870 decode_format_string, skip, write_block, read_char, read_block,
2871 parse_old_offset, dump, dump_strings, main):
2872 Use bool for booleans.
2873 (struct tspec): Use void *, not char *, for generic pointers.
2874 (bytes_to_oct_digits, bytes_to_signed_dec_digits,
2875 bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
2876 Use char, not unsigned int, since char suffices.
2877 (print_s_char, print_char, print_s_short, print_short,
2878 print_int, print_long, print_long_long, print_float,
2879 print_double, print_long_double): Rewrite to avoid casts.
2880 These now take void * arguments, instead of char *.
2881 Use the same body for all functions, except for the choice
2882 of type. Assume C89 to simplify handling of signed char.
2883 (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
2884 Rewrite to avoid casts.
2885 (print_named_ascii, print_ascii): Now takes void *, not char *.
2886 (decode_one_format): Use int for printf field widths, not
2887 unsigned int. Pass void * to subsidiary printers,
2888 not char *. Simplify handling of floating-point formats
2889 by factoring out common code dealing with precision and field width.
2890 (decode_format_string): Avoid need for temporary copy of
2891 each decoded struct tspec.
2892 (get_lcm): Remove unnecessary cast.
2893 (main): Fix bug where more than INT_MAX failed decodes were ignored.
2895 2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
2897 * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
2898 (enum number_format): Remove.
2899 (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
2901 (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
2902 (section_del): Now const.
2903 (print_fmt): Remove.
2904 (starting_line_number, page_incr, blank_join, line_no,
2905 print_lineno, proc_text, main):
2906 Use intmax_t for line numbers.
2907 (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
2908 Use bool for booleans.
2909 (lineno_format): Now a string, not an enum value.
2910 (build_print_fmt): Remove. All calls removed. This work is
2911 now done within print_lineno.
2912 (build_type_arg): Use size_t for sizes.
2913 (print_lineno): Check for line number overflow.
2914 (proc_text, main): Remove unnecessary cast.
2916 * src/ln.c (symbolic_link, interactive, remove_existing_files,
2917 verbose, hard_dir_link, dereference_dest_dir_symlinks,
2918 do_link, main): Use bool for booleans.
2920 * src/ls.c (struct fileinfo, file_interesting,
2921 extract_dirs_from_files, color_symlink_as_referent,
2922 FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
2923 numeric_ids, print_block_size, dired, print_with_color,
2924 check_symlink_color, print_inode, recursive, immediate_dirs,
2925 all_files, really_all_files, qmark_funny_chars,
2926 print_dir_name, format_needs_stat, format_needs_type, visit_dir,
2927 main, decode_switches, parse_ls_color, print_dir, file_interesting,
2928 gobble_file, make_link_path, basename_is_dot_or_dotdot,
2929 extract_dirs_from_files, print_long_format):
2930 Use bool for booleans.
2931 (dir_defaulted): Remove; no longer needed.
2932 (main): Use int to count files, since it suffices for argv.
2933 Rewrite to avoid need for dir_defaulted.
2934 (main, print_dir, gobble_file, get_link_name,
2936 Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
2937 (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
2938 Remove unnecessary cast to int. Use int instead of unsigned
2939 int to count from 0 to 1.
2940 (get_funky_string, print_type_indicator): Use char for bytes, not int.
2941 (make_link_path): Use NULL for null pointers.
2942 (quote_name): Use to_uchar instead of cast.
2944 * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
2945 print_full_info): Use bool for booleans.
2946 (problems): Remove, replacing with....
2947 (ok): New var (inverted from old sense).
2948 (print_user, print_group, print_full_info):
2949 Print uids/gids with %lu, not %u.
2950 (xgetgroups): Don't run out of memory if getgroups or getugroups
2952 * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
2954 * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
2955 int, since it suffices.
2956 (factor, print_factors): Use size_t for sizes.
2957 (print_factors, do_stdin, main): Use bool for booleans.
2958 * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
2959 (fold_file, main): Use bool for booleans.
2960 (fold_file, main): Use size_t for sizes.
2961 (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
2962 of prohibiting widths greater than INT_MAX.
2963 * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
2964 write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
2965 elide_tail_lines_pipe, elide_tail_lines_seekable,
2966 elide_tail_lines_file, head_bytes, head_lines, head, head_file,
2967 string_to_integer, main):
2968 Use bool for booleans.
2969 (main): Rewrite to avoid cast.
2971 * src/csplit.c (struct line): Use size_t for sizes.
2972 (main): Remove unnecessary cast.
2973 * src/cut.c (cut_fields): Use to_uchar rather than a cast.
2974 * src/cut.c (cut_file, main): Use bool for booleans.
2975 * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
2976 * src/env.c (main): Likewise.
2977 * src/expr.c (nextarg): Likewise.
2978 * src/env.c (main): Remove unused and nonstandard envp arg.
2980 * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
2981 fmt's arbitrary limits.
2982 (TRUE, FALSE): Remove; all uses changed to (true, false).
2983 (main): Use bool for booleans.
2984 Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
2986 (copy_rest): Remove unnecessary cast.
2987 (get_prefix): Rewrite to avoid cast.
2988 (check_punctuation): Use char *, not unsigned char *; C89 requires
2989 this. Avoid off-by-one buffer read overrun when line is empty.
2990 (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
2991 Remove unnecessary casts.
2992 * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
2995 * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
2996 next_file, expand, main):
2997 Use bool for booleans.
2998 (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
3000 Use uintmax_t for column counts.
3001 (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
3002 All callers changed.
3003 (parse_tabstops): Don't pass a negative char to isblank.
3004 Avoid memory leak with large tab stops.
3005 (validate_tabstops, expand): Don't assume number of tab stops is
3007 (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
3008 storing values into exit_status.
3009 (expand): Use same pattern as unexpand for reading chars.
3010 Report an error when input line is too long, instead of silently
3011 screwing up. Do not mishandle tab stops when backspacing left
3014 * src/dircolors.c (have_read_stdin, append_quoted,
3015 dc_parse_stream, dc_parse_file, main): Use bool for booleans.
3016 (dc_parse_stream): Use enum for state, rather than int.
3017 Use ssize_t to store getline result.
3019 * src/dd.c (translation_needed, parse_integer, scanargs,
3020 apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
3021 Use bool for booleans.
3022 (translate_buffer): Use to_uchar rather than a cast.
3023 (swab_buffer, copy_simple, copy_with_unblock):
3024 Use size_t for sizes.
3026 * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
3027 * src/sleep.c (apply_suffix): Likewise.
3028 * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
3029 forever, from_start, print_headers, have_read_stdin, valid_file_spec,
3030 write_header, file_lines, pipe_lines, pipe_bytes, recheck,
3031 tail_forever, tail_bytes, tail_lines, tail, tail_file,
3032 parse_obsolescent_option, parse_options, main): Likewise.
3033 * src/sleep.c (apply_suffix): Invert sense of result.
3034 Use int (not unsigned int) for multiplier, as this generates better
3035 code with some compilers. Simplify code a bit.
3036 * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
3037 parse_options): Use uintmax_t, not unsigned int or unsigned long int,
3039 (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
3040 make it a bit clearer.
3042 * src/hostname.c: Include "xgethostname.h".
3043 (xgethostname): Remove decl; xgethostname.h has it.
3044 (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
3045 && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
3046 prototypes rather than K&R form. Assume any negative value from
3047 sysinfo denotes failure, not just -1.
3048 (main): Simplify use of sethostname.
3050 * src/pinky.c (include_idle, include_heading, include_fullname,
3051 include_project, include_plan, include_home_and_shell, do_short_format,
3052 include_where, main): Use bool for booleans.
3053 (count_ampersands, create_fullname, scan_entries, short_pinky):
3054 Use size_t for sizes.
3055 (create_fullname): Check for overflow in size calculations.
3056 (idle_string): Don't assume that the number of idle days
3057 is less than 10**8 and/or INT_MAX/(24*60*60).
3058 (main): No need to pass a non-NULL last arg to getopt_long.
3059 * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
3060 (print_uptime): Remove unused local variable.
3061 (main): No need to pass a non-NULL last arg to getopt_long.
3062 * src/users.c (list_entries_users, users): Use size_t for sizes.
3063 (list_entries_users): Use char for bytes.
3064 (main): No need to pass a non-NULL last arg to getopt_long.
3065 * src/who.c (do_lookup, short_list, short_output, include_idle,
3066 include_heading, include_mesg, include_exit, need_boottime,
3067 need_deadprocs, need_login, need_initspawn, need_clockchange,
3068 need_runlevel, need_users, my_line_only, main): Use bool for booleans.
3069 (print_runlevel): Use unsigned char for bytes.
3070 (list_entries_who, scan_entries, who): Use size_t for sizes.
3071 (main): No need to pass a non-NULL last arg to getopt_long.
3073 * src/install.c (isdir): Remove decl.
3074 (install_file_to_path): Rely on make_path to fail if the destination
3075 is not a directory, by passing preserve_existing==true to it.
3076 Hence we no longer need to call isdir.
3077 Free dest_dir immediately when it's no longer needed, rather than
3078 waiting until the end of the function.
3079 (copy_file): Don't bother calling isdir, as copy will do the
3080 right thing if the destination is a directory.
3082 * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
3083 print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
3084 Use bool for booleans.
3085 (max_depth): Now size_t, not int, to avoid an arbitrary limit
3086 of INT_MAX on depth.
3087 (G_fail): Remove: no longer needed, now that the relevant
3088 functions return bool.
3089 (process_file): Use return value to signal success rather than
3090 setting a global. Remove first_call static var; not needed, since
3091 we can look at n_alloc. Use size_t for depths. Remove FIXME
3092 about size_t casts, as it's now fixed. Use xnrealloc rather
3093 than the obsolescent XREALLOC. Don't bother to check whether
3094 reallocation is needed unless level > prev_level.
3095 (du_files): Invert sense of result, for consistency with
3096 other coreutils code. All callers changed.
3097 (main): Allow --max-depth values up to SIZE_MAX.
3099 * src/df.c (inode_format, show_all_fs, show_local_fs,
3100 show_listed_fs, posix_format, require_sync, print_type,
3101 selected_fstype, excluded_fstype, show_dev, show_point, main):
3102 Use bool for booleans.
3103 (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
3104 (show_dev, show_point, main):
3105 Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3106 Don't assume disk name lengths are <= INT_MAX.
3107 Rewrite pct calculation to avoid cast.
3108 (show_point): Don't assume resolved length is <= SSIZE_MAX.
3110 * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
3111 instead of uintptr_t.
3112 * src/shred.c (UINT_MAX_32_BITS): Remove.
3113 (word32): Remove. All uses changed to uint32_t.
3114 (isaac_seed_data): Remove unnecessary cast.
3115 * src/system.h (ptr_align): Use size_t; in practice, this is just as
3116 good as uintptr_t in checking for alignments, and has fewer
3117 configuration hassles.
3119 * src/Makefile.am (localedir.h): Make it readonly; this
3120 undoes part of the 2004-07-27 patch.
3122 2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
3124 * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
3125 (IS_THOUSANDS_SEP): Use bool when appropriate.
3126 (numcompare, main): Use char, not int, when the value is always a char.
3127 (numcompare): Remove "register"; compilers are smart enough these days.
3128 * src/system.h (errno, CHAR_BIT): Remove decls;
3129 no longer needed now we assume C89 or better.
3130 Include <inttypes.h> before <stdint.h>, as it's the
3131 Autoconf-recommended pattern.
3132 (to_uchar): New inline function, moved here from tr.c.
3133 Use full names for int types, e.g. "long int" rather than "long".
3134 * src/tr.c (to_uchar): Remove; now in system.h.
3135 (is_char_class_member): Use bool when appropriate.
3137 * src/mkdir.c (create_parents, main): Use bool when appropriate.
3138 (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
3140 2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
3142 * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
3144 * src/chmod.c (recurse, force_silent, process_file, process_files,
3145 main): Use bool when appropriate.
3146 * src/cksum.c (cksum, main): Likewise.
3147 * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
3148 compare_files, main): Likewise.
3150 * src/copy.h (struct cp_options): Likewise.
3151 * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
3152 same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
3153 * src/cp-hash.h (remember_created): Likewise.
3154 * src/cp-hash.c (remember_created): Likewise.
3155 * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
3156 re_protect, make_path_private, target_directory_operand, do_copy,
3157 cp_option_init, decode_preserve_arg, main): Likewise.
3158 * src/install.c (isdir, change_timestamps, change_attributes,
3159 copy_file, install_file_to_path, install_file_in_dir,
3160 install_file_in_file, strip_files, dir_arg, cp_option_init, main,
3161 change_attributes, change_timestamps): Likewise.
3162 * src/mv.c (remove_trailing_slashes, rm_option_init,
3163 cp_option_init, do_move, movefile, main): Likewise.
3164 * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
3165 AD_push, prompt, remove_dir): Likewise.
3166 * src/rm.c (rm_option_init, main): Likewise.
3168 * src/remove.c (top_dir, pop_dir, full_filename_):
3169 Use size_t for sizes.
3170 * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
3171 succeeds. It's not necessary in that case, as *NEW_DST is always
3173 (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
3174 (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
3175 * src/rm.c (main): Likewise.
3177 md5sum, sha1sum integer cleanups.
3179 * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
3181 (ALG_UNSPECIFIED): Remove.
3182 (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
3183 * src/md5.c: Don't include any files other than checksum.h.
3184 * src/sha1sum.c: Likewise.
3185 * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
3186 bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
3187 Use bool when appropriate.
3188 (digest_check): Increase limit of number of input lines to
3189 UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
3190 Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
3192 2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
3194 * src/cat.c (exit_status): Remove. Now done by passing a boolean
3196 (simple_cat, cat): Return true if successful. All callers changed.
3197 (simple_cat, cat, main): Use bool for booleans.
3198 (simple_cat): Use size_t for sizes.
3199 (cat, main): Use the same names for parameters that we use for
3200 long options, to avoid confusion. This inverts the sense of the
3201 show_tabs (formerly output_tabs) and number_nonblank
3202 (formerly numbers_at_empty_lines) variables.
3203 (main): Don't mess up (due to integer overflow) if we are given
3204 INT_MAX - INT_MIN + 1 options.
3205 [O_BINARY]: Don't invoke isatty unless the other options require it.
3206 (main): When deciding whether to use simple_cat, don't worry
3207 about binary option; it's irrelevant.
3209 * src/dcgen: Remove comments, trailing white space, and empty
3210 lines from the output strings, to save space.
3211 Use a narrower type like 'unsigned char' for line lengths, if
3213 Make the output variables static, not extern.
3215 * src/chgrp.c (parse_group): Require base 10 when parsing
3217 (main): int -> bool when appropriate.
3218 * src/chown.c (main): Likewise.
3219 * src/chown-core.c: Include inttostr.h.
3220 (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
3221 (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
3222 instead of uint_to_string).
3223 (describe_change): Instead of an int flag, use a char *
3224 auxiliary; this avoids the need for casts.
3225 Assume free (NULL) works.
3226 (change_file_owner): Return true/false, not 0/-1, since
3227 we don't set errno. All callers changed.
3228 Use bool when appropriate.
3229 (chown_files): Likewise.
3230 * src/chown-core.h (chown_files): Likewise.
3232 * tests/chown/basic: Test for proper handling of uids like
3233 "010", which must be parsed as decimal.
3235 * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
3236 pwd when there are multiple names for the working directory
3237 (which can happen with an automounter, sigh).
3239 * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
3240 this causes Solaris 8 'make' to refuse to build "groups".
3241 (localedir.h): Don't depend on Makefile: this causes Solaris
3242 8 'make' to build localedir.h unnecessarily. The dependence
3243 on Makefile is ineffective anyway, since $(localedir) might
3244 change even if Makefile hasn't.
3246 * src/remove.c (remove_dir): If we can't save the state of the
3247 working directory, pretend we started from "/", not ".".
3248 This avoids a bug on hosts like Solaris that don't let you
3249 remove the working directory.
3251 2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
3253 * src/printf.c (strtiomax, strtoumax): Declare if not already
3254 declared: this fixes a portability bug with Solaris 8 + GCC.
3255 (STRTOX): Parenthesize use of macro arg as expression.
3256 (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
3258 * configure.ac: Check for declaration of strtoumax, for
3261 * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
3262 pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
3264 * tests/readlink/can-e: Don't assume that we can remove the
3265 working directory: this isn't possible under Solaris 8, say.
3266 * tests/readlink/can-f: Likewise.
3267 * tests/readlink/can-m: Likewise.
3269 * src/copy.c (copy_internal): find_backup_file_name no longer
3270 returns NULL, so don't bother to check for this.
3271 * src/cp.c (do_copy): Likewise.
3272 * src/ln.c (do_link): Likewise.
3274 2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
3276 * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
3278 (NZERO): New macro, if system doesn't define it already.
3279 (usage): Distinguish priorities from nice values.
3280 Don't assume NZERO is 20.
3281 (main): Use bool instead of int where appropriate.
3282 If user specifies an adjustment out of range, always truncate it
3283 to an inrange value instead of sometimes giving an error message
3285 Do not assume that -1 is an error return from "nice" or
3286 "getpriority", as it might be the current nice value minus NZERO.
3287 If nice/setpriority fails with errno == EPERM, go ahead and run
3288 the command anyway; POSIX requires this.
3290 * src/pathchk.c: Include euidaccess.h.
3291 (dir_ok): Use euidaccess, not access.
3292 * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
3293 (eaccess): Remove. All users changed to use euidaccess instead.
3295 2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
3297 * src/uptime.c (print_uptime) [defined BOOT_MSG]:
3298 Don't assume ut_line is null-terminated.
3299 * src/who.c (print_line): New arguments USERLEN and LINELEN,
3300 since USER and LINE might not be null terminated. All callers
3303 2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
3305 Fix bug with "tail -f" reported by Rob Holland in
3306 <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
3307 Also, remove the undocumented and unsupported-since-2000
3308 --max-consecutive-size-changes options. Fix another related bug:
3309 "tail" got confused if stdin, stdout, or stderr were closed.
3310 Also, use output buffering even with "tail -f".
3312 * NEWS: Document this, plus yesterday's patch.
3313 * doc/coreutils.texi (tail invocation): "size has remained the same"
3314 -> "file has not changed", which is more accurate for fifos.
3315 * src/tail.c: Include fcntl-safer.h.
3316 (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
3317 (COPY_A_BUFFER): New macro.
3318 (struct File_spec): New members mtime, mode, blocking.
3319 Remove member n_consecutive_size_changes.
3320 (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
3321 max_n_consecutive_size_changes_between_opens,
3322 MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
3323 (long_options, tail_forever, parse_options):
3324 Remove (non-)support for --max-consecutive-size-changes.
3325 (record_open_fd): New function.
3326 (recheck, tail_file): Use it. Don't assume that stdin is open.
3327 (dump_remainder): Add support for new COPY_A_BUFFER special value.
3328 Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
3329 (recheck): New arg BLOCKING, specifying whether to use blocking reads.
3331 (n_live_files): Remove, replacing with...
3332 (any_live_files): New function. All uses changed.
3333 (tail_forever): Use nonblocking I/O unless we know that blocking I/O
3334 is safe; this avoids some hangs when reading from a fifo.
3335 Avoid invoking fstat or sleep when using blocking I/O.
3336 Do not check for changes to size if the file is not a regular file,
3337 as the size is undefined in that case.
3338 Check for changes to mtime or mode, too; this works for non-regular
3340 (tail_forever, main): Redo fflush strategy to work even when input
3341 is nonblocking. Don't use unbuffered output; just flush when needed.
3343 2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
3345 * src/tail.c (main): Ignore -f if no file operand is specified
3346 and standard input is a pipe.
3347 * doc/coreutils.texi (tail invocation): Do not ignore -f for
3348 all pipes, just for when standard input is a pipe and no
3349 file operand is specified.
3350 * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
3351 Add a new commented-out f-2 test, which we still fail.
3352 (test_vector): All f-* tests are special cases, not just f-1.
3354 2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
3356 * src/uptime.c: Include c-strtod.h.
3357 (print_uptime): Use c_strtod instead of setlocale and sscanf.
3358 Use long int rather than int to count days (for 64-bit hosts),
3359 and check for arithmetic overflow when converting double to time_t.
3361 2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
3363 * src/printf.c (vstrtold): Renamed from vstrtod.
3364 Now returns long double. All uses changed.
3365 (print_direc): Use "L" length modifier when printing floating point
3366 numbers, since we're now printing long double.
3368 2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
3370 printf cleanup, to avoid undefined behavior, to add support for
3371 formats that Bash supports, and to support wide integers like
3374 * NEWS: Document this.
3375 * src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
3376 booleans, so that we don't reserve any values for precision or
3378 (STRTOX): Use prototype, not K&R-style definition.
3379 (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
3380 in ../lib), with type change to intmax_t.
3382 (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
3384 (vstrtod): Renamed from xstrtod. All uses changed.
3385 (print_direc): Use boolean arg instead of special value to indicate
3386 a missing precision or width. LENGTH no longer includes
3387 length modifiers or conversion character. New arg CONVERSION
3388 now specifies conversion character.
3389 Use intmax_t-width formatting for integers (like Bash).
3390 Add support for C99 %a, %A, %F (like Bash).
3391 Add support for field width with %c (POSIX requires this).
3392 Add a FIXME for lack of support for field width and precision
3394 Add support for '\'', '0' flags.
3395 Check for invalid combinations of flags, field width, precision,
3396 and conversion, to prevent use of undefined behavior.
3397 Allow multiple length modifiers, for formats like "%lld" (like Bash).
3398 Add support for C99 'j', 't', 'z' length modifiers (like Bash).
3399 In error message, output entire invalid conversion specification,
3400 instead of merely outputting % followed by the conversion char.
3401 * tests/misc/printf: Add tests for the above.
3403 2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
3405 Change "readlink -f" to be more compatible with prior implementations.
3406 Add more canonicalize options, -e and -m.
3407 Add comprehensive tests for all readlink modes.
3409 * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
3410 Do not add canonicalize.c here.
3412 * src/readlink.c (longopts): Add new options.
3413 (usage): Document them.
3414 (canonicalize_fname): New proxy function.
3415 (main): Handle new options.
3416 * doc/coreutils.texi (readlink invocation): Document new
3417 "readlink -f" behaviour and new canonicalize options, -e and -m.
3419 * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
3420 * tests/Makefile.am (SUBDIRS): Add readlink.
3421 * tests/readlink/Makefile.am: New file.
3422 * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
3423 * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
3424 * tests/misc/readlink: Remove file.
3426 2004-07-04 Jim Meyering <jim@meyering.net>
3428 * src/copy.c (copy_internal): Add a FIXME comment.
3430 2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
3432 * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
3433 * src/cp.c (do_copy): Likewise.
3434 * src/mv.c (movefile): Likewise.
3436 * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
3437 to avoid problem when path_concat dir name is longer than 2 GiB (!).
3439 * src/nohup.c (main): Don't pass NULL first argument to path_concat.
3440 This cleans up the semantics a bit, as we no longer try to open the
3443 2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
3445 * NEWS: Add short names -t and -T for --target-directory
3446 and --no-target-directory options, respectively.
3448 * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
3449 Remove. All uses changed to 'T' and 't', respectively.
3450 * src/install.c, src/ln.c, src/mv.c: Likewise.
3452 * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
3453 aliases for --target-directory and --no-target-directory,
3455 * src/install.c (long_options, main, usage): Likewise.
3456 * src/ln.c, src/mv.c: Likewise.
3458 2004-07-01 Jim Meyering <jim@meyering.net>
3460 * Makefile.maint (sc_file_system): New target.
3461 (syntax-check-rules): Add it.
3462 .x-sc_file_system: New file.
3463 * Makefile.am (EXTRA_DIST): Add it.
3465 * man/sync.x: Use "file system" rather than "filesystem".
3466 * man/stat.x, man/df.x: Likewise.
3468 2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
3470 * src/df.c (usage, main): Output "file system" rather than
3472 * src/du.c (usage): Likewise.
3473 * src/shred.c (usage): Likewise.
3474 * src/stat.c (usage): Likewise.
3475 * src/stat.c (long_options, usage): Rename "--filesystem" to
3476 "--file-system". But keep the old name around, for compatibility
3479 2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
3481 Add support for --no-target-directory option.
3483 * NEWS: Document it.
3484 * doc/coreutils.texi (Common options, Target directory, cp
3485 invocation, install invocation, mv invocation, ln invocation):
3487 (link invocation): Explain how to rewrite link using ln now
3488 that we have --no-target-directory.
3489 (ln invocation): Explain that --no-target-directory subsumes
3491 (unlink invocation): Modify wording to match new wording in
3494 * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
3495 (long_opts, usage, do_copy, main): Add support for
3496 --no-target-directory,
3497 * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
3499 * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3501 * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
3503 * src/mv.c (enum): Sort values.
3505 2004-06-29 Jim Meyering <jim@meyering.net>
3507 Don't let verbose-mode output from a subshell obscure actual differences.
3508 * tests/rm/inaccessible: Turn off command-echoing just before
3509 invoking subshell, then turn it back on if VERBOSE=yes afterward.
3511 2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
3513 Add support for 'install --target-directory', an option
3514 that has been documented for years but not implemented (!).
3515 * doc/coreutils.texi (install invocation): Document
3516 --target-directory in synopsis, too.
3517 * src/install.c (TARGET_DIRECTORY_OPTION): New var.
3518 (long_options, main, usage): Add --target-directory.
3519 (target_directory_operand): New function, stolen from mv.c.
3520 (main): Use it. Check for -d and --target-directory.
3521 Alter wording of diagnostics to match other programs.
3523 2004-06-28 Jim Meyering <jim@meyering.net>
3525 * src/cp.c (usage): Fix copy+paste error in description of
3526 --target-directory: s/move/copy/. From Paul Jarc.
3528 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
3530 Use more-consistent rules among cp, ln, and mv when dealing with
3531 last operands that are (or look like) directories.
3533 * src/cp.c (target_directory_operand): New, nearly-common function,
3534 It reports an error if the destination appears to be a directory
3535 (e.g., because it has a trailing slash) but is not.
3536 * src/ln.c, src/mv.c: Likewise.
3537 * src/cp.c (do_copy): Use it.
3538 * src/ln.c (main): Likewise.
3539 * src/mv.c (main): Likewise.
3541 * src/cp.c (do_copy): Don't assume argc is positive.
3542 Don't bother to lstat dest, since copy() will do that for us.
3543 Use "const" to avoid the need for cast.
3545 * src/cp.c (do_copy): Don't output a usage message because of file
3546 problems (e.g., an operand is not a directory). Use it only for
3547 syntax. Standardize on "target %s is not a directory" for the
3549 * src/ln.c (main): Likewise.
3550 * src/mv.c (main): Likewise.
3552 * src/cp.c (do_copy): Remove test for trailing slash, since
3553 target_directory_operand now does this.
3554 * src/ln.c (main): Likewise.
3555 * src/mv.c (movefile): Likewise.
3557 * src/cp.c (main): Reject multiple target directories.
3558 Check whether a specified target is a directory when parsing the
3559 options, using stat. This gives more-accurate diagnostics.
3560 * src/ln.c (main): Likewise.
3562 * src/ln.c (isdir): Remove decl; no longer needed.
3563 * src/mv.c (isdir, lstat): Likewise.
3565 * src/ln.c (do_link): New arg dest_is_dir. All uses changed.
3566 Don't check the destination ourself; rely on dest_is_dir.
3567 This way we can avoid lstatting the destination in the
3568 usual case, and in the worst case we lstat 1, not 3 times.
3569 Don't bother to unlink unless link failed; this saves a syscall.
3570 Remove unnecessary backup_succeeded flag;
3571 it was identical to "dest_backup != NULL".
3573 * src/ln.c (main): Use int to count to argc, not unsigned int.
3574 This handles negative operand counts.
3575 * src/mv.c (main): Likewise.
3577 * src/mv.c (do_move): Don't call hash_init; expect the caller to
3578 do it, for consistency with cp.c and ln.c. All callers changed.
3579 (movefile): dest_is_dir parameter is now bool, not int.
3580 (main): Standardize on "missing destination file operand after %s"
3581 for the diagnostic, for consistency with cp.c.
3583 * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
3584 will complain about the arg count.
3585 Adjust to new (briefer) diagnostics.
3586 * tests/cp/fail-perm: Add a test to verify that we get the new
3587 diagnostic when failing to copy through a symlink-to-inaccessible-dir.
3589 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
3591 Fix a bug: formerly, if d/x was a directory and x a file, "ln x
3592 d/" incorrectly created a link d/x/x. It also saves some system
3595 * NEWS: Document the fix.
3597 * src/ln.c (main): Don't append basename to dest if this
3598 results in an existing directory name.
3599 * tests/ln/misc: See whether a trailing slash is followed too far.
3601 2004-06-26 Jim Meyering <jim@meyering.net>
3603 * src/printf.c (main): When given no arguments, print the standard
3604 "missing operand\nTry printf --help..." message -- to be consistent.
3606 2004-06-26 Jim Meyering <jim@meyering.net>
3608 * src/mknod.c (main): Add \n at the end of message output via fprintf.
3610 2004-06-25 Jim Meyering <jim@meyering.net>
3612 * tests/ln/misc: Add test for ln subscript error.
3614 2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
3616 * src/ln.c (do_link): Remove unnecessary call to lstat.
3617 (main): Avoid subscript error when the destination is "".
3619 2004-06-23 Jim Meyering <jim@meyering.net>
3621 * tests/*: Replace all occurrences of `(exit N); exit' with
3622 `(exit N); exit N'. Otherwise, those many tests could exit with
3623 improper exit status when exiting via e.g., a trapped interrupt.
3624 Thanks to a report from Bob Proulx.
3626 2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
3628 * src/who.c (idle_string, print_user): New arg boottime,
3629 specifying the most recent boot time. All uses changed.
3630 (idle_string) Consider a line to be "old" if it hasn't been used
3631 since the last boot time. Watch out for overflow when computing
3632 times, and for times in the future.
3633 (idle_string): Record latest boot time.
3635 2004-06-22 Jim Meyering <jim@meyering.net>
3637 * src/test.c (usage): Correct description of `-t FD'. The file
3638 descriptor, FD, is no longer optional. Reported by Ton Nijkes.
3640 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
3642 The 2004-06-19 fix for who and pinky was incomplete, as ctime
3643 has undefined behavior if the year precedes -999 or follows 9999.
3644 Since we have to stop using ctime anyway, we might as well use
3645 strftime and fix the FIXME, and support internationalized dates.
3647 * NEWS: Document the new behavior.
3648 * src/who.c: Include "hard-locale.h".
3649 (time_format, time_format_width): New vars.
3650 (time_string, print_line): Use them.
3652 (time_string): Use localtime + strftime instead of
3653 ctime, to avoid problems with years before -999 or after 9999.
3654 * src/pinky.c: Likewise.
3656 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
3658 Fix bug: GNU 'ls' didn't count columns correctly if user or group
3659 names contained multibyte characters where the column count
3660 differed from the byte count. This patch also corrects
3663 * src/ls.c (format_user_or_group): New function, which counts
3665 (format_user, format_group): Use it.
3666 (format_user_or_group_width): New function, which counts columns
3668 (format_user_width, format_group_width): Use it.
3670 2004-06-21 Jim Meyering <jim@meyering.net>
3672 * tests/priv-check: Quote "$PATH" in PATH=$PATH.
3673 Suggestion from Andreas Schwab.
3675 * tests/priv-check: When running as root, be sure to propagate
3676 PATH through to the process we exec as non-root.
3677 Reported by michael@aplatform.com.
3679 * src/mknod.c (main): Don't segfault when calculating the
3680 expected number of operands for `mknod NAME'.
3682 2004-06-20 Jim Meyering <jim@meyering.net>
3684 * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
3686 2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
3688 * src/basename.c (main):
3689 Standardize on the diagnostics given when someone gives
3690 too few operands ("missing operand after `xxx'") or
3691 too many operands ("extra operand `xxx'").
3692 Include "quote.h" and/or "error.h" if it wasn't already being included.
3693 * src/chgrp.c (main): Likewise.
3694 * src/chmod.c (main): Likewise.
3695 * src/chown.c (main): Likewise.
3696 * src/chroot.c (main): Likewise.
3697 * src/comm.c (main): Likewise.
3698 * src/cp.c (do_copy): Likewise.
3699 * src/csplit.c (main): Likewise.
3700 * src/date.c (main): Likewise.
3701 * src/dircolors.c (main): Likewise.
3702 * src/dirname.c (main): Likewise.
3703 * src/du.c (main): Likewise.
3704 * src/expr.c (main): Likewise.
3705 * src/hostid.c (main): Likewise.
3706 * src/hostname.c (main): Likewise.
3707 * src/id.c (main): Likewise.
3708 * src/install.c (main): Likewise.
3709 * src/join.c (add_file_name, main): Likewise.
3710 * src/link.c (main): Likewise.
3711 * src/ln.c (main): Likewise.
3712 * src/logname.c (main): Likewise.
3713 * src/md5sum.c (main): Likewise.
3714 * src/mkdir.c (main): Likewise.
3715 * src/mkfifo.c (main): Likewise.
3716 * src/mknod.c (main): Likewise.
3717 * src/mv.c (main): Likewise.
3718 * src/nohup.c (main): Likewise.
3719 * src/od.c (main): Likewise.
3720 * src/pathchk.c (main): Likewise.
3721 * src/ptx.c (main): Likewise.
3722 * src/readlink.c (main): Likewise.
3723 * src/rm.c (main): Likewise.
3724 * src/rmdir.c (main): Likewise.
3725 * src/seq.c (main): Likewise.
3726 * src/setuidgid.c (main): Likewise.
3727 * src/shred.c (main): Likewise.
3728 * src/sleep.c (main): Likewise.
3729 * src/sort.c (main): Likewise.
3730 * src/split.c (main): Likewise.
3731 * src/stat.c (main): Likewise.
3732 * src/test.c (beyond, main): Likewise.
3733 * src/touch.c (main): Likewise.
3734 * src/tr.c (main): Likewise.
3735 * src/tsort.c (main): Likewise.
3736 * src/tty.c (main): Likewise.
3737 * src/uname.c (main): Likewise.
3738 * src/uniq.c (main): Likewise.
3739 * src/unlink.c (main): Likewise.
3740 * src/uptime.c (main): Likewise.
3741 * src/users.c (main): Likewise.
3742 * src/who.c (main): Likewise.
3743 * src/whoami.c (main): Likewise.
3745 * tests/basename/basic: Adjust to new diagnostics.
3746 * tests/du/files0-from: Likewise.
3747 * tests/expr/basic: Likewise.
3748 * tests/mv/diag: Likewise.
3749 * tests/tsort/basic-1: Likewise.
3751 2004-06-20 Jim Meyering <jim@meyering.net>
3753 * src/ln.c: Remove declaration of yesno.
3754 Instead, include yesno.h.
3755 * src/copy.c: Likewise.
3757 * src/remove.c: Remove declaration of yesno.
3758 Instead, include yesno.h.
3759 (top_dir): Remove now-unnecessary cast of obstack_base.
3760 (pop_dir): Likewise.
3761 (full_filename_): Likewise.
3763 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
3765 Don't dump core if ctime returns NULL; this is possible on
3766 hosts with 64-bit time_t and 32-bit int.
3767 * src/who.c: Include "inttostr.h".
3768 (time_string): If ctime fails, print the raw time as an integer
3769 instead of dumping core.
3770 * src/pinky.c: Likewise, as follows:
3771 Include "inttostr.h".
3772 (time_string): New function, copied from who.c.
3773 (print_entry): Use it.
3775 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
3777 * src/who.c (print_line): Don't truncate user names at 8 bytes.
3778 Problem reported by Guido Leenders in:
3779 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
3780 * NEWS: document this.
3782 2004-06-19 Jim Meyering <jim@meyering.net>
3784 * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
3785 using GNU_PACKAGE (from PACKAGE) once again. This restores
3786 `GNU' to the parenthesized package name in --version output.
3787 Before, the first argument from AC_INIT, `GNU coreutils', would
3788 be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
3789 Reported by Richard Stallman.
3791 2004-06-17 Jim Meyering <jim@meyering.net>
3793 * src/tr.c (to_uchar): Rename function from `uchar'. The latter
3794 would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
3796 2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
3798 * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
3799 allows the GNU behavior. "--" is now supported by chroot, hostid,
3800 hosname, pwd, sync, yes.
3801 * doc/coreutils.texi (yes invocation, false invocation,
3802 true invocation): Document this.
3803 * src/chroot.c (main): Handle "--".
3804 * src/hostid.c (main): Likewise.
3805 * src/hostname.c (main): Likewise.
3806 * src/pwd.c (main): Likewise.
3807 * src/sync.c (main): Likewise.
3808 * src/yes.c (main): Likewise.
3809 * src/true.c (main): Recognize --help and --version even if
3810 POSIXLY_CORRECT is set.
3811 * src/yes.c (main): Likewise.
3813 2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
3815 * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
3817 * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
3818 * src/ls.c (decode_switches): Pay attention to TABSIZE even if
3819 POSIXLY_CORRECT is set. POSIX reserves upper-case environment
3820 variables to the implementation, so it's OK for ls to depend on
3822 * src/pr.c: Include "hard-locale.h".
3823 (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
3824 POSIX specifies the behavior only in the POSIX locale.
3825 * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
3826 since POSIX says the behavior is unspecified here.
3827 * src/tail.c (parse_obsolescent_option): Support multiple file operands
3828 even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
3829 * src/printf.c (main): Recognize --help, --version even if
3830 POSIXLY_CORRECT. POSIX does not specify any options, but it
3831 does not prohibit options either, so "printf" is like "expr" here.
3832 * src/unlink.c (main): Likewise.
3833 * tests/misc/printf: Adjust to the new semantics for \x if
3836 2004-06-14 Jim Meyering <jim@meyering.net>
3838 * tests/misc/pwd: New test, for fix of 2004-04-19.
3839 * tests/misc/Makefile.am (TESTS): Add pwd.
3840 (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
3842 * src/copy.c: Remove declaration of euidaccess.
3843 Instead, include "euidaccess.h".
3845 2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
3847 * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
3848 (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
3849 as (sizeof "??") reliably returns 3.
3850 (print_line): Guard against idle and pid being too long
3851 (which is possible when printing headers).
3852 (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
3853 Avoid unnecessary cast of sizeof to int.
3854 (make_id_equals_comment): Do not assume that UT_ID returns
3855 a string; it might return a non-null-terminated array.
3856 Use strncat instead. It's not very often where strncat is
3857 exactly what you want, but this is one of those rare cases.
3859 2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
3861 * src/who.c (list_entries_who): Don't output a trailing space.
3863 2004-06-09 Jim Meyering <jim@meyering.net>
3865 * src/touch.c (usage): Improve wording in description of the
3866 --time=WORD option. Reported by Dan Jacobson.
3868 * src/chown-core.c (change_file_owner): Change names of parameters
3869 old_uid and old_gid to required_uid and required_gid respectively.
3871 * src/chmod.c (mode_changed): Return false, not 0, now that the
3872 function returns `bool'.
3874 2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
3876 Adjust chmod and chown to be similar if -c or -v are given. In
3877 particular, a no-op chown is no longer reported as a change; this
3878 reverts to previous behavior. Also, fix both commands so that -v
3879 report failures even if the failure is not due to the chmod or
3882 * src/chmod.c (CH_NOT_APPLIED): New constant.
3883 (describe_change): Handle it.
3884 (process_file): Use it, if a symlink wasn't changed.
3885 (mode_changed): Return bool, not int. Accept new argument
3886 NEW_MODE; all callers changed. This lets us avoid statting the
3887 file unless the new mode has unusual bits.
3888 (process_file): Return -1 on error. With -v, report all errors
3889 verbosely, not just some.
3891 * src/chown-core.c (change_file_owner): Return -1 on error, not
3892 1 sometimes and -1 on others. Our caller ORs together our results,
3893 and (-1 | 1) == 0 on ones-complement hosts.
3894 With -v report all errors verbosely, not just some.
3895 Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
3896 file_stats wasn't set properly in that case.
3898 * tests/chgrp/basic: Adjust to above changes.
3900 2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
3902 * tests/chgrp/basic: Test that chgrp -h does not fail on
3903 symlinks, even on hosts where that's not supported.
3904 Test that if -R is specified without -H or L, -h is assumed.
3905 Test that chown() is not optimized away.
3907 2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
3909 Several fixes to chgrp and chown for compatibility with POSIX and BSD:
3911 Check for incompatible options. When -R and --dereference are
3912 both used, then either -H or -L must also be used. When -R and -h
3913 are both used, then -P must be in effect.
3915 -H, -L, and -P have no effect unless -R is also specified.
3916 If -P and -R are both specified, -h is assumed.
3918 Do not optimize away the chown() system call when the file's owner
3919 and group already have the desired value. This optimization was
3920 incorrect, as it failed to updated the last-changed time and reset
3921 special permission bits, as POSIX requires.
3923 Do not report an error if the owner or group of a
3924 recursively-encountered symbolic link cannot be updated because
3925 the file system does not support it.
3927 * NEWS: Document the above.
3929 * src/chgrp.c (main): Check for incompatible options. -R --dereference
3930 requires either -H or -L, and -R -h requires -P. If -H, specify
3931 FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
3932 file as much like chown.c as possible.
3933 * src/chown.c (main): Likewise.
3935 * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
3936 needed. Chown a directory only after chowning its children; this
3937 avoids problems if the new directory ownership doesn't permit
3938 access to the children. Dereference symlinks before doing
3939 ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
3940 Do not optimize away the chown() system call when the file's owner
3941 and group already have the desired value. POSIX does not permit
3942 this optimization. Rely on chown and lchown to do the right
3943 thing with symlinks and/or -1 arguments, now that we have wrappers
3944 to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
3945 errors, not just command-line errors.
3946 (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
3948 * src/system.h (ENOTSUP): Remove.
3950 * tests/chgrp/basic: Use chown --from to discover whether the
3951 group changed, since chgrp now changes unconditionally. This
3952 complicates the sed script a bit. Do not specify --dereference,
3953 since it's the default (and we want to test this). Adjust output
3954 to match the fact that chgrp no longer optimizes the case of
3955 changing a file's group to the same value as before.
3956 * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
3957 options are incompatible, and their behavior is undefined with POSIX.
3958 (changed, not_changed): Adjust to match the fact that -h is no longer
3959 specified. Sort names.
3960 * tests/chown/deref: Adjust error-diagnostic spelling to match new
3963 2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
3965 * src/uname.c (main): Fix typo introduced on 2003-05-10 that
3966 prevented a diagnostic of any operands.
3968 2004-06-08 Jim Meyering <jim@meyering.net>
3970 * src/shred.c (direct_mode): Turn it on/off with directio, too.
3972 2004-06-07 Jim Meyering <jim@meyering.net>
3974 Enable direct-mode I/O (bypassing the buffer cache), if possible.
3975 Prompted by a suggestion from Kalle Olavi Niemitalo
3976 in http://bugs.debian.org/207035.
3977 * src/shred.c (direct_mode): New function.
3978 (do_wipefd): Turn on direct-mode I/O.
3979 (dopass): If a file's first write fails with EINVAL,
3980 turn off direct-mode I/O and retry the write.
3982 2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
3984 * src/tr.c (main): "tr -d a b" is now a fatal error even if
3985 POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
3988 2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
3990 * src/shred.c (dopass): Don't subtract 1 from the offset after
3991 a write error. Problem reported by Jon Peatfield in:
3992 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
3994 2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
3996 Fix bug reported by Buciuman Adrian in
3997 <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
3998 where 'dd' created a file that was too large. The bug was that dd
3999 assumed that the input file offset does not advance after a failed
4000 read; but POSIX says that the input file offset is undefined after
4003 * src/dd.c (MAX_BLOCKSIZE): New macro.
4004 (input_seekable, input_seek_errno, input_offset,
4005 input_offset_overflow): New vars.
4006 (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
4007 (advance_input_offset): New function.
4008 (skip_via_lseek): Set errno to zero when reporting our failure,
4009 so that we don't report based on garbage errno.
4010 (skip): If fdesc is standard input, advance the input offset.
4011 Do not quit if reading, and if noerror was specified;
4012 POSIX seems to require this.
4013 If read fails on output file, report the earlier lseek failure
4014 instead; this fixes a FIXME in dd_copy.
4015 (advance_input_after_read_error): New function.
4016 (dd_copy): Use it, instead of assuming that failed reads
4017 do not advance the file pointer. Advance input offset
4018 after nonfailed reads. Advance only a partial block if
4019 the previous read (before the failed read) succeeded, and
4020 do not generate an output block of zeros in this case.
4021 (main): Determine initial input offset, seekability of input,
4022 and error if it wasn't seekable.
4024 2004-06-02 Jim Meyering <jim@meyering.net>
4026 rm (without -f) could hang unnecessarily when attempting to
4027 remove a symlink to a file on an off-line NFS-mounted partition.
4028 Reported by David Howells in https://bugzilla.redhat.com/124699.
4029 * src/remove.c (write_protected_non_symlink): New function.
4030 Don't invoke euidaccess on symlinks.
4031 (prompt): Use write_protected_non_symlink rather than using
4032 euidaccess directly, being careful not to call lstat twice for a file.
4034 Fix a bug in how the --output-delimiter=D option works with
4035 abutting byte or character ranges. Reported by David Krider in
4036 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
4037 * src/cut.c (print_kth): Remove special case for open-ended range.
4038 (set_fields): Record the range start index for an interval even
4039 when it abuts another interval on its low side.
4040 Also record the range start index of the longest right-open-interval.
4041 * tests/cut/Test.pm: Add tests of --output-delimiter=S with
4042 abutting and overlapping byte ranges.
4044 2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
4046 Some POSIX-conformance cleanups for tr.
4048 * src/tr.c (posix_pedantic): Remove; no longer needed since
4049 we need to test this in just one place now.
4050 (usage): Mention -C.
4051 (unquote): Note that \055, \n, etc are escaped.
4052 Do not worry about POSIXLY_CORRECT when warning about ambiguous
4054 \ at end of string stands for itself.
4055 Do not diagnose invalid backslash escapes: POSIX says the behavior
4056 is unspecified in this case, so we don't need to diagnose it.
4057 (main): Add support for -C (currently an alias for -c).
4058 Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
4060 * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
4061 Fix comment for range-a-a.
4063 2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
4065 Improve the efficiency (and in one case, correctness) of code
4066 that reads symlinks.
4068 * src/copy.c (copy_internal): Don't use alloca, as it can mess up
4069 royally if the link length is long (e.g., GNU/Hurd). Use
4070 xreadlink instead, it's safer. Don't bother to read the link if
4071 it's the wrong size. Add a FIXME because this area is a bit murky
4073 * src/ls.c (get_link_name): Update use of xreadlink.
4074 * src/readlink.c (main): Likewise.
4075 * src/stat.c (print_stat): Likewise.
4077 2004-06-01 Jim Meyering <jim@meyering.net>
4079 * src/env.c (main): Prefer the notation `STREQ (a, b)'
4080 over `!strcmp (a, b)'.
4081 * src/sort.c (main, sort_buffer_size): Prefer the notation
4082 `STREQ (a, b)' over `strcmp (a, b) == 0'.
4083 * src/date.c (batch_convert): Likewise.
4084 * src/expr.c (nextarg): Likewise.
4085 * src/su.c (correct_password, restricted_shell, main): Likewise.
4086 * src/ptx.c (swallow_file_in_memory, main): Likewise.
4087 * src/test.c (binary_operator, and, or, main): Likewise.
4089 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
4091 * NEWS: echo compatibility cleanup.
4092 * doc/coreutils.texi (echo invocation): Document the changes.
4093 * src/echo.c (V9_ECHO): Remove; always enabled.
4094 (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
4095 we use the same naming convention as bash. Now an enum,
4097 (usage): Reword to mention -e/-E more accurately.
4098 Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
4099 (hextobin): New function.
4100 (main): Use bool rather than int for local vars when appropriate.
4101 Do not allow options if POSIXLY_CORRECT, unless we are using
4102 BSD semantics and the first argument is "-n".
4103 Don't pass unnecessary extra arg to parse_long_options.
4104 do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
4105 Do not look for options if !allow_options.
4106 Use size_t rather than int when appropriate.
4107 Open-code option test rather than using strrchr.
4108 Use faster test for "-".
4109 Avoid redundant argc test.
4110 Add support for \x, for Bash compatibility.
4111 Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
4112 When '\c' is encountered, stop printing immediately, as POSIX
4114 Add support for \xhh syntax.
4115 Add support for \0ooo syntax; POSIX requires this.
4117 2004-06-01 Jim Meyering <jim@meyering.net>
4119 * Use automake-1.8b. Regenerate dependent files.
4121 2004-05-31 Jim Meyering <jim@meyering.net>
4123 * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
4124 the build src/ directory -- at the front.
4125 ($(srcdir)/$x-tests): Depend on Makefile.am.
4126 Use $x as the program name, except when it would be `test' (test is
4127 the sole program tested via mk-script that is also a shell built-in).
4128 In that case, use the old ../../src/$x.
4130 2004-05-30 Jim Meyering <jim@meyering.net>
4132 Work around HPUX /bin/cc compiler bug that is exposed, now that
4133 sets are arrays of type `bool'. More details here:
4134 http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
4135 FIXME: verify that the above URL points to the right message
4137 * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
4138 rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
4139 (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
4140 system, those two expressions are not the same (256 vs. 1024).
4141 The effect of this problem was that `tr -c x y' would fail:
4142 tr: when not truncating set1, string2 must be non-empty
4143 (set_initialize): Remove unnecessary initialization of the `in_set'
4144 buffer; that initialization triggered the same compiler bug as above.
4146 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
4148 tr cleanup, mostly having to do with integer type ranges.
4151 * tests/tr/Test.pm: Add a few tests for the below. Alas, most of
4152 the test cases wouldn't be portable, or would take too much CPU
4155 * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
4156 This is safe since the code already assumes N_CHARS fits in int.
4157 (Filter): Remove: we want to prototype everything.
4158 (ORD, CHR): Remove. All uses removed. Some replaced with:
4159 (uchar): New function. All places where a char must be converted
4160 to an unsigned char are now done this way, not by ad-hoc methods.
4161 (count): New type. Use it whenever counts or states are needed.
4162 (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
4163 since we used it in an unsigned int context) to UINTMAX_MAX - 1.
4164 (REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
4165 whenever appropriate.
4166 (NOT_A_CHAR): Remove global macro; now a local enum.
4167 (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
4168 the rest of the code no longer depends on them.
4169 (class_ok): Remove; all uses changed to use inline comparisons.
4170 (RE_NO_TYPE): Remove; wasn't used or needed.
4171 (struct List_element): normal_char and equiv_code are now unsigned
4173 first_char, last_char, and the_repeated_char are now unsigned char,
4174 not unsigned int. repeat_count is now count, not size_t.
4176 (struct Spec_list): state is now count, not unsigned int.
4177 lengthis now count, not size_t.
4178 n_indefinite_repeats is now size_t, not int.
4179 has_equiv_class, has_char_class, and has_restricted_char_class
4180 are now bool, not int. All uses changed.
4181 (struct E_string): s is now char *, not unsigned char *.
4182 escaped is now bool *, not int *. All uses changed.
4183 (ES_MATCH): Remove macro, replacing with:
4184 (es_match): New inline function. All uses changed.
4185 (squeeze_repeats, complement, posix_pedantic, truncate_set1,
4186 translating): Now bool, not int.
4187 (io_buf): Now char array, not unsigned char.
4188 (SET_TYPE): Remove. All uses replaced with bool.
4189 (is_equiv_class_member, unquote, append_range, append_char_class,
4190 append_equiv_class, find_closing_delim, star_digits_closebracket,
4191 build_spec_list, parse_str, homogeneous_spec_list):
4192 Now returns bool, not int. All uses changed.
4193 (is_equiv_class_member): Now inline.
4194 (is_equiv_class_member, is_char_class_member, make_printable_str,
4195 append_normal_char, append_range, append_repeated_char,
4197 Args are now of proper integer type.
4198 (unquote, look_up_char_class, make_printable_str,
4199 append_equiv_class, build_spec_list, squeeze_filter):
4200 Avoid unsigned char *p; gently convert *p to unsigned char instead.
4201 (unquote, get_spec_stats): Do not jump past declarations and then
4202 use them; C doesn't allow this in portable programs.
4203 (make_printable_str): Check for overflow in size calculations.
4204 (xmemdup): Remove. All uses rewritten.
4205 (find_bracketed_repeat): Args are now of proper pointer-to-integer
4206 type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
4207 (find_bracketed_repeat, star_digits_closebracket): Check that the
4208 digits are not escaped.
4209 (build_spec_list): Don't bother to copy opnd_str; not needed.
4210 (build_spec_list, get_next): Simplify internal logic a bit.
4211 (card_of_complement): Fix bug due to char overflow.
4212 (get_spec_stats): Don't assume len fits into int.
4213 Check for integer overflow. Use abort() rather than assert(0).
4214 (string2_extend): Fix subscript error: is_char_class_member (..., 255)
4216 (squeeze_filter): READER is never null now; simplify code.
4217 READER arg now has a simpler type. Remove unnecessary casts.
4218 (squeeze_filter, main): Calls to fwrite improperly checked result
4219 against zero, rather than against requested size.
4220 (plain_read): New function.
4221 (read_and_delete, read_and_xlate):
4222 Remove unused filter arg, and don't worry about hit_eof.
4223 Simplify by using plain_read.
4224 (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
4225 (main): Always pass a non-null procedure to squeeze_filter.
4226 Rewrite so that class_ok isn't needed.
4228 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
4230 * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
4231 fdatasync reports EBADF when syncing (unwritable) directories.
4232 Problem reported by Albert Chin-A-Young in:
4233 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
4235 2004-05-29 Jim Meyering <jim@meyering.net>
4237 * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
4238 Patch from Albert Chin.
4240 * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
4242 * src/remove.c (push_dir): Merge declaration and adjacent assignment
4243 into a single statement.
4245 2004-05-28 Jim Meyering <jim@meyering.net>
4247 * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
4249 2004-05-22 Jim Meyering <jim@meyering.net>
4251 rm -r would get a failed assertion when run from an inaccessible
4252 directory and with two or more command line arguments including an
4253 absolute-named directory followed by a relative-named directory.
4255 * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
4256 * src/remove.c (struct cwd_state): Define.
4257 (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
4258 can be detected by the caller. Instead of returning a malloc'd
4259 directory name, communicate it to caller via a new parameter, and
4260 return an indication of whether restore_cwd failed. Update caller.
4261 Eliminate an unnecessary call to AC_stack_top.
4262 (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
4263 so we can now communicate to caller whether/how functions like
4264 restore_cwd have failed. Update caller.
4265 (rm_1): Fail if we've failed to restore the working directory
4266 and the name of the next file to remove is `.'-relative.
4267 (rm): Fail if the require_restore_cwd flag is true and we've
4268 failed to restore the working directory.
4269 * src/mv.c (rm_option_init): Initialize new member,
4270 x->require_restore_cwd.
4271 * src/rm.c (rm_option_init): Likewise.
4273 2004-05-21 Jim Meyering <jim@meyering.net>
4275 * tests/rm/inaccessible: New test for the above fix.
4276 * tests/rm/Makefile.am (TESTS): Add inaccessible.
4278 * src/remove.c (rm): Use free rather than XFREE.
4279 (remove_dir): Use xmalloc, not XMALLOC.
4280 (ds_init): Likewise.
4282 2004-05-20 Jim Meyering <jim@meyering.net>
4284 * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
4285 diagnostics in shred.c have been fixed, don't exempt shred.c from
4288 * src/shred.c: Use translatable diagnostics, e.g.
4289 change "%s: remove" to _("%s: failed to remove") and
4290 change "%s: close" to _("%s: failed to close").
4292 2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
4294 * src/shred.c (names): Bring back lower-case letters, "_", and
4295 ".". But continue to omit +, =, %, @, #, as they're either
4296 shell metacharacters (for some shells) or are not in some
4297 character sets, or (in the case of '%') must be a
4298 metacharacter somewhere.
4300 2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
4302 * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
4304 2004-05-17 Jim Meyering <jim@meyering.net>
4306 * src/shred.c (incname): Decrement `len' only once per loop iteration.
4308 chgrp and chown now dereference symlinks by default, per POSIX.
4309 Reported by Michal Politowski as http://bugs.debian.org/249177.
4311 * src/chown-core.c (chopt_init): Affect each symlink referent by default.
4312 * src/chown.c (usage): Update to reflect this.
4313 * src/chgrp.c (usage): Likewise.
4314 * NEWS: Describe the change.
4315 Adapt tests accordingly.
4316 * tests/chgrp/basic: Use -h where necessary to retain semantics.
4317 * tests/chgrp/deref: Likewise.
4318 * tests/chgrp/posix-H: Likewise.
4320 2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
4322 In shred, check for errors from fdatasync more carefully. If
4323 fdatasync fails with errno==EINVAL, it means this implementation
4324 does not support synchronized I/O for this file. Do not report
4325 this as an error, as (for example) AIX 5.2 fdatasync reports it
4326 for raw disk devices. Problem reported by Albert Chin in
4327 <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
4329 Check for write errors, though: the old code ignored them.
4330 Improve error checking in a few other cases, too (e.g., close of a
4333 Also, change several 'int' values to 'bool', so that the error
4334 checking is a bit clearer. Similarly, change unsigned values
4335 to size_t where appropriate.
4337 * src/shred.c: Include "dirname.h".
4338 (datasync) [!HAVE_FDATASYNC]: Remove.
4339 (dosync): New function.
4340 (dopass): Use it. Return 1 on write error, -1 on other error.
4341 All callers changed. Report write error if dosync does.
4342 (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
4343 not int (0/-1). All callers changed. Return false if there's a
4345 (incname): Return bool (true/false), not int (0/1). Accept
4346 size_t length, not unsigned. All callers changed. Do not
4347 bother checking for non-digits; it can't happen. Replace
4348 recursion with iteration.
4349 (wipename): Use dir_name, base_name, etc. instead of assuming
4350 Unix file names. Use size_t for length, not unsigned.
4351 Report error if unlink or close fails.
4352 (wipename, main): Use bool for booleans.
4354 (names): Use only digits and uppercase letters, for greater
4357 2004-05-16 Jim Meyering <jim@meyering.net>
4359 * tests/chown/deref: New test for the yesterday's change.
4360 * tests/chown/Makefile.am (TESTS): Add deref.
4362 2004-05-15 Jim Meyering <jim@meyering.net>
4364 chown --dereference did nothing when the owner/group of a
4365 symlink matched the desired owner/group. Reported by David Malone.
4366 Also reported in 1999 as http://bugs.debian.org/39642.
4368 * src/chown-core.c (change_file_owner): When --dereference has
4369 been specified, and when processing a symlink, stat it to get the
4370 owner and group of the referent.
4372 2004-05-14 Jim Meyering <jim@meyering.net>
4374 * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
4375 s/supercede/supersede/ reported by Andrew Fabbro.
4377 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
4379 Improve performance of `sort -m' on large files, at the cost of
4380 making some contrived examples unsafe. POSIX allows this
4381 optimization. Performance problem reported by Jonathan Baker in
4382 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
4384 * src/sort.c (first_same_file): Do not treat input pipes
4385 differently from other files.
4386 * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
4387 might write F before reading all the input.
4390 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
4392 * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
4393 '\007', for portability to EBCDIC hosts.
4394 * src/printf.c (print_esc_char): Likewise.
4395 * src/tr.c (unquote, make_printable_str): Likewise.
4397 2004-05-12 Jim Meyering <jim@meyering.net>
4399 * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
4400 where the result is used. This avoids one unnecessary lstat call
4401 per command line argument.
4403 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
4405 Don't assume that "make -C" works; Solaris "make" doesn't have -C.
4407 * src/Makefile.am (all_programs.list): New rule, copied from
4408 man/Makefile.am and tests/Makefile.am, except that we use the
4409 system tr rather than ./tr and we don't use tr -s.
4410 * tests/Makefile.am (all_programs): Use it.
4411 * man/Makefile.am (all_programs): Likewise. Renamed from programs,
4412 for consistency. All uses changed.
4414 2004-05-11 Jim Meyering <jim@meyering.net>
4416 * tests/rm/unread3: New test, for the above fix and today's
4417 lib/save-cwd.c improvement.
4418 * tests/rm/Makefile.am (TESTS): Add unread3.
4420 * src/rm.c: Don't include "save-cwd.h". It's no longer used.
4422 2004-05-10 Jim Meyering <jim@meyering.net>
4424 * tests/install/trap: New file. Test for bug fix of 2004-04-18.
4425 * tests/install/Makefile.am (TESTS): Add trap.
4427 * src/remove.c (AD_push): Don't use errno in diagnostic about
4430 Remove these generated files from CVS.
4431 * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
4432 * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
4433 * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
4434 * tests/tr/tr-tests, tests/wc/wc-tests:
4436 2004-05-09 Jim Meyering <jim@meyering.net>
4438 * src/tr.c (unquote): Use xcalloc rather than xmalloc and
4439 a loop initializing the just-allocated memory to zero.
4441 2004-05-08 Jim Meyering <jim@meyering.net>
4443 * tests/rm/no-give-up: New file; check for today's fix.
4444 * tests/rm/Makefile.am (TESTS): Add no-give-up.
4446 2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
4448 Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
4449 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
4451 * src/remove.c (remove_entry): Check for errno values like ENOENT
4452 that show the file cannot be directory, instead of for errno
4453 values like EPERM that show the file might be a directory. This
4454 is necessary because, when a single unlink() call has multiple
4455 reasons to fail, it can set errno to any of those reasons; it's
4456 only the rare errno value like ENOENT that excludes all the other
4457 possible reasons to fail even when the file is a directory.
4458 (remove_cwd_entries): Don't attempt chdir if the file is known
4459 to not be a directory.
4460 (remove_dir): Use the same method that remove_cwd_entries uses
4461 (for some reason they differed). Don't assert that saved_errno
4462 must be EPERM; it might be just about anything.
4464 2004-05-06 Jim Meyering <jim@meyering.net>
4466 * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
4467 Don't add `1' to the buffer size (it was to protect against malloc
4468 implementations that fail to allocate a buffer of size zero).
4469 That is no longer necessary, since we use a malloc wrapper
4472 * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
4473 * src/head.c (elide_tail_bytes_pipe): Likewise.
4474 * src/df.c (main): Likewise.
4475 * src/shred.c (do_wipefd): Likewise.
4476 * src/users.c (list_entries_users): Likewise.
4477 * src/tail.c (main): Likewise.
4478 * src/md5sum.c (main): Likewise.
4480 2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
4482 * src/df.c (show_disk, show_point): If several filesystems are
4483 mounted on the same mount point, prefer the last one, not the first.
4484 Problem reported by Christian Jones in
4485 <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
4486 (show_disk): Remove unused statp arg. Return bool, not int.
4487 (show_point): Rewrite to avoid gotos. Use the same algorithm
4488 for lofs and dummies for each pass through the mount table,
4489 rather than subtly different algorithms (which are probably
4492 2004-05-03 Jim Meyering <jim@meyering.net>
4494 * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
4497 2004-05-01 Jim Meyering <jim@meyering.net>
4499 When chown or chgrp is modifying the referent of a symlink,
4500 use the chown(2) function, if possible.
4501 * src/chown-core.c (change_file_owner): Don't hard-code the
4502 open/fchown/close kludge here. Use `chown' instead.
4503 The chown function works just fine on conforming systems.
4504 Other systems now go through the new chown wrapper that
4505 resorts to the old kludge.
4507 * src/chown-core.c (change_file_owner): Add a comment.
4509 2004-04-27 Jim Meyering <jim@meyering.net>
4511 * src/ptx.c: Make over 40 global extern variables `static'.
4512 (syntax_table, re_syntax_table): Remove declarations of two unused
4513 variables (they were exposed by the above change).
4515 * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
4516 * src/ln.c (backup_type): Likewise.
4518 * src/remove.c (rm): Add `extern' keyword.
4519 * src/cp-hash.c (forget_created, remember_created)
4520 (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
4521 * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
4522 * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
4523 (uid_to_name, chown_files): Likewise.
4525 * src/Makefile.am (sc_tight_scope): New rule.
4526 * Makefile.maint (sc_tight_scope): New rule.
4527 (syntax-check-rules): Add it.
4529 2004-04-26 Jim Meyering <jim@meyering.net>
4531 * Use automake-1.8.4. Regenerate dependent files.
4533 * src/sort.c (limfield): Make a comment clearer.
4535 2004-04-25 Paul Eggert <eggert@twinsun.com>
4537 Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
4538 leading blanks when computing the location of the field end;
4539 it is not supposed to skip trailing blanks. Solaris 8 "sort"
4540 does conform to POSIX. Also fix the documentation to clarify
4541 this and related issues.
4543 * doc/coreutils.texi (sort invocation): Mention -k earlier, so
4544 that the options are in alphabetical order. Describe how -b works
4545 more-accurately; this involves fixing some examples, too. Mention
4546 what happens if the start field falls after an end field or after
4547 a line end. Warn about using -k without -b, -g, -M, -n, or -t.
4548 Add an example of how to sort IPv4 addresses and Apache Common
4549 Log Format dates. Remove a duplicate example.
4550 (Putting the tools together): Use separate options rather
4551 than agglomerating them.
4552 * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
4553 decode whether to skip leading blanks.
4554 (trailing_blanks): Remove.
4555 (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
4557 * tests/pr/Test.pm: Fix typo in env_default comment.
4558 * tests/sort/Test.pm: Likewise.
4559 (18c, 18d): Reverse the order of output lines, so that the
4560 test cases conform to POSIX.
4562 2004-04-22 Paul Eggert <eggert@twinsun.com>
4564 More signal-handling cleanup for ls.c. Do not allow signals to
4565 happen between arbitrary output bytes, as the
4566 restore-default-color sequence can bollix up multibyte chars or
4567 color-change sequences in the ordinary output. Instead, process
4568 signals only between printing a file name and changing the color
4569 back to non_filename_text color. That way, if the signal handler
4570 changes the color (to the default), 'ls' will change it back when
4571 'ls' continues (after being suspended).
4573 Also, do not bother with signal-handling unless stdout is a
4574 controlling terminal; this lets stdio buffer better when "ls
4575 --color" is piped or sent to a file.
4577 * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
4578 Do not include "full-write.h"; no longer needed.
4579 (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
4580 (put_indicator_direct): Remove. All callers changed to use
4582 (caught_signals, interrupt_signal, stop_signal_count): New vars.
4583 (restore_default_color): Don't bother checking for put_indicator
4585 (sighandler): Don't handle SIGTSTP; that's another handler now.
4586 Simply set interrupt_signal to the signal, then exit.
4587 (stophandler, process_signals): New functions.
4588 (main): Don't output any color changes until _after_ the signal
4589 handlers are set up. This fixes a race condition where 'ls'
4590 could be interrupted while initializing colors, and leaving the
4591 terminal in an undesirable state.
4592 Don't mess with signal-handling if standard output is not a
4593 controlling terminal.
4594 When exiting, restore the default color, then restore the
4595 default signal handling, then act on any signals that weren't
4597 Do not print //DIRED// etc. in colors; this avoids the need
4598 to catch signals when printing them.
4599 (print_name_with_quoting): Process signals just before switching
4600 color back to non_filename_text.
4602 2004-04-23 Jim Meyering <jim@meyering.net>
4604 Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
4605 * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
4606 of quotearg_buffer. Patch by Mikulas Patocka.
4608 2004-04-18 Paul Eggert <eggert@twinsun.com>
4610 tee ignored SIGPIPE, but POSIX doesn't allow this.
4612 * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
4613 does not allow this. This undoes the 1996-10-24 patch.
4615 2004-04-18 Paul Eggert <eggert@twinsun.com>
4617 Signal-handling cleanup for coreutils. Here are the highlights:
4619 - csplit sometimes failed to remove files when interrupted.
4620 - csplit didn't clean up if two signals arrived nearly simultaneously.
4621 - install -s would infloop on System V if SIGCHLD was ignored.
4622 - ls could incorrectly restore color if multiple signals
4623 arrived nearly simultaneously.
4625 * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
4627 (filename_space, prefix, suffix, digits, files_created, remove_files):
4629 (caught_signals): New var.
4630 (cleanup): Block signals while deleting all files.
4631 (cleanup_fatal, handle_line_error, regexp_error):
4632 Mark with ATTRIBUTE_NORETURN.
4633 (create_output_file, close_output_file, interrupt_handler):
4634 Block signals while changing the number of output files,
4635 to fix some race conditions.
4636 (delete_all_files): Do nothing if remove_files is zero.
4637 Clear files_created.
4638 (main): Don't mess with signals until after argument processing
4641 * src/csplit.c (main): Rewrite signal-catching code to make it
4642 similar to other coreutils programs. When processing signals,
4643 block all signals that we catch, but do not block signals that we
4644 don't catch. Avoid problems with unsigned int warnings.
4645 * src/ls.c (main): Likewise.
4646 * src/sort.c (main): Likewise.
4648 * src/csplit.c (interrupt_handler):
4649 Use void, not (obsolete) RETSIGTYPE.
4650 * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
4652 * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
4653 Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
4654 * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4655 * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
4656 * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
4658 * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
4660 * src/install.c: Include <signal.h>.
4661 (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
4662 given, since System V fork+wait does not work if SIGCHLD is ignored.
4664 * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
4665 handler to self, not to SIG_IGN, since SIGTSTP can be received
4667 (main): Use SA_RESTART, as that is simpler than checking for EINTR
4668 failures all over the place.
4670 2004-04-20 Jim Meyering <jim@meyering.net>
4672 * src/remove.c (is_empty_dir): Clarify comment.
4674 * man/help2man: Accept new option: --program-name=NAME, so that we
4675 can override the one in --version output. This is needed solely
4676 so that test.1 doesn't refer to `[' as the program name.
4677 Reported by Benjamin Cutler as http://bugs.debian.org/205251.
4678 * man/Makefile.am (.x.1): Use help2man's new --program-name option.
4680 * src/pwd.c: Don't include pathmax.h; system.h already does it.
4682 * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
4684 2004-04-19 Jim Meyering <jim@meyering.net>
4686 * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
4687 Initialize a buffer to avoid warnings from tools like valgrind.
4689 * Makefile.maint (sc_trailing_blank): New rule.
4690 (syntax-check-rules): Add it.
4691 * .x-sc_trailing_blank: New file.
4693 Make pwd work even if the resulting name is so long that getcwd fails.
4694 * src/pwd.c: (path_free, path_init, path_prepend): New functions.
4695 (nth_parent, find_dir_entry, robust_getcwd): New functions.
4696 (main): First try getcwd, then, upon failure, robust_getcwd.
4698 2004-04-18 Jim Meyering <jim@meyering.net>
4700 * src/who.c (print_user): Use xrealloc here, rather than
4701 unchecked realloc. Remove anachronistic casts.
4703 * src/remove.c (full_filename_): Don't leak upon failed realloc.
4705 * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
4707 * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
4708 renaming it. Update uses.
4710 2004-04-17 Jim Meyering <jim@meyering.net>
4712 * configure.ac: Depend on automake-1.8.3.
4714 * src/join.c (add_file_name): Declare function to be `static'.
4715 (string_to_join_field): Likewise.
4716 * src/remove.c (ds_init, ds_free): Likewise.
4718 * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
4719 (syntax-check-rules): Add to the list.
4721 2004-04-13 Paul Eggert <eggert@twinsun.com>
4723 Use page-aligned buffers whenever we bother to do I/O using buffer
4724 sizes that are tailored for the files.
4726 * src/cat.c: Include getpagesize.h.
4727 * src/copy.c: Likewise.
4728 * src/shred.c: Likewise.
4729 * src/split.c: Likewise.
4730 * src/cat.c (main): Align I/O buffers to page boundaries.
4731 * src/copy.c (copy_reg): Likewise.
4732 * src/shred.c (dopass): Likewise.
4733 * src/split.c (main): Likewise.
4734 * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
4735 All uses replaced by ptr_align.
4736 * src/od.c (gcd, lcm): Remove; now in system.h.
4737 * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
4739 2004-04-14 Jim Meyering <jim@meyering.net>
4741 Remove m4/Makefile.am: it's no longer needed, with newer automake
4742 * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
4743 * Makefile.am (SUBDIRS): Remove `m4' from the list.
4745 2004-04-13 Jim Meyering <jim@meyering.net>
4747 * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
4749 2004-03-27 Paul Eggert <eggert@twinsun.com>
4751 * NEWS: cp -pu and mv -u (when copying) now take the destination
4752 file system time stamp resolution into account.
4753 * doc/coreutils.texi (mv invocation): Document this.
4754 (cp invocation): Document -u (it was missing!) with new behavior.
4756 * src/copy.c: Include "utimecmp.h".
4757 (copy_internal): Compare time stamps using utimecmp rather than
4760 2004-04-09 Jim Meyering <jim@meyering.net>
4762 * Makefile.maint (.re-list): New rule/file, to replace
4763 hard-coded list of header file names.
4764 (sc_system_h_headers): Use the new file.
4765 Don't look for sys2.h anymore.
4767 * src/system.h: Include new "stat-macros.h" rather than hard-coding
4768 all of its macro definitions -- the list was slightly out of date.
4769 Suggestion from Dmitry V. Levin.
4771 2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
4773 * NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
4774 * doc/coreutils.texi (dd invocation): Likewise.
4775 * src/shred.c (O_NOCTTY): Remove redundant decl.
4776 * src/dd.c (flags, usage): Remove noctty flag.
4777 (main): Always use O_NOCTTY when opening files.
4779 2004-04-08 Jim Meyering <jim@meyering.net>
4781 * src/dd.c (dd_copy): Mark two diagnostics for translations.
4782 (set_fd_flags): Undo part of today's change: it's a little
4783 cleaner -- and more efficient in the common case -- to go
4784 ahead and OR in the -1 when fcntl fails.
4786 * Makefile.maint (sc_dd_max_sym_length): New target.
4787 (syntax-check-rules): Add it.
4789 * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
4790 Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
4792 * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
4793 Rename parameter, flags, to avoid shadowing global.
4794 (LONGEST_SYMBOL): Tweak comment.
4796 2004-04-07 Paul Eggert <eggert@twinsun.com>
4798 * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
4799 and new dd options iflag= and oflag=.
4800 * src/dd.c (usage): Likewise.
4801 * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
4802 * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
4803 (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
4804 (input_flags, output_flags): New vars.
4805 (LONGEST_SYMBOL): New macro.
4806 (struct symbol_value): Renamed from struct conversion. Members
4807 symbol and value renamed from convname and conversion. The
4808 symbol value is now an array instead of a pointer; this saves
4809 a bit of space and time in practice. All uses changed.
4810 (conversions): Add nocreat, excl, fdatasync, fsync. Now const.
4811 (flags): New constant array.
4812 (iflag_error_msgid, oflag_error_msgid): New constants.
4813 (parse_symbols): Renamed from parse_conversion and generalized
4814 to handle either conversion or flag symbols.
4815 (scanargs): Adjust uses of parse_symbols accodingly. Add
4816 support for iflag= and oflag=. Reject attempts to use
4817 both excl and nocreat.
4818 (set_fd_flags): New function.
4819 (dd_copy): Just return X rather than calling quit (X), since our
4820 caller invokes quit with the returned value. Add support for
4821 fdatasync and fsync.
4822 (main): Add support for iflag=, oflag=, and new conv= symbols.
4823 * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
4824 O_RSYNC, O_SYNC): Define to 0 if not already defined.
4826 * NEWS: Remove duplicate mention of BLOCKSIZE.
4828 2004-04-02 Andreas Schwab <schwab@suse.de>
4830 * src/stty.c: Add support for IUTF8 input flag.
4832 2004-04-06 Jim Meyering <jim@meyering.net>
4834 * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
4835 Interix spells it `mkdev'. Reported by Mark Funkenhauser.
4837 2004-04-04 Jim Meyering <jim@meyering.net>
4839 A specified format is no longer automatically newline terminated.
4840 If you want a newline at the end of your format, use `\n'.
4841 * src/stat.c (print_it): Don't print a newline at the end of
4843 (do_statfs): Add a newline at end of each default format string.
4845 2004-03-30 Paul Eggert <eggert@twinsun.com>
4847 * src/nohup.c (main): Adjust to new calling convention
4848 for set_cloexec_flag.
4850 2004-03-31 Jim Meyering <jim@meyering.net>
4852 * tests/Fetish.pm (run_tests): Remove `.orig' file.
4853 Remove debugging diagnostic.
4855 Specifying an invalid --width=N (-w) or --gap-size=N (-g)
4856 would not elicit an error.
4857 * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
4858 (main): Don't use atoi. Use xstrtoul instead.
4860 2004-03-30 Jim Meyering <jim@meyering.net>
4862 * Makefile.maint (sc_prohibit_atoi_atof): New rule.
4863 (syntax-check-rules): Add it.
4864 * .x-sc_prohibit_atoi_atof: New file.
4866 2004-03-29 Jim Meyering <jim@meyering.net>
4868 * tests/du/files0-from: Use new OUT_SUBST directive, so that this
4869 test is not sensitive to system-dependent block size differences.
4870 Prompted by a report of Solaris 8 differences from Paul Eggert.
4872 * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
4873 Rename `%tmp' to `%actual'. Reverse order of last two args to
4874 _compare_files (to $actual, $expected) so as to match declaration.
4876 2004-03-28 Paul Eggert <eggert@twinsun.com>
4878 Fix some gotchas encountered when porting to Solaris 8, using
4879 the Forte 6u2 compiler.
4881 * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
4882 Declare sethostname, since no Solaris header does it.
4883 * src/who.c: Include "vasprintf.h", for asprintf.
4885 2004-03-28 Jim Meyering <jim@meyering.net>
4888 * src/du.c (process_file): Don't record dev/inode for directories.
4890 Under some circumstances, without -c, du would mistakenly count the
4891 space of hard-linked files, not just the first one it encountered.
4892 Reported by Anthony Thyssen.
4893 * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
4895 * src/du.c: Rename global `print_totals' to `print_grand_total'.
4897 * src/du.c (main): Rearrange filtering loop to be a tiny bit
4900 * src/chown-core.c: Don't include savedir.h -- no longer needed.
4901 * src/chmod.c: Likewise.
4903 2004-03-25 Jim Meyering <jim@meyering.net>
4905 * src/du.c (main): Remove now-unused declaration of `i'.
4907 2004-03-24 Paul Eggert <eggert@twinsun.com>
4909 * src/du.c (main): Filter out file names of length zero before
4910 invoking fts, so that they don't cause fatal errors.
4912 2004-03-25 Jim Meyering <jim@meyering.net>
4914 * tests/du/files0-from (zero-len): Add a test for the above.
4916 2004-02-25 Paul Eggert <eggert@twinsun.com>
4918 * NEWS: New environment var BLOCKSIZE.
4919 * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
4920 * tests/envvar-check: Test for it. Factor the code to simplify it.
4922 2004-03-23 Paul Eggert <eggert@twinsun.com>
4924 * NEWS: Shorten the du --files0-from announcement, and say
4925 "NUL-terminated" rather than "NUL-separated".
4926 * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
4928 (usage): Say "NUL-terminated", not "NUL-separated".
4929 (main): Check for I/O error when istream is closed.
4930 Allow --files0-from=F even if F is empty; this specifies no files.
4931 (du_files): Now that we allow the list of files to be empty,
4933 * tests/du/files0-from: Adjust to above changes to src/du.c.
4935 2004-03-24 Jim Meyering <jim@meyering.net>
4937 * tests/tail-2/assert: Avoid race condition that could cause
4938 spurious failure. Based on a patch from Andreas Schwab.
4940 2004-03-23 Jim Meyering <jim@meyering.net>
4942 * src/du.c (main): Free the hash table, too.
4944 2004-03-22 Jim Meyering <jim@meyering.net>
4946 * man/Makefile.am (.x.1): Remove --info-page= option, reverting
4947 the change of 2004-01-22. I can no longer reproduce the problem
4948 that prompted that change, and `info coreutils pr' would display the
4949 `printing text' section of the manual, not the one on `pr invocation'.
4951 * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
4952 to match corrected output.
4954 * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
4955 (main): Use readtoken0 functions rather than readtokens.
4956 Don't use errno when diagnosing readtokens0 failure.
4957 Fix off-by-one error in the token number reported in a diagnostic.
4958 (du_files): Return bool, rather than int.
4959 (main): Call readtokens0_free.
4961 2004-03-21 Jim Meyering <jim@meyering.net>
4963 * src/remove.c (ds_free): Plug a small leak.
4965 * tests/Fetish.pm: Fix typo in comment.
4967 2004-03-07 Jim Meyering <jim@meyering.net>
4969 * NEWS: du accepts a new option --files0-from=FILE, where FILE
4970 contains a list of NUL-separated file names.
4972 * src/du.c: Include "readtokens.h".
4973 (usage): Describe the new option, and adjust the `Usage':
4974 with this option, no FILE may be specified on the command line.
4975 (main): Handle the new option.
4977 * tests/du/files0-from: New tests, for the above.
4978 * tests/du/Makefile.am (TESTS): Add files0-from.
4980 * src/factor.c (do_stdin): Reflect changes in use of readtoken.
4981 * src/tsort.c (tsort): Likewise.
4983 2004-02-29 Paul Eggert <eggert@twinsun.com>
4985 * NEWS: Add support for a new notation @N to get_date to represent
4986 the time stamp with numeric value N. Improve support for
4987 fractional time stamps. date's -d and -f options now accept them.
4988 Likewise for touch -t. date has a new option --iso-8601=ns.
4990 * doc/coreutils.texi (touch invocation):
4991 Describe use of fractional seconds.
4992 (date invocation, Options for date): Likewise.
4993 * doc/getdate.texi (General date syntax, Time of day items): Likewise.
4994 * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
4995 (Options for date): Describe new --iso-8601=ns option.
4997 * doc/getdate.texi: Add copyright notice. Change getdate to
4998 get_date when talking about the function name.
4999 (Seconds since the Epoch): New section, containing the time_t
5000 info moved from Date input formats section, along with new
5001 info about the @ syntax. Mention negative time stamps,
5002 fractional time stamps, and leap seconds.
5003 (General date syntax): Modernize examples a bit to reflect new
5005 (General date syntax, Relative items in date strings):
5006 Use ' rather than " to quote formats.
5007 (Time of day items): Add an example with fractional seconds.
5008 Describe fractional-second syntax.
5010 * src/Makefile.am (touch_LDADD): New macro, since `touch' now
5011 needs clock_gettime.
5013 * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
5014 (time_spec_string, time_spec, show_date): Support it.
5015 (usage): Remove description of -ITIMESPEC, as it's obsolete and
5016 confusing. Mention --iso-8601=ns.
5017 (batch_convert): getline returns ssize_t, not int.
5019 * src/touch.c (newtime): Now an array of two timespecs, one
5020 for access and one for modification.
5021 (ref_stats): Remove.
5022 (get_reldate): Use get_date's parameter profile.
5023 (touch, main): Adjust to above changes.
5024 (main): Work even if tm_year == INT_MAX (so long as long int is wider).
5025 Use gettime instead of gettimeofday, for new get_date signature.
5027 * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
5030 2004-03-15 Jim Meyering <jim@meyering.net>
5032 * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
5033 target before updating $(prev_version_file).
5035 * tests/misc/date-sec: New file, to test for just-fixed bug in date.
5036 See today's change in lib/getdate.y.
5037 * tests/misc/Makefile.am (TESTS): Add date-sec.
5039 2004-03-14 Jim Meyering <jim@meyering.net>
5041 * announce-gen (print_changelog_deltas): Use `.sig' suffix for
5042 signature files, not `.asc'. Reported by angico@yahoo.com.
5044 2004-03-13 Jim Meyering <jim@meyering.net>
5046 * src/cp.c (do_copy): Tweak wording in a diagnostic.
5047 Suggestion from Karl Berry.
5048 Include "quoatearg.h".
5049 (do_copy): Use quotearg_colon (not quote) for diagnostics
5050 that begin with `"%s:'.
5052 * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
5053 Suggestion from Dan Jacobson.
5055 2004-03-12 Jim Meyering <jim@meyering.net>
5059 Sometimes, when source and destination partition are different,
5060 mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
5062 * src/copy.c: When moving a set of N hard-linked files between
5063 partitions, via two or more command line arguments where the
5064 command line argument containing the Nth link contains no other
5065 link to that same file, mv would mistakenly copy the file, rather
5066 than hard-linking it to the other(s). That happens because when the
5067 final link is processed, its link count has been reduced to 1 since
5068 the other links have been `copied' to the destination partition
5069 and the source links have been removed.
5070 (copy_internal): When in move mode, use the source dev/inode
5071 pair to look up destination name even when st_nlink == 1.
5072 * src/cp-hash.c (src_to_dest_lookup): New function.
5073 * src/cp-hash.h (src_to_dest_lookup): Add prototype.
5074 * tests/mv/part-hardlink: New file. Test for the above fix.
5075 * tests/mv/Makefile.am (TESTS): Add part-hardlink.
5077 * announce-gen: Sync with autoconf.
5079 * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
5080 This was triggered on a Linux-2.2.19 system using a file system
5081 NFS-mounted from some sort of Sun.
5083 2004-03-11 Jim Meyering <jim@meyering.net>
5085 * Use automake-1.8.3. Regenerate dependent files.
5087 2004-03-10 Jim Meyering <jim@meyering.net>
5089 * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
5090 so that this test works with SELinux-enabled systems.
5091 Based on a patch from Tim Waugh.
5093 `join -1 x' would give a misleading diagnostic
5094 * src/join.c (string_to_join_field): Report that a non-numeric field
5095 number is invalid, rather than `so large that it is not representable'.
5096 * tests/join/Test.pm (invalid-j): New partial test for the above fix.
5098 2004-03-06 Jim Meyering <jim@meyering.net>
5100 cp --sparse=always sparse-image-file.img /dev/hda1 could
5101 produce an invalid copy on the destination device.
5103 * src/copy.c (copy_reg): Even with --sparse=always, try to
5104 make `holes' only if the destination is a regular file.
5105 Reported by Szakacsits Szabolcs.
5107 2004-03-03 Paul Eggert <eggert@twinsun.com>
5109 * src/nohup.c (main): Don't invoke set_cloexec_flag with
5110 a file descriptor of -1.
5112 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
5114 * src/nohup.c: Include "cloexec.h".
5115 (main): Set the copy of stderr to close on exec.
5117 2004-03-01 Paul Eggert <eggert@twinsun.com>
5119 * configure.ac: Include <signal.h> when checking for strsignal,
5120 sys_siglist, and friends. Problem reported by Tony Leneis in
5121 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
5123 2004-02-25 Paul Eggert <eggert@twinsun.com>
5125 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
5126 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
5129 2004-02-23 Paul Eggert <eggert@twinsun.com>
5131 * NEWS: Document how chown's USER.GROUP argument is now parsed.
5133 2004-02-23 Jim Meyering <jim@meyering.net>
5135 * src/seq.c (usage): Remove stray space after \n in --help output.
5137 2004-02-22 Jim Meyering <jim@meyering.net>
5139 * src/du.c (usage): Separate -H and --si. Say that the meaning
5140 of -H will soon change to that of --dereference-args (-D).
5142 2004-02-21 Jim Meyering <jim@meyering.net>
5144 * src/comm.c (usage): Tell what comm does when there are no options.
5145 Reword in terms of FILE1 and FILE2 rather than `left file' and
5146 `right file'. Suggestion from Dan Jacobson.
5148 2004-02-15 Paul Eggert <eggert@twinsun.com>
5150 Fix some POSIX-conformance bugs in expr.
5152 * NEWS: document the following changes to src/expr.c.
5153 * doc/coreutils.texi (expr invocation): Likewise.
5154 Document what forms integers may take, and say "integer"
5155 consistently instead of "number". Warn about operands
5156 that "expr" can misinterpret, and how to work around the
5158 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
5159 Accept a bool argument specifying whether to evaluate the
5160 expression. This is to allow short-circuit evaluation. All
5162 (null): Report that a string is zero even if it has
5163 a form like "-0" or "00".
5164 (eval1, eval): Use short-circuit evaluation for | and &.
5165 (eval): Return 0 if both arguments are null or zero, instead
5166 of returning the first argument.
5167 * tests/expr/basic: Add some tests for the above.
5169 2004-02-17 Jim Meyering <jim@meyering.net>
5173 `make check' from a build inside a chroot environment would fail
5174 * tests/help-version: Specify an argument (`/') for df, in the
5175 unusual event that there is no valid entry in /etc/mtab.
5176 Likewise for id: add the -u option, so we don't get spurious
5177 failures when there are no user or group names.
5180 * src/sort.c (usage) [-u]: Add punctuation so that the description in
5181 the help2man-generated (line-joined) man page is more readable.
5182 Reported by Tim Waugh.
5183 [-T]: Add a semicolon, for the same reason.
5185 2004-02-15 Jim Meyering <jim@meyering.net>
5187 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
5189 2004-02-11 Jim Meyering <jim@meyering.net>
5191 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
5192 $(srcdir)/../Makefile.am.in, rather than $<.
5193 Suggestion from Michael Elizabeth Chastain.
5195 2004-02-10 Jim Meyering <jim@meyering.net>
5197 * config/install-sh: Make this script executable.
5198 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
5199 is executable. Otherwise, on systems that lack a suitable install
5200 binary, `make install' would fail, because of the way this script
5201 is invoked (without `$SHELL ' prefix).
5202 Reported by Bob Proulx.
5204 2004-02-08 Jim Meyering <jim@meyering.net>
5208 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
5209 that would cause an unwarranted test failure.
5210 * tests/rm/rm3: Likewise.
5212 2004-02-07 Jim Meyering <jim@meyering.net>
5214 Remove xstat function pointer member. The way it was used was not
5215 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
5216 inline `stat' and `lstat' functions, thus making the tests of
5217 `xstat == lstat' in copy.c always fail.
5218 * src/copy.h (struct cp_options) [xstat]: Remove member.
5220 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
5221 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
5222 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
5223 (valid_options): Remove now-obsolete FIXME comments.
5225 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
5226 `*(x->xstat) (...)'.
5227 (do_copy): Declare/use local xstat rather than x->xstat.
5228 (main): Remove code that set x.xstat.
5229 * src/mv.c (cp_option_init): Don't initialize xstat member.
5230 * src/install.c (cp_option_init): Likewise.
5232 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
5233 so that emit_upload_commands can use these variables, too.
5235 2004-02-06 Jim Meyering <jim@meyering.net>
5237 * tests/rm/deep-1: Remove `du' stack space test.
5238 Apparently, `ulimit -s N' isn't portable enough.
5239 This test will be restored (with a guard against losing ulimit)
5240 in its own file later.
5242 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
5243 since this test doesn't take long enough to merit them.
5244 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
5246 * Makefile.maint (signatures): Remove definition.
5247 Now, automake's gnupload handles this.
5248 (%.sig: %): Remove now-unused rule.
5249 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
5250 `$(distdir).tar.bz2 $(distdir).tar.gz'.
5251 (emit-upload-commands): Adjust to use gnupload.
5253 2004-02-05 Jim Meyering <jim@meyering.net>
5255 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
5256 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
5257 Now, those are all defined in timespec.h.
5260 * src/date.c: Don't include timespec.h, now that system.h does it.
5262 2004-02-02 Paul Eggert <eggert@twinsun.com>
5264 Don't dump core if localtime returns NULL (possible on
5265 hosts with 64-bit time_t and 32-bit int).
5266 * src/date.c: Include "inttostr.h".
5267 (batch_convert, main):
5268 If time conversion fails, exit with nonzero status.
5269 (show_date): Return int to report conversion failure.
5270 Print the time as an int if localtime fails.
5271 * src/uptime.c: Print "??" if the current clock can't
5272 be converted by localtime. This won't happen until the year
5273 2*31 + 1900, but we don't want to dump core even if the current
5274 clock has the wrong value.
5276 * src/stat.c: Include "inttostr.h".
5277 (human_time): Print the date/time as a number of seconds since the
5278 epoch if it can't be converted by localtime. This is better than
5279 just saying "invalid", and is consistent with what "ls" does.
5280 Don't dump core if the year has more than 48 digits; this isn't
5281 possible on any contemporary host, but we might as well do it right.
5283 2004-01-31 Paul Eggert <eggert@twinsun.com>
5285 * src/stat.c (human_time): Accept time rather than
5286 pointer-to-const-time parameter, for clarity. All callers changed.
5288 2004-02-02 Jim Meyering <jim@meyering.net>
5290 * src/stat.c (do_stat): Remove extra trailing newline from
5291 default formats. Reported by Nelson H. F. Beebe.
5293 Print actual fractional seconds in time stamps, not just `.00000000'.
5294 * src/stat.c (human_time): Add and use new parameter, t_ns.
5295 (print_stat): Update callers.
5296 * src/ls.c (TIMESPEC_NS): Remove definition.
5297 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
5298 also uses this macro.
5299 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
5300 fractional seconds for files on an XFS file system, but that stat's
5301 fractional seconds were always zero.
5303 2004-01-28 Paul Eggert <eggert@twinsun.com>
5305 * src/seq.c (print_numbers): Use 'double' for loop index, not
5306 'int', to avoid problems with integer overflow. On almost all
5307 machines 'double' works in every case where 'int' works, and
5308 it works on other cases besides.
5310 2004-01-27 Jim Meyering <jim@meyering.net>
5312 * src/seq.c (usage): Mention that if INCREMENT is omitted,
5313 it defaults to 1, even when FIRST is larger than LAST.
5314 Reword so as not to exclude the possibility that INCREMENT be zero.
5316 2004-01-25 Jim Meyering <jim@meyering.net>
5320 * Makefile.maint (signatures): Comment out definition.
5322 2004-01-23 Jim Meyering <jim@meyering.net>
5324 * Makefile.maint (header_regexp): Add exitfail.
5326 * man/Makefile.am (EXTRA_DIST): Add help2man.
5327 Reported by Nelson H. F. Beebe.
5329 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
5330 so it works on systems with Perl installed somewhere other than in
5333 * src/paste.c (paste_parallel): Declare local, chr, to be of type
5334 `int', not `char', since it must hold EOF. This bug would make
5335 paste infloop on some systems. Test failures reported by
5336 Nelson H. F. Beebe and Christian Krackowizer.
5338 2004-01-22 Jim Meyering <jim@meyering.net>
5340 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
5341 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
5343 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
5344 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
5345 Use --info-page='coreutils PROG' option.
5346 Now, readlink.1 refers the user to `info coreutils readlink'
5347 rather than to `info readlink'. Reported by Matt Swift.
5349 2004-01-21 Paul Eggert <eggert@twinsun.com>
5351 Exit status cleanup.
5353 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
5354 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
5355 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
5356 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
5357 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
5358 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
5359 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
5360 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
5361 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
5362 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
5363 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
5364 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
5365 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
5366 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
5367 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
5368 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
5369 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
5371 * src/cat.c (usage): Don't bother normalizing exit status
5372 since the arg is already the correct exit status now.
5373 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
5374 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
5375 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
5376 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
5377 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
5379 * src/chown.c (main): Removed unused local 'fail'.
5381 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
5384 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
5385 * src/env.c, src/nice.c, src/su.c: Likewise.
5386 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
5387 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
5388 * src/expr.c (main): Use initialize_exit_failure rather than
5389 setting exit_failure directly; this optimizes away redundant
5391 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
5393 * src/chroot.c (main): Exit with status 1 rather than 127
5394 if chroot itself fails, as per documentation.
5396 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
5397 rather than roll-your-own symbols or integers.
5398 * src/env.c (main): Likewise.
5399 * src/nohup.c (main): Likewise.
5400 * src/su.c (run_shell): Likewise.
5402 * src/cp.c (exit_status): Remove static var....
5403 (main): Making it local here instead. Use =, not |=, to set it.
5405 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
5407 * src/date.c (batch_convert, main): Likewise.
5408 * src/dd.c (dd_copy): Likewise.
5409 * src/pr.c (first_last_page, main, getoptarg): Likewise.
5410 * src/tr.c (main): Likewise.
5411 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
5412 POSIX doesn't require it.
5413 * src/dd.c (write_output, skip, dd_copy): Likewise.
5414 * src/df.c (main): Likewise.
5415 * src/id.c (main): Likewise.
5416 * src/install.c (main): Likewise.
5417 * src/ln.c (main): Likewise.
5418 * src/ls.c (main): Likewise.
5419 * src/mv.c (main): Likewise.
5420 * src/shred.c (main): Likewise.
5422 * src/env.c (main): Exit with status 1, not 2, on errors detected
5424 * src/hostname.c (main): Likewise.
5425 * src/nl.c (main): Likewise.
5426 * src/stty.c (main): Likewise.
5428 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
5429 consistency with the other programs' naming conventions.
5432 * src/factor.c (main): Do not report a usage error simply
5433 because stdin has bad numbers.
5435 * src/id.c (problems): Now a boolean int, not a counter,
5436 so that we don't have to worry about int overflow. All uses changed.
5437 * src/touch.c (err): Likewise.
5439 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
5441 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
5442 * src/mknod.c: Likewise.
5444 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
5445 on error; this is in case EXIT_FAILURE is unusual.
5446 * src/su.c (main): Likewise.
5448 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
5449 changed to EXIT_CANNOT_INVOKE.
5451 * src/printenv.c (PRINTENV_FAILURE): New constant.
5452 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
5453 command-line syntax problems.
5455 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
5456 (main): Avoid integer overflow when seeing whether errors occurred.
5458 * src/seq.c (print_numbers): Now returns void, not (zero) int.
5459 All callers changed.
5460 (main): Remove unused local variable 'errs'. Always exit successfully
5461 if we reach the end.
5463 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
5464 for consistency with other programs here. All uses changed.
5465 (main): Use 'error' to exit rather than invoking 'exit' here.
5467 * src/sort.c: Don't include <assert.h>.
5468 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
5469 (usage): Don't use 'assert'.
5470 (main): Remove redundant assignment to exit_failure.
5472 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
5474 (initialize_exit_failure): New inline function.
5475 Include exitfail.h here, since we refer to exit_failure.
5476 All callers changed to not include exitfail.h.
5478 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
5479 substitute them for the corresponding integer constants.
5481 * tests/help-version (expected_failure_status_date): Remove, as
5482 'date' is now normal.
5483 (expected_failure_status_nohup): New var.
5485 2004-01-21 Jim Meyering <jim@meyering.net>
5487 * tests/touch/relative: Remove `command' syntax.
5488 Thanks to Nelson H. F. Beebe and Paul Eggert.
5490 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
5491 so as to avoid problems with systems using TAI clocks.
5492 Although it's no longer necessary, set TZ=UTC0 also for the
5493 initial touch command. Reported by Paul Jarc here:
5494 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
5496 2004-01-20 Diego Biurrun <diego@biurrun.de>
5498 * src/dircolors.hin: Add .mov to the list of media files.
5500 2004-01-19 Paul Eggert <eggert@twinsun.com>
5502 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
5503 portable). Problem reported by Christian Krackowizer. Also, use
5504 +0000 rather than +0 to specify a time zone, as the documentation
5505 requires four digits.
5507 2004-01-19 Jim Meyering <jim@meyering.net>
5509 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
5510 * tests/mv/backup-is-src: Likewise.
5511 Problem reported by Peter Horst
5513 2004-01-17 Jim Meyering <jim@meyering.net>
5515 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
5519 2003-12-15 Paul Eggert <eggert@twinsun.com>
5521 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
5522 with -r specifying the origin for -d.
5523 * src/touch.c (flexible_date): Remove static var.
5524 (get_reldate): New function.
5525 (main): Use it, to implement this new behavior.
5527 2004-01-16 Jim Meyering <jim@meyering.net>
5529 * tests/touch/relative: New test for the above.
5530 * tests/touch/Makefile.am (TESTS): Add relative.
5532 2004-01-13 Jim Meyering <jim@meyering.net>
5534 * src/system.h: Include contents of sys2.h.
5535 * src/sys2.h: Remove file.
5536 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
5538 * Use automake-1.8.2. Regenerate dependent files.
5540 * Update to gettext-0.13.1.
5541 * configure.ac: Use gettext-0.13.1.
5542 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
5544 2004-01-12 Jim Meyering <jim@meyering.net>
5546 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
5548 * Makefile.maint (po-check): Ensure that cvsu works before using it.
5549 Reported by Alexandre Duret-Lutz.
5551 * src/tail.c (main): Warn about following stdin only when it's a tty.
5553 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
5555 2004-01-10 Jim Meyering <jim@meyering.net>
5557 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
5559 2004-01-09 Jim Meyering <jim@meyering.net>
5561 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
5563 2004-01-08 Jim Meyering <jim@meyering.net>
5565 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
5566 From Andreas Schwab.
5568 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
5569 remnant) from PATH component. That would cause tests in this directory
5570 not to run the just-built binaries, but rather whatever happened
5571 to be in one's PATH. Reported by Christian Krackowizer.
5573 2004-01-04 Jim Meyering <jim@meyering.net>
5575 * src/csplit.c (new_control_record): Use x2nrealloc
5576 rather than xrealloc.
5578 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
5580 (make_path_private): Likewise.
5582 2004-01-03 Jim Meyering <jim@meyering.net>
5584 * src/paste.c: Use `bool' (not int) as the type for a few
5586 (collapse_escapes): Rewrite to set globals rather than modifying
5588 Use size_t (not int) for all counters and related index variables.
5589 (paste_parallel): Remove needless complexity of
5590 using xrealloc in the loop; just allocate the buffers up front.
5591 Free the two temporary buffers.
5592 Move declarations of locals `down' into scope where used.
5593 (paste_serial): Remove `register' attributes.
5594 (main): Simplify delim-related code.
5595 Free `delims', now that it's malloc'd.
5597 2004-01-02 Jim Meyering <jim@meyering.net>
5599 * src/chroot.c: Include "quote.h".
5600 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
5601 (main): Exit with status of 127, not 1, for too-few-args,
5602 chroot failure, or chdir failure.
5603 Give a better diagnostic upon execvp failure.
5605 * src/du.c (usage): Mention that, with its current meaning,
5608 * src/tail.c (main): Warn about following stdin when it's a tty.
5609 Fail when following by name but no names are specified.
5611 2003-12-30 Jim Meyering <jim@meyering.net>
5613 * src/fold.c (main): Use memcpy, not strcpy.
5615 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
5618 2003-12-28 Jim Meyering <jim@meyering.net>
5620 * src/unexpand.c (n_tabs_allocated): New global.
5621 (add_tabstop): Use x2nrealloc rather than xrealloc.
5622 * src/expand.c: Likewise.
5624 * tests/misc/expand: New file.
5625 * tests/misc/Makefile.am (TESTS): Add expand.
5627 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
5628 (fillbuf): Use x2nrealloc rather than xrealloc.
5629 (sort): Use xnmalloc rather than xmalloc.
5632 2003-12-27 Jim Meyering <jim@meyering.net>
5634 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
5636 2003-12-29 Paul Eggert <eggert@twinsun.com>
5638 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
5639 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
5641 * doc/coreutils.texi (join invocation): Remove documentation
5642 accordingly. Document that -t makes all separators significant.
5644 * src/join.c: Include posixver.h.
5645 (obsolete_usage): New var.
5646 (longopts): Put obsolete options first.
5647 (OBSOLETE_LONG_OPTIONS): New constant.
5648 (get_option, add_file_name): New functions.
5649 (main): Use them to support new behavior.
5650 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
5651 Do not mark -j FIELD as obsolescent; it is longstanding
5652 UNIX tradition and is a valid extension to POSIX.
5654 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
5656 2003-12-28 Paul Eggert <eggert@twinsun.com>
5658 * src/join.c (add_field_list): Don't use alloca with unbounded
5659 size; just modify the argument, which is no longer const *.
5661 Various other minor cleanups, mostly to avoid the need for casts.
5663 (extract_field): Renamed from ADD_FIELD, as it's now a function.
5665 (struct field.beg): Now char *, not unsigned char const *. All
5666 uses changed. It shouldn't be const since xmemcoll writes on its
5668 (extract_field): Likewise, for 2nd arg.
5669 (keycmp): Remove now-unnecessary cast of xmemcoll args.
5671 (is_blank): New function, to avoid need to cast arg to unsigned char.
5672 (extract_field): Use it.
5674 (xfields): Rewrite pretty much from scratch.
5676 (hard_LC_COLLATE): Now bool, not int.
5677 (get_line, getseq, add_field_list): Now returns bool, not int.
5678 (decode_field_spec, add_field_list): Return true on success (not
5679 false), for consistency with the rest of the code. All uses changed.
5681 (tab): Now char, not unsigned char. This wasn't 100% necessary
5682 but is slightly cleaner.
5683 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
5685 (empty_filler): Now const *.
5687 (make_blank): Remove; wasn't needed. Remove all calls.
5688 (main): Don't set uni_blank.nfields; zero is fine.
5690 2003-12-27 Jim Meyering <jim@meyering.net>
5692 * src/join.c: Include "quote.h".
5693 (min, max): Remove definitions.
5694 Make a few function parameters and corresponding
5695 locals `const'. Use bool for boolean variables.
5696 Use size_t (not int) for all counters and related index variables.
5697 (prjoin): Remove now-useless assertion.
5698 (string_to_join_field): New function.
5699 (main): Accept join fields as large as SIZE_MAX.
5700 (keycmp): Rename `min' to MIN and max to MAX.
5702 2003-12-26 Jim Meyering <jim@meyering.net>
5704 fold -s didn't work on e.g., alpha-based systems.
5705 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
5706 x2nrealloc works properly on systems with differing sizes for int
5707 and size_t. Reported by Nelson Beebe.
5709 * src/fold.c: Use `bool' (not int) as the type for a few
5712 2003-12-23 Paul Eggert <eggert@twinsun.com>
5714 * src/ls.c (length_of_file_names_and_frills):
5715 Remove forward decl; not needed.
5716 (print_file_name_and_frills, length_of_file_name_and_frills):
5717 With -m, don't output spaces before inum or size.
5718 (print_with_commas): Don't output space just before newline.
5720 2003-12-24 Jim Meyering <jim@meyering.net>
5722 * tests/ls/Makefile.am (TESTS): Add m-option.
5723 * tests/ls/m-option: New file. Test for above fixes.
5725 2003-12-20 Jim Meyering <jim@meyering.net>
5729 * src/pr.c: Change type of global, buff_allocated, to size_t.
5731 * src/join.c [struct seq]: Change types of members count and alloc
5732 from `int' to `size_t'.
5734 * tests/Makefile.am (root-hint): Tweak wording.
5736 * src/du.c: Accept new option (-0, --null) that makes it so each
5737 output line is NUL-terminated rather than newline-terminated.
5739 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
5740 Reported by Volker Paul.
5741 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
5742 * tests/dd/unblock-sync: New test for the above.
5744 2003-12-19 Jim Meyering <jim@meyering.net>
5746 * tests/misc/nohup: Double quote back-ticked expression,
5747 in case it ends up having an unexpected value.
5749 * tests/ls/no-arg: Use ls's -1 option in both runs.
5751 * src/du.c (fts_debug): New global.
5752 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
5753 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
5754 (main) [DU_DEBUG]: Accept -d option.
5756 2003-12-18 Jim Meyering <jim@meyering.net>
5758 * src/ls.c (format_user): Increment dired_pos via two statements,
5759 `dired_pos += width; dired_pos++;' rather than one,
5760 `dired_pos += width + 1;' since the latter could conceivably overflow.
5761 (format_group): Likewise.
5764 * configure.ac: Require automake-1.8.
5766 2003-12-12 Jim Meyering <jim@meyering.net>
5768 * Use automake-1.8. Regenerate dependent files.
5770 2003-12-08 Jim Meyering <jim@meyering.net>
5772 * Makefile.maint (news-date-check): New rule.
5773 (alpha beta major): Depend on it.
5775 2003-12-03 Paul Eggert <eggert@twinsun.com>
5777 * NEWS: ls -l (and similar options) now adjust all columns to
5778 fit the data. Generalized from a suggestion by Leah Q for file sizes.
5779 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
5780 (format_user_width, format_group_width, unsigned_file_size,
5781 format_group): New functions.
5782 (block_size_width): Renamed from block_size_size.
5783 (inode_number_width, nlink_width, owner_width, group_width,
5784 author_width, major_device_number_width, minor_device_number_width,
5785 file_size_width): New vars.
5786 (clear_files): Initialize them.
5787 (gobble_file): Set them. Don't ceiling block_size_width to 7.
5788 (print_long_file): Use them.
5789 (gobble_file): Use a new local variable 'f' to make the code
5790 smaller and more consistent with other functions.
5791 (format_user): Output to stdout, not to a buffer, so that we
5792 don't have to worry about buffer overrun. Update dired_pos.
5793 (print_long_file): Don't put owner, group, author into buffer;
5794 just print them directly. Don't assume link counts and
5795 major and minor numbers fit into unsigned long int.
5796 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
5797 'ls' output is fixed-width.
5799 2003-12-02 Jim Meyering <jim@meyering.net>
5801 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
5803 2003-11-27 Jim Meyering <jim@meyering.net>
5805 * Use automake-1.7f. Regenerate dependent files.
5807 2003-11-24 Paul Eggert <eggert@twinsun.com>
5809 Parse floating-point operands and options in the C locale.
5810 POSIX requires this for printf, and we might as well be
5811 consistent elsewhere (tail, sleep, seq).
5813 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
5814 needed now that we assume C89. Include "c-strtod.h".
5815 (xstrtod): Call c_strtod, not strtod.
5816 * src/sleep.c: Include "c-strtod.h".
5817 (main): Update xstrtod call to include new argument, c_strtod.
5818 * src/seq.c (scan_double_arg): Likewise.
5819 * src/tail.c (parse_options): Likewise.
5821 2003-11-24 Jim Meyering <jim@meyering.net>
5823 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
5824 Reported by Mark Conty.
5826 2003-11-22 Jim Meyering <jim@meyering.net>
5828 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
5829 (sc_system_h_headers): Do this test only if sys2.h exists.
5831 2003-11-20 Jim Meyering <jim@meyering.net>
5833 * tests/help-version: Ensure that the bug-reporting address is
5834 included in the --help output for every program.
5835 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
5837 * src/ptx.c (usage): Output bug-reporting address.
5838 Reported by Dan Jacobson.
5840 2003-11-19 Jim Meyering <jim@meyering.net>
5842 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
5843 on the join fields. Suggestion from Bruce Robertson.
5845 2003-11-18 Jim Meyering <jim@meyering.net>
5847 `od -c -w9999999' could segfault
5848 * src/od.c (dump): Use xnmalloc/free, not alloca.
5850 2003-11-16 Jim Meyering <jim@meyering.net>
5852 * Use autoconf-2.59. Regenerate dependent files.
5854 * tests/du/hard-link: Minor tweak: use mkdir -p.
5856 Fix read-from-free'd-buffer error detected by valgrind.
5857 * src/csplit.c (remove_line): Don't return a pointer to data in
5858 a freed buffer. Instead, arrange to free the buffer on the
5861 * tests/misc/csplit: New test for above fix.
5863 2003-11-11 Jim Meyering <jim@meyering.net>
5865 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
5866 This avoids a warning from valgrind about memcpy with overlapping
5867 source and destination.
5869 * configure.ac: Require automake-1.7.8.
5871 2003-11-09 Jim Meyering <jim@meyering.net>
5873 * Use automake-1.7.9. Regenerate dependent files.
5875 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
5876 * src/chown.c: Likewise.
5878 * src/chown-core.c: Include "root-dev-ino.h".
5879 (chopt_init): Initialize new member.
5880 (change_file_owner): Support rm's new --preserve-root option.
5882 * src/remove.c: Include "root-dev-ino.h".
5883 (remove_cwd_entries): Remove now-obsolete FIXME comment.
5884 (remove_dir): Support rm's new --preserve-root option.
5886 * src/chown.c: Include "root-dev-ino.h".
5887 Add new options: --preserve-root and --no-preserve-root.
5889 * src/chmod.c: Include "root-dev-ino.h".
5890 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
5891 ROOT_DEV_INO_WARN macros.
5892 (get_root_dev_ino): Remove function definition, now that it's
5893 been moved to a separate file.
5894 (usage): Describe new options.
5896 * src/mv.c (rm_option_init): Initialized new member.
5898 * src/remove.h: Include "dev-ino.h".
5899 (struct rm_options): Add new member: root_dev_ino.
5900 * src/chown-core.h: Include "dev-ino.h".
5901 (struct Chown_option): Add new member: root_dev_ino.
5903 2003-11-06 Jim Meyering <jim@meyering.net>
5905 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
5906 hard-coding `sizeof FILE*'.
5908 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
5910 * src/wc.c (main): Free `fstatus' so there is no confusion about
5911 whether it's leaked or not.
5912 * src/who.c (who): Likewise for `utmp_buf'.
5914 2003-11-05 Paul Eggert <eggert@twinsun.com>
5916 Fix 'cut' problems with size_t overflow and unsigned int.
5917 More generally, resize integer variables to fit use more precisely.
5918 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
5919 (struct range_pair): Make members to be of type size_t, not unsigned.
5920 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
5921 (suppress_non_delimited, output_delimiter_specified,
5922 have_read_stdin, print_kth, set_fields): Now bool, nt int.
5923 (delim): Now unsigned char, not int.
5924 (mark_printable_field, is_printable_field, is_range_start_index,
5925 set_fields, set_fields, cut_bytes, cut_fields):
5926 Use size_t, not unsigned, for field and byte counts.
5927 (hash_int): Use uintptr_t, not unsigned, for pointers converted
5928 to integers. This squeezes more info out of them.
5929 (set_fields, cut_bytes, cut_fields, main):
5930 Use bool, not int, for booleans.
5931 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
5933 2003-11-05 Paul Eggert <eggert@twinsun.com>
5935 * man/Makefile.am (check-programs-vs-x):
5936 Work even if $(programs) contains '$'.
5937 Work even if 'missing=1' in environment.
5938 Don't report an error simply because $(programs) outputs nothing.
5940 2003-11-05 Jim Meyering <jim@meyering.net>
5942 * Use autoconf-2.58. Regenerate dependent files.
5944 * src/tr.c (spec_init): Fix typo in last change.
5946 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
5947 call to variadic version_etc function, so that it works even on systems
5948 for which sizeof char* != sizeof int.
5949 * src/true.c (main): Likewise.
5950 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
5951 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
5952 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
5953 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
5954 Similarly, cast NULL to `(char *)' in call to variadic function,
5955 parse_long_options, so that it works even on systems for which
5956 sizeof char* != sizeof int.
5957 A similar problem was reported by Harti Brandt in
5958 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
5960 * src/users.c (users): Free `utmp_buf' explicitly so that people
5961 don't mistake this for a real leak.
5962 Patch by Dennis Smit <ds@nerds-incorporated.org.
5964 2003-11-04 Paul Eggert <eggert@twinsun.com>
5966 * README: Document _POSIX2_VERSION.
5968 2003-11-04 Jim Meyering <jim@meyering.net>
5970 * src/tac.c (memrchr): Remove #if-0'd function.
5971 (tac_stdin_to_mem): Clean up #if-0'd code.
5973 * src/od.c (decode_format_string): Remove unnecessary casts.
5974 Use more maintainable `sizeof *var'.
5975 (main): Call decode_format_string rather than decode_one_format,
5976 now that `spec' may be NULL.
5978 * src/chmod.c (AUTHORS): Add my name.
5980 * src/split.c (next_file_name): Use `sizeof *var' rather than
5981 hard-coding `sizeof size_t'.
5983 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
5985 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
5986 to avoid potential overflow in pointer arithmetic.
5987 (set_fields): Use not `1', but rather `sizeof *printable_field' as
5988 second argument to xcalloc.
5989 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
5990 rather than xrealloc.
5991 * src/date.c (show_date): Likewise.
5992 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
5993 * src/pr.c (store_char): Likewise.
5994 * src/fold.c (fold_file): Likewise.
5996 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
5997 type changes (unsigned int -> size_t) in hash.c.
5998 * src/cp-hash.c (src_to_dest_hash): Likewise.
5999 * src/du.c (entry_hash): Likewise.
6000 * src/ls.c (dev_ino_hash): Likewise.
6001 * src/cut.c (hash_int): Likewise. Declare function as static.
6003 2003-11-03 Jim Meyering <jim@meyering.net>
6005 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
6006 * tests/misc/fold: Fail the test immediately if we're not running
6007 the expected version of fold.
6009 2003-11-02 Jim Meyering <jim@meyering.net>
6011 * src/tr.c (append_normal_char, append_range, append_char_class)
6012 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
6013 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
6014 and usually shorter.
6015 * src/copy.c (copy_internal): Likewise.
6016 * src/join.c (initseq, add_field, make_blank): Likewise.
6017 * src/od.c (main): Likewise.
6018 * src/cp.c (make_path_private): Likewise.
6019 * src/tsort.c (new_item, record_relation): Likewise.
6021 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
6022 (main): Also remove anachronistic cast of xmalloc return value.
6023 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
6024 (main): Also remove anachronistic cast of xmalloc return value.
6025 * src/sort.c (inittables): Likewise.
6026 (sort): Also Split a long line.
6028 2003-10-25 Jim Meyering <jim@meyering.net>
6030 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
6031 type changes (unsigned int -> size_t) in hash.c.
6032 * src/cp-hash.c (src_to_dest_hash): Likewise.
6033 * src/du.c (entry_hash): Likewise.
6034 * src/ls.c (dev_ino_hash): Likewise.
6035 * src/cut.c (hash_int): Likewise. Declare function as static.
6037 2003-10-21 Jim Meyering <jim@meyering.net>
6039 Don't fail when run with VERBOSE=yes.
6040 * tests/chgrp/basic: Do `set +x' before starting the subshell
6041 from which we invoke chgrp. Otherwise, the output from the
6042 VERBOSE=yes-induced `set -x' would result in spurious differences.
6043 Reported by Russel Coker via Michael Stone.
6045 2003-10-19 Jim Meyering <jim@meyering.net>
6047 chmod now uses fts to perform a directory traversal when -R is
6048 specified. Before, it operated on full path names, and as such
6049 would encounter the PATH_MAX (often 4096) limit.
6051 * src/chmod.c: Include "xfts.h".
6052 (process_file): Rename from change_file_mode.
6053 Adapt to be used with fts.
6054 (process_files): New function.
6056 2003-10-18 Jim Meyering <jim@meyering.net>
6058 * tests/du/deref-args: Ensure that du -D now dereferences all
6059 symlinks specified on the command line, not just those that
6060 reference directories.
6062 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6063 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6064 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6065 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6066 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6067 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6068 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6069 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
6070 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
6071 Update the call to parse_long_options so that `AUTHORS, NULL' are the
6073 * src/true.c (main): Append NULL to version_etc argument list.
6074 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6076 2003-10-17 Andreas Schwab <schwab@suse.de>
6078 * tests/mk-script: Get $srcdir from first parameter instead of
6080 (main): Update usage.
6082 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
6083 first argument of mk-script.
6084 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
6086 2003-10-17 Jim Meyering <jim@meyering.net>
6088 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
6089 generated `man' page is more readable. Suggestion from Dan Jacobson.
6091 * src/chown-core.c (change_file_owner): Handle the cases in
6092 which fts_info indicates an error with the given entry.
6094 * src/du.c (main): Simply assign to bit_flags.
6095 Don't bother with bit arithmetic.
6097 * tests/chmod/no-x: New file.
6098 * tests/chgrp/no-x: New file.
6099 * tests/chmod/Makefile.am (TESTS): Add no-x.
6100 * tests/chgrp/Makefile.am (TESTS): Likewise.
6102 * src/du.c: Include "xfts.h".
6103 (du_files): Use xfts_open, rather than fts_open.
6104 * src/chown-core.c (chown_files): Likewise.
6106 2003-10-16 Jim Meyering <jim@meyering.net>
6108 * src/chgrp.c (main): Simply assign to bit_flags.
6109 Don't bother with bit arithmetic.
6110 * src/chown.c (main): Likewise.
6111 Rename a couple of local variables.
6112 Remove unnecessary casts.
6114 * src/tail.c (start_bytes): Rename local, remainder, to avoid
6115 gcc's warning about shadowing a global.
6117 2003-10-15 Jim Meyering <jim@meyering.net>
6119 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
6120 use fts to perform a directory traversal when -R is specified.
6121 Before, they operated on full path names, and as such would
6122 encounter the PATH_MAX (often 4096) limit.
6123 They are more efficient. For example, before, chgrp -R would
6124 take almost 5 seconds to change about 2000 directories and fail
6125 (with `File name too long'), while now it succeeds on a hierarchy
6126 of depth 20,000 in 1/10 the time.
6128 * src/chown.c: Include "userspec.h" and "fts_.h".
6129 (WRITTEN_BY): Add my name.
6130 (getpwnam, getgrnam, getgrgid): Remove declarations.
6131 (endpwent): Remove definition.
6133 (main): Handle new options.
6134 Call new function, chown_files rather than change_file_owner.
6136 * src/chgrp.c: Include "fts_.h".
6137 (WRITTEN_BY): Add my name.
6138 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
6141 (main): Handle new options.
6142 Call new function, chown_files rather than change_file_owner.
6144 Rewrite to iterate through hierarchies using fts rather than
6145 via explicit recursion.
6146 * src/chown-core.c: Include "fts_.h"
6147 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
6148 on a single file at a time.
6149 (chown_files): New function.
6150 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
6151 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
6152 [struct Chown_option] (dereference): Remove member with ambiguous name.
6153 [struct Chown_option] (affect_symlink_referent): New member.
6154 (chown_files): New prototype.
6156 * tests/chgrp/recurse: Update tests accordingly.
6157 * tests/chgrp/posix-H: New tests for the above.
6158 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
6160 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
6161 work even for superuser. Suggestion from Dan Jacobson.
6163 2003-10-14 Paul Eggert <eggert@twinsun.com>
6165 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
6167 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
6168 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
6169 * src/sort.c (parse_field_count): Handle the case where overflow
6170 and invalid suffix char are both reported.
6172 2003-10-14 Jim Meyering <jim@meyering.net>
6174 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
6175 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
6178 2003-10-13 Paul Eggert <eggert@twinsun.com>
6180 Fix to avoid a denial-of-service attack if the display width is
6181 enormous. Also, clean up the code a bit by removing duplicate code.
6183 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
6184 (calculate_columns): New function, that contains code that used
6185 to be common to print_many_per_line and print_horizontal.
6186 (print_many_per_line, print_horizontal): Use it.
6187 (decode_switches): Set max_idx here, not in calculate_columns.
6188 (print_current_files): Don't call init_column_info; calculate_columns
6190 (init_column_info): Don't allocate a lot more space than is needed
6191 to represent the current set of files. Allocate all the new
6192 size_t cells in one call to xnmalloc, rather than a row at a time.
6194 2003-10-13 Jim Meyering <jim@meyering.net>
6196 * src/ls.c (init_column_info): Add another FIXME comment.
6198 2003-10-13 Paul Eggert <eggert@twinsun.com>
6200 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
6201 Remove several arbitrary limits on hosts where int cannot represent
6204 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
6205 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
6206 struct column_info.col_arr[0], max_idx):
6207 Now size_t, not int.
6208 (get_funky_string): Return bool indicating success, instead of
6209 a negative count to indicate failure. Store number of columns
6210 through new parameter OUTPUT_COUNT; that way, they can never
6211 go negative. Change equals_end from int to bool. All uses
6213 (struct column_info.valid_len): Now bool, not int. All uses changed.
6214 (dired_dump_obstack, get_funky_string, clear_files,
6215 extract_dirs_from_files, print_current_files,
6216 print_many_per_line, print_horizontal, init_column_info,
6217 put_indicator, length_of_file_name_and_frills,
6218 print_with_commas): Use size_t, not int, for local variables
6220 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
6221 Check for TIOCGWINSZ returing negative values (or values greater
6223 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
6225 Use xmalloc and xnmalloc, not XMALLOC.
6226 (gobble_file): Use xnrealloc, not XREALLOC.
6227 (print_color_indicator): Remove now-unnecessary cast to size_t.
6229 2003-10-12 Paul Eggert <eggert@twinsun.com>
6231 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
6232 * tests/sort/sort-tests: Remove from CVS; assume that people
6233 brave enough to check coreutils out from CVS can rebuild it.
6235 2003-10-12 Jim Meyering <jim@meyering.net>
6237 New options: --preserve-root and --no-preserve-root.
6238 * src/chmod.c (change_file_mode): Honor new option.
6239 (change_file_mode): Strip trailing slashes on directory
6240 argument passed to change_dir_mode.
6241 (get_root_dev_ino): New function.
6242 (main): Initialize global, root_dev_ino.
6244 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
6245 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
6247 * src/chmod.c (change_file_mode): Likewise.
6249 2003-10-08 Jim Meyering <jim@meyering.net>
6251 * src/csplit.c (main): Remove obsolete FIXME.
6253 2003-10-07 Jim Meyering <jim@meyering.net>
6255 * Use automake-1.7.8. Regenerate dependent files.
6257 2003-09-29 Paul Eggert <eggert@twinsun.com>
6261 * doc/coreutils.texi (csplit invocation):
6262 The regexp offset need not have a sign; POSIX requires support
6263 for signless offets.
6265 Be more careful about int widths. For example, remove some
6266 arbitrary limits by replacing 'unsigned' with 'size_t',
6267 'uintmax_t', etc. Use standard bool rather than a homegrown type.
6268 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
6269 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
6270 to <stdbool.h> usage.
6271 (struct control): offset is now intmax_t, not int.
6272 repeat_forever is now bool, not int.
6273 (struct cstring): len is now size_t, not unsigned int.
6274 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
6275 size_t, not unsigned. start_line, first_available are now
6276 uintmax_t, not unsigned.
6277 (hold_count, control_used): Now size_t, not unsigned.
6278 (last_line_number, current_line, bytes_written):
6279 Now uintmax_t, not unsigned.
6280 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
6281 create_new_buffer, get_new_buffer, load_buffer, find_line,
6282 process_regexp, split_file, new_control_record, extract_regexp,
6283 get_format_width, get_format_prec, max_out):
6284 size args, locals, and returned values are now size_t, not unsigned
6286 (get_first_line_in_buffer, find_line, write_to_file,
6287 handle_line_error, process_line_count, regexp_error, process_regexp,
6289 File line, byte, and repetition counts are now uintmax_t, not unsigned.
6290 (check_for_offset): Don't require a sign before the offset.
6291 Use xstrtoimax to do the real work.
6292 (extract_regexp): Remove harmful cast of size to unsigned.
6293 256 -> 1<<CHAR_BIT, for clarity.
6294 (get_format_flags): Return at most 3, to avoid worries about overflow.
6296 (bytes_to_octal_digits): Remove.
6298 (cleanup): Don't check whether output_stream is NULL, since
6299 close_output_file does that for us.
6301 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
6302 (sizeof *p);" instead of the more long-winded alternatives.
6304 (get_new_buffer): Use O(1) algorithm for resizing a buffer
6305 to a much larger size, instead of an O(N) algorithm.
6307 (process_regexp): Use plain NULL rather than casted 0.
6309 (make_filename): Use %u, not %d, to format unsigned file number.
6311 (new_control_record): Use xrealloc exclusively, since it handles
6314 (extract_regexp): Change misspelled word in diagnostic.
6316 (get_format_width): Even if a minimum field width is specified,
6317 allow room for enough octal digits to represent the value of
6318 the maximum representible integer. This fixes a potential
6319 buffer overrun. Calculate this room at compile-time, not
6320 at run-time; this removes the need for bytes_to_octal_digits.
6321 Check for overflow; this removes a FIXME.
6323 (get_format_prec): Don't allow precision to be signed; it's
6324 not ANSI. Check for overflow. Remove hardcoded "11" as
6325 default precision; this fixes a potential buffer overrun
6326 on hosts with wider size_t.
6328 (get_format_conv_type): Change local variable to be of type
6329 unsigned char, not int; this removes a potential subscript
6330 violation on hosts where char is signed.
6332 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
6333 Allow "%%" in format. Don't overflow when
6334 counting lots of percents.
6336 (usage): Default sprintf format is %02u, not %d.
6338 2003-10-05 Jim Meyering <jim@meyering.net>
6340 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
6342 * src/du.c (du_files): Mark diagnostic for translation.
6344 2003-10-04 Jim Meyering <jim@meyering.net>
6346 * src/du.c (du_files): Ignore any failure of fts_close.
6347 Give better diagnostics for failed fts_open.
6349 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
6351 Deprecate existing use of -H (aka --si).
6352 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
6353 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
6354 (main): Warn that the meaning of -H will soon change to be
6357 2003-10-03 Jim Meyering <jim@meyering.net>
6359 * src/du.c: Accept --no-dereference (-P).
6361 2003-10-02 Jim Meyering <jim@meyering.net>
6363 * tests/du/trailing-slash: Adjust for slightly different output.
6365 Rewrite du.c to use fts.
6366 * src/du.c: Include "fts_.h", not ftw.h.
6367 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
6368 (IS_FTW_DIR_TYPE): Remove definition.
6369 (IS_DIR_TYPE): Define.
6370 (is_symlink_to_dir): Remove now-unnecessary function.
6371 (process_file, du_files): Rewrite to use fts.
6373 * tests/du/inaccessible-cwd: Ensure that even when run from an
6374 inaccessible directory, du can still operate on accessible
6375 directories elsewhere.
6376 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
6378 * tests/rm/deep-1: Ensure that du can process a hierarchy
6379 of depth 400 while using no more than 50KB of stack space.
6381 2003-10-01 Akim Demaille <akim@epita.fr>
6383 * announce-gen (print_news_deltas): New function, extracted from main.
6384 (main): Make `news_file' an array.
6385 Use '...=s' => \@var for --news and --url-directory specs.
6386 Before there were a couple of portability problems.
6388 2003-09-28 Jim Meyering <jim@meyering.net>
6390 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
6391 (syntax-check-rules): Add it.
6393 * src/copy.c: Remove unnecessary cast of alloca, since now it's
6394 guaranteed to be (void *).
6395 * src/cp.c: Likewise.
6396 * src/join.c: Likewise.
6397 * src/ln.c: Likewise.
6398 * src/ls.c: Likewise.
6399 * src/od.c: Likewise.
6400 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
6402 2003-09-27 Jim Meyering <jim@meyering.net>
6404 Don't exhaust virtual memory when processing large inputs.
6405 Fix this by removing csplit's internal free-list management;
6406 instead rely on malloc for that.
6408 * src/csplit.c (free_list): Remove global.
6409 (clear_all_line_control): Remove function.
6410 (get_new_buffer): Always use create_new_buffer to obtain a
6411 new buffer, rather than searching free_list.
6412 (free_buffer): Just call free.
6413 Reported by Nikola Milutinovic.
6415 2003-09-26 Jim Meyering <jim@meyering.net>
6417 * man/rm.x: Also list `chattr' in SEE ALSO section.
6418 Suggestion from Mark Hubbart.
6420 2003-09-25 Jim Meyering <jim@meyering.net>
6422 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
6423 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
6425 * Use autoconf-2.57d. Regenerate dependent files.
6427 2003-09-24 Jim Meyering <jim@meyering.net>
6429 Minor efficiency tweak.
6430 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
6431 (do_link): Likewise.
6433 2003-09-23 Jim Meyering <jim@meyering.net>
6435 * src/paste.c (paste_serial): Save errno after input error,
6436 to report proper errno value.
6437 Based on a patch from Paul Eggert.
6439 * src/tee.c (tee): Adjust fwrite arguments so that the return
6440 value is the number of bytes written.
6442 2003-09-16 Paul Eggert <eggert@twinsun.com>
6444 Don't assume ferror sets errno. Bug reported by Bruno Haible.
6446 * src/comm.c (compare_files): Save errno after input error,
6447 to report proper errno value.
6448 * src/fold.c (fold_file): Likewise.
6449 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
6450 * src/unexpand.c (unexpand): Likewise.
6452 * src/csplit.c (close_output_file): Don't report bogus errno value
6453 after ferror discovers an output error. We don't know the proper
6454 errno value, since it might have been caused by any of a whole
6455 bunch of calls, and it might have been trashed in the meantime.
6456 Fixing this problem will require much more extensive changes;
6457 in the meantime just say "write error".
6458 * src/od.c (check_and_close, dump, dump_strings): Likewise.
6459 * src/uniq.c (check_file): Likewise.
6461 * src/join.c (get_line): Report error right away if I/O fails,
6462 so that the proper errno value is used.
6463 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
6464 * src/tee.c (tee): Likewise.
6465 * src/uniq.c (check_file): Likewise.
6467 * src/od.c (skip): If a read fails, don't retry it later, so
6468 that we report the proper errno.
6470 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
6472 * src/tee.c (tee): Once a write failure has occurred, don't bother
6473 writing anything more to that stream.
6475 * src/uniq.c (check_file): Check for ferror (stdout) even if
6478 * src/yes.c (UNROLL): Remove.
6479 (main): Exit immediately when write failure is detected.
6480 Simplify code by assigning to argv when argc == 1.
6482 2003-09-21 Paul Eggert <eggert@twinsun.com>
6484 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
6485 (WRITTEN_BY): Change "Franc,ois" (actually using
6486 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
6489 2003-09-19 Jim Meyering <jim@meyering.net>
6491 `du -D symlink-to-dir' would mistakenly omit the slash in
6492 lines like this: 24 symlink-to-dir/subdir
6493 * src/du.c (process_file): Fix offset calculation.
6494 Reported by Jeff Sheinberg as Debian bug #211591;
6495 http://bugs.debian.org/205251
6497 * tests/du/deref-args: New file/test for the above.
6498 * tests/du/Makefile.am (TESTS): Add deref-args.
6500 * src/du.c (process_file): Remove useless disjunct.
6502 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
6504 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
6505 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
6506 Mark each WRITTEN_BY string as translatable.
6508 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6509 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6510 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6511 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6512 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6513 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6514 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6515 * who.c, whoami.c, yes.c: Revert yesterday's changes.
6516 Instead, a subsequent change will embed `Written by ' in
6517 each string along with the author names.
6519 * src/true.c: Revert yesterday's changes.
6520 * src/sys2.h: Likewise.
6522 2003-09-18 Jim Meyering <jim@meyering.net>
6524 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
6525 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
6526 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
6527 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
6528 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
6529 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
6530 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
6531 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
6532 comma-separated list of strings and/or update the call to
6533 parse_long_options so that `AUTHORS, NULL' are the last parameters.
6534 * src/true.c (main): Append NULL to version_etc argument list.
6535 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
6537 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
6538 shadowing the math function name. Also rename loga to log_a.
6540 2003-09-14 Jim Meyering <jim@meyering.net>
6542 * src/factor.c (print_factors): Give a separate diagnostic
6543 for numbers that are too large, but otherwise valid.
6544 Reported by Dániel Varga.
6546 2003-09-10 Jim Meyering <jim@meyering.net>
6548 * Use automake-1.7.7. Regenerate dependent files.
6550 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
6551 of `fmt -1'. Using the just-built tr is a little cleaner.
6552 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
6553 * man/Makefile.am (programs, check-x-vs-1): Likewise.
6555 2003-09-09 Jim Meyering <jim@meyering.net>
6557 * src/copy.c: Alphabetize includes.
6558 Remove duplicate inclusion of "same.h".
6560 2003-09-08 Jim Meyering <jim@meyering.net>
6562 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
6563 Didn't give enough of a benefit, mainly because it's not yet
6568 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
6569 (check-programs-vs-x): Fail if $(programs) is empty.
6571 * src/remove.c: Add a comment.
6573 2003-09-07 Jim Meyering <jim@meyering.net>
6575 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
6576 Don't define. These symbols are no longer used.
6578 * tests/misc/tty-eof: Write ^D as \cD.
6579 Complete the change of 2003-08-02.
6581 * Makefile.maint (po-check): Use cvsu, so that a temporary source
6582 file in lib/ or src/ doesn't induce an unwarranted failure.
6583 Add a kludge to filter out the sole generated source file that
6584 also has translatable messages: src/false.c.
6586 2003-09-06 Jim Meyering <jim@meyering.net>
6588 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
6589 (parse_options): Give a diagnostic for (but still accept) the
6590 deprecated --allow-missing option.
6592 2003-09-04 Paul Eggert <eggert@twinsun.com>
6594 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
6595 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
6597 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
6598 size_bound ourselves. if an input file is a pipe and the user
6599 specified a size, use that size instead of trying to guess the
6600 pipe size. This has the beneficial side effect of avoiding the
6601 overhead of default_sort_size in that case. All callers changed.
6602 (sort): Remove static var size; now done by sort_buffer_size.
6604 2003-09-05 Jim Meyering <jim@meyering.net>
6606 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
6608 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
6609 to start, rather than just .1. Upon failure, print unexpected state.
6611 2003-09-04 Paul Eggert <eggert@twinsun.com>
6613 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
6614 SAFE_READ_ERROR to tmp->nbytes.
6615 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
6617 * src/head.c (struct linebuffer): Change nbytes and nlines
6618 from unsigned int to size_t. unsigned int is safe (after the
6619 2003-09-03 patch) but size_t is cleaner.
6620 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
6621 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
6623 Standardize on BUFSIZ as opposed to other macro names and values.
6624 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
6625 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
6626 stdio.h has always defined it,
6627 and other code already assumes it's defined.
6628 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
6629 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
6630 (io_buf): IO_BUF_SIZE -> BUFSIZ.
6632 2003-09-04 Paul Eggert <eggert@twinsun.com>
6634 * src/seq.c (step): Default to 1.
6635 (print_numbers): Allow the output to be empty.
6636 (main): The default step is 1, even if LAST < FIRST;
6637 as per documentation.
6638 * tests/seq/basic (onearg-2): Output should be empty.
6640 2003-09-05 Jim Meyering <jim@meyering.net>
6642 * Makefile.cfg (wget_files): Temporarily disable, until master
6643 versions are restored to ftp.gnu.org.
6645 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
6647 Make seq's --width (-w) option work properly even when the
6648 endpoint requiring the larger width is negative and smaller than
6650 * src/seq.c (get_width_format): Include `-' in the set of bytes
6651 allowed in a `simple' number (no decimal point, no exponent).
6652 Reported by Patrick Mauritz.
6654 2003-09-02 Paul Eggert <eggert@twinsun.com>
6656 * NEWS: sort -t '\0' now uses a NUL tab.
6657 sort option order no longer matters, unless POSIX requires it.
6658 * src/sort.c (usage): Say "blanks" instead of "whitespace",
6659 Similar fixes for many comments.
6660 (TAB_DEFAULT): New constant, so that we can support NUL as
6661 the field separator.
6662 (tab): Now int, not char. Initialize to TAB_DEFAULT.
6663 (specify_sort_size): If multiple sizes are specified, use the largest.
6664 (begfield, limfield): Support NUL tab char.
6665 (set_ordering): Do not let -i override -d.
6666 (main): Report an error if incompatible -o or -t options are given.
6667 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
6669 2003-09-05 Jim Meyering <jim@meyering.net>
6671 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
6673 2003-09-03 Andreas Schwab <schwab@suse.de>
6675 Bug report and patch here:
6676 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
6677 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
6678 * src/head.c (elide_tail_lines_pipe): Likewise.
6680 2003-09-03 Jim Meyering <jim@meyering.net>
6682 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
6683 small amount of code from him was first moved to lib/human.c, and was
6684 subsequently rewritten entirely.
6685 * src/df.c (AUTHORS): Likewise.
6687 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
6689 * src/md5sum.c (split_3): Accept the BSD format for generic
6690 message digest modes. Currently works with BSD's MD5 and SHA1
6691 formats since these are the two algorithms presently used in
6692 coreutils. Updated comments to reflect this change.
6693 (bsd_split_3): Updated comments.
6695 * tests/md5sum/basic-1: New test to make sure that
6696 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
6697 from `check-bsd' test in tests/sha1sum/basic-1).
6699 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
6700 --check exit status and BSD SHA1 format (adapted from tests
6701 in tests/md5sum/basic-1).
6703 2003-08-30 Jim Meyering <jim@meyering.net>
6705 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
6707 When source and destination arguments refer to the same file, reside
6708 on a partition (e.g. VFAT) on which distinct names may refer to the
6709 same directory entry (often due to variations in case), and when the
6710 link count for the file is 1, mv no longer unlinks the file. Instead,
6711 it gives the expected diagnostic that the source and destination are
6712 the same. WARNING: this is an incomplete fix. If the file happens
6713 to have a link count of 2 or greater, such an erroneous mv command
6714 will still unlink it.
6715 Although that is not possible on vfat or umsdos, it is possible on
6716 other file system types, e.g., ntfs, and hpfs.
6717 * src/copy.c (same_file_ok): Invoke same_name (which might still
6718 return false for names that refer to the same directory entry)
6719 only if the link count is 2 or more.
6720 * tests/mv/vfat: Show how to demonstrate the above problem.
6721 This test is not run.
6722 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
6724 2003-08-27 Jim Meyering <jim@meyering.net>
6726 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
6727 who's -l option has been eliciting an unconditional warning about
6728 this impending change since sh-utils-2.0.12 (April 2002).
6730 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
6731 This would happen for nonempty files not ending with a newline.
6732 Reported by Dan Jacobson.
6733 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
6734 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
6736 * src/stat.c (print_it): Avoid buffer overrun that would
6737 occur when the user-specified format string ends with `%'.
6738 Patch by Tommi Kyntola.
6739 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
6740 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
6742 2003-08-26 Jim Meyering <jim@meyering.net>
6744 Apply changes from bison.
6745 * GNUmakefile (SHELL): Define to `sh', if necessary.
6747 * Makefile.maint (WGETFLAGS): Define to `-C off'.
6748 Update all uses of $(WGET).
6750 2003-08-22 Akim Demaille <akim@epita.fr>
6752 * Makefile.cfg (local-checks-to-skip): New.
6753 * Makefile.maint (local-check): Rename as...
6754 (local-checks-available): this.
6757 2003-08-26 Akim Demaille <akim@epita.fr>
6759 * announce-gen (print_changelog_deltas): Neutralize "<#" as
6760 "<\#" to avoid magic from Gnus when posting parts of this script.
6762 2003-08-25 Jim Meyering <jim@meyering.net>
6764 * src/stat.c (main): Warn about use of deprecated `-l' option.
6766 2003-08-22 Jim Meyering <jim@meyering.net>
6768 * src/stat.c (do_stat): For link count at end of line, use %h format,
6769 instead of %-5h. The latter would make stat emit trailing spaces.
6770 Reported by Dan Jacobson.
6772 2003-08-20 Jim Meyering <jim@meyering.net>
6774 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
6776 2003-08-19 Jim Meyering <jim@meyering.net>
6778 * src/system.h: Include stdlib.h unconditionally,
6779 as we're now assuming that part of hosted C89.
6781 2003-08-18 Jim Meyering <jim@meyering.net>
6783 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
6784 to avoid warnings from gcc.
6786 2003-08-17 Jim Meyering <jim@meyering.net>
6788 Avoid unnecessary and sometimes time-consuming hostname lookups.
6789 * src/who.c (print_user): Use strchr, not strrchr.
6790 * src/pinky.c (print_entry): Likewise.
6791 Patch by Michael Stone.
6792 This fixes a typo I introduced in who-users.c on 1996-02-23.
6794 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
6795 disallowed between `@...@'.
6797 2003-08-16 Paul Eggert <eggert@twinsun.com>
6799 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
6800 done by gnulib .m4 files.
6801 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
6802 * src/sys2.h (strtoull): Remove unused declaration.
6804 2003-08-16 Jim Meyering <jim@meyering.net>
6806 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
6809 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
6810 race condition bug. The bug would be triggered when tailing a file
6811 with file pointer not at beginning of file, and where the file was
6812 truncated to have a length of less than the initial offset at just
6813 the right moment (between the two lseek calls in this function).
6815 An invalid initial value for *read_pos would result in
6816 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
6817 busy-wait rather than sleeping between iterations. The bug manifests
6818 itself only when tailing regular files that are initially nonempty.
6819 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
6821 (tail_lines): Likewise, after lseek calls.
6822 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
6823 * tests/tail-2/tail-n0f: New file. Test for above fix.
6824 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
6826 2003-08-15 Jim Meyering <jim@meyering.net>
6828 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
6829 (sc_sun_os_names): Likewise.
6830 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
6832 * man/help2man: Remove some SPACEs before TAB.
6834 2003-08-14 Paul Eggert <eggert@twinsun.com>
6836 * Makefile.maint (LC_ALL): Set to C.
6837 * man/Makefile.am (ASSORT): New var.
6838 (check-x-vs-1, programs): Use it.
6839 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
6840 * tests/Makefile.am (ASSORT, all_programs): Likewise.
6842 2003-08-11 Jim Meyering <jim@meyering.net>
6844 fold -s -wN would infloop for N < 8 with TABs in the input.
6845 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
6846 * src/fold.c (fold_file): Move contents of `else'-block
6847 out of conditional so it's used also for --spaces (-s).
6848 * tests/misc/fold: Test for the above fix.
6849 * tests/misc/Makefile.am (TESTS): Add fold.
6851 2003-08-10 Jim Meyering <jim@meyering.net>
6853 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
6854 system.h so the types from time.h and sys/time.h are available.
6855 It appears that this is necessary for OpenBSD, NetBSD, and
6856 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
6858 2003-08-06 Paul Eggert <eggert@twinsun.com>
6860 * NEWS: Add support for setting file timestamps to microsecond
6861 resolution, on hosts that support this.
6862 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
6863 * src/copy.c (copy_internal):
6864 Set file timestamps with utimens, not utime.
6865 * src/cp.c (re_protect): Likewise.
6866 * src/install.c (change_timestamps): Likewise.
6867 * src/touch.c (newtime, touch, main): Likewise.
6869 2003-08-09 Jim Meyering <jim@meyering.net>
6871 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
6873 (syntax-check-rules): Add it.
6875 * src/tail.c (main): Tweak Solaris OS version number in comment.
6876 * src/wc.c (wc): Likewise
6877 * tests/tail-2/fflush: Likewise.
6879 * src/tail.c: Add new undocumented option, --presume-input-pipe.
6880 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
6882 2003-08-08 Paul Eggert <eggert@twinsun.com>
6884 Use new gnulib 'extensions' module.
6885 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
6888 2003-08-08 Paul Eggert <eggert@twinsun.com>
6890 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
6892 2003-08-09 Jim Meyering <jim@meyering.net>
6894 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
6895 For tests of obsolete behavior, don't presume that unsetting
6896 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
6898 2003-08-07 Paul Eggert <eggert@twinsun.com>
6900 * doc/coreutils.texi (split invocation):
6901 Add -d or --numeric-suffixes option to 'split'.
6902 From a suggestion by Jesse Kornblum.
6903 * src/split.c (suffix_alphabet): New var.
6904 (longopts, usage, next_file_name, main): Support -d.
6905 (next_file_name, main): Allow -a0, as POSIX requires.
6906 (next_file_name): Don't assume ASCII-like encoding;
6907 'a' through 'z' are not contiguous in EBCDIC.
6909 2003-08-05 Paul Eggert <eggert@twinsun.com>
6911 Merge getline from gnulib.
6912 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
6913 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
6914 New files, from gnulib.
6915 * lib/getdelim2.c, lib/getdelim2.h: Remove.
6916 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
6917 getdelim2.h to getndelim2.c and getndelim2.h.
6918 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
6919 checking for getdelim.
6920 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
6921 than rolling our own.
6922 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
6923 (cut_fields): Invoke getndelim2 rather than getdelim2.
6925 2003-08-04 Jim Meyering <jim@meyering.net>
6927 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
6928 and for the indices to iterate through nsigs.
6930 2003-08-02 Paul Eggert <eggert@twinsun.com>
6932 * src/sort.c: Minor code cleanups, mostly to use more accurate
6933 types and to remove unnecessary casts.
6934 (min, max): Remove. All uses changed to MIN and MAX.
6935 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
6936 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
6937 keyfield.numeric, struct keyfield.general_numeric, struct
6938 keyfield.month, struct keyfield.reverse, reverse, unique,
6939 have_read_stdin): Now bool, not int. All uses changed.
6940 (eolchar): Now char, not int.
6941 (struct keyfield.ignore): Now bool const *, not int *.
6942 (struct keyfield.translate): Now char const *, not char *.
6943 (struct month.name): Likewise.
6944 (blanks, nonprinting, nondictionary): Now bool[], not int[].
6945 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
6946 check, sort, main): Use const * pointers when possible.
6947 (month_cmp): Rewrite to avoid casts.
6948 (inittables): Initialize tables unconditionally, to avoid branches.
6949 (fillbuf): Return bool, not int. All uses changed.
6950 (fillbuf, keycompare, new_key, main):
6951 Use SIZE_MAX rather than (size_t) -1.
6952 (trailing_blanks): Renamed from trim_trailing_blanks.
6953 Return the number of blanks to trim. All uses changed.
6954 (getmonth): Use trailing_blanks rather than open code.
6955 (keycompare): Do not cast char * to unsigned char *; not needed.
6956 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
6958 (compare, main): Use | rather than || to avoid jumps.
6959 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
6961 (check, first_same_file, sort, main):
6962 Use bool instead of int local vars when possible.
6963 (check): Merge the old 'checkfp' and 'check' into a single function,
6964 that returns a boolean (true if the file was ordered).
6966 (main): Use int instead of unsigned for iterating through nsigs.
6967 Rename local var "posix_pedantic" to "posixly_correct".
6969 2003-08-02 Jim Meyering <jim@meyering.net>
6971 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
6972 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
6974 * src/cut.c (cut_fields): Don't read again after encountering an
6975 initial EOF. E.g., `cut -f2' would do so.
6976 * tests/misc/tty-eof: Add a test for the above fix.
6978 * src/sort.c (sortlines): Add description and references.
6981 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
6982 the tests in help-version will use the just-built binaries.
6983 Reported by Christian Krackowizer.
6985 2003-07-31 Paul Eggert <eggert@twinsun.com>
6987 * NEWS: Add --rfc-2822 option to GNU date.
6988 * doc/coreutils.texi (Time directives, Options for date, Examples
6990 * src/date.c (long_options, usage, main): Likewise.
6991 * doc/getdate.texi (General date syntax): Likewise.
6992 * doc/coreutils.texi (Options for date): Fix a typo in format:
6993 it's now %d not %_d. Add URLs.
6995 2003-08-01 Jim Meyering <jim@meyering.net>
6997 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
6998 Otherwise, with at least the /bin/sh from HPUX 10.20,
6999 the trap code would end up converting that to exit 1 and thus an
7000 unexpected test failure. Reported by Christian Krackowizer.
7002 2003-07-31 Paul Eggert <eggert@twinsun.com>
7004 * src/ptx.c: Do not include bumpalloc.h.
7005 (WORD_TABLE): New member alloc.
7006 (ALLOC_NEW_WORD): Remove.
7007 (occurs_alloc): New var.
7008 (digest_word_file, find_occurs_in_text): Check for arithmetic
7009 overflow when computing table size. Use xrealloc rather than
7010 bumpalloc primitives.
7012 2003-07-29 Jim Meyering <jim@meyering.net>
7016 * README: When running tests as root, suggest using
7017 sudo with NON_ROOT_USERNAME=$USER.
7019 * tests/Makefile.am (all_programs): Makefile is in ../src, not
7022 2003-07-28 Jim Meyering <jim@meyering.net>
7024 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
7026 2003-07-28 Paul Eggert <eggert@twinsun.com>
7028 * lib/stdbool.hin (_Bool): Make it signed char, instead of
7029 an enum type, so that it's guaranteed to promote to int.
7030 * src/sort.c (sortlines_temp): Undo previous change.
7032 2003-07-28 Jim Meyering <jim@meyering.net>
7034 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
7035 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
7036 would cause lines[-1 - swap] (with swap = false) to evaluate to
7039 2003-07-27 Jim Meyering <jim@meyering.net>
7041 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
7042 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
7044 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
7045 directories, as required by POSIX. Reported by Karl Berry.
7046 * tests/rm/dir-no-w: New file. Test for the above fix.
7047 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
7049 * tests/mk-script: Emit `$xx', not its expansion.
7051 2003-07-27 Paul Eggert <eggert@twinsun.com>
7053 This change was inspired by a similar proposal by Stepan Kasal.
7054 * src/sort.c (mergelines, sortlines_temp): New functions.
7055 (sortlines): Use them, to reduce the number of times that
7056 we need to copy 'struct line' values. This improved CPU
7057 performance by about 30% on one 18 MB test.
7058 (sort): Don't invoke sortlines unless we have 2 or more lines.
7060 2003-07-26 Stepan Kasal <kasal@ucw.cz>
7062 * src/sort.c (sort): Don't require two `struct line's per text line,
7063 the new sort algorithm requires just 1.5.
7065 2003-07-27 Jim Meyering <jim@meyering.net>
7067 * src/pathchk.c (validate_path): Use %lu, not %ld.
7069 * src/cut.c (is_printable_field): Simplify bit arithmetic.
7071 * src/ls.c (sort_files): Put `volatile' in the right place.
7074 2003-07-26 Jim Meyering <jim@meyering.net>
7076 Use only one bit per field/offset in array, not one `int'.
7077 * src/cut.c (printable_field): Change type to `unsigned char'.
7078 (mark_printable_field, is_printable_field): New functions.
7079 Use them in place of all direct accesses of `printable_field'.
7081 * src/expand.c (parse_tabstops): Detect overflow properly.
7082 * src/cut.c (set_fields): Likewise.
7084 * src/rm.c: Include "dirname.h".
7085 (usage): Use base_name (program_name) in body of --help output.
7087 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
7088 Idea from Brendan O'Dea, who suggested using
7089 `program_name = basename (argv[0]);' everywhere --
7090 can't do that, but using base_name works just fine here.
7092 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
7094 2003-07-24 Paul Eggert <eggert@twinsun.com>
7096 Fix some POSIX-compliance problems with 'test'. This makes
7097 'test' more compatible with Bash.
7099 * NEWS, doc/coreutils.texi: Document the following.
7100 * src/test.c: Include exitfail.h.
7101 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
7102 (test-syntax_error): Use it.
7103 (binary_operator): Now takes bool arg specifying whether left operand
7104 is -l ARG, so that caller determines this rather than us.
7106 (term): Use posixtest to evaluate parenthesized subexpressions.
7107 (unary_operator, one_argument): Remove support for -t without operand.
7108 (one_argument): Take argument from argv[pos].
7109 (one_argument, two_arguments, three_arguments): Advance pos.
7110 All callers changed.
7111 (three_arguments): Look for binary ops before "!". Then look
7112 for parenthesized one_argument expressions, instead of trusting
7113 expr () to do the right thing.
7114 (posixtest): Now takes number of args. All callers changed.
7115 Treat "( A B )" like "A B".
7116 (main): Set exit_failure to TEST_FAILURE. Don't depend on
7117 POSIXLY_CORRECT, as we now conform to POSIX by default.
7118 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
7119 * tests/test/Test.pm (test_vector): Add several tests to check
7120 the above. Syntax errors now exit with status 2, not 1.
7121 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
7123 2003-07-26 Jim Meyering <jim@meyering.net>
7125 * tests/help-version: Adjust for above change in test behavior:
7126 `[' exits with 2, not 1, and test doesn't accept --help or --version.
7128 * Makefile.maint (ME): Don't use trick suggested in Make manual.
7129 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
7131 * Makefile.maint (sc_system_h_headers): Another syntax check.
7132 (syntax-check-rules): Add it to the list.
7134 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
7135 so it matches `%ld' format even on 32-bit systems.
7137 * src/fmt.c (flush_paragraph): Cast field width to `int' to
7138 avoid warning on 64-bit systems.
7140 * src/ls.c (sort_files): Make `func' volatile, so it can't be
7141 clobbered by a `longjmp' into this function.
7143 2003-07-25 Jim Meyering <jim@meyering.net>
7145 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
7148 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
7149 because it'd evoke spurious failure on 64-bit systems.
7151 2003-07-24 Jim Meyering <jim@meyering.net>
7153 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
7154 output its current record counts. Reported by Jurriaan.
7156 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
7157 `wc' with no options. This goes along with the change of 2003-07-20.
7159 2003-07-23 Jim Meyering <jim@meyering.net>
7161 Don't include headers already included by system.h:
7162 * src/tr.c: Don't include errno.h.
7163 * src/true.c: Don't include version-etc.h.
7164 * src/test.c: Don't include limits.h or error.h.
7165 * src/stat.c: Don't include unistd.h or time.h.
7166 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
7167 * src/pr.c: Don't include time.h.
7168 * src/pathchk.c: Don't include errno.h.
7169 * src/nice.c: Don't include sys/time.h.
7170 * src/ls.c: Don't include stdlib.h.
7172 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
7173 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
7174 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
7175 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
7176 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
7177 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
7178 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
7179 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
7180 Don't include closeout.h.
7182 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
7183 can access the required version of rm.
7184 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
7186 * tests/cut/Test.pm (out-delim3a): New test.
7188 * man/help2man: Update to version 1.33.
7190 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
7192 * src/dircolors.c: Include xstrndup.h.
7193 (xstrndup): Remove function, now that it's been factored out into
7196 2003-07-22 Paul Eggert <eggert@twinsun.com>
7198 * src/wc.c (wc): Fix typo in computation of file from file_x,
7199 which caused the former to be used uninitialized if file_x was
7202 2003-07-22 Jim Meyering <jim@meyering.net>
7204 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
7206 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
7207 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
7208 Thomas Luzat. See http://bugs.debian.org/202413 for details.
7210 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
7212 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
7214 * src/cut.c (set_fields): Mark all selected indices before trying to
7215 determine range endpoints.
7216 * tests/cut/Test.pm: New test for the above fix.
7218 Begin to address this comment: What if someone wants to
7219 extract the 1,000,000-th field of some huge input file?
7220 The first step is to rearrange things so that the values
7221 in the printable_field array are all 0/1 rather than 0/1/2.
7222 * src/cut.c (RANGE_START_SENTINEL): Remove.
7223 Store range-start indices in a hash table, rather than
7224 overloading the `printable_field' array.
7225 (range_start_ht): New global.
7226 (hash_int, hash_compare_ints, is_range_start_index): New functions.
7227 (print_kth): Use is_range_start_index; don't test printable_field.
7228 (set_fields): Detect overflow.
7229 (set_fields): Insert each range-start index into range_start_ht.
7230 (main): Call set_fields only once, and only after
7231 output_delimiter_specified and (if required) range_start_ht have
7234 2003-07-20 Paul Eggert <eggert@twinsun.com>
7236 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
7237 invoked with a null pointer when there were no file arguments.
7239 2003-07-20 Jim Meyering <jim@meyering.net>
7241 * Makefile.maint (sc_changelog): Add another nit-picky check.
7243 * src/wc.c (write_counts): Add a comment.
7244 (wc): Rename `file' parameter.
7245 Set new local, `file', to be the file name, or (when it's NULL)
7246 _("standard output") so that all uses of `file' use the proper value.
7247 Use STREQ, not strcmp.
7249 2003-07-20 Paul Eggert <eggert@twinsun.com>
7251 wc count field widths now are heuristically adjusted depending
7252 on the input size, if known. If only one count is printed, it
7253 is guaranteed to be printed without leading spaces.
7255 Previously, wc did not align the count fields if
7256 POSIXLY_CORRECT was set, but POSIX did not actually require
7257 this undesirable behavior, so it has been removed.
7259 * NEWS: Document this.
7260 * doc/coreutils.texi (wc invocation): Likewise.
7262 * src/wc.c (number_width): New var.
7263 (posixly_correct): Remove.
7264 (struct fstatus): New struct.
7265 (write_counts): Output fields of width number_width.
7266 Do not worry about POSIXLY_CORRECT.
7267 Use null file, not empty-string file, to denote stdin,
7268 since "" is a valid file name on some hosts.
7269 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
7271 (wc): Avoid problems if end_pos - current_pos overflows.
7272 Do not print odd message if stdin has a read error.
7273 (get_input_fstatus, compute_number_width): New functions.
7274 (main): Use them to implement the new behavior.
7275 Ignore POSIXLY_CORRECT.
7277 * tests/wc/Test.pm: Adjust to the new output widths.
7279 2003-07-19 Jim Meyering <jim@meyering.net>
7281 * tests/rm/fail-eperm: Don't create temporary directory --
7284 * tests/shred/remove: Don't open-code test for UID != 0.
7285 Use priv-check's require-non-root instead.
7286 Update to use newer framework.
7288 * tests/help-version (expected_failure_status_expr): Record that
7289 expr exits with status of 3 for e.g., a write error.
7291 * tests/priv-check: Use `id -u' to see if we're running as root,
7292 rather than trying go write to an write-protected file.
7293 When running as root, ensure $NON_ROOT_USERNAME is valid.
7294 When running as root with `require-non-root', ensure that `.'
7295 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
7296 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
7298 * src/printenv.c: Include "exitfail.h".
7299 (main): Set exit_failure rather than calling close_stdout_set_status.
7300 * src/date.c: Likewise.
7301 * src/sort.c: Likewise.
7302 * src/tty.c: Likewise.
7304 2003-07-18 Jim Meyering <jim@meyering.net>
7306 * tests/touch/not-owner: Update to use newer framework.
7308 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
7309 directory, and remove Perl-coded `you may not run as root' test.
7310 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
7311 hard-coding something not quite equivalent.
7312 Paul Jarc reported the inconsistent diagnostics.
7314 * src/sort.c (main): Use close_stdout via atexit.
7315 Now `sort --version' and `sort --help' fail, as they should
7316 when their output is redirected to /dev/full.
7318 * src/su.c (usage): Don't call close_stdout here.
7319 (main): Use close_stdout via atexit.
7320 Now `su --version > /dev/full' fails, as it should.
7321 Somehow, the change of 2000-05-07 that purports to fix this
7324 * tests/help-version (--help/--version vs. /dev/full): Special-case
7325 `[' to protect it from expected_failure_status-`eval'.
7327 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
7328 count and the corresponding line, as required by POSIX.
7329 Reported by Clement Wang.
7330 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
7332 * tests/expr/basic: Add tests for when exit status is 2.
7334 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
7335 Use an anonymous `enum', rather than #define.
7337 2003-07-17 Paul Eggert <eggert@twinsun.com>
7339 * src/expr.c: Include "exitfail.h", "quotearg.h".
7340 (EXPR_INVALID, EXPR_ERROR): New constants.
7341 (nomoreargs, null, toarith, nextarg): Return bool, not int.
7342 (syntax_error): New function, exiting with status 2. Use it
7343 insteading of printing "syntax error" ourselves.
7344 (main): Initialize exit_failure to EXPR_ERROR.
7345 Exit with EXPR_INVALID on syntax error (too few arguments).
7346 (nextarg): Use strcmp, not strcoll; strcoll might return
7347 an undesirable 0, or might fail.
7348 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
7349 or other such error.
7350 (eval2): Report an error if strcoll fails in a string comparison.
7351 * src/sort.c: Include "exitfail.h".
7352 (main): Set exit_failure, not xalloc_exit_failure and
7353 xmemcoll_exit_failure.
7354 * tests/expr/basic: Invalid value exits with status 3, not 2.
7356 2003-07-16 Jim Meyering <jim@meyering.net>
7358 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
7359 per GNU maintainer guidelines. The next non-beta release will be 5.1.
7361 This script would have caught at least two recent bugs:
7362 those in [ and kill.
7363 * tests/help-version: Revive this script.
7364 It wasn't doing anything useful, since $all_programs wasn't being
7365 defined by the invoking Makefile.am.
7366 Reflect that nohup is no longer a script, so don't exclude it.
7367 Add framework to handle the programs added since it was last run:
7368 kill, stat, unlink, [, link, readlink.
7369 Fix path-related problems deriving from the move of this script
7370 from src/ to its present location.
7371 * tests/Makefile.am (all_programs): Define.
7372 (TESTS_ENVIRONMENT): Use it.
7374 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
7375 whereby kill would always attempt to operate on argv[0] and fail.
7377 * src/test.c (integer_expected_error): Improve diagnostic -- now,
7378 it also matches the one from bash's builtin test.
7379 (binary_operator): Add \n at end of diagnostic.
7381 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
7382 * tests/priv-check: Move setuidgid-related and
7383 NON_ROOT_USERNAME-checking code to this file.
7385 * README: Update section on testing as `root'.
7386 Suggestion from Paul Jarc.
7388 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
7389 names of authors that I just found in bash's builtins/test.def.
7391 Running `[' with no arguments would evoke a segfault.
7392 * src/test.c (main) [LBRACKET]: Move initialization of argv to
7393 precede potential use via test_syntax_error.
7395 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
7396 warning from automake -Wall.
7398 2003-07-15 Jim Meyering <jim@meyering.net>
7402 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
7405 * announce-gen (print_changelog_deltas): Relax tests for matching
7406 version-number line in NEWS.
7407 Change the .sig suffix to .asc here, too.
7409 2003-07-14 Jim Meyering <jim@meyering.net>
7411 * Makefile.maint (%.asc): Renamed from %.sig.
7412 Generate and use ascii-armored signatures.
7413 Use gpg's -o option.
7415 2003-07-13 Jim Meyering <jim@meyering.net>
7417 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
7420 * Makefile.maint (syntax-check): Move each individual check into
7422 (syntax-check-rules): This is the list of syntax-check targets.
7423 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
7424 (sc_cast_of_x_alloc_return_value, sc_space_tab):
7425 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
7427 2003-07-12 Jim Meyering <jim@meyering.net>
7429 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
7430 traces of the nohup script.
7432 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
7433 $(OPTIONAL_BIN_ZCRIPTS).
7435 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
7436 target, not before the `>'.
7438 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
7439 now that that function no longer calls `error'.
7441 * src/df.c (find_mount_point): Emit a diagnostic for each
7442 failed syscall, rather than relying on caller to do that.
7443 The caller couldn't do a good job, anyhow -- too many different
7444 ways to fail (each with a different referent).
7445 Give a diagnostic upon failed save_cwd, now that that function
7446 no longer calls `error'.
7447 (show_point): Don't diagnose find_mount_point's errors, now that
7448 it handles them itself.
7450 * src/df.c (find_mount_point): Don't let free clobber errno upon
7453 * src/sys2.h: Remove alloca-related block.
7454 * src/system.h: Include <alloca.h> here, instead.
7456 It appears that the `#pragma alloca' included via "system.h" is
7457 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
7458 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
7459 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
7461 * src/chown-core.c (change_file_owner): Do not restore any special
7462 permission bits (e.g., set-user-ID, set-group-ID) that are reset
7463 by chown(2) on some systems. Suggestion and insistence :-) from
7466 * tests/input-tty: Also check `test -t 1'.
7467 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
7468 test would block when run in the background.
7470 2003-07-11 Jim Meyering <jim@meyering.net>
7472 * tests/sample-test: Also fail if cat-to-create-expected-output
7473 fails. Otherwise, if both `exp' and `out' were to end up empty
7474 because of e.g., a full disk, they would mistakenly compare equal.
7476 * src/nohup.c: New file. Rewrite of nohup.sh in C.
7477 This solves a portability problem: on at least Solaris systems,
7478 when nohup.sh used the vendor /bin/sh, it would exit with status
7479 of `1' rather than the required 126 or 127 upon failure to exec
7480 the specified program.
7482 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
7483 (bin_PROGRAMS): Add nohup.
7484 (EXTRA_DIST): Remove nohup.sh.
7485 (all_programs): Remove use of $(EXTRA_SCRIPTS).
7486 * src/nohup.sh: Remove file.
7487 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
7489 * tests/misc/nohup: Tests for the above.
7490 * tests/misc/Makefile.am (TESTS): Add nohup.
7492 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
7493 the macro, COPY_FD_DIAGNOSE.
7494 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
7495 (head_file): Likewise.
7497 * src/date.c: Include "quote.h".
7498 (batch_convert): Use the quote function rather than using literal `...'
7501 * src/setuidgid.c (main): Enclose diagnostic in _(...).
7502 * src/fmt.c (main): Likewise.
7503 * src/mknod.c (main): Likewise.
7504 * src/tac.c (tac_seekable): Likewise.
7505 * src/yes.c (main): Likewise.
7506 * src/od.c (main): Likewise.
7507 * src/install.c (change_attributes): Likewise.
7509 2003-07-10 Jim Meyering <jim@meyering.net>
7511 * src/head.c (usage): Use 1024*1024 in place of 1048576.
7512 * src/tail.c (usage): Likewise.
7514 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
7515 place of the kludge in this test. Suggestion from Paul Jarc.
7517 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
7518 * src/setuidgid.c: New program, solely for testing (not installed).
7520 * src/chown-core.c (change_file_owner): Don't leak file descriptors
7521 when dereferencing symlinks.
7523 2003-07-09 Jim Meyering <jim@meyering.net>
7525 * tests/du/slash: New file/test for today's lib/ftw.c fix.
7526 * tests/du/Makefile.am (TESTS): Add slash
7528 * src/tail.c (xlseek): Avoid warning about ``return without value
7529 from function returning non-void''.
7531 2003-07-08 Jim Meyering <jim@meyering.net>
7533 * man/help2man: Update to version 1.29.
7535 * man/help2man: Add END handler to close STDOUT and check for errors.
7537 2003-06-30 Paul Eggert <eggert@twinsun.com>
7539 Add support for a "[" that conforms to the GNU coding standards,
7540 i.e., that does not depend on its name.
7541 * src/lbracket.c: New file.
7543 * man/Makefile.am (programs): Ignore "[", since it doesn't have
7544 a separate man page.
7545 * src/Makefile.am (bin_PROGRAMS): Add "[".
7546 (__SOURCES): New var.
7547 * src/test.c (LBRACKET): Define to 0 if not defined.
7548 (main): Use LBRACKET rather than argv[0].
7550 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
7551 Reported by Paul Jarc and Dan Jacobson.
7553 * src/test.c (main): Do not recognize --help or --version if
7554 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
7555 Do not bother testing that margv[margc] is non-null.
7557 2003-07-04 Jim Meyering <jim@meyering.net>
7559 * src/who.c (print_line): Rewrite to use asprintf, in order to be
7560 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
7562 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
7563 option, and perform the +1600 invocations of head IFF the envvar
7564 RUN_EXPENSIVE_TESTS is set.
7566 2003-07-03 Jim Meyering <jim@meyering.net>
7568 * src/cp.c (do_copy): Give a better diagnostic when failing due
7569 to nonexistent destination directory. Reported by Dmitry Rutsky.
7570 See http://bugs.debian.org/199730 for details.
7572 2003-06-27 Jim Meyering <jim@meyering.net>
7574 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
7575 * src/split.c (longopts): Use `1', not `0' as the value for
7576 for &verbose. Reported by Keith Thompson.
7578 Test for the above fix.
7579 * tests/misc/split-a: Also use --verbose and compare stderr
7580 output with what we'd expect.
7582 2003-06-20 Jim Meyering <jim@meyering.net>
7584 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7585 Use `error_t' (rather than int) as type for local `err'.
7586 From Alfred M. Szmidt.
7588 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
7590 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
7591 Fix author preservation code.
7593 2003-06-19 Jim Meyering <jim@meyering.net>
7595 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
7596 (do_link): Don't warn about hard link to symlink.
7598 2003-06-18 Jim Meyering <jim@meyering.net>
7600 * src/cut.c: Include "getdelim2.h", not "getstr.h".
7601 Reflect renaming: getstr -> getdelim2.
7603 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
7604 readline -> readlinebuffer.
7606 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
7608 * src/readlink.c: Include <sys/types.h> before system.h (because
7609 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
7611 2003-06-17 Jim Meyering <jim@meyering.net>
7613 * src/system.h (initialize_main): Define.
7614 Use it in every `main'. Applied via this:
7615 p='initialize_main (&argc, &argv);'
7616 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
7617 $(grep -l program_name.=.argv.0 *.c)
7618 test.c uses margc/margv, so I made the change manually for that file.
7619 Based on a patch from Bernard Giroud.
7621 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
7623 Fix for build failure on Ultrix 4.3.
7624 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
7625 Include sys/param.h and sys/mount.h on ultrix.
7627 2003-06-16 Jim Meyering <jim@meyering.net>
7629 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
7631 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
7632 them here instead, but with one change: define EISDIR to -1, not 0.
7634 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
7635 guaranteed to be defined.
7636 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
7638 * README: Mention the CVS repository.
7639 Encourage addition of test cases.
7641 2003-06-12 Jim Meyering <jim@meyering.net>
7643 * src/touch.c (touch): Call close only if necessary.
7646 * src/wc.c (usage): Correct wording: wc prints counts in the order
7647 `newline, word, byte'. Reported by Keith M. Briggs.
7648 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
7650 2003-06-10 Jim Meyering <jim@meyering.net>
7652 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
7654 2003-06-07 Jim Meyering <jim@meyering.net>
7656 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
7659 2003-06-06 Jim Meyering <jim@meyering.net>
7661 * src/extract-magic (main): Avoid newer 3-arg form of open,
7662 so this script works also with e.g., perl5.005_03.
7663 Patch by John David Anglin.
7665 2003-06-04 Paul Eggert <eggert@twinsun.com>
7667 * src/system.h: Include <stdbool.h> unconditionally.
7669 2003-06-04 Jim Meyering <jim@meyering.net>
7671 * man/Makefile.am (check-programs-vs-x): Rename target
7672 from check-programs-vs-1. Adjust rule to check for the
7673 primary (.x) file, not the generated one (.1).
7675 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
7677 * man/kill.x: New file.
7678 * man/Makefile.am (dist_man_MANS): Add kill.1.
7681 2003-06-04 Jim Meyering <jim@meyering.net>
7683 Ensure that the .x file for a new program is never forgotten again.
7684 * man/Makefile.am (programs): Define.
7685 (check-programs-vs-1): New phony target.
7686 (check-local): Depend on it.
7688 2003-06-03 Jim Meyering <jim@meyering.net>
7690 Avoid unnecessary copying of environment.
7691 * src/env.c (main): Rather than clearing the environment and --
7692 unless told to ignore environment -- copying all settings from
7693 the saved, original environment, clear the environment only when
7694 that is requested. Suggested by Jens Elkner.
7696 2003-06-02 Jim Meyering <jim@meyering.net>
7698 * src/system.h: Always include <string.h>, since we assume C89.
7699 Include <limits.h> without checking for HAVE_LIMITS_H.
7701 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
7702 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
7704 2003-06-01 Jim Meyering <jim@meyering.net>
7706 Avoid a race condition in `tail -f' described by Ken Raeburn in
7707 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
7708 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
7709 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
7710 (tail_bytes, tail_lines, tail): Likewise.
7711 (tail_file): Use the new `read_pos' value as the size,
7712 rather than stats.st_size from the fstat call.
7714 2003-05-28 Jim Meyering <jim@meyering.net>
7716 * src/extract-magic: Allow expansion of `$file' in the here-
7717 document corresponding to the comment at the top of fs.h.
7719 2003-05-26 Jim Meyering <jim@meyering.net>
7721 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
7722 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
7723 Use #if/#elif/... cascade so we get only one set of include files.
7724 Reported by Nelson Beebe.
7726 2003-05-24 Jim Meyering <jim@meyering.net>
7728 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
7729 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
7730 accept the BSD format.
7732 2003-03-28 Joe Orton <jorton@redhat.com>
7734 * src/md5sum.c (bsd_split_3): New function.
7735 (split_3): Detect checksums from BSD 'md5' command and handle them
7738 * tests/md5sum/basic-1: New tests for --check exit status, and for
7739 BSD-style checksum files.
7741 2003-05-21 Jim Meyering <jim@meyering.net>
7743 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
7744 This sort of thing is why it'd be *Really Good* to factor
7745 out the common code used here and in tail.c.
7747 2003-05-14 Jim Meyering <jim@meyering.net>
7749 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
7751 * tests/du/slink: Skip this test if `.' is on an XFS file system.
7753 * tests/du/fd-leak: New file. Test for the bug in du that
7754 was fixed by the 2003-05-12 change to lib/ftw.c.
7755 * tests/du/Makefile.am (TESTS): Add fd-leak.
7757 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
7758 includes a translatable word, `and'.
7760 * src/dd.c (usage): Don't use `,' as the thousands separator
7761 in e.g. 1,000,000 and 1,048,576. Instead, do this:
7762 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
7763 * src/df.c (usage): Likewise.
7764 * src/du.c (usage): Likewise.
7765 * src/ls.c (usage): Likewise.
7767 * Makefile.maint (syntax-check): Add another check.
7769 2003-05-13 Paul Eggert <eggert@twinsun.com>
7771 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
7772 must output nothing. Problem reported by Josh Hyman.
7774 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
7775 (output_unique, output_first_repeated, output_later_repeated):
7776 New vars. All uses of "mode" changed to use these variables,
7777 which are not mutually exclusive as "mode" was.
7778 (writeline): New arg "match", used to control whether to
7779 obey output_first_repeated or output_later_repeated.
7780 All callers changed.
7781 (check_file, main): Adjust to above changes.
7783 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
7785 2003-05-14 Jim Meyering <jim@meyering.net>
7787 * tests/rm/rm3: Use tr's \n notation rather than \012.
7788 This package can afford to do that, since its tests are guaranteed use
7789 GNU tr, which has accepted the more modern notation for 10 years.
7790 * tests/rm/rm5: Likewise.
7791 * tests/cp/same-file: Likewise.
7792 * tests/stty/row-col-1: Likewise.
7793 * tests/stty/basic-1: Likewise.
7794 * tests/rm/deep-1: Likewise.
7795 * tests/mv/part-symlink: Likewise.
7796 * tests/mkdir/perm: Likewise.
7797 * tests/misc/nice: Likewise.
7799 2003-05-13 Jim Meyering <jim@meyering.net>
7801 * src/copy.c (struct F_triple) [name]: Remove const attribute.
7802 (triple_free): Don't apply cast to argument of free.
7803 (seen_file): Add cast here instead.
7805 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
7806 (src_to_dest_free): Don't apply cast to argument of free.
7808 * src/sort.c (zaptemp): Don't apply cast to argument of free.
7809 * src/pr.c (init_fps, init_store_cols): Likewise.
7810 * src/join.c (delseq, freeline): Likewise.
7811 * src/expr.c (OLD): Likewise.
7812 * src/sort.c (sort): Likewise.
7813 * src/head.c (elide_tail_lines_pipe): Likewise.
7815 * src/tail.c: Include "quote.h".
7816 Use quote in diagnostics. Change many error format strings
7817 from just `%s' to e.g., `error reading %s'.
7818 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
7819 Rewrite newline-counting loop to use memchr.
7821 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
7822 Now that assert is no longer used, don't include <assert.h>.
7824 2003-05-12 Jim Meyering <jim@meyering.net>
7826 * src/head.c: Include <assert.h>.
7827 (AUTHORS): Add my name.
7828 (elide_tail_lines_pipe): New function.
7830 2003-05-10 Jim Meyering <jim@meyering.net>
7832 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
7834 * src/readlink.c (main): Set program_name before first use.
7835 Remove that (redundant) first use.
7836 Don't exit successfully just because --verbose was specified.
7837 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
7838 parameter is 0, error does not exit.
7840 * src/uname.c (main): When failing due to too many arguments, also say
7841 that, rather than just "Try `uname --help' for more information.".
7842 * src/comm.c (main): Likewise, but for too few arguments.
7843 * src/logname.c: Include error.h.
7844 (main): Say why we're failing.
7846 * src/uniq.c (main): Don't segfault when argc < optind.
7847 * src/who.c (main): Handle argc < optind.
7848 * src/df.c (main): Likewise.
7849 * src/install.c (main): Likewise.
7850 * src/mv.c (main): Likewise.
7851 * src/pwd.c (main): Likewise.
7852 * src/tty.c (main): Likewise.
7853 * src/chroot.c (main): Likewise.
7854 * src/hostname.c: Likewise.
7855 * src/du.c (main): Likewise.
7856 * src/expand.c (main): Likewise.
7857 * src/env.c (main): Likewise.
7858 * src/unexpand.c (main): Likewise.
7859 * src/printenv.c (main): Likewise.
7860 * src/sync.c (main): Handle argc == 0.
7861 * src/expr.c (main): Likewise.
7862 * src/printf.c (main): Likewise.
7863 * src/basename.c (main): Likewise.
7864 * src/ln.c (main): Test for `missing argument' before computing n_files.
7865 * src/tail.c (main): Test for the case of no arguments before
7868 * src/kill.c (send_signals): Don't check command line arguments here.
7869 (main): Check them here instead. Handle argc < optind.
7871 * src/logname.c (main): Use error, rather than fprintf, for the sake
7874 * src/rm.c (main): Don't overrun array bound if argc is 0.
7876 2003-05-09 Jim Meyering <jim@meyering.net>
7878 * src/sort.c (main): Don't overrun array bound if argc is 0.
7879 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
7880 Reported by Wartan Hachaturow.
7882 2003-05-07 Jim Meyering <jim@meyering.net>
7884 Implement support so that `head --lines=-N' works on seekable files.
7885 * src/head.c (enum Copy_fd_status): Define.
7886 (COPY_FD_DIAGNOSE): New macro.
7887 (elide_tail_lines_seekable): New funtion.
7888 (elide_tail_lines_file): Call it here.
7890 2003-05-06 Jim Meyering <jim@meyering.net>
7892 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
7894 2003-05-04 Jim Meyering <jim@meyering.net>
7896 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
7897 caused the addition of thousands of small files to the tar archive.
7898 * tests/misc/head-elide-tail: New file. Add them here instead.
7899 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
7901 2003-05-04 Paul Eggert <eggert@twinsun.com>
7903 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
7904 (IF_READDIR_NEEDS_REWINDDIR): Remove.
7905 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
7906 which was a bit weird because it couldn't be emulated by a function.
7908 2003-05-03 Jim Meyering <jim@meyering.net>
7910 Extend head to accept --lines=-N (--bytes=-N) and to print all
7911 but the N lines (bytes) at the end of the file.
7912 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
7913 Use quote() in diagnostics, rather than literal `' marks.
7914 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
7916 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
7917 (head_file): Reorganize so as to call head from only one place.
7918 (main): Likewise, for head_file.
7919 Handle new, undocumented option, --presume-input-pipe.
7920 Handle negative line and byte counts.
7921 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
7923 * tests/du/8gb: Skip test if the file system of `.' doesn't support
7924 sparse files -- otherwise it'd create a file of size 8GB.
7926 2003-05-02 Jim Meyering <jim@meyering.net>
7928 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
7929 Instead explain about `-' and standard input.
7930 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
7931 Reported by Keith Thompson.
7932 * tests/fmt/basic: Add test for the above fix.
7934 * src/fmt.c: Include "quote.h".
7935 Use quote() in diagnostics, rather than literal `' marks.
7936 (main): Exit nonzero when unable to open an input file.
7937 * tests/fmt/basic: Add test for the above fix.
7939 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
7940 specifications like `-72x'.
7941 * tests/fmt/basic: Add test for the above fix.
7943 Work around nasty readdir bug on Darwin6.5.
7944 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
7945 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
7946 returned NULL and there has been at least one successful unlink or
7947 rmdir call since the opendir or previous rewinddir, then call
7948 rewinddir and reiterate the loop.
7950 Factor out common code.
7951 * src/remove.c (readdir_ignoring_dotdirs): New function.
7952 (is_empty_dir): Use it here.
7953 (remove_cwd_entries): Use it here.
7955 2003-05-01 Jim Meyering <jim@meyering.net>
7957 * tests/rm/r-3: Create 500 rather than just 300 files.
7958 There's a bug in Darwin6.5's readdir that shows up only with
7960 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
7964 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
7965 (dump_remainder): Move two declarations `down' into the scope
7966 where they are used.
7967 (xlseek): Return the resulting offset.
7968 (file_lines): Rename parameter, file_length, to end_pos.
7969 (pipe_lines): Don't coerce safe_read return value to `int'.
7970 Adapt tests accordingly.
7971 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
7973 Change type of `total_bytes' from `int' to `size_t',
7974 since the former wouldn't always be wide enough.
7975 Don't coerce safe_read return value to `int',
7976 and adapt tests accordingly.
7977 Now that testing for a read error no longer involves
7978 using `tmp', handle that case *after* freeing `tmp'.
7979 (start_bytes): Clean up.
7980 (tail_bytes): Now that `n_bytes' may be larger than
7981 OFF_T_MAX, test for that condition and, if it's true, don't
7982 use lseek optimizations.
7983 (parse_options): Don't fail just because N_UNITS is larger than
7984 the maximum size of a file -- tail may be applied to an input
7985 stream (e.g., a pipe) with more data than that.
7987 * Makefile.maint (syntax-check): Rename from alloc-check.
7988 Also check for SPACE-TAB sequences.
7989 Also check for malloc/calloc/realloc casts.
7991 2003-05-01 Jim Meyering <jim@meyering.net>
7993 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
7995 2003-04-28 Jim Meyering <jim@meyering.net>
7997 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
7998 make the now-more-picky tsort fail.
8000 2003-04-24 Jim Meyering <jim@meyering.net>
8002 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
8003 (main): Minor syntactic clean-up.
8005 * src/tsort.c (tsort): Fail if the input contains an odd number of
8006 tokens. Reported by junkio@cox.net.
8008 * tests/tsort/basic-1: Test for the above fix.
8010 2003-04-21 Jim Meyering <jim@meyering.net>
8012 * tests/misc/printf: Add tests for the printf fixes below.
8014 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
8016 2003-04-20 Paul Eggert <eggert@twinsun.com>
8018 Fix printf POSIX compatibility bug reported by Ben Harris in
8019 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
8020 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
8021 \0NNN in the %b operand.
8022 * src/printf.c (usage): Likewise.
8023 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
8024 is desired. All uses changed. Behave like Bash printf if %b
8025 operand uses \NNN where the initial N is not 0.
8027 2003-04-17 Jim Meyering <jim@meyering.net>
8029 * src/stty.c: Remove uses of PROTOTYPE macro.
8031 2003-04-15 Jim Meyering <jim@meyering.net>
8033 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
8034 each sequence of spaces before a TAB character.
8036 2003-04-13 Jim Meyering <jim@meyering.net>
8038 * src/remove.c (is_empty_dir): Don't closedir (NULL).
8040 2003-04-12 Jim Meyering <jim@meyering.net>
8042 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
8043 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
8044 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
8045 * src/nl.c (main): Fix those problems and remove literal quote marks
8046 (e.g., "`%s'") from format string; instead use "%s" in each format
8047 string and `quote (optarg)' as the corresponding argument.
8048 Also, diagnose all invalid command line options before failing.
8050 * src/nl.c (proc_text): Fix a bug that would make nl output extra
8051 newlines in some cases. Details here: http://bugs.debian.org/177256.
8052 This bug was introduced on 2001-11-10 for textutils-2.0.17.
8053 * tests/misc/nl: Add test for the above-fixed bug.
8055 * tests/misc/readlink: New file. Test the --canonicalize option.
8056 * tests/misc/Makefile.am (TESTS): Add readlink.
8058 2003-04-11 Jim Meyering <jim@meyering.net>
8061 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
8062 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
8063 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
8064 retain alignment) each sequence of spaces before a TAB character.
8066 * src/ls.c: Include <stdlib.h> unconditionally.
8068 * Makefile.maint (xalloc-check): Rename from header-check.
8070 * src/yes.c: Include error.h after system.h, not before.
8073 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
8074 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
8075 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
8076 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
8077 * src/tr.c: * src/unexpand.c, src/users.c:
8078 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
8079 return values and of xrealloc's first argument.
8080 Fix the former with this:
8081 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
8083 2003-04-10 Jim Meyering <jim@meyering.net>
8085 * src/stty.c (wrapf): Declare with format attribute.
8087 The S_MAGIC_... names shouldn't be maintained in two places (prior
8088 to this change, one would have to keep stat.c and fs.h in sync).
8089 This change makes it so those names and the corresponding
8090 hexadecimal constants all reside in stat.c. fs.h is now generated.
8091 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
8092 (BUILT_SOURCES): Add fs.h, now that it's generated.
8093 (EXTRA_DIST): Add extract-magic.
8094 * src/extract-magic: New script to extract fs.h definitions from stat.c.
8095 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
8096 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
8098 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
8099 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
8101 * man/unexpand.x: Add `SEE ALSO' reference to expand.
8102 * man/expand.x: Add `SEE ALSO' reference to unexpand.
8103 Suggestion from Dan Jacobson.
8105 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
8107 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
8108 * src/stat.c (human_fstype): Handle Linux's devpts.
8110 2003-04-09 Paul Eggert <eggert@twinsun.com>
8112 * src/split.c (line_bytes_split): Arg is of type size_t, since
8113 that's all that is supported for now.
8114 (main): Check for overflow in obsolescent line count option.
8116 2003-04-09 Jim Meyering <jim@meyering.net>
8118 * tests/misc/split-fail: Add a new test for the above fix.
8120 * src/split.c (bytes_split): Use size_t temporary (rather than
8121 uintmax_t original) in remaining computations. From Paul Eggert.
8123 Handle command line option arguments larger than 2^31.
8124 This allows e.g., splitting into files of size 2GB and larger,
8125 and running split --lines=N with N=2^31 or more.
8126 But for --line-bytes=N, the restriction that N <= SIZE_MAX
8127 remains (for now), due to the way it is implemented.
8129 * src/split.c: Include "inttostr.h".
8130 (bytes_split, lines_split, line_bytes_split, main):
8131 Use uintmax_t, not size_t, for file sizes.
8132 (main): Give a better diagnostic for option arguments == 0.
8133 Use umaxtostr to print file sizes.
8134 Reported by Luke Hassell.
8136 2003-04-08 Jim Meyering <jim@meyering.net>
8138 * src/rm.c (usage): Mention that --directory (-d) works only
8139 on some systems. Suggestion from Samuel Tardieu.
8141 * tests/basename/basic: Run $PERL to see if it is available,
8142 rather than testing its value.
8143 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
8144 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
8145 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
8146 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
8147 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
8148 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
8149 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
8150 * tests/sum/basic-1, tests/seq/basic: Likewise.
8152 * tests/misc/Makefile.am (TESTS): Add split-fail.
8153 * tests/misc/split-fail: New file.
8155 * src/split.c: Rename local variables: nchars -> n_bytes.
8156 (lines_split): Rename local, nlines -> n_lines.
8157 (main): Rename local variable: s/accum/n_units/.
8158 (main): Use STDIN_FILENO, not literal `0'.
8160 2003-04-07 Jim Meyering <jim@meyering.net>
8162 * src/stat.c: Add #include directives for Ultrix 4.4.
8163 Based on a suggested change from Bert Deknuydt.
8165 2003-04-06 Jim Meyering <jim@meyering.net>
8167 * Makefile.maint (makefile-check): New rule.
8168 (local-check): Add it.
8170 2003-04-05 Jim Meyering <jim@meyering.net>
8172 * Makefile.am (nearly all of them):
8173 Use $(VAR) rather than @VAR@, now that we can rely on automake to
8174 emit a definition for each substituted variable.
8175 * tests/Makefile.am.in: Likewise.
8177 * tests/rm/rm5: Add a comment explaining why this test fails when
8178 using Tru64's broken sed.
8179 * tests/rm/rm3: Likewise.
8181 Make `kill -t' output signal descriptions (not `?') on Tru64.
8182 * src/kill.c (sys_siglist): Also check for __sys_siglist.
8183 Patch by Tony Leneis.
8184 * configure.ac: Also check for declaration of __sys_siglist.
8185 Required for Tru64 4.0D, 4.0F, and 5.1.
8186 Reported by Tony Leneis.
8188 2003-04-04 Jim Meyering <jim@meyering.net>
8190 * src/Makefile.am (PERL): Remove unnecessary definition.
8192 Because of inappropriate (but POSIX-mandated) behavior of rename,
8193 `mv a b' would not remove `a' in some unusual cases. Work around
8194 this by unlinking `a' when necessary.
8196 * src/copy.c (same_file_ok): Add an output parameter.
8197 Set it in the offending case.
8198 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
8199 Reported by Ed Avis.
8200 * tests/mv/hard-4: New test for the above.
8201 * tests/mv/Makefile.am (TESTS): Add hard-4.
8203 Clean up rules for automatically generated sources:
8204 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
8205 Make each generated file be read-only.
8206 Add each file name to BUILT_SOURCES separately.
8207 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
8209 Put LOCALEDIR macro definition in new file: localedir.h.
8210 * src/Makefile.am (DEFS): Remove definition.
8211 (localedir.h): New rule.
8212 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
8213 * src/system.h: Include "localedir.h".
8215 2003-04-02 Jim Meyering <jim@meyering.net>
8219 * tests/misc/Makefile.am (TESTS): Add false.
8221 * Makefile.maint (TMPDIR): Make sure it's defined.
8222 (my-distcheck): Build in $(TMPDIR), not `.'.
8224 * src/Makefile.am (false.c): Change all occurrences of
8225 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
8226 unsuccessfully also with --help. Reported by Paul Jarc,
8227 * tests/misc/false: New test for the above.
8229 2003-03-30 Jim Meyering <jim@meyering.net>
8231 * NEWS: Note the location of older NEWS files.
8233 * src/remove.c (is_empty_dir): Don't let a failing closedir
8234 clobber errno. Spotted by Arnold Robbins.
8236 * src/env.c: Fix typo in comment. From Arnold Robbins.
8238 2003-03-29 Jim Meyering <jim@meyering.net>
8242 * README: Note to expect build problems for stat.c on Ultrix 4.3.
8243 Note that there are some harmless test failures when running
8244 `make check' as root on some systems.
8246 2003-03-28 Jim Meyering <jim@meyering.net>
8248 * tests/stty/row-col-1: Skip this test if stty can't get window size.
8249 This happens when connecting to sparc-solaris5.7 via ssh from within
8250 emacs. Reported by Karl Berry.
8252 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
8253 Otherwise, on systems (DJGPP) that emulate pipes using files,
8254 this test would never complete, waiting for `yes' to terminate.
8255 * tests/du/slink: As above, use seq, not `yes' to generate link target.
8256 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
8257 Reported by Rich Dawe.
8259 2003-03-27 Jim Meyering <jim@meyering.net>
8261 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
8262 from `written by...' comment, at his request.
8264 2003-03-24 Paul Eggert <eggert@twinsun.com>
8266 Fix buffer overrun problem reported by TAKAI Kousuke, along
8267 with some other POSIX incompatibilities.
8269 * src/printf.c (print_esc): Do not treat \x specially if
8270 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
8271 in backslash. Treat incomplete escape sequences as strings
8272 of characters, as POSIX requires.
8273 (print_formatted): Allow multiple flags. Avoid buffer overrun
8274 if the format is incomplete.
8276 2003-03-24 Jim Meyering <jim@meyering.net>
8278 * tests/misc/printf: Add tests for the above fixes and changes.
8280 2003-03-26 Jim Meyering <jim@meyering.net>
8282 * src/copy.h (struct cp_options): Add a comment.
8284 2003-03-23 Jim Meyering <jim@meyering.net>
8286 * README: Describe problem with 64-bit mode on HPUX 11.x,
8287 with patch for /usr/include/inttypes.h.
8288 * TODO: Plan to add an autoconf test to work around the bug.
8290 2003-03-22 Jim Meyering <jim@meyering.net>
8292 * src/stat.c: Don't include <sys/sysmacros.h>.
8293 That is already done via system.h. Otherwise, the multiple
8294 inclusion would evoke redefinition warnings from Cray's /bin/cc,
8295 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
8296 (human_fstype): Factor some directives `up', out of this function.
8297 Cast away `const' to avoid error from Cray's /bin/cc.
8299 2003-03-20 Jim Meyering <jim@meyering.net>
8301 * announce-gen (print_changelog_deltas): Ensure that a newline
8302 precedes each row of `*'s.
8304 2003-03-20 Jim Meyering <jim@meyering.net>
8308 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
8309 format flag characters.
8310 Do not require that a field width be specified.
8311 Do not fail when given a field width of `0'.
8312 Reported by Dan Jacobson.
8313 * tests/seq/basic: Add new tests for the above-fixed bug.
8315 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
8316 (install-root): Likewise.
8317 (install-exec-local): Likewise.
8318 Based on a patch from Richard Dawe.
8320 2003-03-19 Jim Meyering <jim@meyering.net>
8322 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
8323 because the DJGPP 2.03 port of 'ln -s' doesn't work.
8324 Include $(EXEEXT) in program names.
8325 Since $(LN_S) may degenerate to `cp -p', be careful
8326 to invoke it from the destination directory.
8327 Mostly from Richard Dawe.
8328 * configure.ac: Use AC_PROG_LN_S.
8330 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
8331 CDPATH shell variable set could cause this test to fail.
8332 Reported by Karl Berry.
8334 2003-03-18 Jim Meyering <jim@meyering.net>
8336 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
8337 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
8338 AIX 5.1's xlc could not compile the former.
8339 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
8341 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
8343 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
8344 program names, since automake only adds $(EXEEXT) to programs
8347 2003-03-16 Jim Meyering <jim@meyering.net>
8349 * src/remove.c (rm): Put two local variables in static storage,
8350 so they can't be clobbered by the potential longjmp.
8352 2003-03-15 Jim Meyering <jim@meyering.net>
8354 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
8355 so that a version number with a two-digit component can still count
8356 as an alpha release. Reported by Richard A Downing.
8357 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
8359 2003-03-14 Jim Meyering <jim@meyering.net>
8361 * src/ansi2knr.c: Remove no-longer-used file.
8362 * src/ansi2knr.1: Likewise.
8364 * Makefile.maint (prev_version_file): Don't use ?= for this particular
8365 assignment, since it causes trouble with old versions of GNU make
8366 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
8367 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
8368 Patch from Alexandre Duret-Lutz.
8370 * Use patched automake-1.7.3. Regenerate Makefile.in files in
8371 subdirectories so that each includes a definition of ACLOCAL_M4.
8373 * announce-gen (main): Label the compressed source URLs.
8377 * tests/du/slink: Relax the test for the `local'ness of a file system,
8378 so that now it works also for tmpfs.
8380 * tests/du/hard-link: Transform output from first du, so that this
8381 test doesn't fail on file systems like tmpfs that order directory
8382 entries differently.
8384 2003-03-13 Jim Meyering <jim@meyering.net>
8386 * tests/du/8gb: Work around what appears to be an NFS failure that
8387 would make this test fail on some systems.
8389 2003-03-11 Jim Meyering <jim@meyering.net>
8391 * tests/du/basic: Make the test file exactly 4k bytes long.
8393 * src/split.c (longopts): Don't hard-code `2' here.
8394 Instead, just specify `&verbose', and ...
8395 (main): ... remove the `case 2:' block for --verbose.
8397 * tests/du/basic: Make the test file larger than 64 bytes, so that
8398 we don't immediately disqualify file systems (e.g., NetApp) on which
8399 smaller files take up zero disk blocks. Reported by Vin Shelton.
8401 2003-03-10 Jim Meyering <jim@meyering.net>
8403 Don't segfault for a negative field width or precision in format string.
8404 Note that this is just a stopgap fix. The longer term solution may
8405 involve adapting bash's builtins/printf.def.
8407 * src/printf.c: (UNSPECIFIED): Define.
8408 (print_direc): Use the special value, UNSPECIFIED, to indicate
8409 that field_width or precision has not been specified.
8410 (print_formatted): Fail if field_width or precision is the
8411 special value, UNSPECIFIED.
8412 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
8414 * src/sys2.h (INT_MIN): Define, if necessary.
8415 * tests/misc/printf: Add a test for the above-fixed bug.
8417 2003-03-09 Jim Meyering <jim@meyering.net>
8419 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
8420 changing its sign. This avoids a warning from gcc on 64-bit systems.
8421 Reported by Bob Proulx.
8422 (pop_dir): Reverse order of sign change and cast, to be consistent
8425 2003-03-08 Jim Meyering <jim@meyering.net>
8427 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
8428 shell variable, but only in the environment. With /bin/sh->bash, the
8429 shell variable is set to `y', and that would cause a spurious warning.
8430 Reported by Bob Proulx.
8432 * tests/Makefile.am (check-root): Remove touch/fifo.
8433 It doesn't appear to have to be run as root.
8435 * tests/rm/fail-2eperm: Rather than simply using the first non-root
8436 user name, make sure that the selected user name has a usable shell.
8437 Reported by Paul Jarc.
8439 Before, when using shred on a device, one had to specify --exact,
8440 or be careful to choose a size that would not be rounded up and
8441 exceed the maximum value; that could result in a failure of
8443 * src/shred.c (do_wipefd): --exact is now the default for non-regular
8444 files. Suggestion from Ben Elliston.
8447 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
8448 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
8449 Patch by Bob Proulx.
8451 * src/Makefile.am (check-misc): Check for use of `defined' in
8453 Change to $(srcdir) before running grep.
8455 * src/sleep.c: Remove now-unused #include and #define directives.
8457 * src/du.c (process_file): If a file's size is not being counted
8458 e.g., because it's a hard link to a file we've already counted,
8459 then don't print a line for it.
8461 * tests/du/hard-link: New test for the above-fixed bug.
8462 * tests/du/Makefile.am (TESTS): Add hard-link.
8465 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
8466 and make the two-array approach work.
8468 * tests/du/basic: Correct/add tests for the above fix.
8469 Set LC_ALL, etc., now that we use sort.
8470 Check the block/size of a small file, too.
8471 Correct expected results for simple dir1/dir2/file case.
8472 Add another test of du -S.
8474 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
8476 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
8477 middle-end/9986). As one of GCC's optimizations, it transforms a
8478 fputs_unlocked call to a fputc_unlocked call when the string is
8479 one character long. However, hpux doesn't have fputc_unlocked.
8481 * expr.c (usage): Use putchar, not fputs, to output a single character.
8482 * ls.c (dired_dump_obstack): Likewise.
8483 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
8484 * stat.c (print_it): Likewise.
8486 2003-03-07 Jim Meyering <jim@meyering.net>
8488 * src/cp.c: Remove everything associated with mmap-stack.c.
8489 This reverts the two changes of 2003-02-21.
8490 * src/du.c: Remove everything associated with mmap-stack.c.
8491 This reverts the change of 2003-02-19.
8493 2003-03-06 Jim Meyering <jim@meyering.net>
8495 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
8496 CDPATH shell variable set could cause this test to fail.
8497 Reported by Karl Berry.
8499 2003-03-05 Jim Meyering <jim@meyering.net>
8503 * src/printf.c (print_esc): Remove pointless comparison of unsigned
8504 integer with zero, to avoid a warning from Intel's ecc.
8505 Reported by Nelson Beebe.
8507 * src/du.c (process_file): Sizes must all be of type uintmax_t.
8508 Otherwise, for files or totals that are too big, numbers would
8509 be truncated. Patch mostly by Michael Stone.
8510 Reported by Ingo Saitz as Debian bug #183210.
8512 * tests/du/8gb: New test for the above-fixed bug.
8513 * tests/du/Makefile.am (TESTS): Add 8gb.
8515 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
8516 rather than UTILS_OPEN_MAX - 10.
8518 2003-03-04 Jim Meyering <jim@meyering.net>
8520 * README: Refer new feature discussion to bug-coreutils@gnu.org,
8521 rather than bug-gnu-utils, now that the former is better known.
8522 Suggestion from Göran Uddeborg.
8524 * src/stat.c (usage): Capitalize consistently.
8525 Reported by Göran Uddeborg.
8527 * Makefile.maint (rel-files): Include $(signatures), so that
8528 those files are also copied into $(release_archive_dir).
8530 * src/df.c (find_mount_point): Call error here, now that restore_cwd
8532 * src/remove.c (AD_pop_and_chdir): Likewise.
8534 * tests/Makefile.am (check-root): Add fail-2eperm.
8536 2003-03-03 Jim Meyering <jim@meyering.net>
8538 * src/remove.c (remove_cwd_entries): Include the full filename of
8539 the offending file, not just the basename.
8541 * tests/misc/tty-eof: Set $ME properly.
8543 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
8544 Remove now-unused variables.
8545 (tag-prev-version, prev-cvs-tag): Likewise.
8547 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
8548 accurate diagnostic when failing to remove a file owned by some other
8549 user. Reported by Ivo Timmermans via Michael Stone.
8550 This fixes Debian bug# 178471.
8552 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
8553 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
8554 Based on a report from Ivo Timmermans.
8556 2003-03-02 Jim Meyering <jim@meyering.net>
8558 * src/copy.c (copy_internal) [un_backup]: When recovering from a
8559 failure to create a hard link, do not remove the entry associating
8560 the source dev/ino with the destination file name.
8561 * tests/mv/Makefile.am (TESTS): Add hard-3.
8562 * tests/mv/hard-3: New test, for the above-fixed bug.
8563 Inspired by a report from Iida Yosiaki.
8565 2003-03-01 Jim Meyering <jim@meyering.net>
8567 * src/df.c (print_header): Don't embed spaces in a separate `Type'
8568 header string. Instead, put `Filesystem' and `Type' headers in the
8569 same string, so translators can use horizontal space as needed.
8570 Reported by Jean Charles Delepine.
8572 2003-02-28 Jim Meyering <jim@meyering.net>
8574 * src/copy.c (copy_internal): When link fails because of an
8575 existing destination file, unlink that file and try again.
8576 Reported by Iida Yosiaki.
8578 * tests/mv/Makefile.am (TESTS): Add hard-2.
8579 * tests/mv/hard-2: New test for the above-fixed bug.
8580 Based on a test case from Iida Yosiaki.
8582 2003-02-26 Jim Meyering <jim@meyering.net>
8584 * tests/du/basic: Don't test du's -b option here. Directory byte
8585 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
8586 and IBM AIX 4.2. Reported by Nelson Beebe.
8588 2003-02-25 Jim Meyering <jim@meyering.net>
8590 * Makefile.maint (announcement): Now that ChangeLog entries
8591 are output by announce-gen, don't do it here.
8592 * announce-gen (print_changelog_deltas): New function.
8595 2003-02-22 Jim Meyering <jim@meyering.net>
8597 * announce-gen: New option: --release-type=TYPE
8598 * Makefile.maint (beta, major): New targets. Remove `release'.
8599 Put them all together on a line.
8600 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
8601 invocation of `announcement'.
8602 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
8604 * announce-gen: New option: --news=NEWS_FILE.
8605 Extract NEWS entries here, not via rules in Makefile.maint.
8606 * Makefile.maint (announcement): Now that NEWS entries are
8607 extracted by announce-gen, don't do it here.
8608 (news-r1, news-r2): Remove now-unused definitions.
8610 2003-02-21 Jim Meyering <jim@meyering.net>
8614 Merge in changes from autoconf's version of this file.
8615 * Makefile.maint (www-gnu): Define.
8616 (standards.texi-url_prefix): Use $(www-gnu).
8617 (make-stds.texi-url_prefix): Likewise.
8619 * src/cp.c: Include "mmap-stack.h".
8620 (main): Invoke `run' through a macro that (when possible) runs it
8621 with a large, mmap'd stack.
8623 * src/cp.c (run): New function, preparing for the above.
8624 Exit from this function, not from main
8627 * src/du.c: New option: --apparent-size.
8628 (enum) [APPARENT_SIZE_OPTION]: New member.
8629 (long_options): Add it.
8630 (usage): Describe it.
8632 ['b']: Set apparent_size.
8633 David Eisner reported that the behavior of --bytes had changed.
8634 Paul Eggert proposed the use of a new option, --apparent-size.
8636 * src/du.c (apparent_size): New global.
8637 (print_only_size): Reflect the fact that we're printing byte counts,
8638 not ST_NBLOCKSIZE-byte-block counts.
8639 (print_size): Call print_only_size rather than duplicating its code.
8640 (process_file): Accumulate byte counts, rather than block counts.
8642 * src/du.c (process_file): Always reset size_to_propagate_to_parent
8643 for --separate-dirs (-S).
8645 2003-02-20 Jim Meyering <jim@meyering.net>
8647 * Use automake-1.7.3. Regenerate dependent files.
8649 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
8650 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
8651 (usage) [%B]: Describe it.
8654 * src/du.c (process_file): Reorganize the code to use only
8655 one `sum' array, and change how -S works back to the way it was
8656 before 2003-01-31. Patch by Bruno Haible.
8658 * tests/du/basic: New test.
8659 * tests/du/Makefile.am (TESTS): Add basic.
8661 * tests/envvar-check: Add checks for the following:
8662 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
8664 * tests/Makefile.am: Rename phony target envvar-check to evar-check
8665 so as not to conflict with the distributed file by the same name.
8667 * src/du.c (process_file): Set info->skip before any possible return.
8669 Report correct usage for directories, not 0.
8670 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
8671 _before_ recording the dev/ino of a directory.
8672 Reported by Bruno Haible.
8674 Now, df always displays the device file name corresponding to the
8675 listed mount point under `Filesystem'. Before, for an unmounted
8676 block- or character-special file argument, it would display the
8677 command-line argument instead.
8678 * src/df.c (show_disk): Return a value indicating whether
8679 there was a match. Don't try to find a mount point here.
8680 (show_entry): If show_disk doesn't find a match, call show_point.
8682 2003-02-19 Jim Meyering <jim@meyering.net>
8684 * src/du.c: Include "mmap-stack.h".
8685 (du_files): Add prototype with ATTRIBUTE_NORETURN.
8686 Exit from this function, not from...
8688 Instead, if possible, invoke du_files through a macro that
8689 runs it with a large, mmap'd stack.
8691 * src/join.c (usage): Change wording in --help output:
8692 use FILENUM instead of `SIDE' and say what FILENUM means.
8693 Reported by Bernhard Gabler.
8695 * src/df.c (print_header): Rather than using a hard-coded literal
8696 string of spaces matching the length of the English `...Type' header,
8697 output the right number of spaces to match the selected translation.
8698 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
8700 * src/split.c (bytes_split): Remove unnecessary `else' after break.
8701 (lines_split): Likewise. and correct misleading indentation.
8703 * src/split.c: Include "full-read.h".
8704 (bytes_split, lines_split, line_bytes_split): Use full_read,
8705 not safe_read. The way split was using the latter, a short read
8706 could cause split to terminate before EOF.
8708 * tests/misc/tty-eof: Test all programs that can read stdin,
8709 requiring no arguments and that write to standard output.
8711 * tests/misc/tty-eof: New file. Renamed from ...
8712 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
8713 * tests/misc/Makefile.am (TESTS): Reflect renaming.
8715 2003-02-18 Jim Meyering <jim@meyering.net>
8717 cksum would perform an extra read after encountering EOF
8718 * src/cksum.c (cksum): Exit the loop upon EOF, too.
8719 Patch by Michael Bacarella.
8721 Test for the bug fixed today in cksum, md5sum, and sha1sum.
8722 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
8723 cat, cksum, md5sum, and sha1sum all in the same loop.
8725 2003-02-14 Jim Meyering <jim@meyering.net>
8727 * src/remove.c: Include "euidaccess.h".
8728 Remove declaration of euidaccess.
8730 2003-02-12 Jim Meyering <jim@meyering.net>
8732 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
8733 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
8735 2003-02-10 Jim Meyering <jim@meyering.net>
8737 * src/test.c: Don't include group-member.h.
8738 Include euidaccess.h.
8739 (eaccess): Rewrite function to set the real uid and gid temporarily
8740 to the effective uid and gid, then invoke 'access', and then set the
8741 real uid and gid back. On systems that lack setreuid or setregid,
8742 fall back on the kludges in euidaccess. Before, it would not work
8743 for e.g., files with ACLs, files that were marked immutable,
8744 or on file systems mounted read-only. Nelson Beebe raised the issue.
8745 Paul Eggert suggested the new implementation.
8747 2003-02-09 Jim Meyering <jim@meyering.net>
8749 * src/test.c (test_stat): Remove function. It's job is done (only
8750 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
8752 2003-02-08 Jim Meyering <jim@meyering.net>
8756 * tests/mv/part-symlink: Don't assume that the file owner username
8757 length is less than 9 in ls output: instead, omit that field
8758 altogether. Reported by, and suggested fix from, Ferdinand.
8760 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
8761 * tests/du/Makefile.am (TESTS): Add restore-wd.
8763 * src/rm.c: Correct now-invalid comment about cycle-detection.
8765 2003-02-06 Jim Meyering <jim@meyering.net>
8767 * NEWS: Add entries from old/*/NEWS
8768 from fileutils-4.1 through 4.1.11 and
8769 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
8773 * src/du.c (process_file): Don't return early for excluded files
8774 or for files whose dev/inode we've already seen.
8776 2003-02-05 Jim Meyering <jim@meyering.net>
8778 * tests/du/exclude: New file.
8779 * tests/du/Makefile.am (TESTS): Add exclude.
8781 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
8783 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
8784 Fix memory allocation arithmetic.
8786 2003-02-04 Jim Meyering <jim@meyering.net>
8788 `df /dev/block-or-char-device-file--not-mounted' now reports
8789 the name of the file system on which the file resides, usually `/'.
8790 Before, it would leave the `Mounted on' field blank.
8791 * src/df.c (show_disk): Move function to precede find_mount_point.
8792 (show_disk): Add parameter: STATP.
8793 If we don't find a matching device name, then resort to calling
8794 find_mount_point. Reported by Bob Proulx.
8796 2003-02-03 Andreas Schwab <schwab@suse.de>
8798 * tests/rm/cycle: Require non-root.
8799 * tests/rm/isatty: Likewise.
8801 2003-02-02 Jim Meyering <jim@meyering.net>
8805 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
8807 Ensure that there are no offending uses of `:'.
8808 * Makefile.maint (makefile_path_separator_check): New rule.
8809 (local-check): Add it to the list.
8811 2003-02-01 Jim Meyering <jim@meyering.net>
8813 * src/du.c (MAX_N_DESCRIPTORS): Define.
8815 * src/stat.c (G_fail): New global.
8816 (human_time): Diagnose failed localtime, not failed nstrftime.
8817 (main): Fail if G_fail is set.
8819 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
8821 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
8822 hard-coding the path-separator. Also double-quote the new PATH,
8823 to avoid problems when the path-separator is a semi-colon or when
8824 `pwd` contains e.g. a space.
8825 * tests/chgrp/Makefile.am: Likewise.
8826 * tests/chmod/Makefile.am: Likewise.
8827 * tests/chown/Makefile.am: Likewise.
8828 * tests/cp/Makefile.am: Likewise.
8829 * tests/dd/Makefile.am: Likewise.
8830 * tests/dircolors/Makefile.am: Likewise.
8831 * tests/du/Makefile.am: Likewise.
8832 * tests/expr/Makefile.am: Likewise.
8833 * tests/factor/Makefile.am: Likewise.
8834 * tests/fmt/Makefile.am: Likewise.
8835 * tests/install/Makefile.am: Likewise.
8836 * tests/ln/Makefile.am: Likewise.
8837 * tests/ls/Makefile.am: Likewise.
8838 * tests/ls-2/Makefile.am: Likewise.
8839 * tests/md5sum/Makefile.am: Likewise.
8840 * tests/misc/Makefile.am: Likewise.
8841 * tests/mkdir/Makefile.am: Likewise.
8842 * tests/mv/Makefile.am: Likewise.
8843 * tests/od/Makefile.am: Likewise.
8844 * tests/rm/Makefile.am: Likewise.
8845 * tests/rmdir/Makefile.am: Likewise.
8846 * tests/seq/Makefile.am: Likewise.
8847 * tests/sha1sum/Makefile.am: Likewise.
8848 * tests/shred/Makefile.am: Likewise.
8849 * tests/stty/Makefile.am: Likewise.
8850 * tests/sum/Makefile.am: Likewise.
8851 * tests/tail-2/Makefile.am: Likewise.
8852 * tests/touch/Makefile.am: Likewise.
8853 * tests/tsort/Makefile.am: Likewise.
8854 * tests/unexpand/Makefile.am: Likewise.
8856 2003-01-31 Jim Meyering <jim@meyering.net>
8858 * src/stat.c: Include "file-type.h"
8859 (print_human_type): Remove function.
8860 (human_access): Rename from print_human_access. Return a string.
8861 (human_time): Rename from print_human_time. Return a string.
8862 (print_stat): Arrange so that field width and an alignment specifier
8863 are honored for the %A, %F, %x, %y, and %z formats.
8864 [%F]: Use file_type; this gives slightly different file type strings,
8865 e.g., `directory' instead of `Directory' and `regular file' or
8866 `regular empty file' instead of `Regular file'.
8867 Prompted by a report from Richard Dawe that the uses of
8868 S_IFSOCK and S_IFIFO in print_human_time were not portable
8869 to systems using e.g., DJGPP.
8871 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
8873 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
8874 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
8876 2003-01-31 Jim Meyering <jim@meyering.net>
8878 * src/du.c (main): Upon processing an invalid option or an invalid
8879 --exclude-from or --max-depth option argument, don't exit right away,
8880 in case there are others. Rather record the failure and exit after
8881 processing other options.
8883 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
8884 tar archive easier to reproduce.
8886 Rewrite to perform directory traversal using nftw.
8888 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
8889 (AUTHORS): Add self.
8890 (opt_one_file_system): Move global into `main'.
8891 (path, xstat, exit_status): Remove declarations.
8892 (arg_length, suffix_length): New globals.
8893 (G_fail): New global, sort of like the old `exit_status'.
8894 (IS_FTW_DIR_TYPE): Define.
8895 (print_only_size): New function.
8896 (process_file): New function.
8897 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
8898 (str_trunc, pop_dir, count_entry): Likewise.
8899 (du_files): Rewrite to use nftw.
8901 2003-01-30 Jim Meyering <jim@meyering.net>
8903 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
8904 symlink-to-directory with -L, even without the trailing slash.
8906 2003-01-27 Jim Meyering <jim@meyering.net>
8908 * src/Makefile.am (check-misc): Check for st_blocks, too.
8910 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
8911 Reported by Richard Dawe.
8913 2003-01-27 Andreas Schwab <schwab@suse.de>
8915 * src/ls.c (quote_name): Add fourth parameter, width, into which to
8916 store the screen columns, and return the number of bytes instead.
8917 (print_dir): Pass NULL as fourth parameter of quote_name.
8918 (print_name_with_quoting): Likewise.
8919 (length_of_file_name_and_frills): Get the width from the fourth
8920 parameter of quote_name instead of return value.
8922 2003-01-27 Jim Meyering <jim@meyering.net>
8924 * src/ls.c (decode_switches): If `dired' is set without
8925 `format == long_format', then silently reset dired. This doesn't
8926 change the behavior of ls (all prior uses of dired were protected
8927 by `&& format == long_format'), and lets us...
8928 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
8929 (PUSH_CURRENT_DIRED_POS): Likewise.
8932 2003-01-22 Jim Meyering <jim@meyering.net>
8934 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
8935 * tests/du/Makefile.am (TESTS): Add no-x.
8937 2003-01-21 Jim Meyering <jim@meyering.net>
8939 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
8940 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
8941 it may still be a directory -- or not (e.g., with FreeBSD on an
8942 NFS-mounted file system), so resort to calling lstat to find out.
8943 Based on a patch by Michael van Elst.
8945 * tests/cp/same-file: Don't assume that the file owner username
8946 length is less than 9 in ls output: instead, omit that field
8947 altogether. Reported by, and suggested fix from, Ferdinand.
8949 2003-01-20 Jim Meyering <jim@meyering.net>
8951 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
8952 large format widths no longer cause strftime to infloop.
8954 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
8956 2003-01-19 Jim Meyering <jim@meyering.net>
8958 * src/readlink.c: Include "canonicalize.h".
8960 2003-01-18 Jim Meyering <jim@meyering.net>
8962 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
8964 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
8965 (long_options): Add option --dereference-command-line-symlink-to-dir.
8966 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
8967 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
8968 -d, -F, -l options is specified.
8969 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
8970 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
8971 Change --dereference-command-line (-H) to dereference *all*
8972 command line arguments, including broken symlinks.
8974 2003-01-15 Paul Eggert <eggert@twinsun.com>
8976 Change ls -H back to the way it was yesterday, since this is
8977 compatible with FreeBSD and the POSIX spec is confusing
8978 and somewhat contradictory.
8980 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
8981 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
8982 (long_options): Change the long option name back.
8983 (usage): Change the usage back.
8984 (gobble_file): When -H is specified, dereference a top-level
8985 arg even if it points to a non-directory.
8987 2003-01-15 Jim Meyering <jim@meyering.net>
8989 * src/ls.c (gobble_file): Fall back on using lstat when required:
8990 when --dereference (-L) is not specified, and
8991 - when operating on a dangling symlink
8992 - when operating on command-line-symlink-to-directories
8993 This fixes numerous problems. Here are examples:
8994 - `ls dangling-symlink' would fail with `no such file...'
8995 Now it prints `dangling-symlink'.
8996 - `ls -i symlink' would mistakenly print the inode of the referent.
8997 Now it prints the inode of the symlink. Likewise for --size (-s).
8998 Based on a patch from Michael Stone.
8999 Reported by Deepak Goel as Debian bug #173793.
9001 Rename ls's --dereference-command-line (-H)
9002 option to --dereference-command-line-symlink-to-dir.
9003 * src/ls.c [enum Dereference_symlink]
9004 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
9005 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
9006 (long_options): Rename the long option.
9007 (usage): Say that --dereference-... changes how ls treats
9008 only symlinks to directories specified on the command line.
9010 2003-01-14 Jim Meyering <jim@meyering.net>
9012 * tests/ls/dangle: New file/test, for the above fix.
9013 * tests/ls/inode: Another new file/test, for the above fix.
9014 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
9016 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
9017 so that ls --color would no longer highlight the names of files with
9018 the execute bit set when not specified on the command line.
9019 Patch by Michael Stone. Reported by Stephen Depooter as
9022 * tests/ls-2/tests (color-exe): New test, for the above fix.
9024 2003-01-13 Jim Meyering <jim@meyering.net>
9026 * tests/shred/exact: Also test for just fixed bug with --zero.
9028 * src/shred.c (long_opts): --zero does not require an argument.
9029 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
9031 2003-01-12 Jim Meyering <jim@meyering.net>
9033 * Makefile.maint (cvs-update): Skip any file with local modifications.
9035 * src/unexpand.c (usage): Document --first-only and mention that
9036 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
9038 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
9040 * src/df.c: Include "canonicalize.h".
9041 Use canonicalize_file_name unconditionally.
9043 2003-01-09 Jim Meyering <jim@meyering.net>
9045 * README: Add readlink.
9047 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
9049 * src/df.c: Include "xgetcwd.h".
9050 * src/pwd.c: Likewise.
9052 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
9054 * src/shred.c: Remove declaration of xstrdup.
9055 We already get it via xalloc.h which is included via system.h.
9057 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
9059 New program: readlink.
9061 * src/Makefile.am (bin_PROGRAMS): Add readlink.
9062 * src/readlink.c: New file.
9064 * man/readlink.x: New file.
9065 * man/Makefile.am (dist_man_MANS): Add readlink.1.
9066 (readlink.1): New rule.
9068 2003-01-09 Jim Meyering <jim@meyering.net>
9070 When selecting ranges of byte offsets (as opposed to ranges of fields)
9071 and when --output-delimiter=STRING is specified, output STRING between
9072 ranges of selected bytes.
9073 * src/cut.c (RANGE_START_SENTINEL): Define.
9074 (output_delimiter_specified): New global.
9075 (print_kth): Add parameter. Adjust all callers.
9076 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
9077 (cut_bytes): When requested, output STRING between ranges of
9079 (main): Make a diagnostic a little clearer.
9080 Based on a patch from Jan Nieuwenhuizen.
9082 * tests/cut/Test.pm: New tests for the above.
9084 * src/cut.c (set_fields): Make code agree with comment:
9085 Don't merge abutting ranges like 4- and 2-3. This makes no
9086 difference currently, but is required to support an upcoming change.
9088 2003-01-07 Jim Meyering <jim@meyering.net>
9090 * src/cut.c (set_fields): Fix typo in comment.
9092 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
9093 * tests/touch/Makefile.am (TESTS): Add not-owner.
9094 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
9095 Now, this tests only the nonexistent-directory diagnostic.
9096 Suggestion from Michael Stone.
9098 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
9100 2003-01-04 Jim Meyering <jim@meyering.net>
9102 * src/copy.h: Remove use of PARAMS.
9103 * src/remove.h: Likewise.
9104 * src/chown-core.h: Likewise.
9106 rm could be tricked into mistakenly reporting a cycle.
9107 * src/remove.c: [cycle_check_state]: New global.
9108 (remove_cwd_entries): Adapt to new semantics of cycle_check.
9109 (rm): Call cycle_check_init and cycle_check_free for each file.
9110 * tests/rm/cycle (rm): New test, for the above fix.
9111 * tests/rm/Makefile.am (TESTS): Add cycle.
9113 When rm detects a cycle, don't abort the entire command,
9114 but rather just the affected command line argument.
9115 * src/remove.c: Include <setjmp.h>
9116 (struct dirstack_state) [current_arg_jumpbuf]: New member.
9117 (remove_cwd_entries): Call longjmp if we detect a cycle.
9118 (rm): Call setjmp here.
9120 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
9121 Instead, include cycle-check.h and use it.
9123 * src/remove.h (struct dev_ino): Remove declaration.
9125 * src/remove.c (remove_cwd_entries): Fix typos in comment.
9127 Don't include trailing /. in diagnostics about directories.
9128 * src/remove.c (full_filename_): When FILENAME is just `.'
9129 and there is a nonempty directory-name part, don't append `/.'.
9130 * tests/rm/unread2: Remove trailing /. from diagnostic.
9131 * tests/rm/rm2: Likewise.
9133 * src/remove.c (struct dirstack_state): Define.
9134 To be used in place of these file-scoped globals ...
9135 (dir_stack, len_stack, Active_dir): Remove globals.
9136 (ds_init, ds_free): New functions.
9137 (full_filename): Define.
9138 (full_filename_): Rename from full_filename.
9140 Begin to make AD_* functions more generic.
9141 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9142 (AD_push): Likewise.
9143 (AD_INIT_OTHER_MEMBERS): Define.
9144 (remove_dir): Define the `status' member manually after each
9145 call to AD_push or AD_push_initial.
9147 * src/Makefile.am (check-misc): New rule, to ensure that no more
9148 S_IS* macro definitions sneak into the code.
9149 (check): Depend on check-misc.
9151 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
9152 * src/du.c (count_entry) [S_ISLNK]: Don't define.
9153 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
9155 2003-01-03 Jim Meyering <jim@meyering.net>
9157 * src/true.c: Add copyright.
9158 (AUTHORS): I suppose I've written it.
9160 * src/Makefile.am (false.c): Make the generated file be read-only.
9162 2003-01-04 Jim Meyering <jim@meyering.net>
9164 * src/ls.c: Include "dev-ino.h".
9165 [struct dev_ino]: Remove declaration.
9167 2003-01-02 Jim Meyering <jim@meyering.net>
9169 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
9170 from mv: s/missing file arguments/missing file argument/.
9171 With --target-directory=DIR, cp and mv work with a single file argument.
9172 Reported by Karl Berry.
9174 * tests/rm/isatty: Enable this test.
9176 2002-12-31 Jim Meyering <jim@meyering.net>
9178 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
9179 (AD_push): Likewise.
9180 (AD_INIT_OTHER_MEMBERS): Define.
9181 (remove_dir): Define the `status' member manually after each
9182 call to AD_push or AD_push_initial.
9184 * src/ls.c [struct dev_ino]: Remove definition.
9185 Include "dev-ino.h" instead.
9187 2002-12-28 Jim Meyering <jim@meyering.net>
9189 * tests/du/Makefile.am (TESTS): Add no-deref.
9190 * tests/du/no-deref: New script.
9192 2002-12-23 Jim Meyering <jim@meyering.net>
9194 * src/remove.c (remove_cwd_entries): Fix typo in comment.
9196 2002-12-21 Jim Meyering <jim@meyering.net>
9198 * announce-gen: Generate MML-formatted announcement.
9199 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
9201 2002-12-20 Jim Meyering <jim@meyering.net>
9203 * src/touch.c (touch): Change the wording of a diagnostic so
9204 that it makes sense both when the file exists and when it doesn't.
9205 Suggestion from Michael Stone.
9207 2002-12-18 Jim Meyering <jim@meyering.net>
9209 * src/stty.c (valid_options): Declare to be static.
9211 2002-12-15 Jim Meyering <jim@meyering.net>
9213 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
9215 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
9216 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
9217 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
9218 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
9219 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
9221 * src/remove.c (PARAMS): Remove definition.
9222 * src/sys2.h: Likewise.
9224 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
9225 Include strftime.h instead.
9227 2002-12-14 Jim Meyering <jim@meyering.net>
9229 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
9231 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
9232 This is necessary at least for Irix6.5 when using c89.
9233 Reported by Nelson Beebe.
9235 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
9237 * tests/misc/cat-tty-eof: New test.
9239 * src/mknod.c (usage): Specify how major and minor mode numbers
9240 are interpreted. Report forwarded by Kristin E Thomas.
9241 * src/mknod.c: Remove now-redundant usage-specifying comment.
9243 2002-12-13 Jim Meyering <jim@meyering.net>
9247 * tests/du/trailing-slash: Allow for a directory of size `0'.
9248 That happens at least on file systems of type tmpfs on linux-2.4.18.
9250 * announce-gen: New script to begin replacing the commands
9251 associated with the rule here...
9252 * Makefile.maint (announcement): Invoke announce-gen.
9253 * Makefile.am (EXTRA_DIST): Add announce-gen.
9255 * tests/cp/preserve-2: New file/test, for latest fix.
9256 * tests/cp/Makefile.am (TESTS): Add preserve-2.
9258 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
9260 Fix a bug whereby cp would fail to parse an option like
9261 --preserve=mode,ownership.
9262 * src/cp.c (decode_preserve_arg): Advance `comma' to
9263 point the character following the comma.
9265 2002-12-11 Jim Meyering <jim@meyering.net>
9267 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
9268 in case it's already defined.
9270 2002-12-09 Jim Meyering <jim@meyering.net>
9272 * tests/touch/fail-diag: Don't get a test failure if /no exists.
9273 Instead, evoke a framework failure if /no-$$ exists.
9274 Reported by Michael Stone.
9276 2002-12-08 Jim Meyering <jim@meyering.net>
9278 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
9279 Define to rpl_lstat, so that even on systems like Solaris 5.8,
9280 du honors (per POSIX) the trailing slash on an argument referring
9281 to a symlink-to-directory.
9283 2002-12-06 Jim Meyering <jim@meyering.net>
9285 * Use autoconf-2.57. Regenerate dependent files.
9286 * Use automake-1.7.2. Regenerate dependent files.
9288 * src/ls.c (gobble_file): Also stat the file if it's a
9289 regular file and --indicator-style=classify (aka -F).
9290 Thanks to Ed Santiago for opening my eyes.
9292 * tests/ls/file-type: New file. Test for the above.
9293 A test to contrast ls -F and ls --indicator-style=file-type.
9294 * tests/ls/Makefile.am (TESTS): Add file-type.
9296 2002-12-04 Jim Meyering <jim@meyering.net>
9298 * tests/ls/follow-slink: Make sure the symlink was created.
9299 Richard Dawe reported that `ln -s link link' succeeds, but creates
9300 no file on systems running some version of the DJGPP libc.
9302 2002-12-03 Jim Meyering <jim@meyering.net>
9304 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
9305 since this package no longer panders to K&R compilers.
9307 2002-12-02 Jim Meyering <jim@meyering.net>
9309 * tests/du/slink: Skip this test if `.' is on a non-local file system.
9311 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
9312 something to replace.
9314 2002-12-01 Jim Meyering <jim@meyering.net>
9316 * src/stat.c: Don't include <string.h> or <ctype.h>.
9317 That's already done via system.h.
9318 * src/dircolors.c: Don't include <ctype.h>.
9320 2002-11-30 Jim Meyering <jim@meyering.net>
9322 * ls.c (gobble_file): Remove the block of code that caused
9323 `ls --color -F symlink-to-dir' to list the files in
9324 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
9325 like `ls -F symlink-to-dir') but with the addition of highlighting.
9326 Similarly, `ls --color -dF symlink-to-dir' would print
9327 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
9328 Reported by Jeff Sheinberg as Debian bug #168203.
9329 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
9331 ls is now more efficient: with certain options, it no longer needs
9332 to stat each directory entry on systems with valid dirent.d_type.
9333 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
9334 (main): Make --recursive set format_needs_type, not format_needs_stat.
9335 (gobble_file): Remove a FIXME comment, now that it's fixed.
9337 2002-11-24 Jim Meyering <jim@meyering.net>
9339 * src/du.c (du_files): Don't strip any trailing slash.
9340 Rewrite so that `/' is no longer represented internally as
9342 (count_entry): When appending a file name component,
9343 account for the fact that the current path may end in `/'.
9344 François Pinard reported that `du symlink-to-dir/' was not
9345 equivalent to `du symlink-to-dir/.'. Now it is.
9346 * tests/du/trailing-slash: New file/test, for the above fix.
9347 * tests/du/Makefile.am (TESTS): Add trailing-slash.
9349 2002-11-23 Jim Meyering <jim@meyering.net>
9351 * src/tac.c (output): Declare some local variables to be of type size_t,
9352 rather than `int' to avoid warnings from gcc.
9354 2002-11-21 Paul Eggert <eggert@twinsun.com>
9356 * src/ls.c (decode_switches): Use case-sensitive matching to
9357 decode the QUOTING_STYLE environment variable. This is more
9358 consistent with the documentation, and with --quoting-style.
9360 2002-11-21 Martin Buck <martin.buck@ascom.ch
9362 * src/stty.c (struct speeds): Add support for all baud rates defined
9365 2002-11-19 Jim Meyering <jim@meyering.net>
9367 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
9368 run in a UTF locale. Report and suggested fix by Bruno Haible.
9369 * tests/fmt/basic: Likewise.
9371 2002-11-17 Jim Meyering <jim@meyering.net>
9373 * configure.ac: Update via autoupdate.
9374 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
9376 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
9377 Reported by Hans Ginzel.
9379 2002-11-15 Jim Meyering <jim@meyering.net>
9381 * Makefile.cfg (gnu_rel_host): Define.
9382 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
9383 on whether $(VERSION) looks like a major release number.
9385 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
9386 (release): Rename from `alpha'.
9387 (alpha): Depend on release.
9389 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
9391 2002-11-14 Jim Meyering <jim@meyering.net>
9393 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
9394 (announcement): Use the new variable.
9396 * Makefile.maint: Sync with Bison, i.e.:
9397 (po-check): Scan .l and .y files instead of the
9398 .c and the .h files that they generate. This fixes the bug
9399 reported by Tim Van Holder in:
9400 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
9401 Look for N_ as well as for _. Try to avoid matching #define for
9405 2002-11-12 Jim Meyering <jim@meyering.net>
9407 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
9408 Replace sole use with equivalent `#ifdef S_ISLNK'.
9409 Inconsistency reported by Dmitry V. Levin.
9411 2002-11-11 Jim Meyering <jim@meyering.net>
9413 * src/stat.c (usage): Transform --help items output via s/ - / /,
9414 so that help2man produces properly formatted man pages.
9415 Reported by Herbert Xu as Debian bug #168400.
9417 2002-11-10 Jim Meyering <jim@meyering.net>
9419 * src/ls.c (sighandler): Handle SIGTSTP specially.
9420 Based on suggestions from Solar Designer and Dmitry V. Levin.
9423 * Makefile.cfg (cvs_files): Define. From autoconf.
9424 (local_updates): Likewise.
9426 * src/ls.c (restore_default_color_handler, sigtstp_handler):
9428 (sighandler): New function, based on the one in sort.c.
9429 (main): Use sigaction, if possible; otherwise signal.
9430 Handle these signals:
9431 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
9432 Don't register our handler if the signal is already being ignored.
9434 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
9435 * src/csplit.c (interrupt_handler): Likewise.
9436 * src/sort.c (sighandler): Likewise.
9437 (main): Declare `i' and `nsigs' to be unsigned, not int.
9439 2002-11-09 Jim Meyering <jim@meyering.net>
9441 ls --color: restore terminal text color upon signal.
9442 * src/ls.c: Include "full-write.h" and <signal.h>.
9443 (restore_default_color, restore_default_color_handler): New functions.
9444 (sigtstp_handler, put_indicator_direct): New functions.
9445 (main) [print_with_color]: Register signal handlers.
9446 Patch mostly by Solar Designer and Stanislav Ievlev.
9448 Update from autoconf.
9449 * Makefile.maint (AMTAR): Remove definition.
9450 (update, cvs-update, po-update, do-po-update): New rules.
9451 (wget-update): Update (thus renaming to cvs-update).
9452 (automake_repo): Use anoncvs@sources.redhat.com.
9454 2002-11-06 Jim Meyering <jim@meyering.net>
9456 * tests/misc/Makefile.am (TESTS): Add printf-hex.
9458 * tests/misc/printf: Be careful to test the code in this package,
9459 not the shell built-in function.
9461 * src/printf.c (print_esc): A hexadecimal escape sequence has
9462 at most two hex. digits, not three. Reported by Padraig Brady.
9463 (usage): Update description.
9464 * tests/misc/printf-hex: New file/test, for the above fix.
9466 2002-10-07 Paul Eggert <eggert@twinsun.com>
9468 Add support for locale-specific size indications (e.g.,
9469 thousands-separators) and for explicit size suffixes on output.
9471 * doc/coreutils.texi (Block size): Say that:
9472 This affects display format as well as block size.
9473 Fractional block counts are rounded up.
9474 ls file size blocksize defaults to 1.
9475 A block size spec preceded by ' generates thousands separators.
9476 A suffix without a preceding integer generates suffixes.
9477 (tail invocation): 32k -> 32 KiB.
9478 (What information is listed): ls -h is now equivalent to
9479 ls --block-size=human, and ls -H is now equivalent to
9480 ls --block-size=si. Displayed file size is now always affected by
9483 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
9484 lib/umaxtostr.c: New files, taken from GNU tar.
9486 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
9488 (EXTRA_DIST): Add inttostr.c.
9490 * lib/human.c, lib/human.h: Rewrite to support locale-specific
9491 notations like thousands separators.
9492 Specify what includer of include.h must include beforehand.
9493 (human_group_digits, human_suppress_point_zero, human_autoscale,
9494 human_base_1024, human_SI, human_B): New enum values.
9495 (human_readable): Rename from human_readable_inexact; put the
9496 options before the sizes. All uses changed. The old human_readable
9497 function has been removed; use inttostr.h instead.
9498 (human_options): Renamed from human_block_size, with new signature
9499 that allows block sizes up to UINTMAX_MAX. All callers changed.
9501 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
9502 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
9503 freestanding C89. No need to check for stdlib.h or string.h since
9504 autoconf does this now.
9506 * src/cksum.c (cksum): Use primitives from inttostr.h, not
9507 human.h, to print large numbers simply.
9508 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
9509 * src/dd.c (print_stats, main): Likewise.
9510 * src/df.c (print_header): Likewise.
9511 * src/factor.c (print_factors): Likewise.
9512 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
9513 * src/shred.c (dopass): Likewise.
9514 * src/sort.c (checkfp): Likewise.
9515 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
9516 * src/tail.c (xlseek): Likewise.
9517 * src/wc.c (write_counts, wc): Likewise.
9519 * src/df.c (human_output_opts): New var.
9520 (output_block_size): Now uintmax_t, not int, to handle larger
9521 block sizes. All uses changed.
9522 * src/du.c: Likewise.
9523 * src/ls.c: Likewise.
9525 * src/df.c (print_header): In the header line, prefer SI to human
9526 representation if it's shorter; if neither is shorter, try to
9527 intuit what the user would prefer.
9529 * src/expr.c (inttostr): Remove; use new imaxtostr library
9532 * src/ls.c (file_output_block_size): New var, to distinguish
9533 file sizes from other sizes.
9534 (decode_switches): Set it.
9536 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
9537 (dopass): When printing progress, use floor for what has been done
9538 so far (since we should be conservative there), and ceiling for
9539 what needs to be done (since that's what other programs use).
9541 2002-10-19 Jim Meyering <jim@meyering.net>
9543 * src/pinky.c (print_heading): Align TTY and Name headings.
9544 Reported by Karl Eichwalder.
9546 2002-10-18 Jim Meyering <jim@meyering.net>
9548 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
9549 Remove now-useless cast.
9550 (stdread): Remove function.
9551 (bytes_split): Use size_t instead of int.
9552 Use safe_read, not stdread.
9553 (lines_split): Likewise.
9554 Use memchr rather than a `while' loop.
9555 (line_bytes_split): Use size_t instead of int.
9556 Use safe_read, not stdread.
9557 (main): Add some FIXME comments to remind me to remove casts.
9559 * src/system.h (ST_BLKSIZE): Correct comment describing how to
9560 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
9562 2002-10-17 Jim Meyering <jim@meyering.net>
9564 Fix a problem that could make e.g., `cat' misbehave on systems which
9565 give invalid (unreasonably large) values for stat.st_blksize.
9566 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
9567 Reported by Petter Reinholdtsen.
9569 2002-10-14 Jim Meyering <jim@meyering.net>
9571 Specifying a printf conversion specifer as nl's separator string
9572 could cause nl to segfault.
9573 * src/nl.c (build_print_fmt): Don't include separator string
9574 in the printf format; it might contain `%'.
9575 Use a better bound on the length of the print_fmt buffer.
9576 (print_lineno): Print the separator here instead.
9577 Reported by Doug Coleman.
9579 * tests/misc/nl: New file/tests, including a test for the above.
9580 * tests/misc/Makefile.am (TESTS): Add nl.
9582 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
9583 * tests/misc/Makefile.am (TESTS): Add split-l.
9585 2002-10-13 Jim Meyering <jim@meyering.net>
9589 * src/du.c (usage): Tweak description of --dereference-args/-D.
9591 * src/du.c (count_entry): Also save cwd when dereferencing (via
9592 --dereference-args, -D) a command-line argument.
9593 Reported by Michal Svec. Based on a patch by Andreas Schwab.
9595 * src/Makefile.am (../AUTHORS): New target/rule.
9597 2002-10-12 Jim Meyering <jim@meyering.net>
9599 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
9600 of type size_t, since that's the way it's used and avoids a warning.
9602 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
9603 since that's how it's always used and avoids a new warning from gcc.
9604 (read_input): Adapt to new safe_read ABI.
9606 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
9609 * src/pinky.c (print_long_entry): fread returns size_t.
9610 Declare local `bytes' accordingly, to avoid warning.
9612 tail -c +N would perform an extra read after encountering EOF
9613 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
9614 * src/tail.c (start_bytes): Detect EOF, inform caller.
9615 (tail_bytes): Upon EOF in start_bytes, return immediately.
9616 (file_lines): Reorganize to use memrchr rather than an explicit loop.
9617 Adapt to new safe_read ABI.
9619 2002-10-11 Jim Meyering <jim@meyering.net>
9621 * tests/du/deref: New file/test, for the above fix.
9622 * tests/du/Makefile.am (TESTS): Add deref.
9624 2002-10-10 Jim Meyering <jim@meyering.net>
9626 * tests/ln/Makefile.am (TESTS): Add target-1.
9627 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
9629 2002-10-09 Jim Meyering <jim@meyering.net>
9631 * tests/cp/backup-is-src: Ensure that certain environment variables
9632 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
9634 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
9635 consume 4GB of disk space on systems without support for sparse files.
9636 Fix a logic error that'd make it `cat err' even though dd didn't fail.
9638 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
9639 Patch by steven@magelico.net, forwarded by Michael Stone.
9641 * tests/ls/dired: Ensure that ls produces English messages.
9642 Patch by Alexey Vyskubov, forwarded by Michael Stone.
9644 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
9646 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
9648 2002-10-08 Jim Meyering <jim@meyering.net>
9650 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
9651 Fix syntax in test: use =, not ==.
9652 Reported by Bob Proulx.
9653 Change all the rest like this: grep -lR "testing framework'" .\
9654 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
9656 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
9657 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
9658 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
9659 * src/wc.c (wc): Likewise.
9661 2002-10-07 Paul Eggert <eggert@twinsun.com>
9664 Don't advance the write pointer past the end of the write buffer.
9665 * src/sort.c (begfield, limfield): Likewise.
9667 2002-10-07 Jim Meyering <jim@meyering.net>
9669 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
9670 * src/head.c (head_bytes, head_lines): Likewise.
9672 2002-10-06 Jim Meyering <jim@meyering.net>
9674 * src/dd.c (scanargs): Ensure that specified block sizes (specified
9675 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
9676 (skip, dd_copy): Adapt to new safe_read ABI.
9678 * Makefile.maint (signatures): Define.
9680 (announcement): Depend on $(signatures).
9682 * Makefile.maint (announcement): Output all URLs for detached
9683 signatures, not just the last one from the previous loop.
9685 2002-10-05 Jim Meyering <jim@meyering.net>
9689 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
9690 don't recurse into directory, DIR. Prompted by a report from
9693 * tests/rm/i-no-r: New file/test, for the above fix.
9694 * tests/rm/Makefile.am (TESTS): Add i-no-r.
9696 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
9697 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
9699 2002-10-03 Jim Meyering <jim@meyering.net>
9701 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
9702 * src/df.c (AUTHORS): Likewise.
9703 * src/du.c (AUTHORS): Likewise.
9704 * src/tail.c (AUTHORS): Likewise.
9705 * src/touch.c (AUTHORS): Likewise.
9707 2002-10-02 Jim Meyering <jim@meyering.net>
9709 * Makefile.am (SUBDIRS): Remove `old'.
9710 (EXTRA_DIST): List the files in old/.
9711 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
9712 Suggestion from Akim Demaille.
9714 2002-10-01 Jim Meyering <jim@meyering.net>
9716 * src/sys2.h (SSIZE_MAX): Define.
9718 2002-09-30 Jim Meyering <jim@meyering.net>
9720 * src/csplit.c: Don't include stdlib.h here. It's already included
9723 2002-09-29 Jim Meyering <jim@meyering.net>
9725 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
9726 expression to avoid bogus warning from gcc.
9728 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
9729 (cat): Declare insize and outsize to be of type size_t, not int.
9730 Rearrange pointer/integer expressions to avoid bogus warnings.
9731 (main): Declare insize and outsize to be of type size_t, not int.
9733 * src/tail.c (parse_options): Give a sensible diagnostic for
9734 an invalid byte or line count. Reported by Mikko Tuumanen.
9736 * src/touch.c (main): Split a long line.
9738 * tests/du/Makefile.am (TESTS): Add slink.
9739 * tests/du/slink: New test for system.h change of 2002-08-31.
9741 In move mode, always first try to rename. Before, upon failure to
9742 rename a directory, this code would never attempt to rename any
9743 other file in that directory, but would thenceforth always copy.
9744 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
9745 may fail with EXDEV, yet renaming files within that directory to
9746 a newly-created destination directory succeeds.
9747 * src/copy.c (copy_internal): Remove local, move_mode;
9748 use x->move_mode instead. Based on a patch from Tom Haynes.
9750 2002-09-28 Jim Meyering <jim@meyering.net>
9752 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
9753 Factor out some duplication.
9755 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
9757 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
9759 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
9760 to avoid compiler warnings.
9762 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
9765 Fix things so `mkdir -p' can create very deep directories, e.g.,
9766 mkdir -p $(perl -e 'print "a/" x 40000') now works.
9767 * src/mkdir.c (main): For --parents (-p), call make_path with the
9768 entire directory name, so we don't ever require that file operations
9769 like stat or chmod be performed on the entire command line argument.
9770 * makepath.c (make_path): Restore umask *before* creating the final
9773 2002-09-27 Andreas Schwab <schwab@suse.de>
9775 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
9776 to avoid overflow. Reported by Hans Lermen.
9778 2002-09-26 Jim Meyering <jim@meyering.net>
9780 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
9782 2002-09-25 Jim Meyering <jim@meyering.net>
9784 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
9785 and add a cast, to avoid a warning about `signed and unsigned type in
9786 conditional expression'.
9788 2002-09-22 Jim Meyering <jim@meyering.net>
9790 * src/rmdir.c: Include "dirname.h", for declaration of
9791 strip_trailing_slashes.
9793 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
9794 Now they're defined through system.h.
9796 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
9797 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
9798 since it's already included from sys2.h via system.h.
9800 * Use automake-1.6f. Regenerate dependent files.
9802 * src/Makefile.am (PERL): Remove duplicate definition.
9804 fmt's -s, -t, -c options didn't work properly for long lines.
9805 Since get_line may end up calling put_paragraph (for long lines),
9806 be sure to set global, `other_indent', before it is used there.
9808 * src/fmt.c (set_other_indent): New function, factored out of...
9809 (get_paragraph): ... here. Call it.
9810 (get_line): Call set_other_indent before calling flush_paragraph,
9811 which calls fmt_paragraph, which in turn calls put_paragraph,
9812 which uses other_indent.
9814 * tests/fmt/Makefile.am (TESTS): Add long-line.
9815 * tests/fmt/long-line: New file/test, for the above fix.
9817 2002-09-21 Jim Meyering <jim@meyering.net>
9819 * src/od.c: No longer include deprecated <values.h>.
9820 It was required solely for now-removed reference to BITSPERBYTE.
9821 * src/install.c: Likewise.
9822 Suggestion from Bruno Haible.
9824 2002-09-06 Andreas Schwab <schwab@suse.de>
9826 `rmdir -p dir-specified-with-trailing-slash/' would fail.
9827 * src/rmdir.c (remove_parents): Strip trailing slashes.
9829 2002-09-20 Jim Meyering <jim@meyering.net>
9831 * tests/rmdir/t-slash: New file/test, for the above fix.
9832 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
9834 * Makefile.maint (announcement): Arrange to gpg-sign the message.
9835 Add a URL for each detached signature file.
9837 2002-09-07 Bruno Haible <bruno@clisp.org>
9839 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
9841 2002-09-18 Jim Meyering <jim@meyering.net>
9843 `od -t x8' used the wrong (`l'-prefixed) printf format.
9844 Likewise for the o8 and u8 formats.
9845 * src/od.c (ISPEC_TO_FORMAT): Define macro.
9846 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
9847 Reported by Arun Sharma.
9849 2002-09-17 Jim Meyering <jim@meyering.net>
9851 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
9852 From gettext's intl/loadmsgcat.c.
9854 * tests/od/x8: New file/test, for the above fix.
9855 * tests/od/Makefile.am (TESTS): Add x8.
9857 2002-09-15 Jim Meyering <jim@meyering.net>
9859 * Use autoconf-2.54. Regenerate dependent files.
9861 * src/csplit.c (get_format_width): Add cast to avoid
9862 warning about `signed and unsigned type in conditional expression'.
9864 2002-09-14 Jim Meyering <jim@meyering.net>
9866 * src/who.c (print_user): Change type of local to size_t
9867 to avoid warnings about `comparison between signed and unsigned'.
9868 * src/ptx.c (generate_all_output): Likewise.
9870 * src/dd.c (main, skip): Add casts to avoid warnings about
9871 `comparison between signed and unsigned'.
9873 * src/id.c (print_full_info, print_group_list): Add casts to avoid
9874 warnings about `signed and unsigned type in conditional expression'.
9876 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
9877 to avoid warnings about `comparison between signed and unsigned'.
9878 (split_3): Change parameter names to be readable and add comment.
9879 Clean up the test for whether a line may be ignored.
9881 2002-09-13 Jim Meyering <jim@meyering.net>
9883 * src/printf.c (main): Handle leading command line argument of `--'.
9884 Reported by Raul: DervishD <raul@pleyades.net>
9885 * tests/misc/printf: New file: test for the above.
9886 * tests/misc/Makefile.am (TESTS): Add printf.
9888 * src/date.c (usage): Explain that %S's range of [0..60] is required --
9889 rather than 0..59 -- to accommodate the occasional positive leap second.
9890 Reported by Richard Neill.
9892 2002-09-12 Jim Meyering <jim@meyering.net>
9894 * src/Makefile.am (nanosec_libs): Define.
9895 (sleep_LDADD, tail_LDADD): Use it here.
9897 Factor nanosleep-related code into ../lib/xnanosleep.c.
9898 * src/sleep.c: Include xnanosleep.h.
9899 Factor out fenv.h-related code.
9900 (timespec_subtract): Remove function.
9901 (main): Remove code that deals with computing start and stop times
9902 as well as the loop around nanosleep. Now that's in xnanosleep.c.
9904 Allow S (in --sleep-interval=S) to be a floating point value.
9905 * src/tail.c: Include xnanosleep.h and xstrtod.h.
9906 Move declaration of global variable, sleep_interval, to ...
9908 (usage): Update description of --sleep-interval option.
9909 (tail_forever): New parameter, sleep_interval. Update caller.
9910 Use xnanosleep, rather than sleep.
9911 (parse_options): New parameter, sleep_interval. Update caller.
9912 Use xstrtod, now that we accept floating point values.
9913 Prompted by a patch from Augey Mikus.
9915 2002-09-06 Jim Meyering <jim@meyering.net>
9917 * src/remove.c (prompt): Change comment to give a better note to
9918 translators. From Michael Piefel.
9920 2002-09-02 Jim Meyering <jim@meyering.net>
9922 * README: A good problem report/patch includes diffs against
9923 the most recent test release.
9925 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
9926 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
9928 * src/kill.c (print_table_row): Use an unsigned type for widths
9929 to avoid warning about comparison between signed and unsigned.
9930 (list_signals): Likewise.
9932 * src/od.c (skip): Add a cast to avoid warning about comparison
9933 between signed and unsigned.
9934 * src/install.c (get_ids): Likewise. Also rearrange range-checking
9935 comparisons to make them more readable.
9937 2002-09-01 Jim Meyering <jim@meyering.net>
9941 2002-08-31 Jim Meyering <jim@meyering.net>
9943 Symlinks were always reported as using 0 blocks.
9944 * src/system.h (ST_NBLOCKS): Don't depend on file type.
9945 This reverts the change of 2000-01-30.
9946 Based on a report and patch from Neil Brown via Michael Stone.
9947 This fixes Debian Bug#156358.
9949 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
9950 `exit (1)' to `exit (EXIT_FAILURE)', and
9951 `usage (1)' to `usage (EXIT_FAILURE)'.
9953 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
9954 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
9955 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
9956 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
9957 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
9958 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
9959 error never exits successfully.
9961 2002-08-29 Jim Meyering <jim@meyering.net>
9963 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
9964 when ignoring any return value.
9966 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
9967 failures. On some systems (at least EMC Celerra and Solaris5.8),
9968 this appears to be necessary.
9969 (is_empty_dir): Likewise. Also, always close directory handle.
9970 * src/ls.c (print_dir): Likewise.
9971 (print_dir): Rename local variable: reading -> dirp.
9972 Reported by Mike Coleman.
9974 2002-08-28 Jim Meyering <jim@meyering.net>
9976 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
9977 Give a diagnostic and fail if closedir fails.
9979 2002-08-26 Jim Meyering <jim@meyering.net>
9981 * Makefile.am (THANKS-to-translators): New rule.
9982 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
9983 * THANKStt.in: New file.
9985 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
9987 (main): Register it with atexit.
9988 Close STDOUT_FILENO, to avoid a problem when writing to
9989 /dev/audio on at least Solaris 5.7 and 5.8 systems.
9990 Reported by Shing-Shong Shei.
9992 2002-08-25 Jim Meyering <jim@meyering.net>
9994 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
9995 * src/tac.c (main): Likewise.
9996 * src/tail.c (main): Likewise.
9997 * src/tee.c (main): Likewise.
9998 * src/tr.c (main): Likewise.
9999 * src/wc.c (main): Likewise.
10001 2002-08-20 Jim Meyering <jim@meyering.net>
10003 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
10005 2002-08-10 Paul Eggert <eggert@twinsun.com>
10007 * src/nohup.sh: Don't use "exec --"; it's not portable and
10008 shouldn't be needed.
10010 2002-08-09 Jim Meyering <jim@meyering.net>
10012 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
10013 (usage): Clarify help text for the -COLUMN option.
10014 Patch by Padraig Brady.
10015 * tests/pr/Test.pm [col-last]: New test for the above.
10017 * configure.ac: Start with version 4.5.1, chosen so that it's larger
10018 than the latest version numbers of the component packages.
10020 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
10021 programs in ../src.
10023 2002-08-08 Jim Meyering <jim@meyering.net>
10025 * src/date.c: Guard inclusion of <langinfo.h> with
10026 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
10027 * src/sort.c: Likewise.
10028 Patch by GOTO Masanori.
10030 2002-08-05 Paul Eggert <eggert@twinsun.com>
10032 Fix some minor time-related bugs with POSIX time arguments.
10033 Some valid time stamps were being rejected (notably -1, and
10034 time stamps before 1900 on 64-bit hosts). And some invalid
10035 time stamps were being accepted, e.g. September 31.
10037 * src/date.c (main): Adjust to posixtime signature change.
10038 * src/touch.c (main): Likewise. Remove unnecessary initialization.
10039 Use localtime, not posixtm, to warn about obsolete "touch".
10041 2002-08-05 Jim Meyering <jim@meyering.net>
10043 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
10045 2002-08-04 Jim Meyering <jim@meyering.net>
10047 * src/Makefile.am (check-README): New target/rule.
10048 (check): Depend on it.
10050 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
10052 2002-08-03 Jim Meyering <jim@meyering.net>
10054 * Makefile.am (SUBDIRS): Add old.
10055 * old/: New directory, containing legacy ChangeLog* and NEWS files
10056 from the fileutils, sh-utils, and textutils packages.
10058 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
10060 2002-08-02 Paul Eggert <eggert@twinsun.com>
10062 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
10064 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
10065 (hard_LC_COLLATE): New var.
10066 (different): Args are now char *, not const char *.
10067 Use xmemcoll instead of memcmp to compare lines, so that
10068 LC_COLLATE has effect. However, use memcmp if it is an
10070 (check_file): Do not include newline in comparison, so that
10071 xmemcoll has a byte to stomp on temporarily.
10072 (main): Set hard_LC_COLLATE.
10074 2002-07-29 Jim Meyering <jim@meyering.net>
10076 * Makefile.am (SUBDIRS): Remove djgpp, for now.
10078 2002-07-20 Jim Meyering <jim@meyering.net>
10080 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
10081 into EXIT_FAILURE. Otherwise, false --help and false --version
10084 2002-07-08 Jim Meyering <jim@meyering.net>
10086 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
10087 rather than the hard-coded `sh-utils'.
10089 2002-07-01 Jim Meyering <jim@meyering.net>
10091 * configure.ac: Merge the three files from fileutils,
10092 textutils, and sh-utils.
10093 * Makefile.am: Likewise.
10094 * src/Makefile.am: Likewise.