1 2004-12-05 Jim Meyering <jim@meyering.net>
5 * tests/tail/Test.pm (test_vector): Avoid test failure when
6 _POSIX2_VERSION=199209 is in the environment, or when building on
9 2004-12-04 Jim Meyering <jim@meyering.net>
11 * NEWS: Mention cut's new --complement option.
13 2004-10-01 Paolo Bonzini <bonzini@gnu.org>
15 * cut.c (complement, COMPLEMENT_OPTION): New.
16 (longopts): Add --complement.
17 (usage): Say not that -b, -c, and -f `print' fields,
18 but rather that they `select' fields for printing.
19 Describe the new --complement option.
20 (mark_range_start): Extracted from set_fields.
21 (print_kth): Support --complement.
22 (compare_ranges): New function.
23 (set_fields): Rewrite the part that populates range_start_ht,
24 merging it with the part that populates printable_field.
25 (main): Handle --complement.
27 2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
29 * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
30 failed. This works around an assertion failure reported by
32 http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
34 2004-12-02 Jim Meyering <jim@meyering.net>
36 With using --color and with LS_COLORS saying not to color
37 executables, don't stat every file.
38 * src/ls.c (is_colored): New function.
39 (gobble_file): Use it.
40 (main): Use it here, in place of too-strict tests against NULL:
41 if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
44 2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
46 * src/comm.c (compare_files): Assume setlocale exists.
47 * src/join.c (keycmp): Likewise.
48 * src/seq.c (decimal_point): Treat like sort. Now char.
50 (main): Assume localeconv exists. Use same code as sort.
51 * src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
52 Assume setlocale exists.
53 (thousands_sep): Renamed from th_sep.
54 (IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
55 (NONZERO): Parenthesize use of arg.
56 (numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
57 consistency. Avoid unnecessary negation by reversing
59 (main): Rewrite localeconv call to match seq.c.
60 * src/system.h: Assume locale.h exists.
61 (HAVE_SETLOCALE): Remove.
62 * src/uniq.c (different): Assume setlocale exists.
64 * src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
65 'volatile' on a local variable. Rewrite to avoid unnecessary
66 double-assignment to 'func' in the usual case where strcoll does
69 2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
71 * src/pinky.c (gethostname): Remove decl.
72 (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
73 * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
74 UT_TYPE_BOOT_TIME instead of by-hand code.
75 * src/users.c (list_entries_users): Use IS_USER_PROCESS
76 instead of by-hand code.
77 * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
78 DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
79 (IS_USER_PROCESS): Move to ../lib/readutmp.h.
80 (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
81 UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
82 (gethostname): Remove decl.
83 (list_entries_who, scan_entries): Use the new macros defined above,
84 for consistency with pinky, uptime, and users.
86 2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
88 Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
89 HP's ANSI C compiler. Declaring int functions causes warnings on
90 some modern systems and shouldn't be needed to compile on ancient
92 * src/copy.h (stat, lstat, rename): Remove decls.
93 * src/install.c (stat): Remove decl.
94 * src/ln.c (link, symlink): Remove decls.
96 2004-11-25 Jim Meyering <jim@meyering.net>
98 * man/help2man: Import help2man-1.35.1.
99 * man/Makefile.am (.x.1): Remove now-unnecessary use of
100 locally-added --program-name=NAME option. Now, help2man gets
101 the name from the [NAME] section (i.e. from our .x file).
102 * man/install.x: Use `install', not `ginstall' in the one-line
103 description. Reported by Brendan O'Dea.
104 * man/sha1sum.x: Use `sha1sum', not `shasum'.
106 2004-11-24 Jim Meyering <jim@meyering.net>
108 Since the changes of 2004-05-22, the u.saved_cwd member at
109 the bottom of the active-directory stack was no longer
110 strictly necessary. This change removes that member and uses
111 the newer cwd_state parameter for the final restore_cwd.
113 * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
114 [dev_ino]: Rename from `a'.
115 (AD_pop_and_chdir): Add a parameter to play the role of just-removed
116 bottom-of-stack cwd-state member.
117 (AD_pop_and_chdir): No longer return boolean. Adjust caller.
118 (AD_push_initial): Remove CWD parameter. Adjust caller.
120 2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
122 Minor performance improvements and cleanups for "touch".
123 * src/touch.c (posix_date): Remove; not needed as a static var.
125 (touch): Use new futimens function to operate more efficiently
126 in some cases. Don't stat/fstat existing file when
127 (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
128 old time stamps aren't needed in that case.
129 (main): change_times is int, not bool. Simplify test for
132 2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
134 * src/install.c (usage): Avoid usage that runs afoul of Docbook
135 translation. Problem reported by Eric S. Raymond.
137 Restore dd's noctty flag, reverting the change of 2004-04-08.
138 POSIX does not allow "dd" to use O_NOCTTY by default.
139 * NEWS: Add noctty flag to dd.
140 * doc/coreutils.texi (dd invocation): Likewise.
141 * src/dd.c (flags, usage, main): Likewise.
143 2004-11-19 Alfred M. Szmidt <ams@gnu.org>
145 * src/ls.c (usage): Clarified description of --no-group (-G),
146 --human-readable (-h), --inode (-i), --size (-s), --time,
149 2004-11-19 Jim Meyering <jim@meyering.net>
151 * src/ls.c (usage): Clarify description of --author.
152 Tweak indentation so that help2man creates better nroff.
153 Reported by Dan Jacobson.
155 * src/uniq.c (check_file): Don't check stdout for errors here.
157 * src/pwd.c (find_dir_entry): Update comment to match reality.
159 2004-11-18 Jim Meyering <jim@meyering.net>
161 * src/pwd.c (robust_getcwd): Correct the comment: this function
162 constructs the directory name. The caller prints it.
164 2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
166 * src/stat.c (STATFS): New macro, for portability to Solaris 9.
169 * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
170 src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
171 src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
172 src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
173 src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
174 * src/readlink.c (main): argv is not const.
176 * src/cut.c (usage): Improve documentation along the lines suggested
178 * src/echo.c (usage): Likewise.
179 * src/expr.c (usage): Likewise.
181 * src/dircolors.hin: Add putty, screen-bce.
183 * src/pinky.c (print_entry): Fix memory leak.
184 * src/who.c (print_user): Likewise.
186 2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
188 * NEWS: New dd operand "status=noxfer".
189 * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
190 C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
191 C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
193 (STATUS_NOXFER, statuses): New constants.
194 (usage, print_stats, scanargs): Add support for status=noxfer.
195 (usage): Update status output to match new behavior.
196 (print_stats): Always output complete byte count.
197 Put space between numbers and units, as SI requires.
198 Use ngettext so that i18n can use plurals for "byte" and "second".
199 Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
200 (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
202 * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
203 problems with regression testing.
205 2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
207 * NEWS: dd now outputs total bytes, seconds, and bytes per second.
208 * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
209 * src/dd.c: Include "human.h".
210 (w_bytes, start_time): New vars.
211 (usage): Document new I/O statistics output
212 (print_stats): Output new I/O statistics.
213 (cleanup): Do statistics after closing stdin and stdout, so that
214 the times are more accurate.
215 (write_output, dd_copy): Count output bytes.
216 (main): Get initial value of clock.
218 2004-11-14 Jim Meyering <jim@meyering.net>
220 Backslash-escape `-'s in email addresses, so that they are
221 rendered properly in UTF-locales.
222 * man/help2man (escape_hyphens): New function.
223 (main): Call it on email addresses.
225 * src/sort.c (zaptemp): Mark new diagnostic for translation.
227 * tests/misc/close-stdout: New file. Test today's closeout.c change.
228 * tests/misc/Makefile.am (TESTS): Add close-stdout.
230 2004-11-13 Jim Meyering <jim@meyering.net>
232 * src/test.c (usage): Put the description of `[-n] STRING'
233 on two lines, one for `-n STRING' and one for `STRING' so that
234 help2man properly escapes the `-'. Otherwise, the hyphen is
235 rendered inappropriately in UTF-8 locales.
236 Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
238 2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
240 * NEWS: Document the following changes.
242 * src/sort.c: Avoid O(N**2) behavior when there are many temporary
244 (temptail): New variable, so that we can easily append to list.
245 (create_temp_file): Create new files at end of list, so that
246 searching the list has O(N*NMERGE) behavior instead of O(N**2).
247 (zaptemp): Update temptail if needed.
248 (mergefps, merge): Accept new arg that counts temp files, and keep it
249 up to date as we create and remove temporaries. This is for
250 efficiency, so that we don't call zaptemp so often.
252 (sort): Don't create array in reverse order, since the list of
253 temporaries is now in the correct order.
255 (zaptemp): Protect against race condition: if 'sort' is
256 interrupted in the middle of zaptemp, it might unlink the
257 temporary file twice, and the second time this happens the file
258 might already have been created by some other process.
260 (zaptemp): Warn if a temporary file is not removed.
262 (create_temp_file): Use offsetof for clarity.
263 (die): Move it up earlier, to clean up the code a bit.
265 * src/pr.c (strtoumax): Declare if not declared.
266 (skip_to_page, first_page_number, last_page_number, page_number,
267 first_last_page, print_header):
268 Use uintmax_t for page numbers.
269 (first_last_page): Remove unnecessary forward declaration.
270 Do not modify arg (it is now a const pointer).
271 Return a true if successful, false (without print a diagnostic)
273 (main): If +XXX does not specify a valid page range, treat it
274 as a file name. This follows the response to Open Group XCU ERN 41
275 <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
276 which says the behavior is allowed.
277 (skip_to_page): When starting page number exceeds page count,
278 print both numbers in the diagnostic.
279 (print_header): Detect page number overflow.
281 2004-11-07 Jim Meyering <jim@meyering.net>
283 * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
284 (main) [__APPLE__]: Get the processor type via syscall rather than
285 hard-coding "powerpc". From Toby Peterson.
287 * src/sort.c (merge): Remove declarations of now-unused variables.
289 2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
291 * src/sort.c (first_same_file): Remove. Move most of the code to....
292 (avoid_trashing_input): New function.
293 (merge): Avoid some silly merges, e.g., copying a single file to
294 a temporary file when there are exactly 17 input files to merge.
295 Take a count of temporary files rather than a max_merge arg.
298 2004-11-06 Jim Meyering <jim@meyering.net>
300 * src/sort.c (xfclose): Don't close stdout here (just flush it),
301 since close_stdout now closes stdout unconditionally.
303 2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
305 * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
306 first_same_file, merge, sort, main): Use size_t for indexes to arrays.
307 This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
309 (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
310 thus avoiding unchecked stack overflow in some cases. As a side
311 effect this improve the performance of "sort -M" by a factor of 4
314 2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
316 * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
318 * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
319 expression; it's not portable. Problem reported by Albert Chin.
320 Don't invoke a program more than once.
321 * src/groups.sh (version): New variable, containing author info,
322 for benefit of AUTHORS check. Use it when acting on --version option.
323 * AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
326 * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
327 as this breaks the new regime that does "#define getopt rpl_getopt".
328 Problem reported by Albert Chin for Solaris 9 with Sun cc in:
329 http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
330 I suppose this may cause problems on ancient hosts with
331 incompatible getopt declarations, but we'll cross that bridge if
332 the problem gets reported to us by someone who can test the fix.
334 2004-11-03 Jim Meyering <jim@meyering.net>
336 * src/tac.c: quote(...) file names in diagnostics.
338 2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
340 * NEWS: Document getdate changes.
342 2004-10-29 Jim Meyering <jim@meyering.net>
344 * src/tac.c (tac_file): Remove temporary prototype and move this
345 function `down' so that it precedes definition of tac_nonseekable.
347 `tac /proc/modules' would print nothing
348 Reported by Harald Dunkel in http://bugs.debian.org/278604.
350 * src/tac.c (copy_to_temp): Renamed from save_stdin, since
351 now it copies a general file descriptor, not just stdin.
352 (tac_nonseekable): Renamed/adapted from tac_stdin.
353 (tac_file): Get fd via `open' directly rather than via fopen/fileno,
354 since we never used the stream. Perform "-" to stdin mapping here
355 rather than in main. Determine whether a file is seekable,
356 by trying to `lseek' to its end, and dispatch to tac_seekable or
357 tac_nonseekable accordingly.
358 (main): Rewrite argument handling now that it uses only tac_file.
359 * NEWS: Mention it here.
361 2004-10-21 Jim Meyering <jim@meyering.net>
363 * tests/mv/leak-fd: New file.
364 * tests/mv/Makefile.am (TESTS): Add it.
365 * tests/rm/dot-rel: New file.
366 * tests/rm/Makefile.am (TESTS): Add it.
368 Correct my patch of 2004-10-18.
369 * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
370 if necessary, not in remove_dir. Otherwise, removing multiple
371 `.'-relative nonempty directories no longer worked.
373 2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
375 * src/fmt.c (usage): Improve description of --prefix.
376 Problem reported by Edward Welbourne.
378 * man/uniq.x: Change summary so that it doesn't imply that
379 uniq writes to its input file. Problem reported by
382 2004-10-18 Jim Meyering <jim@meyering.net>
384 Plug a leak that would cause a cross-device mv to fail when
385 operating on too many command-line-specified nonempty directories.
386 * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
387 top of the stack before returning. This usually closes the file
388 descriptor that was used to return to the original working directory.
389 Reported by Cyril Bouthors in
390 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
391 * NEWS: Mention it here.
393 * src/pathchk.c (validate_file_name): Give a more descriptive
394 diagnostic when pathconf fails. This also avoids an unwarranted
395 warning from gcc-3.3.5 about a format not being a string literal.
397 * src/sleep.c (main): Remove declaration of unused local, c.
398 * src/printenv.c (main): Likewise.
399 * src/logname.c (main): Likewise.
400 * src/uptime.c (main): Likewise, for optc.
401 * src/tsort.c (main): Likewise, for opt.
403 2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
405 * AUTHORS: Add self to pathchk.
406 * src/pathchk.c (AUTHORS): Add self.
407 Change "path" to "file name" whenever possible.
408 Remove usage comment, as it was a duplication of the code or doc.
409 Include <wchar.h> if available.
410 (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
411 (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
412 pathconf_wrapper, portable_chars, dir_ok): Remove.
413 (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
414 (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
415 (portable_chars_only): New arg FILELEN.
416 Don't assume ASCII; we might be on an EBCDIC host.
417 Don't assume unibyte locale in diagnostic.
418 (component_start, component_len): New functions.
419 (validate_file_name): Renamed from validate_path. All uses changed.
420 Pretty much a complete rewrite.
421 Don't make copy of file arg. Always append trailing slash to
422 pathconf arg, just in case it's a symlink (this is pure paranoia;
423 we don't know of any hosts where the trailing slash is required).
424 Use size_t instead of long int when possible.
425 Avoid need to call pathconf in most practical cases.
426 Don't use euidaccess several times to test searchability;
427 just use lstat once. Reword diagnostic to put the (often very long)
430 2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
432 * src/printf.c (usage): Mention Unicode, and use H for hex digits.
434 2004-10-13 Jim Meyering <jim@meyering.net>
436 * NEWS: Mention today's fts.c fix.
438 2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
440 * tests/stty/row-col-1: Set LC_ALL=C.
442 2004-10-12 Jim Meyering <jim@meyering.net>
444 * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
445 From Jesus Climent in http://bugs.debian.org/276149.
447 2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
449 * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
450 problems. All uses changed.
452 2004-10-05 Jim Meyering <jim@meyering.net>
454 * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
455 since Karl says its trailing blanks are there to stay :-)
457 2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
459 * src/expr.c (NEW, OLD): Remove, partly to avoid
460 reference to obsolescent macro XMALLOC.
461 All uses replaced by xmalloc and free.
463 2004-09-28 Jim Meyering <jim@meyering.net>
465 * src/tail.c (usage): Clarify: --retry works only with --follow=name.
466 Reported by Nik A. Melchior in http://bugs.debian.org/273781.
468 2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
470 * src/od.c (format_address_paren): c is optional, so don't output
473 2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
475 Add support for ls --hide. Idea suggested by Bardur Arantsson.
476 * NEWS: Document this.
477 * src/ls.c (file_ignored): Renamed from file_interesting, with
478 inverted return value. Accept the file name, not a struct dirent *.
479 All uses changed. Avoid the expense of calling fnmatch if the
480 file is ignorable due to leading '.'.
481 (all_files, really_all_files): Removed; replaced by:
482 (ignore): New variable. All uses changed.
483 (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
485 (hide_patterns): New variable.
486 (long_options, decode_switches, file_ignored, usage):
487 Add support for --hide.
488 (patterns_match): New function.
489 (usage): Replace "hide" with "ignore" in explanation, to avoid
492 2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
494 * src/ls.c (gobble_file, print_long_format): Don't assume that
495 human-readable output has a byte count equal to its column width;
496 this isn't always true in locales where the radix character is not
498 (format_user_or_group): Revamp code to match the above fix;
499 this avoids the (very faint) possibility of integer overflow.
501 2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
503 * NEWS: Mention that "chmod -r -w x" now works as expected.
504 * src/chmod.c (main): Revamp option processing to support this.
505 * tests/chmod/Makefile.am (TESTS): Add 'usage'.
506 * tests/chmod/usage: New set of tests for usage like that.
508 2004-09-24 Jim Meyering <jim@meyering.net>
510 * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
511 it lists only cvs-controlled regular files.
513 * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
514 to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
516 2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
518 * Makefile.maint (CVS_LIST): New macro.
519 (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
520 sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
521 sc_trailing_blank, po-check): Use it instead of the
522 nonstandard "cvsu --list".
524 * src/tail.c (parse_obsolete_option): Bring back support
525 for obsolete option followed by non-obsolete, or by more
526 than one file. When obsolete, conform to SUSv2 rather than
527 original POSIX 1003.2-1992, as SUSv2 corrected the case of
528 "tail -c". Add support for the SUSv2 "b" modifier.
529 * NEWS: Mention the above.
530 * tests/tail/Test.pm: New test case obs-b to check the above.
531 err-[134] no longer need _POSIX2_VERSION=199209.
532 Fix comments to match revised behavior.
534 2004-09-22 Jim Meyering <jim@meyering.net>
536 * Use automake-1.9.2. Regenerate dependent files.
538 * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
541 Clean up scoping etc. so that some make `distcheck' tests pass.
542 * src/csplit.c (xalloc_die): Declare to be static.
543 * src/chown-core.c (chown_files): Declare as `extern'.
544 * src/cp-hash.c (remember_created): Likewise.
545 * src/copy.c (copy): Likewise.
546 * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
548 * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
549 * src/unexpand.c: Likewise.
551 * src/Makefile.am (check-AUTHORS): New rule.
552 (check): Depend on it.
555 * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
556 (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
558 2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
560 * src/ls.c (decode_switches): Don't compare a short value
561 to SIZE_MAX: GCC sometimes complains.
563 2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
565 * NEWS: The following commands now reject unknown options:
566 basename dirname factor hostname link nohup sync unlink yes
567 Also, pathchk no longer accepts trailing options.
569 * src/basename.c: Include <getopt.h>.
570 * src/chroot.c: Likewise.
571 * src/dirname.c: Likewise.
572 * src/factor.c: Likewise.
573 * src/hostid.c: Likewise.
574 * src/hostname.c: Likewise.
575 * src/nohup.c: Likewise.
576 * src/pwd.c: Likewise.
577 * src/setuidgid.c: Likewise.
578 * src/sync.c: Likewise.
580 * src/basename.c (main): Reject unknown options.
581 * src/dirname.c (main): Likewise.
582 * src/factor.c (main): Likewise.
583 * src/hostid.c (main): Likewise.
584 * src/hostname.c (main): Likewise.
585 * src/link.c (main): Likewise.
586 * src/nohup.c (main): Likewise.
587 * src/pwd.c (main): Likewise.
588 * src/setuidgid.c (main): Likewise.
589 * src/sync.c (main): Likewise.
590 * src/unlink.c (main): Likewise.
591 * src/yes.c (main): Likewise.
593 * src/cat.c (main): Remove unused "case 0".
594 * src/chgrp.c (main): Likewise.
595 * src/chmod.c (main): Likewise.
596 * src/chown.c (main): Likewise.
597 * src/comm.c (main): Likewise.
598 * src/cp.c (main): Likewise.
599 * src/csplit.c (main): Likewise.
600 * src/cut.c (main): Likewise.
601 * src/date.c (main): Likewise.
602 * src/df.c (main): Likewise.
603 * src/du.c (main): Likewise.
604 * src/env.c (main): Likewise.
605 * src/expand.c (main): Likewise.
606 * src/fold.c (main): Likewise.
607 * src/head.c (main): Likewise.
608 * src/id.c (main): Likewise.
609 * src/install.c (main): Likewise.
610 * src/join.c (main): Likewise.
611 * src/ln.c (main): Likewise.
612 * src/ls.c (decode_switches): Likewise.
613 * src/mkdir.c (main): Likewise.
614 * src/mkfifo.c (main): Likewise.
615 * src/mknode.c (main): Likewise.
616 * src/mv.c (main): Likewise.
617 * src/nl.c (main): Likewise.
618 * src/paste.c (main): Likewise.
619 * src/pinky.c (main): Likewise.
620 * src/pr.c (main): Likewise.
621 * src/ptx.c (main): Likewise.
622 * src/readlink.c (main): Likewise.
623 * src/rm.c (main): Likewise.
624 * src/rmdir.c (main): Likewise.
625 * src/seq.c (main): Likewise.
626 * src/shred.c (main): Likewise.
627 * src/split.c (main): Likewise.
628 * src/sum.c (main): Likewise.
629 * src/tac.c (main): Likewise.
630 * src/tail.c (main): Likewise.
631 * src/tee.c (main): Likewise.
632 * src/touch.c (main): Likewise.
633 * src/tr.c (main): Likewise.
634 * src/tty.c (main): Likewise.
635 * src/uname.c (main): Likewise.
636 * src/unexpand.c (main): Likewise.
637 * src/wc.c (main): Likewise.
638 * src/who.c (main): Likewise.
640 * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
641 * src/cksum.c (main): Likewise.
642 * src/dd.c (main): Likewise.
643 * src/logname.c (main): Likewise.
644 * src/printenv.c (main): Likewise.
645 * src/sleep.c (main): Likewise.
646 * src/tsort.c (main): Likewise.
647 * src/uptime.c (main): Likewise.
648 * src/users.c (main): Likewise.
649 * src/whoami.c (main): Likewise.
651 * src/du.c (long_options): Standardize on NULL vs 0.
652 * src/rm.c (long_opts): Likewise.
654 * src/logname.c (long_options): Remove.
655 * src/printenv.c (long_options): Likewise.
656 * src/sleep.c (long_options): Likewise.
657 * src/tsort.c (long_options): Likewise.
658 * src/uptime.c (longopts): Likewise.
659 * src/users.c (longopts): Likewise.
660 * src/whoami.c (long_options): Likewise.
662 * src/pathchk.c (longopts): Add --help, --version.
663 (main): Use longopts rather than parse_long_options.
664 * src/stty.c (longpts, main): Likewise.
666 * src/pathchk.c (main): Don't reorder arguments, so that
667 we can check weird file names.
669 * src/readlink.c: Don't include "long-options.h".
670 * src/sort.c: Likewise.
671 * src/stty.c: Likewise.
673 * src/split.c (verbose): Now bool, not int.
674 (VERBOSE_OPTION): New enum.
675 (longopts, main): Use it.
677 * tests/factor/basic: Adjust to new wording in diagnostic
678 that results from the above changes.
680 2004-09-21 Jim Meyering <jim@meyering.net>
682 * man/rm.x: Say "the response is affirmative" rather than "the
683 response begins with y or Y", so that the documentation is
684 accurate in non-English locales. Problem reported by Munzir Taha.
686 2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
688 * src/echo.c (main): Don't pass NULL to strcmp when
689 POSIXLY_CORRECT and given no arguments.
691 * src/md5sum.c (STRING_OPTION): Remove.
692 (long_options, main): Remove support for undocumented and
693 obsolete --string option, as suggested in the 1996-09-26 patch.
694 * NEWS: Document this.
696 * tests/rm/fail-eperm: Don't try to remove writeable files in a
697 sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
698 you remove such files. Problem reported by Bert Fischer in:
699 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
701 2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
703 * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
704 (long_options, main): Use them instead of magic numbers 2 and 1.
705 For --string, optarg can't possibly be NULL.
707 * src/dd.c (usage): Distinguish between options and operands.
708 (scanargs): Don't mess with argc, argv; getopt_long handles this now.
709 Say "operands" for operands, not "options".
710 (main): Use getopt_long, so that "dd --" works as POSIX requires.
711 * tests/dd/misc: Check for "dd --".
713 * src/chroot.c (main): Reject unknown options instead of
714 interpreting them as a directory to chroot to.
716 * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
717 The current standard (POSIX 1003.1-2004) is correct.
718 (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
719 collision with builtin function.
720 (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
721 output the first 0 as 8 digits, to make it easier to compare to
722 the text of the standard. Output crctab to be a const array.
723 (crctab): Use result of above changes.
724 (long_options): Remove; not needed if empty.
725 (main): getopt_long can't return 0 here, so simplify the code.
727 2004-09-13 Jim Meyering <jim@meyering.net>
729 * src/Makefile.am (localedir.h): Don't redirect directly to target.
731 2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
733 * src/id.c (print_full_info): Don't exit with failure status simply
734 because a user or group number can't be turned into a name.
735 Problem reported by Felipe Kellermann in:
736 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
738 2004-09-12 Jim Meyering <jim@meyering.net>
740 * Makefile.maint (my-distcheck): When building with -Werror, also
743 2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
745 * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
746 * src/tail.c (parse_obsolete_option): Renamed from
747 parse_obsolescent_option, since the options are obsolete now.
748 Remove bool *arg; just exit if there's an error. Revamp to follow
749 POSIX 1003.2-1992 more precisely, to handle cases like "tail -
750 file" and "tail -10 -- file" correctly when we are conforming to
752 (main): Adjust to this change.
753 * tests/tail/Test.pm (test_vector): minus-* requires
754 _POSIX2_VERSION=199209 now, to work correctly if there is
755 an input file. err-1 and err-3 no longer errors if there
758 2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
760 * src/test.c (usage): Document -r, -w, -x more carefully.
762 2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
764 * src/test.c (usage): Document "test" (with no args) and "[ ]".
765 Document that -h and -L don't dereference.
767 * NEWS: Document that "tr xy -z" now works as per POSIX.
768 Sort the descriptions.
769 * src/tr.c (main): Don't reorder options.
770 * tests/tr/Test.pm (fowler-1): New test case.
772 2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
774 * src/touch.c (main): Fix POSIX-conformance bug: "touch --
775 MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
776 conforming to pre-2001 POSIX.
777 * NEWS: Document this.
778 * tests/touch/obsolescent: Test for this bug. Also, set
779 _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
780 a better test for obsolescent features.
782 * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
783 "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
786 * src/od.c: Several changes for POSIX and FreeBSD compatibility.
787 (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
788 (long_options, main): --strings is now -S, not -s.
789 (usage): Reflect the usage changes.
790 (parse_old_offset): Do not issue a diagnostic on failure;
791 callers now do this as necessary.
792 (main): Support POSIX syntax. Remove unused case 0 from getopt_long.
793 Add support for new short options (many undocumented) for
794 compatibility with FreeBSD. Remove FIXME for -s; it's now
795 POSIX-compatible. Default format is now oS, not o2.
796 * NEWS: Describe the above.
798 2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
800 * src/stty.c (valid_options): Remove.
801 (main): Fix some bugs in handling invalid option-combinations
803 (recover_mode): Arg is now char const *, not char *.
804 (main): Use STDIN_FILENO, not 0.
805 Simplify option-parsing code a tad.
806 * tests/stty/basic-1: Check for the fixed bugs.
808 2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
810 * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
811 it from ever being nonzero. Reported by Pozsar Balazs in:
812 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
813 (human_fstype): Add ramfs, squashfs, sysfs.
814 Reported by Pozsar Balazs in:
815 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
816 (human_fstype): Return char const *, not char *.
817 Simplify internals a bit, and avoid casts.
819 * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
820 (bit_count): Remove. All uses changed to....
821 (multiple_bits_set): New function.
822 (scanargs): Use it, and check separately for each set of
823 incompatible options, to improve diagnostics.
825 (apply_translations): Move checks for incompatible options
826 to scanargs, so that they're done consistently.
828 2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
830 Output correct errno-related diagnostic on "paste" I/O errors.
831 * src/paste.c (write_error, xputchar): New functions.
832 (paste_parallel): Use correct errno value after input error.
833 (paste_parallel, paste_serial): Report errno value after output error.
835 Port to diet libc. Problem reported by Felix von Leitner in:
836 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
837 * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
838 it's not portable C to assume FILE is a complete type.
839 (paste_parallel): Use index test instead of ENDLIST, and NULL
842 2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
844 POSIX-conformance fixes for "expand" and "unexpand".
845 Also, consistently use "tab stop" rather than "tabstop".
846 * NEWS: Document fixes.
847 * src/expand.c: Revamp to resemble the new unexpand.c better.
848 (usage): -i does not convert tabs after non-tabs.
849 (add_tab_stop): Renamed from add_tabstop. All uses changed.
850 (parse_tab_stop): Renamed from parse_tabstop. All uses changed.
851 (validate_tab_stop): Renamed from validate_tabstop. All uses changed.
852 (next_file, main): Check fclose against 0, not EOF.
853 (expand): Remove unnecessary casts.
854 Add another loop nesting level, for lines, so that per-line variables
855 are initialized cleanly.
856 Revamp tab checking. Check for write error immediately, rather
857 than just once at the end of the program.
858 * src/unexpand.c: Lkewise (for the expand.c changes).
859 (TAB_STOP_SENTINEL): Remove.
860 (tab_size): Now size_t, not uintmax_t, since we need to store
861 the sequences of blanks.
862 (max_column_width): New var.
863 (usage): Say "blank" where POSIX requires this.
864 (add_tab_stop): Calculate maximum column width.
865 (unexpand): Store the pending blanks, instead of merely counting them.
866 Follow POSIX's rules about -a requiring two blanks before a tab stop.
867 Get rid of internal label and goto.
868 * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
869 Add blanks-1 through blanks-13.
871 2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
873 * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
874 succeed without changing the uid and gid, like FreeBSD.
875 * src/chgrp.c (parse_group): Return gid_t rather than storing it
876 through a pointer. Treat "chgrp '' file" as a no-op change,
878 (main): Set chopt.group_name to NULL if the group is the empty
880 * src/chown-core.c (describe_change): Describe changes to -1:-1
881 without using "to OWNERSHIP" phrase.
882 * src/chown.c (usage): "chown '' file" is now allowed.
883 (main): Do not set user name to the empty string if the group
885 * tests/chgrp/basic: Test "chgrp '' file".
886 * tests/chown/Makefile.am (TESTS): Add separator.
887 * tests/chown/separator: New file, partly taken from
888 Dmitry V. Levin's suggestion in
889 <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
891 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
893 * tests/install/basic-1: Test for the -d regression.
895 2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
897 * src/install.c (main): Fix -d regression introduced with
898 --target-directory support at 2004-06-25.
900 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
902 * src/copy.c (copy_internal): When preserving links, unlink
903 a destination with link count greater than one. This is so
904 that commands like "cp -a" don't get confused when copying into
905 a destination that already contains many hard links. Problem
906 reported by Tim Waugh in:
907 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
909 2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
911 Convert all files to UTF-8.
912 * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
913 * tests/sort/Test.pm (16a): Likewise.
914 * tests/uniq/Test.pm (8): Likewise.
915 * tests/misc/printf-hex: Use ASCII, not Latin-1.
917 * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
918 * src/shred.c (usage): "-" is an operand, not an option.
919 * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
920 A null file arg means standard output.
921 (main): "-o -" means to write to a file named "-",
922 not to standard output.
923 * src/tee.c (usage, tee): "tee -" writes to standard output, not
926 2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
928 * src/install.c (change_timestamps): Fix int->bool conversion
929 bugs introduced on 2004-07-29.
931 2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
933 * src/shred.c (wipename): Work even if the directory is writeable
934 and not readable. Prefer write access, since this should work
935 better with fdatasync.
937 * src/csplit.c (xalloc_die): New function.
938 (main): Remove now-obsolete initialization of xalloc_fail_func.
940 * src/md5sum.c: Adjust to sha->sha1 renaming.
942 2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
945 * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
946 (can_mode): Make variable local.
948 2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
950 * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
951 Do not define, to avoid annoying compiler messages on QNX 6.3.
952 Problem reported by Johan in:
953 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
955 2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
957 * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
958 Define to a concatenation of string literals, not to an expression;
959 needed for concatenation contexts.
960 (INTMAX_MAX, INTMAX_MIN): New macros.
962 * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
963 unsigned long; this isn't true for st_ino on Solaris 9.
965 2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
967 * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
968 whether to include files. Include <sys/param.h> if
969 HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
970 (main) [defined __POWERPC__]: Add a kludge to work around a
971 Mac OS X bug, so that uname -p defaults to "powerpc" if
972 sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
973 fails. Problem reported by Petter Reinholdtsen in:
974 http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
976 * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
977 main): Use bool for booleans.
978 (writeline, check_file): Use uintmax_t for line counts.
979 (check_file): Check for and report line number overflow,
981 * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
982 (print_lines, print_words, print_chars, print_bytes, print_linelength,
983 have_read_stdin, wc, wc_file, main):
984 Use bool for booleans.
985 (exit_status): Remove.
986 (wc, wc_file): Return bool status. All callers changed.
987 * src/who.c (scan_entries): 0 -> STDIN_FILENO.
988 * src/whoami.c (main): Print uids using unsigned long int, not
991 * src/unexpand.c: Int cleanup and minor reorganization to be more
993 Include quote.h, xstrndup.h.
994 (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
995 (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
997 Use bool for booleans.
998 (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
999 Use uintmax_t for column counts.
1000 (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
1001 (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
1003 (parse_tabstops): Don't use ISBLANK on possibly-signed char.
1004 Detect overflow in tab stop string.
1005 (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
1006 (unexpand): Concatenate input files the same way expand does.
1008 * src/touch.c (no_create, use_ref, posix_date, amtime_now,
1009 touch, main): Use bool for booleans.
1010 (main): Avoid integer overflow when given more than INT_MAX
1012 * src/tsort.c (struct item, n_strings): Use size_t for sizes.
1013 (have_read_stdin, count_items, scan_zeros, detect_loop,
1014 recurse_tree, walk_tree, tsort, main):
1015 Use bool for booleans.
1016 (exit_status): Remove.
1017 (tsort): Return a success flag instead of storing into a global.
1019 * src/tty.c (silent, main): Use bool for booleans.
1020 (main): 0 -> STDIN_FILENO.
1021 * src/uname.c (print_element): Use bool for booleans.
1023 * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
1024 Remove. All uses replaced by C99 boolean primitives.
1025 (TEST_TRUE, TEST_FALSE): New constants, for readability.
1026 (test_unop, binop, unary_operator, binary_operator, two_arguments,
1027 three_arguments, posixtest, expr, term, and, or, is_int, age_of,
1028 one_argument, main): Use bool for booleans.
1029 (advance, unary_advance): Now inline procedures rather than a macros.
1030 (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
1031 (term, and, or): When it's easy, loop instead of recursing.
1032 (term): Avoid integer overflow if there are INT_MAX-3 args (!).
1033 (binary_operator, unary_operator): Simplify by systematically rewriting
1034 true==FOO to FOO (where FOO is a boolean).
1035 (unary_operator): Don't consider a file to be a regular file
1036 merely because its mode&S_IFMT is zero. Just use S_ISREG.
1037 Remove unnecessary casts. Remove ifdefs for things like
1038 S_ISSOCK that are no longer needed, since stat-macros.h always
1041 * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
1042 Use bool for booleans.
1043 (buf_init_from_stdin, buf_free, find_bol, print_line):
1044 Use size_t for sizes.
1045 * src/tac.c (separator_ends_record, tac_seekable, tac_file,
1046 tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
1047 (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
1048 (tac_seekable): Use ptrdiff_t for pointer subtraction.
1049 Report an error if the result is out of range.
1050 (tac_seekable, main): Check for integer overflow in buffer size
1052 (main): Remove unnecessary casts.
1054 * src/su.c (run_shell): Pass a new n_additional_args arg, so that
1055 the callee doesn't have to count 'em. All callers changed.
1056 Don't allocate more space for the arg vector than we'll need.
1057 Use memcpy to copy the args rather than rolling our own loop.
1058 Use size_t for sizes.
1059 (fast_startup, simulate_login, change_environment, log_su,
1060 correct_password, restricted_shell, main): Use bool for booleans.
1061 (longopts): Don't assume change_environment is an int.
1062 Use NULL, not 0, for pointers.
1063 (xsetenv): New function, replacing xputenv and concat.
1064 All callers changed.
1065 (elements): Remove; no longer needed.
1066 (log_su, correct_passwd, main): Prefer !x to x==NULL.
1067 (log_su): 2 -> STDERR_FILENO.
1068 (modify_environment, main): Don't assume that getenv's returned value
1069 has an indefinite lifetime.
1070 (modify_environment): Allocate a larger environ.
1071 (main): Remove an impossible 'case 0'; if it happens now, it'll
1072 get diagnosed. Don't assume getpwnam results outlive endpwent.
1073 Check for null or empty pw_name, pw_dir and for null pw_passwd.
1075 * src/stty.c (VA_START): Remove. All callers now use va_start.
1076 (_POSIX_VDISABLE): Remove unnecessary cast.
1077 (struct control_info, visible): Use cc_t for control chars.
1078 (struct control_info): Use size_t for sizes.
1079 (recover_mode, set_mode, display_speed, display_window_size,
1080 valid_options, main, display_changed):
1081 Use bool for booleans.
1082 (integer_arg): Return unsigned long int, not long int.
1083 Accept new max arg; all callers changed, to specify a maximum
1084 value for integer parameters instead of silently overflowing.
1085 (wrap): Do not overrun the stack buffer if the output contains
1086 more than 1024 bytes. Instead, malloc a buffer.
1087 (main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
1088 Remove unnecessary casts.
1089 (set_control_char): Allow int values only up to cc_t range.
1090 (screen_columns): Don't reject INT_MAX.
1091 (display_changed, display_all, display_speed, recover_mode):
1092 Don't assume cc_t fits in int.
1094 * src/remove.h: Add copyright notice.
1095 (struct rm_options): Use bool for booleans.
1096 * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
1097 errno_rmdir_non_empty, remove_parents, main): Likewise.
1098 * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
1100 (main): Don't dump core if invoked with argv[0]==NULL.
1101 * src/tee.c (tee, append, ignore_interrupts, main, tee):
1102 Use bool for booleans.
1103 (tee): Use ssize_t for read returns.
1105 * src/ptx.c: Add a FIXME mentioning that there are many
1106 unchecked integer overflows in this file.
1107 (gnu_extensions, auto_reference, input_reference, right_reference,
1108 ignore_case, initialize_regex, fix_output_parameters,
1109 output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
1110 Use bool for booleans.
1111 (SKIP_SOMETHING, compare_words, digest_break_file,
1112 find_occurs_in_text, fix_output_parameters):
1113 Use to_uchar instead of a caset.
1114 (print_field): Rewrite to avoid cast.
1116 * src/printf.c (posixly_correct): Use bool for booleans.
1117 (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
1118 (STRTOX): Rewrite to avoid casts.
1119 (print_esc_char): Arg is char, not int.
1120 * src/readlink.c (canonicalize): Remove. All uses now merely inspect
1122 (no_newline, verbose): Use bool for booleans.
1123 (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
1124 * src/shred.c (struct Options, main): Use bool for booleans.
1125 (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
1126 * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
1127 Use bool for booleans.
1128 * src/stat.c (G_fail): Remove.
1129 (print_statfs): Print various gotta-be-nonnegative values using
1130 unsigned long int, not long int or int.
1131 (do_statfs, do_stat): Return a boolean success flag.
1132 (do_stat, main): Use bool for booleans.
1134 * src/pr.c: Add a FIXME mentioning that there are many
1135 unchecked integer overflows in this file.
1136 (TRUE, FALSE): Remove. All uses replaced by true and false.
1137 (struct COLUMN, read_line, print_page, print_stored, open_file,
1138 skip_to_page, init_fps, parallel_files, align_empty_cols,
1139 empty_line, FF_only, explicit_columns, extremities, keep_FF,
1140 print_a_FF, print_a_header, use_form_feed, have_read_stdin,
1141 print_across_flag, storing_columns, balance_columns,
1142 truncate_lines, join_lines, untabify_input, failed_opens,
1143 numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
1144 double_space, ignore_failed_opens, use_col_separator,
1145 pad_vertically, last_line, main, init_parameters, skip_read,
1146 read_line, print_stored):
1147 Use bool for booleans.
1148 (struct COLUMN, char_to_clump, store_char, print_char):
1150 (clump_buff, print_clump): Use char[], not int[], for an array whose
1151 elements are always chars.
1152 (first_last_page, main, getoptarg, balance, add_line_number,
1153 char_to_uclump): Remove unnecessary casts.
1154 (init_parameters): Allocate chars, not ints, for clump_buff.
1155 (print_char): Use to_uchar before invoking ISPRINT.
1156 (char_to_clump): Convert to unsigned char before invoking ISPRINT.
1158 * src/nohup.c (main): Use bool for booleans.
1159 * src/paste.c (paste_parallel, paste_serial, main): Likewise.
1160 * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
1161 (portable_chars_only): Use to_uchar rather than a cast.
1162 * src/printenv.c (main): Use bool for booleans.
1163 Do not assume that the environ has at most one matching entry
1164 for each option (integer overflow was possible otherwise).
1166 * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
1167 constant. Do not assume PRIdMAX etc. are strings of length 3 or
1169 (struct tspec): Use it. fmt_string is now an array, not
1170 a pointer, as there's little point to the indirection here.
1171 (struct tspec, flag_dump_strings,
1172 traditional, flag_pseudo_start, limit_bytes_to_format,
1173 abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
1174 decode_one_format, open_next_file, check_and_close,
1175 decode_format_string, skip, write_block, read_char, read_block,
1176 parse_old_offset, dump, dump_strings, main):
1177 Use bool for booleans.
1178 (struct tspec): Use void *, not char *, for generic pointers.
1179 (bytes_to_oct_digits, bytes_to_signed_dec_digits,
1180 bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
1181 Use char, not unsigned int, since char suffices.
1182 (print_s_char, print_char, print_s_short, print_short,
1183 print_int, print_long, print_long_long, print_float,
1184 print_double, print_long_double): Rewrite to avoid casts.
1185 These now take void * arguments, instead of char *.
1186 Use the same body for all functions, except for the choice
1187 of type. Assume C89 to simplify handling of signed char.
1188 (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
1189 Rewrite to avoid casts.
1190 (print_named_ascii, print_ascii): Now takes void *, not char *.
1191 (decode_one_format): Use int for printf field widths, not
1192 unsigned int. Pass void * to subsidiary printers,
1193 not char *. Simplify handling of floating-point formats
1194 by factoring out common code dealing with precision and field width.
1195 (decode_format_string): Avoid need for temporary copy of
1196 each decoded struct tspec.
1197 (get_lcm): Remove unnecessary cast.
1198 (main): Fix bug where more than INT_MAX failed decodes were ignored.
1200 2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
1202 * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
1203 (enum number_format): Remove.
1204 (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
1206 (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
1207 (section_del): Now const.
1208 (print_fmt): Remove.
1209 (starting_line_number, page_incr, blank_join, line_no,
1210 print_lineno, proc_text, main):
1211 Use intmax_t for line numbers.
1212 (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
1213 Use bool for booleans.
1214 (lineno_format): Now a string, not an enum value.
1215 (build_print_fmt): Remove. All calls removed. This work is
1216 now done within print_lineno.
1217 (build_type_arg): Use size_t for sizes.
1218 (print_lineno): Check for line number overflow.
1219 (proc_text, main): Remove unnecessary cast.
1221 * src/ln.c (symbolic_link, interactive, remove_existing_files,
1222 verbose, hard_dir_link, dereference_dest_dir_symlinks,
1223 do_link, main): Use bool for booleans.
1225 * src/ls.c (struct fileinfo, file_interesting,
1226 extract_dirs_from_files, color_symlink_as_referent,
1227 FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
1228 numeric_ids, print_block_size, dired, print_with_color,
1229 check_symlink_color, print_inode, recursive, immediate_dirs,
1230 all_files, really_all_files, qmark_funny_chars,
1231 print_dir_name, format_needs_stat, format_needs_type, visit_dir,
1232 main, decode_switches, parse_ls_color, print_dir, file_interesting,
1233 gobble_file, make_link_path, basename_is_dot_or_dotdot,
1234 extract_dirs_from_files, print_long_format):
1235 Use bool for booleans.
1236 (dir_defaulted): Remove; no longer needed.
1237 (main): Use int to count files, since it suffices for argv.
1238 Rewrite to avoid need for dir_defaulted.
1239 (main, print_dir, gobble_file, get_link_name,
1241 Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
1242 (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
1243 Remove unnecessary cast to int. Use int instead of unsigned
1244 int to count from 0 to 1.
1245 (get_funky_string, print_type_indicator): Use char for bytes, not int.
1246 (make_link_path): Use NULL for null pointers.
1247 (quote_name): Use to_uchar instead of cast.
1249 * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
1250 print_full_info): Use bool for booleans.
1251 (problems): Remove, replacing with....
1252 (ok): New var (inverted from old sense).
1253 (print_user, print_group, print_full_info):
1254 Print uids/gids with %lu, not %u.
1255 (xgetgroups): Don't run out of memory if getgroups or getugroups
1257 * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
1259 * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
1260 int, since it suffices.
1261 (factor, print_factors): Use size_t for sizes.
1262 (print_factors, do_stdin, main): Use bool for booleans.
1263 * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
1264 (fold_file, main): Use bool for booleans.
1265 (fold_file, main): Use size_t for sizes.
1266 (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
1267 of prohibiting widths greater than INT_MAX.
1268 * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
1269 write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
1270 elide_tail_lines_pipe, elide_tail_lines_seekable,
1271 elide_tail_lines_file, head_bytes, head_lines, head, head_file,
1272 string_to_integer, main):
1273 Use bool for booleans.
1274 (main): Rewrite to avoid cast.
1276 * src/csplit.c (struct line): Use size_t for sizes.
1277 (main): Remove unnecessary cast.
1278 * src/cut.c (cut_fields): Use to_uchar rather than a cast.
1279 * src/cut.c (cut_file, main): Use bool for booleans.
1280 * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
1281 * src/env.c (main): Likewise.
1282 * src/expr.c (nextarg): Likewise.
1283 * src/env.c (main): Remove unused and nonstandard envp arg.
1285 * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
1286 fmt's arbitrary limits.
1287 (TRUE, FALSE): Remove; all uses changed to (true, false).
1288 (main): Use bool for booleans.
1289 Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
1291 (copy_rest): Remove unnecessary cast.
1292 (get_prefix): Rewrite to avoid cast.
1293 (check_punctuation): Use char *, not unsigned char *; C89 requires
1294 this. Avoid off-by-one buffer read overrun when line is empty.
1295 (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
1296 Remove unnecessary casts.
1297 * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
1300 * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
1301 next_file, expand, main):
1302 Use bool for booleans.
1303 (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
1305 Use uintmax_t for column counts.
1306 (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
1307 All callers changed.
1308 (parse_tabstops): Don't pass a negative char to isblank.
1309 Avoid memory leak with large tab stops.
1310 (validate_tabstops, expand): Don't assume number of tab stops is
1312 (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
1313 storing values into exit_status.
1314 (expand): Use same pattern as unexpand for reading chars.
1315 Report an error when input line is too long, instead of silently
1316 screwing up. Do not mishandle tab stops when backspacing left
1319 * src/dircolors.c (have_read_stdin, append_quoted,
1320 dc_parse_stream, dc_parse_file, main): Use bool for booleans.
1321 (dc_parse_stream): Use enum for state, rather than int.
1322 Use ssize_t to store getline result.
1324 * src/dd.c (translation_needed, parse_integer, scanargs,
1325 apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
1326 Use bool for booleans.
1327 (translate_buffer): Use to_uchar rather than a cast.
1328 (swab_buffer, copy_simple, copy_with_unblock):
1329 Use size_t for sizes.
1331 * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
1332 * src/sleep.c (apply_suffix): Likewise.
1333 * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
1334 forever, from_start, print_headers, have_read_stdin, valid_file_spec,
1335 write_header, file_lines, pipe_lines, pipe_bytes, recheck,
1336 tail_forever, tail_bytes, tail_lines, tail, tail_file,
1337 parse_obsolescent_option, parse_options, main): Likewise.
1338 * src/sleep.c (apply_suffix): Invert sense of result.
1339 Use int (not unsigned int) for multiplier, as this generates better
1340 code with some compilers. Simplify code a bit.
1341 * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
1342 parse_options): Use uintmax_t, not unsigned int or unsigned long int,
1344 (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
1345 make it a bit clearer.
1347 * src/hostname.c: Include "xgethostname.h".
1348 (xgethostname): Remove decl; xgethostname.h has it.
1349 (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
1350 && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
1351 prototypes rather than K&R form. Assume any negative value from
1352 sysinfo denotes failure, not just -1.
1353 (main): Simplify use of sethostname.
1355 * src/pinky.c (include_idle, include_heading, include_fullname,
1356 include_project, include_plan, include_home_and_shell, do_short_format,
1357 include_where, main): Use bool for booleans.
1358 (count_ampersands, create_fullname, scan_entries, short_pinky):
1359 Use size_t for sizes.
1360 (create_fullname): Check for overflow in size calculations.
1361 (idle_string): Don't assume that the number of idle days
1362 is less than 10**8 and/or INT_MAX/(24*60*60).
1363 (main): No need to pass a non-NULL last arg to getopt_long.
1364 * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
1365 (print_uptime): Remove unused local variable.
1366 (main): No need to pass a non-NULL last arg to getopt_long.
1367 * src/users.c (list_entries_users, users): Use size_t for sizes.
1368 (list_entries_users): Use char for bytes.
1369 (main): No need to pass a non-NULL last arg to getopt_long.
1370 * src/who.c (do_lookup, short_list, short_output, include_idle,
1371 include_heading, include_mesg, include_exit, need_boottime,
1372 need_deadprocs, need_login, need_initspawn, need_clockchange,
1373 need_runlevel, need_users, my_line_only, main): Use bool for booleans.
1374 (print_runlevel): Use unsigned char for bytes.
1375 (list_entries_who, scan_entries, who): Use size_t for sizes.
1376 (main): No need to pass a non-NULL last arg to getopt_long.
1378 * src/install.c (isdir): Remove decl.
1379 (install_file_to_path): Rely on make_path to fail if the destination
1380 is not a directory, by passing preserve_existing==true to it.
1381 Hence we no longer need to call isdir.
1382 Free dest_dir immediately when it's no longer needed, rather than
1383 waiting until the end of the function.
1384 (copy_file): Don't bother calling isdir, as copy will do the
1385 right thing if the destination is a directory.
1387 * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
1388 print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
1389 Use bool for booleans.
1390 (max_depth): Now size_t, not int, to avoid an arbitrary limit
1391 of INT_MAX on depth.
1392 (G_fail): Remove: no longer needed, now that the relevant
1393 functions return bool.
1394 (process_file): Use return value to signal success rather than
1395 setting a global. Remove first_call static var; not needed, since
1396 we can look at n_alloc. Use size_t for depths. Remove FIXME
1397 about size_t casts, as it's now fixed. Use xnrealloc rather
1398 than the obsolescent XREALLOC. Don't bother to check whether
1399 reallocation is needed unless level > prev_level.
1400 (du_files): Invert sense of result, for consistency with
1401 other coreutils code. All callers changed.
1402 (main): Allow --max-depth values up to SIZE_MAX.
1404 * src/df.c (inode_format, show_all_fs, show_local_fs,
1405 show_listed_fs, posix_format, require_sync, print_type,
1406 selected_fstype, excluded_fstype, show_dev, show_point, main):
1407 Use bool for booleans.
1408 (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
1409 (show_dev, show_point, main):
1410 Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
1411 Don't assume disk name lengths are <= INT_MAX.
1412 Rewrite pct calculation to avoid cast.
1413 (show_point): Don't assume resolved length is <= SSIZE_MAX.
1415 * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
1416 instead of uintptr_t.
1417 * src/shred.c (UINT_MAX_32_BITS): Remove.
1418 (word32): Remove. All uses changed to uint32_t.
1419 (isaac_seed_data): Remove unnecessary cast.
1420 * src/system.h (ptr_align): Use size_t; in practice, this is just as
1421 good as uintptr_t in checking for alignments, and has fewer
1422 configuration hassles.
1424 * src/Makefile.am (localedir.h): Make it readonly; this
1425 undoes part of the 2004-07-27 patch.
1427 2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
1429 * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
1430 (IS_THOUSANDS_SEP): Use bool when appropriate.
1431 (numcompare, main): Use char, not int, when the value is always a char.
1432 (numcompare): Remove "register"; compilers are smart enough these days.
1433 * src/system.h (errno, CHAR_BIT): Remove decls;
1434 no longer needed now we assume C89 or better.
1435 Include <inttypes.h> before <stdint.h>, as it's the
1436 Autoconf-recommended pattern.
1437 (to_uchar): New inline function, moved here from tr.c.
1438 Use full names for int types, e.g. "long int" rather than "long".
1439 * src/tr.c (to_uchar): Remove; now in system.h.
1440 (is_char_class_member): Use bool when appropriate.
1442 * src/mkdir.c (create_parents, main): Use bool when appropriate.
1443 (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
1445 2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
1447 * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
1449 * src/chmod.c (recurse, force_silent, process_file, process_files,
1450 main): Use bool when appropriate.
1451 * src/cksum.c (cksum, main): Likewise.
1452 * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
1453 compare_files, main): Likewise.
1455 * src/copy.h (struct cp_options): Likewise.
1456 * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
1457 same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
1458 * src/cp-hash.h (remember_created): Likewise.
1459 * src/cp-hash.c (remember_created): Likewise.
1460 * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
1461 re_protect, make_path_private, target_directory_operand, do_copy,
1462 cp_option_init, decode_preserve_arg, main): Likewise.
1463 * src/install.c (isdir, change_timestamps, change_attributes,
1464 copy_file, install_file_to_path, install_file_in_dir,
1465 install_file_in_file, strip_files, dir_arg, cp_option_init, main,
1466 change_attributes, change_timestamps): Likewise.
1467 * src/mv.c (remove_trailing_slashes, rm_option_init,
1468 cp_option_init, do_move, movefile, main): Likewise.
1469 * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
1470 AD_push, prompt, remove_dir): Likewise.
1471 * src/rm.c (rm_option_init, main): Likewise.
1473 * src/remove.c (top_dir, pop_dir, full_filename_):
1474 Use size_t for sizes.
1475 * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
1476 succeeds. It's not necessary in that case, as *NEW_DST is always
1478 (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
1479 (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
1480 * src/rm.c (main): Likewise.
1482 md5sum, sha1sum integer cleanups.
1484 * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
1486 (ALG_UNSPECIFIED): Remove.
1487 (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
1488 * src/md5.c: Don't include any files other than checksum.h.
1489 * src/sha1sum.c: Likewise.
1490 * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
1491 bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
1492 Use bool when appropriate.
1493 (digest_check): Increase limit of number of input lines to
1494 UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
1495 Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
1497 2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
1499 * src/cat.c (exit_status): Remove. Now done by passing a boolean
1501 (simple_cat, cat): Return true if successful. All callers changed.
1502 (simple_cat, cat, main): Use bool for booleans.
1503 (simple_cat): Use size_t for sizes.
1504 (cat, main): Use the same names for parameters that we use for
1505 long options, to avoid confusion. This inverts the sense of the
1506 show_tabs (formerly output_tabs) and number_nonblank
1507 (formerly numbers_at_empty_lines) variables.
1508 (main): Don't mess up (due to integer overflow) if we are given
1509 INT_MAX - INT_MIN + 1 options.
1510 [O_BINARY]: Don't invoke isatty unless the other options require it.
1511 (main): When deciding whether to use simple_cat, don't worry
1512 about binary option; it's irrelevant.
1514 * src/dcgen: Remove comments, trailing white space, and empty
1515 lines from the output strings, to save space.
1516 Use a narrower type like 'unsigned char' for line lengths, if
1518 Make the output variables static, not extern.
1520 * src/chgrp.c (parse_group): Require base 10 when parsing
1522 (main): int -> bool when appropriate.
1523 * src/chown.c (main): Likewise.
1524 * src/chown-core.c: Include inttostr.h.
1525 (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
1526 (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
1527 instead of uint_to_string).
1528 (describe_change): Instead of an int flag, use a char *
1529 auxiliary; this avoids the need for casts.
1530 Assume free (NULL) works.
1531 (change_file_owner): Return true/false, not 0/-1, since
1532 we don't set errno. All callers changed.
1533 Use bool when appropriate.
1534 (chown_files): Likewise.
1535 * src/chown-core.h (chown_files): Likewise.
1537 * tests/chown/basic: Test for proper handling of uids like
1538 "010", which must be parsed as decimal.
1540 * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
1541 pwd when there are multiple names for the working directory
1542 (which can happen with an automounter, sigh).
1544 * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
1545 this causes Solaris 8 'make' to refuse to build "groups".
1546 (localedir.h): Don't depend on Makefile: this causes Solaris
1547 8 'make' to build localedir.h unnecessarily. The dependence
1548 on Makefile is ineffective anyway, since $(localedir) might
1549 change even if Makefile hasn't.
1551 * src/remove.c (remove_dir): If we can't save the state of the
1552 working directory, pretend we started from "/", not ".".
1553 This avoids a bug on hosts like Solaris that don't let you
1554 remove the working directory.
1556 2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
1558 * src/printf.c (strtiomax, strtoumax): Declare if not already
1559 declared: this fixes a portability bug with Solaris 8 + GCC.
1560 (STRTOX): Parenthesize use of macro arg as expression.
1561 (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
1563 * configure.ac: Check for declaration of strtoumax, for
1566 * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
1567 pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
1569 * tests/readlink/can-e: Don't assume that we can remove the
1570 working directory: this isn't possible under Solaris 8, say.
1571 * tests/readlink/can-f: Likewise.
1572 * tests/readlink/can-m: Likewise.
1574 * src/copy.c (copy_internal): find_backup_file_name no longer
1575 returns NULL, so don't bother to check for this.
1576 * src/cp.c (do_copy): Likewise.
1577 * src/ln.c (do_link): Likewise.
1579 2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
1581 * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
1583 (NZERO): New macro, if system doesn't define it already.
1584 (usage): Distinguish priorities from nice values.
1585 Don't assume NZERO is 20.
1586 (main): Use bool instead of int where appropriate.
1587 If user specifies an adjustment out of range, always truncate it
1588 to an inrange value instead of sometimes giving an error message
1590 Do not assume that -1 is an error return from "nice" or
1591 "getpriority", as it might be the current nice value minus NZERO.
1592 If nice/setpriority fails with errno == EPERM, go ahead and run
1593 the command anyway; POSIX requires this.
1595 * src/pathchk.c: Include euidaccess.h.
1596 (dir_ok): Use euidaccess, not access.
1597 * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
1598 (eaccess): Remove. All users changed to use euidaccess instead.
1600 2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
1602 * src/uptime.c (print_uptime) [defined BOOT_MSG]:
1603 Don't assume ut_line is null-terminated.
1604 * src/who.c (print_line): New arguments USERLEN and LINELEN,
1605 since USER and LINE might not be null terminated. All callers
1608 2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
1610 Fix bug with "tail -f" reported by Rob Holland in
1611 <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
1612 Also, remove the undocumented and unsupported-since-2000
1613 --max-consecutive-size-changes options. Fix another related bug:
1614 "tail" got confused if stdin, stdout, or stderr were closed.
1615 Also, use output buffering even with "tail -f".
1617 * NEWS: Document this, plus yesterday's patch.
1618 * doc/coreutils.texi (tail invocation): "size has remained the same"
1619 -> "file has not changed", which is more accurate for fifos.
1620 * src/tail.c: Include fcntl-safer.h.
1621 (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
1622 (COPY_A_BUFFER): New macro.
1623 (struct File_spec): New members mtime, mode, blocking.
1624 Remove member n_consecutive_size_changes.
1625 (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
1626 max_n_consecutive_size_changes_between_opens,
1627 MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
1628 (long_options, tail_forever, parse_options):
1629 Remove (non-)support for --max-consecutive-size-changes.
1630 (record_open_fd): New function.
1631 (recheck, tail_file): Use it. Don't assume that stdin is open.
1632 (dump_remainder): Add support for new COPY_A_BUFFER special value.
1633 Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
1634 (recheck): New arg BLOCKING, specifying whether to use blocking reads.
1636 (n_live_files): Remove, replacing with...
1637 (any_live_files): New function. All uses changed.
1638 (tail_forever): Use nonblocking I/O unless we know that blocking I/O
1639 is safe; this avoids some hangs when reading from a fifo.
1640 Avoid invoking fstat or sleep when using blocking I/O.
1641 Do not check for changes to size if the file is not a regular file,
1642 as the size is undefined in that case.
1643 Check for changes to mtime or mode, too; this works for non-regular
1645 (tail_forever, main): Redo fflush strategy to work even when input
1646 is nonblocking. Don't use unbuffered output; just flush when needed.
1648 2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
1650 * src/tail.c (main): Ignore -f if no file operand is specified
1651 and standard input is a pipe.
1652 * doc/coreutils.texi (tail invocation): Do not ignore -f for
1653 all pipes, just for when standard input is a pipe and no
1654 file operand is specified.
1655 * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
1656 Add a new commented-out f-2 test, which we still fail.
1657 (test_vector): All f-* tests are special cases, not just f-1.
1659 2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
1661 * src/uptime.c: Include c-strtod.h.
1662 (print_uptime): Use c_strtod instead of setlocale and sscanf.
1663 Use long int rather than int to count days (for 64-bit hosts),
1664 and check for arithmetic overflow when converting double to time_t.
1666 2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
1668 * src/printf.c (vstrtold): Renamed from vstrtod.
1669 Now returns long double. All uses changed.
1670 (print_direc): Use "L" length modifier when printing floating point
1671 numbers, since we're now printing long double.
1673 2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
1675 printf cleanup, to avoid undefined behavior, to add support for
1676 formats that Bash supports, and to support wide integers like
1679 * NEWS: Document this.
1680 * src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
1681 booleans, so that we don't reserve any values for precision or
1683 (STRTOX): Use prototype, not K&R-style definition.
1684 (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
1685 in ../lib), with type change to intmax_t.
1687 (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
1689 (vstrtod): Renamed from xstrtod. All uses changed.
1690 (print_direc): Use boolean arg instead of special value to indicate
1691 a missing precision or width. LENGTH no longer includes
1692 length modifiers or conversion character. New arg CONVERSION
1693 now specifies conversion character.
1694 Use intmax_t-width formatting for integers (like Bash).
1695 Add support for C99 %a, %A, %F (like Bash).
1696 Add support for field width with %c (POSIX requires this).
1697 Add a FIXME for lack of support for field width and precision
1699 Add support for '\'', '0' flags.
1700 Check for invalid combinations of flags, field width, precision,
1701 and conversion, to prevent use of undefined behavior.
1702 Allow multiple length modifiers, for formats like "%lld" (like Bash).
1703 Add support for C99 'j', 't', 'z' length modifiers (like Bash).
1704 In error message, output entire invalid conversion specification,
1705 instead of merely outputting % followed by the conversion char.
1706 * tests/misc/printf: Add tests for the above.
1708 2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
1710 Change "readlink -f" to be more compatible with prior implementations.
1711 Add more canonicalize options, -e and -m.
1712 Add comprehensive tests for all readlink modes.
1714 * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
1715 Do not add canonicalize.c here.
1717 * src/readlink.c (longopts): Add new options.
1718 (usage): Document them.
1719 (canonicalize_fname): New proxy function.
1720 (main): Handle new options.
1721 * doc/coreutils.texi (readlink invocation): Document new
1722 "readlink -f" behaviour and new canonicalize options, -e and -m.
1724 * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
1725 * tests/Makefile.am (SUBDIRS): Add readlink.
1726 * tests/readlink/Makefile.am: New file.
1727 * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
1728 * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
1729 * tests/misc/readlink: Remove file.
1731 2004-07-04 Jim Meyering <jim@meyering.net>
1733 * src/copy.c (copy_internal): Add a FIXME comment.
1735 2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
1737 * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
1738 * src/cp.c (do_copy): Likewise.
1739 * src/mv.c (movefile): Likewise.
1741 * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
1742 to avoid problem when path_concat dir name is longer than 2 GiB (!).
1744 * src/nohup.c (main): Don't pass NULL first argument to path_concat.
1745 This cleans up the semantics a bit, as we no longer try to open the
1748 2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
1750 * NEWS: Add short names -t and -T for --target-directory
1751 and --no-target-directory options, respectively.
1753 * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
1754 Remove. All uses changed to 'T' and 't', respectively.
1755 * src/install.c, src/ln.c, src/mv.c: Likewise.
1757 * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
1758 aliases for --target-directory and --no-target-directory,
1760 * src/install.c (long_options, main, usage): Likewise.
1761 * src/ln.c, src/mv.c: Likewise.
1763 2004-07-01 Jim Meyering <jim@meyering.net>
1765 * Makefile.maint (sc_file_system): New target.
1766 (syntax-check-rules): Add it.
1767 .x-sc_file_system: New file.
1768 * Makefile.am (EXTRA_DIST): Add it.
1770 * man/sync.x: Use "file system" rather than "filesystem".
1771 * man/stat.x, man/df.x: Likewise.
1773 2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
1775 * src/df.c (usage, main): Output "file system" rather than
1777 * src/du.c (usage): Likewise.
1778 * src/shred.c (usage): Likewise.
1779 * src/stat.c (usage): Likewise.
1780 * src/stat.c (long_options, usage): Rename "--filesystem" to
1781 "--file-system". But keep the old name around, for compatibility
1784 2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
1786 Add support for --no-target-directory option.
1788 * NEWS: Document it.
1789 * doc/coreutils.texi (Common options, Target directory, cp
1790 invocation, install invocation, mv invocation, ln invocation):
1792 (link invocation): Explain how to rewrite link using ln now
1793 that we have --no-target-directory.
1794 (ln invocation): Explain that --no-target-directory subsumes
1796 (unlink invocation): Modify wording to match new wording in
1799 * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
1800 (long_opts, usage, do_copy, main): Add support for
1801 --no-target-directory,
1802 * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
1804 * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
1806 * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
1808 * src/mv.c (enum): Sort values.
1810 2004-06-29 Jim Meyering <jim@meyering.net>
1812 Don't let verbose-mode output from a subshell obscure actual differences.
1813 * tests/rm/inaccessible: Turn off command-echoing just before
1814 invoking subshell, then turn it back on if VERBOSE=yes afterward.
1816 2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
1818 Add support for 'install --target-directory', an option
1819 that has been documented for years but not implemented (!).
1820 * doc/coreutils.texi (install invocation): Document
1821 --target-directory in synopsis, too.
1822 * src/install.c (TARGET_DIRECTORY_OPTION): New var.
1823 (long_options, main, usage): Add --target-directory.
1824 (target_directory_operand): New function, stolen from mv.c.
1825 (main): Use it. Check for -d and --target-directory.
1826 Alter wording of diagnostics to match other programs.
1828 2004-06-28 Jim Meyering <jim@meyering.net>
1830 * src/cp.c (usage): Fix copy+paste error in description of
1831 --target-directory: s/move/copy/. From Paul Jarc.
1833 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
1835 Use more-consistent rules among cp, ln, and mv when dealing with
1836 last operands that are (or look like) directories.
1838 * src/cp.c (target_directory_operand): New, nearly-common function,
1839 It reports an error if the destination appears to be a directory
1840 (e.g., because it has a trailing slash) but is not.
1841 * src/ln.c, src/mv.c: Likewise.
1842 * src/cp.c (do_copy): Use it.
1843 * src/ln.c (main): Likewise.
1844 * src/mv.c (main): Likewise.
1846 * src/cp.c (do_copy): Don't assume argc is positive.
1847 Don't bother to lstat dest, since copy() will do that for us.
1848 Use "const" to avoid the need for cast.
1850 * src/cp.c (do_copy): Don't output a usage message because of file
1851 problems (e.g., an operand is not a directory). Use it only for
1852 syntax. Standardize on "target %s is not a directory" for the
1854 * src/ln.c (main): Likewise.
1855 * src/mv.c (main): Likewise.
1857 * src/cp.c (do_copy): Remove test for trailing slash, since
1858 target_directory_operand now does this.
1859 * src/ln.c (main): Likewise.
1860 * src/mv.c (movefile): Likewise.
1862 * src/cp.c (main): Reject multiple target directories.
1863 Check whether a specified target is a directory when parsing the
1864 options, using stat. This gives more-accurate diagnostics.
1865 * src/ln.c (main): Likewise.
1867 * src/ln.c (isdir): Remove decl; no longer needed.
1868 * src/mv.c (isdir, lstat): Likewise.
1870 * src/ln.c (do_link): New arg dest_is_dir. All uses changed.
1871 Don't check the destination ourself; rely on dest_is_dir.
1872 This way we can avoid lstatting the destination in the
1873 usual case, and in the worst case we lstat 1, not 3 times.
1874 Don't bother to unlink unless link failed; this saves a syscall.
1875 Remove unnecessary backup_succeeded flag;
1876 it was identical to "dest_backup != NULL".
1878 * src/ln.c (main): Use int to count to argc, not unsigned int.
1879 This handles negative operand counts.
1880 * src/mv.c (main): Likewise.
1882 * src/mv.c (do_move): Don't call hash_init; expect the caller to
1883 do it, for consistency with cp.c and ln.c. All callers changed.
1884 (movefile): dest_is_dir parameter is now bool, not int.
1885 (main): Standardize on "missing destination file operand after %s"
1886 for the diagnostic, for consistency with cp.c.
1888 * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
1889 will complain about the arg count.
1890 Adjust to new (briefer) diagnostics.
1891 * tests/cp/fail-perm: Add a test to verify that we get the new
1892 diagnostic when failing to copy through a symlink-to-inaccessible-dir.
1894 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
1896 Fix a bug: formerly, if d/x was a directory and x a file, "ln x
1897 d/" incorrectly created a link d/x/x. It also saves some system
1900 * NEWS: Document the fix.
1902 * src/ln.c (main): Don't append basename to dest if this
1903 results in an existing directory name.
1904 * tests/ln/misc: See whether a trailing slash is followed too far.
1906 2004-06-26 Jim Meyering <jim@meyering.net>
1908 * src/printf.c (main): When given no arguments, print the standard
1909 "missing operand\nTry printf --help..." message -- to be consistent.
1911 2004-06-26 Jim Meyering <jim@meyering.net>
1913 * src/mknod.c (main): Add \n at the end of message output via fprintf.
1915 2004-06-25 Jim Meyering <jim@meyering.net>
1917 * tests/ln/misc: Add test for ln subscript error.
1919 2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
1921 * src/ln.c (do_link): Remove unnecessary call to lstat.
1922 (main): Avoid subscript error when the destination is "".
1924 2004-06-23 Jim Meyering <jim@meyering.net>
1926 * tests/*: Replace all occurrences of `(exit N); exit' with
1927 `(exit N); exit N'. Otherwise, those many tests could exit with
1928 improper exit status when exiting via e.g., a trapped interrupt.
1929 Thanks to a report from Bob Proulx.
1931 2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
1933 * src/who.c (idle_string, print_user): New arg boottime,
1934 specifying the most recent boot time. All uses changed.
1935 (idle_string) Consider a line to be "old" if it hasn't been used
1936 since the last boot time. Watch out for overflow when computing
1937 times, and for times in the future.
1938 (idle_string): Record latest boot time.
1940 2004-06-22 Jim Meyering <jim@meyering.net>
1942 * src/test.c (usage): Correct description of `-t FD'. The file
1943 descriptor, FD, is no longer optional. Reported by Ton Nijkes.
1945 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
1947 The 2004-06-19 fix for who and pinky was incomplete, as ctime
1948 has undefined behavior if the year precedes -999 or follows 9999.
1949 Since we have to stop using ctime anyway, we might as well use
1950 strftime and fix the FIXME, and support internationalized dates.
1952 * NEWS: Document the new behavior.
1953 * src/who.c: Include "hard-locale.h".
1954 (time_format, time_format_width): New vars.
1955 (time_string, print_line): Use them.
1957 (time_string): Use localtime + strftime instead of
1958 ctime, to avoid problems with years before -999 or after 9999.
1959 * src/pinky.c: Likewise.
1961 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
1963 Fix bug: GNU 'ls' didn't count columns correctly if user or group
1964 names contained multibyte characters where the column count
1965 differed from the byte count. This patch also corrects
1968 * src/ls.c (format_user_or_group): New function, which counts
1970 (format_user, format_group): Use it.
1971 (format_user_or_group_width): New function, which counts columns
1973 (format_user_width, format_group_width): Use it.
1975 2004-06-21 Jim Meyering <jim@meyering.net>
1977 * tests/priv-check: Quote "$PATH" in PATH=$PATH.
1978 Suggestion from Andreas Schwab.
1980 * tests/priv-check: When running as root, be sure to propagate
1981 PATH through to the process we exec as non-root.
1982 Reported by michael@aplatform.com.
1984 * src/mknod.c (main): Don't segfault when calculating the
1985 expected number of operands for `mknod NAME'.
1987 2004-06-20 Jim Meyering <jim@meyering.net>
1989 * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
1991 2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
1993 * src/basename.c (main):
1994 Standardize on the diagnostics given when someone gives
1995 too few operands ("missing operand after `xxx'") or
1996 too many operands ("extra operand `xxx'").
1997 Include "quote.h" and/or "error.h" if it wasn't already being included.
1998 * src/chgrp.c (main): Likewise.
1999 * src/chmod.c (main): Likewise.
2000 * src/chown.c (main): Likewise.
2001 * src/chroot.c (main): Likewise.
2002 * src/comm.c (main): Likewise.
2003 * src/cp.c (do_copy): Likewise.
2004 * src/csplit.c (main): Likewise.
2005 * src/date.c (main): Likewise.
2006 * src/dircolors.c (main): Likewise.
2007 * src/dirname.c (main): Likewise.
2008 * src/du.c (main): Likewise.
2009 * src/expr.c (main): Likewise.
2010 * src/hostid.c (main): Likewise.
2011 * src/hostname.c (main): Likewise.
2012 * src/id.c (main): Likewise.
2013 * src/install.c (main): Likewise.
2014 * src/join.c (add_file_name, main): Likewise.
2015 * src/link.c (main): Likewise.
2016 * src/ln.c (main): Likewise.
2017 * src/logname.c (main): Likewise.
2018 * src/md5sum.c (main): Likewise.
2019 * src/mkdir.c (main): Likewise.
2020 * src/mkfifo.c (main): Likewise.
2021 * src/mknod.c (main): Likewise.
2022 * src/mv.c (main): Likewise.
2023 * src/nohup.c (main): Likewise.
2024 * src/od.c (main): Likewise.
2025 * src/pathchk.c (main): Likewise.
2026 * src/ptx.c (main): Likewise.
2027 * src/readlink.c (main): Likewise.
2028 * src/rm.c (main): Likewise.
2029 * src/rmdir.c (main): Likewise.
2030 * src/seq.c (main): Likewise.
2031 * src/setuidgid.c (main): Likewise.
2032 * src/shred.c (main): Likewise.
2033 * src/sleep.c (main): Likewise.
2034 * src/sort.c (main): Likewise.
2035 * src/split.c (main): Likewise.
2036 * src/stat.c (main): Likewise.
2037 * src/test.c (beyond, main): Likewise.
2038 * src/touch.c (main): Likewise.
2039 * src/tr.c (main): Likewise.
2040 * src/tsort.c (main): Likewise.
2041 * src/tty.c (main): Likewise.
2042 * src/uname.c (main): Likewise.
2043 * src/uniq.c (main): Likewise.
2044 * src/unlink.c (main): Likewise.
2045 * src/uptime.c (main): Likewise.
2046 * src/users.c (main): Likewise.
2047 * src/who.c (main): Likewise.
2048 * src/whoami.c (main): Likewise.
2050 * tests/basename/basic: Adjust to new diagnostics.
2051 * tests/du/files0-from: Likewise.
2052 * tests/expr/basic: Likewise.
2053 * tests/mv/diag: Likewise.
2054 * tests/tsort/basic-1: Likewise.
2056 2004-06-20 Jim Meyering <jim@meyering.net>
2058 * src/ln.c: Remove declaration of yesno.
2059 Instead, include yesno.h.
2060 * src/copy.c: Likewise.
2062 * src/remove.c: Remove declaration of yesno.
2063 Instead, include yesno.h.
2064 (top_dir): Remove now-unnecessary cast of obstack_base.
2065 (pop_dir): Likewise.
2066 (full_filename_): Likewise.
2068 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
2070 Don't dump core if ctime returns NULL; this is possible on
2071 hosts with 64-bit time_t and 32-bit int.
2072 * src/who.c: Include "inttostr.h".
2073 (time_string): If ctime fails, print the raw time as an integer
2074 instead of dumping core.
2075 * src/pinky.c: Likewise, as follows:
2076 Include "inttostr.h".
2077 (time_string): New function, copied from who.c.
2078 (print_entry): Use it.
2080 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
2082 * src/who.c (print_line): Don't truncate user names at 8 bytes.
2083 Problem reported by Guido Leenders in:
2084 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
2085 * NEWS: document this.
2087 2004-06-19 Jim Meyering <jim@meyering.net>
2089 * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
2090 using GNU_PACKAGE (from PACKAGE) once again. This restores
2091 `GNU' to the parenthesized package name in --version output.
2092 Before, the first argument from AC_INIT, `GNU coreutils', would
2093 be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
2094 Reported by Richard Stallman.
2096 2004-06-17 Jim Meyering <jim@meyering.net>
2098 * src/tr.c (to_uchar): Rename function from `uchar'. The latter
2099 would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
2101 2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
2103 * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
2104 allows the GNU behavior. "--" is now supported by chroot, hostid,
2105 hosname, pwd, sync, yes.
2106 * doc/coreutils.texi (yes invocation, false invocation,
2107 true invocation): Document this.
2108 * src/chroot.c (main): Handle "--".
2109 * src/hostid.c (main): Likewise.
2110 * src/hostname.c (main): Likewise.
2111 * src/pwd.c (main): Likewise.
2112 * src/sync.c (main): Likewise.
2113 * src/yes.c (main): Likewise.
2114 * src/true.c (main): Recognize --help and --version even if
2115 POSIXLY_CORRECT is set.
2116 * src/yes.c (main): Likewise.
2118 2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
2120 * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
2122 * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
2123 * src/ls.c (decode_switches): Pay attention to TABSIZE even if
2124 POSIXLY_CORRECT is set. POSIX reserves upper-case environment
2125 variables to the implementation, so it's OK for ls to depend on
2127 * src/pr.c: Include "hard-locale.h".
2128 (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
2129 POSIX specifies the behavior only in the POSIX locale.
2130 * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
2131 since POSIX says the behavior is unspecified here.
2132 * src/tail.c (parse_obsolescent_option): Support multiple file operands
2133 even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
2134 * src/printf.c (main): Recognize --help, --version even if
2135 POSIXLY_CORRECT. POSIX does not specify any options, but it
2136 does not prohibit options either, so "printf" is like "expr" here.
2137 * src/unlink.c (main): Likewise.
2138 * tests/misc/printf: Adjust to the new semantics for \x if
2141 2004-06-14 Jim Meyering <jim@meyering.net>
2143 * tests/misc/pwd: New test, for fix of 2004-04-19.
2144 * tests/misc/Makefile.am (TESTS): Add pwd.
2145 (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
2147 * src/copy.c: Remove declaration of euidaccess.
2148 Instead, include "euidaccess.h".
2150 2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
2152 * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
2153 (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
2154 as (sizeof "??") reliably returns 3.
2155 (print_line): Guard against idle and pid being too long
2156 (which is possible when printing headers).
2157 (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
2158 Avoid unnecessary cast of sizeof to int.
2159 (make_id_equals_comment): Do not assume that UT_ID returns
2160 a string; it might return a non-null-terminated array.
2161 Use strncat instead. It's not very often where strncat is
2162 exactly what you want, but this is one of those rare cases.
2164 2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
2166 * src/who.c (list_entries_who): Don't output a trailing space.
2168 2004-06-09 Jim Meyering <jim@meyering.net>
2170 * src/touch.c (usage): Improve wording in description of the
2171 --time=WORD option. Reported by Dan Jacobson.
2173 * src/chown-core.c (change_file_owner): Change names of parameters
2174 old_uid and old_gid to required_uid and required_gid respectively.
2176 * src/chmod.c (mode_changed): Return false, not 0, now that the
2177 function returns `bool'.
2179 2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
2181 Adjust chmod and chown to be similar if -c or -v are given. In
2182 particular, a no-op chown is no longer reported as a change; this
2183 reverts to previous behavior. Also, fix both commands so that -v
2184 report failures even if the failure is not due to the chmod or
2187 * src/chmod.c (CH_NOT_APPLIED): New constant.
2188 (describe_change): Handle it.
2189 (process_file): Use it, if a symlink wasn't changed.
2190 (mode_changed): Return bool, not int. Accept new argument
2191 NEW_MODE; all callers changed. This lets us avoid statting the
2192 file unless the new mode has unusual bits.
2193 (process_file): Return -1 on error. With -v, report all errors
2194 verbosely, not just some.
2196 * src/chown-core.c (change_file_owner): Return -1 on error, not
2197 1 sometimes and -1 on others. Our caller ORs together our results,
2198 and (-1 | 1) == 0 on ones-complement hosts.
2199 With -v report all errors verbosely, not just some.
2200 Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
2201 file_stats wasn't set properly in that case.
2203 * tests/chgrp/basic: Adjust to above changes.
2205 2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
2207 * tests/chgrp/basic: Test that chgrp -h does not fail on
2208 symlinks, even on hosts where that's not supported.
2209 Test that if -R is specified without -H or L, -h is assumed.
2210 Test that chown() is not optimized away.
2212 2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
2214 Several fixes to chgrp and chown for compatibility with POSIX and BSD:
2216 Check for incompatible options. When -R and --dereference are
2217 both used, then either -H or -L must also be used. When -R and -h
2218 are both used, then -P must be in effect.
2220 -H, -L, and -P have no effect unless -R is also specified.
2221 If -P and -R are both specified, -h is assumed.
2223 Do not optimize away the chown() system call when the file's owner
2224 and group already have the desired value. This optimization was
2225 incorrect, as it failed to updated the last-changed time and reset
2226 special permission bits, as POSIX requires.
2228 Do not report an error if the owner or group of a
2229 recursively-encountered symbolic link cannot be updated because
2230 the file system does not support it.
2232 * NEWS: Document the above.
2234 * src/chgrp.c (main): Check for incompatible options. -R --dereference
2235 requires either -H or -L, and -R -h requires -P. If -H, specify
2236 FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
2237 file as much like chown.c as possible.
2238 * src/chown.c (main): Likewise.
2240 * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
2241 needed. Chown a directory only after chowning its children; this
2242 avoids problems if the new directory ownership doesn't permit
2243 access to the children. Dereference symlinks before doing
2244 ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
2245 Do not optimize away the chown() system call when the file's owner
2246 and group already have the desired value. POSIX does not permit
2247 this optimization. Rely on chown and lchown to do the right
2248 thing with symlinks and/or -1 arguments, now that we have wrappers
2249 to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
2250 errors, not just command-line errors.
2251 (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
2253 * src/system.h (ENOTSUP): Remove.
2255 * tests/chgrp/basic: Use chown --from to discover whether the
2256 group changed, since chgrp now changes unconditionally. This
2257 complicates the sed script a bit. Do not specify --dereference,
2258 since it's the default (and we want to test this). Adjust output
2259 to match the fact that chgrp no longer optimizes the case of
2260 changing a file's group to the same value as before.
2261 * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
2262 options are incompatible, and their behavior is undefined with POSIX.
2263 (changed, not_changed): Adjust to match the fact that -h is no longer
2264 specified. Sort names.
2265 * tests/chown/deref: Adjust error-diagnostic spelling to match new
2268 2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
2270 * src/uname.c (main): Fix typo introduced on 2003-05-10 that
2271 prevented a diagnostic of any operands.
2273 2004-06-08 Jim Meyering <jim@meyering.net>
2275 * src/shred.c (direct_mode): Turn it on/off with directio, too.
2277 2004-06-07 Jim Meyering <jim@meyering.net>
2279 Enable direct-mode I/O (bypassing the buffer cache), if possible.
2280 Prompted by a suggestion from Kalle Olavi Niemitalo
2281 in http://bugs.debian.org/207035.
2282 * src/shred.c (direct_mode): New function.
2283 (do_wipefd): Turn on direct-mode I/O.
2284 (dopass): If a file's first write fails with EINVAL,
2285 turn off direct-mode I/O and retry the write.
2287 2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
2289 * src/tr.c (main): "tr -d a b" is now a fatal error even if
2290 POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
2293 2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
2295 * src/shred.c (dopass): Don't subtract 1 from the offset after
2296 a write error. Problem reported by Jon Peatfield in:
2297 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
2299 2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
2301 Fix bug reported by Buciuman Adrian in
2302 <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
2303 where 'dd' created a file that was too large. The bug was that dd
2304 assumed that the input file offset does not advance after a failed
2305 read; but POSIX says that the input file offset is undefined after
2308 * src/dd.c (MAX_BLOCKSIZE): New macro.
2309 (input_seekable, input_seek_errno, input_offset,
2310 input_offset_overflow): New vars.
2311 (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
2312 (advance_input_offset): New function.
2313 (skip_via_lseek): Set errno to zero when reporting our failure,
2314 so that we don't report based on garbage errno.
2315 (skip): If fdesc is standard input, advance the input offset.
2316 Do not quit if reading, and if noerror was specified;
2317 POSIX seems to require this.
2318 If read fails on output file, report the earlier lseek failure
2319 instead; this fixes a FIXME in dd_copy.
2320 (advance_input_after_read_error): New function.
2321 (dd_copy): Use it, instead of assuming that failed reads
2322 do not advance the file pointer. Advance input offset
2323 after nonfailed reads. Advance only a partial block if
2324 the previous read (before the failed read) succeeded, and
2325 do not generate an output block of zeros in this case.
2326 (main): Determine initial input offset, seekability of input,
2327 and error if it wasn't seekable.
2329 2004-06-02 Jim Meyering <jim@meyering.net>
2331 rm (without -f) could hang unnecessarily when attempting to
2332 remove a symlink to a file on an off-line NFS-mounted partition.
2333 Reported by David Howells in https://bugzilla.redhat.com/124699.
2334 * src/remove.c (write_protected_non_symlink): New function.
2335 Don't invoke euidaccess on symlinks.
2336 (prompt): Use write_protected_non_symlink rather than using
2337 euidaccess directly, being careful not to call lstat twice for a file.
2339 Fix a bug in how the --output-delimiter=D option works with
2340 abutting byte or character ranges. Reported by David Krider in
2341 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
2342 * src/cut.c (print_kth): Remove special case for open-ended range.
2343 (set_fields): Record the range start index for an interval even
2344 when it abuts another interval on its low side.
2345 Also record the range start index of the longest right-open-interval.
2346 * tests/cut/Test.pm: Add tests of --output-delimiter=S with
2347 abutting and overlapping byte ranges.
2349 2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
2351 Some POSIX-conformance cleanups for tr.
2353 * src/tr.c (posix_pedantic): Remove; no longer needed since
2354 we need to test this in just one place now.
2355 (usage): Mention -C.
2356 (unquote): Note that \055, \n, etc are escaped.
2357 Do not worry about POSIXLY_CORRECT when warning about ambiguous
2359 \ at end of string stands for itself.
2360 Do not diagnose invalid backslash escapes: POSIX says the behavior
2361 is unspecified in this case, so we don't need to diagnose it.
2362 (main): Add support for -C (currently an alias for -c).
2363 Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
2365 * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
2366 Fix comment for range-a-a.
2368 2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
2370 Improve the efficiency (and in one case, correctness) of code
2371 that reads symlinks.
2373 * src/copy.c (copy_internal): Don't use alloca, as it can mess up
2374 royally if the link length is long (e.g., GNU/Hurd). Use
2375 xreadlink instead, it's safer. Don't bother to read the link if
2376 it's the wrong size. Add a FIXME because this area is a bit murky
2378 * src/ls.c (get_link_name): Update use of xreadlink.
2379 * src/readlink.c (main): Likewise.
2380 * src/stat.c (print_stat): Likewise.
2382 2004-06-01 Jim Meyering <jim@meyering.net>
2384 * src/env.c (main): Prefer the notation `STREQ (a, b)'
2385 over `!strcmp (a, b)'.
2386 * src/sort.c (main, sort_buffer_size): Prefer the notation
2387 `STREQ (a, b)' over `strcmp (a, b) == 0'.
2388 * src/date.c (batch_convert): Likewise.
2389 * src/expr.c (nextarg): Likewise.
2390 * src/su.c (correct_password, restricted_shell, main): Likewise.
2391 * src/ptx.c (swallow_file_in_memory, main): Likewise.
2392 * src/test.c (binary_operator, and, or, main): Likewise.
2394 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
2396 * NEWS: echo compatibility cleanup.
2397 * doc/coreutils.texi (echo invocation): Document the changes.
2398 * src/echo.c (V9_ECHO): Remove; always enabled.
2399 (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
2400 we use the same naming convention as bash. Now an enum,
2402 (usage): Reword to mention -e/-E more accurately.
2403 Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
2404 (hextobin): New function.
2405 (main): Use bool rather than int for local vars when appropriate.
2406 Do not allow options if POSIXLY_CORRECT, unless we are using
2407 BSD semantics and the first argument is "-n".
2408 Don't pass unnecessary extra arg to parse_long_options.
2409 do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
2410 Do not look for options if !allow_options.
2411 Use size_t rather than int when appropriate.
2412 Open-code option test rather than using strrchr.
2413 Use faster test for "-".
2414 Avoid redundant argc test.
2415 Add support for \x, for Bash compatibility.
2416 Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
2417 When '\c' is encountered, stop printing immediately, as POSIX
2419 Add support for \xhh syntax.
2420 Add support for \0ooo syntax; POSIX requires this.
2422 2004-06-01 Jim Meyering <jim@meyering.net>
2424 * Use automake-1.8b. Regenerate dependent files.
2426 2004-05-31 Jim Meyering <jim@meyering.net>
2428 * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
2429 the build src/ directory -- at the front.
2430 ($(srcdir)/$x-tests): Depend on Makefile.am.
2431 Use $x as the program name, except when it would be `test' (test is
2432 the sole program tested via mk-script that is also a shell built-in).
2433 In that case, use the old ../../src/$x.
2435 2004-05-30 Jim Meyering <jim@meyering.net>
2437 Work around HPUX /bin/cc compiler bug that is exposed, now that
2438 sets are arrays of type `bool'. More details here:
2439 http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
2440 FIXME: verify that the above URL points to the right message
2442 * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
2443 rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
2444 (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
2445 system, those two expressions are not the same (256 vs. 1024).
2446 The effect of this problem was that `tr -c x y' would fail:
2447 tr: when not truncating set1, string2 must be non-empty
2448 (set_initialize): Remove unnecessary initialization of the `in_set'
2449 buffer; that initialization triggered the same compiler bug as above.
2451 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
2453 tr cleanup, mostly having to do with integer type ranges.
2456 * tests/tr/Test.pm: Add a few tests for the below. Alas, most of
2457 the test cases wouldn't be portable, or would take too much CPU
2460 * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
2461 This is safe since the code already assumes N_CHARS fits in int.
2462 (Filter): Remove: we want to prototype everything.
2463 (ORD, CHR): Remove. All uses removed. Some replaced with:
2464 (uchar): New function. All places where a char must be converted
2465 to an unsigned char are now done this way, not by ad-hoc methods.
2466 (count): New type. Use it whenever counts or states are needed.
2467 (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
2468 since we used it in an unsigned int context) to UINTMAX_MAX - 1.
2469 (REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
2470 whenever appropriate.
2471 (NOT_A_CHAR): Remove global macro; now a local enum.
2472 (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
2473 the rest of the code no longer depends on them.
2474 (class_ok): Remove; all uses changed to use inline comparisons.
2475 (RE_NO_TYPE): Remove; wasn't used or needed.
2476 (struct List_element): normal_char and equiv_code are now unsigned
2478 first_char, last_char, and the_repeated_char are now unsigned char,
2479 not unsigned int. repeat_count is now count, not size_t.
2481 (struct Spec_list): state is now count, not unsigned int.
2482 lengthis now count, not size_t.
2483 n_indefinite_repeats is now size_t, not int.
2484 has_equiv_class, has_char_class, and has_restricted_char_class
2485 are now bool, not int. All uses changed.
2486 (struct E_string): s is now char *, not unsigned char *.
2487 escaped is now bool *, not int *. All uses changed.
2488 (ES_MATCH): Remove macro, replacing with:
2489 (es_match): New inline function. All uses changed.
2490 (squeeze_repeats, complement, posix_pedantic, truncate_set1,
2491 translating): Now bool, not int.
2492 (io_buf): Now char array, not unsigned char.
2493 (SET_TYPE): Remove. All uses replaced with bool.
2494 (is_equiv_class_member, unquote, append_range, append_char_class,
2495 append_equiv_class, find_closing_delim, star_digits_closebracket,
2496 build_spec_list, parse_str, homogeneous_spec_list):
2497 Now returns bool, not int. All uses changed.
2498 (is_equiv_class_member): Now inline.
2499 (is_equiv_class_member, is_char_class_member, make_printable_str,
2500 append_normal_char, append_range, append_repeated_char,
2502 Args are now of proper integer type.
2503 (unquote, look_up_char_class, make_printable_str,
2504 append_equiv_class, build_spec_list, squeeze_filter):
2505 Avoid unsigned char *p; gently convert *p to unsigned char instead.
2506 (unquote, get_spec_stats): Do not jump past declarations and then
2507 use them; C doesn't allow this in portable programs.
2508 (make_printable_str): Check for overflow in size calculations.
2509 (xmemdup): Remove. All uses rewritten.
2510 (find_bracketed_repeat): Args are now of proper pointer-to-integer
2511 type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
2512 (find_bracketed_repeat, star_digits_closebracket): Check that the
2513 digits are not escaped.
2514 (build_spec_list): Don't bother to copy opnd_str; not needed.
2515 (build_spec_list, get_next): Simplify internal logic a bit.
2516 (card_of_complement): Fix bug due to char overflow.
2517 (get_spec_stats): Don't assume len fits into int.
2518 Check for integer overflow. Use abort() rather than assert(0).
2519 (string2_extend): Fix subscript error: is_char_class_member (..., 255)
2521 (squeeze_filter): READER is never null now; simplify code.
2522 READER arg now has a simpler type. Remove unnecessary casts.
2523 (squeeze_filter, main): Calls to fwrite improperly checked result
2524 against zero, rather than against requested size.
2525 (plain_read): New function.
2526 (read_and_delete, read_and_xlate):
2527 Remove unused filter arg, and don't worry about hit_eof.
2528 Simplify by using plain_read.
2529 (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
2530 (main): Always pass a non-null procedure to squeeze_filter.
2531 Rewrite so that class_ok isn't needed.
2533 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
2535 * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
2536 fdatasync reports EBADF when syncing (unwritable) directories.
2537 Problem reported by Albert Chin-A-Young in:
2538 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
2540 2004-05-29 Jim Meyering <jim@meyering.net>
2542 * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
2543 Patch from Albert Chin.
2545 * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
2547 * src/remove.c (push_dir): Merge declaration and adjacent assignment
2548 into a single statement.
2550 2004-05-28 Jim Meyering <jim@meyering.net>
2552 * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
2554 2004-05-22 Jim Meyering <jim@meyering.net>
2556 rm -r would get a failed assertion when run from an inaccessible
2557 directory and with two or more command line arguments including an
2558 absolute-named directory followed by a relative-named directory.
2560 * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
2561 * src/remove.c (struct cwd_state): Define.
2562 (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
2563 can be detected by the caller. Instead of returning a malloc'd
2564 directory name, communicate it to caller via a new parameter, and
2565 return an indication of whether restore_cwd failed. Update caller.
2566 Eliminate an unnecessary call to AC_stack_top.
2567 (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
2568 so we can now communicate to caller whether/how functions like
2569 restore_cwd have failed. Update caller.
2570 (rm_1): Fail if we've failed to restore the working directory
2571 and the name of the next file to remove is `.'-relative.
2572 (rm): Fail if the require_restore_cwd flag is true and we've
2573 failed to restore the working directory.
2574 * src/mv.c (rm_option_init): Initialize new member,
2575 x->require_restore_cwd.
2576 * src/rm.c (rm_option_init): Likewise.
2578 2004-05-21 Jim Meyering <jim@meyering.net>
2580 * tests/rm/inaccessible: New test for the above fix.
2581 * tests/rm/Makefile.am (TESTS): Add inaccessible.
2583 * src/remove.c (rm): Use free rather than XFREE.
2584 (remove_dir): Use xmalloc, not XMALLOC.
2585 (ds_init): Likewise.
2587 2004-05-20 Jim Meyering <jim@meyering.net>
2589 * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
2590 diagnostics in shred.c have been fixed, don't exempt shred.c from
2593 * src/shred.c: Use translatable diagnostics, e.g.
2594 change "%s: remove" to _("%s: failed to remove") and
2595 change "%s: close" to _("%s: failed to close").
2597 2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
2599 * src/shred.c (names): Bring back lower-case letters, "_", and
2600 ".". But continue to omit +, =, %, @, #, as they're either
2601 shell metacharacters (for some shells) or are not in some
2602 character sets, or (in the case of '%') must be a
2603 metacharacter somewhere.
2605 2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
2607 * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
2609 2004-05-17 Jim Meyering <jim@meyering.net>
2611 * src/shred.c (incname): Decrement `len' only once per loop iteration.
2613 chgrp and chown now dereference symlinks by default, per POSIX.
2614 Reported by Michal Politowski as http://bugs.debian.org/249177.
2616 * src/chown-core.c (chopt_init): Affect each symlink referent by default.
2617 * src/chown.c (usage): Update to reflect this.
2618 * src/chgrp.c (usage): Likewise.
2619 * NEWS: Describe the change.
2620 Adapt tests accordingly.
2621 * tests/chgrp/basic: Use -h where necessary to retain semantics.
2622 * tests/chgrp/deref: Likewise.
2623 * tests/chgrp/posix-H: Likewise.
2625 2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
2627 In shred, check for errors from fdatasync more carefully. If
2628 fdatasync fails with errno==EINVAL, it means this implementation
2629 does not support synchronized I/O for this file. Do not report
2630 this as an error, as (for example) AIX 5.2 fdatasync reports it
2631 for raw disk devices. Problem reported by Albert Chin in
2632 <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
2634 Check for write errors, though: the old code ignored them.
2635 Improve error checking in a few other cases, too (e.g., close of a
2638 Also, change several 'int' values to 'bool', so that the error
2639 checking is a bit clearer. Similarly, change unsigned values
2640 to size_t where appropriate.
2642 * src/shred.c: Include "dirname.h".
2643 (datasync) [!HAVE_FDATASYNC]: Remove.
2644 (dosync): New function.
2645 (dopass): Use it. Return 1 on write error, -1 on other error.
2646 All callers changed. Report write error if dosync does.
2647 (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
2648 not int (0/-1). All callers changed. Return false if there's a
2650 (incname): Return bool (true/false), not int (0/1). Accept
2651 size_t length, not unsigned. All callers changed. Do not
2652 bother checking for non-digits; it can't happen. Replace
2653 recursion with iteration.
2654 (wipename): Use dir_name, base_name, etc. instead of assuming
2655 Unix file names. Use size_t for length, not unsigned.
2656 Report error if unlink or close fails.
2657 (wipename, main): Use bool for booleans.
2659 (names): Use only digits and uppercase letters, for greater
2662 2004-05-16 Jim Meyering <jim@meyering.net>
2664 * tests/chown/deref: New test for the yesterday's change.
2665 * tests/chown/Makefile.am (TESTS): Add deref.
2667 2004-05-15 Jim Meyering <jim@meyering.net>
2669 chown --dereference did nothing when the owner/group of a
2670 symlink matched the desired owner/group. Reported by David Malone.
2671 Also reported in 1999 as http://bugs.debian.org/39642.
2673 * src/chown-core.c (change_file_owner): When --dereference has
2674 been specified, and when processing a symlink, stat it to get the
2675 owner and group of the referent.
2677 2004-05-14 Jim Meyering <jim@meyering.net>
2679 * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
2680 s/supercede/supersede/ reported by Andrew Fabbro.
2682 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
2684 Improve performance of `sort -m' on large files, at the cost of
2685 making some contrived examples unsafe. POSIX allows this
2686 optimization. Performance problem reported by Jonathan Baker in
2687 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
2689 * src/sort.c (first_same_file): Do not treat input pipes
2690 differently from other files.
2691 * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
2692 might write F before reading all the input.
2695 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
2697 * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
2698 '\007', for portability to EBCDIC hosts.
2699 * src/printf.c (print_esc_char): Likewise.
2700 * src/tr.c (unquote, make_printable_str): Likewise.
2702 2004-05-12 Jim Meyering <jim@meyering.net>
2704 * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
2705 where the result is used. This avoids one unnecessary lstat call
2706 per command line argument.
2708 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
2710 Don't assume that "make -C" works; Solaris "make" doesn't have -C.
2712 * src/Makefile.am (all_programs.list): New rule, copied from
2713 man/Makefile.am and tests/Makefile.am, except that we use the
2714 system tr rather than ./tr and we don't use tr -s.
2715 * tests/Makefile.am (all_programs): Use it.
2716 * man/Makefile.am (all_programs): Likewise. Renamed from programs,
2717 for consistency. All uses changed.
2719 2004-05-11 Jim Meyering <jim@meyering.net>
2721 * tests/rm/unread3: New test, for the above fix and today's
2722 lib/save-cwd.c improvement.
2723 * tests/rm/Makefile.am (TESTS): Add unread3.
2725 * src/rm.c: Don't include "save-cwd.h". It's no longer used.
2727 2004-05-10 Jim Meyering <jim@meyering.net>
2729 * tests/install/trap: New file. Test for bug fix of 2004-04-18.
2730 * tests/install/Makefile.am (TESTS): Add trap.
2732 * src/remove.c (AD_push): Don't use errno in diagnostic about
2735 Remove these generated files from CVS.
2736 * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
2737 * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
2738 * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
2739 * tests/tr/tr-tests, tests/wc/wc-tests:
2741 2004-05-09 Jim Meyering <jim@meyering.net>
2743 * src/tr.c (unquote): Use xcalloc rather than xmalloc and
2744 a loop initializing the just-allocated memory to zero.
2746 2004-05-08 Jim Meyering <jim@meyering.net>
2748 * tests/rm/no-give-up: New file; check for today's fix.
2749 * tests/rm/Makefile.am (TESTS): Add no-give-up.
2751 2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
2753 Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
2754 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
2756 * src/remove.c (remove_entry): Check for errno values like ENOENT
2757 that show the file cannot be directory, instead of for errno
2758 values like EPERM that show the file might be a directory. This
2759 is necessary because, when a single unlink() call has multiple
2760 reasons to fail, it can set errno to any of those reasons; it's
2761 only the rare errno value like ENOENT that excludes all the other
2762 possible reasons to fail even when the file is a directory.
2763 (remove_cwd_entries): Don't attempt chdir if the file is known
2764 to not be a directory.
2765 (remove_dir): Use the same method that remove_cwd_entries uses
2766 (for some reason they differed). Don't assert that saved_errno
2767 must be EPERM; it might be just about anything.
2769 2004-05-06 Jim Meyering <jim@meyering.net>
2771 * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
2772 Don't add `1' to the buffer size (it was to protect against malloc
2773 implementations that fail to allocate a buffer of size zero).
2774 That is no longer necessary, since we use a malloc wrapper
2777 * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
2778 * src/head.c (elide_tail_bytes_pipe): Likewise.
2779 * src/df.c (main): Likewise.
2780 * src/shred.c (do_wipefd): Likewise.
2781 * src/users.c (list_entries_users): Likewise.
2782 * src/tail.c (main): Likewise.
2783 * src/md5sum.c (main): Likewise.
2785 2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
2787 * src/df.c (show_disk, show_point): If several filesystems are
2788 mounted on the same mount point, prefer the last one, not the first.
2789 Problem reported by Christian Jones in
2790 <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
2791 (show_disk): Remove unused statp arg. Return bool, not int.
2792 (show_point): Rewrite to avoid gotos. Use the same algorithm
2793 for lofs and dummies for each pass through the mount table,
2794 rather than subtly different algorithms (which are probably
2797 2004-05-03 Jim Meyering <jim@meyering.net>
2799 * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
2802 2004-05-01 Jim Meyering <jim@meyering.net>
2804 When chown or chgrp is modifying the referent of a symlink,
2805 use the chown(2) function, if possible.
2806 * src/chown-core.c (change_file_owner): Don't hard-code the
2807 open/fchown/close kludge here. Use `chown' instead.
2808 The chown function works just fine on conforming systems.
2809 Other systems now go through the new chown wrapper that
2810 resorts to the old kludge.
2812 * src/chown-core.c (change_file_owner): Add a comment.
2814 2004-04-27 Jim Meyering <jim@meyering.net>
2816 * src/ptx.c: Make over 40 global extern variables `static'.
2817 (syntax_table, re_syntax_table): Remove declarations of two unused
2818 variables (they were exposed by the above change).
2820 * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
2821 * src/ln.c (backup_type): Likewise.
2823 * src/remove.c (rm): Add `extern' keyword.
2824 * src/cp-hash.c (forget_created, remember_created)
2825 (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
2826 * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
2827 * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
2828 (uid_to_name, chown_files): Likewise.
2830 * src/Makefile.am (sc_tight_scope): New rule.
2831 * Makefile.maint (sc_tight_scope): New rule.
2832 (syntax-check-rules): Add it.
2834 2004-04-26 Jim Meyering <jim@meyering.net>
2836 * Use automake-1.8.4. Regenerate dependent files.
2838 * src/sort.c (limfield): Make a comment clearer.
2840 2004-04-25 Paul Eggert <eggert@twinsun.com>
2842 Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
2843 leading blanks when computing the location of the field end;
2844 it is not supposed to skip trailing blanks. Solaris 8 "sort"
2845 does conform to POSIX. Also fix the documentation to clarify
2846 this and related issues.
2848 * doc/coreutils.texi (sort invocation): Mention -k earlier, so
2849 that the options are in alphabetical order. Describe how -b works
2850 more-accurately; this involves fixing some examples, too. Mention
2851 what happens if the start field falls after an end field or after
2852 a line end. Warn about using -k without -b, -g, -M, -n, or -t.
2853 Add an example of how to sort IPv4 addresses and Apache Common
2854 Log Format dates. Remove a duplicate example.
2855 (Putting the tools together): Use separate options rather
2856 than agglomerating them.
2857 * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
2858 decode whether to skip leading blanks.
2859 (trailing_blanks): Remove.
2860 (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
2862 * tests/pr/Test.pm: Fix typo in env_default comment.
2863 * tests/sort/Test.pm: Likewise.
2864 (18c, 18d): Reverse the order of output lines, so that the
2865 test cases conform to POSIX.
2867 2004-04-22 Paul Eggert <eggert@twinsun.com>
2869 More signal-handling cleanup for ls.c. Do not allow signals to
2870 happen between arbitrary output bytes, as the
2871 restore-default-color sequence can bollix up multibyte chars or
2872 color-change sequences in the ordinary output. Instead, process
2873 signals only between printing a file name and changing the color
2874 back to non_filename_text color. That way, if the signal handler
2875 changes the color (to the default), 'ls' will change it back when
2876 'ls' continues (after being suspended).
2878 Also, do not bother with signal-handling unless stdout is a
2879 controlling terminal; this lets stdio buffer better when "ls
2880 --color" is piped or sent to a file.
2882 * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
2883 Do not include "full-write.h"; no longer needed.
2884 (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
2885 (put_indicator_direct): Remove. All callers changed to use
2887 (caught_signals, interrupt_signal, stop_signal_count): New vars.
2888 (restore_default_color): Don't bother checking for put_indicator
2890 (sighandler): Don't handle SIGTSTP; that's another handler now.
2891 Simply set interrupt_signal to the signal, then exit.
2892 (stophandler, process_signals): New functions.
2893 (main): Don't output any color changes until _after_ the signal
2894 handlers are set up. This fixes a race condition where 'ls'
2895 could be interrupted while initializing colors, and leaving the
2896 terminal in an undesirable state.
2897 Don't mess with signal-handling if standard output is not a
2898 controlling terminal.
2899 When exiting, restore the default color, then restore the
2900 default signal handling, then act on any signals that weren't
2902 Do not print //DIRED// etc. in colors; this avoids the need
2903 to catch signals when printing them.
2904 (print_name_with_quoting): Process signals just before switching
2905 color back to non_filename_text.
2907 2004-04-23 Jim Meyering <jim@meyering.net>
2909 Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
2910 * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
2911 of quotearg_buffer. Patch by Mikulas Patocka.
2913 2004-04-18 Paul Eggert <eggert@twinsun.com>
2915 tee ignored SIGPIPE, but POSIX doesn't allow this.
2917 * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
2918 does not allow this. This undoes the 1996-10-24 patch.
2920 2004-04-18 Paul Eggert <eggert@twinsun.com>
2922 Signal-handling cleanup for coreutils. Here are the highlights:
2924 - csplit sometimes failed to remove files when interrupted.
2925 - csplit didn't clean up if two signals arrived nearly simultaneously.
2926 - install -s would infloop on System V if SIGCHLD was ignored.
2927 - ls could incorrectly restore color if multiple signals
2928 arrived nearly simultaneously.
2930 * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
2932 (filename_space, prefix, suffix, digits, files_created, remove_files):
2934 (caught_signals): New var.
2935 (cleanup): Block signals while deleting all files.
2936 (cleanup_fatal, handle_line_error, regexp_error):
2937 Mark with ATTRIBUTE_NORETURN.
2938 (create_output_file, close_output_file, interrupt_handler):
2939 Block signals while changing the number of output files,
2940 to fix some race conditions.
2941 (delete_all_files): Do nothing if remove_files is zero.
2942 Clear files_created.
2943 (main): Don't mess with signals until after argument processing
2946 * src/csplit.c (main): Rewrite signal-catching code to make it
2947 similar to other coreutils programs. When processing signals,
2948 block all signals that we catch, but do not block signals that we
2949 don't catch. Avoid problems with unsigned int warnings.
2950 * src/ls.c (main): Likewise.
2951 * src/sort.c (main): Likewise.
2953 * src/csplit.c (interrupt_handler):
2954 Use void, not (obsolete) RETSIGTYPE.
2955 * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
2957 * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
2958 Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
2959 * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
2960 * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
2961 * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
2963 * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
2965 * src/install.c: Include <signal.h>.
2966 (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
2967 given, since System V fork+wait does not work if SIGCHLD is ignored.
2969 * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
2970 handler to self, not to SIG_IGN, since SIGTSTP can be received
2972 (main): Use SA_RESTART, as that is simpler than checking for EINTR
2973 failures all over the place.
2975 2004-04-20 Jim Meyering <jim@meyering.net>
2977 * src/remove.c (is_empty_dir): Clarify comment.
2979 * man/help2man: Accept new option: --program-name=NAME, so that we
2980 can override the one in --version output. This is needed solely
2981 so that test.1 doesn't refer to `[' as the program name.
2982 Reported by Benjamin Cutler as http://bugs.debian.org/205251.
2983 * man/Makefile.am (.x.1): Use help2man's new --program-name option.
2985 * src/pwd.c: Don't include pathmax.h; system.h already does it.
2987 * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
2989 2004-04-19 Jim Meyering <jim@meyering.net>
2991 * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
2992 Initialize a buffer to avoid warnings from tools like valgrind.
2994 * Makefile.maint (sc_trailing_blank): New rule.
2995 (syntax-check-rules): Add it.
2996 * .x-sc_trailing_blank: New file.
2998 Make pwd work even if the resulting name is so long that getcwd fails.
2999 * src/pwd.c: (path_free, path_init, path_prepend): New functions.
3000 (nth_parent, find_dir_entry, robust_getcwd): New functions.
3001 (main): First try getcwd, then, upon failure, robust_getcwd.
3003 2004-04-18 Jim Meyering <jim@meyering.net>
3005 * src/who.c (print_user): Use xrealloc here, rather than
3006 unchecked realloc. Remove anachronistic casts.
3008 * src/remove.c (full_filename_): Don't leak upon failed realloc.
3010 * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
3012 * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
3013 renaming it. Update uses.
3015 2004-04-17 Jim Meyering <jim@meyering.net>
3017 * configure.ac: Depend on automake-1.8.3.
3019 * src/join.c (add_file_name): Declare function to be `static'.
3020 (string_to_join_field): Likewise.
3021 * src/remove.c (ds_init, ds_free): Likewise.
3023 * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
3024 (syntax-check-rules): Add to the list.
3026 2004-04-13 Paul Eggert <eggert@twinsun.com>
3028 Use page-aligned buffers whenever we bother to do I/O using buffer
3029 sizes that are tailored for the files.
3031 * src/cat.c: Include getpagesize.h.
3032 * src/copy.c: Likewise.
3033 * src/shred.c: Likewise.
3034 * src/split.c: Likewise.
3035 * src/cat.c (main): Align I/O buffers to page boundaries.
3036 * src/copy.c (copy_reg): Likewise.
3037 * src/shred.c (dopass): Likewise.
3038 * src/split.c (main): Likewise.
3039 * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
3040 All uses replaced by ptr_align.
3041 * src/od.c (gcd, lcm): Remove; now in system.h.
3042 * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
3044 2004-04-14 Jim Meyering <jim@meyering.net>
3046 Remove m4/Makefile.am: it's no longer needed, with newer automake
3047 * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
3048 * Makefile.am (SUBDIRS): Remove `m4' from the list.
3050 2004-04-13 Jim Meyering <jim@meyering.net>
3052 * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
3054 2004-03-27 Paul Eggert <eggert@twinsun.com>
3056 * NEWS: cp -pu and mv -u (when copying) now take the destination
3057 file system time stamp resolution into account.
3058 * doc/coreutils.texi (mv invocation): Document this.
3059 (cp invocation): Document -u (it was missing!) with new behavior.
3061 * src/copy.c: Include "utimecmp.h".
3062 (copy_internal): Compare time stamps using utimecmp rather than
3065 2004-04-09 Jim Meyering <jim@meyering.net>
3067 * Makefile.maint (.re-list): New rule/file, to replace
3068 hard-coded list of header file names.
3069 (sc_system_h_headers): Use the new file.
3070 Don't look for sys2.h anymore.
3072 * src/system.h: Include new "stat-macros.h" rather than hard-coding
3073 all of its macro definitions -- the list was slightly out of date.
3074 Suggestion from Dmitry V. Levin.
3076 2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
3078 * NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
3079 * doc/coreutils.texi (dd invocation): Likewise.
3080 * src/shred.c (O_NOCTTY): Remove redundant decl.
3081 * src/dd.c (flags, usage): Remove noctty flag.
3082 (main): Always use O_NOCTTY when opening files.
3084 2004-04-08 Jim Meyering <jim@meyering.net>
3086 * src/dd.c (dd_copy): Mark two diagnostics for translations.
3087 (set_fd_flags): Undo part of today's change: it's a little
3088 cleaner -- and more efficient in the common case -- to go
3089 ahead and OR in the -1 when fcntl fails.
3091 * Makefile.maint (sc_dd_max_sym_length): New target.
3092 (syntax-check-rules): Add it.
3094 * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
3095 Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
3097 * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
3098 Rename parameter, flags, to avoid shadowing global.
3099 (LONGEST_SYMBOL): Tweak comment.
3101 2004-04-07 Paul Eggert <eggert@twinsun.com>
3103 * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
3104 and new dd options iflag= and oflag=.
3105 * src/dd.c (usage): Likewise.
3106 * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
3107 * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
3108 (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
3109 (input_flags, output_flags): New vars.
3110 (LONGEST_SYMBOL): New macro.
3111 (struct symbol_value): Renamed from struct conversion. Members
3112 symbol and value renamed from convname and conversion. The
3113 symbol value is now an array instead of a pointer; this saves
3114 a bit of space and time in practice. All uses changed.
3115 (conversions): Add nocreat, excl, fdatasync, fsync. Now const.
3116 (flags): New constant array.
3117 (iflag_error_msgid, oflag_error_msgid): New constants.
3118 (parse_symbols): Renamed from parse_conversion and generalized
3119 to handle either conversion or flag symbols.
3120 (scanargs): Adjust uses of parse_symbols accodingly. Add
3121 support for iflag= and oflag=. Reject attempts to use
3122 both excl and nocreat.
3123 (set_fd_flags): New function.
3124 (dd_copy): Just return X rather than calling quit (X), since our
3125 caller invokes quit with the returned value. Add support for
3126 fdatasync and fsync.
3127 (main): Add support for iflag=, oflag=, and new conv= symbols.
3128 * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
3129 O_RSYNC, O_SYNC): Define to 0 if not already defined.
3131 * NEWS: Remove duplicate mention of BLOCKSIZE.
3133 2004-04-02 Andreas Schwab <schwab@suse.de>
3135 * src/stty.c: Add support for IUTF8 input flag.
3137 2004-04-06 Jim Meyering <jim@meyering.net>
3139 * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
3140 Interix spells it `mkdev'. Reported by Mark Funkenhauser.
3142 2004-04-04 Jim Meyering <jim@meyering.net>
3144 A specified format is no longer automatically newline terminated.
3145 If you want a newline at the end of your format, use `\n'.
3146 * src/stat.c (print_it): Don't print a newline at the end of
3148 (do_statfs): Add a newline at end of each default format string.
3150 2004-03-30 Paul Eggert <eggert@twinsun.com>
3152 * src/nohup.c (main): Adjust to new calling convention
3153 for set_cloexec_flag.
3155 2004-03-31 Jim Meyering <jim@meyering.net>
3157 * tests/Fetish.pm (run_tests): Remove `.orig' file.
3158 Remove debugging diagnostic.
3160 Specifying an invalid --width=N (-w) or --gap-size=N (-g)
3161 would not elicit an error.
3162 * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
3163 (main): Don't use atoi. Use xstrtoul instead.
3165 2004-03-30 Jim Meyering <jim@meyering.net>
3167 * Makefile.maint (sc_prohibit_atoi_atof): New rule.
3168 (syntax-check-rules): Add it.
3169 * .x-sc_prohibit_atoi_atof: New file.
3171 2004-03-29 Jim Meyering <jim@meyering.net>
3173 * tests/du/files0-from: Use new OUT_SUBST directive, so that this
3174 test is not sensitive to system-dependent block size differences.
3175 Prompted by a report of Solaris 8 differences from Paul Eggert.
3177 * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
3178 Rename `%tmp' to `%actual'. Reverse order of last two args to
3179 _compare_files (to $actual, $expected) so as to match declaration.
3181 2004-03-28 Paul Eggert <eggert@twinsun.com>
3183 Fix some gotchas encountered when porting to Solaris 8, using
3184 the Forte 6u2 compiler.
3186 * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
3187 Declare sethostname, since no Solaris header does it.
3188 * src/who.c: Include "vasprintf.h", for asprintf.
3190 2004-03-28 Jim Meyering <jim@meyering.net>
3193 * src/du.c (process_file): Don't record dev/inode for directories.
3195 Under some circumstances, without -c, du would mistakenly count the
3196 space of hard-linked files, not just the first one it encountered.
3197 Reported by Anthony Thyssen.
3198 * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
3200 * src/du.c: Rename global `print_totals' to `print_grand_total'.
3202 * src/du.c (main): Rearrange filtering loop to be a tiny bit
3205 * src/chown-core.c: Don't include savedir.h -- no longer needed.
3206 * src/chmod.c: Likewise.
3208 2004-03-25 Jim Meyering <jim@meyering.net>
3210 * src/du.c (main): Remove now-unused declaration of `i'.
3212 2004-03-24 Paul Eggert <eggert@twinsun.com>
3214 * src/du.c (main): Filter out file names of length zero before
3215 invoking fts, so that they don't cause fatal errors.
3217 2004-03-25 Jim Meyering <jim@meyering.net>
3219 * tests/du/files0-from (zero-len): Add a test for the above.
3221 2004-02-25 Paul Eggert <eggert@twinsun.com>
3223 * NEWS: New environment var BLOCKSIZE.
3224 * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
3225 * tests/envvar-check: Test for it. Factor the code to simplify it.
3227 2004-03-23 Paul Eggert <eggert@twinsun.com>
3229 * NEWS: Shorten the du --files0-from announcement, and say
3230 "NUL-terminated" rather than "NUL-separated".
3231 * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
3233 (usage): Say "NUL-terminated", not "NUL-separated".
3234 (main): Check for I/O error when istream is closed.
3235 Allow --files0-from=F even if F is empty; this specifies no files.
3236 (du_files): Now that we allow the list of files to be empty,
3238 * tests/du/files0-from: Adjust to above changes to src/du.c.
3240 2004-03-24 Jim Meyering <jim@meyering.net>
3242 * tests/tail-2/assert: Avoid race condition that could cause
3243 spurious failure. Based on a patch from Andreas Schwab.
3245 2004-03-23 Jim Meyering <jim@meyering.net>
3247 * src/du.c (main): Free the hash table, too.
3249 2004-03-22 Jim Meyering <jim@meyering.net>
3251 * man/Makefile.am (.x.1): Remove --info-page= option, reverting
3252 the change of 2004-01-22. I can no longer reproduce the problem
3253 that prompted that change, and `info coreutils pr' would display the
3254 `printing text' section of the manual, not the one on `pr invocation'.
3256 * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
3257 to match corrected output.
3259 * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
3260 (main): Use readtoken0 functions rather than readtokens.
3261 Don't use errno when diagnosing readtokens0 failure.
3262 Fix off-by-one error in the token number reported in a diagnostic.
3263 (du_files): Return bool, rather than int.
3264 (main): Call readtokens0_free.
3266 2004-03-21 Jim Meyering <jim@meyering.net>
3268 * src/remove.c (ds_free): Plug a small leak.
3270 * tests/Fetish.pm: Fix typo in comment.
3272 2004-03-07 Jim Meyering <jim@meyering.net>
3274 * NEWS: du accepts a new option --files0-from=FILE, where FILE
3275 contains a list of NUL-separated file names.
3277 * src/du.c: Include "readtokens.h".
3278 (usage): Describe the new option, and adjust the `Usage':
3279 with this option, no FILE may be specified on the command line.
3280 (main): Handle the new option.
3282 * tests/du/files0-from: New tests, for the above.
3283 * tests/du/Makefile.am (TESTS): Add files0-from.
3285 * src/factor.c (do_stdin): Reflect changes in use of readtoken.
3286 * src/tsort.c (tsort): Likewise.
3288 2004-02-29 Paul Eggert <eggert@twinsun.com>
3290 * NEWS: Add support for a new notation @N to get_date to represent
3291 the time stamp with numeric value N. Improve support for
3292 fractional time stamps. date's -d and -f options now accept them.
3293 Likewise for touch -t. date has a new option --iso-8601=ns.
3295 * doc/coreutils.texi (touch invocation):
3296 Describe use of fractional seconds.
3297 (date invocation, Options for date): Likewise.
3298 * doc/getdate.texi (General date syntax, Time of day items): Likewise.
3299 * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
3300 (Options for date): Describe new --iso-8601=ns option.
3302 * doc/getdate.texi: Add copyright notice. Change getdate to
3303 get_date when talking about the function name.
3304 (Seconds since the Epoch): New section, containing the time_t
3305 info moved from Date input formats section, along with new
3306 info about the @ syntax. Mention negative time stamps,
3307 fractional time stamps, and leap seconds.
3308 (General date syntax): Modernize examples a bit to reflect new
3310 (General date syntax, Relative items in date strings):
3311 Use ' rather than " to quote formats.
3312 (Time of day items): Add an example with fractional seconds.
3313 Describe fractional-second syntax.
3315 * src/Makefile.am (touch_LDADD): New macro, since `touch' now
3316 needs clock_gettime.
3318 * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
3319 (time_spec_string, time_spec, show_date): Support it.
3320 (usage): Remove description of -ITIMESPEC, as it's obsolete and
3321 confusing. Mention --iso-8601=ns.
3322 (batch_convert): getline returns ssize_t, not int.
3324 * src/touch.c (newtime): Now an array of two timespecs, one
3325 for access and one for modification.
3326 (ref_stats): Remove.
3327 (get_reldate): Use get_date's parameter profile.
3328 (touch, main): Adjust to above changes.
3329 (main): Work even if tm_year == INT_MAX (so long as long int is wider).
3330 Use gettime instead of gettimeofday, for new get_date signature.
3332 * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
3335 2004-03-15 Jim Meyering <jim@meyering.net>
3337 * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
3338 target before updating $(prev_version_file).
3340 * tests/misc/date-sec: New file, to test for just-fixed bug in date.
3341 See today's change in lib/getdate.y.
3342 * tests/misc/Makefile.am (TESTS): Add date-sec.
3344 2004-03-14 Jim Meyering <jim@meyering.net>
3346 * announce-gen (print_changelog_deltas): Use `.sig' suffix for
3347 signature files, not `.asc'. Reported by angico@yahoo.com.
3349 2004-03-13 Jim Meyering <jim@meyering.net>
3351 * src/cp.c (do_copy): Tweak wording in a diagnostic.
3352 Suggestion from Karl Berry.
3353 Include "quoatearg.h".
3354 (do_copy): Use quotearg_colon (not quote) for diagnostics
3355 that begin with `"%s:'.
3357 * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
3358 Suggestion from Dan Jacobson.
3360 2004-03-12 Jim Meyering <jim@meyering.net>
3364 Sometimes, when source and destination partition are different,
3365 mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
3367 * src/copy.c: When moving a set of N hard-linked files between
3368 partitions, via two or more command line arguments where the
3369 command line argument containing the Nth link contains no other
3370 link to that same file, mv would mistakenly copy the file, rather
3371 than hard-linking it to the other(s). That happens because when the
3372 final link is processed, its link count has been reduced to 1 since
3373 the other links have been `copied' to the destination partition
3374 and the source links have been removed.
3375 (copy_internal): When in move mode, use the source dev/inode
3376 pair to look up destination name even when st_nlink == 1.
3377 * src/cp-hash.c (src_to_dest_lookup): New function.
3378 * src/cp-hash.h (src_to_dest_lookup): Add prototype.
3379 * tests/mv/part-hardlink: New file. Test for the above fix.
3380 * tests/mv/Makefile.am (TESTS): Add part-hardlink.
3382 * announce-gen: Sync with autoconf.
3384 * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
3385 This was triggered on a Linux-2.2.19 system using a file system
3386 NFS-mounted from some sort of Sun.
3388 2004-03-11 Jim Meyering <jim@meyering.net>
3390 * Use automake-1.8.3. Regenerate dependent files.
3392 2004-03-10 Jim Meyering <jim@meyering.net>
3394 * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
3395 so that this test works with SELinux-enabled systems.
3396 Based on a patch from Tim Waugh.
3398 `join -1 x' would give a misleading diagnostic
3399 * src/join.c (string_to_join_field): Report that a non-numeric field
3400 number is invalid, rather than `so large that it is not representable'.
3401 * tests/join/Test.pm (invalid-j): New partial test for the above fix.
3403 2004-03-06 Jim Meyering <jim@meyering.net>
3405 cp --sparse=always sparse-image-file.img /dev/hda1 could
3406 produce an invalid copy on the destination device.
3408 * src/copy.c (copy_reg): Even with --sparse=always, try to
3409 make `holes' only if the destination is a regular file.
3410 Reported by Szakacsits Szabolcs.
3412 2004-03-03 Paul Eggert <eggert@twinsun.com>
3414 * src/nohup.c (main): Don't invoke set_cloexec_flag with
3415 a file descriptor of -1.
3417 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
3419 * src/nohup.c: Include "cloexec.h".
3420 (main): Set the copy of stderr to close on exec.
3422 2004-03-01 Paul Eggert <eggert@twinsun.com>
3424 * configure.ac: Include <signal.h> when checking for strsignal,
3425 sys_siglist, and friends. Problem reported by Tony Leneis in
3426 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
3428 2004-02-25 Paul Eggert <eggert@twinsun.com>
3430 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
3431 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
3434 2004-02-23 Paul Eggert <eggert@twinsun.com>
3436 * NEWS: Document how chown's USER.GROUP argument is now parsed.
3438 2004-02-23 Jim Meyering <jim@meyering.net>
3440 * src/seq.c (usage): Remove stray space after \n in --help output.
3442 2004-02-22 Jim Meyering <jim@meyering.net>
3444 * src/du.c (usage): Separate -H and --si. Say that the meaning
3445 of -H will soon change to that of --dereference-args (-D).
3447 2004-02-21 Jim Meyering <jim@meyering.net>
3449 * src/comm.c (usage): Tell what comm does when there are no options.
3450 Reword in terms of FILE1 and FILE2 rather than `left file' and
3451 `right file'. Suggestion from Dan Jacobson.
3453 2004-02-15 Paul Eggert <eggert@twinsun.com>
3455 Fix some POSIX-conformance bugs in expr.
3457 * NEWS: document the following changes to src/expr.c.
3458 * doc/coreutils.texi (expr invocation): Likewise.
3459 Document what forms integers may take, and say "integer"
3460 consistently instead of "number". Warn about operands
3461 that "expr" can misinterpret, and how to work around the
3463 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
3464 Accept a bool argument specifying whether to evaluate the
3465 expression. This is to allow short-circuit evaluation. All
3467 (null): Report that a string is zero even if it has
3468 a form like "-0" or "00".
3469 (eval1, eval): Use short-circuit evaluation for | and &.
3470 (eval): Return 0 if both arguments are null or zero, instead
3471 of returning the first argument.
3472 * tests/expr/basic: Add some tests for the above.
3474 2004-02-17 Jim Meyering <jim@meyering.net>
3478 `make check' from a build inside a chroot environment would fail
3479 * tests/help-version: Specify an argument (`/') for df, in the
3480 unusual event that there is no valid entry in /etc/mtab.
3481 Likewise for id: add the -u option, so we don't get spurious
3482 failures when there are no user or group names.
3485 * src/sort.c (usage) [-u]: Add punctuation so that the description in
3486 the help2man-generated (line-joined) man page is more readable.
3487 Reported by Tim Waugh.
3488 [-T]: Add a semicolon, for the same reason.
3490 2004-02-15 Jim Meyering <jim@meyering.net>
3492 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
3494 2004-02-11 Jim Meyering <jim@meyering.net>
3496 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
3497 $(srcdir)/../Makefile.am.in, rather than $<.
3498 Suggestion from Michael Elizabeth Chastain.
3500 2004-02-10 Jim Meyering <jim@meyering.net>
3502 * config/install-sh: Make this script executable.
3503 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
3504 is executable. Otherwise, on systems that lack a suitable install
3505 binary, `make install' would fail, because of the way this script
3506 is invoked (without `$SHELL ' prefix).
3507 Reported by Bob Proulx.
3509 2004-02-08 Jim Meyering <jim@meyering.net>
3513 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
3514 that would cause an unwarranted test failure.
3515 * tests/rm/rm3: Likewise.
3517 2004-02-07 Jim Meyering <jim@meyering.net>
3519 Remove xstat function pointer member. The way it was used was not
3520 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
3521 inline `stat' and `lstat' functions, thus making the tests of
3522 `xstat == lstat' in copy.c always fail.
3523 * src/copy.h (struct cp_options) [xstat]: Remove member.
3525 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
3526 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
3527 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
3528 (valid_options): Remove now-obsolete FIXME comments.
3530 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
3531 `*(x->xstat) (...)'.
3532 (do_copy): Declare/use local xstat rather than x->xstat.
3533 (main): Remove code that set x.xstat.
3534 * src/mv.c (cp_option_init): Don't initialize xstat member.
3535 * src/install.c (cp_option_init): Likewise.
3537 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
3538 so that emit_upload_commands can use these variables, too.
3540 2004-02-06 Jim Meyering <jim@meyering.net>
3542 * tests/rm/deep-1: Remove `du' stack space test.
3543 Apparently, `ulimit -s N' isn't portable enough.
3544 This test will be restored (with a guard against losing ulimit)
3545 in its own file later.
3547 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
3548 since this test doesn't take long enough to merit them.
3549 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
3551 * Makefile.maint (signatures): Remove definition.
3552 Now, automake's gnupload handles this.
3553 (%.sig: %): Remove now-unused rule.
3554 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
3555 `$(distdir).tar.bz2 $(distdir).tar.gz'.
3556 (emit-upload-commands): Adjust to use gnupload.
3558 2004-02-05 Jim Meyering <jim@meyering.net>
3560 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
3561 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
3562 Now, those are all defined in timespec.h.
3565 * src/date.c: Don't include timespec.h, now that system.h does it.
3567 2004-02-02 Paul Eggert <eggert@twinsun.com>
3569 Don't dump core if localtime returns NULL (possible on
3570 hosts with 64-bit time_t and 32-bit int).
3571 * src/date.c: Include "inttostr.h".
3572 (batch_convert, main):
3573 If time conversion fails, exit with nonzero status.
3574 (show_date): Return int to report conversion failure.
3575 Print the time as an int if localtime fails.
3576 * src/uptime.c: Print "??" if the current clock can't
3577 be converted by localtime. This won't happen until the year
3578 2*31 + 1900, but we don't want to dump core even if the current
3579 clock has the wrong value.
3581 * src/stat.c: Include "inttostr.h".
3582 (human_time): Print the date/time as a number of seconds since the
3583 epoch if it can't be converted by localtime. This is better than
3584 just saying "invalid", and is consistent with what "ls" does.
3585 Don't dump core if the year has more than 48 digits; this isn't
3586 possible on any contemporary host, but we might as well do it right.
3588 2004-01-31 Paul Eggert <eggert@twinsun.com>
3590 * src/stat.c (human_time): Accept time rather than
3591 pointer-to-const-time parameter, for clarity. All callers changed.
3593 2004-02-02 Jim Meyering <jim@meyering.net>
3595 * src/stat.c (do_stat): Remove extra trailing newline from
3596 default formats. Reported by Nelson H. F. Beebe.
3598 Print actual fractional seconds in time stamps, not just `.00000000'.
3599 * src/stat.c (human_time): Add and use new parameter, t_ns.
3600 (print_stat): Update callers.
3601 * src/ls.c (TIMESPEC_NS): Remove definition.
3602 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
3603 also uses this macro.
3604 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
3605 fractional seconds for files on an XFS file system, but that stat's
3606 fractional seconds were always zero.
3608 2004-01-28 Paul Eggert <eggert@twinsun.com>
3610 * src/seq.c (print_numbers): Use 'double' for loop index, not
3611 'int', to avoid problems with integer overflow. On almost all
3612 machines 'double' works in every case where 'int' works, and
3613 it works on other cases besides.
3615 2004-01-27 Jim Meyering <jim@meyering.net>
3617 * src/seq.c (usage): Mention that if INCREMENT is omitted,
3618 it defaults to 1, even when FIRST is larger than LAST.
3619 Reword so as not to exclude the possibility that INCREMENT be zero.
3621 2004-01-25 Jim Meyering <jim@meyering.net>
3625 * Makefile.maint (signatures): Comment out definition.
3627 2004-01-23 Jim Meyering <jim@meyering.net>
3629 * Makefile.maint (header_regexp): Add exitfail.
3631 * man/Makefile.am (EXTRA_DIST): Add help2man.
3632 Reported by Nelson H. F. Beebe.
3634 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
3635 so it works on systems with Perl installed somewhere other than in
3638 * src/paste.c (paste_parallel): Declare local, chr, to be of type
3639 `int', not `char', since it must hold EOF. This bug would make
3640 paste infloop on some systems. Test failures reported by
3641 Nelson H. F. Beebe and Christian Krackowizer.
3643 2004-01-22 Jim Meyering <jim@meyering.net>
3645 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
3646 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
3648 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
3649 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
3650 Use --info-page='coreutils PROG' option.
3651 Now, readlink.1 refers the user to `info coreutils readlink'
3652 rather than to `info readlink'. Reported by Matt Swift.
3654 2004-01-21 Paul Eggert <eggert@twinsun.com>
3656 Exit status cleanup.
3658 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
3659 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
3660 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
3661 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
3662 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
3663 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
3664 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
3665 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
3666 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
3667 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
3668 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
3669 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
3670 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
3671 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
3672 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
3673 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
3674 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
3676 * src/cat.c (usage): Don't bother normalizing exit status
3677 since the arg is already the correct exit status now.
3678 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
3679 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
3680 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
3681 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
3682 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
3684 * src/chown.c (main): Removed unused local 'fail'.
3686 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
3689 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
3690 * src/env.c, src/nice.c, src/su.c: Likewise.
3691 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
3692 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
3693 * src/expr.c (main): Use initialize_exit_failure rather than
3694 setting exit_failure directly; this optimizes away redundant
3696 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
3698 * src/chroot.c (main): Exit with status 1 rather than 127
3699 if chroot itself fails, as per documentation.
3701 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
3702 rather than roll-your-own symbols or integers.
3703 * src/env.c (main): Likewise.
3704 * src/nohup.c (main): Likewise.
3705 * src/su.c (run_shell): Likewise.
3707 * src/cp.c (exit_status): Remove static var....
3708 (main): Making it local here instead. Use =, not |=, to set it.
3710 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
3712 * src/date.c (batch_convert, main): Likewise.
3713 * src/dd.c (dd_copy): Likewise.
3714 * src/pr.c (first_last_page, main, getoptarg): Likewise.
3715 * src/tr.c (main): Likewise.
3716 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
3717 POSIX doesn't require it.
3718 * src/dd.c (write_output, skip, dd_copy): Likewise.
3719 * src/df.c (main): Likewise.
3720 * src/id.c (main): Likewise.
3721 * src/install.c (main): Likewise.
3722 * src/ln.c (main): Likewise.
3723 * src/ls.c (main): Likewise.
3724 * src/mv.c (main): Likewise.
3725 * src/shred.c (main): Likewise.
3727 * src/env.c (main): Exit with status 1, not 2, on errors detected
3729 * src/hostname.c (main): Likewise.
3730 * src/nl.c (main): Likewise.
3731 * src/stty.c (main): Likewise.
3733 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
3734 consistency with the other programs' naming conventions.
3737 * src/factor.c (main): Do not report a usage error simply
3738 because stdin has bad numbers.
3740 * src/id.c (problems): Now a boolean int, not a counter,
3741 so that we don't have to worry about int overflow. All uses changed.
3742 * src/touch.c (err): Likewise.
3744 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
3746 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
3747 * src/mknod.c: Likewise.
3749 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
3750 on error; this is in case EXIT_FAILURE is unusual.
3751 * src/su.c (main): Likewise.
3753 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
3754 changed to EXIT_CANNOT_INVOKE.
3756 * src/printenv.c (PRINTENV_FAILURE): New constant.
3757 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
3758 command-line syntax problems.
3760 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
3761 (main): Avoid integer overflow when seeing whether errors occurred.
3763 * src/seq.c (print_numbers): Now returns void, not (zero) int.
3764 All callers changed.
3765 (main): Remove unused local variable 'errs'. Always exit successfully
3766 if we reach the end.
3768 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
3769 for consistency with other programs here. All uses changed.
3770 (main): Use 'error' to exit rather than invoking 'exit' here.
3772 * src/sort.c: Don't include <assert.h>.
3773 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
3774 (usage): Don't use 'assert'.
3775 (main): Remove redundant assignment to exit_failure.
3777 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
3779 (initialize_exit_failure): New inline function.
3780 Include exitfail.h here, since we refer to exit_failure.
3781 All callers changed to not include exitfail.h.
3783 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
3784 substitute them for the corresponding integer constants.
3786 * tests/help-version (expected_failure_status_date): Remove, as
3787 'date' is now normal.
3788 (expected_failure_status_nohup): New var.
3790 2004-01-21 Jim Meyering <jim@meyering.net>
3792 * tests/touch/relative: Remove `command' syntax.
3793 Thanks to Nelson H. F. Beebe and Paul Eggert.
3795 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
3796 so as to avoid problems with systems using TAI clocks.
3797 Although it's no longer necessary, set TZ=UTC0 also for the
3798 initial touch command. Reported by Paul Jarc here:
3799 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
3801 2004-01-20 Diego Biurrun <diego@biurrun.de>
3803 * src/dircolors.hin: Add .mov to the list of media files.
3805 2004-01-19 Paul Eggert <eggert@twinsun.com>
3807 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
3808 portable). Problem reported by Christian Krackowizer. Also, use
3809 +0000 rather than +0 to specify a time zone, as the documentation
3810 requires four digits.
3812 2004-01-19 Jim Meyering <jim@meyering.net>
3814 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
3815 * tests/mv/backup-is-src: Likewise.
3816 Problem reported by Peter Horst
3818 2004-01-17 Jim Meyering <jim@meyering.net>
3820 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
3824 2003-12-15 Paul Eggert <eggert@twinsun.com>
3826 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
3827 with -r specifying the origin for -d.
3828 * src/touch.c (flexible_date): Remove static var.
3829 (get_reldate): New function.
3830 (main): Use it, to implement this new behavior.
3832 2004-01-16 Jim Meyering <jim@meyering.net>
3834 * tests/touch/relative: New test for the above.
3835 * tests/touch/Makefile.am (TESTS): Add relative.
3837 2004-01-13 Jim Meyering <jim@meyering.net>
3839 * src/system.h: Include contents of sys2.h.
3840 * src/sys2.h: Remove file.
3841 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
3843 * Use automake-1.8.2. Regenerate dependent files.
3845 * Update to gettext-0.13.1.
3846 * configure.ac: Use gettext-0.13.1.
3847 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
3849 2004-01-12 Jim Meyering <jim@meyering.net>
3851 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
3853 * Makefile.maint (po-check): Ensure that cvsu works before using it.
3854 Reported by Alexandre Duret-Lutz.
3856 * src/tail.c (main): Warn about following stdin only when it's a tty.
3858 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
3860 2004-01-10 Jim Meyering <jim@meyering.net>
3862 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
3864 2004-01-09 Jim Meyering <jim@meyering.net>
3866 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
3868 2004-01-08 Jim Meyering <jim@meyering.net>
3870 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
3871 From Andreas Schwab.
3873 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
3874 remnant) from PATH component. That would cause tests in this directory
3875 not to run the just-built binaries, but rather whatever happened
3876 to be in one's PATH. Reported by Christian Krackowizer.
3878 2004-01-04 Jim Meyering <jim@meyering.net>
3880 * src/csplit.c (new_control_record): Use x2nrealloc
3881 rather than xrealloc.
3883 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
3885 (make_path_private): Likewise.
3887 2004-01-03 Jim Meyering <jim@meyering.net>
3889 * src/paste.c: Use `bool' (not int) as the type for a few
3891 (collapse_escapes): Rewrite to set globals rather than modifying
3893 Use size_t (not int) for all counters and related index variables.
3894 (paste_parallel): Remove needless complexity of
3895 using xrealloc in the loop; just allocate the buffers up front.
3896 Free the two temporary buffers.
3897 Move declarations of locals `down' into scope where used.
3898 (paste_serial): Remove `register' attributes.
3899 (main): Simplify delim-related code.
3900 Free `delims', now that it's malloc'd.
3902 2004-01-02 Jim Meyering <jim@meyering.net>
3904 * src/chroot.c: Include "quote.h".
3905 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
3906 (main): Exit with status of 127, not 1, for too-few-args,
3907 chroot failure, or chdir failure.
3908 Give a better diagnostic upon execvp failure.
3910 * src/du.c (usage): Mention that, with its current meaning,
3913 * src/tail.c (main): Warn about following stdin when it's a tty.
3914 Fail when following by name but no names are specified.
3916 2003-12-30 Jim Meyering <jim@meyering.net>
3918 * src/fold.c (main): Use memcpy, not strcpy.
3920 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
3923 2003-12-28 Jim Meyering <jim@meyering.net>
3925 * src/unexpand.c (n_tabs_allocated): New global.
3926 (add_tabstop): Use x2nrealloc rather than xrealloc.
3927 * src/expand.c: Likewise.
3929 * tests/misc/expand: New file.
3930 * tests/misc/Makefile.am (TESTS): Add expand.
3932 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
3933 (fillbuf): Use x2nrealloc rather than xrealloc.
3934 (sort): Use xnmalloc rather than xmalloc.
3937 2003-12-27 Jim Meyering <jim@meyering.net>
3939 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
3941 2003-12-29 Paul Eggert <eggert@twinsun.com>
3943 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
3944 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
3946 * doc/coreutils.texi (join invocation): Remove documentation
3947 accordingly. Document that -t makes all separators significant.
3949 * src/join.c: Include posixver.h.
3950 (obsolete_usage): New var.
3951 (longopts): Put obsolete options first.
3952 (OBSOLETE_LONG_OPTIONS): New constant.
3953 (get_option, add_file_name): New functions.
3954 (main): Use them to support new behavior.
3955 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
3956 Do not mark -j FIELD as obsolescent; it is longstanding
3957 UNIX tradition and is a valid extension to POSIX.
3959 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
3961 2003-12-28 Paul Eggert <eggert@twinsun.com>
3963 * src/join.c (add_field_list): Don't use alloca with unbounded
3964 size; just modify the argument, which is no longer const *.
3966 Various other minor cleanups, mostly to avoid the need for casts.
3968 (extract_field): Renamed from ADD_FIELD, as it's now a function.
3970 (struct field.beg): Now char *, not unsigned char const *. All
3971 uses changed. It shouldn't be const since xmemcoll writes on its
3973 (extract_field): Likewise, for 2nd arg.
3974 (keycmp): Remove now-unnecessary cast of xmemcoll args.
3976 (is_blank): New function, to avoid need to cast arg to unsigned char.
3977 (extract_field): Use it.
3979 (xfields): Rewrite pretty much from scratch.
3981 (hard_LC_COLLATE): Now bool, not int.
3982 (get_line, getseq, add_field_list): Now returns bool, not int.
3983 (decode_field_spec, add_field_list): Return true on success (not
3984 false), for consistency with the rest of the code. All uses changed.
3986 (tab): Now char, not unsigned char. This wasn't 100% necessary
3987 but is slightly cleaner.
3988 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
3990 (empty_filler): Now const *.
3992 (make_blank): Remove; wasn't needed. Remove all calls.
3993 (main): Don't set uni_blank.nfields; zero is fine.
3995 2003-12-27 Jim Meyering <jim@meyering.net>
3997 * src/join.c: Include "quote.h".
3998 (min, max): Remove definitions.
3999 Make a few function parameters and corresponding
4000 locals `const'. Use bool for boolean variables.
4001 Use size_t (not int) for all counters and related index variables.
4002 (prjoin): Remove now-useless assertion.
4003 (string_to_join_field): New function.
4004 (main): Accept join fields as large as SIZE_MAX.
4005 (keycmp): Rename `min' to MIN and max to MAX.
4007 2003-12-26 Jim Meyering <jim@meyering.net>
4009 fold -s didn't work on e.g., alpha-based systems.
4010 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
4011 x2nrealloc works properly on systems with differing sizes for int
4012 and size_t. Reported by Nelson Beebe.
4014 * src/fold.c: Use `bool' (not int) as the type for a few
4017 2003-12-23 Paul Eggert <eggert@twinsun.com>
4019 * src/ls.c (length_of_file_names_and_frills):
4020 Remove forward decl; not needed.
4021 (print_file_name_and_frills, length_of_file_name_and_frills):
4022 With -m, don't output spaces before inum or size.
4023 (print_with_commas): Don't output space just before newline.
4025 2003-12-24 Jim Meyering <jim@meyering.net>
4027 * tests/ls/Makefile.am (TESTS): Add m-option.
4028 * tests/ls/m-option: New file. Test for above fixes.
4030 2003-12-20 Jim Meyering <jim@meyering.net>
4034 * src/pr.c: Change type of global, buff_allocated, to size_t.
4036 * src/join.c [struct seq]: Change types of members count and alloc
4037 from `int' to `size_t'.
4039 * tests/Makefile.am (root-hint): Tweak wording.
4041 * src/du.c: Accept new option (-0, --null) that makes it so each
4042 output line is NUL-terminated rather than newline-terminated.
4044 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
4045 Reported by Volker Paul.
4046 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
4047 * tests/dd/unblock-sync: New test for the above.
4049 2003-12-19 Jim Meyering <jim@meyering.net>
4051 * tests/misc/nohup: Double quote back-ticked expression,
4052 in case it ends up having an unexpected value.
4054 * tests/ls/no-arg: Use ls's -1 option in both runs.
4056 * src/du.c (fts_debug): New global.
4057 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
4058 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
4059 (main) [DU_DEBUG]: Accept -d option.
4061 2003-12-18 Jim Meyering <jim@meyering.net>
4063 * src/ls.c (format_user): Increment dired_pos via two statements,
4064 `dired_pos += width; dired_pos++;' rather than one,
4065 `dired_pos += width + 1;' since the latter could conceivably overflow.
4066 (format_group): Likewise.
4069 * configure.ac: Require automake-1.8.
4071 2003-12-12 Jim Meyering <jim@meyering.net>
4073 * Use automake-1.8. Regenerate dependent files.
4075 2003-12-08 Jim Meyering <jim@meyering.net>
4077 * Makefile.maint (news-date-check): New rule.
4078 (alpha beta major): Depend on it.
4080 2003-12-03 Paul Eggert <eggert@twinsun.com>
4082 * NEWS: ls -l (and similar options) now adjust all columns to
4083 fit the data. Generalized from a suggestion by Leah Q for file sizes.
4084 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
4085 (format_user_width, format_group_width, unsigned_file_size,
4086 format_group): New functions.
4087 (block_size_width): Renamed from block_size_size.
4088 (inode_number_width, nlink_width, owner_width, group_width,
4089 author_width, major_device_number_width, minor_device_number_width,
4090 file_size_width): New vars.
4091 (clear_files): Initialize them.
4092 (gobble_file): Set them. Don't ceiling block_size_width to 7.
4093 (print_long_file): Use them.
4094 (gobble_file): Use a new local variable 'f' to make the code
4095 smaller and more consistent with other functions.
4096 (format_user): Output to stdout, not to a buffer, so that we
4097 don't have to worry about buffer overrun. Update dired_pos.
4098 (print_long_file): Don't put owner, group, author into buffer;
4099 just print them directly. Don't assume link counts and
4100 major and minor numbers fit into unsigned long int.
4101 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
4102 'ls' output is fixed-width.
4104 2003-12-02 Jim Meyering <jim@meyering.net>
4106 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
4108 2003-11-27 Jim Meyering <jim@meyering.net>
4110 * Use automake-1.7f. Regenerate dependent files.
4112 2003-11-24 Paul Eggert <eggert@twinsun.com>
4114 Parse floating-point operands and options in the C locale.
4115 POSIX requires this for printf, and we might as well be
4116 consistent elsewhere (tail, sleep, seq).
4118 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
4119 needed now that we assume C89. Include "c-strtod.h".
4120 (xstrtod): Call c_strtod, not strtod.
4121 * src/sleep.c: Include "c-strtod.h".
4122 (main): Update xstrtod call to include new argument, c_strtod.
4123 * src/seq.c (scan_double_arg): Likewise.
4124 * src/tail.c (parse_options): Likewise.
4126 2003-11-24 Jim Meyering <jim@meyering.net>
4128 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
4129 Reported by Mark Conty.
4131 2003-11-22 Jim Meyering <jim@meyering.net>
4133 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
4134 (sc_system_h_headers): Do this test only if sys2.h exists.
4136 2003-11-20 Jim Meyering <jim@meyering.net>
4138 * tests/help-version: Ensure that the bug-reporting address is
4139 included in the --help output for every program.
4140 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
4142 * src/ptx.c (usage): Output bug-reporting address.
4143 Reported by Dan Jacobson.
4145 2003-11-19 Jim Meyering <jim@meyering.net>
4147 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
4148 on the join fields. Suggestion from Bruce Robertson.
4150 2003-11-18 Jim Meyering <jim@meyering.net>
4152 `od -c -w9999999' could segfault
4153 * src/od.c (dump): Use xnmalloc/free, not alloca.
4155 2003-11-16 Jim Meyering <jim@meyering.net>
4157 * Use autoconf-2.59. Regenerate dependent files.
4159 * tests/du/hard-link: Minor tweak: use mkdir -p.
4161 Fix read-from-free'd-buffer error detected by valgrind.
4162 * src/csplit.c (remove_line): Don't return a pointer to data in
4163 a freed buffer. Instead, arrange to free the buffer on the
4166 * tests/misc/csplit: New test for above fix.
4168 2003-11-11 Jim Meyering <jim@meyering.net>
4170 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
4171 This avoids a warning from valgrind about memcpy with overlapping
4172 source and destination.
4174 * configure.ac: Require automake-1.7.8.
4176 2003-11-09 Jim Meyering <jim@meyering.net>
4178 * Use automake-1.7.9. Regenerate dependent files.
4180 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
4181 * src/chown.c: Likewise.
4183 * src/chown-core.c: Include "root-dev-ino.h".
4184 (chopt_init): Initialize new member.
4185 (change_file_owner): Support rm's new --preserve-root option.
4187 * src/remove.c: Include "root-dev-ino.h".
4188 (remove_cwd_entries): Remove now-obsolete FIXME comment.
4189 (remove_dir): Support rm's new --preserve-root option.
4191 * src/chown.c: Include "root-dev-ino.h".
4192 Add new options: --preserve-root and --no-preserve-root.
4194 * src/chmod.c: Include "root-dev-ino.h".
4195 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
4196 ROOT_DEV_INO_WARN macros.
4197 (get_root_dev_ino): Remove function definition, now that it's
4198 been moved to a separate file.
4199 (usage): Describe new options.
4201 * src/mv.c (rm_option_init): Initialized new member.
4203 * src/remove.h: Include "dev-ino.h".
4204 (struct rm_options): Add new member: root_dev_ino.
4205 * src/chown-core.h: Include "dev-ino.h".
4206 (struct Chown_option): Add new member: root_dev_ino.
4208 2003-11-06 Jim Meyering <jim@meyering.net>
4210 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
4211 hard-coding `sizeof FILE*'.
4213 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
4215 * src/wc.c (main): Free `fstatus' so there is no confusion about
4216 whether it's leaked or not.
4217 * src/who.c (who): Likewise for `utmp_buf'.
4219 2003-11-05 Paul Eggert <eggert@twinsun.com>
4221 Fix 'cut' problems with size_t overflow and unsigned int.
4222 More generally, resize integer variables to fit use more precisely.
4223 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
4224 (struct range_pair): Make members to be of type size_t, not unsigned.
4225 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
4226 (suppress_non_delimited, output_delimiter_specified,
4227 have_read_stdin, print_kth, set_fields): Now bool, nt int.
4228 (delim): Now unsigned char, not int.
4229 (mark_printable_field, is_printable_field, is_range_start_index,
4230 set_fields, set_fields, cut_bytes, cut_fields):
4231 Use size_t, not unsigned, for field and byte counts.
4232 (hash_int): Use uintptr_t, not unsigned, for pointers converted
4233 to integers. This squeezes more info out of them.
4234 (set_fields, cut_bytes, cut_fields, main):
4235 Use bool, not int, for booleans.
4236 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
4238 2003-11-05 Paul Eggert <eggert@twinsun.com>
4240 * man/Makefile.am (check-programs-vs-x):
4241 Work even if $(programs) contains '$'.
4242 Work even if 'missing=1' in environment.
4243 Don't report an error simply because $(programs) outputs nothing.
4245 2003-11-05 Jim Meyering <jim@meyering.net>
4247 * Use autoconf-2.58. Regenerate dependent files.
4249 * src/tr.c (spec_init): Fix typo in last change.
4251 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
4252 call to variadic version_etc function, so that it works even on systems
4253 for which sizeof char* != sizeof int.
4254 * src/true.c (main): Likewise.
4255 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
4256 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
4257 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
4258 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
4259 Similarly, cast NULL to `(char *)' in call to variadic function,
4260 parse_long_options, so that it works even on systems for which
4261 sizeof char* != sizeof int.
4262 A similar problem was reported by Harti Brandt in
4263 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
4265 * src/users.c (users): Free `utmp_buf' explicitly so that people
4266 don't mistake this for a real leak.
4267 Patch by Dennis Smit <ds@nerds-incorporated.org.
4269 2003-11-04 Paul Eggert <eggert@twinsun.com>
4271 * README: Document _POSIX2_VERSION.
4273 2003-11-04 Jim Meyering <jim@meyering.net>
4275 * src/tac.c (memrchr): Remove #if-0'd function.
4276 (tac_stdin_to_mem): Clean up #if-0'd code.
4278 * src/od.c (decode_format_string): Remove unnecessary casts.
4279 Use more maintainable `sizeof *var'.
4280 (main): Call decode_format_string rather than decode_one_format,
4281 now that `spec' may be NULL.
4283 * src/chmod.c (AUTHORS): Add my name.
4285 * src/split.c (next_file_name): Use `sizeof *var' rather than
4286 hard-coding `sizeof size_t'.
4288 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
4290 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
4291 to avoid potential overflow in pointer arithmetic.
4292 (set_fields): Use not `1', but rather `sizeof *printable_field' as
4293 second argument to xcalloc.
4294 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
4295 rather than xrealloc.
4296 * src/date.c (show_date): Likewise.
4297 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
4298 * src/pr.c (store_char): Likewise.
4299 * src/fold.c (fold_file): Likewise.
4301 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
4302 type changes (unsigned int -> size_t) in hash.c.
4303 * src/cp-hash.c (src_to_dest_hash): Likewise.
4304 * src/du.c (entry_hash): Likewise.
4305 * src/ls.c (dev_ino_hash): Likewise.
4306 * src/cut.c (hash_int): Likewise. Declare function as static.
4308 2003-11-03 Jim Meyering <jim@meyering.net>
4310 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
4311 * tests/misc/fold: Fail the test immediately if we're not running
4312 the expected version of fold.
4314 2003-11-02 Jim Meyering <jim@meyering.net>
4316 * src/tr.c (append_normal_char, append_range, append_char_class)
4317 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
4318 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
4319 and usually shorter.
4320 * src/copy.c (copy_internal): Likewise.
4321 * src/join.c (initseq, add_field, make_blank): Likewise.
4322 * src/od.c (main): Likewise.
4323 * src/cp.c (make_path_private): Likewise.
4324 * src/tsort.c (new_item, record_relation): Likewise.
4326 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
4327 (main): Also remove anachronistic cast of xmalloc return value.
4328 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
4329 (main): Also remove anachronistic cast of xmalloc return value.
4330 * src/sort.c (inittables): Likewise.
4331 (sort): Also Split a long line.
4333 2003-10-25 Jim Meyering <jim@meyering.net>
4335 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
4336 type changes (unsigned int -> size_t) in hash.c.
4337 * src/cp-hash.c (src_to_dest_hash): Likewise.
4338 * src/du.c (entry_hash): Likewise.
4339 * src/ls.c (dev_ino_hash): Likewise.
4340 * src/cut.c (hash_int): Likewise. Declare function as static.
4342 2003-10-21 Jim Meyering <jim@meyering.net>
4344 Don't fail when run with VERBOSE=yes.
4345 * tests/chgrp/basic: Do `set +x' before starting the subshell
4346 from which we invoke chgrp. Otherwise, the output from the
4347 VERBOSE=yes-induced `set -x' would result in spurious differences.
4348 Reported by Russel Coker via Michael Stone.
4350 2003-10-19 Jim Meyering <jim@meyering.net>
4352 chmod now uses fts to perform a directory traversal when -R is
4353 specified. Before, it operated on full path names, and as such
4354 would encounter the PATH_MAX (often 4096) limit.
4356 * src/chmod.c: Include "xfts.h".
4357 (process_file): Rename from change_file_mode.
4358 Adapt to be used with fts.
4359 (process_files): New function.
4361 2003-10-18 Jim Meyering <jim@meyering.net>
4363 * tests/du/deref-args: Ensure that du -D now dereferences all
4364 symlinks specified on the command line, not just those that
4365 reference directories.
4367 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
4368 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
4369 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
4370 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
4371 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
4372 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
4373 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
4374 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
4375 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
4376 Update the call to parse_long_options so that `AUTHORS, NULL' are the
4378 * src/true.c (main): Append NULL to version_etc argument list.
4379 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
4381 2003-10-17 Andreas Schwab <schwab@suse.de>
4383 * tests/mk-script: Get $srcdir from first parameter instead of
4385 (main): Update usage.
4387 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
4388 first argument of mk-script.
4389 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
4391 2003-10-17 Jim Meyering <jim@meyering.net>
4393 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
4394 generated `man' page is more readable. Suggestion from Dan Jacobson.
4396 * src/chown-core.c (change_file_owner): Handle the cases in
4397 which fts_info indicates an error with the given entry.
4399 * src/du.c (main): Simply assign to bit_flags.
4400 Don't bother with bit arithmetic.
4402 * tests/chmod/no-x: New file.
4403 * tests/chgrp/no-x: New file.
4404 * tests/chmod/Makefile.am (TESTS): Add no-x.
4405 * tests/chgrp/Makefile.am (TESTS): Likewise.
4407 * src/du.c: Include "xfts.h".
4408 (du_files): Use xfts_open, rather than fts_open.
4409 * src/chown-core.c (chown_files): Likewise.
4411 2003-10-16 Jim Meyering <jim@meyering.net>
4413 * src/chgrp.c (main): Simply assign to bit_flags.
4414 Don't bother with bit arithmetic.
4415 * src/chown.c (main): Likewise.
4416 Rename a couple of local variables.
4417 Remove unnecessary casts.
4419 * src/tail.c (start_bytes): Rename local, remainder, to avoid
4420 gcc's warning about shadowing a global.
4422 2003-10-15 Jim Meyering <jim@meyering.net>
4424 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
4425 use fts to perform a directory traversal when -R is specified.
4426 Before, they operated on full path names, and as such would
4427 encounter the PATH_MAX (often 4096) limit.
4428 They are more efficient. For example, before, chgrp -R would
4429 take almost 5 seconds to change about 2000 directories and fail
4430 (with `File name too long'), while now it succeeds on a hierarchy
4431 of depth 20,000 in 1/10 the time.
4433 * src/chown.c: Include "userspec.h" and "fts_.h".
4434 (WRITTEN_BY): Add my name.
4435 (getpwnam, getgrnam, getgrgid): Remove declarations.
4436 (endpwent): Remove definition.
4438 (main): Handle new options.
4439 Call new function, chown_files rather than change_file_owner.
4441 * src/chgrp.c: Include "fts_.h".
4442 (WRITTEN_BY): Add my name.
4443 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
4446 (main): Handle new options.
4447 Call new function, chown_files rather than change_file_owner.
4449 Rewrite to iterate through hierarchies using fts rather than
4450 via explicit recursion.
4451 * src/chown-core.c: Include "fts_.h"
4452 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
4453 on a single file at a time.
4454 (chown_files): New function.
4455 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
4456 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
4457 [struct Chown_option] (dereference): Remove member with ambiguous name.
4458 [struct Chown_option] (affect_symlink_referent): New member.
4459 (chown_files): New prototype.
4461 * tests/chgrp/recurse: Update tests accordingly.
4462 * tests/chgrp/posix-H: New tests for the above.
4463 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
4465 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
4466 work even for superuser. Suggestion from Dan Jacobson.
4468 2003-10-14 Paul Eggert <eggert@twinsun.com>
4470 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
4472 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
4473 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
4474 * src/sort.c (parse_field_count): Handle the case where overflow
4475 and invalid suffix char are both reported.
4477 2003-10-14 Jim Meyering <jim@meyering.net>
4479 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
4480 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
4483 2003-10-13 Paul Eggert <eggert@twinsun.com>
4485 Fix to avoid a denial-of-service attack if the display width is
4486 enormous. Also, clean up the code a bit by removing duplicate code.
4488 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
4489 (calculate_columns): New function, that contains code that used
4490 to be common to print_many_per_line and print_horizontal.
4491 (print_many_per_line, print_horizontal): Use it.
4492 (decode_switches): Set max_idx here, not in calculate_columns.
4493 (print_current_files): Don't call init_column_info; calculate_columns
4495 (init_column_info): Don't allocate a lot more space than is needed
4496 to represent the current set of files. Allocate all the new
4497 size_t cells in one call to xnmalloc, rather than a row at a time.
4499 2003-10-13 Jim Meyering <jim@meyering.net>
4501 * src/ls.c (init_column_info): Add another FIXME comment.
4503 2003-10-13 Paul Eggert <eggert@twinsun.com>
4505 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
4506 Remove several arbitrary limits on hosts where int cannot represent
4509 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
4510 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
4511 struct column_info.col_arr[0], max_idx):
4512 Now size_t, not int.
4513 (get_funky_string): Return bool indicating success, instead of
4514 a negative count to indicate failure. Store number of columns
4515 through new parameter OUTPUT_COUNT; that way, they can never
4516 go negative. Change equals_end from int to bool. All uses
4518 (struct column_info.valid_len): Now bool, not int. All uses changed.
4519 (dired_dump_obstack, get_funky_string, clear_files,
4520 extract_dirs_from_files, print_current_files,
4521 print_many_per_line, print_horizontal, init_column_info,
4522 put_indicator, length_of_file_name_and_frills,
4523 print_with_commas): Use size_t, not int, for local variables
4525 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
4526 Check for TIOCGWINSZ returing negative values (or values greater
4528 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
4530 Use xmalloc and xnmalloc, not XMALLOC.
4531 (gobble_file): Use xnrealloc, not XREALLOC.
4532 (print_color_indicator): Remove now-unnecessary cast to size_t.
4534 2003-10-12 Paul Eggert <eggert@twinsun.com>
4536 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
4537 * tests/sort/sort-tests: Remove from CVS; assume that people
4538 brave enough to check coreutils out from CVS can rebuild it.
4540 2003-10-12 Jim Meyering <jim@meyering.net>
4542 New options: --preserve-root and --no-preserve-root.
4543 * src/chmod.c (change_file_mode): Honor new option.
4544 (change_file_mode): Strip trailing slashes on directory
4545 argument passed to change_dir_mode.
4546 (get_root_dev_ino): New function.
4547 (main): Initialize global, root_dev_ino.
4549 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
4550 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
4552 * src/chmod.c (change_file_mode): Likewise.
4554 2003-10-08 Jim Meyering <jim@meyering.net>
4556 * src/csplit.c (main): Remove obsolete FIXME.
4558 2003-10-07 Jim Meyering <jim@meyering.net>
4560 * Use automake-1.7.8. Regenerate dependent files.
4562 2003-09-29 Paul Eggert <eggert@twinsun.com>
4566 * doc/coreutils.texi (csplit invocation):
4567 The regexp offset need not have a sign; POSIX requires support
4568 for signless offets.
4570 Be more careful about int widths. For example, remove some
4571 arbitrary limits by replacing 'unsigned' with 'size_t',
4572 'uintmax_t', etc. Use standard bool rather than a homegrown type.
4573 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
4574 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
4575 to <stdbool.h> usage.
4576 (struct control): offset is now intmax_t, not int.
4577 repeat_forever is now bool, not int.
4578 (struct cstring): len is now size_t, not unsigned int.
4579 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
4580 size_t, not unsigned. start_line, first_available are now
4581 uintmax_t, not unsigned.
4582 (hold_count, control_used): Now size_t, not unsigned.
4583 (last_line_number, current_line, bytes_written):
4584 Now uintmax_t, not unsigned.
4585 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
4586 create_new_buffer, get_new_buffer, load_buffer, find_line,
4587 process_regexp, split_file, new_control_record, extract_regexp,
4588 get_format_width, get_format_prec, max_out):
4589 size args, locals, and returned values are now size_t, not unsigned
4591 (get_first_line_in_buffer, find_line, write_to_file,
4592 handle_line_error, process_line_count, regexp_error, process_regexp,
4594 File line, byte, and repetition counts are now uintmax_t, not unsigned.
4595 (check_for_offset): Don't require a sign before the offset.
4596 Use xstrtoimax to do the real work.
4597 (extract_regexp): Remove harmful cast of size to unsigned.
4598 256 -> 1<<CHAR_BIT, for clarity.
4599 (get_format_flags): Return at most 3, to avoid worries about overflow.
4601 (bytes_to_octal_digits): Remove.
4603 (cleanup): Don't check whether output_stream is NULL, since
4604 close_output_file does that for us.
4606 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
4607 (sizeof *p);" instead of the more long-winded alternatives.
4609 (get_new_buffer): Use O(1) algorithm for resizing a buffer
4610 to a much larger size, instead of an O(N) algorithm.
4612 (process_regexp): Use plain NULL rather than casted 0.
4614 (make_filename): Use %u, not %d, to format unsigned file number.
4616 (new_control_record): Use xrealloc exclusively, since it handles
4619 (extract_regexp): Change misspelled word in diagnostic.
4621 (get_format_width): Even if a minimum field width is specified,
4622 allow room for enough octal digits to represent the value of
4623 the maximum representible integer. This fixes a potential
4624 buffer overrun. Calculate this room at compile-time, not
4625 at run-time; this removes the need for bytes_to_octal_digits.
4626 Check for overflow; this removes a FIXME.
4628 (get_format_prec): Don't allow precision to be signed; it's
4629 not ANSI. Check for overflow. Remove hardcoded "11" as
4630 default precision; this fixes a potential buffer overrun
4631 on hosts with wider size_t.
4633 (get_format_conv_type): Change local variable to be of type
4634 unsigned char, not int; this removes a potential subscript
4635 violation on hosts where char is signed.
4637 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
4638 Allow "%%" in format. Don't overflow when
4639 counting lots of percents.
4641 (usage): Default sprintf format is %02u, not %d.
4643 2003-10-05 Jim Meyering <jim@meyering.net>
4645 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
4647 * src/du.c (du_files): Mark diagnostic for translation.
4649 2003-10-04 Jim Meyering <jim@meyering.net>
4651 * src/du.c (du_files): Ignore any failure of fts_close.
4652 Give better diagnostics for failed fts_open.
4654 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
4656 Deprecate existing use of -H (aka --si).
4657 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
4658 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
4659 (main): Warn that the meaning of -H will soon change to be
4662 2003-10-03 Jim Meyering <jim@meyering.net>
4664 * src/du.c: Accept --no-dereference (-P).
4666 2003-10-02 Jim Meyering <jim@meyering.net>
4668 * tests/du/trailing-slash: Adjust for slightly different output.
4670 Rewrite du.c to use fts.
4671 * src/du.c: Include "fts_.h", not ftw.h.
4672 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
4673 (IS_FTW_DIR_TYPE): Remove definition.
4674 (IS_DIR_TYPE): Define.
4675 (is_symlink_to_dir): Remove now-unnecessary function.
4676 (process_file, du_files): Rewrite to use fts.
4678 * tests/du/inaccessible-cwd: Ensure that even when run from an
4679 inaccessible directory, du can still operate on accessible
4680 directories elsewhere.
4681 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
4683 * tests/rm/deep-1: Ensure that du can process a hierarchy
4684 of depth 400 while using no more than 50KB of stack space.
4686 2003-10-01 Akim Demaille <akim@epita.fr>
4688 * announce-gen (print_news_deltas): New function, extracted from main.
4689 (main): Make `news_file' an array.
4690 Use '...=s' => \@var for --news and --url-directory specs.
4691 Before there were a couple of portability problems.
4693 2003-09-28 Jim Meyering <jim@meyering.net>
4695 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
4696 (syntax-check-rules): Add it.
4698 * src/copy.c: Remove unnecessary cast of alloca, since now it's
4699 guaranteed to be (void *).
4700 * src/cp.c: Likewise.
4701 * src/join.c: Likewise.
4702 * src/ln.c: Likewise.
4703 * src/ls.c: Likewise.
4704 * src/od.c: Likewise.
4705 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
4707 2003-09-27 Jim Meyering <jim@meyering.net>
4709 Don't exhaust virtual memory when processing large inputs.
4710 Fix this by removing csplit's internal free-list management;
4711 instead rely on malloc for that.
4713 * src/csplit.c (free_list): Remove global.
4714 (clear_all_line_control): Remove function.
4715 (get_new_buffer): Always use create_new_buffer to obtain a
4716 new buffer, rather than searching free_list.
4717 (free_buffer): Just call free.
4718 Reported by Nikola Milutinovic.
4720 2003-09-26 Jim Meyering <jim@meyering.net>
4722 * man/rm.x: Also list `chattr' in SEE ALSO section.
4723 Suggestion from Mark Hubbart.
4725 2003-09-25 Jim Meyering <jim@meyering.net>
4727 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
4728 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
4730 * Use autoconf-2.57d. Regenerate dependent files.
4732 2003-09-24 Jim Meyering <jim@meyering.net>
4734 Minor efficiency tweak.
4735 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
4736 (do_link): Likewise.
4738 2003-09-23 Jim Meyering <jim@meyering.net>
4740 * src/paste.c (paste_serial): Save errno after input error,
4741 to report proper errno value.
4742 Based on a patch from Paul Eggert.
4744 * src/tee.c (tee): Adjust fwrite arguments so that the return
4745 value is the number of bytes written.
4747 2003-09-16 Paul Eggert <eggert@twinsun.com>
4749 Don't assume ferror sets errno. Bug reported by Bruno Haible.
4751 * src/comm.c (compare_files): Save errno after input error,
4752 to report proper errno value.
4753 * src/fold.c (fold_file): Likewise.
4754 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
4755 * src/unexpand.c (unexpand): Likewise.
4757 * src/csplit.c (close_output_file): Don't report bogus errno value
4758 after ferror discovers an output error. We don't know the proper
4759 errno value, since it might have been caused by any of a whole
4760 bunch of calls, and it might have been trashed in the meantime.
4761 Fixing this problem will require much more extensive changes;
4762 in the meantime just say "write error".
4763 * src/od.c (check_and_close, dump, dump_strings): Likewise.
4764 * src/uniq.c (check_file): Likewise.
4766 * src/join.c (get_line): Report error right away if I/O fails,
4767 so that the proper errno value is used.
4768 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
4769 * src/tee.c (tee): Likewise.
4770 * src/uniq.c (check_file): Likewise.
4772 * src/od.c (skip): If a read fails, don't retry it later, so
4773 that we report the proper errno.
4775 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
4777 * src/tee.c (tee): Once a write failure has occurred, don't bother
4778 writing anything more to that stream.
4780 * src/uniq.c (check_file): Check for ferror (stdout) even if
4783 * src/yes.c (UNROLL): Remove.
4784 (main): Exit immediately when write failure is detected.
4785 Simplify code by assigning to argv when argc == 1.
4787 2003-09-21 Paul Eggert <eggert@twinsun.com>
4789 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
4790 (WRITTEN_BY): Change "Franc,ois" (actually using
4791 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
4794 2003-09-19 Jim Meyering <jim@meyering.net>
4796 `du -D symlink-to-dir' would mistakenly omit the slash in
4797 lines like this: 24 symlink-to-dir/subdir
4798 * src/du.c (process_file): Fix offset calculation.
4799 Reported by Jeff Sheinberg as Debian bug #211591;
4800 http://bugs.debian.org/205251
4802 * tests/du/deref-args: New file/test for the above.
4803 * tests/du/Makefile.am (TESTS): Add deref-args.
4805 * src/du.c (process_file): Remove useless disjunct.
4807 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
4809 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
4810 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
4811 Mark each WRITTEN_BY string as translatable.
4813 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
4814 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
4815 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
4816 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
4817 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
4818 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
4819 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
4820 * who.c, whoami.c, yes.c: Revert yesterday's changes.
4821 Instead, a subsequent change will embed `Written by ' in
4822 each string along with the author names.
4824 * src/true.c: Revert yesterday's changes.
4825 * src/sys2.h: Likewise.
4827 2003-09-18 Jim Meyering <jim@meyering.net>
4829 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
4830 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
4831 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
4832 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
4833 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
4834 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
4835 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
4836 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
4837 comma-separated list of strings and/or update the call to
4838 parse_long_options so that `AUTHORS, NULL' are the last parameters.
4839 * src/true.c (main): Append NULL to version_etc argument list.
4840 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
4842 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
4843 shadowing the math function name. Also rename loga to log_a.
4845 2003-09-14 Jim Meyering <jim@meyering.net>
4847 * src/factor.c (print_factors): Give a separate diagnostic
4848 for numbers that are too large, but otherwise valid.
4849 Reported by Dániel Varga.
4851 2003-09-10 Jim Meyering <jim@meyering.net>
4853 * Use automake-1.7.7. Regenerate dependent files.
4855 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
4856 of `fmt -1'. Using the just-built tr is a little cleaner.
4857 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
4858 * man/Makefile.am (programs, check-x-vs-1): Likewise.
4860 2003-09-09 Jim Meyering <jim@meyering.net>
4862 * src/copy.c: Alphabetize includes.
4863 Remove duplicate inclusion of "same.h".
4865 2003-09-08 Jim Meyering <jim@meyering.net>
4867 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
4868 Didn't give enough of a benefit, mainly because it's not yet
4873 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
4874 (check-programs-vs-x): Fail if $(programs) is empty.
4876 * src/remove.c: Add a comment.
4878 2003-09-07 Jim Meyering <jim@meyering.net>
4880 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
4881 Don't define. These symbols are no longer used.
4883 * tests/misc/tty-eof: Write ^D as \cD.
4884 Complete the change of 2003-08-02.
4886 * Makefile.maint (po-check): Use cvsu, so that a temporary source
4887 file in lib/ or src/ doesn't induce an unwarranted failure.
4888 Add a kludge to filter out the sole generated source file that
4889 also has translatable messages: src/false.c.
4891 2003-09-06 Jim Meyering <jim@meyering.net>
4893 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
4894 (parse_options): Give a diagnostic for (but still accept) the
4895 deprecated --allow-missing option.
4897 2003-09-04 Paul Eggert <eggert@twinsun.com>
4899 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
4900 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
4902 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
4903 size_bound ourselves. if an input file is a pipe and the user
4904 specified a size, use that size instead of trying to guess the
4905 pipe size. This has the beneficial side effect of avoiding the
4906 overhead of default_sort_size in that case. All callers changed.
4907 (sort): Remove static var size; now done by sort_buffer_size.
4909 2003-09-05 Jim Meyering <jim@meyering.net>
4911 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
4913 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
4914 to start, rather than just .1. Upon failure, print unexpected state.
4916 2003-09-04 Paul Eggert <eggert@twinsun.com>
4918 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
4919 SAFE_READ_ERROR to tmp->nbytes.
4920 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
4922 * src/head.c (struct linebuffer): Change nbytes and nlines
4923 from unsigned int to size_t. unsigned int is safe (after the
4924 2003-09-03 patch) but size_t is cleaner.
4925 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
4926 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
4928 Standardize on BUFSIZ as opposed to other macro names and values.
4929 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
4930 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
4931 stdio.h has always defined it,
4932 and other code already assumes it's defined.
4933 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
4934 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
4935 (io_buf): IO_BUF_SIZE -> BUFSIZ.
4937 2003-09-04 Paul Eggert <eggert@twinsun.com>
4939 * src/seq.c (step): Default to 1.
4940 (print_numbers): Allow the output to be empty.
4941 (main): The default step is 1, even if LAST < FIRST;
4942 as per documentation.
4943 * tests/seq/basic (onearg-2): Output should be empty.
4945 2003-09-05 Jim Meyering <jim@meyering.net>
4947 * Makefile.cfg (wget_files): Temporarily disable, until master
4948 versions are restored to ftp.gnu.org.
4950 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
4952 Make seq's --width (-w) option work properly even when the
4953 endpoint requiring the larger width is negative and smaller than
4955 * src/seq.c (get_width_format): Include `-' in the set of bytes
4956 allowed in a `simple' number (no decimal point, no exponent).
4957 Reported by Patrick Mauritz.
4959 2003-09-02 Paul Eggert <eggert@twinsun.com>
4961 * NEWS: sort -t '\0' now uses a NUL tab.
4962 sort option order no longer matters, unless POSIX requires it.
4963 * src/sort.c (usage): Say "blanks" instead of "whitespace",
4964 Similar fixes for many comments.
4965 (TAB_DEFAULT): New constant, so that we can support NUL as
4966 the field separator.
4967 (tab): Now int, not char. Initialize to TAB_DEFAULT.
4968 (specify_sort_size): If multiple sizes are specified, use the largest.
4969 (begfield, limfield): Support NUL tab char.
4970 (set_ordering): Do not let -i override -d.
4971 (main): Report an error if incompatible -o or -t options are given.
4972 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
4974 2003-09-05 Jim Meyering <jim@meyering.net>
4976 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
4978 2003-09-03 Andreas Schwab <schwab@suse.de>
4980 Bug report and patch here:
4981 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
4982 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
4983 * src/head.c (elide_tail_lines_pipe): Likewise.
4985 2003-09-03 Jim Meyering <jim@meyering.net>
4987 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
4988 small amount of code from him was first moved to lib/human.c, and was
4989 subsequently rewritten entirely.
4990 * src/df.c (AUTHORS): Likewise.
4992 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
4994 * src/md5sum.c (split_3): Accept the BSD format for generic
4995 message digest modes. Currently works with BSD's MD5 and SHA1
4996 formats since these are the two algorithms presently used in
4997 coreutils. Updated comments to reflect this change.
4998 (bsd_split_3): Updated comments.
5000 * tests/md5sum/basic-1: New test to make sure that
5001 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
5002 from `check-bsd' test in tests/sha1sum/basic-1).
5004 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
5005 --check exit status and BSD SHA1 format (adapted from tests
5006 in tests/md5sum/basic-1).
5008 2003-08-30 Jim Meyering <jim@meyering.net>
5010 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
5012 When source and destination arguments refer to the same file, reside
5013 on a partition (e.g. VFAT) on which distinct names may refer to the
5014 same directory entry (often due to variations in case), and when the
5015 link count for the file is 1, mv no longer unlinks the file. Instead,
5016 it gives the expected diagnostic that the source and destination are
5017 the same. WARNING: this is an incomplete fix. If the file happens
5018 to have a link count of 2 or greater, such an erroneous mv command
5019 will still unlink it.
5020 Although that is not possible on vfat or umsdos, it is possible on
5021 other file system types, e.g., ntfs, and hpfs.
5022 * src/copy.c (same_file_ok): Invoke same_name (which might still
5023 return false for names that refer to the same directory entry)
5024 only if the link count is 2 or more.
5025 * tests/mv/vfat: Show how to demonstrate the above problem.
5026 This test is not run.
5027 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
5029 2003-08-27 Jim Meyering <jim@meyering.net>
5031 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
5032 who's -l option has been eliciting an unconditional warning about
5033 this impending change since sh-utils-2.0.12 (April 2002).
5035 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
5036 This would happen for nonempty files not ending with a newline.
5037 Reported by Dan Jacobson.
5038 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
5039 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
5041 * src/stat.c (print_it): Avoid buffer overrun that would
5042 occur when the user-specified format string ends with `%'.
5043 Patch by Tommi Kyntola.
5044 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
5045 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
5047 2003-08-26 Jim Meyering <jim@meyering.net>
5049 Apply changes from bison.
5050 * GNUmakefile (SHELL): Define to `sh', if necessary.
5052 * Makefile.maint (WGETFLAGS): Define to `-C off'.
5053 Update all uses of $(WGET).
5055 2003-08-22 Akim Demaille <akim@epita.fr>
5057 * Makefile.cfg (local-checks-to-skip): New.
5058 * Makefile.maint (local-check): Rename as...
5059 (local-checks-available): this.
5062 2003-08-26 Akim Demaille <akim@epita.fr>
5064 * announce-gen (print_changelog_deltas): Neutralize "<#" as
5065 "<\#" to avoid magic from Gnus when posting parts of this script.
5067 2003-08-25 Jim Meyering <jim@meyering.net>
5069 * src/stat.c (main): Warn about use of deprecated `-l' option.
5071 2003-08-22 Jim Meyering <jim@meyering.net>
5073 * src/stat.c (do_stat): For link count at end of line, use %h format,
5074 instead of %-5h. The latter would make stat emit trailing spaces.
5075 Reported by Dan Jacobson.
5077 2003-08-20 Jim Meyering <jim@meyering.net>
5079 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
5081 2003-08-19 Jim Meyering <jim@meyering.net>
5083 * src/system.h: Include stdlib.h unconditionally,
5084 as we're now assuming that part of hosted C89.
5086 2003-08-18 Jim Meyering <jim@meyering.net>
5088 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
5089 to avoid warnings from gcc.
5091 2003-08-17 Jim Meyering <jim@meyering.net>
5093 Avoid unnecessary and sometimes time-consuming hostname lookups.
5094 * src/who.c (print_user): Use strchr, not strrchr.
5095 * src/pinky.c (print_entry): Likewise.
5096 Patch by Michael Stone.
5097 This fixes a typo I introduced in who-users.c on 1996-02-23.
5099 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
5100 disallowed between `@...@'.
5102 2003-08-16 Paul Eggert <eggert@twinsun.com>
5104 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
5105 done by gnulib .m4 files.
5106 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
5107 * src/sys2.h (strtoull): Remove unused declaration.
5109 2003-08-16 Jim Meyering <jim@meyering.net>
5111 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
5114 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
5115 race condition bug. The bug would be triggered when tailing a file
5116 with file pointer not at beginning of file, and where the file was
5117 truncated to have a length of less than the initial offset at just
5118 the right moment (between the two lseek calls in this function).
5120 An invalid initial value for *read_pos would result in
5121 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
5122 busy-wait rather than sleeping between iterations. The bug manifests
5123 itself only when tailing regular files that are initially nonempty.
5124 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
5126 (tail_lines): Likewise, after lseek calls.
5127 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
5128 * tests/tail-2/tail-n0f: New file. Test for above fix.
5129 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
5131 2003-08-15 Jim Meyering <jim@meyering.net>
5133 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
5134 (sc_sun_os_names): Likewise.
5135 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
5137 * man/help2man: Remove some SPACEs before TAB.
5139 2003-08-14 Paul Eggert <eggert@twinsun.com>
5141 * Makefile.maint (LC_ALL): Set to C.
5142 * man/Makefile.am (ASSORT): New var.
5143 (check-x-vs-1, programs): Use it.
5144 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
5145 * tests/Makefile.am (ASSORT, all_programs): Likewise.
5147 2003-08-11 Jim Meyering <jim@meyering.net>
5149 fold -s -wN would infloop for N < 8 with TABs in the input.
5150 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
5151 * src/fold.c (fold_file): Move contents of `else'-block
5152 out of conditional so it's used also for --spaces (-s).
5153 * tests/misc/fold: Test for the above fix.
5154 * tests/misc/Makefile.am (TESTS): Add fold.
5156 2003-08-10 Jim Meyering <jim@meyering.net>
5158 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
5159 system.h so the types from time.h and sys/time.h are available.
5160 It appears that this is necessary for OpenBSD, NetBSD, and
5161 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
5163 2003-08-06 Paul Eggert <eggert@twinsun.com>
5165 * NEWS: Add support for setting file timestamps to microsecond
5166 resolution, on hosts that support this.
5167 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
5168 * src/copy.c (copy_internal):
5169 Set file timestamps with utimens, not utime.
5170 * src/cp.c (re_protect): Likewise.
5171 * src/install.c (change_timestamps): Likewise.
5172 * src/touch.c (newtime, touch, main): Likewise.
5174 2003-08-09 Jim Meyering <jim@meyering.net>
5176 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
5178 (syntax-check-rules): Add it.
5180 * src/tail.c (main): Tweak Solaris OS version number in comment.
5181 * src/wc.c (wc): Likewise
5182 * tests/tail-2/fflush: Likewise.
5184 * src/tail.c: Add new undocumented option, --presume-input-pipe.
5185 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
5187 2003-08-08 Paul Eggert <eggert@twinsun.com>
5189 Use new gnulib 'extensions' module.
5190 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
5193 2003-08-08 Paul Eggert <eggert@twinsun.com>
5195 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
5197 2003-08-09 Jim Meyering <jim@meyering.net>
5199 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
5200 For tests of obsolete behavior, don't presume that unsetting
5201 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
5203 2003-08-07 Paul Eggert <eggert@twinsun.com>
5205 * doc/coreutils.texi (split invocation):
5206 Add -d or --numeric-suffixes option to 'split'.
5207 From a suggestion by Jesse Kornblum.
5208 * src/split.c (suffix_alphabet): New var.
5209 (longopts, usage, next_file_name, main): Support -d.
5210 (next_file_name, main): Allow -a0, as POSIX requires.
5211 (next_file_name): Don't assume ASCII-like encoding;
5212 'a' through 'z' are not contiguous in EBCDIC.
5214 2003-08-05 Paul Eggert <eggert@twinsun.com>
5216 Merge getline from gnulib.
5217 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
5218 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
5219 New files, from gnulib.
5220 * lib/getdelim2.c, lib/getdelim2.h: Remove.
5221 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
5222 getdelim2.h to getndelim2.c and getndelim2.h.
5223 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
5224 checking for getdelim.
5225 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
5226 than rolling our own.
5227 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
5228 (cut_fields): Invoke getndelim2 rather than getdelim2.
5230 2003-08-04 Jim Meyering <jim@meyering.net>
5232 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
5233 and for the indices to iterate through nsigs.
5235 2003-08-02 Paul Eggert <eggert@twinsun.com>
5237 * src/sort.c: Minor code cleanups, mostly to use more accurate
5238 types and to remove unnecessary casts.
5239 (min, max): Remove. All uses changed to MIN and MAX.
5240 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
5241 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
5242 keyfield.numeric, struct keyfield.general_numeric, struct
5243 keyfield.month, struct keyfield.reverse, reverse, unique,
5244 have_read_stdin): Now bool, not int. All uses changed.
5245 (eolchar): Now char, not int.
5246 (struct keyfield.ignore): Now bool const *, not int *.
5247 (struct keyfield.translate): Now char const *, not char *.
5248 (struct month.name): Likewise.
5249 (blanks, nonprinting, nondictionary): Now bool[], not int[].
5250 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
5251 check, sort, main): Use const * pointers when possible.
5252 (month_cmp): Rewrite to avoid casts.
5253 (inittables): Initialize tables unconditionally, to avoid branches.
5254 (fillbuf): Return bool, not int. All uses changed.
5255 (fillbuf, keycompare, new_key, main):
5256 Use SIZE_MAX rather than (size_t) -1.
5257 (trailing_blanks): Renamed from trim_trailing_blanks.
5258 Return the number of blanks to trim. All uses changed.
5259 (getmonth): Use trailing_blanks rather than open code.
5260 (keycompare): Do not cast char * to unsigned char *; not needed.
5261 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
5263 (compare, main): Use | rather than || to avoid jumps.
5264 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
5266 (check, first_same_file, sort, main):
5267 Use bool instead of int local vars when possible.
5268 (check): Merge the old 'checkfp' and 'check' into a single function,
5269 that returns a boolean (true if the file was ordered).
5271 (main): Use int instead of unsigned for iterating through nsigs.
5272 Rename local var "posix_pedantic" to "posixly_correct".
5274 2003-08-02 Jim Meyering <jim@meyering.net>
5276 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
5277 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
5279 * src/cut.c (cut_fields): Don't read again after encountering an
5280 initial EOF. E.g., `cut -f2' would do so.
5281 * tests/misc/tty-eof: Add a test for the above fix.
5283 * src/sort.c (sortlines): Add description and references.
5286 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
5287 the tests in help-version will use the just-built binaries.
5288 Reported by Christian Krackowizer.
5290 2003-07-31 Paul Eggert <eggert@twinsun.com>
5292 * NEWS: Add --rfc-2822 option to GNU date.
5293 * doc/coreutils.texi (Time directives, Options for date, Examples
5295 * src/date.c (long_options, usage, main): Likewise.
5296 * doc/getdate.texi (General date syntax): Likewise.
5297 * doc/coreutils.texi (Options for date): Fix a typo in format:
5298 it's now %d not %_d. Add URLs.
5300 2003-08-01 Jim Meyering <jim@meyering.net>
5302 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
5303 Otherwise, with at least the /bin/sh from HPUX 10.20,
5304 the trap code would end up converting that to exit 1 and thus an
5305 unexpected test failure. Reported by Christian Krackowizer.
5307 2003-07-31 Paul Eggert <eggert@twinsun.com>
5309 * src/ptx.c: Do not include bumpalloc.h.
5310 (WORD_TABLE): New member alloc.
5311 (ALLOC_NEW_WORD): Remove.
5312 (occurs_alloc): New var.
5313 (digest_word_file, find_occurs_in_text): Check for arithmetic
5314 overflow when computing table size. Use xrealloc rather than
5315 bumpalloc primitives.
5317 2003-07-29 Jim Meyering <jim@meyering.net>
5321 * README: When running tests as root, suggest using
5322 sudo with NON_ROOT_USERNAME=$USER.
5324 * tests/Makefile.am (all_programs): Makefile is in ../src, not
5327 2003-07-28 Jim Meyering <jim@meyering.net>
5329 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
5331 2003-07-28 Paul Eggert <eggert@twinsun.com>
5333 * lib/stdbool.hin (_Bool): Make it signed char, instead of
5334 an enum type, so that it's guaranteed to promote to int.
5335 * src/sort.c (sortlines_temp): Undo previous change.
5337 2003-07-28 Jim Meyering <jim@meyering.net>
5339 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
5340 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
5341 would cause lines[-1 - swap] (with swap = false) to evaluate to
5344 2003-07-27 Jim Meyering <jim@meyering.net>
5346 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
5347 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
5349 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
5350 directories, as required by POSIX. Reported by Karl Berry.
5351 * tests/rm/dir-no-w: New file. Test for the above fix.
5352 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
5354 * tests/mk-script: Emit `$xx', not its expansion.
5356 2003-07-27 Paul Eggert <eggert@twinsun.com>
5358 This change was inspired by a similar proposal by Stepan Kasal.
5359 * src/sort.c (mergelines, sortlines_temp): New functions.
5360 (sortlines): Use them, to reduce the number of times that
5361 we need to copy 'struct line' values. This improved CPU
5362 performance by about 30% on one 18 MB test.
5363 (sort): Don't invoke sortlines unless we have 2 or more lines.
5365 2003-07-26 Stepan Kasal <kasal@ucw.cz>
5367 * src/sort.c (sort): Don't require two `struct line's per text line,
5368 the new sort algorithm requires just 1.5.
5370 2003-07-27 Jim Meyering <jim@meyering.net>
5372 * src/pathchk.c (validate_path): Use %lu, not %ld.
5374 * src/cut.c (is_printable_field): Simplify bit arithmetic.
5376 * src/ls.c (sort_files): Put `volatile' in the right place.
5379 2003-07-26 Jim Meyering <jim@meyering.net>
5381 Use only one bit per field/offset in array, not one `int'.
5382 * src/cut.c (printable_field): Change type to `unsigned char'.
5383 (mark_printable_field, is_printable_field): New functions.
5384 Use them in place of all direct accesses of `printable_field'.
5386 * src/expand.c (parse_tabstops): Detect overflow properly.
5387 * src/cut.c (set_fields): Likewise.
5389 * src/rm.c: Include "dirname.h".
5390 (usage): Use base_name (program_name) in body of --help output.
5392 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
5393 Idea from Brendan O'Dea, who suggested using
5394 `program_name = basename (argv[0]);' everywhere --
5395 can't do that, but using base_name works just fine here.
5397 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
5399 2003-07-24 Paul Eggert <eggert@twinsun.com>
5401 Fix some POSIX-compliance problems with 'test'. This makes
5402 'test' more compatible with Bash.
5404 * NEWS, doc/coreutils.texi: Document the following.
5405 * src/test.c: Include exitfail.h.
5406 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
5407 (test-syntax_error): Use it.
5408 (binary_operator): Now takes bool arg specifying whether left operand
5409 is -l ARG, so that caller determines this rather than us.
5411 (term): Use posixtest to evaluate parenthesized subexpressions.
5412 (unary_operator, one_argument): Remove support for -t without operand.
5413 (one_argument): Take argument from argv[pos].
5414 (one_argument, two_arguments, three_arguments): Advance pos.
5415 All callers changed.
5416 (three_arguments): Look for binary ops before "!". Then look
5417 for parenthesized one_argument expressions, instead of trusting
5418 expr () to do the right thing.
5419 (posixtest): Now takes number of args. All callers changed.
5420 Treat "( A B )" like "A B".
5421 (main): Set exit_failure to TEST_FAILURE. Don't depend on
5422 POSIXLY_CORRECT, as we now conform to POSIX by default.
5423 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
5424 * tests/test/Test.pm (test_vector): Add several tests to check
5425 the above. Syntax errors now exit with status 2, not 1.
5426 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
5428 2003-07-26 Jim Meyering <jim@meyering.net>
5430 * tests/help-version: Adjust for above change in test behavior:
5431 `[' exits with 2, not 1, and test doesn't accept --help or --version.
5433 * Makefile.maint (ME): Don't use trick suggested in Make manual.
5434 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
5436 * Makefile.maint (sc_system_h_headers): Another syntax check.
5437 (syntax-check-rules): Add it to the list.
5439 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
5440 so it matches `%ld' format even on 32-bit systems.
5442 * src/fmt.c (flush_paragraph): Cast field width to `int' to
5443 avoid warning on 64-bit systems.
5445 * src/ls.c (sort_files): Make `func' volatile, so it can't be
5446 clobbered by a `longjmp' into this function.
5448 2003-07-25 Jim Meyering <jim@meyering.net>
5450 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
5453 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
5454 because it'd evoke spurious failure on 64-bit systems.
5456 2003-07-24 Jim Meyering <jim@meyering.net>
5458 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
5459 output its current record counts. Reported by Jurriaan.
5461 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
5462 `wc' with no options. This goes along with the change of 2003-07-20.
5464 2003-07-23 Jim Meyering <jim@meyering.net>
5466 Don't include headers already included by system.h:
5467 * src/tr.c: Don't include errno.h.
5468 * src/true.c: Don't include version-etc.h.
5469 * src/test.c: Don't include limits.h or error.h.
5470 * src/stat.c: Don't include unistd.h or time.h.
5471 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
5472 * src/pr.c: Don't include time.h.
5473 * src/pathchk.c: Don't include errno.h.
5474 * src/nice.c: Don't include sys/time.h.
5475 * src/ls.c: Don't include stdlib.h.
5477 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
5478 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
5479 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
5480 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
5481 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
5482 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
5483 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
5484 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
5485 Don't include closeout.h.
5487 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
5488 can access the required version of rm.
5489 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5491 * tests/cut/Test.pm (out-delim3a): New test.
5493 * man/help2man: Update to version 1.33.
5495 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
5497 * src/dircolors.c: Include xstrndup.h.
5498 (xstrndup): Remove function, now that it's been factored out into
5501 2003-07-22 Paul Eggert <eggert@twinsun.com>
5503 * src/wc.c (wc): Fix typo in computation of file from file_x,
5504 which caused the former to be used uninitialized if file_x was
5507 2003-07-22 Jim Meyering <jim@meyering.net>
5509 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
5511 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
5512 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
5513 Thomas Luzat. See http://bugs.debian.org/202413 for details.
5515 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
5517 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
5519 * src/cut.c (set_fields): Mark all selected indices before trying to
5520 determine range endpoints.
5521 * tests/cut/Test.pm: New test for the above fix.
5523 Begin to address this comment: What if someone wants to
5524 extract the 1,000,000-th field of some huge input file?
5525 The first step is to rearrange things so that the values
5526 in the printable_field array are all 0/1 rather than 0/1/2.
5527 * src/cut.c (RANGE_START_SENTINEL): Remove.
5528 Store range-start indices in a hash table, rather than
5529 overloading the `printable_field' array.
5530 (range_start_ht): New global.
5531 (hash_int, hash_compare_ints, is_range_start_index): New functions.
5532 (print_kth): Use is_range_start_index; don't test printable_field.
5533 (set_fields): Detect overflow.
5534 (set_fields): Insert each range-start index into range_start_ht.
5535 (main): Call set_fields only once, and only after
5536 output_delimiter_specified and (if required) range_start_ht have
5539 2003-07-20 Paul Eggert <eggert@twinsun.com>
5541 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
5542 invoked with a null pointer when there were no file arguments.
5544 2003-07-20 Jim Meyering <jim@meyering.net>
5546 * Makefile.maint (sc_changelog): Add another nit-picky check.
5548 * src/wc.c (write_counts): Add a comment.
5549 (wc): Rename `file' parameter.
5550 Set new local, `file', to be the file name, or (when it's NULL)
5551 _("standard output") so that all uses of `file' use the proper value.
5552 Use STREQ, not strcmp.
5554 2003-07-20 Paul Eggert <eggert@twinsun.com>
5556 wc count field widths now are heuristically adjusted depending
5557 on the input size, if known. If only one count is printed, it
5558 is guaranteed to be printed without leading spaces.
5560 Previously, wc did not align the count fields if
5561 POSIXLY_CORRECT was set, but POSIX did not actually require
5562 this undesirable behavior, so it has been removed.
5564 * NEWS: Document this.
5565 * doc/coreutils.texi (wc invocation): Likewise.
5567 * src/wc.c (number_width): New var.
5568 (posixly_correct): Remove.
5569 (struct fstatus): New struct.
5570 (write_counts): Output fields of width number_width.
5571 Do not worry about POSIXLY_CORRECT.
5572 Use null file, not empty-string file, to denote stdin,
5573 since "" is a valid file name on some hosts.
5574 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
5576 (wc): Avoid problems if end_pos - current_pos overflows.
5577 Do not print odd message if stdin has a read error.
5578 (get_input_fstatus, compute_number_width): New functions.
5579 (main): Use them to implement the new behavior.
5580 Ignore POSIXLY_CORRECT.
5582 * tests/wc/Test.pm: Adjust to the new output widths.
5584 2003-07-19 Jim Meyering <jim@meyering.net>
5586 * tests/rm/fail-eperm: Don't create temporary directory --
5589 * tests/shred/remove: Don't open-code test for UID != 0.
5590 Use priv-check's require-non-root instead.
5591 Update to use newer framework.
5593 * tests/help-version (expected_failure_status_expr): Record that
5594 expr exits with status of 3 for e.g., a write error.
5596 * tests/priv-check: Use `id -u' to see if we're running as root,
5597 rather than trying go write to an write-protected file.
5598 When running as root, ensure $NON_ROOT_USERNAME is valid.
5599 When running as root with `require-non-root', ensure that `.'
5600 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
5601 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
5603 * src/printenv.c: Include "exitfail.h".
5604 (main): Set exit_failure rather than calling close_stdout_set_status.
5605 * src/date.c: Likewise.
5606 * src/sort.c: Likewise.
5607 * src/tty.c: Likewise.
5609 2003-07-18 Jim Meyering <jim@meyering.net>
5611 * tests/touch/not-owner: Update to use newer framework.
5613 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
5614 directory, and remove Perl-coded `you may not run as root' test.
5615 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
5616 hard-coding something not quite equivalent.
5617 Paul Jarc reported the inconsistent diagnostics.
5619 * src/sort.c (main): Use close_stdout via atexit.
5620 Now `sort --version' and `sort --help' fail, as they should
5621 when their output is redirected to /dev/full.
5623 * src/su.c (usage): Don't call close_stdout here.
5624 (main): Use close_stdout via atexit.
5625 Now `su --version > /dev/full' fails, as it should.
5626 Somehow, the change of 2000-05-07 that purports to fix this
5629 * tests/help-version (--help/--version vs. /dev/full): Special-case
5630 `[' to protect it from expected_failure_status-`eval'.
5632 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
5633 count and the corresponding line, as required by POSIX.
5634 Reported by Clement Wang.
5635 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
5637 * tests/expr/basic: Add tests for when exit status is 2.
5639 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
5640 Use an anonymous `enum', rather than #define.
5642 2003-07-17 Paul Eggert <eggert@twinsun.com>
5644 * src/expr.c: Include "exitfail.h", "quotearg.h".
5645 (EXPR_INVALID, EXPR_ERROR): New constants.
5646 (nomoreargs, null, toarith, nextarg): Return bool, not int.
5647 (syntax_error): New function, exiting with status 2. Use it
5648 insteading of printing "syntax error" ourselves.
5649 (main): Initialize exit_failure to EXPR_ERROR.
5650 Exit with EXPR_INVALID on syntax error (too few arguments).
5651 (nextarg): Use strcmp, not strcoll; strcoll might return
5652 an undesirable 0, or might fail.
5653 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
5654 or other such error.
5655 (eval2): Report an error if strcoll fails in a string comparison.
5656 * src/sort.c: Include "exitfail.h".
5657 (main): Set exit_failure, not xalloc_exit_failure and
5658 xmemcoll_exit_failure.
5659 * tests/expr/basic: Invalid value exits with status 3, not 2.
5661 2003-07-16 Jim Meyering <jim@meyering.net>
5663 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
5664 per GNU maintainer guidelines. The next non-beta release will be 5.1.
5666 This script would have caught at least two recent bugs:
5667 those in [ and kill.
5668 * tests/help-version: Revive this script.
5669 It wasn't doing anything useful, since $all_programs wasn't being
5670 defined by the invoking Makefile.am.
5671 Reflect that nohup is no longer a script, so don't exclude it.
5672 Add framework to handle the programs added since it was last run:
5673 kill, stat, unlink, [, link, readlink.
5674 Fix path-related problems deriving from the move of this script
5675 from src/ to its present location.
5676 * tests/Makefile.am (all_programs): Define.
5677 (TESTS_ENVIRONMENT): Use it.
5679 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
5680 whereby kill would always attempt to operate on argv[0] and fail.
5682 * src/test.c (integer_expected_error): Improve diagnostic -- now,
5683 it also matches the one from bash's builtin test.
5684 (binary_operator): Add \n at end of diagnostic.
5686 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
5687 * tests/priv-check: Move setuidgid-related and
5688 NON_ROOT_USERNAME-checking code to this file.
5690 * README: Update section on testing as `root'.
5691 Suggestion from Paul Jarc.
5693 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
5694 names of authors that I just found in bash's builtins/test.def.
5696 Running `[' with no arguments would evoke a segfault.
5697 * src/test.c (main) [LBRACKET]: Move initialization of argv to
5698 precede potential use via test_syntax_error.
5700 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
5701 warning from automake -Wall.
5703 2003-07-15 Jim Meyering <jim@meyering.net>
5707 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
5710 * announce-gen (print_changelog_deltas): Relax tests for matching
5711 version-number line in NEWS.
5712 Change the .sig suffix to .asc here, too.
5714 2003-07-14 Jim Meyering <jim@meyering.net>
5716 * Makefile.maint (%.asc): Renamed from %.sig.
5717 Generate and use ascii-armored signatures.
5718 Use gpg's -o option.
5720 2003-07-13 Jim Meyering <jim@meyering.net>
5722 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
5725 * Makefile.maint (syntax-check): Move each individual check into
5727 (syntax-check-rules): This is the list of syntax-check targets.
5728 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
5729 (sc_cast_of_x_alloc_return_value, sc_space_tab):
5730 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
5732 2003-07-12 Jim Meyering <jim@meyering.net>
5734 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
5735 traces of the nohup script.
5737 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
5738 $(OPTIONAL_BIN_ZCRIPTS).
5740 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
5741 target, not before the `>'.
5743 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
5744 now that that function no longer calls `error'.
5746 * src/df.c (find_mount_point): Emit a diagnostic for each
5747 failed syscall, rather than relying on caller to do that.
5748 The caller couldn't do a good job, anyhow -- too many different
5749 ways to fail (each with a different referent).
5750 Give a diagnostic upon failed save_cwd, now that that function
5751 no longer calls `error'.
5752 (show_point): Don't diagnose find_mount_point's errors, now that
5753 it handles them itself.
5755 * src/df.c (find_mount_point): Don't let free clobber errno upon
5758 * src/sys2.h: Remove alloca-related block.
5759 * src/system.h: Include <alloca.h> here, instead.
5761 It appears that the `#pragma alloca' included via "system.h" is
5762 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
5763 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
5764 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
5766 * src/chown-core.c (change_file_owner): Do not restore any special
5767 permission bits (e.g., set-user-ID, set-group-ID) that are reset
5768 by chown(2) on some systems. Suggestion and insistence :-) from
5771 * tests/input-tty: Also check `test -t 1'.
5772 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
5773 test would block when run in the background.
5775 2003-07-11 Jim Meyering <jim@meyering.net>
5777 * tests/sample-test: Also fail if cat-to-create-expected-output
5778 fails. Otherwise, if both `exp' and `out' were to end up empty
5779 because of e.g., a full disk, they would mistakenly compare equal.
5781 * src/nohup.c: New file. Rewrite of nohup.sh in C.
5782 This solves a portability problem: on at least Solaris systems,
5783 when nohup.sh used the vendor /bin/sh, it would exit with status
5784 of `1' rather than the required 126 or 127 upon failure to exec
5785 the specified program.
5787 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
5788 (bin_PROGRAMS): Add nohup.
5789 (EXTRA_DIST): Remove nohup.sh.
5790 (all_programs): Remove use of $(EXTRA_SCRIPTS).
5791 * src/nohup.sh: Remove file.
5792 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
5794 * tests/misc/nohup: Tests for the above.
5795 * tests/misc/Makefile.am (TESTS): Add nohup.
5797 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
5798 the macro, COPY_FD_DIAGNOSE.
5799 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
5800 (head_file): Likewise.
5802 * src/date.c: Include "quote.h".
5803 (batch_convert): Use the quote function rather than using literal `...'
5806 * src/setuidgid.c (main): Enclose diagnostic in _(...).
5807 * src/fmt.c (main): Likewise.
5808 * src/mknod.c (main): Likewise.
5809 * src/tac.c (tac_seekable): Likewise.
5810 * src/yes.c (main): Likewise.
5811 * src/od.c (main): Likewise.
5812 * src/install.c (change_attributes): Likewise.
5814 2003-07-10 Jim Meyering <jim@meyering.net>
5816 * src/head.c (usage): Use 1024*1024 in place of 1048576.
5817 * src/tail.c (usage): Likewise.
5819 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
5820 place of the kludge in this test. Suggestion from Paul Jarc.
5822 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
5823 * src/setuidgid.c: New program, solely for testing (not installed).
5825 * src/chown-core.c (change_file_owner): Don't leak file descriptors
5826 when dereferencing symlinks.
5828 2003-07-09 Jim Meyering <jim@meyering.net>
5830 * tests/du/slash: New file/test for today's lib/ftw.c fix.
5831 * tests/du/Makefile.am (TESTS): Add slash
5833 * src/tail.c (xlseek): Avoid warning about ``return without value
5834 from function returning non-void''.
5836 2003-07-08 Jim Meyering <jim@meyering.net>
5838 * man/help2man: Update to version 1.29.
5840 * man/help2man: Add END handler to close STDOUT and check for errors.
5842 2003-06-30 Paul Eggert <eggert@twinsun.com>
5844 Add support for a "[" that conforms to the GNU coding standards,
5845 i.e., that does not depend on its name.
5846 * src/lbracket.c: New file.
5848 * man/Makefile.am (programs): Ignore "[", since it doesn't have
5849 a separate man page.
5850 * src/Makefile.am (bin_PROGRAMS): Add "[".
5851 (__SOURCES): New var.
5852 * src/test.c (LBRACKET): Define to 0 if not defined.
5853 (main): Use LBRACKET rather than argv[0].
5855 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
5856 Reported by Paul Jarc and Dan Jacobson.
5858 * src/test.c (main): Do not recognize --help or --version if
5859 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
5860 Do not bother testing that margv[margc] is non-null.
5862 2003-07-04 Jim Meyering <jim@meyering.net>
5864 * src/who.c (print_line): Rewrite to use asprintf, in order to be
5865 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
5867 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
5868 option, and perform the +1600 invocations of head IFF the envvar
5869 RUN_EXPENSIVE_TESTS is set.
5871 2003-07-03 Jim Meyering <jim@meyering.net>
5873 * src/cp.c (do_copy): Give a better diagnostic when failing due
5874 to nonexistent destination directory. Reported by Dmitry Rutsky.
5875 See http://bugs.debian.org/199730 for details.
5877 2003-06-27 Jim Meyering <jim@meyering.net>
5879 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
5880 * src/split.c (longopts): Use `1', not `0' as the value for
5881 for &verbose. Reported by Keith Thompson.
5883 Test for the above fix.
5884 * tests/misc/split-a: Also use --verbose and compare stderr
5885 output with what we'd expect.
5887 2003-06-20 Jim Meyering <jim@meyering.net>
5889 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
5890 Use `error_t' (rather than int) as type for local `err'.
5891 From Alfred M. Szmidt.
5893 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
5895 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
5896 Fix author preservation code.
5898 2003-06-19 Jim Meyering <jim@meyering.net>
5900 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
5901 (do_link): Don't warn about hard link to symlink.
5903 2003-06-18 Jim Meyering <jim@meyering.net>
5905 * src/cut.c: Include "getdelim2.h", not "getstr.h".
5906 Reflect renaming: getstr -> getdelim2.
5908 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
5909 readline -> readlinebuffer.
5911 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
5913 * src/readlink.c: Include <sys/types.h> before system.h (because
5914 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
5916 2003-06-17 Jim Meyering <jim@meyering.net>
5918 * src/system.h (initialize_main): Define.
5919 Use it in every `main'. Applied via this:
5920 p='initialize_main (&argc, &argv);'
5921 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
5922 $(grep -l program_name.=.argv.0 *.c)
5923 test.c uses margc/margv, so I made the change manually for that file.
5924 Based on a patch from Bernard Giroud.
5926 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
5928 Fix for build failure on Ultrix 4.3.
5929 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
5930 Include sys/param.h and sys/mount.h on ultrix.
5932 2003-06-16 Jim Meyering <jim@meyering.net>
5934 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
5936 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
5937 them here instead, but with one change: define EISDIR to -1, not 0.
5939 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
5940 guaranteed to be defined.
5941 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
5943 * README: Mention the CVS repository.
5944 Encourage addition of test cases.
5946 2003-06-12 Jim Meyering <jim@meyering.net>
5948 * src/touch.c (touch): Call close only if necessary.
5951 * src/wc.c (usage): Correct wording: wc prints counts in the order
5952 `newline, word, byte'. Reported by Keith M. Briggs.
5953 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
5955 2003-06-10 Jim Meyering <jim@meyering.net>
5957 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
5959 2003-06-07 Jim Meyering <jim@meyering.net>
5961 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
5964 2003-06-06 Jim Meyering <jim@meyering.net>
5966 * src/extract-magic (main): Avoid newer 3-arg form of open,
5967 so this script works also with e.g., perl5.005_03.
5968 Patch by John David Anglin.
5970 2003-06-04 Paul Eggert <eggert@twinsun.com>
5972 * src/system.h: Include <stdbool.h> unconditionally.
5974 2003-06-04 Jim Meyering <jim@meyering.net>
5976 * man/Makefile.am (check-programs-vs-x): Rename target
5977 from check-programs-vs-1. Adjust rule to check for the
5978 primary (.x) file, not the generated one (.1).
5980 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
5982 * man/kill.x: New file.
5983 * man/Makefile.am (dist_man_MANS): Add kill.1.
5986 2003-06-04 Jim Meyering <jim@meyering.net>
5988 Ensure that the .x file for a new program is never forgotten again.
5989 * man/Makefile.am (programs): Define.
5990 (check-programs-vs-1): New phony target.
5991 (check-local): Depend on it.
5993 2003-06-03 Jim Meyering <jim@meyering.net>
5995 Avoid unnecessary copying of environment.
5996 * src/env.c (main): Rather than clearing the environment and --
5997 unless told to ignore environment -- copying all settings from
5998 the saved, original environment, clear the environment only when
5999 that is requested. Suggested by Jens Elkner.
6001 2003-06-02 Jim Meyering <jim@meyering.net>
6003 * src/system.h: Always include <string.h>, since we assume C89.
6004 Include <limits.h> without checking for HAVE_LIMITS_H.
6006 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
6007 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
6009 2003-06-01 Jim Meyering <jim@meyering.net>
6011 Avoid a race condition in `tail -f' described by Ken Raeburn in
6012 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
6013 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
6014 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
6015 (tail_bytes, tail_lines, tail): Likewise.
6016 (tail_file): Use the new `read_pos' value as the size,
6017 rather than stats.st_size from the fstat call.
6019 2003-05-28 Jim Meyering <jim@meyering.net>
6021 * src/extract-magic: Allow expansion of `$file' in the here-
6022 document corresponding to the comment at the top of fs.h.
6024 2003-05-26 Jim Meyering <jim@meyering.net>
6026 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
6027 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
6028 Use #if/#elif/... cascade so we get only one set of include files.
6029 Reported by Nelson Beebe.
6031 2003-05-24 Jim Meyering <jim@meyering.net>
6033 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
6034 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
6035 accept the BSD format.
6037 2003-03-28 Joe Orton <jorton@redhat.com>
6039 * src/md5sum.c (bsd_split_3): New function.
6040 (split_3): Detect checksums from BSD 'md5' command and handle them
6043 * tests/md5sum/basic-1: New tests for --check exit status, and for
6044 BSD-style checksum files.
6046 2003-05-21 Jim Meyering <jim@meyering.net>
6048 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
6049 This sort of thing is why it'd be *Really Good* to factor
6050 out the common code used here and in tail.c.
6052 2003-05-14 Jim Meyering <jim@meyering.net>
6054 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
6056 * tests/du/slink: Skip this test if `.' is on an XFS file system.
6058 * tests/du/fd-leak: New file. Test for the bug in du that
6059 was fixed by the 2003-05-12 change to lib/ftw.c.
6060 * tests/du/Makefile.am (TESTS): Add fd-leak.
6062 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
6063 includes a translatable word, `and'.
6065 * src/dd.c (usage): Don't use `,' as the thousands separator
6066 in e.g. 1,000,000 and 1,048,576. Instead, do this:
6067 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
6068 * src/df.c (usage): Likewise.
6069 * src/du.c (usage): Likewise.
6070 * src/ls.c (usage): Likewise.
6072 * Makefile.maint (syntax-check): Add another check.
6074 2003-05-13 Paul Eggert <eggert@twinsun.com>
6076 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
6077 must output nothing. Problem reported by Josh Hyman.
6079 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
6080 (output_unique, output_first_repeated, output_later_repeated):
6081 New vars. All uses of "mode" changed to use these variables,
6082 which are not mutually exclusive as "mode" was.
6083 (writeline): New arg "match", used to control whether to
6084 obey output_first_repeated or output_later_repeated.
6085 All callers changed.
6086 (check_file, main): Adjust to above changes.
6088 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
6090 2003-05-14 Jim Meyering <jim@meyering.net>
6092 * tests/rm/rm3: Use tr's \n notation rather than \012.
6093 This package can afford to do that, since its tests are guaranteed use
6094 GNU tr, which has accepted the more modern notation for 10 years.
6095 * tests/rm/rm5: Likewise.
6096 * tests/cp/same-file: Likewise.
6097 * tests/stty/row-col-1: Likewise.
6098 * tests/stty/basic-1: Likewise.
6099 * tests/rm/deep-1: Likewise.
6100 * tests/mv/part-symlink: Likewise.
6101 * tests/mkdir/perm: Likewise.
6102 * tests/misc/nice: Likewise.
6104 2003-05-13 Jim Meyering <jim@meyering.net>
6106 * src/copy.c (struct F_triple) [name]: Remove const attribute.
6107 (triple_free): Don't apply cast to argument of free.
6108 (seen_file): Add cast here instead.
6110 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
6111 (src_to_dest_free): Don't apply cast to argument of free.
6113 * src/sort.c (zaptemp): Don't apply cast to argument of free.
6114 * src/pr.c (init_fps, init_store_cols): Likewise.
6115 * src/join.c (delseq, freeline): Likewise.
6116 * src/expr.c (OLD): Likewise.
6117 * src/sort.c (sort): Likewise.
6118 * src/head.c (elide_tail_lines_pipe): Likewise.
6120 * src/tail.c: Include "quote.h".
6121 Use quote in diagnostics. Change many error format strings
6122 from just `%s' to e.g., `error reading %s'.
6123 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
6124 Rewrite newline-counting loop to use memchr.
6126 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
6127 Now that assert is no longer used, don't include <assert.h>.
6129 2003-05-12 Jim Meyering <jim@meyering.net>
6131 * src/head.c: Include <assert.h>.
6132 (AUTHORS): Add my name.
6133 (elide_tail_lines_pipe): New function.
6135 2003-05-10 Jim Meyering <jim@meyering.net>
6137 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
6139 * src/readlink.c (main): Set program_name before first use.
6140 Remove that (redundant) first use.
6141 Don't exit successfully just because --verbose was specified.
6142 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
6143 parameter is 0, error does not exit.
6145 * src/uname.c (main): When failing due to too many arguments, also say
6146 that, rather than just "Try `uname --help' for more information.".
6147 * src/comm.c (main): Likewise, but for too few arguments.
6148 * src/logname.c: Include error.h.
6149 (main): Say why we're failing.
6151 * src/uniq.c (main): Don't segfault when argc < optind.
6152 * src/who.c (main): Handle argc < optind.
6153 * src/df.c (main): Likewise.
6154 * src/install.c (main): Likewise.
6155 * src/mv.c (main): Likewise.
6156 * src/pwd.c (main): Likewise.
6157 * src/tty.c (main): Likewise.
6158 * src/chroot.c (main): Likewise.
6159 * src/hostname.c: Likewise.
6160 * src/du.c (main): Likewise.
6161 * src/expand.c (main): Likewise.
6162 * src/env.c (main): Likewise.
6163 * src/unexpand.c (main): Likewise.
6164 * src/printenv.c (main): Likewise.
6165 * src/sync.c (main): Handle argc == 0.
6166 * src/expr.c (main): Likewise.
6167 * src/printf.c (main): Likewise.
6168 * src/basename.c (main): Likewise.
6169 * src/ln.c (main): Test for `missing argument' before computing n_files.
6170 * src/tail.c (main): Test for the case of no arguments before
6173 * src/kill.c (send_signals): Don't check command line arguments here.
6174 (main): Check them here instead. Handle argc < optind.
6176 * src/logname.c (main): Use error, rather than fprintf, for the sake
6179 * src/rm.c (main): Don't overrun array bound if argc is 0.
6181 2003-05-09 Jim Meyering <jim@meyering.net>
6183 * src/sort.c (main): Don't overrun array bound if argc is 0.
6184 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
6185 Reported by Wartan Hachaturow.
6187 2003-05-07 Jim Meyering <jim@meyering.net>
6189 Implement support so that `head --lines=-N' works on seekable files.
6190 * src/head.c (enum Copy_fd_status): Define.
6191 (COPY_FD_DIAGNOSE): New macro.
6192 (elide_tail_lines_seekable): New funtion.
6193 (elide_tail_lines_file): Call it here.
6195 2003-05-06 Jim Meyering <jim@meyering.net>
6197 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
6199 2003-05-04 Jim Meyering <jim@meyering.net>
6201 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
6202 caused the addition of thousands of small files to the tar archive.
6203 * tests/misc/head-elide-tail: New file. Add them here instead.
6204 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
6206 2003-05-04 Paul Eggert <eggert@twinsun.com>
6208 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
6209 (IF_READDIR_NEEDS_REWINDDIR): Remove.
6210 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
6211 which was a bit weird because it couldn't be emulated by a function.
6213 2003-05-03 Jim Meyering <jim@meyering.net>
6215 Extend head to accept --lines=-N (--bytes=-N) and to print all
6216 but the N lines (bytes) at the end of the file.
6217 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
6218 Use quote() in diagnostics, rather than literal `' marks.
6219 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
6221 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
6222 (head_file): Reorganize so as to call head from only one place.
6223 (main): Likewise, for head_file.
6224 Handle new, undocumented option, --presume-input-pipe.
6225 Handle negative line and byte counts.
6226 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
6228 * tests/du/8gb: Skip test if the file system of `.' doesn't support
6229 sparse files -- otherwise it'd create a file of size 8GB.
6231 2003-05-02 Jim Meyering <jim@meyering.net>
6233 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
6234 Instead explain about `-' and standard input.
6235 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
6236 Reported by Keith Thompson.
6237 * tests/fmt/basic: Add test for the above fix.
6239 * src/fmt.c: Include "quote.h".
6240 Use quote() in diagnostics, rather than literal `' marks.
6241 (main): Exit nonzero when unable to open an input file.
6242 * tests/fmt/basic: Add test for the above fix.
6244 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
6245 specifications like `-72x'.
6246 * tests/fmt/basic: Add test for the above fix.
6248 Work around nasty readdir bug on Darwin6.5.
6249 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
6250 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
6251 returned NULL and there has been at least one successful unlink or
6252 rmdir call since the opendir or previous rewinddir, then call
6253 rewinddir and reiterate the loop.
6255 Factor out common code.
6256 * src/remove.c (readdir_ignoring_dotdirs): New function.
6257 (is_empty_dir): Use it here.
6258 (remove_cwd_entries): Use it here.
6260 2003-05-01 Jim Meyering <jim@meyering.net>
6262 * tests/rm/r-3: Create 500 rather than just 300 files.
6263 There's a bug in Darwin6.5's readdir that shows up only with
6265 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
6269 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
6270 (dump_remainder): Move two declarations `down' into the scope
6271 where they are used.
6272 (xlseek): Return the resulting offset.
6273 (file_lines): Rename parameter, file_length, to end_pos.
6274 (pipe_lines): Don't coerce safe_read return value to `int'.
6275 Adapt tests accordingly.
6276 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
6278 Change type of `total_bytes' from `int' to `size_t',
6279 since the former wouldn't always be wide enough.
6280 Don't coerce safe_read return value to `int',
6281 and adapt tests accordingly.
6282 Now that testing for a read error no longer involves
6283 using `tmp', handle that case *after* freeing `tmp'.
6284 (start_bytes): Clean up.
6285 (tail_bytes): Now that `n_bytes' may be larger than
6286 OFF_T_MAX, test for that condition and, if it's true, don't
6287 use lseek optimizations.
6288 (parse_options): Don't fail just because N_UNITS is larger than
6289 the maximum size of a file -- tail may be applied to an input
6290 stream (e.g., a pipe) with more data than that.
6292 * Makefile.maint (syntax-check): Rename from alloc-check.
6293 Also check for SPACE-TAB sequences.
6294 Also check for malloc/calloc/realloc casts.
6296 2003-05-01 Jim Meyering <jim@meyering.net>
6298 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
6300 2003-04-28 Jim Meyering <jim@meyering.net>
6302 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
6303 make the now-more-picky tsort fail.
6305 2003-04-24 Jim Meyering <jim@meyering.net>
6307 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
6308 (main): Minor syntactic clean-up.
6310 * src/tsort.c (tsort): Fail if the input contains an odd number of
6311 tokens. Reported by junkio@cox.net.
6313 * tests/tsort/basic-1: Test for the above fix.
6315 2003-04-21 Jim Meyering <jim@meyering.net>
6317 * tests/misc/printf: Add tests for the printf fixes below.
6319 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
6321 2003-04-20 Paul Eggert <eggert@twinsun.com>
6323 Fix printf POSIX compatibility bug reported by Ben Harris in
6324 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
6325 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
6326 \0NNN in the %b operand.
6327 * src/printf.c (usage): Likewise.
6328 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
6329 is desired. All uses changed. Behave like Bash printf if %b
6330 operand uses \NNN where the initial N is not 0.
6332 2003-04-17 Jim Meyering <jim@meyering.net>
6334 * src/stty.c: Remove uses of PROTOTYPE macro.
6336 2003-04-15 Jim Meyering <jim@meyering.net>
6338 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
6339 each sequence of spaces before a TAB character.
6341 2003-04-13 Jim Meyering <jim@meyering.net>
6343 * src/remove.c (is_empty_dir): Don't closedir (NULL).
6345 2003-04-12 Jim Meyering <jim@meyering.net>
6347 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
6348 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
6349 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
6350 * src/nl.c (main): Fix those problems and remove literal quote marks
6351 (e.g., "`%s'") from format string; instead use "%s" in each format
6352 string and `quote (optarg)' as the corresponding argument.
6353 Also, diagnose all invalid command line options before failing.
6355 * src/nl.c (proc_text): Fix a bug that would make nl output extra
6356 newlines in some cases. Details here: http://bugs.debian.org/177256.
6357 This bug was introduced on 2001-11-10 for textutils-2.0.17.
6358 * tests/misc/nl: Add test for the above-fixed bug.
6360 * tests/misc/readlink: New file. Test the --canonicalize option.
6361 * tests/misc/Makefile.am (TESTS): Add readlink.
6363 2003-04-11 Jim Meyering <jim@meyering.net>
6366 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
6367 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
6368 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
6369 retain alignment) each sequence of spaces before a TAB character.
6371 * src/ls.c: Include <stdlib.h> unconditionally.
6373 * Makefile.maint (xalloc-check): Rename from header-check.
6375 * src/yes.c: Include error.h after system.h, not before.
6378 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
6379 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
6380 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
6381 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
6382 * src/tr.c: * src/unexpand.c, src/users.c:
6383 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
6384 return values and of xrealloc's first argument.
6385 Fix the former with this:
6386 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
6388 2003-04-10 Jim Meyering <jim@meyering.net>
6390 * src/stty.c (wrapf): Declare with format attribute.
6392 The S_MAGIC_... names shouldn't be maintained in two places (prior
6393 to this change, one would have to keep stat.c and fs.h in sync).
6394 This change makes it so those names and the corresponding
6395 hexadecimal constants all reside in stat.c. fs.h is now generated.
6396 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
6397 (BUILT_SOURCES): Add fs.h, now that it's generated.
6398 (EXTRA_DIST): Add extract-magic.
6399 * src/extract-magic: New script to extract fs.h definitions from stat.c.
6400 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
6401 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
6403 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
6404 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
6406 * man/unexpand.x: Add `SEE ALSO' reference to expand.
6407 * man/expand.x: Add `SEE ALSO' reference to unexpand.
6408 Suggestion from Dan Jacobson.
6410 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
6412 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
6413 * src/stat.c (human_fstype): Handle Linux's devpts.
6415 2003-04-09 Paul Eggert <eggert@twinsun.com>
6417 * src/split.c (line_bytes_split): Arg is of type size_t, since
6418 that's all that is supported for now.
6419 (main): Check for overflow in obsolescent line count option.
6421 2003-04-09 Jim Meyering <jim@meyering.net>
6423 * tests/misc/split-fail: Add a new test for the above fix.
6425 * src/split.c (bytes_split): Use size_t temporary (rather than
6426 uintmax_t original) in remaining computations. From Paul Eggert.
6428 Handle command line option arguments larger than 2^31.
6429 This allows e.g., splitting into files of size 2GB and larger,
6430 and running split --lines=N with N=2^31 or more.
6431 But for --line-bytes=N, the restriction that N <= SIZE_MAX
6432 remains (for now), due to the way it is implemented.
6434 * src/split.c: Include "inttostr.h".
6435 (bytes_split, lines_split, line_bytes_split, main):
6436 Use uintmax_t, not size_t, for file sizes.
6437 (main): Give a better diagnostic for option arguments == 0.
6438 Use umaxtostr to print file sizes.
6439 Reported by Luke Hassell.
6441 2003-04-08 Jim Meyering <jim@meyering.net>
6443 * src/rm.c (usage): Mention that --directory (-d) works only
6444 on some systems. Suggestion from Samuel Tardieu.
6446 * tests/basename/basic: Run $PERL to see if it is available,
6447 rather than testing its value.
6448 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
6449 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
6450 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
6451 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
6452 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
6453 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
6454 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
6455 * tests/sum/basic-1, tests/seq/basic: Likewise.
6457 * tests/misc/Makefile.am (TESTS): Add split-fail.
6458 * tests/misc/split-fail: New file.
6460 * src/split.c: Rename local variables: nchars -> n_bytes.
6461 (lines_split): Rename local, nlines -> n_lines.
6462 (main): Rename local variable: s/accum/n_units/.
6463 (main): Use STDIN_FILENO, not literal `0'.
6465 2003-04-07 Jim Meyering <jim@meyering.net>
6467 * src/stat.c: Add #include directives for Ultrix 4.4.
6468 Based on a suggested change from Bert Deknuydt.
6470 2003-04-06 Jim Meyering <jim@meyering.net>
6472 * Makefile.maint (makefile-check): New rule.
6473 (local-check): Add it.
6475 2003-04-05 Jim Meyering <jim@meyering.net>
6477 * Makefile.am (nearly all of them):
6478 Use $(VAR) rather than @VAR@, now that we can rely on automake to
6479 emit a definition for each substituted variable.
6480 * tests/Makefile.am.in: Likewise.
6482 * tests/rm/rm5: Add a comment explaining why this test fails when
6483 using Tru64's broken sed.
6484 * tests/rm/rm3: Likewise.
6486 Make `kill -t' output signal descriptions (not `?') on Tru64.
6487 * src/kill.c (sys_siglist): Also check for __sys_siglist.
6488 Patch by Tony Leneis.
6489 * configure.ac: Also check for declaration of __sys_siglist.
6490 Required for Tru64 4.0D, 4.0F, and 5.1.
6491 Reported by Tony Leneis.
6493 2003-04-04 Jim Meyering <jim@meyering.net>
6495 * src/Makefile.am (PERL): Remove unnecessary definition.
6497 Because of inappropriate (but POSIX-mandated) behavior of rename,
6498 `mv a b' would not remove `a' in some unusual cases. Work around
6499 this by unlinking `a' when necessary.
6501 * src/copy.c (same_file_ok): Add an output parameter.
6502 Set it in the offending case.
6503 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
6504 Reported by Ed Avis.
6505 * tests/mv/hard-4: New test for the above.
6506 * tests/mv/Makefile.am (TESTS): Add hard-4.
6508 Clean up rules for automatically generated sources:
6509 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
6510 Make each generated file be read-only.
6511 Add each file name to BUILT_SOURCES separately.
6512 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
6514 Put LOCALEDIR macro definition in new file: localedir.h.
6515 * src/Makefile.am (DEFS): Remove definition.
6516 (localedir.h): New rule.
6517 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
6518 * src/system.h: Include "localedir.h".
6520 2003-04-02 Jim Meyering <jim@meyering.net>
6524 * tests/misc/Makefile.am (TESTS): Add false.
6526 * Makefile.maint (TMPDIR): Make sure it's defined.
6527 (my-distcheck): Build in $(TMPDIR), not `.'.
6529 * src/Makefile.am (false.c): Change all occurrences of
6530 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
6531 unsuccessfully also with --help. Reported by Paul Jarc,
6532 * tests/misc/false: New test for the above.
6534 2003-03-30 Jim Meyering <jim@meyering.net>
6536 * NEWS: Note the location of older NEWS files.
6538 * src/remove.c (is_empty_dir): Don't let a failing closedir
6539 clobber errno. Spotted by Arnold Robbins.
6541 * src/env.c: Fix typo in comment. From Arnold Robbins.
6543 2003-03-29 Jim Meyering <jim@meyering.net>
6547 * README: Note to expect build problems for stat.c on Ultrix 4.3.
6548 Note that there are some harmless test failures when running
6549 `make check' as root on some systems.
6551 2003-03-28 Jim Meyering <jim@meyering.net>
6553 * tests/stty/row-col-1: Skip this test if stty can't get window size.
6554 This happens when connecting to sparc-solaris5.7 via ssh from within
6555 emacs. Reported by Karl Berry.
6557 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
6558 Otherwise, on systems (DJGPP) that emulate pipes using files,
6559 this test would never complete, waiting for `yes' to terminate.
6560 * tests/du/slink: As above, use seq, not `yes' to generate link target.
6561 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
6562 Reported by Rich Dawe.
6564 2003-03-27 Jim Meyering <jim@meyering.net>
6566 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
6567 from `written by...' comment, at his request.
6569 2003-03-24 Paul Eggert <eggert@twinsun.com>
6571 Fix buffer overrun problem reported by TAKAI Kousuke, along
6572 with some other POSIX incompatibilities.
6574 * src/printf.c (print_esc): Do not treat \x specially if
6575 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
6576 in backslash. Treat incomplete escape sequences as strings
6577 of characters, as POSIX requires.
6578 (print_formatted): Allow multiple flags. Avoid buffer overrun
6579 if the format is incomplete.
6581 2003-03-24 Jim Meyering <jim@meyering.net>
6583 * tests/misc/printf: Add tests for the above fixes and changes.
6585 2003-03-26 Jim Meyering <jim@meyering.net>
6587 * src/copy.h (struct cp_options): Add a comment.
6589 2003-03-23 Jim Meyering <jim@meyering.net>
6591 * README: Describe problem with 64-bit mode on HPUX 11.x,
6592 with patch for /usr/include/inttypes.h.
6593 * TODO: Plan to add an autoconf test to work around the bug.
6595 2003-03-22 Jim Meyering <jim@meyering.net>
6597 * src/stat.c: Don't include <sys/sysmacros.h>.
6598 That is already done via system.h. Otherwise, the multiple
6599 inclusion would evoke redefinition warnings from Cray's /bin/cc,
6600 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
6601 (human_fstype): Factor some directives `up', out of this function.
6602 Cast away `const' to avoid error from Cray's /bin/cc.
6604 2003-03-20 Jim Meyering <jim@meyering.net>
6606 * announce-gen (print_changelog_deltas): Ensure that a newline
6607 precedes each row of `*'s.
6609 2003-03-20 Jim Meyering <jim@meyering.net>
6613 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
6614 format flag characters.
6615 Do not require that a field width be specified.
6616 Do not fail when given a field width of `0'.
6617 Reported by Dan Jacobson.
6618 * tests/seq/basic: Add new tests for the above-fixed bug.
6620 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
6621 (install-root): Likewise.
6622 (install-exec-local): Likewise.
6623 Based on a patch from Richard Dawe.
6625 2003-03-19 Jim Meyering <jim@meyering.net>
6627 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
6628 because the DJGPP 2.03 port of 'ln -s' doesn't work.
6629 Include $(EXEEXT) in program names.
6630 Since $(LN_S) may degenerate to `cp -p', be careful
6631 to invoke it from the destination directory.
6632 Mostly from Richard Dawe.
6633 * configure.ac: Use AC_PROG_LN_S.
6635 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
6636 CDPATH shell variable set could cause this test to fail.
6637 Reported by Karl Berry.
6639 2003-03-18 Jim Meyering <jim@meyering.net>
6641 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
6642 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
6643 AIX 5.1's xlc could not compile the former.
6644 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
6646 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
6648 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
6649 program names, since automake only adds $(EXEEXT) to programs
6652 2003-03-16 Jim Meyering <jim@meyering.net>
6654 * src/remove.c (rm): Put two local variables in static storage,
6655 so they can't be clobbered by the potential longjmp.
6657 2003-03-15 Jim Meyering <jim@meyering.net>
6659 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
6660 so that a version number with a two-digit component can still count
6661 as an alpha release. Reported by Richard A Downing.
6662 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
6664 2003-03-14 Jim Meyering <jim@meyering.net>
6666 * src/ansi2knr.c: Remove no-longer-used file.
6667 * src/ansi2knr.1: Likewise.
6669 * Makefile.maint (prev_version_file): Don't use ?= for this particular
6670 assignment, since it causes trouble with old versions of GNU make
6671 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
6672 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
6673 Patch from Alexandre Duret-Lutz.
6675 * Use patched automake-1.7.3. Regenerate Makefile.in files in
6676 subdirectories so that each includes a definition of ACLOCAL_M4.
6678 * announce-gen (main): Label the compressed source URLs.
6682 * tests/du/slink: Relax the test for the `local'ness of a file system,
6683 so that now it works also for tmpfs.
6685 * tests/du/hard-link: Transform output from first du, so that this
6686 test doesn't fail on file systems like tmpfs that order directory
6687 entries differently.
6689 2003-03-13 Jim Meyering <jim@meyering.net>
6691 * tests/du/8gb: Work around what appears to be an NFS failure that
6692 would make this test fail on some systems.
6694 2003-03-11 Jim Meyering <jim@meyering.net>
6696 * tests/du/basic: Make the test file exactly 4k bytes long.
6698 * src/split.c (longopts): Don't hard-code `2' here.
6699 Instead, just specify `&verbose', and ...
6700 (main): ... remove the `case 2:' block for --verbose.
6702 * tests/du/basic: Make the test file larger than 64 bytes, so that
6703 we don't immediately disqualify file systems (e.g., NetApp) on which
6704 smaller files take up zero disk blocks. Reported by Vin Shelton.
6706 2003-03-10 Jim Meyering <jim@meyering.net>
6708 Don't segfault for a negative field width or precision in format string.
6709 Note that this is just a stopgap fix. The longer term solution may
6710 involve adapting bash's builtins/printf.def.
6712 * src/printf.c: (UNSPECIFIED): Define.
6713 (print_direc): Use the special value, UNSPECIFIED, to indicate
6714 that field_width or precision has not been specified.
6715 (print_formatted): Fail if field_width or precision is the
6716 special value, UNSPECIFIED.
6717 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
6719 * src/sys2.h (INT_MIN): Define, if necessary.
6720 * tests/misc/printf: Add a test for the above-fixed bug.
6722 2003-03-09 Jim Meyering <jim@meyering.net>
6724 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
6725 changing its sign. This avoids a warning from gcc on 64-bit systems.
6726 Reported by Bob Proulx.
6727 (pop_dir): Reverse order of sign change and cast, to be consistent
6730 2003-03-08 Jim Meyering <jim@meyering.net>
6732 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
6733 shell variable, but only in the environment. With /bin/sh->bash, the
6734 shell variable is set to `y', and that would cause a spurious warning.
6735 Reported by Bob Proulx.
6737 * tests/Makefile.am (check-root): Remove touch/fifo.
6738 It doesn't appear to have to be run as root.
6740 * tests/rm/fail-2eperm: Rather than simply using the first non-root
6741 user name, make sure that the selected user name has a usable shell.
6742 Reported by Paul Jarc.
6744 Before, when using shred on a device, one had to specify --exact,
6745 or be careful to choose a size that would not be rounded up and
6746 exceed the maximum value; that could result in a failure of
6748 * src/shred.c (do_wipefd): --exact is now the default for non-regular
6749 files. Suggestion from Ben Elliston.
6752 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
6753 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
6754 Patch by Bob Proulx.
6756 * src/Makefile.am (check-misc): Check for use of `defined' in
6758 Change to $(srcdir) before running grep.
6760 * src/sleep.c: Remove now-unused #include and #define directives.
6762 * src/du.c (process_file): If a file's size is not being counted
6763 e.g., because it's a hard link to a file we've already counted,
6764 then don't print a line for it.
6766 * tests/du/hard-link: New test for the above-fixed bug.
6767 * tests/du/Makefile.am (TESTS): Add hard-link.
6770 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
6771 and make the two-array approach work.
6773 * tests/du/basic: Correct/add tests for the above fix.
6774 Set LC_ALL, etc., now that we use sort.
6775 Check the block/size of a small file, too.
6776 Correct expected results for simple dir1/dir2/file case.
6777 Add another test of du -S.
6779 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
6781 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
6782 middle-end/9986). As one of GCC's optimizations, it transforms a
6783 fputs_unlocked call to a fputc_unlocked call when the string is
6784 one character long. However, hpux doesn't have fputc_unlocked.
6786 * expr.c (usage): Use putchar, not fputs, to output a single character.
6787 * ls.c (dired_dump_obstack): Likewise.
6788 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
6789 * stat.c (print_it): Likewise.
6791 2003-03-07 Jim Meyering <jim@meyering.net>
6793 * src/cp.c: Remove everything associated with mmap-stack.c.
6794 This reverts the two changes of 2003-02-21.
6795 * src/du.c: Remove everything associated with mmap-stack.c.
6796 This reverts the change of 2003-02-19.
6798 2003-03-06 Jim Meyering <jim@meyering.net>
6800 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
6801 CDPATH shell variable set could cause this test to fail.
6802 Reported by Karl Berry.
6804 2003-03-05 Jim Meyering <jim@meyering.net>
6808 * src/printf.c (print_esc): Remove pointless comparison of unsigned
6809 integer with zero, to avoid a warning from Intel's ecc.
6810 Reported by Nelson Beebe.
6812 * src/du.c (process_file): Sizes must all be of type uintmax_t.
6813 Otherwise, for files or totals that are too big, numbers would
6814 be truncated. Patch mostly by Michael Stone.
6815 Reported by Ingo Saitz as Debian bug #183210.
6817 * tests/du/8gb: New test for the above-fixed bug.
6818 * tests/du/Makefile.am (TESTS): Add 8gb.
6820 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
6821 rather than UTILS_OPEN_MAX - 10.
6823 2003-03-04 Jim Meyering <jim@meyering.net>
6825 * README: Refer new feature discussion to bug-coreutils@gnu.org,
6826 rather than bug-gnu-utils, now that the former is better known.
6827 Suggestion from Göran Uddeborg.
6829 * src/stat.c (usage): Capitalize consistently.
6830 Reported by Göran Uddeborg.
6832 * Makefile.maint (rel-files): Include $(signatures), so that
6833 those files are also copied into $(release_archive_dir).
6835 * src/df.c (find_mount_point): Call error here, now that restore_cwd
6837 * src/remove.c (AD_pop_and_chdir): Likewise.
6839 * tests/Makefile.am (check-root): Add fail-2eperm.
6841 2003-03-03 Jim Meyering <jim@meyering.net>
6843 * src/remove.c (remove_cwd_entries): Include the full filename of
6844 the offending file, not just the basename.
6846 * tests/misc/tty-eof: Set $ME properly.
6848 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
6849 Remove now-unused variables.
6850 (tag-prev-version, prev-cvs-tag): Likewise.
6852 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
6853 accurate diagnostic when failing to remove a file owned by some other
6854 user. Reported by Ivo Timmermans via Michael Stone.
6855 This fixes Debian bug# 178471.
6857 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
6858 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
6859 Based on a report from Ivo Timmermans.
6861 2003-03-02 Jim Meyering <jim@meyering.net>
6863 * src/copy.c (copy_internal) [un_backup]: When recovering from a
6864 failure to create a hard link, do not remove the entry associating
6865 the source dev/ino with the destination file name.
6866 * tests/mv/Makefile.am (TESTS): Add hard-3.
6867 * tests/mv/hard-3: New test, for the above-fixed bug.
6868 Inspired by a report from Iida Yosiaki.
6870 2003-03-01 Jim Meyering <jim@meyering.net>
6872 * src/df.c (print_header): Don't embed spaces in a separate `Type'
6873 header string. Instead, put `Filesystem' and `Type' headers in the
6874 same string, so translators can use horizontal space as needed.
6875 Reported by Jean Charles Delepine.
6877 2003-02-28 Jim Meyering <jim@meyering.net>
6879 * src/copy.c (copy_internal): When link fails because of an
6880 existing destination file, unlink that file and try again.
6881 Reported by Iida Yosiaki.
6883 * tests/mv/Makefile.am (TESTS): Add hard-2.
6884 * tests/mv/hard-2: New test for the above-fixed bug.
6885 Based on a test case from Iida Yosiaki.
6887 2003-02-26 Jim Meyering <jim@meyering.net>
6889 * tests/du/basic: Don't test du's -b option here. Directory byte
6890 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
6891 and IBM AIX 4.2. Reported by Nelson Beebe.
6893 2003-02-25 Jim Meyering <jim@meyering.net>
6895 * Makefile.maint (announcement): Now that ChangeLog entries
6896 are output by announce-gen, don't do it here.
6897 * announce-gen (print_changelog_deltas): New function.
6900 2003-02-22 Jim Meyering <jim@meyering.net>
6902 * announce-gen: New option: --release-type=TYPE
6903 * Makefile.maint (beta, major): New targets. Remove `release'.
6904 Put them all together on a line.
6905 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
6906 invocation of `announcement'.
6907 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
6909 * announce-gen: New option: --news=NEWS_FILE.
6910 Extract NEWS entries here, not via rules in Makefile.maint.
6911 * Makefile.maint (announcement): Now that NEWS entries are
6912 extracted by announce-gen, don't do it here.
6913 (news-r1, news-r2): Remove now-unused definitions.
6915 2003-02-21 Jim Meyering <jim@meyering.net>
6919 Merge in changes from autoconf's version of this file.
6920 * Makefile.maint (www-gnu): Define.
6921 (standards.texi-url_prefix): Use $(www-gnu).
6922 (make-stds.texi-url_prefix): Likewise.
6924 * src/cp.c: Include "mmap-stack.h".
6925 (main): Invoke `run' through a macro that (when possible) runs it
6926 with a large, mmap'd stack.
6928 * src/cp.c (run): New function, preparing for the above.
6929 Exit from this function, not from main
6932 * src/du.c: New option: --apparent-size.
6933 (enum) [APPARENT_SIZE_OPTION]: New member.
6934 (long_options): Add it.
6935 (usage): Describe it.
6937 ['b']: Set apparent_size.
6938 David Eisner reported that the behavior of --bytes had changed.
6939 Paul Eggert proposed the use of a new option, --apparent-size.
6941 * src/du.c (apparent_size): New global.
6942 (print_only_size): Reflect the fact that we're printing byte counts,
6943 not ST_NBLOCKSIZE-byte-block counts.
6944 (print_size): Call print_only_size rather than duplicating its code.
6945 (process_file): Accumulate byte counts, rather than block counts.
6947 * src/du.c (process_file): Always reset size_to_propagate_to_parent
6948 for --separate-dirs (-S).
6950 2003-02-20 Jim Meyering <jim@meyering.net>
6952 * Use automake-1.7.3. Regenerate dependent files.
6954 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
6955 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
6956 (usage) [%B]: Describe it.
6959 * src/du.c (process_file): Reorganize the code to use only
6960 one `sum' array, and change how -S works back to the way it was
6961 before 2003-01-31. Patch by Bruno Haible.
6963 * tests/du/basic: New test.
6964 * tests/du/Makefile.am (TESTS): Add basic.
6966 * tests/envvar-check: Add checks for the following:
6967 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
6969 * tests/Makefile.am: Rename phony target envvar-check to evar-check
6970 so as not to conflict with the distributed file by the same name.
6972 * src/du.c (process_file): Set info->skip before any possible return.
6974 Report correct usage for directories, not 0.
6975 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
6976 _before_ recording the dev/ino of a directory.
6977 Reported by Bruno Haible.
6979 Now, df always displays the device file name corresponding to the
6980 listed mount point under `Filesystem'. Before, for an unmounted
6981 block- or character-special file argument, it would display the
6982 command-line argument instead.
6983 * src/df.c (show_disk): Return a value indicating whether
6984 there was a match. Don't try to find a mount point here.
6985 (show_entry): If show_disk doesn't find a match, call show_point.
6987 2003-02-19 Jim Meyering <jim@meyering.net>
6989 * src/du.c: Include "mmap-stack.h".
6990 (du_files): Add prototype with ATTRIBUTE_NORETURN.
6991 Exit from this function, not from...
6993 Instead, if possible, invoke du_files through a macro that
6994 runs it with a large, mmap'd stack.
6996 * src/join.c (usage): Change wording in --help output:
6997 use FILENUM instead of `SIDE' and say what FILENUM means.
6998 Reported by Bernhard Gabler.
7000 * src/df.c (print_header): Rather than using a hard-coded literal
7001 string of spaces matching the length of the English `...Type' header,
7002 output the right number of spaces to match the selected translation.
7003 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
7005 * src/split.c (bytes_split): Remove unnecessary `else' after break.
7006 (lines_split): Likewise. and correct misleading indentation.
7008 * src/split.c: Include "full-read.h".
7009 (bytes_split, lines_split, line_bytes_split): Use full_read,
7010 not safe_read. The way split was using the latter, a short read
7011 could cause split to terminate before EOF.
7013 * tests/misc/tty-eof: Test all programs that can read stdin,
7014 requiring no arguments and that write to standard output.
7016 * tests/misc/tty-eof: New file. Renamed from ...
7017 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
7018 * tests/misc/Makefile.am (TESTS): Reflect renaming.
7020 2003-02-18 Jim Meyering <jim@meyering.net>
7022 cksum would perform an extra read after encountering EOF
7023 * src/cksum.c (cksum): Exit the loop upon EOF, too.
7024 Patch by Michael Bacarella.
7026 Test for the bug fixed today in cksum, md5sum, and sha1sum.
7027 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
7028 cat, cksum, md5sum, and sha1sum all in the same loop.
7030 2003-02-14 Jim Meyering <jim@meyering.net>
7032 * src/remove.c: Include "euidaccess.h".
7033 Remove declaration of euidaccess.
7035 2003-02-12 Jim Meyering <jim@meyering.net>
7037 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
7038 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
7040 2003-02-10 Jim Meyering <jim@meyering.net>
7042 * src/test.c: Don't include group-member.h.
7043 Include euidaccess.h.
7044 (eaccess): Rewrite function to set the real uid and gid temporarily
7045 to the effective uid and gid, then invoke 'access', and then set the
7046 real uid and gid back. On systems that lack setreuid or setregid,
7047 fall back on the kludges in euidaccess. Before, it would not work
7048 for e.g., files with ACLs, files that were marked immutable,
7049 or on file systems mounted read-only. Nelson Beebe raised the issue.
7050 Paul Eggert suggested the new implementation.
7052 2003-02-09 Jim Meyering <jim@meyering.net>
7054 * src/test.c (test_stat): Remove function. It's job is done (only
7055 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
7057 2003-02-08 Jim Meyering <jim@meyering.net>
7061 * tests/mv/part-symlink: Don't assume that the file owner username
7062 length is less than 9 in ls output: instead, omit that field
7063 altogether. Reported by, and suggested fix from, Ferdinand.
7065 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
7066 * tests/du/Makefile.am (TESTS): Add restore-wd.
7068 * src/rm.c: Correct now-invalid comment about cycle-detection.
7070 2003-02-06 Jim Meyering <jim@meyering.net>
7072 * NEWS: Add entries from old/*/NEWS
7073 from fileutils-4.1 through 4.1.11 and
7074 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
7078 * src/du.c (process_file): Don't return early for excluded files
7079 or for files whose dev/inode we've already seen.
7081 2003-02-05 Jim Meyering <jim@meyering.net>
7083 * tests/du/exclude: New file.
7084 * tests/du/Makefile.am (TESTS): Add exclude.
7086 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
7088 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
7089 Fix memory allocation arithmetic.
7091 2003-02-04 Jim Meyering <jim@meyering.net>
7093 `df /dev/block-or-char-device-file--not-mounted' now reports
7094 the name of the file system on which the file resides, usually `/'.
7095 Before, it would leave the `Mounted on' field blank.
7096 * src/df.c (show_disk): Move function to precede find_mount_point.
7097 (show_disk): Add parameter: STATP.
7098 If we don't find a matching device name, then resort to calling
7099 find_mount_point. Reported by Bob Proulx.
7101 2003-02-03 Andreas Schwab <schwab@suse.de>
7103 * tests/rm/cycle: Require non-root.
7104 * tests/rm/isatty: Likewise.
7106 2003-02-02 Jim Meyering <jim@meyering.net>
7110 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
7112 Ensure that there are no offending uses of `:'.
7113 * Makefile.maint (makefile_path_separator_check): New rule.
7114 (local-check): Add it to the list.
7116 2003-02-01 Jim Meyering <jim@meyering.net>
7118 * src/du.c (MAX_N_DESCRIPTORS): Define.
7120 * src/stat.c (G_fail): New global.
7121 (human_time): Diagnose failed localtime, not failed nstrftime.
7122 (main): Fail if G_fail is set.
7124 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
7126 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
7127 hard-coding the path-separator. Also double-quote the new PATH,
7128 to avoid problems when the path-separator is a semi-colon or when
7129 `pwd` contains e.g. a space.
7130 * tests/chgrp/Makefile.am: Likewise.
7131 * tests/chmod/Makefile.am: Likewise.
7132 * tests/chown/Makefile.am: Likewise.
7133 * tests/cp/Makefile.am: Likewise.
7134 * tests/dd/Makefile.am: Likewise.
7135 * tests/dircolors/Makefile.am: Likewise.
7136 * tests/du/Makefile.am: Likewise.
7137 * tests/expr/Makefile.am: Likewise.
7138 * tests/factor/Makefile.am: Likewise.
7139 * tests/fmt/Makefile.am: Likewise.
7140 * tests/install/Makefile.am: Likewise.
7141 * tests/ln/Makefile.am: Likewise.
7142 * tests/ls/Makefile.am: Likewise.
7143 * tests/ls-2/Makefile.am: Likewise.
7144 * tests/md5sum/Makefile.am: Likewise.
7145 * tests/misc/Makefile.am: Likewise.
7146 * tests/mkdir/Makefile.am: Likewise.
7147 * tests/mv/Makefile.am: Likewise.
7148 * tests/od/Makefile.am: Likewise.
7149 * tests/rm/Makefile.am: Likewise.
7150 * tests/rmdir/Makefile.am: Likewise.
7151 * tests/seq/Makefile.am: Likewise.
7152 * tests/sha1sum/Makefile.am: Likewise.
7153 * tests/shred/Makefile.am: Likewise.
7154 * tests/stty/Makefile.am: Likewise.
7155 * tests/sum/Makefile.am: Likewise.
7156 * tests/tail-2/Makefile.am: Likewise.
7157 * tests/touch/Makefile.am: Likewise.
7158 * tests/tsort/Makefile.am: Likewise.
7159 * tests/unexpand/Makefile.am: Likewise.
7161 2003-01-31 Jim Meyering <jim@meyering.net>
7163 * src/stat.c: Include "file-type.h"
7164 (print_human_type): Remove function.
7165 (human_access): Rename from print_human_access. Return a string.
7166 (human_time): Rename from print_human_time. Return a string.
7167 (print_stat): Arrange so that field width and an alignment specifier
7168 are honored for the %A, %F, %x, %y, and %z formats.
7169 [%F]: Use file_type; this gives slightly different file type strings,
7170 e.g., `directory' instead of `Directory' and `regular file' or
7171 `regular empty file' instead of `Regular file'.
7172 Prompted by a report from Richard Dawe that the uses of
7173 S_IFSOCK and S_IFIFO in print_human_time were not portable
7174 to systems using e.g., DJGPP.
7176 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
7178 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
7179 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
7181 2003-01-31 Jim Meyering <jim@meyering.net>
7183 * src/du.c (main): Upon processing an invalid option or an invalid
7184 --exclude-from or --max-depth option argument, don't exit right away,
7185 in case there are others. Rather record the failure and exit after
7186 processing other options.
7188 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
7189 tar archive easier to reproduce.
7191 Rewrite to perform directory traversal using nftw.
7193 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
7194 (AUTHORS): Add self.
7195 (opt_one_file_system): Move global into `main'.
7196 (path, xstat, exit_status): Remove declarations.
7197 (arg_length, suffix_length): New globals.
7198 (G_fail): New global, sort of like the old `exit_status'.
7199 (IS_FTW_DIR_TYPE): Define.
7200 (print_only_size): New function.
7201 (process_file): New function.
7202 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
7203 (str_trunc, pop_dir, count_entry): Likewise.
7204 (du_files): Rewrite to use nftw.
7206 2003-01-30 Jim Meyering <jim@meyering.net>
7208 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
7209 symlink-to-directory with -L, even without the trailing slash.
7211 2003-01-27 Jim Meyering <jim@meyering.net>
7213 * src/Makefile.am (check-misc): Check for st_blocks, too.
7215 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
7216 Reported by Richard Dawe.
7218 2003-01-27 Andreas Schwab <schwab@suse.de>
7220 * src/ls.c (quote_name): Add fourth parameter, width, into which to
7221 store the screen columns, and return the number of bytes instead.
7222 (print_dir): Pass NULL as fourth parameter of quote_name.
7223 (print_name_with_quoting): Likewise.
7224 (length_of_file_name_and_frills): Get the width from the fourth
7225 parameter of quote_name instead of return value.
7227 2003-01-27 Jim Meyering <jim@meyering.net>
7229 * src/ls.c (decode_switches): If `dired' is set without
7230 `format == long_format', then silently reset dired. This doesn't
7231 change the behavior of ls (all prior uses of dired were protected
7232 by `&& format == long_format'), and lets us...
7233 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
7234 (PUSH_CURRENT_DIRED_POS): Likewise.
7237 2003-01-22 Jim Meyering <jim@meyering.net>
7239 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
7240 * tests/du/Makefile.am (TESTS): Add no-x.
7242 2003-01-21 Jim Meyering <jim@meyering.net>
7244 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
7245 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
7246 it may still be a directory -- or not (e.g., with FreeBSD on an
7247 NFS-mounted file system), so resort to calling lstat to find out.
7248 Based on a patch by Michael van Elst.
7250 * tests/cp/same-file: Don't assume that the file owner username
7251 length is less than 9 in ls output: instead, omit that field
7252 altogether. Reported by, and suggested fix from, Ferdinand.
7254 2003-01-20 Jim Meyering <jim@meyering.net>
7256 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
7257 large format widths no longer cause strftime to infloop.
7259 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
7261 2003-01-19 Jim Meyering <jim@meyering.net>
7263 * src/readlink.c: Include "canonicalize.h".
7265 2003-01-18 Jim Meyering <jim@meyering.net>
7267 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
7269 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
7270 (long_options): Add option --dereference-command-line-symlink-to-dir.
7271 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
7272 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
7273 -d, -F, -l options is specified.
7274 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
7275 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
7276 Change --dereference-command-line (-H) to dereference *all*
7277 command line arguments, including broken symlinks.
7279 2003-01-15 Paul Eggert <eggert@twinsun.com>
7281 Change ls -H back to the way it was yesterday, since this is
7282 compatible with FreeBSD and the POSIX spec is confusing
7283 and somewhat contradictory.
7285 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
7286 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
7287 (long_options): Change the long option name back.
7288 (usage): Change the usage back.
7289 (gobble_file): When -H is specified, dereference a top-level
7290 arg even if it points to a non-directory.
7292 2003-01-15 Jim Meyering <jim@meyering.net>
7294 * src/ls.c (gobble_file): Fall back on using lstat when required:
7295 when --dereference (-L) is not specified, and
7296 - when operating on a dangling symlink
7297 - when operating on command-line-symlink-to-directories
7298 This fixes numerous problems. Here are examples:
7299 - `ls dangling-symlink' would fail with `no such file...'
7300 Now it prints `dangling-symlink'.
7301 - `ls -i symlink' would mistakenly print the inode of the referent.
7302 Now it prints the inode of the symlink. Likewise for --size (-s).
7303 Based on a patch from Michael Stone.
7304 Reported by Deepak Goel as Debian bug #173793.
7306 Rename ls's --dereference-command-line (-H)
7307 option to --dereference-command-line-symlink-to-dir.
7308 * src/ls.c [enum Dereference_symlink]
7309 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
7310 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
7311 (long_options): Rename the long option.
7312 (usage): Say that --dereference-... changes how ls treats
7313 only symlinks to directories specified on the command line.
7315 2003-01-14 Jim Meyering <jim@meyering.net>
7317 * tests/ls/dangle: New file/test, for the above fix.
7318 * tests/ls/inode: Another new file/test, for the above fix.
7319 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
7321 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
7322 so that ls --color would no longer highlight the names of files with
7323 the execute bit set when not specified on the command line.
7324 Patch by Michael Stone. Reported by Stephen Depooter as
7327 * tests/ls-2/tests (color-exe): New test, for the above fix.
7329 2003-01-13 Jim Meyering <jim@meyering.net>
7331 * tests/shred/exact: Also test for just fixed bug with --zero.
7333 * src/shred.c (long_opts): --zero does not require an argument.
7334 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
7336 2003-01-12 Jim Meyering <jim@meyering.net>
7338 * Makefile.maint (cvs-update): Skip any file with local modifications.
7340 * src/unexpand.c (usage): Document --first-only and mention that
7341 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
7343 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
7345 * src/df.c: Include "canonicalize.h".
7346 Use canonicalize_file_name unconditionally.
7348 2003-01-09 Jim Meyering <jim@meyering.net>
7350 * README: Add readlink.
7352 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
7354 * src/df.c: Include "xgetcwd.h".
7355 * src/pwd.c: Likewise.
7357 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
7359 * src/shred.c: Remove declaration of xstrdup.
7360 We already get it via xalloc.h which is included via system.h.
7362 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
7364 New program: readlink.
7366 * src/Makefile.am (bin_PROGRAMS): Add readlink.
7367 * src/readlink.c: New file.
7369 * man/readlink.x: New file.
7370 * man/Makefile.am (dist_man_MANS): Add readlink.1.
7371 (readlink.1): New rule.
7373 2003-01-09 Jim Meyering <jim@meyering.net>
7375 When selecting ranges of byte offsets (as opposed to ranges of fields)
7376 and when --output-delimiter=STRING is specified, output STRING between
7377 ranges of selected bytes.
7378 * src/cut.c (RANGE_START_SENTINEL): Define.
7379 (output_delimiter_specified): New global.
7380 (print_kth): Add parameter. Adjust all callers.
7381 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
7382 (cut_bytes): When requested, output STRING between ranges of
7384 (main): Make a diagnostic a little clearer.
7385 Based on a patch from Jan Nieuwenhuizen.
7387 * tests/cut/Test.pm: New tests for the above.
7389 * src/cut.c (set_fields): Make code agree with comment:
7390 Don't merge abutting ranges like 4- and 2-3. This makes no
7391 difference currently, but is required to support an upcoming change.
7393 2003-01-07 Jim Meyering <jim@meyering.net>
7395 * src/cut.c (set_fields): Fix typo in comment.
7397 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
7398 * tests/touch/Makefile.am (TESTS): Add not-owner.
7399 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
7400 Now, this tests only the nonexistent-directory diagnostic.
7401 Suggestion from Michael Stone.
7403 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
7405 2003-01-04 Jim Meyering <jim@meyering.net>
7407 * src/copy.h: Remove use of PARAMS.
7408 * src/remove.h: Likewise.
7409 * src/chown-core.h: Likewise.
7411 rm could be tricked into mistakenly reporting a cycle.
7412 * src/remove.c: [cycle_check_state]: New global.
7413 (remove_cwd_entries): Adapt to new semantics of cycle_check.
7414 (rm): Call cycle_check_init and cycle_check_free for each file.
7415 * tests/rm/cycle (rm): New test, for the above fix.
7416 * tests/rm/Makefile.am (TESTS): Add cycle.
7418 When rm detects a cycle, don't abort the entire command,
7419 but rather just the affected command line argument.
7420 * src/remove.c: Include <setjmp.h>
7421 (struct dirstack_state) [current_arg_jumpbuf]: New member.
7422 (remove_cwd_entries): Call longjmp if we detect a cycle.
7423 (rm): Call setjmp here.
7425 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
7426 Instead, include cycle-check.h and use it.
7428 * src/remove.h (struct dev_ino): Remove declaration.
7430 * src/remove.c (remove_cwd_entries): Fix typos in comment.
7432 Don't include trailing /. in diagnostics about directories.
7433 * src/remove.c (full_filename_): When FILENAME is just `.'
7434 and there is a nonempty directory-name part, don't append `/.'.
7435 * tests/rm/unread2: Remove trailing /. from diagnostic.
7436 * tests/rm/rm2: Likewise.
7438 * src/remove.c (struct dirstack_state): Define.
7439 To be used in place of these file-scoped globals ...
7440 (dir_stack, len_stack, Active_dir): Remove globals.
7441 (ds_init, ds_free): New functions.
7442 (full_filename): Define.
7443 (full_filename_): Rename from full_filename.
7445 Begin to make AD_* functions more generic.
7446 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
7447 (AD_push): Likewise.
7448 (AD_INIT_OTHER_MEMBERS): Define.
7449 (remove_dir): Define the `status' member manually after each
7450 call to AD_push or AD_push_initial.
7452 * src/Makefile.am (check-misc): New rule, to ensure that no more
7453 S_IS* macro definitions sneak into the code.
7454 (check): Depend on check-misc.
7456 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
7457 * src/du.c (count_entry) [S_ISLNK]: Don't define.
7458 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
7460 2003-01-03 Jim Meyering <jim@meyering.net>
7462 * src/true.c: Add copyright.
7463 (AUTHORS): I suppose I've written it.
7465 * src/Makefile.am (false.c): Make the generated file be read-only.
7467 2003-01-04 Jim Meyering <jim@meyering.net>
7469 * src/ls.c: Include "dev-ino.h".
7470 [struct dev_ino]: Remove declaration.
7472 2003-01-02 Jim Meyering <jim@meyering.net>
7474 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
7475 from mv: s/missing file arguments/missing file argument/.
7476 With --target-directory=DIR, cp and mv work with a single file argument.
7477 Reported by Karl Berry.
7479 * tests/rm/isatty: Enable this test.
7481 2002-12-31 Jim Meyering <jim@meyering.net>
7483 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
7484 (AD_push): Likewise.
7485 (AD_INIT_OTHER_MEMBERS): Define.
7486 (remove_dir): Define the `status' member manually after each
7487 call to AD_push or AD_push_initial.
7489 * src/ls.c [struct dev_ino]: Remove definition.
7490 Include "dev-ino.h" instead.
7492 2002-12-28 Jim Meyering <jim@meyering.net>
7494 * tests/du/Makefile.am (TESTS): Add no-deref.
7495 * tests/du/no-deref: New script.
7497 2002-12-23 Jim Meyering <jim@meyering.net>
7499 * src/remove.c (remove_cwd_entries): Fix typo in comment.
7501 2002-12-21 Jim Meyering <jim@meyering.net>
7503 * announce-gen: Generate MML-formatted announcement.
7504 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
7506 2002-12-20 Jim Meyering <jim@meyering.net>
7508 * src/touch.c (touch): Change the wording of a diagnostic so
7509 that it makes sense both when the file exists and when it doesn't.
7510 Suggestion from Michael Stone.
7512 2002-12-18 Jim Meyering <jim@meyering.net>
7514 * src/stty.c (valid_options): Declare to be static.
7516 2002-12-15 Jim Meyering <jim@meyering.net>
7518 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
7520 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
7521 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
7522 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
7523 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
7524 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
7526 * src/remove.c (PARAMS): Remove definition.
7527 * src/sys2.h: Likewise.
7529 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
7530 Include strftime.h instead.
7532 2002-12-14 Jim Meyering <jim@meyering.net>
7534 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
7536 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
7537 This is necessary at least for Irix6.5 when using c89.
7538 Reported by Nelson Beebe.
7540 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
7542 * tests/misc/cat-tty-eof: New test.
7544 * src/mknod.c (usage): Specify how major and minor mode numbers
7545 are interpreted. Report forwarded by Kristin E Thomas.
7546 * src/mknod.c: Remove now-redundant usage-specifying comment.
7548 2002-12-13 Jim Meyering <jim@meyering.net>
7552 * tests/du/trailing-slash: Allow for a directory of size `0'.
7553 That happens at least on file systems of type tmpfs on linux-2.4.18.
7555 * announce-gen: New script to begin replacing the commands
7556 associated with the rule here...
7557 * Makefile.maint (announcement): Invoke announce-gen.
7558 * Makefile.am (EXTRA_DIST): Add announce-gen.
7560 * tests/cp/preserve-2: New file/test, for latest fix.
7561 * tests/cp/Makefile.am (TESTS): Add preserve-2.
7563 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
7565 Fix a bug whereby cp would fail to parse an option like
7566 --preserve=mode,ownership.
7567 * src/cp.c (decode_preserve_arg): Advance `comma' to
7568 point the character following the comma.
7570 2002-12-11 Jim Meyering <jim@meyering.net>
7572 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
7573 in case it's already defined.
7575 2002-12-09 Jim Meyering <jim@meyering.net>
7577 * tests/touch/fail-diag: Don't get a test failure if /no exists.
7578 Instead, evoke a framework failure if /no-$$ exists.
7579 Reported by Michael Stone.
7581 2002-12-08 Jim Meyering <jim@meyering.net>
7583 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
7584 Define to rpl_lstat, so that even on systems like Solaris 5.8,
7585 du honors (per POSIX) the trailing slash on an argument referring
7586 to a symlink-to-directory.
7588 2002-12-06 Jim Meyering <jim@meyering.net>
7590 * Use autoconf-2.57. Regenerate dependent files.
7591 * Use automake-1.7.2. Regenerate dependent files.
7593 * src/ls.c (gobble_file): Also stat the file if it's a
7594 regular file and --indicator-style=classify (aka -F).
7595 Thanks to Ed Santiago for opening my eyes.
7597 * tests/ls/file-type: New file. Test for the above.
7598 A test to contrast ls -F and ls --indicator-style=file-type.
7599 * tests/ls/Makefile.am (TESTS): Add file-type.
7601 2002-12-04 Jim Meyering <jim@meyering.net>
7603 * tests/ls/follow-slink: Make sure the symlink was created.
7604 Richard Dawe reported that `ln -s link link' succeeds, but creates
7605 no file on systems running some version of the DJGPP libc.
7607 2002-12-03 Jim Meyering <jim@meyering.net>
7609 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
7610 since this package no longer panders to K&R compilers.
7612 2002-12-02 Jim Meyering <jim@meyering.net>
7614 * tests/du/slink: Skip this test if `.' is on a non-local file system.
7616 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
7617 something to replace.
7619 2002-12-01 Jim Meyering <jim@meyering.net>
7621 * src/stat.c: Don't include <string.h> or <ctype.h>.
7622 That's already done via system.h.
7623 * src/dircolors.c: Don't include <ctype.h>.
7625 2002-11-30 Jim Meyering <jim@meyering.net>
7627 * ls.c (gobble_file): Remove the block of code that caused
7628 `ls --color -F symlink-to-dir' to list the files in
7629 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
7630 like `ls -F symlink-to-dir') but with the addition of highlighting.
7631 Similarly, `ls --color -dF symlink-to-dir' would print
7632 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
7633 Reported by Jeff Sheinberg as Debian bug #168203.
7634 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
7636 ls is now more efficient: with certain options, it no longer needs
7637 to stat each directory entry on systems with valid dirent.d_type.
7638 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
7639 (main): Make --recursive set format_needs_type, not format_needs_stat.
7640 (gobble_file): Remove a FIXME comment, now that it's fixed.
7642 2002-11-24 Jim Meyering <jim@meyering.net>
7644 * src/du.c (du_files): Don't strip any trailing slash.
7645 Rewrite so that `/' is no longer represented internally as
7647 (count_entry): When appending a file name component,
7648 account for the fact that the current path may end in `/'.
7649 François Pinard reported that `du symlink-to-dir/' was not
7650 equivalent to `du symlink-to-dir/.'. Now it is.
7651 * tests/du/trailing-slash: New file/test, for the above fix.
7652 * tests/du/Makefile.am (TESTS): Add trailing-slash.
7654 2002-11-23 Jim Meyering <jim@meyering.net>
7656 * src/tac.c (output): Declare some local variables to be of type size_t,
7657 rather than `int' to avoid warnings from gcc.
7659 2002-11-21 Paul Eggert <eggert@twinsun.com>
7661 * src/ls.c (decode_switches): Use case-sensitive matching to
7662 decode the QUOTING_STYLE environment variable. This is more
7663 consistent with the documentation, and with --quoting-style.
7665 2002-11-21 Martin Buck <martin.buck@ascom.ch
7667 * src/stty.c (struct speeds): Add support for all baud rates defined
7670 2002-11-19 Jim Meyering <jim@meyering.net>
7672 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
7673 run in a UTF locale. Report and suggested fix by Bruno Haible.
7674 * tests/fmt/basic: Likewise.
7676 2002-11-17 Jim Meyering <jim@meyering.net>
7678 * configure.ac: Update via autoupdate.
7679 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
7681 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
7682 Reported by Hans Ginzel.
7684 2002-11-15 Jim Meyering <jim@meyering.net>
7686 * Makefile.cfg (gnu_rel_host): Define.
7687 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
7688 on whether $(VERSION) looks like a major release number.
7690 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
7691 (release): Rename from `alpha'.
7692 (alpha): Depend on release.
7694 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
7696 2002-11-14 Jim Meyering <jim@meyering.net>
7698 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
7699 (announcement): Use the new variable.
7701 * Makefile.maint: Sync with Bison, i.e.:
7702 (po-check): Scan .l and .y files instead of the
7703 .c and the .h files that they generate. This fixes the bug
7704 reported by Tim Van Holder in:
7705 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
7706 Look for N_ as well as for _. Try to avoid matching #define for
7710 2002-11-12 Jim Meyering <jim@meyering.net>
7712 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
7713 Replace sole use with equivalent `#ifdef S_ISLNK'.
7714 Inconsistency reported by Dmitry V. Levin.
7716 2002-11-11 Jim Meyering <jim@meyering.net>
7718 * src/stat.c (usage): Transform --help items output via s/ - / /,
7719 so that help2man produces properly formatted man pages.
7720 Reported by Herbert Xu as Debian bug #168400.
7722 2002-11-10 Jim Meyering <jim@meyering.net>
7724 * src/ls.c (sighandler): Handle SIGTSTP specially.
7725 Based on suggestions from Solar Designer and Dmitry V. Levin.
7728 * Makefile.cfg (cvs_files): Define. From autoconf.
7729 (local_updates): Likewise.
7731 * src/ls.c (restore_default_color_handler, sigtstp_handler):
7733 (sighandler): New function, based on the one in sort.c.
7734 (main): Use sigaction, if possible; otherwise signal.
7735 Handle these signals:
7736 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
7737 Don't register our handler if the signal is already being ignored.
7739 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
7740 * src/csplit.c (interrupt_handler): Likewise.
7741 * src/sort.c (sighandler): Likewise.
7742 (main): Declare `i' and `nsigs' to be unsigned, not int.
7744 2002-11-09 Jim Meyering <jim@meyering.net>
7746 ls --color: restore terminal text color upon signal.
7747 * src/ls.c: Include "full-write.h" and <signal.h>.
7748 (restore_default_color, restore_default_color_handler): New functions.
7749 (sigtstp_handler, put_indicator_direct): New functions.
7750 (main) [print_with_color]: Register signal handlers.
7751 Patch mostly by Solar Designer and Stanislav Ievlev.
7753 Update from autoconf.
7754 * Makefile.maint (AMTAR): Remove definition.
7755 (update, cvs-update, po-update, do-po-update): New rules.
7756 (wget-update): Update (thus renaming to cvs-update).
7757 (automake_repo): Use anoncvs@sources.redhat.com.
7759 2002-11-06 Jim Meyering <jim@meyering.net>
7761 * tests/misc/Makefile.am (TESTS): Add printf-hex.
7763 * tests/misc/printf: Be careful to test the code in this package,
7764 not the shell built-in function.
7766 * src/printf.c (print_esc): A hexadecimal escape sequence has
7767 at most two hex. digits, not three. Reported by Padraig Brady.
7768 (usage): Update description.
7769 * tests/misc/printf-hex: New file/test, for the above fix.
7771 2002-10-07 Paul Eggert <eggert@twinsun.com>
7773 Add support for locale-specific size indications (e.g.,
7774 thousands-separators) and for explicit size suffixes on output.
7776 * doc/coreutils.texi (Block size): Say that:
7777 This affects display format as well as block size.
7778 Fractional block counts are rounded up.
7779 ls file size blocksize defaults to 1.
7780 A block size spec preceded by ' generates thousands separators.
7781 A suffix without a preceding integer generates suffixes.
7782 (tail invocation): 32k -> 32 KiB.
7783 (What information is listed): ls -h is now equivalent to
7784 ls --block-size=human, and ls -H is now equivalent to
7785 ls --block-size=si. Displayed file size is now always affected by
7788 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
7789 lib/umaxtostr.c: New files, taken from GNU tar.
7791 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
7793 (EXTRA_DIST): Add inttostr.c.
7795 * lib/human.c, lib/human.h: Rewrite to support locale-specific
7796 notations like thousands separators.
7797 Specify what includer of include.h must include beforehand.
7798 (human_group_digits, human_suppress_point_zero, human_autoscale,
7799 human_base_1024, human_SI, human_B): New enum values.
7800 (human_readable): Rename from human_readable_inexact; put the
7801 options before the sizes. All uses changed. The old human_readable
7802 function has been removed; use inttostr.h instead.
7803 (human_options): Renamed from human_block_size, with new signature
7804 that allows block sizes up to UINTMAX_MAX. All callers changed.
7806 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
7807 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
7808 freestanding C89. No need to check for stdlib.h or string.h since
7809 autoconf does this now.
7811 * src/cksum.c (cksum): Use primitives from inttostr.h, not
7812 human.h, to print large numbers simply.
7813 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
7814 * src/dd.c (print_stats, main): Likewise.
7815 * src/df.c (print_header): Likewise.
7816 * src/factor.c (print_factors): Likewise.
7817 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
7818 * src/shred.c (dopass): Likewise.
7819 * src/sort.c (checkfp): Likewise.
7820 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
7821 * src/tail.c (xlseek): Likewise.
7822 * src/wc.c (write_counts, wc): Likewise.
7824 * src/df.c (human_output_opts): New var.
7825 (output_block_size): Now uintmax_t, not int, to handle larger
7826 block sizes. All uses changed.
7827 * src/du.c: Likewise.
7828 * src/ls.c: Likewise.
7830 * src/df.c (print_header): In the header line, prefer SI to human
7831 representation if it's shorter; if neither is shorter, try to
7832 intuit what the user would prefer.
7834 * src/expr.c (inttostr): Remove; use new imaxtostr library
7837 * src/ls.c (file_output_block_size): New var, to distinguish
7838 file sizes from other sizes.
7839 (decode_switches): Set it.
7841 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
7842 (dopass): When printing progress, use floor for what has been done
7843 so far (since we should be conservative there), and ceiling for
7844 what needs to be done (since that's what other programs use).
7846 2002-10-19 Jim Meyering <jim@meyering.net>
7848 * src/pinky.c (print_heading): Align TTY and Name headings.
7849 Reported by Karl Eichwalder.
7851 2002-10-18 Jim Meyering <jim@meyering.net>
7853 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
7854 Remove now-useless cast.
7855 (stdread): Remove function.
7856 (bytes_split): Use size_t instead of int.
7857 Use safe_read, not stdread.
7858 (lines_split): Likewise.
7859 Use memchr rather than a `while' loop.
7860 (line_bytes_split): Use size_t instead of int.
7861 Use safe_read, not stdread.
7862 (main): Add some FIXME comments to remind me to remove casts.
7864 * src/system.h (ST_BLKSIZE): Correct comment describing how to
7865 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
7867 2002-10-17 Jim Meyering <jim@meyering.net>
7869 Fix a problem that could make e.g., `cat' misbehave on systems which
7870 give invalid (unreasonably large) values for stat.st_blksize.
7871 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
7872 Reported by Petter Reinholdtsen.
7874 2002-10-14 Jim Meyering <jim@meyering.net>
7876 Specifying a printf conversion specifer as nl's separator string
7877 could cause nl to segfault.
7878 * src/nl.c (build_print_fmt): Don't include separator string
7879 in the printf format; it might contain `%'.
7880 Use a better bound on the length of the print_fmt buffer.
7881 (print_lineno): Print the separator here instead.
7882 Reported by Doug Coleman.
7884 * tests/misc/nl: New file/tests, including a test for the above.
7885 * tests/misc/Makefile.am (TESTS): Add nl.
7887 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
7888 * tests/misc/Makefile.am (TESTS): Add split-l.
7890 2002-10-13 Jim Meyering <jim@meyering.net>
7894 * src/du.c (usage): Tweak description of --dereference-args/-D.
7896 * src/du.c (count_entry): Also save cwd when dereferencing (via
7897 --dereference-args, -D) a command-line argument.
7898 Reported by Michal Svec. Based on a patch by Andreas Schwab.
7900 * src/Makefile.am (../AUTHORS): New target/rule.
7902 2002-10-12 Jim Meyering <jim@meyering.net>
7904 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
7905 of type size_t, since that's the way it's used and avoids a warning.
7907 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
7908 since that's how it's always used and avoids a new warning from gcc.
7909 (read_input): Adapt to new safe_read ABI.
7911 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
7914 * src/pinky.c (print_long_entry): fread returns size_t.
7915 Declare local `bytes' accordingly, to avoid warning.
7917 tail -c +N would perform an extra read after encountering EOF
7918 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
7919 * src/tail.c (start_bytes): Detect EOF, inform caller.
7920 (tail_bytes): Upon EOF in start_bytes, return immediately.
7921 (file_lines): Reorganize to use memrchr rather than an explicit loop.
7922 Adapt to new safe_read ABI.
7924 2002-10-11 Jim Meyering <jim@meyering.net>
7926 * tests/du/deref: New file/test, for the above fix.
7927 * tests/du/Makefile.am (TESTS): Add deref.
7929 2002-10-10 Jim Meyering <jim@meyering.net>
7931 * tests/ln/Makefile.am (TESTS): Add target-1.
7932 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
7934 2002-10-09 Jim Meyering <jim@meyering.net>
7936 * tests/cp/backup-is-src: Ensure that certain environment variables
7937 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
7939 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
7940 consume 4GB of disk space on systems without support for sparse files.
7941 Fix a logic error that'd make it `cat err' even though dd didn't fail.
7943 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
7944 Patch by steven@magelico.net, forwarded by Michael Stone.
7946 * tests/ls/dired: Ensure that ls produces English messages.
7947 Patch by Alexey Vyskubov, forwarded by Michael Stone.
7949 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
7951 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
7953 2002-10-08 Jim Meyering <jim@meyering.net>
7955 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
7956 Fix syntax in test: use =, not ==.
7957 Reported by Bob Proulx.
7958 Change all the rest like this: grep -lR "testing framework'" .\
7959 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
7961 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
7962 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
7963 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
7964 * src/wc.c (wc): Likewise.
7966 2002-10-07 Paul Eggert <eggert@twinsun.com>
7969 Don't advance the write pointer past the end of the write buffer.
7970 * src/sort.c (begfield, limfield): Likewise.
7972 2002-10-07 Jim Meyering <jim@meyering.net>
7974 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
7975 * src/head.c (head_bytes, head_lines): Likewise.
7977 2002-10-06 Jim Meyering <jim@meyering.net>
7979 * src/dd.c (scanargs): Ensure that specified block sizes (specified
7980 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
7981 (skip, dd_copy): Adapt to new safe_read ABI.
7983 * Makefile.maint (signatures): Define.
7985 (announcement): Depend on $(signatures).
7987 * Makefile.maint (announcement): Output all URLs for detached
7988 signatures, not just the last one from the previous loop.
7990 2002-10-05 Jim Meyering <jim@meyering.net>
7994 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
7995 don't recurse into directory, DIR. Prompted by a report from
7998 * tests/rm/i-no-r: New file/test, for the above fix.
7999 * tests/rm/Makefile.am (TESTS): Add i-no-r.
8001 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
8002 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
8004 2002-10-03 Jim Meyering <jim@meyering.net>
8006 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
8007 * src/df.c (AUTHORS): Likewise.
8008 * src/du.c (AUTHORS): Likewise.
8009 * src/tail.c (AUTHORS): Likewise.
8010 * src/touch.c (AUTHORS): Likewise.
8012 2002-10-02 Jim Meyering <jim@meyering.net>
8014 * Makefile.am (SUBDIRS): Remove `old'.
8015 (EXTRA_DIST): List the files in old/.
8016 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
8017 Suggestion from Akim Demaille.
8019 2002-10-01 Jim Meyering <jim@meyering.net>
8021 * src/sys2.h (SSIZE_MAX): Define.
8023 2002-09-30 Jim Meyering <jim@meyering.net>
8025 * src/csplit.c: Don't include stdlib.h here. It's already included
8028 2002-09-29 Jim Meyering <jim@meyering.net>
8030 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
8031 expression to avoid bogus warning from gcc.
8033 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
8034 (cat): Declare insize and outsize to be of type size_t, not int.
8035 Rearrange pointer/integer expressions to avoid bogus warnings.
8036 (main): Declare insize and outsize to be of type size_t, not int.
8038 * src/tail.c (parse_options): Give a sensible diagnostic for
8039 an invalid byte or line count. Reported by Mikko Tuumanen.
8041 * src/touch.c (main): Split a long line.
8043 * tests/du/Makefile.am (TESTS): Add slink.
8044 * tests/du/slink: New test for system.h change of 2002-08-31.
8046 In move mode, always first try to rename. Before, upon failure to
8047 rename a directory, this code would never attempt to rename any
8048 other file in that directory, but would thenceforth always copy.
8049 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
8050 may fail with EXDEV, yet renaming files within that directory to
8051 a newly-created destination directory succeeds.
8052 * src/copy.c (copy_internal): Remove local, move_mode;
8053 use x->move_mode instead. Based on a patch from Tom Haynes.
8055 2002-09-28 Jim Meyering <jim@meyering.net>
8057 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
8058 Factor out some duplication.
8060 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
8062 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
8064 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
8065 to avoid compiler warnings.
8067 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
8070 Fix things so `mkdir -p' can create very deep directories, e.g.,
8071 mkdir -p $(perl -e 'print "a/" x 40000') now works.
8072 * src/mkdir.c (main): For --parents (-p), call make_path with the
8073 entire directory name, so we don't ever require that file operations
8074 like stat or chmod be performed on the entire command line argument.
8075 * makepath.c (make_path): Restore umask *before* creating the final
8078 2002-09-27 Andreas Schwab <schwab@suse.de>
8080 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
8081 to avoid overflow. Reported by Hans Lermen.
8083 2002-09-26 Jim Meyering <jim@meyering.net>
8085 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
8087 2002-09-25 Jim Meyering <jim@meyering.net>
8089 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
8090 and add a cast, to avoid a warning about `signed and unsigned type in
8091 conditional expression'.
8093 2002-09-22 Jim Meyering <jim@meyering.net>
8095 * src/rmdir.c: Include "dirname.h", for declaration of
8096 strip_trailing_slashes.
8098 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
8099 Now they're defined through system.h.
8101 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
8102 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
8103 since it's already included from sys2.h via system.h.
8105 * Use automake-1.6f. Regenerate dependent files.
8107 * src/Makefile.am (PERL): Remove duplicate definition.
8109 fmt's -s, -t, -c options didn't work properly for long lines.
8110 Since get_line may end up calling put_paragraph (for long lines),
8111 be sure to set global, `other_indent', before it is used there.
8113 * src/fmt.c (set_other_indent): New function, factored out of...
8114 (get_paragraph): ... here. Call it.
8115 (get_line): Call set_other_indent before calling flush_paragraph,
8116 which calls fmt_paragraph, which in turn calls put_paragraph,
8117 which uses other_indent.
8119 * tests/fmt/Makefile.am (TESTS): Add long-line.
8120 * tests/fmt/long-line: New file/test, for the above fix.
8122 2002-09-21 Jim Meyering <jim@meyering.net>
8124 * src/od.c: No longer include deprecated <values.h>.
8125 It was required solely for now-removed reference to BITSPERBYTE.
8126 * src/install.c: Likewise.
8127 Suggestion from Bruno Haible.
8129 2002-09-06 Andreas Schwab <schwab@suse.de>
8131 `rmdir -p dir-specified-with-trailing-slash/' would fail.
8132 * src/rmdir.c (remove_parents): Strip trailing slashes.
8134 2002-09-20 Jim Meyering <jim@meyering.net>
8136 * tests/rmdir/t-slash: New file/test, for the above fix.
8137 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
8139 * Makefile.maint (announcement): Arrange to gpg-sign the message.
8140 Add a URL for each detached signature file.
8142 2002-09-07 Bruno Haible <bruno@clisp.org>
8144 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
8146 2002-09-18 Jim Meyering <jim@meyering.net>
8148 `od -t x8' used the wrong (`l'-prefixed) printf format.
8149 Likewise for the o8 and u8 formats.
8150 * src/od.c (ISPEC_TO_FORMAT): Define macro.
8151 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
8152 Reported by Arun Sharma.
8154 2002-09-17 Jim Meyering <jim@meyering.net>
8156 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
8157 From gettext's intl/loadmsgcat.c.
8159 * tests/od/x8: New file/test, for the above fix.
8160 * tests/od/Makefile.am (TESTS): Add x8.
8162 2002-09-15 Jim Meyering <jim@meyering.net>
8164 * Use autoconf-2.54. Regenerate dependent files.
8166 * src/csplit.c (get_format_width): Add cast to avoid
8167 warning about `signed and unsigned type in conditional expression'.
8169 2002-09-14 Jim Meyering <jim@meyering.net>
8171 * src/who.c (print_user): Change type of local to size_t
8172 to avoid warnings about `comparison between signed and unsigned'.
8173 * src/ptx.c (generate_all_output): Likewise.
8175 * src/dd.c (main, skip): Add casts to avoid warnings about
8176 `comparison between signed and unsigned'.
8178 * src/id.c (print_full_info, print_group_list): Add casts to avoid
8179 warnings about `signed and unsigned type in conditional expression'.
8181 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
8182 to avoid warnings about `comparison between signed and unsigned'.
8183 (split_3): Change parameter names to be readable and add comment.
8184 Clean up the test for whether a line may be ignored.
8186 2002-09-13 Jim Meyering <jim@meyering.net>
8188 * src/printf.c (main): Handle leading command line argument of `--'.
8189 Reported by Raul: DervishD <raul@pleyades.net>
8190 * tests/misc/printf: New file: test for the above.
8191 * tests/misc/Makefile.am (TESTS): Add printf.
8193 * src/date.c (usage): Explain that %S's range of [0..60] is required --
8194 rather than 0..59 -- to accommodate the occasional positive leap second.
8195 Reported by Richard Neill.
8197 2002-09-12 Jim Meyering <jim@meyering.net>
8199 * src/Makefile.am (nanosec_libs): Define.
8200 (sleep_LDADD, tail_LDADD): Use it here.
8202 Factor nanosleep-related code into ../lib/xnanosleep.c.
8203 * src/sleep.c: Include xnanosleep.h.
8204 Factor out fenv.h-related code.
8205 (timespec_subtract): Remove function.
8206 (main): Remove code that deals with computing start and stop times
8207 as well as the loop around nanosleep. Now that's in xnanosleep.c.
8209 Allow S (in --sleep-interval=S) to be a floating point value.
8210 * src/tail.c: Include xnanosleep.h and xstrtod.h.
8211 Move declaration of global variable, sleep_interval, to ...
8213 (usage): Update description of --sleep-interval option.
8214 (tail_forever): New parameter, sleep_interval. Update caller.
8215 Use xnanosleep, rather than sleep.
8216 (parse_options): New parameter, sleep_interval. Update caller.
8217 Use xstrtod, now that we accept floating point values.
8218 Prompted by a patch from Augey Mikus.
8220 2002-09-06 Jim Meyering <jim@meyering.net>
8222 * src/remove.c (prompt): Change comment to give a better note to
8223 translators. From Michael Piefel.
8225 2002-09-02 Jim Meyering <jim@meyering.net>
8227 * README: A good problem report/patch includes diffs against
8228 the most recent test release.
8230 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
8231 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
8233 * src/kill.c (print_table_row): Use an unsigned type for widths
8234 to avoid warning about comparison between signed and unsigned.
8235 (list_signals): Likewise.
8237 * src/od.c (skip): Add a cast to avoid warning about comparison
8238 between signed and unsigned.
8239 * src/install.c (get_ids): Likewise. Also rearrange range-checking
8240 comparisons to make them more readable.
8242 2002-09-01 Jim Meyering <jim@meyering.net>
8246 2002-08-31 Jim Meyering <jim@meyering.net>
8248 Symlinks were always reported as using 0 blocks.
8249 * src/system.h (ST_NBLOCKS): Don't depend on file type.
8250 This reverts the change of 2000-01-30.
8251 Based on a report and patch from Neil Brown via Michael Stone.
8252 This fixes Debian Bug#156358.
8254 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
8255 `exit (1)' to `exit (EXIT_FAILURE)', and
8256 `usage (1)' to `usage (EXIT_FAILURE)'.
8258 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
8259 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
8260 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
8261 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
8262 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
8263 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
8264 error never exits successfully.
8266 2002-08-29 Jim Meyering <jim@meyering.net>
8268 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
8269 when ignoring any return value.
8271 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
8272 failures. On some systems (at least EMC Celerra and Solaris5.8),
8273 this appears to be necessary.
8274 (is_empty_dir): Likewise. Also, always close directory handle.
8275 * src/ls.c (print_dir): Likewise.
8276 (print_dir): Rename local variable: reading -> dirp.
8277 Reported by Mike Coleman.
8279 2002-08-28 Jim Meyering <jim@meyering.net>
8281 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
8282 Give a diagnostic and fail if closedir fails.
8284 2002-08-26 Jim Meyering <jim@meyering.net>
8286 * Makefile.am (THANKS-to-translators): New rule.
8287 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
8288 * THANKStt.in: New file.
8290 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
8292 (main): Register it with atexit.
8293 Close STDOUT_FILENO, to avoid a problem when writing to
8294 /dev/audio on at least Solaris 5.7 and 5.8 systems.
8295 Reported by Shing-Shong Shei.
8297 2002-08-25 Jim Meyering <jim@meyering.net>
8299 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
8300 * src/tac.c (main): Likewise.
8301 * src/tail.c (main): Likewise.
8302 * src/tee.c (main): Likewise.
8303 * src/tr.c (main): Likewise.
8304 * src/wc.c (main): Likewise.
8306 2002-08-20 Jim Meyering <jim@meyering.net>
8308 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
8310 2002-08-10 Paul Eggert <eggert@twinsun.com>
8312 * src/nohup.sh: Don't use "exec --"; it's not portable and
8313 shouldn't be needed.
8315 2002-08-09 Jim Meyering <jim@meyering.net>
8317 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
8318 (usage): Clarify help text for the -COLUMN option.
8319 Patch by Padraig Brady.
8320 * tests/pr/Test.pm [col-last]: New test for the above.
8322 * configure.ac: Start with version 4.5.1, chosen so that it's larger
8323 than the latest version numbers of the component packages.
8325 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
8328 2002-08-08 Jim Meyering <jim@meyering.net>
8330 * src/date.c: Guard inclusion of <langinfo.h> with
8331 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
8332 * src/sort.c: Likewise.
8333 Patch by GOTO Masanori.
8335 2002-08-05 Paul Eggert <eggert@twinsun.com>
8337 Fix some minor time-related bugs with POSIX time arguments.
8338 Some valid time stamps were being rejected (notably -1, and
8339 time stamps before 1900 on 64-bit hosts). And some invalid
8340 time stamps were being accepted, e.g. September 31.
8342 * src/date.c (main): Adjust to posixtime signature change.
8343 * src/touch.c (main): Likewise. Remove unnecessary initialization.
8344 Use localtime, not posixtm, to warn about obsolete "touch".
8346 2002-08-05 Jim Meyering <jim@meyering.net>
8348 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
8350 2002-08-04 Jim Meyering <jim@meyering.net>
8352 * src/Makefile.am (check-README): New target/rule.
8353 (check): Depend on it.
8355 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
8357 2002-08-03 Jim Meyering <jim@meyering.net>
8359 * Makefile.am (SUBDIRS): Add old.
8360 * old/: New directory, containing legacy ChangeLog* and NEWS files
8361 from the fileutils, sh-utils, and textutils packages.
8363 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
8365 2002-08-02 Paul Eggert <eggert@twinsun.com>
8367 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
8369 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
8370 (hard_LC_COLLATE): New var.
8371 (different): Args are now char *, not const char *.
8372 Use xmemcoll instead of memcmp to compare lines, so that
8373 LC_COLLATE has effect. However, use memcmp if it is an
8375 (check_file): Do not include newline in comparison, so that
8376 xmemcoll has a byte to stomp on temporarily.
8377 (main): Set hard_LC_COLLATE.
8379 2002-07-29 Jim Meyering <jim@meyering.net>
8381 * Makefile.am (SUBDIRS): Remove djgpp, for now.
8383 2002-07-20 Jim Meyering <jim@meyering.net>
8385 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
8386 into EXIT_FAILURE. Otherwise, false --help and false --version
8389 2002-07-08 Jim Meyering <jim@meyering.net>
8391 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
8392 rather than the hard-coded `sh-utils'.
8394 2002-07-01 Jim Meyering <jim@meyering.net>
8396 * configure.ac: Merge the three files from fileutils,
8397 textutils, and sh-utils.
8398 * Makefile.am: Likewise.
8399 * src/Makefile.am: Likewise.