1 2004-03-02 Jim Meyering <jim@meyering.net>
5 2004-03-03 Paul Eggert <eggert@twinsun.com>
7 * src/nohup.c (main): Don't invoke set_cloexec_flag with
8 a file descriptor of -1.
10 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
12 * src/nohup.c: Include "cloexec.h".
13 (main): Set the copy of stderr to close on exec.
15 2004-03-01 Paul Eggert <eggert@twinsun.com>
17 * configure.ac: Include <signal.h> when checking for strsignal,
18 sys_siglist, and friends. Problem reported by Toney Leneis in
19 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
21 2004-02-25 Paul Eggert <eggert@twinsun.com>
23 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
24 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
27 2004-02-23 Paul Eggert <eggert@twinsun.com>
29 * NEWS: Document how chown's USER.GROUP argument is now parsed.
31 2004-02-23 Jim Meyering <jim@meyering.net>
33 * src/seq.c (usage): Remove stray space after \n in --help output.
35 2004-02-22 Jim Meyering <jim@meyering.net>
37 * src/du.c (usage): Separate -H and --si. Say that the meaning
38 of -H will soon change to that of --dereference-args (-D).
40 2004-02-21 Jim Meyering <jim@meyering.net>
42 * src/comm.c (usage): Tell what comm does when there are no options.
43 Reword in terms of FILE1 and FILE2 rather than `left file' and
44 `right file'. Suggestion from Dan Jacobson.
46 2004-02-15 Paul Eggert <eggert@twinsun.com>
48 Fix some POSIX-conformance bugs in expr.
50 * NEWS: document the following changes to src/expr.c.
51 * doc/coreutils.texi (expr invocation): Likewise.
52 Document what forms integers may take, and say "integer"
53 consistently instead of "number". Warn about operands
54 that "expr" can misinterpret, and how to work around the
56 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
57 Accept a bool argument specifying whether to evaluate the
58 expression. This is to allow short-circuit evaluation. All
60 (null): Report that a string is zero even if it has
61 a form like "-0" or "00".
62 (eval1, eval): Use short-circuit evaluation for | and &.
63 (eval): Return 0 if both arguments are null or zero, instead
64 of returning the first argument.
65 * tests/expr/basic: Add some tests for the above.
67 2004-02-17 Jim Meyering <jim@meyering.net>
71 `make check' from a build inside a chroot environment would fail
72 * tests/help-version: Specify an argument (`/') for df, in the
73 unusual event that there is no valid entry in /etc/mtab.
74 Likewise for id: add the -u option, so we don't get spurious
75 failures when there are no user or group names.
78 * src/sort.c (usage) [-u]: Add punctuation so that the description in
79 the help2man-generated (line-joined) man page is more readable.
80 Reported by Tim Waugh.
81 [-T]: Add a semicolon, for the same reason.
83 2004-02-15 Jim Meyering <jim@meyering.net>
85 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
87 2004-02-11 Jim Meyering <jim@meyering.net>
89 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
90 $(srcdir)/../Makefile.am.in, rather than $<.
91 Suggestion from Michael Elizabeth Chastain.
93 2004-02-10 Jim Meyering <jim@meyering.net>
95 * config/install-sh: Make this script executable.
96 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
97 is executable. Otherwise, on systems that lack a suitable install
98 binary, `make install' would fail, because of the way this script
99 is invoked (without `$SHELL ' prefix).
100 Reported by Bob Proulx.
102 2004-02-08 Jim Meyering <jim@meyering.net>
106 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
107 that would cause an unwarranted test failure.
108 * tests/rm/rm3: Likewise.
110 2004-02-07 Jim Meyering <jim@meyering.net>
112 Remove xstat function pointer member. The way it was used was not
113 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
114 inline `stat' and `lstat' functions, thus making the tests of
115 `xstat == lstat' in copy.c always fail.
116 * src/copy.h (struct cp_options) [xstat]: Remove member.
118 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
119 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
120 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
121 (valid_options): Remove now-obsolete FIXME comments.
123 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
125 (do_copy): Declare/use local xstat rather than x->xstat.
126 (main): Remove code that set x.xstat.
127 * src/mv.c (cp_option_init): Don't initialize xstat member.
128 * src/install.c (cp_option_init): Likewise.
130 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
131 so that emit_upload_commands can use these variables, too.
133 2004-02-06 Jim Meyering <jim@meyering.net>
135 * tests/rm/deep-1: Remove `du' stack space test.
136 Apparently, `ulimit -s N' isn't portable enough.
137 This test will be restored (with a guard against losing ulimit)
138 in its own file later.
140 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
141 since this test doesn't take long enough to merit them.
142 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
144 * Makefile.maint (signatures): Remove definition.
145 Now, automake's gnupload handles this.
146 (%.sig: %): Remove now-unused rule.
147 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
148 `$(distdir).tar.bz2 $(distdir).tar.gz'.
149 (emit-upload-commands): Adjust to use gnupload.
151 2004-02-05 Jim Meyering <jim@meyering.net>
153 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
154 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
155 Now, those are all defined in timespec.h.
158 * src/date.c: Don't include timespec.h, now that system.h does it.
160 2004-02-02 Paul Eggert <eggert@twinsun.com>
162 Don't dump core if localtime returns NULL (possible on
163 hosts with 64-bit time_t and 32-bit int).
164 * src/date.c: Include "inttostr.h".
165 (batch_convert, main):
166 If time conversion fails, exit with nonzero status.
167 (show_date): Return int to report conversion failure.
168 Print the time as an int if localtime fails.
169 * src/uptime.c: Print "??" if the current clock can't
170 be converted by localtime. This won't happen until the year
171 2*31 + 1900, but we don't want to dump core even if the current
172 clock has the wrong value.
174 * src/stat.c: Include "inttostr.h".
175 (human_time): Print the date/time as a number of seconds since the
176 epoch if it can't be converted by localtime. This is better than
177 just saying "invalid", and is consistent with what "ls" does.
178 Don't dump core if the year has more than 48 digits; this isn't
179 possible on any contemporary host, but we might as well do it right.
181 2004-01-31 Paul Eggert <eggert@twinsun.com>
183 * src/stat.c (human_time): Accept time rather than
184 pointer-to-const-time parameter, for clarity. All callers changed.
186 2004-02-02 Jim Meyering <jim@meyering.net>
188 * src/stat.c (do_stat): Remove extra trailing newline from
189 default formats. Reported by Nelson H. F. Beebe.
191 Print actual fractional seconds in time stamps, not just `.00000000'.
192 * src/stat.c (human_time): Add and use new parameter, t_ns.
193 (print_stat): Update callers.
194 * src/ls.c (TIMESPEC_NS): Remove definition.
195 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
196 also uses this macro.
197 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
198 fractional seconds for files on an XFS file system, but that stat's
199 fractional seconds were always zero.
201 2004-01-28 Paul Eggert <eggert@twinsun.com>
203 * src/seq.c (print_numbers): Use 'double' for loop index, not
204 'int', to avoid problems with integer overflow. On almost all
205 machines 'double' works in every case where 'int' works, and
206 it works on other cases besides.
208 2004-01-27 Jim Meyering <jim@meyering.net>
210 * src/seq.c (usage): Mention that if INCREMENT is omitted,
211 it defaults to 1, even when FIRST is larger than LAST.
212 Reword so as not to exclude the possibility that INCREMENT be zero.
214 2004-01-25 Jim Meyering <jim@meyering.net>
218 * Makefile.maint (signatures): Comment out definition.
220 2004-01-23 Jim Meyering <jim@meyering.net>
222 * Makefile.maint (header_regexp): Add exitfail.
224 * man/Makefile.am (EXTRA_DIST): Add help2man.
225 Reported by Nelson H. F. Beebe.
227 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
228 so it works on systems with Perl installed somewhere other than in
231 * src/paste.c (paste_parallel): Declare local, chr, to be of type
232 `int', not `char', since it must hold EOF. This bug would make
233 paste infloop on some systems. Test failures reported by
234 Nelson H. F. Beebe and Christian Krackowizer.
236 2004-01-22 Jim Meyering <jim@meyering.net>
238 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
239 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
241 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
242 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
243 Use --info-page='coreutils PROG' option.
244 Now, readlink.1 refers the user to `info coreutils readlink'
245 rather than to `info readlink'. Reported by Matt Swift.
247 2004-01-21 Paul Eggert <eggert@twinsun.com>
251 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
252 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
253 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
254 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
255 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
256 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
257 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
258 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
259 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
260 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
261 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
262 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
263 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
264 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
265 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
266 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
267 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
269 * src/cat.c (usage): Don't bother normalizing exit status
270 since the arg is already the correct exit status now.
271 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
272 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
273 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
274 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
275 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
277 * src/chown.c (main): Removed unused local 'fail'.
279 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
282 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
283 * src/env.c, src/nice.c, src/su.c: Likewise.
284 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
285 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
286 * src/expr.c (main): Use initialize_exit_failure rather than
287 setting exit_failure directly; this optimizes away redundant
289 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
291 * src/chroot.c (main): Exit with status 1 rather than 127
292 if chroot itself fails, as per documentation.
294 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
295 rather than roll-your-own symbols or integers.
296 * src/env.c (main): Likewise.
297 * src/nohup.c (main): Likewise.
298 * src/su.c (run_shell): Likewise.
300 * src/cp.c (exit_status): Remove static var....
301 (main): Making it local here instead. Use =, not |=, to set it.
303 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
305 * src/date.c (batch_convert, main): Likewise.
306 * src/dd.c (dd_copy): Likewise.
307 * src/pr.c (first_last_page, main, getoptarg): Likewise.
308 * src/tr.c (main): Likewise.
309 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
310 POSIX doesn't require it.
311 * src/dd.c (write_output, skip, dd_copy): Likewise.
312 * src/df.c (main): Likewise.
313 * src/id.c (main): Likewise.
314 * src/install.c (main): Likewise.
315 * src/ln.c (main): Likewise.
316 * src/ls.c (main): Likewise.
317 * src/mv.c (main): Likewise.
318 * src/shred.c (main): Likewise.
320 * src/env.c (main): Exit with status 1, not 2, on errors detected
322 * src/hostname.c (main): Likewise.
323 * src/nl.c (main): Likewise.
324 * src/stty.c (main): Likewise.
326 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
327 consistency with the other programs' naming conventions.
330 * src/factor.c (main): Do not report a usage error simply
331 because stdin has bad numbers.
333 * src/id.c (problems): Now a boolean int, not a counter,
334 so that we don't have to worry about int overflow. All uses changed.
335 * src/touch.c (err): Likewise.
337 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
339 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
340 * src/mknod.c: Likewise.
342 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
343 on error; this is in case EXIT_FAILURE is unusual.
344 * src/su.c (main): Likewise.
346 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
347 changed to EXIT_CANNOT_INVOKE.
349 * src/printenv.c (PRINTENV_FAILURE): New constant.
350 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
351 command-line syntax problems.
353 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
354 (main): Avoid integer overflow when seeing whether errors occurred.
356 * src/seq.c (print_numbers): Now returns void, not (zero) int.
358 (main): Remove unused local variable 'errs'. Always exit successfully
361 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
362 for consistency with other programs here. All uses changed.
363 (main): Use 'error' to exit rather than invoking 'exit' here.
365 * src/sort.c: Don't include <assert.h>.
366 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
367 (usage): Don't use 'assert'.
368 (main): Remove redundant assignment to exit_failure.
370 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
372 (initialize_exit_failure): New inline function.
373 Include exitfail.h here, since we refer to exit_failure.
374 All callers changed to not include exitfail.h.
376 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
377 substitute them for the corresponding integer constants.
379 * tests/help-version (expected_failure_status_date): Remove, as
380 'date' is now normal.
381 (expected_failure_status_nohup): New var.
383 2004-01-21 Jim Meyering <jim@meyering.net>
385 * tests/touch/relative: Remove `command' syntax.
386 Thanks to Nelson H. F. Beebe and Paul Eggert.
388 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
389 so as to avoid problems with systems using TAI clocks.
390 Although it's no longer necessary, set TZ=UTC0 also for the
391 initial touch command. Reported by Paul Jarc here:
392 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
394 2004-01-20 Diego Biurrun <diego@biurrun.de>
396 * src/dircolors.hin: Add .mov to the list of media files.
398 2004-01-19 Paul Eggert <eggert@twinsun.com>
400 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
401 portable). Problem reported by Christian Krackowizer. Also, use
402 +0000 rather than +0 to specify a time zone, as the documentation
403 requires four digits.
405 2004-01-19 Jim Meyering <jim@meyering.net>
407 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
408 * tests/mv/backup-is-src: Likewise.
409 Problem reported by Peter Horst
411 2004-01-17 Jim Meyering <jim@meyering.net>
413 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
417 2003-12-15 Paul Eggert <eggert@twinsun.com>
419 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
420 with -r specifying the origin for -d.
421 * src/touch.c (flexible_date): Remove static var.
422 (get_reldate): New function.
423 (main): Use it, to implement this new behavior.
425 2004-01-16 Jim Meyering <jim@meyering.net>
427 * tests/touch/relative: New test for the above.
428 * tests/touch/Makefile.am (TESTS): Add relative.
430 2004-01-13 Jim Meyering <jim@meyering.net>
432 * src/system.h: Include contents of sys2.h.
433 * src/sys2.h: Remove file.
434 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
436 * Use automake-1.8.2. Regenerate dependent files.
438 * Update to gettext-0.13.1.
439 * configure.ac: Use gettext-0.13.1.
440 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
442 2004-01-12 Jim Meyering <jim@meyering.net>
444 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
446 * Makefile.maint (po-check): Ensure that cvsu works before using it.
447 Reported by Alexandre Duret-Lutz.
449 * src/tail.c (main): Warn about following stdin only when it's a tty.
451 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
453 2004-01-10 Jim Meyering <jim@meyering.net>
455 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
457 2004-01-09 Jim Meyering <jim@meyering.net>
459 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
461 2004-01-08 Jim Meyering <jim@meyering.net>
463 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
466 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
467 remnant) from PATH component. That would cause tests in this directory
468 not to run the just-built binaries, but rather whatever happened
469 to be in one's PATH. Reported by Christian Krackowizer.
471 2004-01-04 Jim Meyering <jim@meyering.net>
473 * src/csplit.c (new_control_record): Use x2nrealloc
474 rather than xrealloc.
476 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
478 (make_path_private): Likewise.
480 2004-01-03 Jim Meyering <jim@meyering.net>
482 * src/paste.c: Use `bool' (not int) as the type for a few
484 (collapse_escapes): Rewrite to set globals rather than modifying
486 Use size_t (not int) for all counters and related index variables.
487 (paste_parallel): Remove needless complexity of
488 using xrealloc in the loop; just allocate the buffers up front.
489 Free the two temporary buffers.
490 Move declarations of locals `down' into scope where used.
491 (paste_serial): Remove `register' attributes.
492 (main): Simplify delim-related code.
493 Free `delims', now that it's malloc'd.
495 2004-01-02 Jim Meyering <jim@meyering.net>
497 * src/chroot.c: Include "quote.h".
498 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
499 (main): Exit with status of 127, not 1, for too-few-args,
500 chroot failure, or chdir failure.
501 Give a better diagnostic upon execvp failure.
503 * src/du.c (usage): Mention that, with its current meaning,
506 * src/tail.c (main): Warn about following stdin when it's a tty.
507 Fail when following by name but no names are specified.
509 2003-12-30 Jim Meyering <jim@meyering.net>
511 * src/fold.c (main): Use memcpy, not strcpy.
513 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
516 2003-12-28 Jim Meyering <jim@meyering.net>
518 * src/unexpand.c (n_tabs_allocated): New global.
519 (add_tabstop): Use x2nrealloc rather than xrealloc.
520 * src/expand.c: Likewise.
522 * tests/misc/expand: New file.
523 * tests/misc/Makefile.am (TESTS): Add expand.
525 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
526 (fillbuf): Use x2nrealloc rather than xrealloc.
527 (sort): Use xnmalloc rather than xmalloc.
530 2003-12-27 Jim Meyering <jim@meyering.net>
532 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
534 2003-12-29 Paul Eggert <eggert@twinsun.com>
536 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
537 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
539 * doc/coreutils.texi (join invocation): Remove documentation
540 accordingly. Document that -t makes all separators significant.
542 * src/join.c: Include posixver.h.
543 (obsolete_usage): New var.
544 (longopts): Put obsolete options first.
545 (OBSOLETE_LONG_OPTIONS): New constant.
546 (get_option, add_file_name): New functions.
547 (main): Use them to support new behavior.
548 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
549 Do not mark -j FIELD as obsolescent; it is longstanding
550 UNIX tradition and is a valid extension to POSIX.
552 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
554 2003-12-28 Paul Eggert <eggert@twinsun.com>
556 * src/join.c (add_field_list): Don't use alloca with unbounded
557 size; just modify the argument, which is no longer const *.
559 Various other minor cleanups, mostly to avoid the need for casts.
561 (extract_field): Renamed from ADD_FIELD, as it's now a function.
563 (struct field.beg): Now char *, not unsigned char const *. All
564 uses changed. It shouldn't be const since xmemcoll writes on its
566 (extract_field): Likewise, for 2nd arg.
567 (keycmp): Remove now-unnecessary cast of xmemcoll args.
569 (is_blank): New function, to avoid need to cast arg to unsigned char.
570 (extract_field): Use it.
572 (xfields): Rewrite pretty much from scratch.
574 (hard_LC_COLLATE): Now bool, not int.
575 (get_line, getseq, add_field_list): Now returns bool, not int.
576 (decode_field_spec, add_field_list): Return true on success (not
577 false), for consistency with the rest of the code. All uses changed.
579 (tab): Now char, not unsigned char. This wasn't 100% necessary
580 but is slightly cleaner.
581 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
583 (empty_filler): Now const *.
585 (make_blank): Remove; wasn't needed. Remove all calls.
586 (main): Don't set uni_blank.nfields; zero is fine.
588 2003-12-27 Jim Meyering <jim@meyering.net>
590 * src/join.c: Include "quote.h".
591 (min, max): Remove definitions.
592 Make a few function parameters and corresponding
593 locals `const'. Use bool for boolean variables.
594 Use size_t (not int) for all counters and related index variables.
595 (prjoin): Remove now-useless assertion.
596 (string_to_join_field): New function.
597 (main): Accept join fields as large as SIZE_MAX.
598 (keycmp): Rename `min' to MIN and max to MAX.
600 2003-12-26 Jim Meyering <jim@meyering.net>
602 fold -s didn't work on e.g., alpha-based systems.
603 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
604 x2nrealloc works properly on systems with differing sizes for int
605 and size_t. Reported by Nelson Beebe.
607 * src/fold.c: Use `bool' (not int) as the type for a few
610 2003-12-23 Paul Eggert <eggert@twinsun.com>
612 * src/ls.c (length_of_file_names_and_frills):
613 Remove forward decl; not needed.
614 (print_file_name_and_frills, length_of_file_name_and_frills):
615 With -m, don't output spaces before inum or size.
616 (print_with_commas): Don't output space just before newline.
618 2003-12-24 Jim Meyering <jim@meyering.net>
620 * tests/ls/Makefile.am (TESTS): Add m-option.
621 * tests/ls/m-option: New file. Test for above fixes.
623 2003-12-20 Jim Meyering <jim@meyering.net>
627 * src/pr.c: Change type of global, buff_allocated, to size_t.
629 * src/join.c [struct seq]: Change types of members count and alloc
630 from `int' to `size_t'.
632 * tests/Makefile.am (root-hint): Tweak wording.
634 * src/du.c: Accept new option (-0, --null) that makes it so each
635 output line is NUL-terminated rather than newline-terminated.
637 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
638 Reported by Volker Paul.
639 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
640 * tests/dd/unblock-sync: New test for the above.
642 2003-12-19 Jim Meyering <jim@meyering.net>
644 * tests/misc/nohup: Double quote back-ticked expression,
645 in case it ends up having an unexpected value.
647 * tests/ls/no-arg: Use ls's -1 option in both runs.
649 * src/du.c (fts_debug): New global.
650 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
651 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
652 (main) [DU_DEBUG]: Accept -d option.
654 2003-12-18 Jim Meyering <jim@meyering.net>
656 * src/ls.c (format_user): Increment dired_pos via two statements,
657 `dired_pos += width; dired_pos++;' rather than one,
658 `dired_pos += width + 1;' since the latter could conceivably overflow.
659 (format_group): Likewise.
662 * configure.ac: Require automake-1.8.
664 2003-12-12 Jim Meyering <jim@meyering.net>
666 * Use automake-1.8. Regenerate dependent files.
668 2003-12-08 Jim Meyering <jim@meyering.net>
670 * Makefile.maint (news-date-check): New rule.
671 (alpha beta major): Depend on it.
673 2003-12-03 Paul Eggert <eggert@twinsun.com>
675 * NEWS: ls -l (and similar options) now adjust all columns to
676 fit the data. Generalized from a suggestion by Leah Q for file sizes.
677 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
678 (format_user_width, format_group_width, unsigned_file_size,
679 format_group): New functions.
680 (block_size_width): Renamed from block_size_size.
681 (inode_number_width, nlink_width, owner_width, group_width,
682 author_width, major_device_number_width, minor_device_number_width,
683 file_size_width): New vars.
684 (clear_files): Initialize them.
685 (gobble_file): Set them. Don't ceiling block_size_width to 7.
686 (print_long_file): Use them.
687 (gobble_file): Use a new local variable 'f' to make the code
688 smaller and more consistent with other functions.
689 (format_user): Output to stdout, not to a buffer, so that we
690 don't have to worry about buffer overrun. Update dired_pos.
691 (print_long_file): Don't put owner, group, author into buffer;
692 just print them directly. Don't assume link counts and
693 major and minor numbers fit into unsigned long int.
694 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
695 'ls' output is fixed-width.
697 2003-12-02 Jim Meyering <jim@meyering.net>
699 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
701 2003-11-27 Jim Meyering <jim@meyering.net>
703 * Use automake-1.7f. Regenerate dependent files.
705 2003-11-24 Paul Eggert <eggert@twinsun.com>
707 Parse floating-point operands and options in the C locale.
708 POSIX requires this for printf, and we might as well be
709 consistent elsewhere (tail, sleep, seq).
711 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
712 needed now that we assume C89. Include "c-strtod.h".
713 (xstrtod): Call c_strtod, not strtod.
714 * src/sleep.c: Include "c-strtod.h".
715 (main): Update xstrtod call to include new argument, c_strtod.
716 * src/seq.c (scan_double_arg): Likewise.
717 * src/tail.c (parse_options): Likewise.
719 2003-11-24 Jim Meyering <jim@meyering.net>
721 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
722 Reported by Mark Conty.
724 2003-11-22 Jim Meyering <jim@meyering.net>
726 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
727 (sc_system_h_headers): Do this test only if sys2.h exists.
729 2003-11-20 Jim Meyering <jim@meyering.net>
731 * tests/help-version: Ensure that the bug-reporting address is
732 included in the --help output for every program.
733 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
735 * src/ptx.c (usage): Output bug-reporting address.
736 Reported by Dan Jacobson.
738 2003-11-19 Jim Meyering <jim@meyering.net>
740 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
741 on the join fields. Suggestion from Bruce Robertson.
743 2003-11-18 Jim Meyering <jim@meyering.net>
745 `od -c -w9999999' could segfault
746 * src/od.c (dump): Use xnmalloc/free, not alloca.
748 2003-11-16 Jim Meyering <jim@meyering.net>
750 * Use autoconf-2.59. Regenerate dependent files.
752 * tests/du/hard-link: Minor tweak: use mkdir -p.
754 Fix read-from-free'd-buffer error detected by valgrind.
755 * src/csplit.c (remove_line): Don't return a pointer to data in
756 a freed buffer. Instead, arrange to free the buffer on the
759 * tests/misc/csplit: New test for above fix.
761 2003-11-11 Jim Meyering <jim@meyering.net>
763 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
764 This avoids a warning from valgrind about memcpy with overlapping
765 source and destination.
767 * configure.ac: Require automake-1.7.8.
769 2003-11-09 Jim Meyering <jim@meyering.net>
771 * Use automake-1.7.9. Regenerate dependent files.
773 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
774 * src/chown.c: Likewise.
776 * src/chown-core.c: Include "root-dev-ino.h".
777 (chopt_init): Initialize new member.
778 (change_file_owner): Support rm's new --preserve-root option.
780 * src/remove.c: Include "root-dev-ino.h".
781 (remove_cwd_entries): Remove now-obsolete FIXME comment.
782 (remove_dir): Support rm's new --preserve-root option.
784 * src/chown.c: Include "root-dev-ino.h".
785 Add new options: --preserve-root and --no-preserve-root.
787 * src/chmod.c: Include "root-dev-ino.h".
788 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
789 ROOT_DEV_INO_WARN macros.
790 (get_root_dev_ino): Remove function definition, now that it's
791 been moved to a separate file.
792 (usage): Describe new options.
794 * src/mv.c (rm_option_init): Initialized new member.
796 * src/remove.h: Include "dev-ino.h".
797 (struct rm_options): Add new member: root_dev_ino.
798 * src/chown-core.h: Include "dev-ino.h".
799 (struct Chown_option): Add new member: root_dev_ino.
801 2003-11-06 Jim Meyering <jim@meyering.net>
803 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
804 hard-coding `sizeof FILE*'.
806 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
808 * src/wc.c (main): Free `fstatus' so there is no confusion about
809 whether it's leaked or not.
810 * src/who.c (who): Likewise for `utmp_buf'.
812 2003-11-05 Paul Eggert <eggert@twinsun.com>
814 Fix 'cut' problems with size_t overflow and unsigned int.
815 More generally, resize integer variables to fit use more precisely.
816 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
817 (struct range_pair): Make members to be of type size_t, not unsigned.
818 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
819 (suppress_non_delimited, output_delimiter_specified,
820 have_read_stdin, print_kth, set_fields): Now bool, nt int.
821 (delim): Now unsigned char, not int.
822 (mark_printable_field, is_printable_field, is_range_start_index,
823 set_fields, set_fields, cut_bytes, cut_fields):
824 Use size_t, not unsigned, for field and byte counts.
825 (hash_int): Use uintptr_t, not unsigned, for pointers converted
826 to integers. This squeezes more info out of them.
827 (set_fields, cut_bytes, cut_fields, main):
828 Use bool, not int, for booleans.
829 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
831 2003-11-05 Paul Eggert <eggert@twinsun.com>
833 * man/Makefile.am (check-programs-vs-x):
834 Work even if $(programs) contains '$'.
835 Work even if 'missing=1' in environment.
836 Don't report an error simply because $(programs) outputs nothing.
838 2003-11-05 Jim Meyering <jim@meyering.net>
840 * Use autoconf-2.58. Regenerate dependent files.
842 * src/tr.c (spec_init): Fix typo in last change.
844 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
845 call to variadic version_etc function, so that it works even on systems
846 for which sizeof char* != sizeof int.
847 * src/true.c (main): Likewise.
848 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
849 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
850 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
851 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
852 Similarly, cast NULL to `(char *)' in call to variadic function,
853 parse_long_options, so that it works even on systems for which
854 sizeof char* != sizeof int.
855 A similar problem was reported by Harti Brandt in
856 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
858 * src/users.c (users): Free `utmp_buf' explicitly so that people
859 don't mistake this for a real leak.
860 Patch by Dennis Smit <ds@nerds-incorporated.org.
862 2003-11-04 Paul Eggert <eggert@twinsun.com>
864 * README: Document _POSIX2_VERSION.
866 2003-11-04 Jim Meyering <jim@meyering.net>
868 * src/tac.c (memrchr): Remove #if-0'd function.
869 (tac_stdin_to_mem): Clean up #if-0'd code.
871 * src/od.c (decode_format_string): Remove unnecessary casts.
872 Use more maintainable `sizeof *var'.
873 (main): Call decode_format_string rather than decode_one_format,
874 now that `spec' may be NULL.
876 * src/chmod.c (AUTHORS): Add my name.
878 * src/split.c (next_file_name): Use `sizeof *var' rather than
879 hard-coding `sizeof size_t'.
881 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
883 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
884 to avoid potential overflow in pointer arithmetic.
885 (set_fields): Use not `1', but rather `sizeof *printable_field' as
886 second argument to xcalloc.
887 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
888 rather than xrealloc.
889 * src/date.c (show_date): Likewise.
890 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
891 * src/pr.c (store_char): Likewise.
892 * src/fold.c (fold_file): Likewise.
894 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
895 type changes (unsigned int -> size_t) in hash.c.
896 * src/cp-hash.c (src_to_dest_hash): Likewise.
897 * src/du.c (entry_hash): Likewise.
898 * src/ls.c (dev_ino_hash): Likewise.
899 * src/cut.c (hash_int): Likewise. Declare function as static.
901 2003-11-03 Jim Meyering <jim@meyering.net>
903 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
904 * tests/misc/fold: Fail the test immediately if we're not running
905 the expected version of fold.
907 2003-11-02 Jim Meyering <jim@meyering.net>
909 * src/tr.c (append_normal_char, append_range, append_char_class)
910 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
911 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
913 * src/copy.c (copy_internal): Likewise.
914 * src/join.c (initseq, add_field, make_blank): Likewise.
915 * src/od.c (main): Likewise.
916 * src/cp.c (make_path_private): Likewise.
917 * src/tsort.c (new_item, record_relation): Likewise.
919 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
920 (main): Also remove anachronistic cast of xmalloc return value.
921 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
922 (main): Also remove anachronistic cast of xmalloc return value.
923 * src/sort.c (inittables): Likewise.
924 (sort): Also Split a long line.
926 2003-10-25 Jim Meyering <jim@meyering.net>
928 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
929 type changes (unsigned int -> size_t) in hash.c.
930 * src/cp-hash.c (src_to_dest_hash): Likewise.
931 * src/du.c (entry_hash): Likewise.
932 * src/ls.c (dev_ino_hash): Likewise.
933 * src/cut.c (hash_int): Likewise. Declare function as static.
935 2003-10-21 Jim Meyering <jim@meyering.net>
937 Don't fail when run with VERBOSE=yes.
938 * tests/chgrp/basic: Do `set +x' before starting the subshell
939 from which we invoke chgrp. Otherwise, the output from the
940 VERBOSE=yes-induced `set -x' would result in spurious differences.
941 Reported by Russel Coker via Michael Stone.
943 2003-10-19 Jim Meyering <jim@meyering.net>
945 chmod now uses fts to perform a directory traversal when -R is
946 specified. Before, it operated on full path names, and as such
947 would encounter the PATH_MAX (often 4096) limit.
949 * src/chmod.c: Include "xfts.h".
950 (process_file): Rename from change_file_mode.
951 Adapt to be used with fts.
952 (process_files): New function.
954 2003-10-18 Jim Meyering <jim@meyering.net>
956 * tests/du/deref-args: Ensure that du -D now dereferences all
957 symlinks specified on the command line, not just those that
958 reference directories.
960 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
961 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
962 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
963 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
964 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
965 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
966 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
967 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
968 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
969 Update the call to parse_long_options so that `AUTHORS, NULL' are the
971 * src/true.c (main): Append NULL to version_etc argument list.
972 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
974 2003-10-17 Andreas Schwab <schwab@suse.de>
976 * tests/mk-script: Get $srcdir from first parameter instead of
978 (main): Update usage.
980 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
981 first argument of mk-script.
982 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
984 2003-10-17 Jim Meyering <jim@meyering.net>
986 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
987 generated `man' page is more readable. Suggestion from Dan Jacobson.
989 * src/chown-core.c (change_file_owner): Handle the cases in
990 which fts_info indicates an error with the given entry.
992 * src/du.c (main): Simply assign to bit_flags.
993 Don't bother with bit arithmetic.
995 * tests/chmod/no-x: New file.
996 * tests/chgrp/no-x: New file.
997 * tests/chmod/Makefile.am (TESTS): Add no-x.
998 * tests/chgrp/Makefile.am (TESTS): Likewise.
1000 * src/du.c: Include "xfts.h".
1001 (du_files): Use xfts_open, rather than fts_open.
1002 * src/chown-core.c (chown_files): Likewise.
1004 2003-10-16 Jim Meyering <jim@meyering.net>
1006 * src/chgrp.c (main): Simply assign to bit_flags.
1007 Don't bother with bit arithmetic.
1008 * src/chown.c (main): Likewise.
1009 Rename a couple of local variables.
1010 Remove unnecessary casts.
1012 * src/tail.c (start_bytes): Rename local, remainder, to avoid
1013 gcc's warning about shadowing a global.
1015 2003-10-15 Jim Meyering <jim@meyering.net>
1017 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
1018 use fts to perform a directory traversal when -R is specified.
1019 Before, they operated on full path names, and as such would
1020 encounter the PATH_MAX (often 4096) limit.
1021 They are more efficient. For example, before, chgrp -R would
1022 take almost 5 seconds to change about 2000 directories and fail
1023 (with `File name too long'), while now it succeeds on a hierarchy
1024 of depth 20,000 in 1/10 the time.
1026 * src/chown.c: Include "userspec.h" and "fts_.h".
1027 (WRITTEN_BY): Add my name.
1028 (getpwnam, getgrnam, getgrgid): Remove declarations.
1029 (endpwent): Remove definition.
1031 (main): Handle new options.
1032 Call new function, chown_files rather than change_file_owner.
1034 * src/chgrp.c: Include "fts_.h".
1035 (WRITTEN_BY): Add my name.
1036 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
1039 (main): Handle new options.
1040 Call new function, chown_files rather than change_file_owner.
1042 Rewrite to iterate through hierarchies using fts rather than
1043 via explicit recursion.
1044 * src/chown-core.c: Include "fts_.h"
1045 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
1046 on a single file at a time.
1047 (chown_files): New function.
1048 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
1049 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
1050 [struct Chown_option] (dereference): Remove member with ambiguous name.
1051 [struct Chown_option] (affect_symlink_referent): New member.
1052 (chown_files): New prototype.
1054 * tests/chgrp/recurse: Update tests accordingly.
1055 * tests/chgrp/posix-H: New tests for the above.
1056 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
1058 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
1059 work even for superuser. Suggestion from Dan Jacobson.
1061 2003-10-14 Paul Eggert <eggert@twinsun.com>
1063 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
1065 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
1066 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
1067 * src/sort.c (parse_field_count): Handle the case where overflow
1068 and invalid suffix char are both reported.
1070 2003-10-14 Jim Meyering <jim@meyering.net>
1072 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
1073 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
1076 2003-10-13 Paul Eggert <eggert@twinsun.com>
1078 Fix to avoid a denial-of-service attack if the display width is
1079 enormous. Also, clean up the code a bit by removing duplicate code.
1081 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
1082 (calculate_columns): New function, that contains code that used
1083 to be common to print_many_per_line and print_horizontal.
1084 (print_many_per_line, print_horizontal): Use it.
1085 (decode_switches): Set max_idx here, not in calculate_columns.
1086 (print_current_files): Don't call init_column_info; calculate_columns
1088 (init_column_info): Don't allocate a lot more space than is needed
1089 to represent the current set of files. Allocate all the new
1090 size_t cells in one call to xnmalloc, rather than a row at a time.
1092 2003-10-13 Jim Meyering <jim@meyering.net>
1094 * src/ls.c (init_column_info): Add another FIXME comment.
1096 2003-10-13 Paul Eggert <eggert@twinsun.com>
1098 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
1099 Remove several arbitrary limits on hosts where int cannot represent
1102 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
1103 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
1104 struct column_info.col_arr[0], max_idx):
1105 Now size_t, not int.
1106 (get_funky_string): Return bool indicating success, instead of
1107 a negative count to indicate failure. Store number of columns
1108 through new parameter OUTPUT_COUNT; that way, they can never
1109 go negative. Change equals_end from int to bool. All uses
1111 (struct column_info.valid_len): Now bool, not int. All uses changed.
1112 (dired_dump_obstack, get_funky_string, clear_files,
1113 extract_dirs_from_files, print_current_files,
1114 print_many_per_line, print_horizontal, init_column_info,
1115 put_indicator, length_of_file_name_and_frills,
1116 print_with_commas): Use size_t, not int, for local variables
1118 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
1119 Check for TIOCGWINSZ returing negative values (or values greater
1121 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
1123 Use xmalloc and xnmalloc, not XMALLOC.
1124 (gobble_file): Use xnrealloc, not XREALLOC.
1125 (print_color_indicator): Remove now-unnecessary cast to size_t.
1127 2003-10-12 Paul Eggert <eggert@twinsun.com>
1129 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
1130 * tests/sort/sort-tests: Remove from CVS; assume that people
1131 brave enough to check coreutils out from CVS can rebuild it.
1133 2003-10-12 Jim Meyering <jim@meyering.net>
1135 New options: --preserve-root and --no-preserve-root.
1136 * src/chmod.c (change_file_mode): Honor new option.
1137 (change_file_mode): Strip trailing slashes on directory
1138 argument passed to change_dir_mode.
1139 (get_root_dev_ino): New function.
1140 (main): Initialize global, root_dev_ino.
1142 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
1143 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
1145 * src/chmod.c (change_file_mode): Likewise.
1147 2003-10-08 Jim Meyering <jim@meyering.net>
1149 * src/csplit.c (main): Remove obsolete FIXME.
1151 2003-10-07 Jim Meyering <jim@meyering.net>
1153 * Use automake-1.7.8. Regenerate dependent files.
1155 2003-09-29 Paul Eggert <eggert@twinsun.com>
1159 * doc/coreutils.texi (csplit invocation):
1160 The regexp offset need not have a sign; POSIX requires support
1161 for signless offets.
1163 Be more careful about int widths. For example, remove some
1164 arbitrary limits by replacing 'unsigned' with 'size_t',
1165 'uintmax_t', etc. Use standard bool rather than a homegrown type.
1166 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
1167 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
1168 to <stdbool.h> usage.
1169 (struct control): offset is now intmax_t, not int.
1170 repeat_forever is now bool, not int.
1171 (struct cstring): len is now size_t, not unsigned int.
1172 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
1173 size_t, not unsigned. start_line, first_available are now
1174 uintmax_t, not unsigned.
1175 (hold_count, control_used): Now size_t, not unsigned.
1176 (last_line_number, current_line, bytes_written):
1177 Now uintmax_t, not unsigned.
1178 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
1179 create_new_buffer, get_new_buffer, load_buffer, find_line,
1180 process_regexp, split_file, new_control_record, extract_regexp,
1181 get_format_width, get_format_prec, max_out):
1182 size args, locals, and returned values are now size_t, not unsigned
1184 (get_first_line_in_buffer, find_line, write_to_file,
1185 handle_line_error, process_line_count, regexp_error, process_regexp,
1187 File line, byte, and repetition counts are now uintmax_t, not unsigned.
1188 (check_for_offset): Don't require a sign before the offset.
1189 Use xstrtoimax to do the real work.
1190 (extract_regexp): Remove harmful cast of size to unsigned.
1191 256 -> 1<<CHAR_BIT, for clarity.
1192 (get_format_flags): Return at most 3, to avoid worries about overflow.
1194 (bytes_to_octal_digits): Remove.
1196 (cleanup): Don't check whether output_stream is NULL, since
1197 close_output_file does that for us.
1199 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
1200 (sizeof *p);" instead of the more long-winded alternatives.
1202 (get_new_buffer): Use O(1) algorithm for resizing a buffer
1203 to a much larger size, instead of an O(N) algorithm.
1205 (process_regexp): Use plain NULL rather than casted 0.
1207 (make_filename): Use %u, not %d, to format unsigned file number.
1209 (new_control_record): Use xrealloc exclusively, since it handles
1212 (extract_regexp): Change misspelled word in diagnostic.
1214 (get_format_width): Even if a minimum field width is specified,
1215 allow room for enough octal digits to represent the value of
1216 the maximum representible integer. This fixes a potential
1217 buffer overrun. Calculate this room at compile-time, not
1218 at run-time; this removes the need for bytes_to_octal_digits.
1219 Check for overflow; this removes a FIXME.
1221 (get_format_prec): Don't allow precision to be signed; it's
1222 not ANSI. Check for overflow. Remove hardcoded "11" as
1223 default precision; this fixes a potential buffer overrun
1224 on hosts with wider size_t.
1226 (get_format_conv_type): Change local variable to be of type
1227 unsigned char, not int; this removes a potential subscript
1228 violation on hosts where char is signed.
1230 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
1231 Allow "%%" in format. Don't overflow when
1232 counting lots of percents.
1234 (usage): Default sprintf format is %02u, not %d.
1236 2003-10-05 Jim Meyering <jim@meyering.net>
1238 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
1240 * src/du.c (du_files): Mark diagnostic for translation.
1242 2003-10-04 Jim Meyering <jim@meyering.net>
1244 * src/du.c (du_files): Ignore any failure of fts_close.
1245 Give better diagnostics for failed fts_open.
1247 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
1249 Deprecate existing use of -H (aka --si).
1250 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
1251 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
1252 (main): Warn that the meaning of -H will soon change to be
1255 2003-10-03 Jim Meyering <jim@meyering.net>
1257 * src/du.c: Accept --no-dereference (-P).
1259 2003-10-02 Jim Meyering <jim@meyering.net>
1261 * tests/du/trailing-slash: Adjust for slightly different output.
1263 Rewrite du.c to use fts.
1264 * src/du.c: Include "fts_.h", not ftw.h.
1265 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
1266 (IS_FTW_DIR_TYPE): Remove definition.
1267 (IS_DIR_TYPE): Define.
1268 (is_symlink_to_dir): Remove now-unnecessary function.
1269 (process_file, du_files): Rewrite to use fts.
1271 * tests/du/inaccessible-cwd: Ensure that even when run from an
1272 inaccessible directory, du can still operate on accessible
1273 directories elsewhere.
1274 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
1276 * tests/rm/deep-1: Ensure that du can process a hierarchy
1277 of depth 400 while using no more than 50KB of stack space.
1279 2003-10-01 Akim Demaille <akim@epita.fr>
1281 * announce-gen (print_news_deltas): New function, extracted from main.
1282 (main): Make `news_file' an array.
1283 Use '...=s' => \@var for --news and --url-directory specs.
1284 Before there were a couple of portability problems.
1286 2003-09-28 Jim Meyering <jim@meyering.net>
1288 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
1289 (syntax-check-rules): Add it.
1291 * src/copy.c: Remove unnecessary cast of alloca, since now it's
1292 guaranteed to be (void *).
1293 * src/cp.c: Likewise.
1294 * src/join.c: Likewise.
1295 * src/ln.c: Likewise.
1296 * src/ls.c: Likewise.
1297 * src/od.c: Likewise.
1298 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
1300 2003-09-27 Jim Meyering <jim@meyering.net>
1302 Don't exhaust virtual memory when processing large inputs.
1303 Fix this by removing csplit's internal free-list management;
1304 instead rely on malloc for that.
1306 * src/csplit.c (free_list): Remove global.
1307 (clear_all_line_control): Remove function.
1308 (get_new_buffer): Always use create_new_buffer to obtain a
1309 new buffer, rather than searching free_list.
1310 (free_buffer): Just call free.
1311 Reported by Nikola Milutinovic.
1313 2003-09-26 Jim Meyering <jim@meyering.net>
1315 * man/rm.x: Also list `chattr' in SEE ALSO section.
1316 Suggestion from Mark Hubbart.
1318 2003-09-25 Jim Meyering <jim@meyering.net>
1320 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
1321 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
1323 * Use autoconf-2.57d. Regenerate dependent files.
1325 2003-09-24 Jim Meyering <jim@meyering.net>
1327 Minor efficiency tweak.
1328 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
1329 (do_link): Likewise.
1331 2003-09-23 Jim Meyering <jim@meyering.net>
1333 * src/paste.c (paste_serial): Save errno after input error,
1334 to report proper errno value.
1335 Based on a patch from Paul Eggert.
1337 * src/tee.c (tee): Adjust fwrite arguments so that the return
1338 value is the number of bytes written.
1340 2003-09-16 Paul Eggert <eggert@twinsun.com>
1342 Don't assume ferror sets errno. Bug reported by Bruno Haible.
1344 * src/comm.c (compare_files): Save errno after input error,
1345 to report proper errno value.
1346 * src/fold.c (fold_file): Likewise.
1347 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
1348 * src/unexpand.c (unexpand): Likewise.
1350 * src/csplit.c (close_output_file): Don't report bogus errno value
1351 after ferror discovers an output error. We don't know the proper
1352 errno value, since it might have been caused by any of a whole
1353 bunch of calls, and it might have been trashed in the meantime.
1354 Fixing this problem will require much more extensive changes;
1355 in the meantime just say "write error".
1356 * src/od.c (check_and_close, dump, dump_strings): Likewise.
1357 * src/uniq.c (check_file): Likewise.
1359 * src/join.c (get_line): Report error right away if I/O fails,
1360 so that the proper errno value is used.
1361 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
1362 * src/tee.c (tee): Likewise.
1363 * src/uniq.c (check_file): Likewise.
1365 * src/od.c (skip): If a read fails, don't retry it later, so
1366 that we report the proper errno.
1368 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
1370 * src/tee.c (tee): Once a write failure has occurred, don't bother
1371 writing anything more to that stream.
1373 * src/uniq.c (check_file): Check for ferror (stdout) even if
1376 * src/yes.c (UNROLL): Remove.
1377 (main): Exit immediately when write failure is detected.
1378 Simplify code by assigning to argv when argc == 1.
1380 2003-09-21 Paul Eggert <eggert@twinsun.com>
1382 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
1383 (WRITTEN_BY): Change "Franc,ois" (actually using
1384 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
1387 2003-09-19 Jim Meyering <jim@meyering.net>
1389 `du -D symlink-to-dir' would mistakenly omit the slash in
1390 lines like this: 24 symlink-to-dir/subdir
1391 * src/du.c (process_file): Fix offset calculation.
1392 Reported by Jeff Sheinberg as Debian bug #211591;
1393 http://bugs.debian.org/205251
1395 * tests/du/deref-args: New file/test for the above.
1396 * tests/du/Makefile.am (TESTS): Add deref-args.
1398 * src/du.c (process_file): Remove useless disjunct.
1400 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
1402 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
1403 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
1404 Mark each WRITTEN_BY string as translatable.
1406 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
1407 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
1408 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
1409 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
1410 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
1411 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
1412 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
1413 * who.c, whoami.c, yes.c: Revert yesterday's changes.
1414 Instead, a subsequent change will embed `Written by ' in
1415 each string along with the author names.
1417 * src/true.c: Revert yesterday's changes.
1418 * src/sys2.h: Likewise.
1420 2003-09-18 Jim Meyering <jim@meyering.net>
1422 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
1423 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
1424 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
1425 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
1426 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
1427 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
1428 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
1429 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
1430 comma-separated list of strings and/or update the call to
1431 parse_long_options so that `AUTHORS, NULL' are the last parameters.
1432 * src/true.c (main): Append NULL to version_etc argument list.
1433 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
1435 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
1436 shadowing the math function name. Also rename loga to log_a.
1438 2003-09-14 Jim Meyering <jim@meyering.net>
1440 * src/factor.c (print_factors): Give a separate diagnostic
1441 for numbers that are too large, but otherwise valid.
1442 Reported by Dániel Varga.
1444 2003-09-10 Jim Meyering <jim@meyering.net>
1446 * Use automake-1.7.7. Regenerate dependent files.
1448 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
1449 of `fmt -1'. Using the just-built tr is a little cleaner.
1450 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
1451 * man/Makefile.am (programs, check-x-vs-1): Likewise.
1453 2003-09-09 Jim Meyering <jim@meyering.net>
1455 * src/copy.c: Alphabetize includes.
1456 Remove duplicate inclusion of "same.h".
1458 2003-09-08 Jim Meyering <jim@meyering.net>
1460 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
1461 Didn't give enough of a benefit, mainly because it's not yet
1466 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
1467 (check-programs-vs-x): Fail if $(programs) is empty.
1469 * src/remove.c: Add a comment.
1471 2003-09-07 Jim Meyering <jim@meyering.net>
1473 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
1474 Don't define. These symbols are no longer used.
1476 * tests/misc/tty-eof: Write ^D as \cD.
1477 Complete the change of 2003-08-02.
1479 * Makefile.maint (po-check): Use cvsu, so that a temporary source
1480 file in lib/ or src/ doesn't induce an unwarranted failure.
1481 Add a kludge to filter out the sole generated source file that
1482 also has translatable messages: src/false.c.
1484 2003-09-06 Jim Meyering <jim@meyering.net>
1486 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
1487 (parse_options): Give a diagnostic for (but still accept) the
1488 deprecated --allow-missing option.
1490 2003-09-04 Paul Eggert <eggert@twinsun.com>
1492 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
1493 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
1495 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
1496 size_bound ourselves. if an input file is a pipe and the user
1497 specified a size, use that size instead of trying to guess the
1498 pipe size. This has the beneficial side effect of avoiding the
1499 overhead of default_sort_size in that case. All callers changed.
1500 (sort): Remove static var size; now done by sort_buffer_size.
1502 2003-09-05 Jim Meyering <jim@meyering.net>
1504 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
1506 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
1507 to start, rather than just .1. Upon failure, print unexpected state.
1509 2003-09-04 Paul Eggert <eggert@twinsun.com>
1511 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
1512 SAFE_READ_ERROR to tmp->nbytes.
1513 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
1515 * src/head.c (struct linebuffer): Change nbytes and nlines
1516 from unsigned int to size_t. unsigned int is safe (after the
1517 2003-09-03 patch) but size_t is cleaner.
1518 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
1519 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
1521 Standardize on BUFSIZ as opposed to other macro names and values.
1522 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
1523 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
1524 stdio.h has always defined it,
1525 and other code already assumes it's defined.
1526 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
1527 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
1528 (io_buf): IO_BUF_SIZE -> BUFSIZ.
1530 2003-09-04 Paul Eggert <eggert@twinsun.com>
1532 * src/seq.c (step): Default to 1.
1533 (print_numbers): Allow the output to be empty.
1534 (main): The default step is 1, even if LAST < FIRST;
1535 as per documentation.
1536 * tests/seq/basic (onearg-2): Output should be empty.
1538 2003-09-05 Jim Meyering <jim@meyering.net>
1540 * Makefile.cfg (wget_files): Temporarily disable, until master
1541 versions are restored to ftp.gnu.org.
1543 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
1545 Make seq's --width (-w) option work properly even when the
1546 endpoint requiring the larger width is negative and smaller than
1548 * src/seq.c (get_width_format): Include `-' in the set of bytes
1549 allowed in a `simple' number (no decimal point, no exponent).
1550 Reported by Patrick Mauritz.
1552 2003-09-02 Paul Eggert <eggert@twinsun.com>
1554 * NEWS: sort -t '\0' now uses a NUL tab.
1555 sort option order no longer matters, unless POSIX requires it.
1556 * src/sort.c (usage): Say "blanks" instead of "whitespace",
1557 Similar fixes for many comments.
1558 (TAB_DEFAULT): New constant, so that we can support NUL as
1559 the field separator.
1560 (tab): Now int, not char. Initialize to TAB_DEFAULT.
1561 (specify_sort_size): If multiple sizes are specified, use the largest.
1562 (begfield, limfield): Support NUL tab char.
1563 (set_ordering): Do not let -i override -d.
1564 (main): Report an error if incompatible -o or -t options are given.
1565 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
1567 2003-09-05 Jim Meyering <jim@meyering.net>
1569 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
1571 2003-09-03 Andreas Schwab <schwab@suse.de>
1573 Bug report and patch here:
1574 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
1575 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
1576 * src/head.c (elide_tail_lines_pipe): Likewise.
1578 2003-09-03 Jim Meyering <jim@meyering.net>
1580 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
1581 small amount of code from him was first moved to lib/human.c, and was
1582 subsequently rewritten entirely.
1583 * src/df.c (AUTHORS): Likewise.
1585 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
1587 * src/md5sum.c (split_3): Accept the BSD format for generic
1588 message digest modes. Currently works with BSD's MD5 and SHA1
1589 formats since these are the two algorithms presently used in
1590 coreutils. Updated comments to reflect this change.
1591 (bsd_split_3): Updated comments.
1593 * tests/md5sum/basic-1: New test to make sure that
1594 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
1595 from `check-bsd' test in tests/sha1sum/basic-1).
1597 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
1598 --check exit status and BSD SHA1 format (adapted from tests
1599 in tests/md5sum/basic-1).
1601 2003-08-30 Jim Meyering <jim@meyering.net>
1603 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
1605 When source and destination arguments refer to the same file, reside
1606 on a partition (e.g. VFAT) on which distinct names may refer to the
1607 same directory entry (often due to variations in case), and when the
1608 link count for the file is 1, mv no longer unlinks the file. Instead,
1609 it gives the expected diagnostic that the source and destination are
1610 the same. WARNING: this is an incomplete fix. If the file happens
1611 to have a link count of 2 or greater, such an erroneous mv command
1612 will still unlink it.
1613 Although that is not possible on vfat or umsdos, it is possible on
1614 other file system types, e.g., ntfs, and hpfs.
1615 * src/copy.c (same_file_ok): Invoke same_name (which might still
1616 return false for names that refer to the same directory entry)
1617 only if the link count is 2 or more.
1618 * tests/mv/vfat: Show how to demonstrate the above problem.
1619 This test is not run.
1620 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
1622 2003-08-27 Jim Meyering <jim@meyering.net>
1624 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
1625 who's -l option has been eliciting an unconditional warning about
1626 this impending change since sh-utils-2.0.12 (April 2002).
1628 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
1629 This would happen for nonempty files not ending with a newline.
1630 Reported by Dan Jacobson.
1631 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
1632 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
1634 * src/stat.c (print_it): Avoid buffer overrun that would
1635 occur when the user-specified format string ends with `%'.
1636 Patch by Tommi Kyntola.
1637 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
1638 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
1640 2003-08-26 Jim Meyering <jim@meyering.net>
1642 Apply changes from bison.
1643 * GNUmakefile (SHELL): Define to `sh', if necessary.
1645 * Makefile.maint (WGETFLAGS): Define to `-C off'.
1646 Update all uses of $(WGET).
1648 2003-08-22 Akim Demaille <akim@epita.fr>
1650 * Makefile.cfg (local-checks-to-skip): New.
1651 * Makefile.maint (local-check): Rename as...
1652 (local-checks-available): this.
1655 2003-08-26 Akim Demaille <akim@epita.fr>
1657 * announce-gen (print_changelog_deltas): Neutralize "<#" as
1658 "<\#" to avoid magic from Gnus when posting parts of this script.
1660 2003-08-25 Jim Meyering <jim@meyering.net>
1662 * src/stat.c (main): Warn about use of deprecated `-l' option.
1664 2003-08-22 Jim Meyering <jim@meyering.net>
1666 * src/stat.c (do_stat): For link count at end of line, use %h format,
1667 instead of %-5h. The latter would make stat emit trailing spaces.
1668 Reported by Dan Jacobson.
1670 2003-08-20 Jim Meyering <jim@meyering.net>
1672 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
1674 2003-08-19 Jim Meyering <jim@meyering.net>
1676 * src/system.h: Include stdlib.h unconditionally,
1677 as we're now assuming that part of hosted C89.
1679 2003-08-18 Jim Meyering <jim@meyering.net>
1681 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
1682 to avoid warnings from gcc.
1684 2003-08-17 Jim Meyering <jim@meyering.net>
1686 Avoid unnecessary and sometimes time-consuming hostname lookups.
1687 * src/who.c (print_user): Use strchr, not strrchr.
1688 * src/pinky.c (print_entry): Likewise.
1689 Patch by Michael Stone.
1690 This fixes a typo I introduced in who-users.c on 1996-02-23.
1692 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
1693 disallowed between `@...@'.
1695 2003-08-16 Paul Eggert <eggert@twinsun.com>
1697 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
1698 done by gnulib .m4 files.
1699 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
1700 * src/sys2.h (strtoull): Remove unused declaration.
1702 2003-08-16 Jim Meyering <jim@meyering.net>
1704 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
1707 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
1708 race condition bug. The bug would be triggered when tailing a file
1709 with file pointer not at beginning of file, and where the file was
1710 truncated to have a length of less than the initial offset at just
1711 the right moment (between the two lseek calls in this function).
1713 An invalid initial value for *read_pos would result in
1714 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
1715 busy-wait rather than sleeping between iterations. The bug manifests
1716 itself only when tailing regular files that are initially nonempty.
1717 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
1719 (tail_lines): Likewise, after lseek calls.
1720 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
1721 * tests/tail-2/tail-n0f: New file. Test for above fix.
1722 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
1724 2003-08-15 Jim Meyering <jim@meyering.net>
1726 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
1727 (sc_sun_os_names): Likewise.
1728 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
1730 * man/help2man: Remove some SPACEs before TAB.
1732 2003-08-14 Paul Eggert <eggert@twinsun.com>
1734 * Makefile.maint (LC_ALL): Set to C.
1735 * man/Makefile.am (ASSORT): New var.
1736 (check-x-vs-1, programs): Use it.
1737 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
1738 * tests/Makefile.am (ASSORT, all_programs): Likewise.
1740 2003-08-11 Jim Meyering <jim@meyering.net>
1742 fold -s -wN would infloop for N < 8 with TABs in the input.
1743 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
1744 * src/fold.c (fold_file): Move contents of `else'-block
1745 out of conditional so it's used also for --spaces (-s).
1746 * tests/misc/fold: Test for the above fix.
1747 * tests/misc/Makefile.am (TESTS): Add fold.
1749 2003-08-10 Jim Meyering <jim@meyering.net>
1751 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
1752 system.h so the types from time.h and sys/time.h are available.
1753 It appears that this is necessary for OpenBSD, NetBSD, and
1754 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
1756 2003-08-06 Paul Eggert <eggert@twinsun.com>
1758 * NEWS: Add support for setting file timestamps to microsecond
1759 resolution, on hosts that support this.
1760 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
1761 * src/copy.c (copy_internal):
1762 Set file timestamps with utimens, not utime.
1763 * src/cp.c (re_protect): Likewise.
1764 * src/install.c (change_timestamps): Likewise.
1765 * src/touch.c (newtime, touch, main): Likewise.
1767 2003-08-09 Jim Meyering <jim@meyering.net>
1769 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
1771 (syntax-check-rules): Add it.
1773 * src/tail.c (main): Tweak Solaris OS version number in comment.
1774 * src/wc.c (wc): Likewise
1775 * tests/tail-2/fflush: Likewise.
1777 * src/tail.c: Add new undocumented option, --presume-input-pipe.
1778 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
1780 2003-08-08 Paul Eggert <eggert@twinsun.com>
1782 Use new gnulib 'extensions' module.
1783 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
1786 2003-08-08 Paul Eggert <eggert@twinsun.com>
1788 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
1790 2003-08-09 Jim Meyering <jim@meyering.net>
1792 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
1793 For tests of obsolete behavior, don't presume that unsetting
1794 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
1796 2003-08-07 Paul Eggert <eggert@twinsun.com>
1798 * doc/coreutils.texi (split invocation):
1799 Add -d or --numeric-suffixes option to 'split'.
1800 From a suggestion by Jesse Kornblum.
1801 * src/split.c (suffix_alphabet): New var.
1802 (longopts, usage, next_file_name, main): Support -d.
1803 (next_file_name, main): Allow -a0, as POSIX requires.
1804 (next_file_name): Don't assume ASCII-like encoding;
1805 'a' through 'z' are not contiguous in EBCDIC.
1807 2003-08-05 Paul Eggert <eggert@twinsun.com>
1809 Merge getline from gnulib.
1810 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
1811 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
1812 New files, from gnulib.
1813 * lib/getdelim2.c, lib/getdelim2.h: Remove.
1814 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
1815 getdelim2.h to getndelim2.c and getndelim2.h.
1816 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
1817 checking for getdelim.
1818 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
1819 than rolling our own.
1820 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
1821 (cut_fields): Invoke getndelim2 rather than getdelim2.
1823 2003-08-04 Jim Meyering <jim@meyering.net>
1825 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
1826 and for the indices to iterate through nsigs.
1828 2003-08-02 Paul Eggert <eggert@twinsun.com>
1830 * src/sort.c: Minor code cleanups, mostly to use more accurate
1831 types and to remove unnecessary casts.
1832 (min, max): Remove. All uses changed to MIN and MAX.
1833 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
1834 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
1835 keyfield.numeric, struct keyfield.general_numeric, struct
1836 keyfield.month, struct keyfield.reverse, reverse, unique,
1837 have_read_stdin): Now bool, not int. All uses changed.
1838 (eolchar): Now char, not int.
1839 (struct keyfield.ignore): Now bool const *, not int *.
1840 (struct keyfield.translate): Now char const *, not char *.
1841 (struct month.name): Likewise.
1842 (blanks, nonprinting, nondictionary): Now bool[], not int[].
1843 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
1844 check, sort, main): Use const * pointers when possible.
1845 (month_cmp): Rewrite to avoid casts.
1846 (inittables): Initialize tables unconditionally, to avoid branches.
1847 (fillbuf): Return bool, not int. All uses changed.
1848 (fillbuf, keycompare, new_key, main):
1849 Use SIZE_MAX rather than (size_t) -1.
1850 (trailing_blanks): Renamed from trim_trailing_blanks.
1851 Return the number of blanks to trim. All uses changed.
1852 (getmonth): Use trailing_blanks rather than open code.
1853 (keycompare): Do not cast char * to unsigned char *; not needed.
1854 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
1856 (compare, main): Use | rather than || to avoid jumps.
1857 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
1859 (check, first_same_file, sort, main):
1860 Use bool instead of int local vars when possible.
1861 (check): Merge the old 'checkfp' and 'check' into a single function,
1862 that returns a boolean (true if the file was ordered).
1864 (main): Use int instead of unsigned for iterating through nsigs.
1865 Rename local var "posix_pedantic" to "posixly_correct".
1867 2003-08-02 Jim Meyering <jim@meyering.net>
1869 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
1870 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
1872 * src/cut.c (cut_fields): Don't read again after encountering an
1873 initial EOF. E.g., `cut -f2' would do so.
1874 * tests/misc/tty-eof: Add a test for the above fix.
1876 * src/sort.c (sortlines): Add description and references.
1879 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
1880 the tests in help-version will use the just-built binaries.
1881 Reported by Christian Krackowizer.
1883 2003-07-31 Paul Eggert <eggert@twinsun.com>
1885 * NEWS: Add --rfc-2822 option to GNU date.
1886 * doc/coreutils.texi (Time directives, Options for date, Examples
1888 * src/date.c (long_options, usage, main): Likewise.
1889 * doc/getdate.texi (General date syntax): Likewise.
1890 * doc/coreutils.texi (Options for date): Fix a typo in format:
1891 it's now %d not %_d. Add URLs.
1893 2003-08-01 Jim Meyering <jim@meyering.net>
1895 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
1896 Otherwise, with at least the /bin/sh from HPUX 10.20,
1897 the trap code would end up converting that to exit 1 and thus an
1898 unexpected test failure. Reported by Christian Krackowizer.
1900 2003-07-31 Paul Eggert <eggert@twinsun.com>
1902 * src/ptx.c: Do not include bumpalloc.h.
1903 (WORD_TABLE): New member alloc.
1904 (ALLOC_NEW_WORD): Remove.
1905 (occurs_alloc): New var.
1906 (digest_word_file, find_occurs_in_text): Check for arithmetic
1907 overflow when computing table size. Use xrealloc rather than
1908 bumpalloc primitives.
1910 2003-07-29 Jim Meyering <jim@meyering.net>
1914 * README: When running tests as root, suggest using
1915 sudo with NON_ROOT_USERNAME=$USER.
1917 * tests/Makefile.am (all_programs): Makefile is in ../src, not
1920 2003-07-28 Jim Meyering <jim@meyering.net>
1922 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
1924 2003-07-28 Paul Eggert <eggert@twinsun.com>
1926 * lib/stdbool.hin (_Bool): Make it signed char, instead of
1927 an enum type, so that it's guaranteed to promote to int.
1928 * src/sort.c (sortlines_temp): Undo previous change.
1930 2003-07-28 Jim Meyering <jim@meyering.net>
1932 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
1933 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
1934 would cause lines[-1 - swap] (with swap = false) to evaluate to
1937 2003-07-27 Jim Meyering <jim@meyering.net>
1939 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
1940 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
1942 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
1943 directories, as required by POSIX. Reported by Karl Berry.
1944 * tests/rm/dir-no-w: New file. Test for the above fix.
1945 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
1947 * tests/mk-script: Emit `$xx', not its expansion.
1949 2003-07-27 Paul Eggert <eggert@twinsun.com>
1951 This change was inspired by a similar proposal by Stepan Kasal.
1952 * src/sort.c (mergelines, sortlines_temp): New functions.
1953 (sortlines): Use them, to reduce the number of times that
1954 we need to copy 'struct line' values. This improved CPU
1955 performance by about 30% on one 18 MB test.
1956 (sort): Don't invoke sortlines unless we have 2 or more lines.
1958 2003-07-26 Stepan Kasal <kasal@ucw.cz>
1960 * src/sort.c (sort): Don't require two `struct line's per text line,
1961 the new sort algorithm requires just 1.5.
1963 2003-07-27 Jim Meyering <jim@meyering.net>
1965 * src/pathchk.c (validate_path): Use %lu, not %ld.
1967 * src/cut.c (is_printable_field): Simplify bit arithmetic.
1969 * src/ls.c (sort_files): Put `volatile' in the right place.
1972 2003-07-26 Jim Meyering <jim@meyering.net>
1974 Use only one bit per field/offset in array, not one `int'.
1975 * src/cut.c (printable_field): Change type to `unsigned char'.
1976 (mark_printable_field, is_printable_field): New functions.
1977 Use them in place of all direct accesses of `printable_field'.
1979 * src/expand.c (parse_tabstops): Detect overflow properly.
1980 * src/cut.c (set_fields): Likewise.
1982 * src/rm.c: Include "dirname.h".
1983 (usage): Use base_name (program_name) in body of --help output.
1985 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
1986 Idea from Brendan O'Dea, who suggested using
1987 `program_name = basename (argv[0]);' everywhere --
1988 can't do that, but using base_name works just fine here.
1990 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
1992 2003-07-24 Paul Eggert <eggert@twinsun.com>
1994 Fix some POSIX-compliance problems with 'test'. This makes
1995 'test' more compatible with Bash.
1997 * NEWS, doc/coreutils.texi: Document the following.
1998 * src/test.c: Include exitfail.h.
1999 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
2000 (test-syntax_error): Use it.
2001 (binary_operator): Now takes bool arg specifying whether left operand
2002 is -l ARG, so that caller determines this rather than us.
2004 (term): Use posixtest to evaluate parenthesized subexpressions.
2005 (unary_operator, one_argument): Remove support for -t without operand.
2006 (one_argument): Take argument from argv[pos].
2007 (one_argument, two_arguments, three_arguments): Advance pos.
2008 All callers changed.
2009 (three_arguments): Look for binary ops before "!". Then look
2010 for parenthesized one_argument expressions, instead of trusting
2011 expr () to do the right thing.
2012 (posixtest): Now takes number of args. All callers changed.
2013 Treat "( A B )" like "A B".
2014 (main): Set exit_failure to TEST_FAILURE. Don't depend on
2015 POSIXLY_CORRECT, as we now conform to POSIX by default.
2016 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
2017 * tests/test/Test.pm (test_vector): Add several tests to check
2018 the above. Syntax errors now exit with status 2, not 1.
2019 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
2021 2003-07-26 Jim Meyering <jim@meyering.net>
2023 * tests/help-version: Adjust for above change in test behavior:
2024 `[' exits with 2, not 1, and test doesn't accept --help or --version.
2026 * Makefile.maint (ME): Don't use trick suggested in Make manual.
2027 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
2029 * Makefile.maint (sc_system_h_headers): Another syntax check.
2030 (syntax-check-rules): Add it to the list.
2032 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
2033 so it matches `%ld' format even on 32-bit systems.
2035 * src/fmt.c (flush_paragraph): Cast field width to `int' to
2036 avoid warning on 64-bit systems.
2038 * src/ls.c (sort_files): Make `func' volatile, so it can't be
2039 clobbered by a `longjmp' into this function.
2041 2003-07-25 Jim Meyering <jim@meyering.net>
2043 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
2046 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
2047 because it'd evoke spurious failure on 64-bit systems.
2049 2003-07-24 Jim Meyering <jim@meyering.net>
2051 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
2052 output its current record counts. Reported by Jurriaan.
2054 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
2055 `wc' with no options. This goes along with the change of 2003-07-20.
2057 2003-07-23 Jim Meyering <jim@meyering.net>
2059 Don't include headers already included by system.h:
2060 * src/tr.c: Don't include errno.h.
2061 * src/true.c: Don't include version-etc.h.
2062 * src/test.c: Don't include limits.h or error.h.
2063 * src/stat.c: Don't include unistd.h or time.h.
2064 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
2065 * src/pr.c: Don't include time.h.
2066 * src/pathchk.c: Don't include errno.h.
2067 * src/nice.c: Don't include sys/time.h.
2068 * src/ls.c: Don't include stdlib.h.
2070 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
2071 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
2072 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
2073 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
2074 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
2075 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
2076 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
2077 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
2078 Don't include closeout.h.
2080 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
2081 can access the required version of rm.
2082 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
2084 * tests/cut/Test.pm (out-delim3a): New test.
2086 * man/help2man: Update to version 1.33.
2088 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
2090 * src/dircolors.c: Include xstrndup.h.
2091 (xstrndup): Remove function, now that it's been factored out into
2094 2003-07-22 Paul Eggert <eggert@twinsun.com>
2096 * src/wc.c (wc): Fix typo in computation of file from file_x,
2097 which caused the former to be used uninitialized if file_x was
2100 2003-07-22 Jim Meyering <jim@meyering.net>
2102 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
2104 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
2105 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
2106 Thomas Luzat. See http://bugs.debian.org/202413 for details.
2108 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
2110 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
2112 * src/cut.c (set_fields): Mark all selected indices before trying to
2113 determine range endpoints.
2114 * tests/cut/Test.pm: New test for the above fix.
2116 Begin to address this comment: What if someone wants to
2117 extract the 1,000,000-th field of some huge input file?
2118 The first step is to rearrange things so that the values
2119 in the printable_field array are all 0/1 rather than 0/1/2.
2120 * src/cut.c (RANGE_START_SENTINEL): Remove.
2121 Store range-start indices in a hash table, rather than
2122 overloading the `printable_field' array.
2123 (range_start_ht): New global.
2124 (hash_int, hash_compare_ints, is_range_start_index): New functions.
2125 (print_kth): Use is_range_start_index; don't test printable_field.
2126 (set_fields): Detect overflow.
2127 (set_fields): Insert each range-start index into range_start_ht.
2128 (main): Call set_fields only once, and only after
2129 output_delimiter_specified and (if required) range_start_ht have
2132 2003-07-20 Paul Eggert <eggert@twinsun.com>
2134 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
2135 invoked with a null pointer when there were no file arguments.
2137 2003-07-20 Jim Meyering <jim@meyering.net>
2139 * Makefile.maint (sc_changelog): Add another nit-picky check.
2141 * src/wc.c (write_counts): Add a comment.
2142 (wc): Rename `file' parameter.
2143 Set new local, `file', to be the file name, or (when it's NULL)
2144 _("standard output") so that all uses of `file' use the proper value.
2145 Use STREQ, not strcmp.
2147 2003-07-20 Paul Eggert <eggert@twinsun.com>
2149 wc count field widths now are heuristically adjusted depending
2150 on the input size, if known. If only one count is printed, it
2151 is guaranteed to be printed without leading spaces.
2153 Previously, wc did not align the count fields if
2154 POSIXLY_CORRECT was set, but POSIX did not actually require
2155 this undesirable behavior, so it has been removed.
2157 * NEWS: Document this.
2158 * doc/coreutils.texi (wc invocation): Likewise.
2160 * src/wc.c (number_width): New var.
2161 (posixly_correct): Remove.
2162 (struct fstatus): New struct.
2163 (write_counts): Output fields of width number_width.
2164 Do not worry about POSIXLY_CORRECT.
2165 Use null file, not empty-string file, to denote stdin,
2166 since "" is a valid file name on some hosts.
2167 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
2169 (wc): Avoid problems if end_pos - current_pos overflows.
2170 Do not print odd message if stdin has a read error.
2171 (get_input_fstatus, compute_number_width): New functions.
2172 (main): Use them to implement the new behavior.
2173 Ignore POSIXLY_CORRECT.
2175 * tests/wc/Test.pm: Adjust to the new output widths.
2177 2003-07-19 Jim Meyering <jim@meyering.net>
2179 * tests/rm/fail-eperm: Don't create temporary directory --
2182 * tests/shred/remove: Don't open-code test for UID != 0.
2183 Use priv-check's require-non-root instead.
2184 Update to use newer framework.
2186 * tests/help-version (expected_failure_status_expr): Record that
2187 expr exits with status of 3 for e.g., a write error.
2189 * tests/priv-check: Use `id -u' to see if we're running as root,
2190 rather than trying go write to an write-protected file.
2191 When running as root, ensure $NON_ROOT_USERNAME is valid.
2192 When running as root with `require-non-root', ensure that `.'
2193 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
2194 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
2196 * src/printenv.c: Include "exitfail.h".
2197 (main): Set exit_failure rather than calling close_stdout_set_status.
2198 * src/date.c: Likewise.
2199 * src/sort.c: Likewise.
2200 * src/tty.c: Likewise.
2202 2003-07-18 Jim Meyering <jim@meyering.net>
2204 * tests/touch/not-owner: Update to use newer framework.
2206 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
2207 directory, and remove Perl-coded `you may not run as root' test.
2208 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
2209 hard-coding something not quite equivalent.
2210 Paul Jarc reported the inconsistent diagnostics.
2212 * src/sort.c (main): Use close_stdout via atexit.
2213 Now `sort --version' and `sort --help' fail, as they should
2214 when their output is redirected to /dev/full.
2216 * src/su.c (usage): Don't call close_stdout here.
2217 (main): Use close_stdout via atexit.
2218 Now `su --version > /dev/full' fails, as it should.
2219 Somehow, the change of 2000-05-07 that purports to fix this
2222 * tests/help-version (--help/--version vs. /dev/full): Special-case
2223 `[' to protect it from expected_failure_status-`eval'.
2225 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
2226 count and the corresponding line, as required by POSIX.
2227 Reported by Clement Wang.
2228 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
2230 * tests/expr/basic: Add tests for when exit status is 2.
2232 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
2233 Use an anonymous `enum', rather than #define.
2235 2003-07-17 Paul Eggert <eggert@twinsun.com>
2237 * src/expr.c: Include "exitfail.h", "quotearg.h".
2238 (EXPR_INVALID, EXPR_ERROR): New constants.
2239 (nomoreargs, null, toarith, nextarg): Return bool, not int.
2240 (syntax_error): New function, exiting with status 2. Use it
2241 insteading of printing "syntax error" ourselves.
2242 (main): Initialize exit_failure to EXPR_ERROR.
2243 Exit with EXPR_INVALID on syntax error (too few arguments).
2244 (nextarg): Use strcmp, not strcoll; strcoll might return
2245 an undesirable 0, or might fail.
2246 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
2247 or other such error.
2248 (eval2): Report an error if strcoll fails in a string comparison.
2249 * src/sort.c: Include "exitfail.h".
2250 (main): Set exit_failure, not xalloc_exit_failure and
2251 xmemcoll_exit_failure.
2252 * tests/expr/basic: Invalid value exits with status 3, not 2.
2254 2003-07-16 Jim Meyering <jim@meyering.net>
2256 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
2257 per GNU maintainer guidelines. The next non-beta release will be 5.1.
2259 This script would have caught at least two recent bugs:
2260 those in [ and kill.
2261 * tests/help-version: Revive this script.
2262 It wasn't doing anything useful, since $all_programs wasn't being
2263 defined by the invoking Makefile.am.
2264 Reflect that nohup is no longer a script, so don't exclude it.
2265 Add framework to handle the programs added since it was last run:
2266 kill, stat, unlink, [, link, readlink.
2267 Fix path-related problems deriving from the move of this script
2268 from src/ to its present location.
2269 * tests/Makefile.am (all_programs): Define.
2270 (TESTS_ENVIRONMENT): Use it.
2272 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
2273 whereby kill would always attempt to operate on argv[0] and fail.
2275 * src/test.c (integer_expected_error): Improve diagnostic -- now,
2276 it also matches the one from bash's builtin test.
2277 (binary_operator): Add \n at end of diagnostic.
2279 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
2280 * tests/priv-check: Move setuidgid-related and
2281 NON_ROOT_USERNAME-checking code to this file.
2283 * README: Update section on testing as `root'.
2284 Suggestion from Paul Jarc.
2286 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
2287 names of authors that I just found in bash's builtins/test.def.
2289 Running `[' with no arguments would evoke a segfault.
2290 * src/test.c (main) [LBRACKET]: Move initialization of argv to
2291 precede potential use via test_syntax_error.
2293 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
2294 warning from automake -Wall.
2296 2003-07-15 Jim Meyering <jim@meyering.net>
2300 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
2303 * announce-gen (print_changelog_deltas): Relax tests for matching
2304 version-number line in NEWS.
2305 Change the .sig suffix to .asc here, too.
2307 2003-07-14 Jim Meyering <jim@meyering.net>
2309 * Makefile.maint (%.asc): Renamed from %.sig.
2310 Generate and use ascii-armored signatures.
2311 Use gpg's -o option.
2313 2003-07-13 Jim Meyering <jim@meyering.net>
2315 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
2318 * Makefile.maint (syntax-check): Move each individual check into
2320 (syntax-check-rules): This is the list of syntax-check targets.
2321 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
2322 (sc_cast_of_x_alloc_return_value, sc_space_tab):
2323 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
2325 2003-07-12 Jim Meyering <jim@meyering.net>
2327 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
2328 traces of the nohup script.
2330 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
2331 $(OPTIONAL_BIN_ZCRIPTS).
2333 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
2334 target, not before the `>'.
2336 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
2337 now that that function no longer calls `error'.
2339 * src/df.c (find_mount_point): Emit a diagnostic for each
2340 failed syscall, rather than relying on caller to do that.
2341 The caller couldn't do a good job, anyhow -- too many different
2342 ways to fail (each with a different referent).
2343 Give a diagnostic upon failed save_cwd, now that that function
2344 no longer calls `error'.
2345 (show_point): Don't diagnose find_mount_point's errors, now that
2346 it handles them itself.
2348 * src/df.c (find_mount_point): Don't let free clobber errno upon
2351 * src/sys2.h: Remove alloca-related block.
2352 * src/system.h: Include <alloca.h> here, instead.
2354 It appears that the `#pragma alloca' included via "system.h" is
2355 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
2356 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
2357 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
2359 * src/chown-core.c (change_file_owner): Do not restore any special
2360 permission bits (e.g., set-user-ID, set-group-ID) that are reset
2361 by chown(2) on some systems. Suggestion and insistence :-) from
2364 * tests/input-tty: Also check `test -t 1'.
2365 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
2366 test would block when run in the background.
2368 2003-07-11 Jim Meyering <jim@meyering.net>
2370 * tests/sample-test: Also fail if cat-to-create-expected-output
2371 fails. Otherwise, if both `exp' and `out' were to end up empty
2372 because of e.g., a full disk, they would mistakenly compare equal.
2374 * src/nohup.c: New file. Rewrite of nohup.sh in C.
2375 This solves a portability problem: on at least Solaris systems,
2376 when nohup.sh used the vendor /bin/sh, it would exit with status
2377 of `1' rather than the required 126 or 127 upon failure to exec
2378 the specified program.
2380 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
2381 (bin_PROGRAMS): Add nohup.
2382 (EXTRA_DIST): Remove nohup.sh.
2383 (all_programs): Remove use of $(EXTRA_SCRIPTS).
2384 * src/nohup.sh: Remove file.
2385 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
2387 * tests/misc/nohup: Tests for the above.
2388 * tests/misc/Makefile.am (TESTS): Add nohup.
2390 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
2391 the macro, COPY_FD_DIAGNOSE.
2392 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
2393 (head_file): Likewise.
2395 * src/date.c: Include "quote.h".
2396 (batch_convert): Use the quote function rather than using literal `...'
2399 * src/setuidgid.c (main): Enclose diagnostic in _(...).
2400 * src/fmt.c (main): Likewise.
2401 * src/mknod.c (main): Likewise.
2402 * src/tac.c (tac_seekable): Likewise.
2403 * src/yes.c (main): Likewise.
2404 * src/od.c (main): Likewise.
2405 * src/install.c (change_attributes): Likewise.
2407 2003-07-10 Jim Meyering <jim@meyering.net>
2409 * src/head.c (usage): Use 1024*1024 in place of 1048576.
2410 * src/tail.c (usage): Likewise.
2412 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
2413 place of the kludge in this test. Suggestion from Paul Jarc.
2415 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
2416 * src/setuidgid.c: New program, solely for testing (not installed).
2418 * src/chown-core.c (change_file_owner): Don't leak file descriptors
2419 when dereferencing symlinks.
2421 2003-07-09 Jim Meyering <jim@meyering.net>
2423 * tests/du/slash: New file/test for today's lib/ftw.c fix.
2424 * tests/du/Makefile.am (TESTS): Add slash
2426 * src/tail.c (xlseek): Avoid warning about ``return without value
2427 from function returning non-void''.
2429 2003-07-08 Jim Meyering <jim@meyering.net>
2431 * man/help2man: Update to version 1.29.
2433 * man/help2man: Add END handler to close STDOUT and check for errors.
2435 2003-06-30 Paul Eggert <eggert@twinsun.com>
2437 Add support for a "[" that conforms to the GNU coding standards,
2438 i.e., that does not depend on its name.
2439 * src/lbracket.c: New file.
2441 * man/Makefile.am (programs): Ignore "[", since it doesn't have
2442 a separate man page.
2443 * src/Makefile.am (bin_PROGRAMS): Add "[".
2444 (__SOURCES): New var.
2445 * src/test.c (LBRACKET): Define to 0 if not defined.
2446 (main): Use LBRACKET rather than argv[0].
2448 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
2449 Reported by Paul Jarc and Dan Jacobson.
2451 * src/test.c (main): Do not recognize --help or --version if
2452 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
2453 Do not bother testing that margv[margc] is non-null.
2455 2003-07-04 Jim Meyering <jim@meyering.net>
2457 * src/who.c (print_line): Rewrite to use asprintf, in order to be
2458 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
2460 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
2461 option, and perform the +1600 invocations of head IFF the envvar
2462 RUN_EXPENSIVE_TESTS is set.
2464 2003-07-03 Jim Meyering <jim@meyering.net>
2466 * src/cp.c (do_copy): Give a better diagnostic when failing due
2467 to nonexistent destination directory. Reported by Dmitry Rutsky.
2468 See http://bugs.debian.org/199730 for details.
2470 2003-06-27 Jim Meyering <jim@meyering.net>
2472 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
2473 * src/split.c (longopts): Use `1', not `0' as the value for
2474 for &verbose. Reported by Keith Thompson.
2476 Test for the above fix.
2477 * tests/misc/split-a: Also use --verbose and compare stderr
2478 output with what we'd expect.
2480 2003-06-20 Jim Meyering <jim@meyering.net>
2482 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
2483 Use `error_t' (rather than int) as type for local `err'.
2484 From Alfred M. Szmidt.
2486 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
2488 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
2489 Fix author preservation code.
2491 2003-06-19 Jim Meyering <jim@meyering.net>
2493 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
2494 (do_link): Don't warn about hard link to symlink.
2496 2003-06-18 Jim Meyering <jim@meyering.net>
2498 * src/cut.c: Include "getdelim2.h", not "getstr.h".
2499 Reflect renaming: getstr -> getdelim2.
2501 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
2502 readline -> readlinebuffer.
2504 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
2506 * src/readlink.c: Include <sys/types.h> before system.h (because
2507 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
2509 2003-06-17 Jim Meyering <jim@meyering.net>
2511 * src/system.h (initialize_main): Define.
2512 Use it in every `main'. Applied via this:
2513 p='initialize_main (&argc, &argv);'
2514 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
2515 $(grep -l program_name.=.argv.0 *.c)
2516 test.c uses margc/margv, so I made the change manually for that file.
2517 Based on a patch from Bernard Giroud.
2519 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
2521 Fix for build failure on Ultrix 4.3.
2522 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
2523 Include sys/param.h and sys/mount.h on ultrix.
2525 2003-06-16 Jim Meyering <jim@meyering.net>
2527 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
2529 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
2530 them here instead, but with one change: define EISDIR to -1, not 0.
2532 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
2533 guaranteed to be defined.
2534 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
2536 * README: Mention the CVS repository.
2537 Encourage addition of test cases.
2539 2003-06-12 Jim Meyering <jim@meyering.net>
2541 * src/touch.c (touch): Call close only if necessary.
2544 * src/wc.c (usage): Correct wording: wc prints counts in the order
2545 `newline, word, byte'. Reported by Keith M. Briggs.
2546 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
2548 2003-06-10 Jim Meyering <jim@meyering.net>
2550 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
2552 2003-06-07 Jim Meyering <jim@meyering.net>
2554 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
2557 2003-06-06 Jim Meyering <jim@meyering.net>
2559 * src/extract-magic (main): Avoid newer 3-arg form of open,
2560 so this script works also with e.g., perl5.005_03.
2561 Patch by John David Anglin.
2563 2003-06-04 Paul Eggert <eggert@twinsun.com>
2565 * src/system.h: Include <stdbool.h> unconditionally.
2567 2003-06-04 Jim Meyering <jim@meyering.net>
2569 * man/Makefile.am (check-programs-vs-x): Rename target
2570 from check-programs-vs-1. Adjust rule to check for the
2571 primary (.x) file, not the generated one (.1).
2573 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
2575 * man/kill.x: New file.
2576 * man/Makefile.am (dist_man_MANS): Add kill.1.
2579 2003-06-04 Jim Meyering <jim@meyering.net>
2581 Ensure that the .x file for a new program is never forgotten again.
2582 * man/Makefile.am (programs): Define.
2583 (check-programs-vs-1): New phony target.
2584 (check-local): Depend on it.
2586 2003-06-03 Jim Meyering <jim@meyering.net>
2588 Avoid unnecessary copying of environment.
2589 * src/env.c (main): Rather than clearing the environment and --
2590 unless told to ignore environment -- copying all settings from
2591 the saved, original environment, clear the environment only when
2592 that is requested. Suggested by Jens Elkner.
2594 2003-06-02 Jim Meyering <jim@meyering.net>
2596 * src/system.h: Always include <string.h>, since we assume C89.
2597 Include <limits.h> without checking for HAVE_LIMITS_H.
2599 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
2600 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
2602 2003-06-01 Jim Meyering <jim@meyering.net>
2604 Avoid a race condition in `tail -f' described by Ken Raeburn in
2605 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
2606 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
2607 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
2608 (tail_bytes, tail_lines, tail): Likewise.
2609 (tail_file): Use the new `read_pos' value as the size,
2610 rather than stats.st_size from the fstat call.
2612 2003-05-28 Jim Meyering <jim@meyering.net>
2614 * src/extract-magic: Allow expansion of `$file' in the here-
2615 document corresponding to the comment at the top of fs.h.
2617 2003-05-26 Jim Meyering <jim@meyering.net>
2619 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
2620 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
2621 Use #if/#elif/... cascade so we get only one set of include files.
2622 Reported by Nelson Beebe.
2624 2003-05-24 Jim Meyering <jim@meyering.net>
2626 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
2627 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
2628 accept the BSD format.
2630 2003-03-28 Joe Orton <jorton@redhat.com>
2632 * src/md5sum.c (bsd_split_3): New function.
2633 (split_3): Detect checksums from BSD 'md5' command and handle them
2636 * tests/md5sum/basic-1: New tests for --check exit status, and for
2637 BSD-style checksum files.
2639 2003-05-21 Jim Meyering <jim@meyering.net>
2641 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
2642 This sort of thing is why it'd be *Really Good* to factor
2643 out the common code used here and in tail.c.
2645 2003-05-14 Jim Meyering <jim@meyering.net>
2647 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
2649 * tests/du/slink: Skip this test if `.' is on an XFS file system.
2651 * tests/du/fd-leak: New file. Test for the bug in du that
2652 was fixed by the 2003-05-12 change to lib/ftw.c.
2653 * tests/du/Makefile.am (TESTS): Add fd-leak.
2655 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
2656 includes a translatable word, `and'.
2658 * src/dd.c (usage): Don't use `,' as the thousands separator
2659 in e.g. 1,000,000 and 1,048,576. Instead, do this:
2660 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
2661 * src/df.c (usage): Likewise.
2662 * src/du.c (usage): Likewise.
2663 * src/ls.c (usage): Likewise.
2665 * Makefile.maint (syntax-check): Add another check.
2667 2003-05-13 Paul Eggert <eggert@twinsun.com>
2669 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
2670 must output nothing. Problem reported by Josh Hyman.
2672 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
2673 (output_unique, output_first_repeated, output_later_repeated):
2674 New vars. All uses of "mode" changed to use these variables,
2675 which are not mutually exclusive as "mode" was.
2676 (writeline): New arg "match", used to control whether to
2677 obey output_first_repeated or output_later_repeated.
2678 All callers changed.
2679 (check_file, main): Adjust to above changes.
2681 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
2683 2003-05-14 Jim Meyering <jim@meyering.net>
2685 * tests/rm/rm3: Use tr's \n notation rather than \012.
2686 This package can afford to do that, since its tests are guaranteed use
2687 GNU tr, which has accepted the more modern notation for 10 years.
2688 * tests/rm/rm5: Likewise.
2689 * tests/cp/same-file: Likewise.
2690 * tests/stty/row-col-1: Likewise.
2691 * tests/stty/basic-1: Likewise.
2692 * tests/rm/deep-1: Likewise.
2693 * tests/mv/part-symlink: Likewise.
2694 * tests/mkdir/perm: Likewise.
2695 * tests/misc/nice: Likewise.
2697 2003-05-13 Jim Meyering <jim@meyering.net>
2699 * src/copy.c (struct F_triple) [name]: Remove const attribute.
2700 (triple_free): Don't apply cast to argument of free.
2701 (seen_file): Add cast here instead.
2703 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
2704 (src_to_dest_free): Don't apply cast to argument of free.
2706 * src/sort.c (zaptemp): Don't apply cast to argument of free.
2707 * src/pr.c (init_fps, init_store_cols): Likewise.
2708 * src/join.c (delseq, freeline): Likewise.
2709 * src/expr.c (OLD): Likewise.
2710 * src/sort.c (sort): Likewise.
2711 * src/head.c (elide_tail_lines_pipe): Likewise.
2713 * src/tail.c: Include "quote.h".
2714 Use quote in diagnostics. Change many error format strings
2715 from just `%s' to e.g., `error reading %s'.
2716 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
2717 Rewrite newline-counting loop to use memchr.
2719 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
2720 Now that assert is no longer used, don't include <assert.h>.
2722 2003-05-12 Jim Meyering <jim@meyering.net>
2724 * src/head.c: Include <assert.h>.
2725 (AUTHORS): Add my name.
2726 (elide_tail_lines_pipe): New function.
2728 2003-05-10 Jim Meyering <jim@meyering.net>
2730 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
2732 * src/readlink.c (main): Set program_name before first use.
2733 Remove that (redundant) first use.
2734 Don't exit successfully just because --verbose was specified.
2735 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
2736 parameter is 0, error does not exit.
2738 * src/uname.c (main): When failing due to too many arguments, also say
2739 that, rather than just "Try `uname --help' for more information.".
2740 * src/comm.c (main): Likewise, but for too few arguments.
2741 * src/logname.c: Include error.h.
2742 (main): Say why we're failing.
2744 * src/uniq.c (main): Don't segfault when argc < optind.
2745 * src/who.c (main): Handle argc < optind.
2746 * src/df.c (main): Likewise.
2747 * src/install.c (main): Likewise.
2748 * src/mv.c (main): Likewise.
2749 * src/pwd.c (main): Likewise.
2750 * src/tty.c (main): Likewise.
2751 * src/chroot.c (main): Likewise.
2752 * src/hostname.c: Likewise.
2753 * src/du.c (main): Likewise.
2754 * src/expand.c (main): Likewise.
2755 * src/env.c (main): Likewise.
2756 * src/unexpand.c (main): Likewise.
2757 * src/printenv.c (main): Likewise.
2758 * src/sync.c (main): Handle argc == 0.
2759 * src/expr.c (main): Likewise.
2760 * src/printf.c (main): Likewise.
2761 * src/basename.c (main): Likewise.
2762 * src/ln.c (main): Test for `missing argument' before computing n_files.
2763 * src/tail.c (main): Test for the case of no arguments before
2766 * src/kill.c (send_signals): Don't check command line arguments here.
2767 (main): Check them here instead. Handle argc < optind.
2769 * src/logname.c (main): Use error, rather than fprintf, for the sake
2772 * src/rm.c (main): Don't overrun array bound if argc is 0.
2774 2003-05-09 Jim Meyering <jim@meyering.net>
2776 * src/sort.c (main): Don't overrun array bound if argc is 0.
2777 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
2778 Reported by Wartan Hachaturow.
2780 2003-05-07 Jim Meyering <jim@meyering.net>
2782 Implement support so that `head --lines=-N' works on seekable files.
2783 * src/head.c (enum Copy_fd_status): Define.
2784 (COPY_FD_DIAGNOSE): New macro.
2785 (elide_tail_lines_seekable): New funtion.
2786 (elide_tail_lines_file): Call it here.
2788 2003-05-06 Jim Meyering <jim@meyering.net>
2790 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
2792 2003-05-04 Jim Meyering <jim@meyering.net>
2794 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
2795 caused the addition of thousands of small files to the tar archive.
2796 * tests/misc/head-elide-tail: New file. Add them here instead.
2797 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
2799 2003-05-04 Paul Eggert <eggert@twinsun.com>
2801 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
2802 (IF_READDIR_NEEDS_REWINDDIR): Remove.
2803 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
2804 which was a bit weird because it couldn't be emulated by a function.
2806 2003-05-03 Jim Meyering <jim@meyering.net>
2808 Extend head to accept --lines=-N (--bytes=-N) and to print all
2809 but the N lines (bytes) at the end of the file.
2810 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
2811 Use quote() in diagnostics, rather than literal `' marks.
2812 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
2814 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
2815 (head_file): Reorganize so as to call head from only one place.
2816 (main): Likewise, for head_file.
2817 Handle new, undocumented option, --presume-input-pipe.
2818 Handle negative line and byte counts.
2819 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
2821 * tests/du/8gb: Skip test if the file system of `.' doesn't support
2822 sparse files -- otherwise it'd create a file of size 8GB.
2824 2003-05-02 Jim Meyering <jim@meyering.net>
2826 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
2827 Instead explain about `-' and standard input.
2828 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
2829 Reported by Keith Thompson.
2830 * tests/fmt/basic: Add test for the above fix.
2832 * src/fmt.c: Include "quote.h".
2833 Use quote() in diagnostics, rather than literal `' marks.
2834 (main): Exit nonzero when unable to open an input file.
2835 * tests/fmt/basic: Add test for the above fix.
2837 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
2838 specifications like `-72x'.
2839 * tests/fmt/basic: Add test for the above fix.
2841 Work around nasty readdir bug on Darwin6.5.
2842 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
2843 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
2844 returned NULL and there has been at least one successful unlink or
2845 rmdir call since the opendir or previous rewinddir, then call
2846 rewinddir and reiterate the loop.
2848 Factor out common code.
2849 * src/remove.c (readdir_ignoring_dotdirs): New function.
2850 (is_empty_dir): Use it here.
2851 (remove_cwd_entries): Use it here.
2853 2003-05-01 Jim Meyering <jim@meyering.net>
2855 * tests/rm/r-3: Create 500 rather than just 300 files.
2856 There's a bug in Darwin6.5's readdir that shows up only with
2858 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
2862 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
2863 (dump_remainder): Move two declarations `down' into the scope
2864 where they are used.
2865 (xlseek): Return the resulting offset.
2866 (file_lines): Rename parameter, file_length, to end_pos.
2867 (pipe_lines): Don't coerce safe_read return value to `int'.
2868 Adapt tests accordingly.
2869 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
2871 Change type of `total_bytes' from `int' to `size_t',
2872 since the former wouldn't always be wide enough.
2873 Don't coerce safe_read return value to `int',
2874 and adapt tests accordingly.
2875 Now that testing for a read error no longer involves
2876 using `tmp', handle that case *after* freeing `tmp'.
2877 (start_bytes): Clean up.
2878 (tail_bytes): Now that `n_bytes' may be larger than
2879 OFF_T_MAX, test for that condition and, if it's true, don't
2880 use lseek optimizations.
2881 (parse_options): Don't fail just because N_UNITS is larger than
2882 the maximum size of a file -- tail may be applied to an input
2883 stream (e.g., a pipe) with more data than that.
2885 * Makefile.maint (syntax-check): Rename from alloc-check.
2886 Also check for SPACE-TAB sequences.
2887 Also check for malloc/calloc/realloc casts.
2889 2003-05-01 Jim Meyering <jim@meyering.net>
2891 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
2893 2003-04-28 Jim Meyering <jim@meyering.net>
2895 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
2896 make the now-more-picky tsort fail.
2898 2003-04-24 Jim Meyering <jim@meyering.net>
2900 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
2901 (main): Minor syntactic clean-up.
2903 * src/tsort.c (tsort): Fail if the input contains an odd number of
2904 tokens. Reported by junkio@cox.net.
2906 * tests/tsort/basic-1: Test for the above fix.
2908 2003-04-21 Jim Meyering <jim@meyering.net>
2910 * tests/misc/printf: Add tests for the printf fixes below.
2912 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
2914 2003-04-20 Paul Eggert <eggert@twinsun.com>
2916 Fix printf POSIX compatibility bug reported by Ben Harris in
2917 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
2918 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
2919 \0NNN in the %b operand.
2920 * src/printf.c (usage): Likewise.
2921 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
2922 is desired. All uses changed. Behave like Bash printf if %b
2923 operand uses \NNN where the initial N is not 0.
2925 2003-04-17 Jim Meyering <jim@meyering.net>
2927 * src/stty.c: Remove uses of PROTOTYPE macro.
2929 2003-04-15 Jim Meyering <jim@meyering.net>
2931 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
2932 each sequence of spaces before a TAB character.
2934 2003-04-13 Jim Meyering <jim@meyering.net>
2936 * src/remove.c (is_empty_dir): Don't closedir (NULL).
2938 2003-04-12 Jim Meyering <jim@meyering.net>
2940 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
2941 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
2942 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
2943 * src/nl.c (main): Fix those problems and remove literal quote marks
2944 (e.g., "`%s'") from format string; instead use "%s" in each format
2945 string and `quote (optarg)' as the corresponding argument.
2946 Also, diagnose all invalid command line options before failing.
2948 * src/nl.c (proc_text): Fix a bug that would make nl output extra
2949 newlines in some cases. Details here: http://bugs.debian.org/177256.
2950 This bug was introduced on 2001-11-10 for textutils-2.0.17.
2951 * tests/misc/nl: Add test for the above-fixed bug.
2953 * tests/misc/readlink: New file. Test the --canonicalize option.
2954 * tests/misc/Makefile.am (TESTS): Add readlink.
2956 2003-04-11 Jim Meyering <jim@meyering.net>
2959 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
2960 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
2961 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
2962 retain alignment) each sequence of spaces before a TAB character.
2964 * src/ls.c: Include <stdlib.h> unconditionally.
2966 * Makefile.maint (xalloc-check): Rename from header-check.
2968 * src/yes.c: Include error.h after system.h, not before.
2971 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
2972 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
2973 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
2974 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
2975 * src/tr.c: * src/unexpand.c, src/users.c:
2976 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
2977 return values and of xrealloc's first argument.
2978 Fix the former with this:
2979 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
2981 2003-04-10 Jim Meyering <jim@meyering.net>
2983 * src/stty.c (wrapf): Declare with format attribute.
2985 The S_MAGIC_... names shouldn't be maintained in two places (prior
2986 to this change, one would have to keep stat.c and fs.h in sync).
2987 This change makes it so those names and the corresponding
2988 hexadecimal constants all reside in stat.c. fs.h is now generated.
2989 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
2990 (BUILT_SOURCES): Add fs.h, now that it's generated.
2991 (EXTRA_DIST): Add extract-magic.
2992 * src/extract-magic: New script to extract fs.h definitions from stat.c.
2993 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
2994 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
2996 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
2997 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
2999 * man/unexpand.x: Add `SEE ALSO' reference to expand.
3000 * man/expand.x: Add `SEE ALSO' reference to unexpand.
3001 Suggestion from Dan Jacobson.
3003 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
3005 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
3006 * src/stat.c (human_fstype): Handle Linux's devpts.
3008 2003-04-09 Paul Eggert <eggert@twinsun.com>
3010 * src/split.c (line_bytes_split): Arg is of type size_t, since
3011 that's all that is supported for now.
3012 (main): Check for overflow in obsolescent line count option.
3014 2003-04-09 Jim Meyering <jim@meyering.net>
3016 * tests/misc/split-fail: Add a new test for the above fix.
3018 * src/split.c (bytes_split): Use size_t temporary (rather than
3019 uintmax_t original) in remaining computations. From Paul Eggert.
3021 Handle command line option arguments larger than 2^31.
3022 This allows e.g., splitting into files of size 2GB and larger,
3023 and running split --lines=N with N=2^31 or more.
3024 But for --line-bytes=N, the restriction that N <= SIZE_MAX
3025 remains (for now), due to the way it is implemented.
3027 * src/split.c: Include "inttostr.h".
3028 (bytes_split, lines_split, line_bytes_split, main):
3029 Use uintmax_t, not size_t, for file sizes.
3030 (main): Give a better diagnostic for option arguments == 0.
3031 Use umaxtostr to print file sizes.
3032 Reported by Luke Hassell.
3034 2003-04-08 Jim Meyering <jim@meyering.net>
3036 * src/rm.c (usage): Mention that --directory (-d) works only
3037 on some systems. Suggestion from Samuel Tardieu.
3039 * tests/basename/basic: Run $PERL to see if it is available,
3040 rather than testing its value.
3041 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
3042 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
3043 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
3044 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
3045 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
3046 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
3047 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
3048 * tests/sum/basic-1, tests/seq/basic: Likewise.
3050 * tests/misc/Makefile.am (TESTS): Add split-fail.
3051 * tests/misc/split-fail: New file.
3053 * src/split.c: Rename local variables: nchars -> n_bytes.
3054 (lines_split): Rename local, nlines -> n_lines.
3055 (main): Rename local variable: s/accum/n_units/.
3056 (main): Use STDIN_FILENO, not literal `0'.
3058 2003-04-07 Jim Meyering <jim@meyering.net>
3060 * src/stat.c: Add #include directives for Ultrix 4.4.
3061 Based on a suggested change from Bert Deknuydt.
3063 2003-04-06 Jim Meyering <jim@meyering.net>
3065 * Makefile.maint (makefile-check): New rule.
3066 (local-check): Add it.
3068 2003-04-05 Jim Meyering <jim@meyering.net>
3070 * Makefile.am (nearly all of them):
3071 Use $(VAR) rather than @VAR@, now that we can rely on automake to
3072 emit a definition for each substituted variable.
3073 * tests/Makefile.am.in: Likewise.
3075 * tests/rm/rm5: Add a comment explaining why this test fails when
3076 using Tru64's broken sed.
3077 * tests/rm/rm3: Likewise.
3079 Make `kill -t' output signal descriptions (not `?') on Tru64.
3080 * src/kill.c (sys_siglist): Also check for __sys_siglist.
3081 Patch by Tony Leneis.
3082 * configure.ac: Also check for declaration of __sys_siglist.
3083 Required for Tru64 4.0D, 4.0F, and 5.1.
3084 Reported by Tony Leneis.
3086 2003-04-04 Jim Meyering <jim@meyering.net>
3088 * src/Makefile.am (PERL): Remove unnecessary definition.
3090 Because of inappropriate (but POSIX-mandated) behavior of rename,
3091 `mv a b' would not remove `a' in some unusual cases. Work around
3092 this by unlinking `a' when necessary.
3094 * src/copy.c (same_file_ok): Add an output parameter.
3095 Set it in the offending case.
3096 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
3097 Reported by Ed Avis.
3098 * tests/mv/hard-4: New test for the above.
3099 * tests/mv/Makefile.am (TESTS): Add hard-4.
3101 Clean up rules for automatically generated sources:
3102 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
3103 Make each generated file be read-only.
3104 Add each file name to BUILT_SOURCES separately.
3105 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
3107 Put LOCALEDIR macro definition in new file: localedir.h.
3108 * src/Makefile.am (DEFS): Remove definition.
3109 (localedir.h): New rule.
3110 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
3111 * src/system.h: Include "localedir.h".
3113 2003-04-02 Jim Meyering <jim@meyering.net>
3117 * tests/misc/Makefile.am (TESTS): Add false.
3119 * Makefile.maint (TMPDIR): Make sure it's defined.
3120 (my-distcheck): Build in $(TMPDIR), not `.'.
3122 * src/Makefile.am (false.c): Change all occurrences of
3123 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
3124 unsuccessfully also with --help. Reported by Paul Jarc,
3125 * tests/misc/false: New test for the above.
3127 2003-03-30 Jim Meyering <jim@meyering.net>
3129 * NEWS: Note the location of older NEWS files.
3131 * src/remove.c (is_empty_dir): Don't let a failing closedir
3132 clobber errno. Spotted by Arnold Robbins.
3134 * src/env.c: Fix typo in comment. From Arnold Robbins.
3136 2003-03-29 Jim Meyering <jim@meyering.net>
3140 * README: Note to expect build problems for stat.c on Ultrix 4.3.
3141 Note that there are some harmless test failures when running
3142 `make check' as root on some systems.
3144 2003-03-28 Jim Meyering <jim@meyering.net>
3146 * tests/stty/row-col-1: Skip this test if stty can't get window size.
3147 This happens when connecting to sparc-solaris5.7 via ssh from within
3148 emacs. Reported by Karl Berry.
3150 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
3151 Otherwise, on systems (DJGPP) that emulate pipes using files,
3152 this test would never complete, waiting for `yes' to terminate.
3153 * tests/du/slink: As above, use seq, not `yes' to generate link target.
3154 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
3155 Reported by Rich Dawe.
3157 2003-03-27 Jim Meyering <jim@meyering.net>
3159 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
3160 from `written by...' comment, at his request.
3162 2003-03-24 Paul Eggert <eggert@twinsun.com>
3164 Fix buffer overrun problem reported by TAKAI Kousuke, along
3165 with some other POSIX incompatibilities.
3167 * src/printf.c (print_esc): Do not treat \x specially if
3168 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
3169 in backslash. Treat incomplete escape sequences as strings
3170 of characters, as POSIX requires.
3171 (print_formatted): Allow multiple flags. Avoid buffer overrun
3172 if the format is incomplete.
3174 2003-03-24 Jim Meyering <jim@meyering.net>
3176 * tests/misc/printf: Add tests for the above fixes and changes.
3178 2003-03-26 Jim Meyering <jim@meyering.net>
3180 * src/copy.h (struct cp_options): Add a comment.
3182 2003-03-23 Jim Meyering <jim@meyering.net>
3184 * README: Describe problem with 64-bit mode on HPUX 11.x,
3185 with patch for /usr/include/inttypes.h.
3186 * TODO: Plan to add an autoconf test to work around the bug.
3188 2003-03-22 Jim Meyering <jim@meyering.net>
3190 * src/stat.c: Don't include <sys/sysmacros.h>.
3191 That is already done via system.h. Otherwise, the multiple
3192 inclusion would evoke redefinition warnings from Cray's /bin/cc,
3193 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
3194 (human_fstype): Factor some directives `up', out of this function.
3195 Cast away `const' to avoid error from Cray's /bin/cc.
3197 2003-03-20 Jim Meyering <jim@meyering.net>
3199 * announce-gen (print_changelog_deltas): Ensure that a newline
3200 precedes each row of `*'s.
3202 2003-03-20 Jim Meyering <jim@meyering.net>
3206 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
3207 format flag characters.
3208 Do not require that a field width be specified.
3209 Do not fail when given a field width of `0'.
3210 Reported by Dan Jacobson.
3211 * tests/seq/basic: Add new tests for the above-fixed bug.
3213 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
3214 (install-root): Likewise.
3215 (install-exec-local): Likewise.
3216 Based on a patch from Richard Dawe.
3218 2003-03-19 Jim Meyering <jim@meyering.net>
3220 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
3221 because the DJGPP 2.03 port of 'ln -s' doesn't work.
3222 Include $(EXEEXT) in program names.
3223 Since $(LN_S) may degenerate to `cp -p', be careful
3224 to invoke it from the destination directory.
3225 Mostly from Richard Dawe.
3226 * configure.ac: Use AC_PROG_LN_S.
3228 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
3229 CDPATH shell variable set could cause this test to fail.
3230 Reported by Karl Berry.
3232 2003-03-18 Jim Meyering <jim@meyering.net>
3234 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
3235 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
3236 AIX 5.1's xlc could not compile the former.
3237 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
3239 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
3241 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
3242 program names, since automake only adds $(EXEEXT) to programs
3245 2003-03-16 Jim Meyering <jim@meyering.net>
3247 * src/remove.c (rm): Put two local variables in static storage,
3248 so they can't be clobbered by the potential longjmp.
3250 2003-03-15 Jim Meyering <jim@meyering.net>
3252 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
3253 so that a version number with a two-digit component can still count
3254 as an alpha release. Reported by Richard A Downing.
3255 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
3257 2003-03-14 Jim Meyering <jim@meyering.net>
3259 * src/ansi2knr.c: Remove no-longer-used file.
3260 * src/ansi2knr.1: Likewise.
3262 * Makefile.maint (prev_version_file): Don't use ?= for this particular
3263 assignment, since it causes trouble with old versions of GNU make
3264 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
3265 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
3266 Patch from Alexandre Duret-Lutz.
3268 * Use patched automake-1.7.3. Regenerate Makefile.in files in
3269 subdirectories so that each includes a definition of ACLOCAL_M4.
3271 * announce-gen (main): Label the compressed source URLs.
3275 * tests/du/slink: Relax the test for the `local'ness of a file system,
3276 so that now it works also for tmpfs.
3278 * tests/du/hard-link: Transform output from first du, so that this
3279 test doesn't fail on file systems like tmpfs that order directory
3280 entries differently.
3282 2003-03-13 Jim Meyering <jim@meyering.net>
3284 * tests/du/8gb: Work around what appears to be an NFS failure that
3285 would make this test fail on some systems.
3287 2003-03-11 Jim Meyering <jim@meyering.net>
3289 * tests/du/basic: Make the test file exactly 4k bytes long.
3291 * src/split.c (longopts): Don't hard-code `2' here.
3292 Instead, just specify `&verbose', and ...
3293 (main): ... remove the `case 2:' block for --verbose.
3295 * tests/du/basic: Make the test file larger than 64 bytes, so that
3296 we don't immediately disqualify file systems (e.g., NetApp) on which
3297 smaller files take up zero disk blocks. Reported by Vin Shelton.
3299 2003-03-10 Jim Meyering <jim@meyering.net>
3301 Don't segfault for a negative field width or precision in format string.
3302 Note that this is just a stopgap fix. The longer term solution may
3303 involve adapting bash's builtins/printf.def.
3305 * src/printf.c: (UNSPECIFIED): Define.
3306 (print_direc): Use the special value, UNSPECIFIED, to indicate
3307 that field_width or precision has not been specified.
3308 (print_formatted): Fail if field_width or precision is the
3309 special value, UNSPECIFIED.
3310 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
3312 * src/sys2.h (INT_MIN): Define, if necessary.
3313 * tests/misc/printf: Add a test for the above-fixed bug.
3315 2003-03-09 Jim Meyering <jim@meyering.net>
3317 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
3318 changing its sign. This avoids a warning from gcc on 64-bit systems.
3319 Reported by Bob Proulx.
3320 (pop_dir): Reverse order of sign change and cast, to be consistent
3323 2003-03-08 Jim Meyering <jim@meyering.net>
3325 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
3326 shell variable, but only in the environment. With /bin/sh->bash, the
3327 shell variable is set to `y', and that would cause a spurious warning.
3328 Reported by Bob Proulx.
3330 * tests/Makefile.am (check-root): Remove touch/fifo.
3331 It doesn't appear to have to be run as root.
3333 * tests/rm/fail-2eperm: Rather than simply using the first non-root
3334 user name, make sure that the selected user name has a usable shell.
3335 Reported by Paul Jarc.
3337 Before, when using shred on a device, one had to specify --exact,
3338 or be careful to choose a size that would not be rounded up and
3339 exceed the maximum value; that could result in a failure of
3341 * src/shred.c (do_wipefd): --exact is now the default for non-regular
3342 files. Suggestion from Ben Elliston.
3345 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
3346 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
3347 Patch by Bob Proulx.
3349 * src/Makefile.am (check-misc): Check for use of `defined' in
3351 Change to $(srcdir) before running grep.
3353 * src/sleep.c: Remove now-unused #include and #define directives.
3355 * src/du.c (process_file): If a file's size is not being counted
3356 e.g., because it's a hard link to a file we've already counted,
3357 then don't print a line for it.
3359 * tests/du/hard-link: New test for the above-fixed bug.
3360 * tests/du/Makefile.am (TESTS): Add hard-link.
3363 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
3364 and make the two-array approach work.
3366 * tests/du/basic: Correct/add tests for the above fix.
3367 Set LC_ALL, etc., now that we use sort.
3368 Check the block/size of a small file, too.
3369 Correct expected results for simple dir1/dir2/file case.
3370 Add another test of du -S.
3372 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
3374 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
3375 middle-end/9986). As one of GCC's optimizations, it transforms a
3376 fputs_unlocked call to a fputc_unlocked call when the string is
3377 one character long. However, hpux doesn't have fputc_unlocked.
3379 * expr.c (usage): Use putchar, not fputs, to output a single character.
3380 * ls.c (dired_dump_obstack): Likewise.
3381 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
3382 * stat.c (print_it): Likewise.
3384 2003-03-07 Jim Meyering <jim@meyering.net>
3386 * src/cp.c: Remove everything associated with mmap-stack.c.
3387 This reverts the two changes of 2003-02-21.
3388 * src/du.c: Remove everything associated with mmap-stack.c.
3389 This reverts the change of 2003-02-19.
3391 2003-03-06 Jim Meyering <jim@meyering.net>
3393 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
3394 CDPATH shell variable set could cause this test to fail.
3395 Reported by Karl Berry.
3397 2003-03-05 Jim Meyering <jim@meyering.net>
3401 * src/printf.c (print_esc): Remove pointless comparison of unsigned
3402 integer with zero, to avoid a warning from Intel's ecc.
3403 Reported by Nelson Beebe.
3405 * src/du.c (process_file): Sizes must all be of type uintmax_t.
3406 Otherwise, for files or totals that are too big, numbers would
3407 be truncated. Patch mostly by Michael Stone.
3408 Reported by Ingo Saitz as Debian bug #183210.
3410 * tests/du/8gb: New test for the above-fixed bug.
3411 * tests/du/Makefile.am (TESTS): Add 8gb.
3413 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
3414 rather than UTILS_OPEN_MAX - 10.
3416 2003-03-04 Jim Meyering <jim@meyering.net>
3418 * README: Refer new feature discussion to bug-coreutils@gnu.org,
3419 rather than bug-gnu-utils, now that the former is better known.
3420 Suggestion from Göran Uddeborg.
3422 * src/stat.c (usage): Capitalize consistently.
3423 Reported by Göran Uddeborg.
3425 * Makefile.maint (rel-files): Include $(signatures), so that
3426 those files are also copied into $(release_archive_dir).
3428 * src/df.c (find_mount_point): Call error here, now that restore_cwd
3430 * src/remove.c (AD_pop_and_chdir): Likewise.
3432 * tests/Makefile.am (check-root): Add fail-2eperm.
3434 2003-03-03 Jim Meyering <jim@meyering.net>
3436 * src/remove.c (remove_cwd_entries): Include the full filename of
3437 the offending file, not just the basename.
3439 * tests/misc/tty-eof: Set $ME properly.
3441 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
3442 Remove now-unused variables.
3443 (tag-prev-version, prev-cvs-tag): Likewise.
3445 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
3446 accurate diagnostic when failing to remove a file owned by some other
3447 user. Reported by Ivo Timmermans via Michael Stone.
3448 This fixes Debian bug# 178471.
3450 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
3451 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
3452 Based on a report from Ivo Timmermans.
3454 2003-03-02 Jim Meyering <jim@meyering.net>
3456 * src/copy.c (copy_internal) [un_backup]: When recovering from a
3457 failure to create a hard link, do not remove the entry associating
3458 the source dev/ino with the destination file name.
3459 * tests/mv/Makefile.am (TESTS): Add hard-3.
3460 * tests/mv/hard-3: New test, for the above-fixed bug.
3461 Inspired by a report from Iida Yosiaki.
3463 2003-03-01 Jim Meyering <jim@meyering.net>
3465 * src/df.c (print_header): Don't embed spaces in a separate `Type'
3466 header string. Instead, put `Filesystem' and `Type' headers in the
3467 same string, so translators can use horizontal space as needed.
3468 Reported by Jean Charles Delepine.
3470 2003-02-28 Jim Meyering <jim@meyering.net>
3472 * src/copy.c (copy_internal): When link fails because of an
3473 existing destination file, unlink that file and try again.
3474 Reported by Iida Yosiaki.
3476 * tests/mv/Makefile.am (TESTS): Add hard-2.
3477 * tests/mv/hard-2: New test for the above-fixed bug.
3478 Based on a test case from Iida Yosiaki.
3480 2003-02-26 Jim Meyering <jim@meyering.net>
3482 * tests/du/basic: Don't test du's -b option here. Directory byte
3483 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
3484 and IBM AIX 4.2. Reported by Nelson Beebe.
3486 2003-02-25 Jim Meyering <jim@meyering.net>
3488 * Makefile.maint (announcement): Now that ChangeLog entries
3489 are output by announce-gen, don't do it here.
3490 * announce-gen (print_changelog_deltas): New function.
3493 2003-02-22 Jim Meyering <jim@meyering.net>
3495 * announce-gen: New option: --release-type=TYPE
3496 * Makefile.maint (beta, major): New targets. Remove `release'.
3497 Put them all together on a line.
3498 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
3499 invocation of `announcement'.
3500 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
3502 * announce-gen: New option: --news=NEWS_FILE.
3503 Extract NEWS entries here, not via rules in Makefile.maint.
3504 * Makefile.maint (announcement): Now that NEWS entries are
3505 extracted by announce-gen, don't do it here.
3506 (news-r1, news-r2): Remove now-unused definitions.
3508 2003-02-21 Jim Meyering <jim@meyering.net>
3512 Merge in changes from autoconf's version of this file.
3513 * Makefile.maint (www-gnu): Define.
3514 (standards.texi-url_prefix): Use $(www-gnu).
3515 (make-stds.texi-url_prefix): Likewise.
3517 * src/cp.c: Include "mmap-stack.h".
3518 (main): Invoke `run' through a macro that (when possible) runs it
3519 with a large, mmap'd stack.
3521 * src/cp.c (run): New function, preparing for the above.
3522 Exit from this function, not from main
3525 * src/du.c: New option: --apparent-size.
3526 (enum) [APPARENT_SIZE_OPTION]: New member.
3527 (long_options): Add it.
3528 (usage): Describe it.
3530 ['b']: Set apparent_size.
3531 David Eisner reported that the behavior of --bytes had changed.
3532 Paul Eggert proposed the use of a new option, --apparent-size.
3534 * src/du.c (apparent_size): New global.
3535 (print_only_size): Reflect the fact that we're printing byte counts,
3536 not ST_NBLOCKSIZE-byte-block counts.
3537 (print_size): Call print_only_size rather than duplicating its code.
3538 (process_file): Accumulate byte counts, rather than block counts.
3540 * src/du.c (process_file): Always reset size_to_propagate_to_parent
3541 for --separate-dirs (-S).
3543 2003-02-20 Jim Meyering <jim@meyering.net>
3545 * Use automake-1.7.3. Regenerate dependent files.
3547 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
3548 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
3549 (usage) [%B]: Describe it.
3552 * src/du.c (process_file): Reorganize the code to use only
3553 one `sum' array, and change how -S works back to the way it was
3554 before 2003-01-31. Patch by Bruno Haible.
3556 * tests/du/basic: New test.
3557 * tests/du/Makefile.am (TESTS): Add basic.
3559 * tests/envvar-check: Add checks for the following:
3560 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
3562 * tests/Makefile.am: Rename phony target envvar-check to evar-check
3563 so as not to conflict with the distributed file by the same name.
3565 * src/du.c (process_file): Set info->skip before any possible return.
3567 Report correct usage for directories, not 0.
3568 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
3569 _before_ recording the dev/ino of a directory.
3570 Reported by Bruno Haible.
3572 Now, df always displays the device file name corresponding to the
3573 listed mount point under `Filesystem'. Before, for an unmounted
3574 block- or character-special file argument, it would display the
3575 command-line argument instead.
3576 * src/df.c (show_disk): Return a value indicating whether
3577 there was a match. Don't try to find a mount point here.
3578 (show_entry): If show_disk doesn't find a match, call show_point.
3580 2003-02-19 Jim Meyering <jim@meyering.net>
3582 * src/du.c: Include "mmap-stack.h".
3583 (du_files): Add prototype with ATTRIBUTE_NORETURN.
3584 Exit from this function, not from...
3586 Instead, if possible, invoke du_files through a macro that
3587 runs it with a large, mmap'd stack.
3589 * src/join.c (usage): Change wording in --help output:
3590 use FILENUM instead of `SIDE' and say what FILENUM means.
3591 Reported by Bernhard Gabler.
3593 * src/df.c (print_header): Rather than using a hard-coded literal
3594 string of spaces matching the length of the English `...Type' header,
3595 output the right number of spaces to match the selected translation.
3596 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
3598 * src/split.c (bytes_split): Remove unnecessary `else' after break.
3599 (lines_split): Likewise. and correct misleading indentation.
3601 * src/split.c: Include "full-read.h".
3602 (bytes_split, lines_split, line_bytes_split): Use full_read,
3603 not safe_read. The way split was using the latter, a short read
3604 could cause split to terminate before EOF.
3606 * tests/misc/tty-eof: Test all programs that can read stdin,
3607 requiring no arguments and that write to standard output.
3609 * tests/misc/tty-eof: New file. Renamed from ...
3610 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
3611 * tests/misc/Makefile.am (TESTS): Reflect renaming.
3613 2003-02-18 Jim Meyering <jim@meyering.net>
3615 cksum would perform an extra read after encountering EOF
3616 * src/cksum.c (cksum): Exit the loop upon EOF, too.
3617 Patch by Michael Bacarella.
3619 Test for the bug fixed today in cksum, md5sum, and sha1sum.
3620 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
3621 cat, cksum, md5sum, and sha1sum all in the same loop.
3623 2003-02-14 Jim Meyering <jim@meyering.net>
3625 * src/remove.c: Include "euidaccess.h".
3626 Remove declaration of euidaccess.
3628 2003-02-12 Jim Meyering <jim@meyering.net>
3630 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
3631 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
3633 2003-02-10 Jim Meyering <jim@meyering.net>
3635 * src/test.c: Don't include group-member.h.
3636 Include euidaccess.h.
3637 (eaccess): Rewrite function to set the real uid and gid temporarily
3638 to the effective uid and gid, then invoke 'access', and then set the
3639 real uid and gid back. On systems that lack setreuid or setregid,
3640 fall back on the kludges in euidaccess. Before, it would not work
3641 for e.g., files with ACLs, files that were marked immutable,
3642 or on file systems mounted read-only. Nelson Beebe raised the issue.
3643 Paul Eggert suggested the new implementation.
3645 2003-02-09 Jim Meyering <jim@meyering.net>
3647 * src/test.c (test_stat): Remove function. It's job is done (only
3648 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
3650 2003-02-08 Jim Meyering <jim@meyering.net>
3654 * tests/mv/part-symlink: Don't assume that the file owner username
3655 length is less than 9 in ls output: instead, omit that field
3656 altogether. Reported by, and suggested fix from, Ferdinand.
3658 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
3659 * tests/du/Makefile.am (TESTS): Add restore-wd.
3661 * src/rm.c: Correct now-invalid comment about cycle-detection.
3663 2003-02-06 Jim Meyering <jim@meyering.net>
3665 * NEWS: Add entries from old/*/NEWS
3666 from fileutils-4.1 through 4.1.11 and
3667 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
3671 * src/du.c (process_file): Don't return early for excluded files
3672 or for files whose dev/inode we've already seen.
3674 2003-02-05 Jim Meyering <jim@meyering.net>
3676 * tests/du/exclude: New file.
3677 * tests/du/Makefile.am (TESTS): Add exclude.
3679 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
3681 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
3682 Fix memory allocation arithmetic.
3684 2003-02-04 Jim Meyering <jim@meyering.net>
3686 `df /dev/block-or-char-device-file--not-mounted' now reports
3687 the name of the file system on which the file resides, usually `/'.
3688 Before, it would leave the `Mounted on' field blank.
3689 * src/df.c (show_disk): Move function to precede find_mount_point.
3690 (show_disk): Add parameter: STATP.
3691 If we don't find a matching device name, then resort to calling
3692 find_mount_point. Reported by Bob Proulx.
3694 2003-02-03 Andreas Schwab <schwab@suse.de>
3696 * tests/rm/cycle: Require non-root.
3697 * tests/rm/isatty: Likewise.
3699 2003-02-02 Jim Meyering <jim@meyering.net>
3703 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
3705 Ensure that there are no offending uses of `:'.
3706 * Makefile.maint (makefile_path_separator_check): New rule.
3707 (local-check): Add it to the list.
3709 2003-02-01 Jim Meyering <jim@meyering.net>
3711 * src/du.c (MAX_N_DESCRIPTORS): Define.
3713 * src/stat.c (G_fail): New global.
3714 (human_time): Diagnose failed localtime, not failed nstrftime.
3715 (main): Fail if G_fail is set.
3717 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
3719 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
3720 hard-coding the path-separator. Also double-quote the new PATH,
3721 to avoid problems when the path-separator is a semi-colon or when
3722 `pwd` contains e.g. a space.
3723 * tests/chgrp/Makefile.am: Likewise.
3724 * tests/chmod/Makefile.am: Likewise.
3725 * tests/chown/Makefile.am: Likewise.
3726 * tests/cp/Makefile.am: Likewise.
3727 * tests/dd/Makefile.am: Likewise.
3728 * tests/dircolors/Makefile.am: Likewise.
3729 * tests/du/Makefile.am: Likewise.
3730 * tests/expr/Makefile.am: Likewise.
3731 * tests/factor/Makefile.am: Likewise.
3732 * tests/fmt/Makefile.am: Likewise.
3733 * tests/install/Makefile.am: Likewise.
3734 * tests/ln/Makefile.am: Likewise.
3735 * tests/ls/Makefile.am: Likewise.
3736 * tests/ls-2/Makefile.am: Likewise.
3737 * tests/md5sum/Makefile.am: Likewise.
3738 * tests/misc/Makefile.am: Likewise.
3739 * tests/mkdir/Makefile.am: Likewise.
3740 * tests/mv/Makefile.am: Likewise.
3741 * tests/od/Makefile.am: Likewise.
3742 * tests/rm/Makefile.am: Likewise.
3743 * tests/rmdir/Makefile.am: Likewise.
3744 * tests/seq/Makefile.am: Likewise.
3745 * tests/sha1sum/Makefile.am: Likewise.
3746 * tests/shred/Makefile.am: Likewise.
3747 * tests/stty/Makefile.am: Likewise.
3748 * tests/sum/Makefile.am: Likewise.
3749 * tests/tail-2/Makefile.am: Likewise.
3750 * tests/touch/Makefile.am: Likewise.
3751 * tests/tsort/Makefile.am: Likewise.
3752 * tests/unexpand/Makefile.am: Likewise.
3754 2003-01-31 Jim Meyering <jim@meyering.net>
3756 * src/stat.c: Include "file-type.h"
3757 (print_human_type): Remove function.
3758 (human_access): Rename from print_human_access. Return a string.
3759 (human_time): Rename from print_human_time. Return a string.
3760 (print_stat): Arrange so that field width and an alignment specifier
3761 are honored for the %A, %F, %x, %y, and %z formats.
3762 [%F]: Use file_type; this gives slightly different file type strings,
3763 e.g., `directory' instead of `Directory' and `regular file' or
3764 `regular empty file' instead of `Regular file'.
3765 Prompted by a report from Richard Dawe that the uses of
3766 S_IFSOCK and S_IFIFO in print_human_time were not portable
3767 to systems using e.g., DJGPP.
3769 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
3771 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
3772 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
3774 2003-01-31 Jim Meyering <jim@meyering.net>
3776 * src/du.c (main): Upon processing an invalid option or an invalid
3777 --exclude-from or --max-depth option argument, don't exit right away,
3778 in case there are others. Rather record the failure and exit after
3779 processing other options.
3781 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
3782 tar archive easier to reproduce.
3784 Rewrite to perform directory traversal using nftw.
3786 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
3787 (AUTHORS): Add self.
3788 (opt_one_file_system): Move global into `main'.
3789 (path, xstat, exit_status): Remove declarations.
3790 (arg_length, suffix_length): New globals.
3791 (G_fail): New global, sort of like the old `exit_status'.
3792 (IS_FTW_DIR_TYPE): Define.
3793 (print_only_size): New function.
3794 (process_file): New function.
3795 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
3796 (str_trunc, pop_dir, count_entry): Likewise.
3797 (du_files): Rewrite to use nftw.
3799 2003-01-30 Jim Meyering <jim@meyering.net>
3801 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
3802 symlink-to-directory with -L, even without the trailing slash.
3804 2003-01-27 Jim Meyering <jim@meyering.net>
3806 * src/Makefile.am (check-misc): Check for st_blocks, too.
3808 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
3809 Reported by Richard Dawe.
3811 2003-01-27 Andreas Schwab <schwab@suse.de>
3813 * src/ls.c (quote_name): Add fourth parameter, width, into which to
3814 store the screen columns, and return the number of bytes instead.
3815 (print_dir): Pass NULL as fourth parameter of quote_name.
3816 (print_name_with_quoting): Likewise.
3817 (length_of_file_name_and_frills): Get the width from the fourth
3818 parameter of quote_name instead of return value.
3820 2003-01-27 Jim Meyering <jim@meyering.net>
3822 * src/ls.c (decode_switches): If `dired' is set without
3823 `format == long_format', then silently reset dired. This doesn't
3824 change the behavior of ls (all prior uses of dired were protected
3825 by `&& format == long_format'), and lets us...
3826 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
3827 (PUSH_CURRENT_DIRED_POS): Likewise.
3830 2003-01-22 Jim Meyering <jim@meyering.net>
3832 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
3833 * tests/du/Makefile.am (TESTS): Add no-x.
3835 2003-01-21 Jim Meyering <jim@meyering.net>
3837 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
3838 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
3839 it may still be a directory -- or not (e.g., with FreeBSD on an
3840 NFS-mounted file system), so resort to calling lstat to find out.
3841 Based on a patch by Michael van Elst.
3843 * tests/cp/same-file: Don't assume that the file owner username
3844 length is less than 9 in ls output: instead, omit that field
3845 altogether. Reported by, and suggested fix from, Ferdinand.
3847 2003-01-20 Jim Meyering <jim@meyering.net>
3849 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
3850 large format widths no longer cause strftime to infloop.
3852 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
3854 2003-01-19 Jim Meyering <jim@meyering.net>
3856 * src/readlink.c: Include "canonicalize.h".
3858 2003-01-18 Jim Meyering <jim@meyering.net>
3860 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
3862 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
3863 (long_options): Add option --dereference-command-line-symlink-to-dir.
3864 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
3865 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
3866 -d, -F, -l options is specified.
3867 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
3868 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
3869 Change --dereference-command-line (-H) to dereference *all*
3870 command line arguments, including broken symlinks.
3872 2003-01-15 Paul Eggert <eggert@twinsun.com>
3874 Change ls -H back to the way it was yesterday, since this is
3875 compatible with FreeBSD and the POSIX spec is confusing
3876 and somewhat contradictory.
3878 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
3879 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
3880 (long_options): Change the long option name back.
3881 (usage): Change the usage back.
3882 (gobble_file): When -H is specified, dereference a top-level
3883 arg even if it points to a non-directory.
3885 2003-01-15 Jim Meyering <jim@meyering.net>
3887 * src/ls.c (gobble_file): Fall back on using lstat when required:
3888 when --dereference (-L) is not specified, and
3889 - when operating on a dangling symlink
3890 - when operating on command-line-symlink-to-directories
3891 This fixes numerous problems. Here are examples:
3892 - `ls dangling-symlink' would fail with `no such file...'
3893 Now it prints `dangling-symlink'.
3894 - `ls -i symlink' would mistakenly print the inode of the referent.
3895 Now it prints the inode of the symlink. Likewise for --size (-s).
3896 Based on a patch from Michael Stone.
3897 Reported by Deepak Goel as Debian bug #173793.
3899 Rename ls's --dereference-command-line (-H)
3900 option to --dereference-command-line-symlink-to-dir.
3901 * src/ls.c [enum Dereference_symlink]
3902 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
3903 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
3904 (long_options): Rename the long option.
3905 (usage): Say that --dereference-... changes how ls treats
3906 only symlinks to directories specified on the command line.
3908 2003-01-14 Jim Meyering <jim@meyering.net>
3910 * tests/ls/dangle: New file/test, for the above fix.
3911 * tests/ls/inode: Another new file/test, for the above fix.
3912 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
3914 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
3915 so that ls --color would no longer highlight the names of files with
3916 the execute bit set when not specified on the command line.
3917 Patch by Michael Stone. Reported by Stephen Depooter as
3920 * tests/ls-2/tests (color-exe): New test, for the above fix.
3922 2003-01-13 Jim Meyering <jim@meyering.net>
3924 * tests/shred/exact: Also test for just fixed bug with --zero.
3926 * src/shred.c (long_opts): --zero does not require an argument.
3927 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
3929 2003-01-12 Jim Meyering <jim@meyering.net>
3931 * Makefile.maint (cvs-update): Skip any file with local modifications.
3933 * src/unexpand.c (usage): Document --first-only and mention that
3934 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
3936 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
3938 * src/df.c: Include "canonicalize.h".
3939 Use canonicalize_file_name unconditionally.
3941 2003-01-09 Jim Meyering <jim@meyering.net>
3943 * README: Add readlink.
3945 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
3947 * src/df.c: Include "xgetcwd.h".
3948 * src/pwd.c: Likewise.
3950 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
3952 * src/shred.c: Remove declaration of xstrdup.
3953 We already get it via xalloc.h which is included via system.h.
3955 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
3957 New program: readlink.
3959 * src/Makefile.am (bin_PROGRAMS): Add readlink.
3960 * src/readlink.c: New file.
3962 * man/readlink.x: New file.
3963 * man/Makefile.am (dist_man_MANS): Add readlink.1.
3964 (readlink.1): New rule.
3966 2003-01-09 Jim Meyering <jim@meyering.net>
3968 When selecting ranges of byte offsets (as opposed to ranges of fields)
3969 and when --output-delimiter=STRING is specified, output STRING between
3970 ranges of selected bytes.
3971 * src/cut.c (RANGE_START_SENTINEL): Define.
3972 (output_delimiter_specified): New global.
3973 (print_kth): Add parameter. Adjust all callers.
3974 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
3975 (cut_bytes): When requested, output STRING between ranges of
3977 (main): Make a diagnostic a little clearer.
3978 Based on a patch from Jan Nieuwenhuizen.
3980 * tests/cut/Test.pm: New tests for the above.
3982 * src/cut.c (set_fields): Make code agree with comment:
3983 Don't merge abutting ranges like 4- and 2-3. This makes no
3984 difference currently, but is required to support an upcoming change.
3986 2003-01-07 Jim Meyering <jim@meyering.net>
3988 * src/cut.c (set_fields): Fix typo in comment.
3990 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
3991 * tests/touch/Makefile.am (TESTS): Add not-owner.
3992 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
3993 Now, this tests only the nonexistent-directory diagnostic.
3994 Suggestion from Michael Stone.
3996 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
3998 2003-01-04 Jim Meyering <jim@meyering.net>
4000 * src/copy.h: Remove use of PARAMS.
4001 * src/remove.h: Likewise.
4002 * src/chown-core.h: Likewise.
4004 rm could be tricked into mistakenly reporting a cycle.
4005 * src/remove.c: [cycle_check_state]: New global.
4006 (remove_cwd_entries): Adapt to new semantics of cycle_check.
4007 (rm): Call cycle_check_init and cycle_check_free for each file.
4008 * tests/rm/cycle (rm): New test, for the above fix.
4009 * tests/rm/Makefile.am (TESTS): Add cycle.
4011 When rm detects a cycle, don't abort the entire command,
4012 but rather just the affected command line argument.
4013 * src/remove.c: Include <setjmp.h>
4014 (struct dirstack_state) [current_arg_jumpbuf]: New member.
4015 (remove_cwd_entries): Call longjmp if we detect a cycle.
4016 (rm): Call setjmp here.
4018 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
4019 Instead, include cycle-check.h and use it.
4021 * src/remove.h (struct dev_ino): Remove declaration.
4023 * src/remove.c (remove_cwd_entries): Fix typos in comment.
4025 Don't include trailing /. in diagnostics about directories.
4026 * src/remove.c (full_filename_): When FILENAME is just `.'
4027 and there is a nonempty directory-name part, don't append `/.'.
4028 * tests/rm/unread2: Remove trailing /. from diagnostic.
4029 * tests/rm/rm2: Likewise.
4031 * src/remove.c (struct dirstack_state): Define.
4032 To be used in place of these file-scoped globals ...
4033 (dir_stack, len_stack, Active_dir): Remove globals.
4034 (ds_init, ds_free): New functions.
4035 (full_filename): Define.
4036 (full_filename_): Rename from full_filename.
4038 Begin to make AD_* functions more generic.
4039 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
4040 (AD_push): Likewise.
4041 (AD_INIT_OTHER_MEMBERS): Define.
4042 (remove_dir): Define the `status' member manually after each
4043 call to AD_push or AD_push_initial.
4045 * src/Makefile.am (check-misc): New rule, to ensure that no more
4046 S_IS* macro definitions sneak into the code.
4047 (check): Depend on check-misc.
4049 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
4050 * src/du.c (count_entry) [S_ISLNK]: Don't define.
4051 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
4053 2003-01-03 Jim Meyering <jim@meyering.net>
4055 * src/true.c: Add copyright.
4056 (AUTHORS): I suppose I've written it.
4058 * src/Makefile.am (false.c): Make the generated file be read-only.
4060 2003-01-04 Jim Meyering <jim@meyering.net>
4062 * src/ls.c: Include "dev-ino.h".
4063 [struct dev_ino]: Remove declaration.
4065 2003-01-02 Jim Meyering <jim@meyering.net>
4067 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
4068 from mv: s/missing file arguments/missing file argument/.
4069 With --target-directory=DIR, cp and mv work with a single file argument.
4070 Reported by Karl Berry.
4072 * tests/rm/isatty: Enable this test.
4074 2002-12-31 Jim Meyering <jim@meyering.net>
4076 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
4077 (AD_push): Likewise.
4078 (AD_INIT_OTHER_MEMBERS): Define.
4079 (remove_dir): Define the `status' member manually after each
4080 call to AD_push or AD_push_initial.
4082 * src/ls.c [struct dev_ino]: Remove definition.
4083 Include "dev-ino.h" instead.
4085 2002-12-28 Jim Meyering <jim@meyering.net>
4087 * tests/du/Makefile.am (TESTS): Add no-deref.
4088 * tests/du/no-deref: New script.
4090 2002-12-23 Jim Meyering <jim@meyering.net>
4092 * src/remove.c (remove_cwd_entries): Fix typo in comment.
4094 2002-12-21 Jim Meyering <jim@meyering.net>
4096 * announce-gen: Generate MML-formatted announcement.
4097 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
4099 2002-12-20 Jim Meyering <jim@meyering.net>
4101 * src/touch.c (touch): Change the wording of a diagnostic so
4102 that it makes sense both when the file exists and when it doesn't.
4103 Suggestion from Michael Stone.
4105 2002-12-18 Jim Meyering <jim@meyering.net>
4107 * src/stty.c (valid_options): Declare to be static.
4109 2002-12-15 Jim Meyering <jim@meyering.net>
4111 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
4113 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
4114 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
4115 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
4116 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
4117 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
4119 * src/remove.c (PARAMS): Remove definition.
4120 * src/sys2.h: Likewise.
4122 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
4123 Include strftime.h instead.
4125 2002-12-14 Jim Meyering <jim@meyering.net>
4127 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
4129 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
4130 This is necessary at least for Irix6.5 when using c89.
4131 Reported by Nelson Beebe.
4133 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
4135 * tests/misc/cat-tty-eof: New test.
4137 * src/mknod.c (usage): Specify how major and minor mode numbers
4138 are interpreted. Report forwarded by Kristin E Thomas.
4139 * src/mknod.c: Remove now-redundant usage-specifying comment.
4141 2002-12-13 Jim Meyering <jim@meyering.net>
4145 * tests/du/trailing-slash: Allow for a directory of size `0'.
4146 That happens at least on file systems of type tmpfs on linux-2.4.18.
4148 * announce-gen: New script to begin replacing the commands
4149 associated with the rule here...
4150 * Makefile.maint (announcement): Invoke announce-gen.
4151 * Makefile.am (EXTRA_DIST): Add announce-gen.
4153 * tests/cp/preserve-2: New file/test, for latest fix.
4154 * tests/cp/Makefile.am (TESTS): Add preserve-2.
4156 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
4158 Fix a bug whereby cp would fail to parse an option like
4159 --preserve=mode,ownership.
4160 * src/cp.c (decode_preserve_arg): Advance `comma' to
4161 point the character following the comma.
4163 2002-12-11 Jim Meyering <jim@meyering.net>
4165 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
4166 in case it's already defined.
4168 2002-12-09 Jim Meyering <jim@meyering.net>
4170 * tests/touch/fail-diag: Don't get a test failure if /no exists.
4171 Instead, evoke a framework failure if /no-$$ exists.
4172 Reported by Michael Stone.
4174 2002-12-08 Jim Meyering <jim@meyering.net>
4176 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
4177 Define to rpl_lstat, so that even on systems like Solaris 5.8,
4178 du honors (per POSIX) the trailing slash on an argument referring
4179 to a symlink-to-directory.
4181 2002-12-06 Jim Meyering <jim@meyering.net>
4183 * Use autoconf-2.57. Regenerate dependent files.
4184 * Use automake-1.7.2. Regenerate dependent files.
4186 * src/ls.c (gobble_file): Also stat the file if it's a
4187 regular file and --indicator-style=classify (aka -F).
4188 Thanks to Ed Santiago for opening my eyes.
4190 * tests/ls/file-type: New file. Test for the above.
4191 A test to contrast ls -F and ls --indicator-style=file-type.
4192 * tests/ls/Makefile.am (TESTS): Add file-type.
4194 2002-12-04 Jim Meyering <jim@meyering.net>
4196 * tests/ls/follow-slink: Make sure the symlink was created.
4197 Richard Dawe reported that `ln -s link link' succeeds, but creates
4198 no file on systems running some version of the DJGPP libc.
4200 2002-12-03 Jim Meyering <jim@meyering.net>
4202 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
4203 since this package no longer panders to K&R compilers.
4205 2002-12-02 Jim Meyering <jim@meyering.net>
4207 * tests/du/slink: Skip this test if `.' is on a non-local file system.
4209 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
4210 something to replace.
4212 2002-12-01 Jim Meyering <jim@meyering.net>
4214 * src/stat.c: Don't include <string.h> or <ctype.h>.
4215 That's already done via system.h.
4216 * src/dircolors.c: Don't include <ctype.h>.
4218 2002-11-30 Jim Meyering <jim@meyering.net>
4220 * ls.c (gobble_file): Remove the block of code that caused
4221 `ls --color -F symlink-to-dir' to list the files in
4222 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
4223 like `ls -F symlink-to-dir') but with the addition of highlighting.
4224 Similarly, `ls --color -dF symlink-to-dir' would print
4225 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
4226 Reported by Jeff Sheinberg as Debian bug #168203.
4227 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
4229 ls is now more efficient: with certain options, it no longer needs
4230 to stat each directory entry on systems with valid dirent.d_type.
4231 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
4232 (main): Make --recursive set format_needs_type, not format_needs_stat.
4233 (gobble_file): Remove a FIXME comment, now that it's fixed.
4235 2002-11-24 Jim Meyering <jim@meyering.net>
4237 * src/du.c (du_files): Don't strip any trailing slash.
4238 Rewrite so that `/' is no longer represented internally as
4240 (count_entry): When appending a file name component,
4241 account for the fact that the current path may end in `/'.
4242 François Pinard reported that `du symlink-to-dir/' was not
4243 equivalent to `du symlink-to-dir/.'. Now it is.
4244 * tests/du/trailing-slash: New file/test, for the above fix.
4245 * tests/du/Makefile.am (TESTS): Add trailing-slash.
4247 2002-11-23 Jim Meyering <jim@meyering.net>
4249 * src/tac.c (output): Declare some local variables to be of type size_t,
4250 rather than `int' to avoid warnings from gcc.
4252 2002-11-21 Paul Eggert <eggert@twinsun.com>
4254 * src/ls.c (decode_switches): Use case-sensitive matching to
4255 decode the QUOTING_STYLE environment variable. This is more
4256 consistent with the documentation, and with --quoting-style.
4258 2002-11-21 Martin Buck <martin.buck@ascom.ch
4260 * src/stty.c (struct speeds): Add support for all baud rates defined
4263 2002-11-19 Jim Meyering <jim@meyering.net>
4265 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
4266 run in a UTF locale. Report and suggested fix by Bruno Haible.
4267 * tests/fmt/basic: Likewise.
4269 2002-11-17 Jim Meyering <jim@meyering.net>
4271 * configure.ac: Update via autoupdate.
4272 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
4274 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
4275 Reported by Hans Ginzel.
4277 2002-11-15 Jim Meyering <jim@meyering.net>
4279 * Makefile.cfg (gnu_rel_host): Define.
4280 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
4281 on whether $(VERSION) looks like a major release number.
4283 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
4284 (release): Rename from `alpha'.
4285 (alpha): Depend on release.
4287 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
4289 2002-11-14 Jim Meyering <jim@meyering.net>
4291 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
4292 (announcement): Use the new variable.
4294 * Makefile.maint: Sync with Bison, i.e.:
4295 (po-check): Scan .l and .y files instead of the
4296 .c and the .h files that they generate. This fixes the bug
4297 reported by Tim Van Holder in:
4298 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
4299 Look for N_ as well as for _. Try to avoid matching #define for
4303 2002-11-12 Jim Meyering <jim@meyering.net>
4305 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
4306 Replace sole use with equivalent `#ifdef S_ISLNK'.
4307 Inconsistency reported by Dmitry V. Levin.
4309 2002-11-11 Jim Meyering <jim@meyering.net>
4311 * src/stat.c (usage): Transform --help items output via s/ - / /,
4312 so that help2man produces properly formatted man pages.
4313 Reported by Herbert Xu as Debian bug #168400.
4315 2002-11-10 Jim Meyering <jim@meyering.net>
4317 * src/ls.c (sighandler): Handle SIGTSTP specially.
4318 Based on suggestions from Solar Designer and Dmitry V. Levin.
4321 * Makefile.cfg (cvs_files): Define. From autoconf.
4322 (local_updates): Likewise.
4324 * src/ls.c (restore_default_color_handler, sigtstp_handler):
4326 (sighandler): New function, based on the one in sort.c.
4327 (main): Use sigaction, if possible; otherwise signal.
4328 Handle these signals:
4329 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
4330 Don't register our handler if the signal is already being ignored.
4332 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
4333 * src/csplit.c (interrupt_handler): Likewise.
4334 * src/sort.c (sighandler): Likewise.
4335 (main): Declare `i' and `nsigs' to be unsigned, not int.
4337 2002-11-09 Jim Meyering <jim@meyering.net>
4339 ls --color: restore terminal text color upon signal.
4340 * src/ls.c: Include "full-write.h" and <signal.h>.
4341 (restore_default_color, restore_default_color_handler): New functions.
4342 (sigtstp_handler, put_indicator_direct): New functions.
4343 (main) [print_with_color]: Register signal handlers.
4344 Patch mostly by Solar Designer and Stanislav Ievlev.
4346 Update from autoconf.
4347 * Makefile.maint (AMTAR): Remove definition.
4348 (update, cvs-update, po-update, do-po-update): New rules.
4349 (wget-update): Update (thus renaming to cvs-update).
4350 (automake_repo): Use anoncvs@sources.redhat.com.
4352 2002-11-06 Jim Meyering <jim@meyering.net>
4354 * tests/misc/Makefile.am (TESTS): Add printf-hex.
4356 * tests/misc/printf: Be careful to test the code in this package,
4357 not the shell built-in function.
4359 * src/printf.c (print_esc): A hexadecimal escape sequence has
4360 at most two hex. digits, not three. Reported by Padraig Brady.
4361 (usage): Update description.
4362 * tests/misc/printf-hex: New file/test, for the above fix.
4364 2002-10-07 Paul Eggert <eggert@twinsun.com>
4366 Add support for locale-specific size indications (e.g.,
4367 thousands-separators) and for explicit size suffixes on output.
4369 * doc/coreutils.texi (Block size): Say that:
4370 This affects display format as well as block size.
4371 Fractional block counts are rounded up.
4372 ls file size blocksize defaults to 1.
4373 A block size spec preceded by ' generates thousands separators.
4374 A suffix without a preceding integer generates suffixes.
4375 (tail invocation): 32k -> 32 KiB.
4376 (What information is listed): ls -h is now equivalent to
4377 ls --block-size=human, and ls -H is now equivalent to
4378 ls --block-size=si. Displayed file size is now always affected by
4381 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
4382 lib/umaxtostr.c: New files, taken from GNU tar.
4384 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
4386 (EXTRA_DIST): Add inttostr.c.
4388 * lib/human.c, lib/human.h: Rewrite to support locale-specific
4389 notations like thousands separators.
4390 Specify what includer of include.h must include beforehand.
4391 (human_group_digits, human_suppress_point_zero, human_autoscale,
4392 human_base_1024, human_SI, human_B): New enum values.
4393 (human_readable): Rename from human_readable_inexact; put the
4394 options before the sizes. All uses changed. The old human_readable
4395 function has been removed; use inttostr.h instead.
4396 (human_options): Renamed from human_block_size, with new signature
4397 that allows block sizes up to UINTMAX_MAX. All callers changed.
4399 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
4400 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
4401 freestanding C89. No need to check for stdlib.h or string.h since
4402 autoconf does this now.
4404 * src/cksum.c (cksum): Use primitives from inttostr.h, not
4405 human.h, to print large numbers simply.
4406 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
4407 * src/dd.c (print_stats, main): Likewise.
4408 * src/df.c (print_header): Likewise.
4409 * src/factor.c (print_factors): Likewise.
4410 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
4411 * src/shred.c (dopass): Likewise.
4412 * src/sort.c (checkfp): Likewise.
4413 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
4414 * src/tail.c (xlseek): Likewise.
4415 * src/wc.c (write_counts, wc): Likewise.
4417 * src/df.c (human_output_opts): New var.
4418 (output_block_size): Now uintmax_t, not int, to handle larger
4419 block sizes. All uses changed.
4420 * src/du.c: Likewise.
4421 * src/ls.c: Likewise.
4423 * src/df.c (print_header): In the header line, prefer SI to human
4424 representation if it's shorter; if neither is shorter, try to
4425 intuit what the user would prefer.
4427 * src/expr.c (inttostr): Remove; use new imaxtostr library
4430 * src/ls.c (file_output_block_size): New var, to distinguish
4431 file sizes from other sizes.
4432 (decode_switches): Set it.
4434 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
4435 (dopass): When printing progress, use floor for what has been done
4436 so far (since we should be conservative there), and ceiling for
4437 what needs to be done (since that's what other programs use).
4439 2002-10-19 Jim Meyering <jim@meyering.net>
4441 * src/pinky.c (print_heading): Align TTY and Name headings.
4442 Reported by Karl Eichwalder.
4444 2002-10-18 Jim Meyering <jim@meyering.net>
4446 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
4447 Remove now-useless cast.
4448 (stdread): Remove function.
4449 (bytes_split): Use size_t instead of int.
4450 Use safe_read, not stdread.
4451 (lines_split): Likewise.
4452 Use memchr rather than a `while' loop.
4453 (line_bytes_split): Use size_t instead of int.
4454 Use safe_read, not stdread.
4455 (main): Add some FIXME comments to remind me to remove casts.
4457 * src/system.h (ST_BLKSIZE): Correct comment describing how to
4458 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
4460 2002-10-17 Jim Meyering <jim@meyering.net>
4462 Fix a problem that could make e.g., `cat' misbehave on systems which
4463 give invalid (unreasonably large) values for stat.st_blksize.
4464 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
4465 Reported by Petter Reinholdtsen.
4467 2002-10-14 Jim Meyering <jim@meyering.net>
4469 Specifying a printf conversion specifer as nl's separator string
4470 could cause nl to segfault.
4471 * src/nl.c (build_print_fmt): Don't include separator string
4472 in the printf format; it might contain `%'.
4473 Use a better bound on the length of the print_fmt buffer.
4474 (print_lineno): Print the separator here instead.
4475 Reported by Doug Coleman.
4477 * tests/misc/nl: New file/tests, including a test for the above.
4478 * tests/misc/Makefile.am (TESTS): Add nl.
4480 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
4481 * tests/misc/Makefile.am (TESTS): Add split-l.
4483 2002-10-13 Jim Meyering <jim@meyering.net>
4487 * src/du.c (usage): Tweak description of --dereference-args/-D.
4489 * src/du.c (count_entry): Also save cwd when dereferencing (via
4490 --dereference-args, -D) a command-line argument.
4491 Reported by Michal Svec. Based on a patch by Andreas Schwab.
4493 * src/Makefile.am (../AUTHORS): New target/rule.
4495 2002-10-12 Jim Meyering <jim@meyering.net>
4497 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
4498 of type size_t, since that's the way it's used and avoids a warning.
4500 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
4501 since that's how it's always used and avoids a new warning from gcc.
4502 (read_input): Adapt to new safe_read ABI.
4504 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
4507 * src/pinky.c (print_long_entry): fread returns size_t.
4508 Declare local `bytes' accordingly, to avoid warning.
4510 tail -c +N would perform an extra read after encountering EOF
4511 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
4512 * src/tail.c (start_bytes): Detect EOF, inform caller.
4513 (tail_bytes): Upon EOF in start_bytes, return immediately.
4514 (file_lines): Reorganize to use memrchr rather than an explicit loop.
4515 Adapt to new safe_read ABI.
4517 2002-10-11 Jim Meyering <jim@meyering.net>
4519 * tests/du/deref: New file/test, for the above fix.
4520 * tests/du/Makefile.am (TESTS): Add deref.
4522 2002-10-10 Jim Meyering <jim@meyering.net>
4524 * tests/ln/Makefile.am (TESTS): Add target-1.
4525 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
4527 2002-10-09 Jim Meyering <jim@meyering.net>
4529 * tests/cp/backup-is-src: Ensure that certain environment variables
4530 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
4532 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
4533 consume 4GB of disk space on systems without support for sparse files.
4534 Fix a logic error that'd make it `cat err' even though dd didn't fail.
4536 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
4537 Patch by steven@magelico.net, forwarded by Michael Stone.
4539 * tests/ls/dired: Ensure that ls produces English messages.
4540 Patch by Alexey Vyskubov, forwarded by Michael Stone.
4542 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
4544 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
4546 2002-10-08 Jim Meyering <jim@meyering.net>
4548 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
4549 Fix syntax in test: use =, not ==.
4550 Reported by Bob Proulx.
4551 Change all the rest like this: grep -lR "testing framework'" .\
4552 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
4554 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
4555 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
4556 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
4557 * src/wc.c (wc): Likewise.
4559 2002-10-07 Paul Eggert <eggert@twinsun.com>
4562 Don't advance the write pointer past the end of the write buffer.
4563 * src/sort.c (begfield, limfield): Likewise.
4565 2002-10-07 Jim Meyering <jim@meyering.net>
4567 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
4568 * src/head.c (head_bytes, head_lines): Likewise.
4570 2002-10-06 Jim Meyering <jim@meyering.net>
4572 * src/dd.c (scanargs): Ensure that specified block sizes (specified
4573 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
4574 (skip, dd_copy): Adapt to new safe_read ABI.
4576 * Makefile.maint (signatures): Define.
4578 (announcement): Depend on $(signatures).
4580 * Makefile.maint (announcement): Output all URLs for detached
4581 signatures, not just the last one from the previous loop.
4583 2002-10-05 Jim Meyering <jim@meyering.net>
4587 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
4588 don't recurse into directory, DIR. Prompted by a report from
4591 * tests/rm/i-no-r: New file/test, for the above fix.
4592 * tests/rm/Makefile.am (TESTS): Add i-no-r.
4594 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
4595 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
4597 2002-10-03 Jim Meyering <jim@meyering.net>
4599 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
4600 * src/df.c (AUTHORS): Likewise.
4601 * src/du.c (AUTHORS): Likewise.
4602 * src/tail.c (AUTHORS): Likewise.
4603 * src/touch.c (AUTHORS): Likewise.
4605 2002-10-02 Jim Meyering <jim@meyering.net>
4607 * Makefile.am (SUBDIRS): Remove `old'.
4608 (EXTRA_DIST): List the files in old/.
4609 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
4610 Suggestion from Akim Demaille.
4612 2002-10-01 Jim Meyering <jim@meyering.net>
4614 * src/sys2.h (SSIZE_MAX): Define.
4616 2002-09-30 Jim Meyering <jim@meyering.net>
4618 * src/csplit.c: Don't include stdlib.h here. It's already included
4621 2002-09-29 Jim Meyering <jim@meyering.net>
4623 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
4624 expression to avoid bogus warning from gcc.
4626 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
4627 (cat): Declare insize and outsize to be of type size_t, not int.
4628 Rearrange pointer/integer expressions to avoid bogus warnings.
4629 (main): Declare insize and outsize to be of type size_t, not int.
4631 * src/tail.c (parse_options): Give a sensible diagnostic for
4632 an invalid byte or line count. Reported by Mikko Tuumanen.
4634 * src/touch.c (main): Split a long line.
4636 * tests/du/Makefile.am (TESTS): Add slink.
4637 * tests/du/slink: New test for system.h change of 2002-08-31.
4639 In move mode, always first try to rename. Before, upon failure to
4640 rename a directory, this code would never attempt to rename any
4641 other file in that directory, but would thenceforth always copy.
4642 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
4643 may fail with EXDEV, yet renaming files within that directory to
4644 a newly-created destination directory succeeds.
4645 * src/copy.c (copy_internal): Remove local, move_mode;
4646 use x->move_mode instead. Based on a patch from Tom Haynes.
4648 2002-09-28 Jim Meyering <jim@meyering.net>
4650 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
4651 Factor out some duplication.
4653 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
4655 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
4657 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
4658 to avoid compiler warnings.
4660 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
4663 Fix things so `mkdir -p' can create very deep directories, e.g.,
4664 mkdir -p $(perl -e 'print "a/" x 40000') now works.
4665 * src/mkdir.c (main): For --parents (-p), call make_path with the
4666 entire directory name, so we don't ever require that file operations
4667 like stat or chmod be performed on the entire command line argument.
4668 * makepath.c (make_path): Restore umask *before* creating the final
4671 2002-09-27 Andreas Schwab <schwab@suse.de>
4673 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
4674 to avoid overflow. Reported by Hans Lermen.
4676 2002-09-26 Jim Meyering <jim@meyering.net>
4678 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
4680 2002-09-25 Jim Meyering <jim@meyering.net>
4682 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
4683 and add a cast, to avoid a warning about `signed and unsigned type in
4684 conditional expression'.
4686 2002-09-22 Jim Meyering <jim@meyering.net>
4688 * src/rmdir.c: Include "dirname.h", for declaration of
4689 strip_trailing_slashes.
4691 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
4692 Now they're defined through system.h.
4694 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
4695 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
4696 since it's already included from sys2.h via system.h.
4698 * Use automake-1.6f. Regenerate dependent files.
4700 * src/Makefile.am (PERL): Remove duplicate definition.
4702 fmt's -s, -t, -c options didn't work properly for long lines.
4703 Since get_line may end up calling put_paragraph (for long lines),
4704 be sure to set global, `other_indent', before it is used there.
4706 * src/fmt.c (set_other_indent): New function, factored out of...
4707 (get_paragraph): ... here. Call it.
4708 (get_line): Call set_other_indent before calling flush_paragraph,
4709 which calls fmt_paragraph, which in turn calls put_paragraph,
4710 which uses other_indent.
4712 * tests/fmt/Makefile.am (TESTS): Add long-line.
4713 * tests/fmt/long-line: New file/test, for the above fix.
4715 2002-09-21 Jim Meyering <jim@meyering.net>
4717 * src/od.c: No longer include deprecated <values.h>.
4718 It was required solely for now-removed reference to BITSPERBYTE.
4719 * src/install.c: Likewise.
4720 Suggestion from Bruno Haible.
4722 2002-09-06 Andreas Schwab <schwab@suse.de>
4724 `rmdir -p dir-specified-with-trailing-slash/' would fail.
4725 * src/rmdir.c (remove_parents): Strip trailing slashes.
4727 2002-09-20 Jim Meyering <jim@meyering.net>
4729 * tests/rmdir/t-slash: New file/test, for the above fix.
4730 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
4732 * Makefile.maint (announcement): Arrange to gpg-sign the message.
4733 Add a URL for each detached signature file.
4735 2002-09-07 Bruno Haible <bruno@clisp.org>
4737 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
4739 2002-09-18 Jim Meyering <jim@meyering.net>
4741 `od -t x8' used the wrong (`l'-prefixed) printf format.
4742 Likewise for the o8 and u8 formats.
4743 * src/od.c (ISPEC_TO_FORMAT): Define macro.
4744 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
4745 Reported by Arun Sharma.
4747 2002-09-17 Jim Meyering <jim@meyering.net>
4749 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
4750 From gettext's intl/loadmsgcat.c.
4752 * tests/od/x8: New file/test, for the above fix.
4753 * tests/od/Makefile.am (TESTS): Add x8.
4755 2002-09-15 Jim Meyering <jim@meyering.net>
4757 * Use autoconf-2.54. Regenerate dependent files.
4759 * src/csplit.c (get_format_width): Add cast to avoid
4760 warning about `signed and unsigned type in conditional expression'.
4762 2002-09-14 Jim Meyering <jim@meyering.net>
4764 * src/who.c (print_user): Change type of local to size_t
4765 to avoid warnings about `comparison between signed and unsigned'.
4766 * src/ptx.c (generate_all_output): Likewise.
4768 * src/dd.c (main, skip): Add casts to avoid warnings about
4769 `comparison between signed and unsigned'.
4771 * src/id.c (print_full_info, print_group_list): Add casts to avoid
4772 warnings about `signed and unsigned type in conditional expression'.
4774 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
4775 to avoid warnings about `comparison between signed and unsigned'.
4776 (split_3): Change parameter names to be readable and add comment.
4777 Clean up the test for whether a line may be ignored.
4779 2002-09-13 Jim Meyering <jim@meyering.net>
4781 * src/printf.c (main): Handle leading command line argument of `--'.
4782 Reported by Raul: DervishD <raul@pleyades.net>
4783 * tests/misc/printf: New file: test for the above.
4784 * tests/misc/Makefile.am (TESTS): Add printf.
4786 * src/date.c (usage): Explain that %S's range of [0..60] is required --
4787 rather than 0..59 -- to accommodate the occasional positive leap second.
4788 Reported by Richard Neill.
4790 2002-09-12 Jim Meyering <jim@meyering.net>
4792 * src/Makefile.am (nanosec_libs): Define.
4793 (sleep_LDADD, tail_LDADD): Use it here.
4795 Factor nanosleep-related code into ../lib/xnanosleep.c.
4796 * src/sleep.c: Include xnanosleep.h.
4797 Factor out fenv.h-related code.
4798 (timespec_subtract): Remove function.
4799 (main): Remove code that deals with computing start and stop times
4800 as well as the loop around nanosleep. Now that's in xnanosleep.c.
4802 Allow S (in --sleep-interval=S) to be a floating point value.
4803 * src/tail.c: Include xnanosleep.h and xstrtod.h.
4804 Move declaration of global variable, sleep_interval, to ...
4806 (usage): Update description of --sleep-interval option.
4807 (tail_forever): New parameter, sleep_interval. Update caller.
4808 Use xnanosleep, rather than sleep.
4809 (parse_options): New parameter, sleep_interval. Update caller.
4810 Use xstrtod, now that we accept floating point values.
4811 Prompted by a patch from Augey Mikus.
4813 2002-09-06 Jim Meyering <jim@meyering.net>
4815 * src/remove.c (prompt): Change comment to give a better note to
4816 translators. From Michael Piefel.
4818 2002-09-02 Jim Meyering <jim@meyering.net>
4820 * README: A good problem report/patch includes diffs against
4821 the most recent test release.
4823 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
4824 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
4826 * src/kill.c (print_table_row): Use an unsigned type for widths
4827 to avoid warning about comparison between signed and unsigned.
4828 (list_signals): Likewise.
4830 * src/od.c (skip): Add a cast to avoid warning about comparison
4831 between signed and unsigned.
4832 * src/install.c (get_ids): Likewise. Also rearrange range-checking
4833 comparisons to make them more readable.
4835 2002-09-01 Jim Meyering <jim@meyering.net>
4839 2002-08-31 Jim Meyering <jim@meyering.net>
4841 Symlinks were always reported as using 0 blocks.
4842 * src/system.h (ST_NBLOCKS): Don't depend on file type.
4843 This reverts the change of 2000-01-30.
4844 Based on a report and patch from Neil Brown via Michael Stone.
4845 This fixes Debian Bug#156358.
4847 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
4848 `exit (1)' to `exit (EXIT_FAILURE)', and
4849 `usage (1)' to `usage (EXIT_FAILURE)'.
4851 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
4852 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
4853 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
4854 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
4855 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
4856 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
4857 error never exits successfully.
4859 2002-08-29 Jim Meyering <jim@meyering.net>
4861 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
4862 when ignoring any return value.
4864 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
4865 failures. On some systems (at least EMC Celerra and Solaris5.8),
4866 this appears to be necessary.
4867 (is_empty_dir): Likewise. Also, always close directory handle.
4868 * src/ls.c (print_dir): Likewise.
4869 (print_dir): Rename local variable: reading -> dirp.
4870 Reported by Mike Coleman.
4872 2002-08-28 Jim Meyering <jim@meyering.net>
4874 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
4875 Give a diagnostic and fail if closedir fails.
4877 2002-08-26 Jim Meyering <jim@meyering.net>
4879 * Makefile.am (THANKS-to-translators): New rule.
4880 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
4881 * THANKStt.in: New file.
4883 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
4885 (main): Register it with atexit.
4886 Close STDOUT_FILENO, to avoid a problem when writing to
4887 /dev/audio on at least Solaris 5.7 and 5.8 systems.
4888 Reported by Shing-Shong Shei.
4890 2002-08-25 Jim Meyering <jim@meyering.net>
4892 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
4893 * src/tac.c (main): Likewise.
4894 * src/tail.c (main): Likewise.
4895 * src/tee.c (main): Likewise.
4896 * src/tr.c (main): Likewise.
4897 * src/wc.c (main): Likewise.
4899 2002-08-20 Jim Meyering <jim@meyering.net>
4901 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
4903 2002-08-10 Paul Eggert <eggert@twinsun.com>
4905 * src/nohup.sh: Don't use "exec --"; it's not portable and
4906 shouldn't be needed.
4908 2002-08-09 Jim Meyering <jim@meyering.net>
4910 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
4911 (usage): Clarify help text for the -COLUMN option.
4912 Patch by Padraig Brady.
4913 * tests/pr/Test.pm [col-last]: New test for the above.
4915 * configure.ac: Start with version 4.5.1, chosen so that it's larger
4916 than the latest version numbers of the component packages.
4918 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
4921 2002-08-08 Jim Meyering <jim@meyering.net>
4923 * src/date.c: Guard inclusion of <langinfo.h> with
4924 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
4925 * src/sort.c: Likewise.
4926 Patch by GOTO Masanori.
4928 2002-08-05 Paul Eggert <eggert@twinsun.com>
4930 Fix some minor time-related bugs with POSIX time arguments.
4931 Some valid time stamps were being rejected (notably -1, and
4932 time stamps before 1900 on 64-bit hosts). And some invalid
4933 time stamps were being accepted, e.g. September 31.
4935 * src/date.c (main): Adjust to posixtime signature change.
4936 * src/touch.c (main): Likewise. Remove unnecessary initialization.
4937 Use localtime, not posixtm, to warn about obsolete "touch".
4939 2002-08-05 Jim Meyering <jim@meyering.net>
4941 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
4943 2002-08-04 Jim Meyering <jim@meyering.net>
4945 * src/Makefile.am (check-README): New target/rule.
4946 (check): Depend on it.
4948 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
4950 2002-08-03 Jim Meyering <jim@meyering.net>
4952 * Makefile.am (SUBDIRS): Add old.
4953 * old/: New directory, containing legacy ChangeLog* and NEWS files
4954 from the fileutils, sh-utils, and textutils packages.
4956 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
4958 2002-08-02 Paul Eggert <eggert@twinsun.com>
4960 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
4962 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
4963 (hard_LC_COLLATE): New var.
4964 (different): Args are now char *, not const char *.
4965 Use xmemcoll instead of memcmp to compare lines, so that
4966 LC_COLLATE has effect. However, use memcmp if it is an
4968 (check_file): Do not include newline in comparison, so that
4969 xmemcoll has a byte to stomp on temporarily.
4970 (main): Set hard_LC_COLLATE.
4972 2002-07-29 Jim Meyering <jim@meyering.net>
4974 * Makefile.am (SUBDIRS): Remove djgpp, for now.
4976 2002-07-20 Jim Meyering <jim@meyering.net>
4978 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
4979 into EXIT_FAILURE. Otherwise, false --help and false --version
4982 2002-07-08 Jim Meyering <jim@meyering.net>
4984 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
4985 rather than the hard-coded `sh-utils'.
4987 2002-07-01 Jim Meyering <jim@meyering.net>
4989 * configure.ac: Merge the three files from fileutils,
4990 textutils, and sh-utils.
4991 * Makefile.am: Likewise.
4992 * src/Makefile.am: Likewise.