1 2004-12-17 Jim Meyering <jim@meyering.net>
5 * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
6 so temporary directories aren't left behind upon e.g., interrupt.
8 2004-12-16 Paul Eggert <eggert@cs.ucla.edu>
10 * src/ls.c (print_dir): Use "%s: not listing already-listed
11 directory", not "not listing already-listed directory: %s", to
12 format already-listed directories, to be consistent with other
13 diagnostics involving file names and colons.
15 2004-12-15 Jim Meyering <jim@meyering.net>
17 * src/Makefile.am (__LDADD): Define, so that building `[' on
18 Solaris still uses the -lgen library that it requires in order
19 to get a definition of eaccess.
21 2004-12-14 Jim Meyering <jim@meyering.net>
23 tac would exit immediately upon I/O or temp-file creation failure.
24 Now it continues on, processing any remaining command line arguments.
26 * src/tac.c: Include quotearg.h.
27 Use quotearg_colon in most diagnostics.
28 (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
29 failure. Before, this command (with /full/tmp being a full partition)
30 TMPDIR=/full/tmp ./tac /proc/modules tac.c
31 would exit immediately upon the write error while trying to copy
32 non-seekable /proc/modules to the full partition. Now it still
33 reports the failure but continues on with the remaining file.
34 (tac_nonseekable): Return false also if copy_to_temp fails.
35 [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
36 using atexit like this is wrong.
37 * NEWS: Document this.
38 * tests/misc/tac-continue: New test for this.
39 * tests/misc/Makefile.am (TESTS): Add tac-continue.
41 * tests/chown/basic: Add a few more tests.
43 2004-12-13 Paul Eggert <eggert@cs.ucla.edu>
45 * src/ls.c (gobble_file): Change arg name to be command_line_arg
46 rather than explicit_arg, for consistency with copy.c.
47 (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
48 it is deducible from dirname arg. All callers changed.
49 (extract_dirs_from_files, print_dir, queue_directory):
50 Add command_line_arg arg. All callers changed.
51 (struct pending): Add command_line_arg member.
52 (main): Use NULL rather than 0 when appropriate.
53 (set_exit_status, file_failure): New functions.
54 (queue_directory): Store command_line_arg into new structure.
55 (print_dir, gobble_file, get_link_name):
56 Use file_failure to report problems in accessing files,
57 so that the exit status is set consistently.
58 (print_dir): Simplify readdir failure code yet again.
59 If closedir fails, report "closing directory" rather than "reading
61 (xstrcoll): Use set_exit_status to set status on failure.
62 * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
65 2004-12-11 Jim Meyering <jim@meyering.net>
67 Avoid a race condition vulnerability in chown, when used with
68 --from=O:G and without the (-h) --no-dereference option.
69 * src/chown-core.c (restricted_chown): New function.
70 (change_file_owner): Call it.
71 Reported by Ulrich Drepper.
74 2004-12-09 Paul Eggert <eggert@cs.ucla.edu>
76 * ls now exits with status 1 on minor problems, 2 if serious trouble.
77 * NEWS: Document this.
78 * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
79 All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
81 (main): Initialize exit failure to LS_FAILURE.
82 (print_dir, gobble_file, get_link_name, xstrcoll):
83 Set exit status to LS_MINOR_PROBLEM if the failure is minor.
84 (print_dir): Do not give up on entire directory merely because readdir
86 (usage): Explain exit status.
87 * tests/help-version: ls and variants now exit with status 2
90 2004-12-08 Paul Eggert <eggert@cs.ucla.edu>
92 * NEWS: Document new UTC+HH:MM date syntax, and put date changes
95 2004-12-07 Paul Eggert <eggert@cs.ucla.edu>
97 * src/factor.c (factor): Don't list 1 as a factor of 1.
98 Problem reported by Thomas Folz-Donahue.
100 2004-12-06 Jim Meyering <jim@meyering.net>
102 * tests/du/files0-from: Sanitize environment.
103 Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
104 setting is the default (exported from /etc/profile) on at least one
106 * tests/du/no-deref: Likewise.
107 * tests/cp/symlink-slash: Likewise.
108 * tests/ls/symlink-slash: Likewise
110 2004-12-05 Jim Meyering <jim@meyering.net>
112 * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
113 _POSIX2_VERSION=199209 is in the environment, or when building on
116 2004-12-04 Jim Meyering <jim@meyering.net>
118 * NEWS: Mention cut's new --complement option.
120 2004-10-01 Paolo Bonzini <bonzini@gnu.org>
122 * cut.c (complement, COMPLEMENT_OPTION): New.
123 (longopts): Add --complement.
124 (usage): Say not that -b, -c, and -f `print' fields,
125 but rather that they `select' fields for printing.
126 Describe the new --complement option.
127 (mark_range_start): Extracted from set_fields.
128 (print_kth): Support --complement.
129 (compare_ranges): New function.
130 (set_fields): Rewrite the part that populates range_start_ht,
131 merging it with the part that populates printable_field.
132 (main): Handle --complement.
134 2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
136 * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
137 failed. This works around an assertion failure reported by
139 http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
141 2004-12-02 Jim Meyering <jim@meyering.net>
143 With using --color and with LS_COLORS saying not to color
144 executables, don't stat every file.
145 * src/ls.c (is_colored): New function.
146 (gobble_file): Use it.
147 (main): Use it here, in place of too-strict tests against NULL:
148 if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
151 2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
153 * src/comm.c (compare_files): Assume setlocale exists.
154 * src/join.c (keycmp): Likewise.
155 * src/seq.c (decimal_point): Treat like sort. Now char.
157 (main): Assume localeconv exists. Use same code as sort.
158 * src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
159 Assume setlocale exists.
160 (thousands_sep): Renamed from th_sep.
161 (IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
162 (NONZERO): Parenthesize use of arg.
163 (numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
164 consistency. Avoid unnecessary negation by reversing
166 (main): Rewrite localeconv call to match seq.c.
167 * src/system.h: Assume locale.h exists.
168 (HAVE_SETLOCALE): Remove.
169 * src/uniq.c (different): Assume setlocale exists.
171 * src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
172 'volatile' on a local variable. Rewrite to avoid unnecessary
173 double-assignment to 'func' in the usual case where strcoll does
176 2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
178 * src/pinky.c (gethostname): Remove decl.
179 (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
180 * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
181 UT_TYPE_BOOT_TIME instead of by-hand code.
182 * src/users.c (list_entries_users): Use IS_USER_PROCESS
183 instead of by-hand code.
184 * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
185 DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
186 (IS_USER_PROCESS): Move to ../lib/readutmp.h.
187 (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
188 UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
189 (gethostname): Remove decl.
190 (list_entries_who, scan_entries): Use the new macros defined above,
191 for consistency with pinky, uptime, and users.
193 2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
195 Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
196 HP's ANSI C compiler. Declaring int functions causes warnings on
197 some modern systems and shouldn't be needed to compile on ancient
199 * src/copy.h (stat, lstat, rename): Remove decls.
200 * src/install.c (stat): Remove decl.
201 * src/ln.c (link, symlink): Remove decls.
203 2004-11-25 Jim Meyering <jim@meyering.net>
205 * man/help2man: Import help2man-1.35.1.
206 * man/Makefile.am (.x.1): Remove now-unnecessary use of
207 locally-added --program-name=NAME option. Now, help2man gets
208 the name from the [NAME] section (i.e. from our .x file).
209 * man/install.x: Use `install', not `ginstall' in the one-line
210 description. Reported by Brendan O'Dea.
211 * man/sha1sum.x: Use `sha1sum', not `shasum'.
213 2004-11-24 Jim Meyering <jim@meyering.net>
215 Since the changes of 2004-05-22, the u.saved_cwd member at
216 the bottom of the active-directory stack was no longer
217 strictly necessary. This change removes that member and uses
218 the newer cwd_state parameter for the final restore_cwd.
220 * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
221 [dev_ino]: Rename from `a'.
222 (AD_pop_and_chdir): Add a parameter to play the role of just-removed
223 bottom-of-stack cwd-state member.
224 (AD_pop_and_chdir): No longer return boolean. Adjust caller.
225 (AD_push_initial): Remove CWD parameter. Adjust caller.
227 2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
229 Minor performance improvements and cleanups for "touch".
230 * src/touch.c (posix_date): Remove; not needed as a static var.
232 (touch): Use new futimens function to operate more efficiently
233 in some cases. Don't stat/fstat existing file when
234 (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
235 old time stamps aren't needed in that case.
236 (main): change_times is int, not bool. Simplify test for
239 2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
241 * src/install.c (usage): Avoid usage that runs afoul of Docbook
242 translation. Problem reported by Eric S. Raymond.
244 Restore dd's noctty flag, reverting the change of 2004-04-08.
245 POSIX does not allow "dd" to use O_NOCTTY by default.
246 * NEWS: Add noctty flag to dd.
247 * doc/coreutils.texi (dd invocation): Likewise.
248 * src/dd.c (flags, usage, main): Likewise.
250 2004-11-19 Alfred M. Szmidt <ams@gnu.org>
252 * src/ls.c (usage): Clarified description of --no-group (-G),
253 --human-readable (-h), --inode (-i), --size (-s), --time,
256 2004-11-19 Jim Meyering <jim@meyering.net>
258 * src/ls.c (usage): Clarify description of --author.
259 Tweak indentation so that help2man creates better nroff.
260 Reported by Dan Jacobson.
262 * src/uniq.c (check_file): Don't check stdout for errors here.
264 * src/pwd.c (find_dir_entry): Update comment to match reality.
266 2004-11-18 Jim Meyering <jim@meyering.net>
268 * src/pwd.c (robust_getcwd): Correct the comment: this function
269 constructs the directory name. The caller prints it.
271 2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
273 * src/stat.c (STATFS): New macro, for portability to Solaris 9.
276 * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
277 src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
278 src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
279 src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
280 src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
281 * src/readlink.c (main): argv is not const.
283 * src/cut.c (usage): Improve documentation along the lines suggested
285 * src/echo.c (usage): Likewise.
286 * src/expr.c (usage): Likewise.
288 * src/dircolors.hin: Add putty, screen-bce.
290 * src/pinky.c (print_entry): Fix memory leak.
291 * src/who.c (print_user): Likewise.
293 2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
295 * NEWS: New dd operand "status=noxfer".
296 * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
297 C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
298 C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
300 (STATUS_NOXFER, statuses): New constants.
301 (usage, print_stats, scanargs): Add support for status=noxfer.
302 (usage): Update status output to match new behavior.
303 (print_stats): Always output complete byte count.
304 Put space between numbers and units, as SI requires.
305 Use ngettext so that i18n can use plurals for "byte" and "second".
306 Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
307 (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
309 * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
310 problems with regression testing.
312 2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
314 * NEWS: dd now outputs total bytes, seconds, and bytes per second.
315 * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
316 * src/dd.c: Include "human.h".
317 (w_bytes, start_time): New vars.
318 (usage): Document new I/O statistics output
319 (print_stats): Output new I/O statistics.
320 (cleanup): Do statistics after closing stdin and stdout, so that
321 the times are more accurate.
322 (write_output, dd_copy): Count output bytes.
323 (main): Get initial value of clock.
325 2004-11-14 Jim Meyering <jim@meyering.net>
327 Backslash-escape `-'s in email addresses, so that they are
328 rendered properly in UTF-locales.
329 * man/help2man (escape_hyphens): New function.
330 (main): Call it on email addresses.
332 * src/sort.c (zaptemp): Mark new diagnostic for translation.
334 * tests/misc/close-stdout: New file. Test today's closeout.c change.
335 * tests/misc/Makefile.am (TESTS): Add close-stdout.
337 2004-11-13 Jim Meyering <jim@meyering.net>
339 * src/test.c (usage): Put the description of `[-n] STRING'
340 on two lines, one for `-n STRING' and one for `STRING' so that
341 help2man properly escapes the `-'. Otherwise, the hyphen is
342 rendered inappropriately in UTF-8 locales.
343 Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
345 2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
347 * NEWS: Document the following changes.
349 * src/sort.c: Avoid O(N**2) behavior when there are many temporary
351 (temptail): New variable, so that we can easily append to list.
352 (create_temp_file): Create new files at end of list, so that
353 searching the list has O(N*NMERGE) behavior instead of O(N**2).
354 (zaptemp): Update temptail if needed.
355 (mergefps, merge): Accept new arg that counts temp files, and keep it
356 up to date as we create and remove temporaries. This is for
357 efficiency, so that we don't call zaptemp so often.
359 (sort): Don't create array in reverse order, since the list of
360 temporaries is now in the correct order.
362 (zaptemp): Protect against race condition: if 'sort' is
363 interrupted in the middle of zaptemp, it might unlink the
364 temporary file twice, and the second time this happens the file
365 might already have been created by some other process.
367 (zaptemp): Warn if a temporary file is not removed.
369 (create_temp_file): Use offsetof for clarity.
370 (die): Move it up earlier, to clean up the code a bit.
372 * src/pr.c (strtoumax): Declare if not declared.
373 (skip_to_page, first_page_number, last_page_number, page_number,
374 first_last_page, print_header):
375 Use uintmax_t for page numbers.
376 (first_last_page): Remove unnecessary forward declaration.
377 Do not modify arg (it is now a const pointer).
378 Return a true if successful, false (without print a diagnostic)
380 (main): If +XXX does not specify a valid page range, treat it
381 as a file name. This follows the response to Open Group XCU ERN 41
382 <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
383 which says the behavior is allowed.
384 (skip_to_page): When starting page number exceeds page count,
385 print both numbers in the diagnostic.
386 (print_header): Detect page number overflow.
388 2004-11-07 Jim Meyering <jim@meyering.net>
390 * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
391 (main) [__APPLE__]: Get the processor type via syscall rather than
392 hard-coding "powerpc". From Toby Peterson.
394 * src/sort.c (merge): Remove declarations of now-unused variables.
396 2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
398 * src/sort.c (first_same_file): Remove. Move most of the code to....
399 (avoid_trashing_input): New function.
400 (merge): Avoid some silly merges, e.g., copying a single file to
401 a temporary file when there are exactly 17 input files to merge.
402 Take a count of temporary files rather than a max_merge arg.
405 2004-11-06 Jim Meyering <jim@meyering.net>
407 * src/sort.c (xfclose): Don't close stdout here (just flush it),
408 since close_stdout now closes stdout unconditionally.
410 2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
412 * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
413 first_same_file, merge, sort, main): Use size_t for indexes to arrays.
414 This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
416 (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
417 thus avoiding unchecked stack overflow in some cases. As a side
418 effect this improve the performance of "sort -M" by a factor of 4
421 2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
423 * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
425 * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
426 expression; it's not portable. Problem reported by Albert Chin.
427 Don't invoke a program more than once.
428 * src/groups.sh (version): New variable, containing author info,
429 for benefit of AUTHORS check. Use it when acting on --version option.
430 * AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
433 * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
434 as this breaks the new regime that does "#define getopt rpl_getopt".
435 Problem reported by Albert Chin for Solaris 9 with Sun cc in:
436 http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
437 I suppose this may cause problems on ancient hosts with
438 incompatible getopt declarations, but we'll cross that bridge if
439 the problem gets reported to us by someone who can test the fix.
441 2004-11-03 Jim Meyering <jim@meyering.net>
443 * src/tac.c: quote(...) file names in diagnostics.
445 2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
447 * NEWS: Document getdate changes.
449 2004-10-29 Jim Meyering <jim@meyering.net>
451 * src/tac.c (tac_file): Remove temporary prototype and move this
452 function `down' so that it precedes definition of tac_nonseekable.
454 `tac /proc/modules' would print nothing
455 Reported by Harald Dunkel in http://bugs.debian.org/278604.
457 * src/tac.c (copy_to_temp): Renamed from save_stdin, since
458 now it copies a general file descriptor, not just stdin.
459 (tac_nonseekable): Renamed/adapted from tac_stdin.
460 (tac_file): Get fd via `open' directly rather than via fopen/fileno,
461 since we never used the stream. Perform "-" to stdin mapping here
462 rather than in main. Determine whether a file is seekable,
463 by trying to `lseek' to its end, and dispatch to tac_seekable or
464 tac_nonseekable accordingly.
465 (main): Rewrite argument handling now that it uses only tac_file.
466 * NEWS: Mention it here.
468 2004-10-21 Jim Meyering <jim@meyering.net>
470 * tests/mv/leak-fd: New file.
471 * tests/mv/Makefile.am (TESTS): Add it.
472 * tests/rm/dot-rel: New file.
473 * tests/rm/Makefile.am (TESTS): Add it.
475 Correct my patch of 2004-10-18.
476 * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
477 if necessary, not in remove_dir. Otherwise, removing multiple
478 `.'-relative nonempty directories no longer worked.
480 2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
482 * src/fmt.c (usage): Improve description of --prefix.
483 Problem reported by Edward Welbourne.
485 * man/uniq.x: Change summary so that it doesn't imply that
486 uniq writes to its input file. Problem reported by
489 2004-10-18 Jim Meyering <jim@meyering.net>
491 Plug a leak that would cause a cross-device mv to fail when
492 operating on too many command-line-specified nonempty directories.
493 * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
494 top of the stack before returning. This usually closes the file
495 descriptor that was used to return to the original working directory.
496 Reported by Cyril Bouthors in
497 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
498 * NEWS: Mention it here.
500 * src/pathchk.c (validate_file_name): Give a more descriptive
501 diagnostic when pathconf fails. This also avoids an unwarranted
502 warning from gcc-3.3.5 about a format not being a string literal.
504 * src/sleep.c (main): Remove declaration of unused local, c.
505 * src/printenv.c (main): Likewise.
506 * src/logname.c (main): Likewise.
507 * src/uptime.c (main): Likewise, for optc.
508 * src/tsort.c (main): Likewise, for opt.
510 2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
512 * AUTHORS: Add self to pathchk.
513 * src/pathchk.c (AUTHORS): Add self.
514 Change "path" to "file name" whenever possible.
515 Remove usage comment, as it was a duplication of the code or doc.
516 Include <wchar.h> if available.
517 (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
518 (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
519 pathconf_wrapper, portable_chars, dir_ok): Remove.
520 (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
521 (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
522 (portable_chars_only): New arg FILELEN.
523 Don't assume ASCII; we might be on an EBCDIC host.
524 Don't assume unibyte locale in diagnostic.
525 (component_start, component_len): New functions.
526 (validate_file_name): Renamed from validate_path. All uses changed.
527 Pretty much a complete rewrite.
528 Don't make copy of file arg. Always append trailing slash to
529 pathconf arg, just in case it's a symlink (this is pure paranoia;
530 we don't know of any hosts where the trailing slash is required).
531 Use size_t instead of long int when possible.
532 Avoid need to call pathconf in most practical cases.
533 Don't use euidaccess several times to test searchability;
534 just use lstat once. Reword diagnostic to put the (often very long)
537 2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
539 * src/printf.c (usage): Mention Unicode, and use H for hex digits.
541 2004-10-13 Jim Meyering <jim@meyering.net>
543 * NEWS: Mention today's fts.c fix.
545 2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
547 * tests/stty/row-col-1: Set LC_ALL=C.
549 2004-10-12 Jim Meyering <jim@meyering.net>
551 * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
552 From Jesus Climent in http://bugs.debian.org/276149.
554 2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
556 * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
557 problems. All uses changed.
559 2004-10-05 Jim Meyering <jim@meyering.net>
561 * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
562 since Karl says its trailing blanks are there to stay :-)
564 2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
566 * src/expr.c (NEW, OLD): Remove, partly to avoid
567 reference to obsolescent macro XMALLOC.
568 All uses replaced by xmalloc and free.
570 2004-09-28 Jim Meyering <jim@meyering.net>
572 * src/tail.c (usage): Clarify: --retry works only with --follow=name.
573 Reported by Nik A. Melchior in http://bugs.debian.org/273781.
575 2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
577 * src/od.c (format_address_paren): c is optional, so don't output
580 2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
582 Add support for ls --hide. Idea suggested by Bardur Arantsson.
583 * NEWS: Document this.
584 * src/ls.c (file_ignored): Renamed from file_interesting, with
585 inverted return value. Accept the file name, not a struct dirent *.
586 All uses changed. Avoid the expense of calling fnmatch if the
587 file is ignorable due to leading '.'.
588 (all_files, really_all_files): Removed; replaced by:
589 (ignore): New variable. All uses changed.
590 (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
592 (hide_patterns): New variable.
593 (long_options, decode_switches, file_ignored, usage):
594 Add support for --hide.
595 (patterns_match): New function.
596 (usage): Replace "hide" with "ignore" in explanation, to avoid
599 2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
601 * src/ls.c (gobble_file, print_long_format): Don't assume that
602 human-readable output has a byte count equal to its column width;
603 this isn't always true in locales where the radix character is not
605 (format_user_or_group): Revamp code to match the above fix;
606 this avoids the (very faint) possibility of integer overflow.
608 2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
610 * NEWS: Mention that "chmod -r -w x" now works as expected.
611 * src/chmod.c (main): Revamp option processing to support this.
612 * tests/chmod/Makefile.am (TESTS): Add 'usage'.
613 * tests/chmod/usage: New set of tests for usage like that.
615 2004-09-24 Jim Meyering <jim@meyering.net>
617 * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
618 it lists only cvs-controlled regular files.
620 * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
621 to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
623 2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
625 * Makefile.maint (CVS_LIST): New macro.
626 (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
627 sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
628 sc_trailing_blank, po-check): Use it instead of the
629 nonstandard "cvsu --list".
631 * src/tail.c (parse_obsolete_option): Bring back support
632 for obsolete option followed by non-obsolete, or by more
633 than one file. When obsolete, conform to SUSv2 rather than
634 original POSIX 1003.2-1992, as SUSv2 corrected the case of
635 "tail -c". Add support for the SUSv2 "b" modifier.
636 * NEWS: Mention the above.
637 * tests/tail/Test.pm: New test case obs-b to check the above.
638 err-[134] no longer need _POSIX2_VERSION=199209.
639 Fix comments to match revised behavior.
641 2004-09-22 Jim Meyering <jim@meyering.net>
643 * Use automake-1.9.2. Regenerate dependent files.
645 * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
648 Clean up scoping etc. so that some make `distcheck' tests pass.
649 * src/csplit.c (xalloc_die): Declare to be static.
650 * src/chown-core.c (chown_files): Declare as `extern'.
651 * src/cp-hash.c (remember_created): Likewise.
652 * src/copy.c (copy): Likewise.
653 * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
655 * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
656 * src/unexpand.c: Likewise.
658 * src/Makefile.am (check-AUTHORS): New rule.
659 (check): Depend on it.
662 * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
663 (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
665 2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
667 * src/ls.c (decode_switches): Don't compare a short value
668 to SIZE_MAX: GCC sometimes complains.
670 2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
672 * NEWS: The following commands now reject unknown options:
673 basename dirname factor hostname link nohup sync unlink yes
674 Also, pathchk no longer accepts trailing options.
676 * src/basename.c: Include <getopt.h>.
677 * src/chroot.c: Likewise.
678 * src/dirname.c: Likewise.
679 * src/factor.c: Likewise.
680 * src/hostid.c: Likewise.
681 * src/hostname.c: Likewise.
682 * src/nohup.c: Likewise.
683 * src/pwd.c: Likewise.
684 * src/setuidgid.c: Likewise.
685 * src/sync.c: Likewise.
687 * src/basename.c (main): Reject unknown options.
688 * src/dirname.c (main): Likewise.
689 * src/factor.c (main): Likewise.
690 * src/hostid.c (main): Likewise.
691 * src/hostname.c (main): Likewise.
692 * src/link.c (main): Likewise.
693 * src/nohup.c (main): Likewise.
694 * src/pwd.c (main): Likewise.
695 * src/setuidgid.c (main): Likewise.
696 * src/sync.c (main): Likewise.
697 * src/unlink.c (main): Likewise.
698 * src/yes.c (main): Likewise.
700 * src/cat.c (main): Remove unused "case 0".
701 * src/chgrp.c (main): Likewise.
702 * src/chmod.c (main): Likewise.
703 * src/chown.c (main): Likewise.
704 * src/comm.c (main): Likewise.
705 * src/cp.c (main): Likewise.
706 * src/csplit.c (main): Likewise.
707 * src/cut.c (main): Likewise.
708 * src/date.c (main): Likewise.
709 * src/df.c (main): Likewise.
710 * src/du.c (main): Likewise.
711 * src/env.c (main): Likewise.
712 * src/expand.c (main): Likewise.
713 * src/fold.c (main): Likewise.
714 * src/head.c (main): Likewise.
715 * src/id.c (main): Likewise.
716 * src/install.c (main): Likewise.
717 * src/join.c (main): Likewise.
718 * src/ln.c (main): Likewise.
719 * src/ls.c (decode_switches): Likewise.
720 * src/mkdir.c (main): Likewise.
721 * src/mkfifo.c (main): Likewise.
722 * src/mknode.c (main): Likewise.
723 * src/mv.c (main): Likewise.
724 * src/nl.c (main): Likewise.
725 * src/paste.c (main): Likewise.
726 * src/pinky.c (main): Likewise.
727 * src/pr.c (main): Likewise.
728 * src/ptx.c (main): Likewise.
729 * src/readlink.c (main): Likewise.
730 * src/rm.c (main): Likewise.
731 * src/rmdir.c (main): Likewise.
732 * src/seq.c (main): Likewise.
733 * src/shred.c (main): Likewise.
734 * src/split.c (main): Likewise.
735 * src/sum.c (main): Likewise.
736 * src/tac.c (main): Likewise.
737 * src/tail.c (main): Likewise.
738 * src/tee.c (main): Likewise.
739 * src/touch.c (main): Likewise.
740 * src/tr.c (main): Likewise.
741 * src/tty.c (main): Likewise.
742 * src/uname.c (main): Likewise.
743 * src/unexpand.c (main): Likewise.
744 * src/wc.c (main): Likewise.
745 * src/who.c (main): Likewise.
747 * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
748 * src/cksum.c (main): Likewise.
749 * src/dd.c (main): Likewise.
750 * src/logname.c (main): Likewise.
751 * src/printenv.c (main): Likewise.
752 * src/sleep.c (main): Likewise.
753 * src/tsort.c (main): Likewise.
754 * src/uptime.c (main): Likewise.
755 * src/users.c (main): Likewise.
756 * src/whoami.c (main): Likewise.
758 * src/du.c (long_options): Standardize on NULL vs 0.
759 * src/rm.c (long_opts): Likewise.
761 * src/logname.c (long_options): Remove.
762 * src/printenv.c (long_options): Likewise.
763 * src/sleep.c (long_options): Likewise.
764 * src/tsort.c (long_options): Likewise.
765 * src/uptime.c (longopts): Likewise.
766 * src/users.c (longopts): Likewise.
767 * src/whoami.c (long_options): Likewise.
769 * src/pathchk.c (longopts): Add --help, --version.
770 (main): Use longopts rather than parse_long_options.
771 * src/stty.c (longpts, main): Likewise.
773 * src/pathchk.c (main): Don't reorder arguments, so that
774 we can check weird file names.
776 * src/readlink.c: Don't include "long-options.h".
777 * src/sort.c: Likewise.
778 * src/stty.c: Likewise.
780 * src/split.c (verbose): Now bool, not int.
781 (VERBOSE_OPTION): New enum.
782 (longopts, main): Use it.
784 * tests/factor/basic: Adjust to new wording in diagnostic
785 that results from the above changes.
787 2004-09-21 Jim Meyering <jim@meyering.net>
789 * man/rm.x: Say "the response is affirmative" rather than "the
790 response begins with y or Y", so that the documentation is
791 accurate in non-English locales. Problem reported by Munzir Taha.
793 2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
795 * src/echo.c (main): Don't pass NULL to strcmp when
796 POSIXLY_CORRECT and given no arguments.
798 * src/md5sum.c (STRING_OPTION): Remove.
799 (long_options, main): Remove support for undocumented and
800 obsolete --string option, as suggested in the 1996-09-26 patch.
801 * NEWS: Document this.
803 * tests/rm/fail-eperm: Don't try to remove writeable files in a
804 sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
805 you remove such files. Problem reported by Bert Fischer in:
806 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
808 2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
810 * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
811 (long_options, main): Use them instead of magic numbers 2 and 1.
812 For --string, optarg can't possibly be NULL.
814 * src/dd.c (usage): Distinguish between options and operands.
815 (scanargs): Don't mess with argc, argv; getopt_long handles this now.
816 Say "operands" for operands, not "options".
817 (main): Use getopt_long, so that "dd --" works as POSIX requires.
818 * tests/dd/misc: Check for "dd --".
820 * src/chroot.c (main): Reject unknown options instead of
821 interpreting them as a directory to chroot to.
823 * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
824 The current standard (POSIX 1003.1-2004) is correct.
825 (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
826 collision with builtin function.
827 (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
828 output the first 0 as 8 digits, to make it easier to compare to
829 the text of the standard. Output crctab to be a const array.
830 (crctab): Use result of above changes.
831 (long_options): Remove; not needed if empty.
832 (main): getopt_long can't return 0 here, so simplify the code.
834 2004-09-13 Jim Meyering <jim@meyering.net>
836 * src/Makefile.am (localedir.h): Don't redirect directly to target.
838 2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
840 * src/id.c (print_full_info): Don't exit with failure status simply
841 because a user or group number can't be turned into a name.
842 Problem reported by Felipe Kellermann in:
843 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
845 2004-09-12 Jim Meyering <jim@meyering.net>
847 * Makefile.maint (my-distcheck): When building with -Werror, also
850 2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
852 * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
853 * src/tail.c (parse_obsolete_option): Renamed from
854 parse_obsolescent_option, since the options are obsolete now.
855 Remove bool *arg; just exit if there's an error. Revamp to follow
856 POSIX 1003.2-1992 more precisely, to handle cases like "tail -
857 file" and "tail -10 -- file" correctly when we are conforming to
859 (main): Adjust to this change.
860 * tests/tail/Test.pm (test_vector): minus-* requires
861 _POSIX2_VERSION=199209 now, to work correctly if there is
862 an input file. err-1 and err-3 no longer errors if there
865 2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
867 * src/test.c (usage): Document -r, -w, -x more carefully.
869 2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
871 * src/test.c (usage): Document "test" (with no args) and "[ ]".
872 Document that -h and -L don't dereference.
874 * NEWS: Document that "tr xy -z" now works as per POSIX.
875 Sort the descriptions.
876 * src/tr.c (main): Don't reorder options.
877 * tests/tr/Test.pm (fowler-1): New test case.
879 2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
881 * src/touch.c (main): Fix POSIX-conformance bug: "touch --
882 MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
883 conforming to pre-2001 POSIX.
884 * NEWS: Document this.
885 * tests/touch/obsolescent: Test for this bug. Also, set
886 _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
887 a better test for obsolescent features.
889 * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
890 "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
893 * src/od.c: Several changes for POSIX and FreeBSD compatibility.
894 (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
895 (long_options, main): --strings is now -S, not -s.
896 (usage): Reflect the usage changes.
897 (parse_old_offset): Do not issue a diagnostic on failure;
898 callers now do this as necessary.
899 (main): Support POSIX syntax. Remove unused case 0 from getopt_long.
900 Add support for new short options (many undocumented) for
901 compatibility with FreeBSD. Remove FIXME for -s; it's now
902 POSIX-compatible. Default format is now oS, not o2.
903 * NEWS: Describe the above.
905 2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
907 * src/stty.c (valid_options): Remove.
908 (main): Fix some bugs in handling invalid option-combinations
910 (recover_mode): Arg is now char const *, not char *.
911 (main): Use STDIN_FILENO, not 0.
912 Simplify option-parsing code a tad.
913 * tests/stty/basic-1: Check for the fixed bugs.
915 2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
917 * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
918 it from ever being nonzero. Reported by Pozsar Balazs in:
919 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
920 (human_fstype): Add ramfs, squashfs, sysfs.
921 Reported by Pozsar Balazs in:
922 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
923 (human_fstype): Return char const *, not char *.
924 Simplify internals a bit, and avoid casts.
926 * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
927 (bit_count): Remove. All uses changed to....
928 (multiple_bits_set): New function.
929 (scanargs): Use it, and check separately for each set of
930 incompatible options, to improve diagnostics.
932 (apply_translations): Move checks for incompatible options
933 to scanargs, so that they're done consistently.
935 2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
937 Output correct errno-related diagnostic on "paste" I/O errors.
938 * src/paste.c (write_error, xputchar): New functions.
939 (paste_parallel): Use correct errno value after input error.
940 (paste_parallel, paste_serial): Report errno value after output error.
942 Port to diet libc. Problem reported by Felix von Leitner in:
943 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
944 * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
945 it's not portable C to assume FILE is a complete type.
946 (paste_parallel): Use index test instead of ENDLIST, and NULL
949 2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
951 POSIX-conformance fixes for "expand" and "unexpand".
952 Also, consistently use "tab stop" rather than "tabstop".
953 * NEWS: Document fixes.
954 * src/expand.c: Revamp to resemble the new unexpand.c better.
955 (usage): -i does not convert tabs after non-tabs.
956 (add_tab_stop): Renamed from add_tabstop. All uses changed.
957 (parse_tab_stop): Renamed from parse_tabstop. All uses changed.
958 (validate_tab_stop): Renamed from validate_tabstop. All uses changed.
959 (next_file, main): Check fclose against 0, not EOF.
960 (expand): Remove unnecessary casts.
961 Add another loop nesting level, for lines, so that per-line variables
962 are initialized cleanly.
963 Revamp tab checking. Check for write error immediately, rather
964 than just once at the end of the program.
965 * src/unexpand.c: Lkewise (for the expand.c changes).
966 (TAB_STOP_SENTINEL): Remove.
967 (tab_size): Now size_t, not uintmax_t, since we need to store
968 the sequences of blanks.
969 (max_column_width): New var.
970 (usage): Say "blank" where POSIX requires this.
971 (add_tab_stop): Calculate maximum column width.
972 (unexpand): Store the pending blanks, instead of merely counting them.
973 Follow POSIX's rules about -a requiring two blanks before a tab stop.
974 Get rid of internal label and goto.
975 * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
976 Add blanks-1 through blanks-13.
978 2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
980 * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
981 succeed without changing the uid and gid, like FreeBSD.
982 * src/chgrp.c (parse_group): Return gid_t rather than storing it
983 through a pointer. Treat "chgrp '' file" as a no-op change,
985 (main): Set chopt.group_name to NULL if the group is the empty
987 * src/chown-core.c (describe_change): Describe changes to -1:-1
988 without using "to OWNERSHIP" phrase.
989 * src/chown.c (usage): "chown '' file" is now allowed.
990 (main): Do not set user name to the empty string if the group
992 * tests/chgrp/basic: Test "chgrp '' file".
993 * tests/chown/Makefile.am (TESTS): Add separator.
994 * tests/chown/separator: New file, partly taken from
995 Dmitry V. Levin's suggestion in
996 <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
998 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
1000 * tests/install/basic-1: Test for the -d regression.
1002 2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
1004 * src/install.c (main): Fix -d regression introduced with
1005 --target-directory support at 2004-06-25.
1007 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
1009 * src/copy.c (copy_internal): When preserving links, unlink
1010 a destination with link count greater than one. This is so
1011 that commands like "cp -a" don't get confused when copying into
1012 a destination that already contains many hard links. Problem
1013 reported by Tim Waugh in:
1014 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
1016 2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
1018 Convert all files to UTF-8.
1019 * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
1020 * tests/sort/Test.pm (16a): Likewise.
1021 * tests/uniq/Test.pm (8): Likewise.
1022 * tests/misc/printf-hex: Use ASCII, not Latin-1.
1024 * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
1025 * src/shred.c (usage): "-" is an operand, not an option.
1026 * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
1027 A null file arg means standard output.
1028 (main): "-o -" means to write to a file named "-",
1029 not to standard output.
1030 * src/tee.c (usage, tee): "tee -" writes to standard output, not
1031 to a file named "-".
1033 2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
1035 * src/install.c (change_timestamps): Fix int->bool conversion
1036 bugs introduced on 2004-07-29.
1038 2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
1040 * src/shred.c (wipename): Work even if the directory is writeable
1041 and not readable. Prefer write access, since this should work
1042 better with fdatasync.
1044 * src/csplit.c (xalloc_die): New function.
1045 (main): Remove now-obsolete initialization of xalloc_fail_func.
1047 * src/md5sum.c: Adjust to sha->sha1 renaming.
1049 2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
1052 * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
1053 (can_mode): Make variable local.
1055 2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
1057 * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
1058 Do not define, to avoid annoying compiler messages on QNX 6.3.
1059 Problem reported by Johan in:
1060 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
1062 2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
1064 * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
1065 Define to a concatenation of string literals, not to an expression;
1066 needed for concatenation contexts.
1067 (INTMAX_MAX, INTMAX_MIN): New macros.
1069 * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
1070 unsigned long; this isn't true for st_ino on Solaris 9.
1072 2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
1074 * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
1075 whether to include files. Include <sys/param.h> if
1076 HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
1077 (main) [defined __POWERPC__]: Add a kludge to work around a
1078 Mac OS X bug, so that uname -p defaults to "powerpc" if
1079 sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
1080 fails. Problem reported by Petter Reinholdtsen in:
1081 http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
1083 * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
1084 main): Use bool for booleans.
1085 (writeline, check_file): Use uintmax_t for line counts.
1086 (check_file): Check for and report line number overflow,
1088 * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
1089 (print_lines, print_words, print_chars, print_bytes, print_linelength,
1090 have_read_stdin, wc, wc_file, main):
1091 Use bool for booleans.
1092 (exit_status): Remove.
1093 (wc, wc_file): Return bool status. All callers changed.
1094 * src/who.c (scan_entries): 0 -> STDIN_FILENO.
1095 * src/whoami.c (main): Print uids using unsigned long int, not
1098 * src/unexpand.c: Int cleanup and minor reorganization to be more
1100 Include quote.h, xstrndup.h.
1101 (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
1102 (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
1104 Use bool for booleans.
1105 (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
1106 Use uintmax_t for column counts.
1107 (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
1108 (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
1110 (parse_tabstops): Don't use ISBLANK on possibly-signed char.
1111 Detect overflow in tab stop string.
1112 (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
1113 (unexpand): Concatenate input files the same way expand does.
1115 * src/touch.c (no_create, use_ref, posix_date, amtime_now,
1116 touch, main): Use bool for booleans.
1117 (main): Avoid integer overflow when given more than INT_MAX
1119 * src/tsort.c (struct item, n_strings): Use size_t for sizes.
1120 (have_read_stdin, count_items, scan_zeros, detect_loop,
1121 recurse_tree, walk_tree, tsort, main):
1122 Use bool for booleans.
1123 (exit_status): Remove.
1124 (tsort): Return a success flag instead of storing into a global.
1126 * src/tty.c (silent, main): Use bool for booleans.
1127 (main): 0 -> STDIN_FILENO.
1128 * src/uname.c (print_element): Use bool for booleans.
1130 * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
1131 Remove. All uses replaced by C99 boolean primitives.
1132 (TEST_TRUE, TEST_FALSE): New constants, for readability.
1133 (test_unop, binop, unary_operator, binary_operator, two_arguments,
1134 three_arguments, posixtest, expr, term, and, or, is_int, age_of,
1135 one_argument, main): Use bool for booleans.
1136 (advance, unary_advance): Now inline procedures rather than a macros.
1137 (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
1138 (term, and, or): When it's easy, loop instead of recursing.
1139 (term): Avoid integer overflow if there are INT_MAX-3 args (!).
1140 (binary_operator, unary_operator): Simplify by systematically rewriting
1141 true==FOO to FOO (where FOO is a boolean).
1142 (unary_operator): Don't consider a file to be a regular file
1143 merely because its mode&S_IFMT is zero. Just use S_ISREG.
1144 Remove unnecessary casts. Remove ifdefs for things like
1145 S_ISSOCK that are no longer needed, since stat-macros.h always
1148 * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
1149 Use bool for booleans.
1150 (buf_init_from_stdin, buf_free, find_bol, print_line):
1151 Use size_t for sizes.
1152 * src/tac.c (separator_ends_record, tac_seekable, tac_file,
1153 tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
1154 (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
1155 (tac_seekable): Use ptrdiff_t for pointer subtraction.
1156 Report an error if the result is out of range.
1157 (tac_seekable, main): Check for integer overflow in buffer size
1159 (main): Remove unnecessary casts.
1161 * src/su.c (run_shell): Pass a new n_additional_args arg, so that
1162 the callee doesn't have to count 'em. All callers changed.
1163 Don't allocate more space for the arg vector than we'll need.
1164 Use memcpy to copy the args rather than rolling our own loop.
1165 Use size_t for sizes.
1166 (fast_startup, simulate_login, change_environment, log_su,
1167 correct_password, restricted_shell, main): Use bool for booleans.
1168 (longopts): Don't assume change_environment is an int.
1169 Use NULL, not 0, for pointers.
1170 (xsetenv): New function, replacing xputenv and concat.
1171 All callers changed.
1172 (elements): Remove; no longer needed.
1173 (log_su, correct_passwd, main): Prefer !x to x==NULL.
1174 (log_su): 2 -> STDERR_FILENO.
1175 (modify_environment, main): Don't assume that getenv's returned value
1176 has an indefinite lifetime.
1177 (modify_environment): Allocate a larger environ.
1178 (main): Remove an impossible 'case 0'; if it happens now, it'll
1179 get diagnosed. Don't assume getpwnam results outlive endpwent.
1180 Check for null or empty pw_name, pw_dir and for null pw_passwd.
1182 * src/stty.c (VA_START): Remove. All callers now use va_start.
1183 (_POSIX_VDISABLE): Remove unnecessary cast.
1184 (struct control_info, visible): Use cc_t for control chars.
1185 (struct control_info): Use size_t for sizes.
1186 (recover_mode, set_mode, display_speed, display_window_size,
1187 valid_options, main, display_changed):
1188 Use bool for booleans.
1189 (integer_arg): Return unsigned long int, not long int.
1190 Accept new max arg; all callers changed, to specify a maximum
1191 value for integer parameters instead of silently overflowing.
1192 (wrap): Do not overrun the stack buffer if the output contains
1193 more than 1024 bytes. Instead, malloc a buffer.
1194 (main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
1195 Remove unnecessary casts.
1196 (set_control_char): Allow int values only up to cc_t range.
1197 (screen_columns): Don't reject INT_MAX.
1198 (display_changed, display_all, display_speed, recover_mode):
1199 Don't assume cc_t fits in int.
1201 * src/remove.h: Add copyright notice.
1202 (struct rm_options): Use bool for booleans.
1203 * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
1204 errno_rmdir_non_empty, remove_parents, main): Likewise.
1205 * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
1207 (main): Don't dump core if invoked with argv[0]==NULL.
1208 * src/tee.c (tee, append, ignore_interrupts, main, tee):
1209 Use bool for booleans.
1210 (tee): Use ssize_t for read returns.
1212 * src/ptx.c: Add a FIXME mentioning that there are many
1213 unchecked integer overflows in this file.
1214 (gnu_extensions, auto_reference, input_reference, right_reference,
1215 ignore_case, initialize_regex, fix_output_parameters,
1216 output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
1217 Use bool for booleans.
1218 (SKIP_SOMETHING, compare_words, digest_break_file,
1219 find_occurs_in_text, fix_output_parameters):
1220 Use to_uchar instead of a caset.
1221 (print_field): Rewrite to avoid cast.
1223 * src/printf.c (posixly_correct): Use bool for booleans.
1224 (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
1225 (STRTOX): Rewrite to avoid casts.
1226 (print_esc_char): Arg is char, not int.
1227 * src/readlink.c (canonicalize): Remove. All uses now merely inspect
1229 (no_newline, verbose): Use bool for booleans.
1230 (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
1231 * src/shred.c (struct Options, main): Use bool for booleans.
1232 (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
1233 * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
1234 Use bool for booleans.
1235 * src/stat.c (G_fail): Remove.
1236 (print_statfs): Print various gotta-be-nonnegative values using
1237 unsigned long int, not long int or int.
1238 (do_statfs, do_stat): Return a boolean success flag.
1239 (do_stat, main): Use bool for booleans.
1241 * src/pr.c: Add a FIXME mentioning that there are many
1242 unchecked integer overflows in this file.
1243 (TRUE, FALSE): Remove. All uses replaced by true and false.
1244 (struct COLUMN, read_line, print_page, print_stored, open_file,
1245 skip_to_page, init_fps, parallel_files, align_empty_cols,
1246 empty_line, FF_only, explicit_columns, extremities, keep_FF,
1247 print_a_FF, print_a_header, use_form_feed, have_read_stdin,
1248 print_across_flag, storing_columns, balance_columns,
1249 truncate_lines, join_lines, untabify_input, failed_opens,
1250 numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
1251 double_space, ignore_failed_opens, use_col_separator,
1252 pad_vertically, last_line, main, init_parameters, skip_read,
1253 read_line, print_stored):
1254 Use bool for booleans.
1255 (struct COLUMN, char_to_clump, store_char, print_char):
1257 (clump_buff, print_clump): Use char[], not int[], for an array whose
1258 elements are always chars.
1259 (first_last_page, main, getoptarg, balance, add_line_number,
1260 char_to_uclump): Remove unnecessary casts.
1261 (init_parameters): Allocate chars, not ints, for clump_buff.
1262 (print_char): Use to_uchar before invoking ISPRINT.
1263 (char_to_clump): Convert to unsigned char before invoking ISPRINT.
1265 * src/nohup.c (main): Use bool for booleans.
1266 * src/paste.c (paste_parallel, paste_serial, main): Likewise.
1267 * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
1268 (portable_chars_only): Use to_uchar rather than a cast.
1269 * src/printenv.c (main): Use bool for booleans.
1270 Do not assume that the environ has at most one matching entry
1271 for each option (integer overflow was possible otherwise).
1273 * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
1274 constant. Do not assume PRIdMAX etc. are strings of length 3 or
1276 (struct tspec): Use it. fmt_string is now an array, not
1277 a pointer, as there's little point to the indirection here.
1278 (struct tspec, flag_dump_strings,
1279 traditional, flag_pseudo_start, limit_bytes_to_format,
1280 abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
1281 decode_one_format, open_next_file, check_and_close,
1282 decode_format_string, skip, write_block, read_char, read_block,
1283 parse_old_offset, dump, dump_strings, main):
1284 Use bool for booleans.
1285 (struct tspec): Use void *, not char *, for generic pointers.
1286 (bytes_to_oct_digits, bytes_to_signed_dec_digits,
1287 bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
1288 Use char, not unsigned int, since char suffices.
1289 (print_s_char, print_char, print_s_short, print_short,
1290 print_int, print_long, print_long_long, print_float,
1291 print_double, print_long_double): Rewrite to avoid casts.
1292 These now take void * arguments, instead of char *.
1293 Use the same body for all functions, except for the choice
1294 of type. Assume C89 to simplify handling of signed char.
1295 (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
1296 Rewrite to avoid casts.
1297 (print_named_ascii, print_ascii): Now takes void *, not char *.
1298 (decode_one_format): Use int for printf field widths, not
1299 unsigned int. Pass void * to subsidiary printers,
1300 not char *. Simplify handling of floating-point formats
1301 by factoring out common code dealing with precision and field width.
1302 (decode_format_string): Avoid need for temporary copy of
1303 each decoded struct tspec.
1304 (get_lcm): Remove unnecessary cast.
1305 (main): Fix bug where more than INT_MAX failed decodes were ignored.
1307 2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
1309 * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
1310 (enum number_format): Remove.
1311 (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
1313 (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
1314 (section_del): Now const.
1315 (print_fmt): Remove.
1316 (starting_line_number, page_incr, blank_join, line_no,
1317 print_lineno, proc_text, main):
1318 Use intmax_t for line numbers.
1319 (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
1320 Use bool for booleans.
1321 (lineno_format): Now a string, not an enum value.
1322 (build_print_fmt): Remove. All calls removed. This work is
1323 now done within print_lineno.
1324 (build_type_arg): Use size_t for sizes.
1325 (print_lineno): Check for line number overflow.
1326 (proc_text, main): Remove unnecessary cast.
1328 * src/ln.c (symbolic_link, interactive, remove_existing_files,
1329 verbose, hard_dir_link, dereference_dest_dir_symlinks,
1330 do_link, main): Use bool for booleans.
1332 * src/ls.c (struct fileinfo, file_interesting,
1333 extract_dirs_from_files, color_symlink_as_referent,
1334 FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
1335 numeric_ids, print_block_size, dired, print_with_color,
1336 check_symlink_color, print_inode, recursive, immediate_dirs,
1337 all_files, really_all_files, qmark_funny_chars,
1338 print_dir_name, format_needs_stat, format_needs_type, visit_dir,
1339 main, decode_switches, parse_ls_color, print_dir, file_interesting,
1340 gobble_file, make_link_path, basename_is_dot_or_dotdot,
1341 extract_dirs_from_files, print_long_format):
1342 Use bool for booleans.
1343 (dir_defaulted): Remove; no longer needed.
1344 (main): Use int to count files, since it suffices for argv.
1345 Rewrite to avoid need for dir_defaulted.
1346 (main, print_dir, gobble_file, get_link_name,
1348 Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
1349 (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
1350 Remove unnecessary cast to int. Use int instead of unsigned
1351 int to count from 0 to 1.
1352 (get_funky_string, print_type_indicator): Use char for bytes, not int.
1353 (make_link_path): Use NULL for null pointers.
1354 (quote_name): Use to_uchar instead of cast.
1356 * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
1357 print_full_info): Use bool for booleans.
1358 (problems): Remove, replacing with....
1359 (ok): New var (inverted from old sense).
1360 (print_user, print_group, print_full_info):
1361 Print uids/gids with %lu, not %u.
1362 (xgetgroups): Don't run out of memory if getgroups or getugroups
1364 * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
1366 * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
1367 int, since it suffices.
1368 (factor, print_factors): Use size_t for sizes.
1369 (print_factors, do_stdin, main): Use bool for booleans.
1370 * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
1371 (fold_file, main): Use bool for booleans.
1372 (fold_file, main): Use size_t for sizes.
1373 (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
1374 of prohibiting widths greater than INT_MAX.
1375 * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
1376 write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
1377 elide_tail_lines_pipe, elide_tail_lines_seekable,
1378 elide_tail_lines_file, head_bytes, head_lines, head, head_file,
1379 string_to_integer, main):
1380 Use bool for booleans.
1381 (main): Rewrite to avoid cast.
1383 * src/csplit.c (struct line): Use size_t for sizes.
1384 (main): Remove unnecessary cast.
1385 * src/cut.c (cut_fields): Use to_uchar rather than a cast.
1386 * src/cut.c (cut_file, main): Use bool for booleans.
1387 * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
1388 * src/env.c (main): Likewise.
1389 * src/expr.c (nextarg): Likewise.
1390 * src/env.c (main): Remove unused and nonstandard envp arg.
1392 * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
1393 fmt's arbitrary limits.
1394 (TRUE, FALSE): Remove; all uses changed to (true, false).
1395 (main): Use bool for booleans.
1396 Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
1398 (copy_rest): Remove unnecessary cast.
1399 (get_prefix): Rewrite to avoid cast.
1400 (check_punctuation): Use char *, not unsigned char *; C89 requires
1401 this. Avoid off-by-one buffer read overrun when line is empty.
1402 (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
1403 Remove unnecessary casts.
1404 * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
1407 * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
1408 next_file, expand, main):
1409 Use bool for booleans.
1410 (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
1412 Use uintmax_t for column counts.
1413 (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
1414 All callers changed.
1415 (parse_tabstops): Don't pass a negative char to isblank.
1416 Avoid memory leak with large tab stops.
1417 (validate_tabstops, expand): Don't assume number of tab stops is
1419 (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
1420 storing values into exit_status.
1421 (expand): Use same pattern as unexpand for reading chars.
1422 Report an error when input line is too long, instead of silently
1423 screwing up. Do not mishandle tab stops when backspacing left
1426 * src/dircolors.c (have_read_stdin, append_quoted,
1427 dc_parse_stream, dc_parse_file, main): Use bool for booleans.
1428 (dc_parse_stream): Use enum for state, rather than int.
1429 Use ssize_t to store getline result.
1431 * src/dd.c (translation_needed, parse_integer, scanargs,
1432 apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
1433 Use bool for booleans.
1434 (translate_buffer): Use to_uchar rather than a cast.
1435 (swab_buffer, copy_simple, copy_with_unblock):
1436 Use size_t for sizes.
1438 * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
1439 * src/sleep.c (apply_suffix): Likewise.
1440 * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
1441 forever, from_start, print_headers, have_read_stdin, valid_file_spec,
1442 write_header, file_lines, pipe_lines, pipe_bytes, recheck,
1443 tail_forever, tail_bytes, tail_lines, tail, tail_file,
1444 parse_obsolescent_option, parse_options, main): Likewise.
1445 * src/sleep.c (apply_suffix): Invert sense of result.
1446 Use int (not unsigned int) for multiplier, as this generates better
1447 code with some compilers. Simplify code a bit.
1448 * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
1449 parse_options): Use uintmax_t, not unsigned int or unsigned long int,
1451 (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
1452 make it a bit clearer.
1454 * src/hostname.c: Include "xgethostname.h".
1455 (xgethostname): Remove decl; xgethostname.h has it.
1456 (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
1457 && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
1458 prototypes rather than K&R form. Assume any negative value from
1459 sysinfo denotes failure, not just -1.
1460 (main): Simplify use of sethostname.
1462 * src/pinky.c (include_idle, include_heading, include_fullname,
1463 include_project, include_plan, include_home_and_shell, do_short_format,
1464 include_where, main): Use bool for booleans.
1465 (count_ampersands, create_fullname, scan_entries, short_pinky):
1466 Use size_t for sizes.
1467 (create_fullname): Check for overflow in size calculations.
1468 (idle_string): Don't assume that the number of idle days
1469 is less than 10**8 and/or INT_MAX/(24*60*60).
1470 (main): No need to pass a non-NULL last arg to getopt_long.
1471 * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
1472 (print_uptime): Remove unused local variable.
1473 (main): No need to pass a non-NULL last arg to getopt_long.
1474 * src/users.c (list_entries_users, users): Use size_t for sizes.
1475 (list_entries_users): Use char for bytes.
1476 (main): No need to pass a non-NULL last arg to getopt_long.
1477 * src/who.c (do_lookup, short_list, short_output, include_idle,
1478 include_heading, include_mesg, include_exit, need_boottime,
1479 need_deadprocs, need_login, need_initspawn, need_clockchange,
1480 need_runlevel, need_users, my_line_only, main): Use bool for booleans.
1481 (print_runlevel): Use unsigned char for bytes.
1482 (list_entries_who, scan_entries, who): Use size_t for sizes.
1483 (main): No need to pass a non-NULL last arg to getopt_long.
1485 * src/install.c (isdir): Remove decl.
1486 (install_file_to_path): Rely on make_path to fail if the destination
1487 is not a directory, by passing preserve_existing==true to it.
1488 Hence we no longer need to call isdir.
1489 Free dest_dir immediately when it's no longer needed, rather than
1490 waiting until the end of the function.
1491 (copy_file): Don't bother calling isdir, as copy will do the
1492 right thing if the destination is a directory.
1494 * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
1495 print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
1496 Use bool for booleans.
1497 (max_depth): Now size_t, not int, to avoid an arbitrary limit
1498 of INT_MAX on depth.
1499 (G_fail): Remove: no longer needed, now that the relevant
1500 functions return bool.
1501 (process_file): Use return value to signal success rather than
1502 setting a global. Remove first_call static var; not needed, since
1503 we can look at n_alloc. Use size_t for depths. Remove FIXME
1504 about size_t casts, as it's now fixed. Use xnrealloc rather
1505 than the obsolescent XREALLOC. Don't bother to check whether
1506 reallocation is needed unless level > prev_level.
1507 (du_files): Invert sense of result, for consistency with
1508 other coreutils code. All callers changed.
1509 (main): Allow --max-depth values up to SIZE_MAX.
1511 * src/df.c (inode_format, show_all_fs, show_local_fs,
1512 show_listed_fs, posix_format, require_sync, print_type,
1513 selected_fstype, excluded_fstype, show_dev, show_point, main):
1514 Use bool for booleans.
1515 (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
1516 (show_dev, show_point, main):
1517 Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
1518 Don't assume disk name lengths are <= INT_MAX.
1519 Rewrite pct calculation to avoid cast.
1520 (show_point): Don't assume resolved length is <= SSIZE_MAX.
1522 * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
1523 instead of uintptr_t.
1524 * src/shred.c (UINT_MAX_32_BITS): Remove.
1525 (word32): Remove. All uses changed to uint32_t.
1526 (isaac_seed_data): Remove unnecessary cast.
1527 * src/system.h (ptr_align): Use size_t; in practice, this is just as
1528 good as uintptr_t in checking for alignments, and has fewer
1529 configuration hassles.
1531 * src/Makefile.am (localedir.h): Make it readonly; this
1532 undoes part of the 2004-07-27 patch.
1534 2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
1536 * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
1537 (IS_THOUSANDS_SEP): Use bool when appropriate.
1538 (numcompare, main): Use char, not int, when the value is always a char.
1539 (numcompare): Remove "register"; compilers are smart enough these days.
1540 * src/system.h (errno, CHAR_BIT): Remove decls;
1541 no longer needed now we assume C89 or better.
1542 Include <inttypes.h> before <stdint.h>, as it's the
1543 Autoconf-recommended pattern.
1544 (to_uchar): New inline function, moved here from tr.c.
1545 Use full names for int types, e.g. "long int" rather than "long".
1546 * src/tr.c (to_uchar): Remove; now in system.h.
1547 (is_char_class_member): Use bool when appropriate.
1549 * src/mkdir.c (create_parents, main): Use bool when appropriate.
1550 (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
1552 2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
1554 * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
1556 * src/chmod.c (recurse, force_silent, process_file, process_files,
1557 main): Use bool when appropriate.
1558 * src/cksum.c (cksum, main): Likewise.
1559 * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
1560 compare_files, main): Likewise.
1562 * src/copy.h (struct cp_options): Likewise.
1563 * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
1564 same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
1565 * src/cp-hash.h (remember_created): Likewise.
1566 * src/cp-hash.c (remember_created): Likewise.
1567 * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
1568 re_protect, make_path_private, target_directory_operand, do_copy,
1569 cp_option_init, decode_preserve_arg, main): Likewise.
1570 * src/install.c (isdir, change_timestamps, change_attributes,
1571 copy_file, install_file_to_path, install_file_in_dir,
1572 install_file_in_file, strip_files, dir_arg, cp_option_init, main,
1573 change_attributes, change_timestamps): Likewise.
1574 * src/mv.c (remove_trailing_slashes, rm_option_init,
1575 cp_option_init, do_move, movefile, main): Likewise.
1576 * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
1577 AD_push, prompt, remove_dir): Likewise.
1578 * src/rm.c (rm_option_init, main): Likewise.
1580 * src/remove.c (top_dir, pop_dir, full_filename_):
1581 Use size_t for sizes.
1582 * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
1583 succeeds. It's not necessary in that case, as *NEW_DST is always
1585 (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
1586 (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
1587 * src/rm.c (main): Likewise.
1589 md5sum, sha1sum integer cleanups.
1591 * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
1593 (ALG_UNSPECIFIED): Remove.
1594 (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
1595 * src/md5.c: Don't include any files other than checksum.h.
1596 * src/sha1sum.c: Likewise.
1597 * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
1598 bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
1599 Use bool when appropriate.
1600 (digest_check): Increase limit of number of input lines to
1601 UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
1602 Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
1604 2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
1606 * src/cat.c (exit_status): Remove. Now done by passing a boolean
1608 (simple_cat, cat): Return true if successful. All callers changed.
1609 (simple_cat, cat, main): Use bool for booleans.
1610 (simple_cat): Use size_t for sizes.
1611 (cat, main): Use the same names for parameters that we use for
1612 long options, to avoid confusion. This inverts the sense of the
1613 show_tabs (formerly output_tabs) and number_nonblank
1614 (formerly numbers_at_empty_lines) variables.
1615 (main): Don't mess up (due to integer overflow) if we are given
1616 INT_MAX - INT_MIN + 1 options.
1617 [O_BINARY]: Don't invoke isatty unless the other options require it.
1618 (main): When deciding whether to use simple_cat, don't worry
1619 about binary option; it's irrelevant.
1621 * src/dcgen: Remove comments, trailing white space, and empty
1622 lines from the output strings, to save space.
1623 Use a narrower type like 'unsigned char' for line lengths, if
1625 Make the output variables static, not extern.
1627 * src/chgrp.c (parse_group): Require base 10 when parsing
1629 (main): int -> bool when appropriate.
1630 * src/chown.c (main): Likewise.
1631 * src/chown-core.c: Include inttostr.h.
1632 (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
1633 (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
1634 instead of uint_to_string).
1635 (describe_change): Instead of an int flag, use a char *
1636 auxiliary; this avoids the need for casts.
1637 Assume free (NULL) works.
1638 (change_file_owner): Return true/false, not 0/-1, since
1639 we don't set errno. All callers changed.
1640 Use bool when appropriate.
1641 (chown_files): Likewise.
1642 * src/chown-core.h (chown_files): Likewise.
1644 * tests/chown/basic: Test for proper handling of uids like
1645 "010", which must be parsed as decimal.
1647 * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
1648 pwd when there are multiple names for the working directory
1649 (which can happen with an automounter, sigh).
1651 * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
1652 this causes Solaris 8 'make' to refuse to build "groups".
1653 (localedir.h): Don't depend on Makefile: this causes Solaris
1654 8 'make' to build localedir.h unnecessarily. The dependence
1655 on Makefile is ineffective anyway, since $(localedir) might
1656 change even if Makefile hasn't.
1658 * src/remove.c (remove_dir): If we can't save the state of the
1659 working directory, pretend we started from "/", not ".".
1660 This avoids a bug on hosts like Solaris that don't let you
1661 remove the working directory.
1663 2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
1665 * src/printf.c (strtiomax, strtoumax): Declare if not already
1666 declared: this fixes a portability bug with Solaris 8 + GCC.
1667 (STRTOX): Parenthesize use of macro arg as expression.
1668 (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
1670 * configure.ac: Check for declaration of strtoumax, for
1673 * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
1674 pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
1676 * tests/readlink/can-e: Don't assume that we can remove the
1677 working directory: this isn't possible under Solaris 8, say.
1678 * tests/readlink/can-f: Likewise.
1679 * tests/readlink/can-m: Likewise.
1681 * src/copy.c (copy_internal): find_backup_file_name no longer
1682 returns NULL, so don't bother to check for this.
1683 * src/cp.c (do_copy): Likewise.
1684 * src/ln.c (do_link): Likewise.
1686 2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
1688 * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
1690 (NZERO): New macro, if system doesn't define it already.
1691 (usage): Distinguish priorities from nice values.
1692 Don't assume NZERO is 20.
1693 (main): Use bool instead of int where appropriate.
1694 If user specifies an adjustment out of range, always truncate it
1695 to an inrange value instead of sometimes giving an error message
1697 Do not assume that -1 is an error return from "nice" or
1698 "getpriority", as it might be the current nice value minus NZERO.
1699 If nice/setpriority fails with errno == EPERM, go ahead and run
1700 the command anyway; POSIX requires this.
1702 * src/pathchk.c: Include euidaccess.h.
1703 (dir_ok): Use euidaccess, not access.
1704 * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
1705 (eaccess): Remove. All users changed to use euidaccess instead.
1707 2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
1709 * src/uptime.c (print_uptime) [defined BOOT_MSG]:
1710 Don't assume ut_line is null-terminated.
1711 * src/who.c (print_line): New arguments USERLEN and LINELEN,
1712 since USER and LINE might not be null terminated. All callers
1715 2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
1717 Fix bug with "tail -f" reported by Rob Holland in
1718 <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
1719 Also, remove the undocumented and unsupported-since-2000
1720 --max-consecutive-size-changes options. Fix another related bug:
1721 "tail" got confused if stdin, stdout, or stderr were closed.
1722 Also, use output buffering even with "tail -f".
1724 * NEWS: Document this, plus yesterday's patch.
1725 * doc/coreutils.texi (tail invocation): "size has remained the same"
1726 -> "file has not changed", which is more accurate for fifos.
1727 * src/tail.c: Include fcntl-safer.h.
1728 (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
1729 (COPY_A_BUFFER): New macro.
1730 (struct File_spec): New members mtime, mode, blocking.
1731 Remove member n_consecutive_size_changes.
1732 (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
1733 max_n_consecutive_size_changes_between_opens,
1734 MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
1735 (long_options, tail_forever, parse_options):
1736 Remove (non-)support for --max-consecutive-size-changes.
1737 (record_open_fd): New function.
1738 (recheck, tail_file): Use it. Don't assume that stdin is open.
1739 (dump_remainder): Add support for new COPY_A_BUFFER special value.
1740 Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
1741 (recheck): New arg BLOCKING, specifying whether to use blocking reads.
1743 (n_live_files): Remove, replacing with...
1744 (any_live_files): New function. All uses changed.
1745 (tail_forever): Use nonblocking I/O unless we know that blocking I/O
1746 is safe; this avoids some hangs when reading from a fifo.
1747 Avoid invoking fstat or sleep when using blocking I/O.
1748 Do not check for changes to size if the file is not a regular file,
1749 as the size is undefined in that case.
1750 Check for changes to mtime or mode, too; this works for non-regular
1752 (tail_forever, main): Redo fflush strategy to work even when input
1753 is nonblocking. Don't use unbuffered output; just flush when needed.
1755 2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
1757 * src/tail.c (main): Ignore -f if no file operand is specified
1758 and standard input is a pipe.
1759 * doc/coreutils.texi (tail invocation): Do not ignore -f for
1760 all pipes, just for when standard input is a pipe and no
1761 file operand is specified.
1762 * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
1763 Add a new commented-out f-2 test, which we still fail.
1764 (test_vector): All f-* tests are special cases, not just f-1.
1766 2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
1768 * src/uptime.c: Include c-strtod.h.
1769 (print_uptime): Use c_strtod instead of setlocale and sscanf.
1770 Use long int rather than int to count days (for 64-bit hosts),
1771 and check for arithmetic overflow when converting double to time_t.
1773 2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
1775 * src/printf.c (vstrtold): Renamed from vstrtod.
1776 Now returns long double. All uses changed.
1777 (print_direc): Use "L" length modifier when printing floating point
1778 numbers, since we're now printing long double.
1780 2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
1782 printf cleanup, to avoid undefined behavior, to add support for
1783 formats that Bash supports, and to support wide integers like
1786 * NEWS: Document this.
1787 * src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
1788 booleans, so that we don't reserve any values for precision or
1790 (STRTOX): Use prototype, not K&R-style definition.
1791 (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
1792 in ../lib), with type change to intmax_t.
1794 (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
1796 (vstrtod): Renamed from xstrtod. All uses changed.
1797 (print_direc): Use boolean arg instead of special value to indicate
1798 a missing precision or width. LENGTH no longer includes
1799 length modifiers or conversion character. New arg CONVERSION
1800 now specifies conversion character.
1801 Use intmax_t-width formatting for integers (like Bash).
1802 Add support for C99 %a, %A, %F (like Bash).
1803 Add support for field width with %c (POSIX requires this).
1804 Add a FIXME for lack of support for field width and precision
1806 Add support for '\'', '0' flags.
1807 Check for invalid combinations of flags, field width, precision,
1808 and conversion, to prevent use of undefined behavior.
1809 Allow multiple length modifiers, for formats like "%lld" (like Bash).
1810 Add support for C99 'j', 't', 'z' length modifiers (like Bash).
1811 In error message, output entire invalid conversion specification,
1812 instead of merely outputting % followed by the conversion char.
1813 * tests/misc/printf: Add tests for the above.
1815 2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
1817 Change "readlink -f" to be more compatible with prior implementations.
1818 Add more canonicalize options, -e and -m.
1819 Add comprehensive tests for all readlink modes.
1821 * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
1822 Do not add canonicalize.c here.
1824 * src/readlink.c (longopts): Add new options.
1825 (usage): Document them.
1826 (canonicalize_fname): New proxy function.
1827 (main): Handle new options.
1828 * doc/coreutils.texi (readlink invocation): Document new
1829 "readlink -f" behaviour and new canonicalize options, -e and -m.
1831 * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
1832 * tests/Makefile.am (SUBDIRS): Add readlink.
1833 * tests/readlink/Makefile.am: New file.
1834 * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
1835 * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
1836 * tests/misc/readlink: Remove file.
1838 2004-07-04 Jim Meyering <jim@meyering.net>
1840 * src/copy.c (copy_internal): Add a FIXME comment.
1842 2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
1844 * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
1845 * src/cp.c (do_copy): Likewise.
1846 * src/mv.c (movefile): Likewise.
1848 * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
1849 to avoid problem when path_concat dir name is longer than 2 GiB (!).
1851 * src/nohup.c (main): Don't pass NULL first argument to path_concat.
1852 This cleans up the semantics a bit, as we no longer try to open the
1855 2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
1857 * NEWS: Add short names -t and -T for --target-directory
1858 and --no-target-directory options, respectively.
1860 * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
1861 Remove. All uses changed to 'T' and 't', respectively.
1862 * src/install.c, src/ln.c, src/mv.c: Likewise.
1864 * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
1865 aliases for --target-directory and --no-target-directory,
1867 * src/install.c (long_options, main, usage): Likewise.
1868 * src/ln.c, src/mv.c: Likewise.
1870 2004-07-01 Jim Meyering <jim@meyering.net>
1872 * Makefile.maint (sc_file_system): New target.
1873 (syntax-check-rules): Add it.
1874 .x-sc_file_system: New file.
1875 * Makefile.am (EXTRA_DIST): Add it.
1877 * man/sync.x: Use "file system" rather than "filesystem".
1878 * man/stat.x, man/df.x: Likewise.
1880 2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
1882 * src/df.c (usage, main): Output "file system" rather than
1884 * src/du.c (usage): Likewise.
1885 * src/shred.c (usage): Likewise.
1886 * src/stat.c (usage): Likewise.
1887 * src/stat.c (long_options, usage): Rename "--filesystem" to
1888 "--file-system". But keep the old name around, for compatibility
1891 2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
1893 Add support for --no-target-directory option.
1895 * NEWS: Document it.
1896 * doc/coreutils.texi (Common options, Target directory, cp
1897 invocation, install invocation, mv invocation, ln invocation):
1899 (link invocation): Explain how to rewrite link using ln now
1900 that we have --no-target-directory.
1901 (ln invocation): Explain that --no-target-directory subsumes
1903 (unlink invocation): Modify wording to match new wording in
1906 * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
1907 (long_opts, usage, do_copy, main): Add support for
1908 --no-target-directory,
1909 * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
1911 * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
1913 * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
1915 * src/mv.c (enum): Sort values.
1917 2004-06-29 Jim Meyering <jim@meyering.net>
1919 Don't let verbose-mode output from a subshell obscure actual differences.
1920 * tests/rm/inaccessible: Turn off command-echoing just before
1921 invoking subshell, then turn it back on if VERBOSE=yes afterward.
1923 2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
1925 Add support for 'install --target-directory', an option
1926 that has been documented for years but not implemented (!).
1927 * doc/coreutils.texi (install invocation): Document
1928 --target-directory in synopsis, too.
1929 * src/install.c (TARGET_DIRECTORY_OPTION): New var.
1930 (long_options, main, usage): Add --target-directory.
1931 (target_directory_operand): New function, stolen from mv.c.
1932 (main): Use it. Check for -d and --target-directory.
1933 Alter wording of diagnostics to match other programs.
1935 2004-06-28 Jim Meyering <jim@meyering.net>
1937 * src/cp.c (usage): Fix copy+paste error in description of
1938 --target-directory: s/move/copy/. From Paul Jarc.
1940 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
1942 Use more-consistent rules among cp, ln, and mv when dealing with
1943 last operands that are (or look like) directories.
1945 * src/cp.c (target_directory_operand): New, nearly-common function,
1946 It reports an error if the destination appears to be a directory
1947 (e.g., because it has a trailing slash) but is not.
1948 * src/ln.c, src/mv.c: Likewise.
1949 * src/cp.c (do_copy): Use it.
1950 * src/ln.c (main): Likewise.
1951 * src/mv.c (main): Likewise.
1953 * src/cp.c (do_copy): Don't assume argc is positive.
1954 Don't bother to lstat dest, since copy() will do that for us.
1955 Use "const" to avoid the need for cast.
1957 * src/cp.c (do_copy): Don't output a usage message because of file
1958 problems (e.g., an operand is not a directory). Use it only for
1959 syntax. Standardize on "target %s is not a directory" for the
1961 * src/ln.c (main): Likewise.
1962 * src/mv.c (main): Likewise.
1964 * src/cp.c (do_copy): Remove test for trailing slash, since
1965 target_directory_operand now does this.
1966 * src/ln.c (main): Likewise.
1967 * src/mv.c (movefile): Likewise.
1969 * src/cp.c (main): Reject multiple target directories.
1970 Check whether a specified target is a directory when parsing the
1971 options, using stat. This gives more-accurate diagnostics.
1972 * src/ln.c (main): Likewise.
1974 * src/ln.c (isdir): Remove decl; no longer needed.
1975 * src/mv.c (isdir, lstat): Likewise.
1977 * src/ln.c (do_link): New arg dest_is_dir. All uses changed.
1978 Don't check the destination ourself; rely on dest_is_dir.
1979 This way we can avoid lstatting the destination in the
1980 usual case, and in the worst case we lstat 1, not 3 times.
1981 Don't bother to unlink unless link failed; this saves a syscall.
1982 Remove unnecessary backup_succeeded flag;
1983 it was identical to "dest_backup != NULL".
1985 * src/ln.c (main): Use int to count to argc, not unsigned int.
1986 This handles negative operand counts.
1987 * src/mv.c (main): Likewise.
1989 * src/mv.c (do_move): Don't call hash_init; expect the caller to
1990 do it, for consistency with cp.c and ln.c. All callers changed.
1991 (movefile): dest_is_dir parameter is now bool, not int.
1992 (main): Standardize on "missing destination file operand after %s"
1993 for the diagnostic, for consistency with cp.c.
1995 * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
1996 will complain about the arg count.
1997 Adjust to new (briefer) diagnostics.
1998 * tests/cp/fail-perm: Add a test to verify that we get the new
1999 diagnostic when failing to copy through a symlink-to-inaccessible-dir.
2001 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
2003 Fix a bug: formerly, if d/x was a directory and x a file, "ln x
2004 d/" incorrectly created a link d/x/x. It also saves some system
2007 * NEWS: Document the fix.
2009 * src/ln.c (main): Don't append basename to dest if this
2010 results in an existing directory name.
2011 * tests/ln/misc: See whether a trailing slash is followed too far.
2013 2004-06-26 Jim Meyering <jim@meyering.net>
2015 * src/printf.c (main): When given no arguments, print the standard
2016 "missing operand\nTry printf --help..." message -- to be consistent.
2018 2004-06-26 Jim Meyering <jim@meyering.net>
2020 * src/mknod.c (main): Add \n at the end of message output via fprintf.
2022 2004-06-25 Jim Meyering <jim@meyering.net>
2024 * tests/ln/misc: Add test for ln subscript error.
2026 2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
2028 * src/ln.c (do_link): Remove unnecessary call to lstat.
2029 (main): Avoid subscript error when the destination is "".
2031 2004-06-23 Jim Meyering <jim@meyering.net>
2033 * tests/*: Replace all occurrences of `(exit N); exit' with
2034 `(exit N); exit N'. Otherwise, those many tests could exit with
2035 improper exit status when exiting via e.g., a trapped interrupt.
2036 Thanks to a report from Bob Proulx.
2038 2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
2040 * src/who.c (idle_string, print_user): New arg boottime,
2041 specifying the most recent boot time. All uses changed.
2042 (idle_string) Consider a line to be "old" if it hasn't been used
2043 since the last boot time. Watch out for overflow when computing
2044 times, and for times in the future.
2045 (idle_string): Record latest boot time.
2047 2004-06-22 Jim Meyering <jim@meyering.net>
2049 * src/test.c (usage): Correct description of `-t FD'. The file
2050 descriptor, FD, is no longer optional. Reported by Ton Nijkes.
2052 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
2054 The 2004-06-19 fix for who and pinky was incomplete, as ctime
2055 has undefined behavior if the year precedes -999 or follows 9999.
2056 Since we have to stop using ctime anyway, we might as well use
2057 strftime and fix the FIXME, and support internationalized dates.
2059 * NEWS: Document the new behavior.
2060 * src/who.c: Include "hard-locale.h".
2061 (time_format, time_format_width): New vars.
2062 (time_string, print_line): Use them.
2064 (time_string): Use localtime + strftime instead of
2065 ctime, to avoid problems with years before -999 or after 9999.
2066 * src/pinky.c: Likewise.
2068 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
2070 Fix bug: GNU 'ls' didn't count columns correctly if user or group
2071 names contained multibyte characters where the column count
2072 differed from the byte count. This patch also corrects
2075 * src/ls.c (format_user_or_group): New function, which counts
2077 (format_user, format_group): Use it.
2078 (format_user_or_group_width): New function, which counts columns
2080 (format_user_width, format_group_width): Use it.
2082 2004-06-21 Jim Meyering <jim@meyering.net>
2084 * tests/priv-check: Quote "$PATH" in PATH=$PATH.
2085 Suggestion from Andreas Schwab.
2087 * tests/priv-check: When running as root, be sure to propagate
2088 PATH through to the process we exec as non-root.
2089 Reported by michael@aplatform.com.
2091 * src/mknod.c (main): Don't segfault when calculating the
2092 expected number of operands for `mknod NAME'.
2094 2004-06-20 Jim Meyering <jim@meyering.net>
2096 * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
2098 2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
2100 * src/basename.c (main):
2101 Standardize on the diagnostics given when someone gives
2102 too few operands ("missing operand after `xxx'") or
2103 too many operands ("extra operand `xxx'").
2104 Include "quote.h" and/or "error.h" if it wasn't already being included.
2105 * src/chgrp.c (main): Likewise.
2106 * src/chmod.c (main): Likewise.
2107 * src/chown.c (main): Likewise.
2108 * src/chroot.c (main): Likewise.
2109 * src/comm.c (main): Likewise.
2110 * src/cp.c (do_copy): Likewise.
2111 * src/csplit.c (main): Likewise.
2112 * src/date.c (main): Likewise.
2113 * src/dircolors.c (main): Likewise.
2114 * src/dirname.c (main): Likewise.
2115 * src/du.c (main): Likewise.
2116 * src/expr.c (main): Likewise.
2117 * src/hostid.c (main): Likewise.
2118 * src/hostname.c (main): Likewise.
2119 * src/id.c (main): Likewise.
2120 * src/install.c (main): Likewise.
2121 * src/join.c (add_file_name, main): Likewise.
2122 * src/link.c (main): Likewise.
2123 * src/ln.c (main): Likewise.
2124 * src/logname.c (main): Likewise.
2125 * src/md5sum.c (main): Likewise.
2126 * src/mkdir.c (main): Likewise.
2127 * src/mkfifo.c (main): Likewise.
2128 * src/mknod.c (main): Likewise.
2129 * src/mv.c (main): Likewise.
2130 * src/nohup.c (main): Likewise.
2131 * src/od.c (main): Likewise.
2132 * src/pathchk.c (main): Likewise.
2133 * src/ptx.c (main): Likewise.
2134 * src/readlink.c (main): Likewise.
2135 * src/rm.c (main): Likewise.
2136 * src/rmdir.c (main): Likewise.
2137 * src/seq.c (main): Likewise.
2138 * src/setuidgid.c (main): Likewise.
2139 * src/shred.c (main): Likewise.
2140 * src/sleep.c (main): Likewise.
2141 * src/sort.c (main): Likewise.
2142 * src/split.c (main): Likewise.
2143 * src/stat.c (main): Likewise.
2144 * src/test.c (beyond, main): Likewise.
2145 * src/touch.c (main): Likewise.
2146 * src/tr.c (main): Likewise.
2147 * src/tsort.c (main): Likewise.
2148 * src/tty.c (main): Likewise.
2149 * src/uname.c (main): Likewise.
2150 * src/uniq.c (main): Likewise.
2151 * src/unlink.c (main): Likewise.
2152 * src/uptime.c (main): Likewise.
2153 * src/users.c (main): Likewise.
2154 * src/who.c (main): Likewise.
2155 * src/whoami.c (main): Likewise.
2157 * tests/basename/basic: Adjust to new diagnostics.
2158 * tests/du/files0-from: Likewise.
2159 * tests/expr/basic: Likewise.
2160 * tests/mv/diag: Likewise.
2161 * tests/tsort/basic-1: Likewise.
2163 2004-06-20 Jim Meyering <jim@meyering.net>
2165 * src/ln.c: Remove declaration of yesno.
2166 Instead, include yesno.h.
2167 * src/copy.c: Likewise.
2169 * src/remove.c: Remove declaration of yesno.
2170 Instead, include yesno.h.
2171 (top_dir): Remove now-unnecessary cast of obstack_base.
2172 (pop_dir): Likewise.
2173 (full_filename_): Likewise.
2175 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
2177 Don't dump core if ctime returns NULL; this is possible on
2178 hosts with 64-bit time_t and 32-bit int.
2179 * src/who.c: Include "inttostr.h".
2180 (time_string): If ctime fails, print the raw time as an integer
2181 instead of dumping core.
2182 * src/pinky.c: Likewise, as follows:
2183 Include "inttostr.h".
2184 (time_string): New function, copied from who.c.
2185 (print_entry): Use it.
2187 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
2189 * src/who.c (print_line): Don't truncate user names at 8 bytes.
2190 Problem reported by Guido Leenders in:
2191 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
2192 * NEWS: document this.
2194 2004-06-19 Jim Meyering <jim@meyering.net>
2196 * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
2197 using GNU_PACKAGE (from PACKAGE) once again. This restores
2198 `GNU' to the parenthesized package name in --version output.
2199 Before, the first argument from AC_INIT, `GNU coreutils', would
2200 be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
2201 Reported by Richard Stallman.
2203 2004-06-17 Jim Meyering <jim@meyering.net>
2205 * src/tr.c (to_uchar): Rename function from `uchar'. The latter
2206 would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
2208 2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
2210 * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
2211 allows the GNU behavior. "--" is now supported by chroot, hostid,
2212 hosname, pwd, sync, yes.
2213 * doc/coreutils.texi (yes invocation, false invocation,
2214 true invocation): Document this.
2215 * src/chroot.c (main): Handle "--".
2216 * src/hostid.c (main): Likewise.
2217 * src/hostname.c (main): Likewise.
2218 * src/pwd.c (main): Likewise.
2219 * src/sync.c (main): Likewise.
2220 * src/yes.c (main): Likewise.
2221 * src/true.c (main): Recognize --help and --version even if
2222 POSIXLY_CORRECT is set.
2223 * src/yes.c (main): Likewise.
2225 2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
2227 * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
2229 * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
2230 * src/ls.c (decode_switches): Pay attention to TABSIZE even if
2231 POSIXLY_CORRECT is set. POSIX reserves upper-case environment
2232 variables to the implementation, so it's OK for ls to depend on
2234 * src/pr.c: Include "hard-locale.h".
2235 (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
2236 POSIX specifies the behavior only in the POSIX locale.
2237 * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
2238 since POSIX says the behavior is unspecified here.
2239 * src/tail.c (parse_obsolescent_option): Support multiple file operands
2240 even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
2241 * src/printf.c (main): Recognize --help, --version even if
2242 POSIXLY_CORRECT. POSIX does not specify any options, but it
2243 does not prohibit options either, so "printf" is like "expr" here.
2244 * src/unlink.c (main): Likewise.
2245 * tests/misc/printf: Adjust to the new semantics for \x if
2248 2004-06-14 Jim Meyering <jim@meyering.net>
2250 * tests/misc/pwd: New test, for fix of 2004-04-19.
2251 * tests/misc/Makefile.am (TESTS): Add pwd.
2252 (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
2254 * src/copy.c: Remove declaration of euidaccess.
2255 Instead, include "euidaccess.h".
2257 2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
2259 * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
2260 (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
2261 as (sizeof "??") reliably returns 3.
2262 (print_line): Guard against idle and pid being too long
2263 (which is possible when printing headers).
2264 (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
2265 Avoid unnecessary cast of sizeof to int.
2266 (make_id_equals_comment): Do not assume that UT_ID returns
2267 a string; it might return a non-null-terminated array.
2268 Use strncat instead. It's not very often where strncat is
2269 exactly what you want, but this is one of those rare cases.
2271 2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
2273 * src/who.c (list_entries_who): Don't output a trailing space.
2275 2004-06-09 Jim Meyering <jim@meyering.net>
2277 * src/touch.c (usage): Improve wording in description of the
2278 --time=WORD option. Reported by Dan Jacobson.
2280 * src/chown-core.c (change_file_owner): Change names of parameters
2281 old_uid and old_gid to required_uid and required_gid respectively.
2283 * src/chmod.c (mode_changed): Return false, not 0, now that the
2284 function returns `bool'.
2286 2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
2288 Adjust chmod and chown to be similar if -c or -v are given. In
2289 particular, a no-op chown is no longer reported as a change; this
2290 reverts to previous behavior. Also, fix both commands so that -v
2291 report failures even if the failure is not due to the chmod or
2294 * src/chmod.c (CH_NOT_APPLIED): New constant.
2295 (describe_change): Handle it.
2296 (process_file): Use it, if a symlink wasn't changed.
2297 (mode_changed): Return bool, not int. Accept new argument
2298 NEW_MODE; all callers changed. This lets us avoid statting the
2299 file unless the new mode has unusual bits.
2300 (process_file): Return -1 on error. With -v, report all errors
2301 verbosely, not just some.
2303 * src/chown-core.c (change_file_owner): Return -1 on error, not
2304 1 sometimes and -1 on others. Our caller ORs together our results,
2305 and (-1 | 1) == 0 on ones-complement hosts.
2306 With -v report all errors verbosely, not just some.
2307 Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
2308 file_stats wasn't set properly in that case.
2310 * tests/chgrp/basic: Adjust to above changes.
2312 2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
2314 * tests/chgrp/basic: Test that chgrp -h does not fail on
2315 symlinks, even on hosts where that's not supported.
2316 Test that if -R is specified without -H or L, -h is assumed.
2317 Test that chown() is not optimized away.
2319 2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
2321 Several fixes to chgrp and chown for compatibility with POSIX and BSD:
2323 Check for incompatible options. When -R and --dereference are
2324 both used, then either -H or -L must also be used. When -R and -h
2325 are both used, then -P must be in effect.
2327 -H, -L, and -P have no effect unless -R is also specified.
2328 If -P and -R are both specified, -h is assumed.
2330 Do not optimize away the chown() system call when the file's owner
2331 and group already have the desired value. This optimization was
2332 incorrect, as it failed to updated the last-changed time and reset
2333 special permission bits, as POSIX requires.
2335 Do not report an error if the owner or group of a
2336 recursively-encountered symbolic link cannot be updated because
2337 the file system does not support it.
2339 * NEWS: Document the above.
2341 * src/chgrp.c (main): Check for incompatible options. -R --dereference
2342 requires either -H or -L, and -R -h requires -P. If -H, specify
2343 FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
2344 file as much like chown.c as possible.
2345 * src/chown.c (main): Likewise.
2347 * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
2348 needed. Chown a directory only after chowning its children; this
2349 avoids problems if the new directory ownership doesn't permit
2350 access to the children. Dereference symlinks before doing
2351 ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
2352 Do not optimize away the chown() system call when the file's owner
2353 and group already have the desired value. POSIX does not permit
2354 this optimization. Rely on chown and lchown to do the right
2355 thing with symlinks and/or -1 arguments, now that we have wrappers
2356 to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
2357 errors, not just command-line errors.
2358 (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
2360 * src/system.h (ENOTSUP): Remove.
2362 * tests/chgrp/basic: Use chown --from to discover whether the
2363 group changed, since chgrp now changes unconditionally. This
2364 complicates the sed script a bit. Do not specify --dereference,
2365 since it's the default (and we want to test this). Adjust output
2366 to match the fact that chgrp no longer optimizes the case of
2367 changing a file's group to the same value as before.
2368 * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
2369 options are incompatible, and their behavior is undefined with POSIX.
2370 (changed, not_changed): Adjust to match the fact that -h is no longer
2371 specified. Sort names.
2372 * tests/chown/deref: Adjust error-diagnostic spelling to match new
2375 2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
2377 * src/uname.c (main): Fix typo introduced on 2003-05-10 that
2378 prevented a diagnostic of any operands.
2380 2004-06-08 Jim Meyering <jim@meyering.net>
2382 * src/shred.c (direct_mode): Turn it on/off with directio, too.
2384 2004-06-07 Jim Meyering <jim@meyering.net>
2386 Enable direct-mode I/O (bypassing the buffer cache), if possible.
2387 Prompted by a suggestion from Kalle Olavi Niemitalo
2388 in http://bugs.debian.org/207035.
2389 * src/shred.c (direct_mode): New function.
2390 (do_wipefd): Turn on direct-mode I/O.
2391 (dopass): If a file's first write fails with EINVAL,
2392 turn off direct-mode I/O and retry the write.
2394 2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
2396 * src/tr.c (main): "tr -d a b" is now a fatal error even if
2397 POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
2400 2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
2402 * src/shred.c (dopass): Don't subtract 1 from the offset after
2403 a write error. Problem reported by Jon Peatfield in:
2404 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
2406 2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
2408 Fix bug reported by Buciuman Adrian in
2409 <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
2410 where 'dd' created a file that was too large. The bug was that dd
2411 assumed that the input file offset does not advance after a failed
2412 read; but POSIX says that the input file offset is undefined after
2415 * src/dd.c (MAX_BLOCKSIZE): New macro.
2416 (input_seekable, input_seek_errno, input_offset,
2417 input_offset_overflow): New vars.
2418 (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
2419 (advance_input_offset): New function.
2420 (skip_via_lseek): Set errno to zero when reporting our failure,
2421 so that we don't report based on garbage errno.
2422 (skip): If fdesc is standard input, advance the input offset.
2423 Do not quit if reading, and if noerror was specified;
2424 POSIX seems to require this.
2425 If read fails on output file, report the earlier lseek failure
2426 instead; this fixes a FIXME in dd_copy.
2427 (advance_input_after_read_error): New function.
2428 (dd_copy): Use it, instead of assuming that failed reads
2429 do not advance the file pointer. Advance input offset
2430 after nonfailed reads. Advance only a partial block if
2431 the previous read (before the failed read) succeeded, and
2432 do not generate an output block of zeros in this case.
2433 (main): Determine initial input offset, seekability of input,
2434 and error if it wasn't seekable.
2436 2004-06-02 Jim Meyering <jim@meyering.net>
2438 rm (without -f) could hang unnecessarily when attempting to
2439 remove a symlink to a file on an off-line NFS-mounted partition.
2440 Reported by David Howells in https://bugzilla.redhat.com/124699.
2441 * src/remove.c (write_protected_non_symlink): New function.
2442 Don't invoke euidaccess on symlinks.
2443 (prompt): Use write_protected_non_symlink rather than using
2444 euidaccess directly, being careful not to call lstat twice for a file.
2446 Fix a bug in how the --output-delimiter=D option works with
2447 abutting byte or character ranges. Reported by David Krider in
2448 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
2449 * src/cut.c (print_kth): Remove special case for open-ended range.
2450 (set_fields): Record the range start index for an interval even
2451 when it abuts another interval on its low side.
2452 Also record the range start index of the longest right-open-interval.
2453 * tests/cut/Test.pm: Add tests of --output-delimiter=S with
2454 abutting and overlapping byte ranges.
2456 2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
2458 Some POSIX-conformance cleanups for tr.
2460 * src/tr.c (posix_pedantic): Remove; no longer needed since
2461 we need to test this in just one place now.
2462 (usage): Mention -C.
2463 (unquote): Note that \055, \n, etc are escaped.
2464 Do not worry about POSIXLY_CORRECT when warning about ambiguous
2466 \ at end of string stands for itself.
2467 Do not diagnose invalid backslash escapes: POSIX says the behavior
2468 is unspecified in this case, so we don't need to diagnose it.
2469 (main): Add support for -C (currently an alias for -c).
2470 Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
2472 * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
2473 Fix comment for range-a-a.
2475 2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
2477 Improve the efficiency (and in one case, correctness) of code
2478 that reads symlinks.
2480 * src/copy.c (copy_internal): Don't use alloca, as it can mess up
2481 royally if the link length is long (e.g., GNU/Hurd). Use
2482 xreadlink instead, it's safer. Don't bother to read the link if
2483 it's the wrong size. Add a FIXME because this area is a bit murky
2485 * src/ls.c (get_link_name): Update use of xreadlink.
2486 * src/readlink.c (main): Likewise.
2487 * src/stat.c (print_stat): Likewise.
2489 2004-06-01 Jim Meyering <jim@meyering.net>
2491 * src/env.c (main): Prefer the notation `STREQ (a, b)'
2492 over `!strcmp (a, b)'.
2493 * src/sort.c (main, sort_buffer_size): Prefer the notation
2494 `STREQ (a, b)' over `strcmp (a, b) == 0'.
2495 * src/date.c (batch_convert): Likewise.
2496 * src/expr.c (nextarg): Likewise.
2497 * src/su.c (correct_password, restricted_shell, main): Likewise.
2498 * src/ptx.c (swallow_file_in_memory, main): Likewise.
2499 * src/test.c (binary_operator, and, or, main): Likewise.
2501 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
2503 * NEWS: echo compatibility cleanup.
2504 * doc/coreutils.texi (echo invocation): Document the changes.
2505 * src/echo.c (V9_ECHO): Remove; always enabled.
2506 (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
2507 we use the same naming convention as bash. Now an enum,
2509 (usage): Reword to mention -e/-E more accurately.
2510 Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
2511 (hextobin): New function.
2512 (main): Use bool rather than int for local vars when appropriate.
2513 Do not allow options if POSIXLY_CORRECT, unless we are using
2514 BSD semantics and the first argument is "-n".
2515 Don't pass unnecessary extra arg to parse_long_options.
2516 do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
2517 Do not look for options if !allow_options.
2518 Use size_t rather than int when appropriate.
2519 Open-code option test rather than using strrchr.
2520 Use faster test for "-".
2521 Avoid redundant argc test.
2522 Add support for \x, for Bash compatibility.
2523 Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
2524 When '\c' is encountered, stop printing immediately, as POSIX
2526 Add support for \xhh syntax.
2527 Add support for \0ooo syntax; POSIX requires this.
2529 2004-06-01 Jim Meyering <jim@meyering.net>
2531 * Use automake-1.8b. Regenerate dependent files.
2533 2004-05-31 Jim Meyering <jim@meyering.net>
2535 * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
2536 the build src/ directory -- at the front.
2537 ($(srcdir)/$x-tests): Depend on Makefile.am.
2538 Use $x as the program name, except when it would be `test' (test is
2539 the sole program tested via mk-script that is also a shell built-in).
2540 In that case, use the old ../../src/$x.
2542 2004-05-30 Jim Meyering <jim@meyering.net>
2544 Work around HPUX /bin/cc compiler bug that is exposed, now that
2545 sets are arrays of type `bool'. More details here:
2546 http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
2547 FIXME: verify that the above URL points to the right message
2549 * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
2550 rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
2551 (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
2552 system, those two expressions are not the same (256 vs. 1024).
2553 The effect of this problem was that `tr -c x y' would fail:
2554 tr: when not truncating set1, string2 must be non-empty
2555 (set_initialize): Remove unnecessary initialization of the `in_set'
2556 buffer; that initialization triggered the same compiler bug as above.
2558 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
2560 tr cleanup, mostly having to do with integer type ranges.
2563 * tests/tr/Test.pm: Add a few tests for the below. Alas, most of
2564 the test cases wouldn't be portable, or would take too much CPU
2567 * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
2568 This is safe since the code already assumes N_CHARS fits in int.
2569 (Filter): Remove: we want to prototype everything.
2570 (ORD, CHR): Remove. All uses removed. Some replaced with:
2571 (uchar): New function. All places where a char must be converted
2572 to an unsigned char are now done this way, not by ad-hoc methods.
2573 (count): New type. Use it whenever counts or states are needed.
2574 (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
2575 since we used it in an unsigned int context) to UINTMAX_MAX - 1.
2576 (REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
2577 whenever appropriate.
2578 (NOT_A_CHAR): Remove global macro; now a local enum.
2579 (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
2580 the rest of the code no longer depends on them.
2581 (class_ok): Remove; all uses changed to use inline comparisons.
2582 (RE_NO_TYPE): Remove; wasn't used or needed.
2583 (struct List_element): normal_char and equiv_code are now unsigned
2585 first_char, last_char, and the_repeated_char are now unsigned char,
2586 not unsigned int. repeat_count is now count, not size_t.
2588 (struct Spec_list): state is now count, not unsigned int.
2589 lengthis now count, not size_t.
2590 n_indefinite_repeats is now size_t, not int.
2591 has_equiv_class, has_char_class, and has_restricted_char_class
2592 are now bool, not int. All uses changed.
2593 (struct E_string): s is now char *, not unsigned char *.
2594 escaped is now bool *, not int *. All uses changed.
2595 (ES_MATCH): Remove macro, replacing with:
2596 (es_match): New inline function. All uses changed.
2597 (squeeze_repeats, complement, posix_pedantic, truncate_set1,
2598 translating): Now bool, not int.
2599 (io_buf): Now char array, not unsigned char.
2600 (SET_TYPE): Remove. All uses replaced with bool.
2601 (is_equiv_class_member, unquote, append_range, append_char_class,
2602 append_equiv_class, find_closing_delim, star_digits_closebracket,
2603 build_spec_list, parse_str, homogeneous_spec_list):
2604 Now returns bool, not int. All uses changed.
2605 (is_equiv_class_member): Now inline.
2606 (is_equiv_class_member, is_char_class_member, make_printable_str,
2607 append_normal_char, append_range, append_repeated_char,
2609 Args are now of proper integer type.
2610 (unquote, look_up_char_class, make_printable_str,
2611 append_equiv_class, build_spec_list, squeeze_filter):
2612 Avoid unsigned char *p; gently convert *p to unsigned char instead.
2613 (unquote, get_spec_stats): Do not jump past declarations and then
2614 use them; C doesn't allow this in portable programs.
2615 (make_printable_str): Check for overflow in size calculations.
2616 (xmemdup): Remove. All uses rewritten.
2617 (find_bracketed_repeat): Args are now of proper pointer-to-integer
2618 type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
2619 (find_bracketed_repeat, star_digits_closebracket): Check that the
2620 digits are not escaped.
2621 (build_spec_list): Don't bother to copy opnd_str; not needed.
2622 (build_spec_list, get_next): Simplify internal logic a bit.
2623 (card_of_complement): Fix bug due to char overflow.
2624 (get_spec_stats): Don't assume len fits into int.
2625 Check for integer overflow. Use abort() rather than assert(0).
2626 (string2_extend): Fix subscript error: is_char_class_member (..., 255)
2628 (squeeze_filter): READER is never null now; simplify code.
2629 READER arg now has a simpler type. Remove unnecessary casts.
2630 (squeeze_filter, main): Calls to fwrite improperly checked result
2631 against zero, rather than against requested size.
2632 (plain_read): New function.
2633 (read_and_delete, read_and_xlate):
2634 Remove unused filter arg, and don't worry about hit_eof.
2635 Simplify by using plain_read.
2636 (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
2637 (main): Always pass a non-null procedure to squeeze_filter.
2638 Rewrite so that class_ok isn't needed.
2640 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
2642 * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
2643 fdatasync reports EBADF when syncing (unwritable) directories.
2644 Problem reported by Albert Chin-A-Young in:
2645 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
2647 2004-05-29 Jim Meyering <jim@meyering.net>
2649 * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
2650 Patch from Albert Chin.
2652 * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
2654 * src/remove.c (push_dir): Merge declaration and adjacent assignment
2655 into a single statement.
2657 2004-05-28 Jim Meyering <jim@meyering.net>
2659 * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
2661 2004-05-22 Jim Meyering <jim@meyering.net>
2663 rm -r would get a failed assertion when run from an inaccessible
2664 directory and with two or more command line arguments including an
2665 absolute-named directory followed by a relative-named directory.
2667 * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
2668 * src/remove.c (struct cwd_state): Define.
2669 (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
2670 can be detected by the caller. Instead of returning a malloc'd
2671 directory name, communicate it to caller via a new parameter, and
2672 return an indication of whether restore_cwd failed. Update caller.
2673 Eliminate an unnecessary call to AC_stack_top.
2674 (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
2675 so we can now communicate to caller whether/how functions like
2676 restore_cwd have failed. Update caller.
2677 (rm_1): Fail if we've failed to restore the working directory
2678 and the name of the next file to remove is `.'-relative.
2679 (rm): Fail if the require_restore_cwd flag is true and we've
2680 failed to restore the working directory.
2681 * src/mv.c (rm_option_init): Initialize new member,
2682 x->require_restore_cwd.
2683 * src/rm.c (rm_option_init): Likewise.
2685 2004-05-21 Jim Meyering <jim@meyering.net>
2687 * tests/rm/inaccessible: New test for the above fix.
2688 * tests/rm/Makefile.am (TESTS): Add inaccessible.
2690 * src/remove.c (rm): Use free rather than XFREE.
2691 (remove_dir): Use xmalloc, not XMALLOC.
2692 (ds_init): Likewise.
2694 2004-05-20 Jim Meyering <jim@meyering.net>
2696 * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
2697 diagnostics in shred.c have been fixed, don't exempt shred.c from
2700 * src/shred.c: Use translatable diagnostics, e.g.
2701 change "%s: remove" to _("%s: failed to remove") and
2702 change "%s: close" to _("%s: failed to close").
2704 2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
2706 * src/shred.c (names): Bring back lower-case letters, "_", and
2707 ".". But continue to omit +, =, %, @, #, as they're either
2708 shell metacharacters (for some shells) or are not in some
2709 character sets, or (in the case of '%') must be a
2710 metacharacter somewhere.
2712 2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
2714 * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
2716 2004-05-17 Jim Meyering <jim@meyering.net>
2718 * src/shred.c (incname): Decrement `len' only once per loop iteration.
2720 chgrp and chown now dereference symlinks by default, per POSIX.
2721 Reported by Michal Politowski as http://bugs.debian.org/249177.
2723 * src/chown-core.c (chopt_init): Affect each symlink referent by default.
2724 * src/chown.c (usage): Update to reflect this.
2725 * src/chgrp.c (usage): Likewise.
2726 * NEWS: Describe the change.
2727 Adapt tests accordingly.
2728 * tests/chgrp/basic: Use -h where necessary to retain semantics.
2729 * tests/chgrp/deref: Likewise.
2730 * tests/chgrp/posix-H: Likewise.
2732 2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
2734 In shred, check for errors from fdatasync more carefully. If
2735 fdatasync fails with errno==EINVAL, it means this implementation
2736 does not support synchronized I/O for this file. Do not report
2737 this as an error, as (for example) AIX 5.2 fdatasync reports it
2738 for raw disk devices. Problem reported by Albert Chin in
2739 <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
2741 Check for write errors, though: the old code ignored them.
2742 Improve error checking in a few other cases, too (e.g., close of a
2745 Also, change several 'int' values to 'bool', so that the error
2746 checking is a bit clearer. Similarly, change unsigned values
2747 to size_t where appropriate.
2749 * src/shred.c: Include "dirname.h".
2750 (datasync) [!HAVE_FDATASYNC]: Remove.
2751 (dosync): New function.
2752 (dopass): Use it. Return 1 on write error, -1 on other error.
2753 All callers changed. Report write error if dosync does.
2754 (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
2755 not int (0/-1). All callers changed. Return false if there's a
2757 (incname): Return bool (true/false), not int (0/1). Accept
2758 size_t length, not unsigned. All callers changed. Do not
2759 bother checking for non-digits; it can't happen. Replace
2760 recursion with iteration.
2761 (wipename): Use dir_name, base_name, etc. instead of assuming
2762 Unix file names. Use size_t for length, not unsigned.
2763 Report error if unlink or close fails.
2764 (wipename, main): Use bool for booleans.
2766 (names): Use only digits and uppercase letters, for greater
2769 2004-05-16 Jim Meyering <jim@meyering.net>
2771 * tests/chown/deref: New test for the yesterday's change.
2772 * tests/chown/Makefile.am (TESTS): Add deref.
2774 2004-05-15 Jim Meyering <jim@meyering.net>
2776 chown --dereference did nothing when the owner/group of a
2777 symlink matched the desired owner/group. Reported by David Malone.
2778 Also reported in 1999 as http://bugs.debian.org/39642.
2780 * src/chown-core.c (change_file_owner): When --dereference has
2781 been specified, and when processing a symlink, stat it to get the
2782 owner and group of the referent.
2784 2004-05-14 Jim Meyering <jim@meyering.net>
2786 * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
2787 s/supercede/supersede/ reported by Andrew Fabbro.
2789 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
2791 Improve performance of `sort -m' on large files, at the cost of
2792 making some contrived examples unsafe. POSIX allows this
2793 optimization. Performance problem reported by Jonathan Baker in
2794 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
2796 * src/sort.c (first_same_file): Do not treat input pipes
2797 differently from other files.
2798 * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
2799 might write F before reading all the input.
2802 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
2804 * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
2805 '\007', for portability to EBCDIC hosts.
2806 * src/printf.c (print_esc_char): Likewise.
2807 * src/tr.c (unquote, make_printable_str): Likewise.
2809 2004-05-12 Jim Meyering <jim@meyering.net>
2811 * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
2812 where the result is used. This avoids one unnecessary lstat call
2813 per command line argument.
2815 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
2817 Don't assume that "make -C" works; Solaris "make" doesn't have -C.
2819 * src/Makefile.am (all_programs.list): New rule, copied from
2820 man/Makefile.am and tests/Makefile.am, except that we use the
2821 system tr rather than ./tr and we don't use tr -s.
2822 * tests/Makefile.am (all_programs): Use it.
2823 * man/Makefile.am (all_programs): Likewise. Renamed from programs,
2824 for consistency. All uses changed.
2826 2004-05-11 Jim Meyering <jim@meyering.net>
2828 * tests/rm/unread3: New test, for the above fix and today's
2829 lib/save-cwd.c improvement.
2830 * tests/rm/Makefile.am (TESTS): Add unread3.
2832 * src/rm.c: Don't include "save-cwd.h". It's no longer used.
2834 2004-05-10 Jim Meyering <jim@meyering.net>
2836 * tests/install/trap: New file. Test for bug fix of 2004-04-18.
2837 * tests/install/Makefile.am (TESTS): Add trap.
2839 * src/remove.c (AD_push): Don't use errno in diagnostic about
2842 Remove these generated files from CVS.
2843 * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
2844 * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
2845 * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
2846 * tests/tr/tr-tests, tests/wc/wc-tests:
2848 2004-05-09 Jim Meyering <jim@meyering.net>
2850 * src/tr.c (unquote): Use xcalloc rather than xmalloc and
2851 a loop initializing the just-allocated memory to zero.
2853 2004-05-08 Jim Meyering <jim@meyering.net>
2855 * tests/rm/no-give-up: New file; check for today's fix.
2856 * tests/rm/Makefile.am (TESTS): Add no-give-up.
2858 2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
2860 Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
2861 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
2863 * src/remove.c (remove_entry): Check for errno values like ENOENT
2864 that show the file cannot be directory, instead of for errno
2865 values like EPERM that show the file might be a directory. This
2866 is necessary because, when a single unlink() call has multiple
2867 reasons to fail, it can set errno to any of those reasons; it's
2868 only the rare errno value like ENOENT that excludes all the other
2869 possible reasons to fail even when the file is a directory.
2870 (remove_cwd_entries): Don't attempt chdir if the file is known
2871 to not be a directory.
2872 (remove_dir): Use the same method that remove_cwd_entries uses
2873 (for some reason they differed). Don't assert that saved_errno
2874 must be EPERM; it might be just about anything.
2876 2004-05-06 Jim Meyering <jim@meyering.net>
2878 * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
2879 Don't add `1' to the buffer size (it was to protect against malloc
2880 implementations that fail to allocate a buffer of size zero).
2881 That is no longer necessary, since we use a malloc wrapper
2884 * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
2885 * src/head.c (elide_tail_bytes_pipe): Likewise.
2886 * src/df.c (main): Likewise.
2887 * src/shred.c (do_wipefd): Likewise.
2888 * src/users.c (list_entries_users): Likewise.
2889 * src/tail.c (main): Likewise.
2890 * src/md5sum.c (main): Likewise.
2892 2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
2894 * src/df.c (show_disk, show_point): If several filesystems are
2895 mounted on the same mount point, prefer the last one, not the first.
2896 Problem reported by Christian Jones in
2897 <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
2898 (show_disk): Remove unused statp arg. Return bool, not int.
2899 (show_point): Rewrite to avoid gotos. Use the same algorithm
2900 for lofs and dummies for each pass through the mount table,
2901 rather than subtly different algorithms (which are probably
2904 2004-05-03 Jim Meyering <jim@meyering.net>
2906 * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
2909 2004-05-01 Jim Meyering <jim@meyering.net>
2911 When chown or chgrp is modifying the referent of a symlink,
2912 use the chown(2) function, if possible.
2913 * src/chown-core.c (change_file_owner): Don't hard-code the
2914 open/fchown/close kludge here. Use `chown' instead.
2915 The chown function works just fine on conforming systems.
2916 Other systems now go through the new chown wrapper that
2917 resorts to the old kludge.
2919 * src/chown-core.c (change_file_owner): Add a comment.
2921 2004-04-27 Jim Meyering <jim@meyering.net>
2923 * src/ptx.c: Make over 40 global extern variables `static'.
2924 (syntax_table, re_syntax_table): Remove declarations of two unused
2925 variables (they were exposed by the above change).
2927 * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
2928 * src/ln.c (backup_type): Likewise.
2930 * src/remove.c (rm): Add `extern' keyword.
2931 * src/cp-hash.c (forget_created, remember_created)
2932 (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
2933 * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
2934 * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
2935 (uid_to_name, chown_files): Likewise.
2937 * src/Makefile.am (sc_tight_scope): New rule.
2938 * Makefile.maint (sc_tight_scope): New rule.
2939 (syntax-check-rules): Add it.
2941 2004-04-26 Jim Meyering <jim@meyering.net>
2943 * Use automake-1.8.4. Regenerate dependent files.
2945 * src/sort.c (limfield): Make a comment clearer.
2947 2004-04-25 Paul Eggert <eggert@twinsun.com>
2949 Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
2950 leading blanks when computing the location of the field end;
2951 it is not supposed to skip trailing blanks. Solaris 8 "sort"
2952 does conform to POSIX. Also fix the documentation to clarify
2953 this and related issues.
2955 * doc/coreutils.texi (sort invocation): Mention -k earlier, so
2956 that the options are in alphabetical order. Describe how -b works
2957 more-accurately; this involves fixing some examples, too. Mention
2958 what happens if the start field falls after an end field or after
2959 a line end. Warn about using -k without -b, -g, -M, -n, or -t.
2960 Add an example of how to sort IPv4 addresses and Apache Common
2961 Log Format dates. Remove a duplicate example.
2962 (Putting the tools together): Use separate options rather
2963 than agglomerating them.
2964 * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
2965 decode whether to skip leading blanks.
2966 (trailing_blanks): Remove.
2967 (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
2969 * tests/pr/Test.pm: Fix typo in env_default comment.
2970 * tests/sort/Test.pm: Likewise.
2971 (18c, 18d): Reverse the order of output lines, so that the
2972 test cases conform to POSIX.
2974 2004-04-22 Paul Eggert <eggert@twinsun.com>
2976 More signal-handling cleanup for ls.c. Do not allow signals to
2977 happen between arbitrary output bytes, as the
2978 restore-default-color sequence can bollix up multibyte chars or
2979 color-change sequences in the ordinary output. Instead, process
2980 signals only between printing a file name and changing the color
2981 back to non_filename_text color. That way, if the signal handler
2982 changes the color (to the default), 'ls' will change it back when
2983 'ls' continues (after being suspended).
2985 Also, do not bother with signal-handling unless stdout is a
2986 controlling terminal; this lets stdio buffer better when "ls
2987 --color" is piped or sent to a file.
2989 * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
2990 Do not include "full-write.h"; no longer needed.
2991 (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
2992 (put_indicator_direct): Remove. All callers changed to use
2994 (caught_signals, interrupt_signal, stop_signal_count): New vars.
2995 (restore_default_color): Don't bother checking for put_indicator
2997 (sighandler): Don't handle SIGTSTP; that's another handler now.
2998 Simply set interrupt_signal to the signal, then exit.
2999 (stophandler, process_signals): New functions.
3000 (main): Don't output any color changes until _after_ the signal
3001 handlers are set up. This fixes a race condition where 'ls'
3002 could be interrupted while initializing colors, and leaving the
3003 terminal in an undesirable state.
3004 Don't mess with signal-handling if standard output is not a
3005 controlling terminal.
3006 When exiting, restore the default color, then restore the
3007 default signal handling, then act on any signals that weren't
3009 Do not print //DIRED// etc. in colors; this avoids the need
3010 to catch signals when printing them.
3011 (print_name_with_quoting): Process signals just before switching
3012 color back to non_filename_text.
3014 2004-04-23 Jim Meyering <jim@meyering.net>
3016 Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
3017 * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
3018 of quotearg_buffer. Patch by Mikulas Patocka.
3020 2004-04-18 Paul Eggert <eggert@twinsun.com>
3022 tee ignored SIGPIPE, but POSIX doesn't allow this.
3024 * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
3025 does not allow this. This undoes the 1996-10-24 patch.
3027 2004-04-18 Paul Eggert <eggert@twinsun.com>
3029 Signal-handling cleanup for coreutils. Here are the highlights:
3031 - csplit sometimes failed to remove files when interrupted.
3032 - csplit didn't clean up if two signals arrived nearly simultaneously.
3033 - install -s would infloop on System V if SIGCHLD was ignored.
3034 - ls could incorrectly restore color if multiple signals
3035 arrived nearly simultaneously.
3037 * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
3039 (filename_space, prefix, suffix, digits, files_created, remove_files):
3041 (caught_signals): New var.
3042 (cleanup): Block signals while deleting all files.
3043 (cleanup_fatal, handle_line_error, regexp_error):
3044 Mark with ATTRIBUTE_NORETURN.
3045 (create_output_file, close_output_file, interrupt_handler):
3046 Block signals while changing the number of output files,
3047 to fix some race conditions.
3048 (delete_all_files): Do nothing if remove_files is zero.
3049 Clear files_created.
3050 (main): Don't mess with signals until after argument processing
3053 * src/csplit.c (main): Rewrite signal-catching code to make it
3054 similar to other coreutils programs. When processing signals,
3055 block all signals that we catch, but do not block signals that we
3056 don't catch. Avoid problems with unsigned int warnings.
3057 * src/ls.c (main): Likewise.
3058 * src/sort.c (main): Likewise.
3060 * src/csplit.c (interrupt_handler):
3061 Use void, not (obsolete) RETSIGTYPE.
3062 * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
3064 * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
3065 Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
3066 * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
3067 * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
3068 * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
3070 * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
3072 * src/install.c: Include <signal.h>.
3073 (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
3074 given, since System V fork+wait does not work if SIGCHLD is ignored.
3076 * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
3077 handler to self, not to SIG_IGN, since SIGTSTP can be received
3079 (main): Use SA_RESTART, as that is simpler than checking for EINTR
3080 failures all over the place.
3082 2004-04-20 Jim Meyering <jim@meyering.net>
3084 * src/remove.c (is_empty_dir): Clarify comment.
3086 * man/help2man: Accept new option: --program-name=NAME, so that we
3087 can override the one in --version output. This is needed solely
3088 so that test.1 doesn't refer to `[' as the program name.
3089 Reported by Benjamin Cutler as http://bugs.debian.org/205251.
3090 * man/Makefile.am (.x.1): Use help2man's new --program-name option.
3092 * src/pwd.c: Don't include pathmax.h; system.h already does it.
3094 * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
3096 2004-04-19 Jim Meyering <jim@meyering.net>
3098 * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
3099 Initialize a buffer to avoid warnings from tools like valgrind.
3101 * Makefile.maint (sc_trailing_blank): New rule.
3102 (syntax-check-rules): Add it.
3103 * .x-sc_trailing_blank: New file.
3105 Make pwd work even if the resulting name is so long that getcwd fails.
3106 * src/pwd.c: (path_free, path_init, path_prepend): New functions.
3107 (nth_parent, find_dir_entry, robust_getcwd): New functions.
3108 (main): First try getcwd, then, upon failure, robust_getcwd.
3110 2004-04-18 Jim Meyering <jim@meyering.net>
3112 * src/who.c (print_user): Use xrealloc here, rather than
3113 unchecked realloc. Remove anachronistic casts.
3115 * src/remove.c (full_filename_): Don't leak upon failed realloc.
3117 * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
3119 * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
3120 renaming it. Update uses.
3122 2004-04-17 Jim Meyering <jim@meyering.net>
3124 * configure.ac: Depend on automake-1.8.3.
3126 * src/join.c (add_file_name): Declare function to be `static'.
3127 (string_to_join_field): Likewise.
3128 * src/remove.c (ds_init, ds_free): Likewise.
3130 * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
3131 (syntax-check-rules): Add to the list.
3133 2004-04-13 Paul Eggert <eggert@twinsun.com>
3135 Use page-aligned buffers whenever we bother to do I/O using buffer
3136 sizes that are tailored for the files.
3138 * src/cat.c: Include getpagesize.h.
3139 * src/copy.c: Likewise.
3140 * src/shred.c: Likewise.
3141 * src/split.c: Likewise.
3142 * src/cat.c (main): Align I/O buffers to page boundaries.
3143 * src/copy.c (copy_reg): Likewise.
3144 * src/shred.c (dopass): Likewise.
3145 * src/split.c (main): Likewise.
3146 * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
3147 All uses replaced by ptr_align.
3148 * src/od.c (gcd, lcm): Remove; now in system.h.
3149 * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
3151 2004-04-14 Jim Meyering <jim@meyering.net>
3153 Remove m4/Makefile.am: it's no longer needed, with newer automake
3154 * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
3155 * Makefile.am (SUBDIRS): Remove `m4' from the list.
3157 2004-04-13 Jim Meyering <jim@meyering.net>
3159 * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
3161 2004-03-27 Paul Eggert <eggert@twinsun.com>
3163 * NEWS: cp -pu and mv -u (when copying) now take the destination
3164 file system time stamp resolution into account.
3165 * doc/coreutils.texi (mv invocation): Document this.
3166 (cp invocation): Document -u (it was missing!) with new behavior.
3168 * src/copy.c: Include "utimecmp.h".
3169 (copy_internal): Compare time stamps using utimecmp rather than
3172 2004-04-09 Jim Meyering <jim@meyering.net>
3174 * Makefile.maint (.re-list): New rule/file, to replace
3175 hard-coded list of header file names.
3176 (sc_system_h_headers): Use the new file.
3177 Don't look for sys2.h anymore.
3179 * src/system.h: Include new "stat-macros.h" rather than hard-coding
3180 all of its macro definitions -- the list was slightly out of date.
3181 Suggestion from Dmitry V. Levin.
3183 2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
3185 * NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
3186 * doc/coreutils.texi (dd invocation): Likewise.
3187 * src/shred.c (O_NOCTTY): Remove redundant decl.
3188 * src/dd.c (flags, usage): Remove noctty flag.
3189 (main): Always use O_NOCTTY when opening files.
3191 2004-04-08 Jim Meyering <jim@meyering.net>
3193 * src/dd.c (dd_copy): Mark two diagnostics for translations.
3194 (set_fd_flags): Undo part of today's change: it's a little
3195 cleaner -- and more efficient in the common case -- to go
3196 ahead and OR in the -1 when fcntl fails.
3198 * Makefile.maint (sc_dd_max_sym_length): New target.
3199 (syntax-check-rules): Add it.
3201 * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
3202 Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
3204 * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
3205 Rename parameter, flags, to avoid shadowing global.
3206 (LONGEST_SYMBOL): Tweak comment.
3208 2004-04-07 Paul Eggert <eggert@twinsun.com>
3210 * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
3211 and new dd options iflag= and oflag=.
3212 * src/dd.c (usage): Likewise.
3213 * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
3214 * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
3215 (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
3216 (input_flags, output_flags): New vars.
3217 (LONGEST_SYMBOL): New macro.
3218 (struct symbol_value): Renamed from struct conversion. Members
3219 symbol and value renamed from convname and conversion. The
3220 symbol value is now an array instead of a pointer; this saves
3221 a bit of space and time in practice. All uses changed.
3222 (conversions): Add nocreat, excl, fdatasync, fsync. Now const.
3223 (flags): New constant array.
3224 (iflag_error_msgid, oflag_error_msgid): New constants.
3225 (parse_symbols): Renamed from parse_conversion and generalized
3226 to handle either conversion or flag symbols.
3227 (scanargs): Adjust uses of parse_symbols accodingly. Add
3228 support for iflag= and oflag=. Reject attempts to use
3229 both excl and nocreat.
3230 (set_fd_flags): New function.
3231 (dd_copy): Just return X rather than calling quit (X), since our
3232 caller invokes quit with the returned value. Add support for
3233 fdatasync and fsync.
3234 (main): Add support for iflag=, oflag=, and new conv= symbols.
3235 * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
3236 O_RSYNC, O_SYNC): Define to 0 if not already defined.
3238 * NEWS: Remove duplicate mention of BLOCKSIZE.
3240 2004-04-02 Andreas Schwab <schwab@suse.de>
3242 * src/stty.c: Add support for IUTF8 input flag.
3244 2004-04-06 Jim Meyering <jim@meyering.net>
3246 * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
3247 Interix spells it `mkdev'. Reported by Mark Funkenhauser.
3249 2004-04-04 Jim Meyering <jim@meyering.net>
3251 A specified format is no longer automatically newline terminated.
3252 If you want a newline at the end of your format, use `\n'.
3253 * src/stat.c (print_it): Don't print a newline at the end of
3255 (do_statfs): Add a newline at end of each default format string.
3257 2004-03-30 Paul Eggert <eggert@twinsun.com>
3259 * src/nohup.c (main): Adjust to new calling convention
3260 for set_cloexec_flag.
3262 2004-03-31 Jim Meyering <jim@meyering.net>
3264 * tests/Fetish.pm (run_tests): Remove `.orig' file.
3265 Remove debugging diagnostic.
3267 Specifying an invalid --width=N (-w) or --gap-size=N (-g)
3268 would not elicit an error.
3269 * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
3270 (main): Don't use atoi. Use xstrtoul instead.
3272 2004-03-30 Jim Meyering <jim@meyering.net>
3274 * Makefile.maint (sc_prohibit_atoi_atof): New rule.
3275 (syntax-check-rules): Add it.
3276 * .x-sc_prohibit_atoi_atof: New file.
3278 2004-03-29 Jim Meyering <jim@meyering.net>
3280 * tests/du/files0-from: Use new OUT_SUBST directive, so that this
3281 test is not sensitive to system-dependent block size differences.
3282 Prompted by a report of Solaris 8 differences from Paul Eggert.
3284 * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
3285 Rename `%tmp' to `%actual'. Reverse order of last two args to
3286 _compare_files (to $actual, $expected) so as to match declaration.
3288 2004-03-28 Paul Eggert <eggert@twinsun.com>
3290 Fix some gotchas encountered when porting to Solaris 8, using
3291 the Forte 6u2 compiler.
3293 * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
3294 Declare sethostname, since no Solaris header does it.
3295 * src/who.c: Include "vasprintf.h", for asprintf.
3297 2004-03-28 Jim Meyering <jim@meyering.net>
3300 * src/du.c (process_file): Don't record dev/inode for directories.
3302 Under some circumstances, without -c, du would mistakenly count the
3303 space of hard-linked files, not just the first one it encountered.
3304 Reported by Anthony Thyssen.
3305 * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
3307 * src/du.c: Rename global `print_totals' to `print_grand_total'.
3309 * src/du.c (main): Rearrange filtering loop to be a tiny bit
3312 * src/chown-core.c: Don't include savedir.h -- no longer needed.
3313 * src/chmod.c: Likewise.
3315 2004-03-25 Jim Meyering <jim@meyering.net>
3317 * src/du.c (main): Remove now-unused declaration of `i'.
3319 2004-03-24 Paul Eggert <eggert@twinsun.com>
3321 * src/du.c (main): Filter out file names of length zero before
3322 invoking fts, so that they don't cause fatal errors.
3324 2004-03-25 Jim Meyering <jim@meyering.net>
3326 * tests/du/files0-from (zero-len): Add a test for the above.
3328 2004-02-25 Paul Eggert <eggert@twinsun.com>
3330 * NEWS: New environment var BLOCKSIZE.
3331 * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
3332 * tests/envvar-check: Test for it. Factor the code to simplify it.
3334 2004-03-23 Paul Eggert <eggert@twinsun.com>
3336 * NEWS: Shorten the du --files0-from announcement, and say
3337 "NUL-terminated" rather than "NUL-separated".
3338 * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
3340 (usage): Say "NUL-terminated", not "NUL-separated".
3341 (main): Check for I/O error when istream is closed.
3342 Allow --files0-from=F even if F is empty; this specifies no files.
3343 (du_files): Now that we allow the list of files to be empty,
3345 * tests/du/files0-from: Adjust to above changes to src/du.c.
3347 2004-03-24 Jim Meyering <jim@meyering.net>
3349 * tests/tail-2/assert: Avoid race condition that could cause
3350 spurious failure. Based on a patch from Andreas Schwab.
3352 2004-03-23 Jim Meyering <jim@meyering.net>
3354 * src/du.c (main): Free the hash table, too.
3356 2004-03-22 Jim Meyering <jim@meyering.net>
3358 * man/Makefile.am (.x.1): Remove --info-page= option, reverting
3359 the change of 2004-01-22. I can no longer reproduce the problem
3360 that prompted that change, and `info coreutils pr' would display the
3361 `printing text' section of the manual, not the one on `pr invocation'.
3363 * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
3364 to match corrected output.
3366 * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
3367 (main): Use readtoken0 functions rather than readtokens.
3368 Don't use errno when diagnosing readtokens0 failure.
3369 Fix off-by-one error in the token number reported in a diagnostic.
3370 (du_files): Return bool, rather than int.
3371 (main): Call readtokens0_free.
3373 2004-03-21 Jim Meyering <jim@meyering.net>
3375 * src/remove.c (ds_free): Plug a small leak.
3377 * tests/Fetish.pm: Fix typo in comment.
3379 2004-03-07 Jim Meyering <jim@meyering.net>
3381 * NEWS: du accepts a new option --files0-from=FILE, where FILE
3382 contains a list of NUL-separated file names.
3384 * src/du.c: Include "readtokens.h".
3385 (usage): Describe the new option, and adjust the `Usage':
3386 with this option, no FILE may be specified on the command line.
3387 (main): Handle the new option.
3389 * tests/du/files0-from: New tests, for the above.
3390 * tests/du/Makefile.am (TESTS): Add files0-from.
3392 * src/factor.c (do_stdin): Reflect changes in use of readtoken.
3393 * src/tsort.c (tsort): Likewise.
3395 2004-02-29 Paul Eggert <eggert@twinsun.com>
3397 * NEWS: Add support for a new notation @N to get_date to represent
3398 the time stamp with numeric value N. Improve support for
3399 fractional time stamps. date's -d and -f options now accept them.
3400 Likewise for touch -t. date has a new option --iso-8601=ns.
3402 * doc/coreutils.texi (touch invocation):
3403 Describe use of fractional seconds.
3404 (date invocation, Options for date): Likewise.
3405 * doc/getdate.texi (General date syntax, Time of day items): Likewise.
3406 * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
3407 (Options for date): Describe new --iso-8601=ns option.
3409 * doc/getdate.texi: Add copyright notice. Change getdate to
3410 get_date when talking about the function name.
3411 (Seconds since the Epoch): New section, containing the time_t
3412 info moved from Date input formats section, along with new
3413 info about the @ syntax. Mention negative time stamps,
3414 fractional time stamps, and leap seconds.
3415 (General date syntax): Modernize examples a bit to reflect new
3417 (General date syntax, Relative items in date strings):
3418 Use ' rather than " to quote formats.
3419 (Time of day items): Add an example with fractional seconds.
3420 Describe fractional-second syntax.
3422 * src/Makefile.am (touch_LDADD): New macro, since `touch' now
3423 needs clock_gettime.
3425 * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
3426 (time_spec_string, time_spec, show_date): Support it.
3427 (usage): Remove description of -ITIMESPEC, as it's obsolete and
3428 confusing. Mention --iso-8601=ns.
3429 (batch_convert): getline returns ssize_t, not int.
3431 * src/touch.c (newtime): Now an array of two timespecs, one
3432 for access and one for modification.
3433 (ref_stats): Remove.
3434 (get_reldate): Use get_date's parameter profile.
3435 (touch, main): Adjust to above changes.
3436 (main): Work even if tm_year == INT_MAX (so long as long int is wider).
3437 Use gettime instead of gettimeofday, for new get_date signature.
3439 * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
3442 2004-03-15 Jim Meyering <jim@meyering.net>
3444 * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
3445 target before updating $(prev_version_file).
3447 * tests/misc/date-sec: New file, to test for just-fixed bug in date.
3448 See today's change in lib/getdate.y.
3449 * tests/misc/Makefile.am (TESTS): Add date-sec.
3451 2004-03-14 Jim Meyering <jim@meyering.net>
3453 * announce-gen (print_changelog_deltas): Use `.sig' suffix for
3454 signature files, not `.asc'. Reported by angico@yahoo.com.
3456 2004-03-13 Jim Meyering <jim@meyering.net>
3458 * src/cp.c (do_copy): Tweak wording in a diagnostic.
3459 Suggestion from Karl Berry.
3460 Include "quoatearg.h".
3461 (do_copy): Use quotearg_colon (not quote) for diagnostics
3462 that begin with `"%s:'.
3464 * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
3465 Suggestion from Dan Jacobson.
3467 2004-03-12 Jim Meyering <jim@meyering.net>
3471 Sometimes, when source and destination partition are different,
3472 mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
3474 * src/copy.c: When moving a set of N hard-linked files between
3475 partitions, via two or more command line arguments where the
3476 command line argument containing the Nth link contains no other
3477 link to that same file, mv would mistakenly copy the file, rather
3478 than hard-linking it to the other(s). That happens because when the
3479 final link is processed, its link count has been reduced to 1 since
3480 the other links have been `copied' to the destination partition
3481 and the source links have been removed.
3482 (copy_internal): When in move mode, use the source dev/inode
3483 pair to look up destination name even when st_nlink == 1.
3484 * src/cp-hash.c (src_to_dest_lookup): New function.
3485 * src/cp-hash.h (src_to_dest_lookup): Add prototype.
3486 * tests/mv/part-hardlink: New file. Test for the above fix.
3487 * tests/mv/Makefile.am (TESTS): Add part-hardlink.
3489 * announce-gen: Sync with autoconf.
3491 * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
3492 This was triggered on a Linux-2.2.19 system using a file system
3493 NFS-mounted from some sort of Sun.
3495 2004-03-11 Jim Meyering <jim@meyering.net>
3497 * Use automake-1.8.3. Regenerate dependent files.
3499 2004-03-10 Jim Meyering <jim@meyering.net>
3501 * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
3502 so that this test works with SELinux-enabled systems.
3503 Based on a patch from Tim Waugh.
3505 `join -1 x' would give a misleading diagnostic
3506 * src/join.c (string_to_join_field): Report that a non-numeric field
3507 number is invalid, rather than `so large that it is not representable'.
3508 * tests/join/Test.pm (invalid-j): New partial test for the above fix.
3510 2004-03-06 Jim Meyering <jim@meyering.net>
3512 cp --sparse=always sparse-image-file.img /dev/hda1 could
3513 produce an invalid copy on the destination device.
3515 * src/copy.c (copy_reg): Even with --sparse=always, try to
3516 make `holes' only if the destination is a regular file.
3517 Reported by Szakacsits Szabolcs.
3519 2004-03-03 Paul Eggert <eggert@twinsun.com>
3521 * src/nohup.c (main): Don't invoke set_cloexec_flag with
3522 a file descriptor of -1.
3524 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
3526 * src/nohup.c: Include "cloexec.h".
3527 (main): Set the copy of stderr to close on exec.
3529 2004-03-01 Paul Eggert <eggert@twinsun.com>
3531 * configure.ac: Include <signal.h> when checking for strsignal,
3532 sys_siglist, and friends. Problem reported by Tony Leneis in
3533 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
3535 2004-02-25 Paul Eggert <eggert@twinsun.com>
3537 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
3538 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
3541 2004-02-23 Paul Eggert <eggert@twinsun.com>
3543 * NEWS: Document how chown's USER.GROUP argument is now parsed.
3545 2004-02-23 Jim Meyering <jim@meyering.net>
3547 * src/seq.c (usage): Remove stray space after \n in --help output.
3549 2004-02-22 Jim Meyering <jim@meyering.net>
3551 * src/du.c (usage): Separate -H and --si. Say that the meaning
3552 of -H will soon change to that of --dereference-args (-D).
3554 2004-02-21 Jim Meyering <jim@meyering.net>
3556 * src/comm.c (usage): Tell what comm does when there are no options.
3557 Reword in terms of FILE1 and FILE2 rather than `left file' and
3558 `right file'. Suggestion from Dan Jacobson.
3560 2004-02-15 Paul Eggert <eggert@twinsun.com>
3562 Fix some POSIX-conformance bugs in expr.
3564 * NEWS: document the following changes to src/expr.c.
3565 * doc/coreutils.texi (expr invocation): Likewise.
3566 Document what forms integers may take, and say "integer"
3567 consistently instead of "number". Warn about operands
3568 that "expr" can misinterpret, and how to work around the
3570 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
3571 Accept a bool argument specifying whether to evaluate the
3572 expression. This is to allow short-circuit evaluation. All
3574 (null): Report that a string is zero even if it has
3575 a form like "-0" or "00".
3576 (eval1, eval): Use short-circuit evaluation for | and &.
3577 (eval): Return 0 if both arguments are null or zero, instead
3578 of returning the first argument.
3579 * tests/expr/basic: Add some tests for the above.
3581 2004-02-17 Jim Meyering <jim@meyering.net>
3585 `make check' from a build inside a chroot environment would fail
3586 * tests/help-version: Specify an argument (`/') for df, in the
3587 unusual event that there is no valid entry in /etc/mtab.
3588 Likewise for id: add the -u option, so we don't get spurious
3589 failures when there are no user or group names.
3592 * src/sort.c (usage) [-u]: Add punctuation so that the description in
3593 the help2man-generated (line-joined) man page is more readable.
3594 Reported by Tim Waugh.
3595 [-T]: Add a semicolon, for the same reason.
3597 2004-02-15 Jim Meyering <jim@meyering.net>
3599 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
3601 2004-02-11 Jim Meyering <jim@meyering.net>
3603 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
3604 $(srcdir)/../Makefile.am.in, rather than $<.
3605 Suggestion from Michael Elizabeth Chastain.
3607 2004-02-10 Jim Meyering <jim@meyering.net>
3609 * config/install-sh: Make this script executable.
3610 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
3611 is executable. Otherwise, on systems that lack a suitable install
3612 binary, `make install' would fail, because of the way this script
3613 is invoked (without `$SHELL ' prefix).
3614 Reported by Bob Proulx.
3616 2004-02-08 Jim Meyering <jim@meyering.net>
3620 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
3621 that would cause an unwarranted test failure.
3622 * tests/rm/rm3: Likewise.
3624 2004-02-07 Jim Meyering <jim@meyering.net>
3626 Remove xstat function pointer member. The way it was used was not
3627 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
3628 inline `stat' and `lstat' functions, thus making the tests of
3629 `xstat == lstat' in copy.c always fail.
3630 * src/copy.h (struct cp_options) [xstat]: Remove member.
3632 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
3633 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
3634 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
3635 (valid_options): Remove now-obsolete FIXME comments.
3637 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
3638 `*(x->xstat) (...)'.
3639 (do_copy): Declare/use local xstat rather than x->xstat.
3640 (main): Remove code that set x.xstat.
3641 * src/mv.c (cp_option_init): Don't initialize xstat member.
3642 * src/install.c (cp_option_init): Likewise.
3644 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
3645 so that emit_upload_commands can use these variables, too.
3647 2004-02-06 Jim Meyering <jim@meyering.net>
3649 * tests/rm/deep-1: Remove `du' stack space test.
3650 Apparently, `ulimit -s N' isn't portable enough.
3651 This test will be restored (with a guard against losing ulimit)
3652 in its own file later.
3654 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
3655 since this test doesn't take long enough to merit them.
3656 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
3658 * Makefile.maint (signatures): Remove definition.
3659 Now, automake's gnupload handles this.
3660 (%.sig: %): Remove now-unused rule.
3661 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
3662 `$(distdir).tar.bz2 $(distdir).tar.gz'.
3663 (emit-upload-commands): Adjust to use gnupload.
3665 2004-02-05 Jim Meyering <jim@meyering.net>
3667 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
3668 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
3669 Now, those are all defined in timespec.h.
3672 * src/date.c: Don't include timespec.h, now that system.h does it.
3674 2004-02-02 Paul Eggert <eggert@twinsun.com>
3676 Don't dump core if localtime returns NULL (possible on
3677 hosts with 64-bit time_t and 32-bit int).
3678 * src/date.c: Include "inttostr.h".
3679 (batch_convert, main):
3680 If time conversion fails, exit with nonzero status.
3681 (show_date): Return int to report conversion failure.
3682 Print the time as an int if localtime fails.
3683 * src/uptime.c: Print "??" if the current clock can't
3684 be converted by localtime. This won't happen until the year
3685 2*31 + 1900, but we don't want to dump core even if the current
3686 clock has the wrong value.
3688 * src/stat.c: Include "inttostr.h".
3689 (human_time): Print the date/time as a number of seconds since the
3690 epoch if it can't be converted by localtime. This is better than
3691 just saying "invalid", and is consistent with what "ls" does.
3692 Don't dump core if the year has more than 48 digits; this isn't
3693 possible on any contemporary host, but we might as well do it right.
3695 2004-01-31 Paul Eggert <eggert@twinsun.com>
3697 * src/stat.c (human_time): Accept time rather than
3698 pointer-to-const-time parameter, for clarity. All callers changed.
3700 2004-02-02 Jim Meyering <jim@meyering.net>
3702 * src/stat.c (do_stat): Remove extra trailing newline from
3703 default formats. Reported by Nelson H. F. Beebe.
3705 Print actual fractional seconds in time stamps, not just `.00000000'.
3706 * src/stat.c (human_time): Add and use new parameter, t_ns.
3707 (print_stat): Update callers.
3708 * src/ls.c (TIMESPEC_NS): Remove definition.
3709 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
3710 also uses this macro.
3711 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
3712 fractional seconds for files on an XFS file system, but that stat's
3713 fractional seconds were always zero.
3715 2004-01-28 Paul Eggert <eggert@twinsun.com>
3717 * src/seq.c (print_numbers): Use 'double' for loop index, not
3718 'int', to avoid problems with integer overflow. On almost all
3719 machines 'double' works in every case where 'int' works, and
3720 it works on other cases besides.
3722 2004-01-27 Jim Meyering <jim@meyering.net>
3724 * src/seq.c (usage): Mention that if INCREMENT is omitted,
3725 it defaults to 1, even when FIRST is larger than LAST.
3726 Reword so as not to exclude the possibility that INCREMENT be zero.
3728 2004-01-25 Jim Meyering <jim@meyering.net>
3732 * Makefile.maint (signatures): Comment out definition.
3734 2004-01-23 Jim Meyering <jim@meyering.net>
3736 * Makefile.maint (header_regexp): Add exitfail.
3738 * man/Makefile.am (EXTRA_DIST): Add help2man.
3739 Reported by Nelson H. F. Beebe.
3741 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
3742 so it works on systems with Perl installed somewhere other than in
3745 * src/paste.c (paste_parallel): Declare local, chr, to be of type
3746 `int', not `char', since it must hold EOF. This bug would make
3747 paste infloop on some systems. Test failures reported by
3748 Nelson H. F. Beebe and Christian Krackowizer.
3750 2004-01-22 Jim Meyering <jim@meyering.net>
3752 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
3753 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
3755 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
3756 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
3757 Use --info-page='coreutils PROG' option.
3758 Now, readlink.1 refers the user to `info coreutils readlink'
3759 rather than to `info readlink'. Reported by Matt Swift.
3761 2004-01-21 Paul Eggert <eggert@twinsun.com>
3763 Exit status cleanup.
3765 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
3766 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
3767 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
3768 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
3769 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
3770 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
3771 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
3772 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
3773 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
3774 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
3775 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
3776 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
3777 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
3778 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
3779 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
3780 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
3781 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
3783 * src/cat.c (usage): Don't bother normalizing exit status
3784 since the arg is already the correct exit status now.
3785 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
3786 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
3787 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
3788 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
3789 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
3791 * src/chown.c (main): Removed unused local 'fail'.
3793 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
3796 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
3797 * src/env.c, src/nice.c, src/su.c: Likewise.
3798 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
3799 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
3800 * src/expr.c (main): Use initialize_exit_failure rather than
3801 setting exit_failure directly; this optimizes away redundant
3803 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
3805 * src/chroot.c (main): Exit with status 1 rather than 127
3806 if chroot itself fails, as per documentation.
3808 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
3809 rather than roll-your-own symbols or integers.
3810 * src/env.c (main): Likewise.
3811 * src/nohup.c (main): Likewise.
3812 * src/su.c (run_shell): Likewise.
3814 * src/cp.c (exit_status): Remove static var....
3815 (main): Making it local here instead. Use =, not |=, to set it.
3817 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
3819 * src/date.c (batch_convert, main): Likewise.
3820 * src/dd.c (dd_copy): Likewise.
3821 * src/pr.c (first_last_page, main, getoptarg): Likewise.
3822 * src/tr.c (main): Likewise.
3823 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
3824 POSIX doesn't require it.
3825 * src/dd.c (write_output, skip, dd_copy): Likewise.
3826 * src/df.c (main): Likewise.
3827 * src/id.c (main): Likewise.
3828 * src/install.c (main): Likewise.
3829 * src/ln.c (main): Likewise.
3830 * src/ls.c (main): Likewise.
3831 * src/mv.c (main): Likewise.
3832 * src/shred.c (main): Likewise.
3834 * src/env.c (main): Exit with status 1, not 2, on errors detected
3836 * src/hostname.c (main): Likewise.
3837 * src/nl.c (main): Likewise.
3838 * src/stty.c (main): Likewise.
3840 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
3841 consistency with the other programs' naming conventions.
3844 * src/factor.c (main): Do not report a usage error simply
3845 because stdin has bad numbers.
3847 * src/id.c (problems): Now a boolean int, not a counter,
3848 so that we don't have to worry about int overflow. All uses changed.
3849 * src/touch.c (err): Likewise.
3851 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
3853 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
3854 * src/mknod.c: Likewise.
3856 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
3857 on error; this is in case EXIT_FAILURE is unusual.
3858 * src/su.c (main): Likewise.
3860 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
3861 changed to EXIT_CANNOT_INVOKE.
3863 * src/printenv.c (PRINTENV_FAILURE): New constant.
3864 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
3865 command-line syntax problems.
3867 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
3868 (main): Avoid integer overflow when seeing whether errors occurred.
3870 * src/seq.c (print_numbers): Now returns void, not (zero) int.
3871 All callers changed.
3872 (main): Remove unused local variable 'errs'. Always exit successfully
3873 if we reach the end.
3875 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
3876 for consistency with other programs here. All uses changed.
3877 (main): Use 'error' to exit rather than invoking 'exit' here.
3879 * src/sort.c: Don't include <assert.h>.
3880 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
3881 (usage): Don't use 'assert'.
3882 (main): Remove redundant assignment to exit_failure.
3884 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
3886 (initialize_exit_failure): New inline function.
3887 Include exitfail.h here, since we refer to exit_failure.
3888 All callers changed to not include exitfail.h.
3890 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
3891 substitute them for the corresponding integer constants.
3893 * tests/help-version (expected_failure_status_date): Remove, as
3894 'date' is now normal.
3895 (expected_failure_status_nohup): New var.
3897 2004-01-21 Jim Meyering <jim@meyering.net>
3899 * tests/touch/relative: Remove `command' syntax.
3900 Thanks to Nelson H. F. Beebe and Paul Eggert.
3902 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
3903 so as to avoid problems with systems using TAI clocks.
3904 Although it's no longer necessary, set TZ=UTC0 also for the
3905 initial touch command. Reported by Paul Jarc here:
3906 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
3908 2004-01-20 Diego Biurrun <diego@biurrun.de>
3910 * src/dircolors.hin: Add .mov to the list of media files.
3912 2004-01-19 Paul Eggert <eggert@twinsun.com>
3914 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
3915 portable). Problem reported by Christian Krackowizer. Also, use
3916 +0000 rather than +0 to specify a time zone, as the documentation
3917 requires four digits.
3919 2004-01-19 Jim Meyering <jim@meyering.net>
3921 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
3922 * tests/mv/backup-is-src: Likewise.
3923 Problem reported by Peter Horst
3925 2004-01-17 Jim Meyering <jim@meyering.net>
3927 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
3931 2003-12-15 Paul Eggert <eggert@twinsun.com>
3933 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
3934 with -r specifying the origin for -d.
3935 * src/touch.c (flexible_date): Remove static var.
3936 (get_reldate): New function.
3937 (main): Use it, to implement this new behavior.
3939 2004-01-16 Jim Meyering <jim@meyering.net>
3941 * tests/touch/relative: New test for the above.
3942 * tests/touch/Makefile.am (TESTS): Add relative.
3944 2004-01-13 Jim Meyering <jim@meyering.net>
3946 * src/system.h: Include contents of sys2.h.
3947 * src/sys2.h: Remove file.
3948 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
3950 * Use automake-1.8.2. Regenerate dependent files.
3952 * Update to gettext-0.13.1.
3953 * configure.ac: Use gettext-0.13.1.
3954 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
3956 2004-01-12 Jim Meyering <jim@meyering.net>
3958 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
3960 * Makefile.maint (po-check): Ensure that cvsu works before using it.
3961 Reported by Alexandre Duret-Lutz.
3963 * src/tail.c (main): Warn about following stdin only when it's a tty.
3965 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
3967 2004-01-10 Jim Meyering <jim@meyering.net>
3969 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
3971 2004-01-09 Jim Meyering <jim@meyering.net>
3973 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
3975 2004-01-08 Jim Meyering <jim@meyering.net>
3977 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
3978 From Andreas Schwab.
3980 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
3981 remnant) from PATH component. That would cause tests in this directory
3982 not to run the just-built binaries, but rather whatever happened
3983 to be in one's PATH. Reported by Christian Krackowizer.
3985 2004-01-04 Jim Meyering <jim@meyering.net>
3987 * src/csplit.c (new_control_record): Use x2nrealloc
3988 rather than xrealloc.
3990 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
3992 (make_path_private): Likewise.
3994 2004-01-03 Jim Meyering <jim@meyering.net>
3996 * src/paste.c: Use `bool' (not int) as the type for a few
3998 (collapse_escapes): Rewrite to set globals rather than modifying
4000 Use size_t (not int) for all counters and related index variables.
4001 (paste_parallel): Remove needless complexity of
4002 using xrealloc in the loop; just allocate the buffers up front.
4003 Free the two temporary buffers.
4004 Move declarations of locals `down' into scope where used.
4005 (paste_serial): Remove `register' attributes.
4006 (main): Simplify delim-related code.
4007 Free `delims', now that it's malloc'd.
4009 2004-01-02 Jim Meyering <jim@meyering.net>
4011 * src/chroot.c: Include "quote.h".
4012 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
4013 (main): Exit with status of 127, not 1, for too-few-args,
4014 chroot failure, or chdir failure.
4015 Give a better diagnostic upon execvp failure.
4017 * src/du.c (usage): Mention that, with its current meaning,
4020 * src/tail.c (main): Warn about following stdin when it's a tty.
4021 Fail when following by name but no names are specified.
4023 2003-12-30 Jim Meyering <jim@meyering.net>
4025 * src/fold.c (main): Use memcpy, not strcpy.
4027 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
4030 2003-12-28 Jim Meyering <jim@meyering.net>
4032 * src/unexpand.c (n_tabs_allocated): New global.
4033 (add_tabstop): Use x2nrealloc rather than xrealloc.
4034 * src/expand.c: Likewise.
4036 * tests/misc/expand: New file.
4037 * tests/misc/Makefile.am (TESTS): Add expand.
4039 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
4040 (fillbuf): Use x2nrealloc rather than xrealloc.
4041 (sort): Use xnmalloc rather than xmalloc.
4044 2003-12-27 Jim Meyering <jim@meyering.net>
4046 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
4048 2003-12-29 Paul Eggert <eggert@twinsun.com>
4050 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
4051 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
4053 * doc/coreutils.texi (join invocation): Remove documentation
4054 accordingly. Document that -t makes all separators significant.
4056 * src/join.c: Include posixver.h.
4057 (obsolete_usage): New var.
4058 (longopts): Put obsolete options first.
4059 (OBSOLETE_LONG_OPTIONS): New constant.
4060 (get_option, add_file_name): New functions.
4061 (main): Use them to support new behavior.
4062 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
4063 Do not mark -j FIELD as obsolescent; it is longstanding
4064 UNIX tradition and is a valid extension to POSIX.
4066 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
4068 2003-12-28 Paul Eggert <eggert@twinsun.com>
4070 * src/join.c (add_field_list): Don't use alloca with unbounded
4071 size; just modify the argument, which is no longer const *.
4073 Various other minor cleanups, mostly to avoid the need for casts.
4075 (extract_field): Renamed from ADD_FIELD, as it's now a function.
4077 (struct field.beg): Now char *, not unsigned char const *. All
4078 uses changed. It shouldn't be const since xmemcoll writes on its
4080 (extract_field): Likewise, for 2nd arg.
4081 (keycmp): Remove now-unnecessary cast of xmemcoll args.
4083 (is_blank): New function, to avoid need to cast arg to unsigned char.
4084 (extract_field): Use it.
4086 (xfields): Rewrite pretty much from scratch.
4088 (hard_LC_COLLATE): Now bool, not int.
4089 (get_line, getseq, add_field_list): Now returns bool, not int.
4090 (decode_field_spec, add_field_list): Return true on success (not
4091 false), for consistency with the rest of the code. All uses changed.
4093 (tab): Now char, not unsigned char. This wasn't 100% necessary
4094 but is slightly cleaner.
4095 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
4097 (empty_filler): Now const *.
4099 (make_blank): Remove; wasn't needed. Remove all calls.
4100 (main): Don't set uni_blank.nfields; zero is fine.
4102 2003-12-27 Jim Meyering <jim@meyering.net>
4104 * src/join.c: Include "quote.h".
4105 (min, max): Remove definitions.
4106 Make a few function parameters and corresponding
4107 locals `const'. Use bool for boolean variables.
4108 Use size_t (not int) for all counters and related index variables.
4109 (prjoin): Remove now-useless assertion.
4110 (string_to_join_field): New function.
4111 (main): Accept join fields as large as SIZE_MAX.
4112 (keycmp): Rename `min' to MIN and max to MAX.
4114 2003-12-26 Jim Meyering <jim@meyering.net>
4116 fold -s didn't work on e.g., alpha-based systems.
4117 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
4118 x2nrealloc works properly on systems with differing sizes for int
4119 and size_t. Reported by Nelson Beebe.
4121 * src/fold.c: Use `bool' (not int) as the type for a few
4124 2003-12-23 Paul Eggert <eggert@twinsun.com>
4126 * src/ls.c (length_of_file_names_and_frills):
4127 Remove forward decl; not needed.
4128 (print_file_name_and_frills, length_of_file_name_and_frills):
4129 With -m, don't output spaces before inum or size.
4130 (print_with_commas): Don't output space just before newline.
4132 2003-12-24 Jim Meyering <jim@meyering.net>
4134 * tests/ls/Makefile.am (TESTS): Add m-option.
4135 * tests/ls/m-option: New file. Test for above fixes.
4137 2003-12-20 Jim Meyering <jim@meyering.net>
4141 * src/pr.c: Change type of global, buff_allocated, to size_t.
4143 * src/join.c [struct seq]: Change types of members count and alloc
4144 from `int' to `size_t'.
4146 * tests/Makefile.am (root-hint): Tweak wording.
4148 * src/du.c: Accept new option (-0, --null) that makes it so each
4149 output line is NUL-terminated rather than newline-terminated.
4151 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
4152 Reported by Volker Paul.
4153 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
4154 * tests/dd/unblock-sync: New test for the above.
4156 2003-12-19 Jim Meyering <jim@meyering.net>
4158 * tests/misc/nohup: Double quote back-ticked expression,
4159 in case it ends up having an unexpected value.
4161 * tests/ls/no-arg: Use ls's -1 option in both runs.
4163 * src/du.c (fts_debug): New global.
4164 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
4165 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
4166 (main) [DU_DEBUG]: Accept -d option.
4168 2003-12-18 Jim Meyering <jim@meyering.net>
4170 * src/ls.c (format_user): Increment dired_pos via two statements,
4171 `dired_pos += width; dired_pos++;' rather than one,
4172 `dired_pos += width + 1;' since the latter could conceivably overflow.
4173 (format_group): Likewise.
4176 * configure.ac: Require automake-1.8.
4178 2003-12-12 Jim Meyering <jim@meyering.net>
4180 * Use automake-1.8. Regenerate dependent files.
4182 2003-12-08 Jim Meyering <jim@meyering.net>
4184 * Makefile.maint (news-date-check): New rule.
4185 (alpha beta major): Depend on it.
4187 2003-12-03 Paul Eggert <eggert@twinsun.com>
4189 * NEWS: ls -l (and similar options) now adjust all columns to
4190 fit the data. Generalized from a suggestion by Leah Q for file sizes.
4191 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
4192 (format_user_width, format_group_width, unsigned_file_size,
4193 format_group): New functions.
4194 (block_size_width): Renamed from block_size_size.
4195 (inode_number_width, nlink_width, owner_width, group_width,
4196 author_width, major_device_number_width, minor_device_number_width,
4197 file_size_width): New vars.
4198 (clear_files): Initialize them.
4199 (gobble_file): Set them. Don't ceiling block_size_width to 7.
4200 (print_long_file): Use them.
4201 (gobble_file): Use a new local variable 'f' to make the code
4202 smaller and more consistent with other functions.
4203 (format_user): Output to stdout, not to a buffer, so that we
4204 don't have to worry about buffer overrun. Update dired_pos.
4205 (print_long_file): Don't put owner, group, author into buffer;
4206 just print them directly. Don't assume link counts and
4207 major and minor numbers fit into unsigned long int.
4208 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
4209 'ls' output is fixed-width.
4211 2003-12-02 Jim Meyering <jim@meyering.net>
4213 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
4215 2003-11-27 Jim Meyering <jim@meyering.net>
4217 * Use automake-1.7f. Regenerate dependent files.
4219 2003-11-24 Paul Eggert <eggert@twinsun.com>
4221 Parse floating-point operands and options in the C locale.
4222 POSIX requires this for printf, and we might as well be
4223 consistent elsewhere (tail, sleep, seq).
4225 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
4226 needed now that we assume C89. Include "c-strtod.h".
4227 (xstrtod): Call c_strtod, not strtod.
4228 * src/sleep.c: Include "c-strtod.h".
4229 (main): Update xstrtod call to include new argument, c_strtod.
4230 * src/seq.c (scan_double_arg): Likewise.
4231 * src/tail.c (parse_options): Likewise.
4233 2003-11-24 Jim Meyering <jim@meyering.net>
4235 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
4236 Reported by Mark Conty.
4238 2003-11-22 Jim Meyering <jim@meyering.net>
4240 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
4241 (sc_system_h_headers): Do this test only if sys2.h exists.
4243 2003-11-20 Jim Meyering <jim@meyering.net>
4245 * tests/help-version: Ensure that the bug-reporting address is
4246 included in the --help output for every program.
4247 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
4249 * src/ptx.c (usage): Output bug-reporting address.
4250 Reported by Dan Jacobson.
4252 2003-11-19 Jim Meyering <jim@meyering.net>
4254 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
4255 on the join fields. Suggestion from Bruce Robertson.
4257 2003-11-18 Jim Meyering <jim@meyering.net>
4259 `od -c -w9999999' could segfault
4260 * src/od.c (dump): Use xnmalloc/free, not alloca.
4262 2003-11-16 Jim Meyering <jim@meyering.net>
4264 * Use autoconf-2.59. Regenerate dependent files.
4266 * tests/du/hard-link: Minor tweak: use mkdir -p.
4268 Fix read-from-free'd-buffer error detected by valgrind.
4269 * src/csplit.c (remove_line): Don't return a pointer to data in
4270 a freed buffer. Instead, arrange to free the buffer on the
4273 * tests/misc/csplit: New test for above fix.
4275 2003-11-11 Jim Meyering <jim@meyering.net>
4277 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
4278 This avoids a warning from valgrind about memcpy with overlapping
4279 source and destination.
4281 * configure.ac: Require automake-1.7.8.
4283 2003-11-09 Jim Meyering <jim@meyering.net>
4285 * Use automake-1.7.9. Regenerate dependent files.
4287 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
4288 * src/chown.c: Likewise.
4290 * src/chown-core.c: Include "root-dev-ino.h".
4291 (chopt_init): Initialize new member.
4292 (change_file_owner): Support rm's new --preserve-root option.
4294 * src/remove.c: Include "root-dev-ino.h".
4295 (remove_cwd_entries): Remove now-obsolete FIXME comment.
4296 (remove_dir): Support rm's new --preserve-root option.
4298 * src/chown.c: Include "root-dev-ino.h".
4299 Add new options: --preserve-root and --no-preserve-root.
4301 * src/chmod.c: Include "root-dev-ino.h".
4302 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
4303 ROOT_DEV_INO_WARN macros.
4304 (get_root_dev_ino): Remove function definition, now that it's
4305 been moved to a separate file.
4306 (usage): Describe new options.
4308 * src/mv.c (rm_option_init): Initialized new member.
4310 * src/remove.h: Include "dev-ino.h".
4311 (struct rm_options): Add new member: root_dev_ino.
4312 * src/chown-core.h: Include "dev-ino.h".
4313 (struct Chown_option): Add new member: root_dev_ino.
4315 2003-11-06 Jim Meyering <jim@meyering.net>
4317 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
4318 hard-coding `sizeof FILE*'.
4320 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
4322 * src/wc.c (main): Free `fstatus' so there is no confusion about
4323 whether it's leaked or not.
4324 * src/who.c (who): Likewise for `utmp_buf'.
4326 2003-11-05 Paul Eggert <eggert@twinsun.com>
4328 Fix 'cut' problems with size_t overflow and unsigned int.
4329 More generally, resize integer variables to fit use more precisely.
4330 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
4331 (struct range_pair): Make members to be of type size_t, not unsigned.
4332 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
4333 (suppress_non_delimited, output_delimiter_specified,
4334 have_read_stdin, print_kth, set_fields): Now bool, nt int.
4335 (delim): Now unsigned char, not int.
4336 (mark_printable_field, is_printable_field, is_range_start_index,
4337 set_fields, set_fields, cut_bytes, cut_fields):
4338 Use size_t, not unsigned, for field and byte counts.
4339 (hash_int): Use uintptr_t, not unsigned, for pointers converted
4340 to integers. This squeezes more info out of them.
4341 (set_fields, cut_bytes, cut_fields, main):
4342 Use bool, not int, for booleans.
4343 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
4345 2003-11-05 Paul Eggert <eggert@twinsun.com>
4347 * man/Makefile.am (check-programs-vs-x):
4348 Work even if $(programs) contains '$'.
4349 Work even if 'missing=1' in environment.
4350 Don't report an error simply because $(programs) outputs nothing.
4352 2003-11-05 Jim Meyering <jim@meyering.net>
4354 * Use autoconf-2.58. Regenerate dependent files.
4356 * src/tr.c (spec_init): Fix typo in last change.
4358 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
4359 call to variadic version_etc function, so that it works even on systems
4360 for which sizeof char* != sizeof int.
4361 * src/true.c (main): Likewise.
4362 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
4363 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
4364 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
4365 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
4366 Similarly, cast NULL to `(char *)' in call to variadic function,
4367 parse_long_options, so that it works even on systems for which
4368 sizeof char* != sizeof int.
4369 A similar problem was reported by Harti Brandt in
4370 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
4372 * src/users.c (users): Free `utmp_buf' explicitly so that people
4373 don't mistake this for a real leak.
4374 Patch by Dennis Smit <ds@nerds-incorporated.org.
4376 2003-11-04 Paul Eggert <eggert@twinsun.com>
4378 * README: Document _POSIX2_VERSION.
4380 2003-11-04 Jim Meyering <jim@meyering.net>
4382 * src/tac.c (memrchr): Remove #if-0'd function.
4383 (tac_stdin_to_mem): Clean up #if-0'd code.
4385 * src/od.c (decode_format_string): Remove unnecessary casts.
4386 Use more maintainable `sizeof *var'.
4387 (main): Call decode_format_string rather than decode_one_format,
4388 now that `spec' may be NULL.
4390 * src/chmod.c (AUTHORS): Add my name.
4392 * src/split.c (next_file_name): Use `sizeof *var' rather than
4393 hard-coding `sizeof size_t'.
4395 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
4397 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
4398 to avoid potential overflow in pointer arithmetic.
4399 (set_fields): Use not `1', but rather `sizeof *printable_field' as
4400 second argument to xcalloc.
4401 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
4402 rather than xrealloc.
4403 * src/date.c (show_date): Likewise.
4404 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
4405 * src/pr.c (store_char): Likewise.
4406 * src/fold.c (fold_file): Likewise.
4408 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
4409 type changes (unsigned int -> size_t) in hash.c.
4410 * src/cp-hash.c (src_to_dest_hash): Likewise.
4411 * src/du.c (entry_hash): Likewise.
4412 * src/ls.c (dev_ino_hash): Likewise.
4413 * src/cut.c (hash_int): Likewise. Declare function as static.
4415 2003-11-03 Jim Meyering <jim@meyering.net>
4417 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
4418 * tests/misc/fold: Fail the test immediately if we're not running
4419 the expected version of fold.
4421 2003-11-02 Jim Meyering <jim@meyering.net>
4423 * src/tr.c (append_normal_char, append_range, append_char_class)
4424 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
4425 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
4426 and usually shorter.
4427 * src/copy.c (copy_internal): Likewise.
4428 * src/join.c (initseq, add_field, make_blank): Likewise.
4429 * src/od.c (main): Likewise.
4430 * src/cp.c (make_path_private): Likewise.
4431 * src/tsort.c (new_item, record_relation): Likewise.
4433 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
4434 (main): Also remove anachronistic cast of xmalloc return value.
4435 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
4436 (main): Also remove anachronistic cast of xmalloc return value.
4437 * src/sort.c (inittables): Likewise.
4438 (sort): Also Split a long line.
4440 2003-10-25 Jim Meyering <jim@meyering.net>
4442 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
4443 type changes (unsigned int -> size_t) in hash.c.
4444 * src/cp-hash.c (src_to_dest_hash): Likewise.
4445 * src/du.c (entry_hash): Likewise.
4446 * src/ls.c (dev_ino_hash): Likewise.
4447 * src/cut.c (hash_int): Likewise. Declare function as static.
4449 2003-10-21 Jim Meyering <jim@meyering.net>
4451 Don't fail when run with VERBOSE=yes.
4452 * tests/chgrp/basic: Do `set +x' before starting the subshell
4453 from which we invoke chgrp. Otherwise, the output from the
4454 VERBOSE=yes-induced `set -x' would result in spurious differences.
4455 Reported by Russel Coker via Michael Stone.
4457 2003-10-19 Jim Meyering <jim@meyering.net>
4459 chmod now uses fts to perform a directory traversal when -R is
4460 specified. Before, it operated on full path names, and as such
4461 would encounter the PATH_MAX (often 4096) limit.
4463 * src/chmod.c: Include "xfts.h".
4464 (process_file): Rename from change_file_mode.
4465 Adapt to be used with fts.
4466 (process_files): New function.
4468 2003-10-18 Jim Meyering <jim@meyering.net>
4470 * tests/du/deref-args: Ensure that du -D now dereferences all
4471 symlinks specified on the command line, not just those that
4472 reference directories.
4474 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
4475 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
4476 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
4477 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
4478 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
4479 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
4480 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
4481 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
4482 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
4483 Update the call to parse_long_options so that `AUTHORS, NULL' are the
4485 * src/true.c (main): Append NULL to version_etc argument list.
4486 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
4488 2003-10-17 Andreas Schwab <schwab@suse.de>
4490 * tests/mk-script: Get $srcdir from first parameter instead of
4492 (main): Update usage.
4494 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
4495 first argument of mk-script.
4496 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
4498 2003-10-17 Jim Meyering <jim@meyering.net>
4500 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
4501 generated `man' page is more readable. Suggestion from Dan Jacobson.
4503 * src/chown-core.c (change_file_owner): Handle the cases in
4504 which fts_info indicates an error with the given entry.
4506 * src/du.c (main): Simply assign to bit_flags.
4507 Don't bother with bit arithmetic.
4509 * tests/chmod/no-x: New file.
4510 * tests/chgrp/no-x: New file.
4511 * tests/chmod/Makefile.am (TESTS): Add no-x.
4512 * tests/chgrp/Makefile.am (TESTS): Likewise.
4514 * src/du.c: Include "xfts.h".
4515 (du_files): Use xfts_open, rather than fts_open.
4516 * src/chown-core.c (chown_files): Likewise.
4518 2003-10-16 Jim Meyering <jim@meyering.net>
4520 * src/chgrp.c (main): Simply assign to bit_flags.
4521 Don't bother with bit arithmetic.
4522 * src/chown.c (main): Likewise.
4523 Rename a couple of local variables.
4524 Remove unnecessary casts.
4526 * src/tail.c (start_bytes): Rename local, remainder, to avoid
4527 gcc's warning about shadowing a global.
4529 2003-10-15 Jim Meyering <jim@meyering.net>
4531 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
4532 use fts to perform a directory traversal when -R is specified.
4533 Before, they operated on full path names, and as such would
4534 encounter the PATH_MAX (often 4096) limit.
4535 They are more efficient. For example, before, chgrp -R would
4536 take almost 5 seconds to change about 2000 directories and fail
4537 (with `File name too long'), while now it succeeds on a hierarchy
4538 of depth 20,000 in 1/10 the time.
4540 * src/chown.c: Include "userspec.h" and "fts_.h".
4541 (WRITTEN_BY): Add my name.
4542 (getpwnam, getgrnam, getgrgid): Remove declarations.
4543 (endpwent): Remove definition.
4545 (main): Handle new options.
4546 Call new function, chown_files rather than change_file_owner.
4548 * src/chgrp.c: Include "fts_.h".
4549 (WRITTEN_BY): Add my name.
4550 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
4553 (main): Handle new options.
4554 Call new function, chown_files rather than change_file_owner.
4556 Rewrite to iterate through hierarchies using fts rather than
4557 via explicit recursion.
4558 * src/chown-core.c: Include "fts_.h"
4559 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
4560 on a single file at a time.
4561 (chown_files): New function.
4562 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
4563 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
4564 [struct Chown_option] (dereference): Remove member with ambiguous name.
4565 [struct Chown_option] (affect_symlink_referent): New member.
4566 (chown_files): New prototype.
4568 * tests/chgrp/recurse: Update tests accordingly.
4569 * tests/chgrp/posix-H: New tests for the above.
4570 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
4572 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
4573 work even for superuser. Suggestion from Dan Jacobson.
4575 2003-10-14 Paul Eggert <eggert@twinsun.com>
4577 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
4579 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
4580 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
4581 * src/sort.c (parse_field_count): Handle the case where overflow
4582 and invalid suffix char are both reported.
4584 2003-10-14 Jim Meyering <jim@meyering.net>
4586 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
4587 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
4590 2003-10-13 Paul Eggert <eggert@twinsun.com>
4592 Fix to avoid a denial-of-service attack if the display width is
4593 enormous. Also, clean up the code a bit by removing duplicate code.
4595 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
4596 (calculate_columns): New function, that contains code that used
4597 to be common to print_many_per_line and print_horizontal.
4598 (print_many_per_line, print_horizontal): Use it.
4599 (decode_switches): Set max_idx here, not in calculate_columns.
4600 (print_current_files): Don't call init_column_info; calculate_columns
4602 (init_column_info): Don't allocate a lot more space than is needed
4603 to represent the current set of files. Allocate all the new
4604 size_t cells in one call to xnmalloc, rather than a row at a time.
4606 2003-10-13 Jim Meyering <jim@meyering.net>
4608 * src/ls.c (init_column_info): Add another FIXME comment.
4610 2003-10-13 Paul Eggert <eggert@twinsun.com>
4612 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
4613 Remove several arbitrary limits on hosts where int cannot represent
4616 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
4617 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
4618 struct column_info.col_arr[0], max_idx):
4619 Now size_t, not int.
4620 (get_funky_string): Return bool indicating success, instead of
4621 a negative count to indicate failure. Store number of columns
4622 through new parameter OUTPUT_COUNT; that way, they can never
4623 go negative. Change equals_end from int to bool. All uses
4625 (struct column_info.valid_len): Now bool, not int. All uses changed.
4626 (dired_dump_obstack, get_funky_string, clear_files,
4627 extract_dirs_from_files, print_current_files,
4628 print_many_per_line, print_horizontal, init_column_info,
4629 put_indicator, length_of_file_name_and_frills,
4630 print_with_commas): Use size_t, not int, for local variables
4632 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
4633 Check for TIOCGWINSZ returing negative values (or values greater
4635 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
4637 Use xmalloc and xnmalloc, not XMALLOC.
4638 (gobble_file): Use xnrealloc, not XREALLOC.
4639 (print_color_indicator): Remove now-unnecessary cast to size_t.
4641 2003-10-12 Paul Eggert <eggert@twinsun.com>
4643 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
4644 * tests/sort/sort-tests: Remove from CVS; assume that people
4645 brave enough to check coreutils out from CVS can rebuild it.
4647 2003-10-12 Jim Meyering <jim@meyering.net>
4649 New options: --preserve-root and --no-preserve-root.
4650 * src/chmod.c (change_file_mode): Honor new option.
4651 (change_file_mode): Strip trailing slashes on directory
4652 argument passed to change_dir_mode.
4653 (get_root_dev_ino): New function.
4654 (main): Initialize global, root_dev_ino.
4656 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
4657 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
4659 * src/chmod.c (change_file_mode): Likewise.
4661 2003-10-08 Jim Meyering <jim@meyering.net>
4663 * src/csplit.c (main): Remove obsolete FIXME.
4665 2003-10-07 Jim Meyering <jim@meyering.net>
4667 * Use automake-1.7.8. Regenerate dependent files.
4669 2003-09-29 Paul Eggert <eggert@twinsun.com>
4673 * doc/coreutils.texi (csplit invocation):
4674 The regexp offset need not have a sign; POSIX requires support
4675 for signless offets.
4677 Be more careful about int widths. For example, remove some
4678 arbitrary limits by replacing 'unsigned' with 'size_t',
4679 'uintmax_t', etc. Use standard bool rather than a homegrown type.
4680 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
4681 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
4682 to <stdbool.h> usage.
4683 (struct control): offset is now intmax_t, not int.
4684 repeat_forever is now bool, not int.
4685 (struct cstring): len is now size_t, not unsigned int.
4686 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
4687 size_t, not unsigned. start_line, first_available are now
4688 uintmax_t, not unsigned.
4689 (hold_count, control_used): Now size_t, not unsigned.
4690 (last_line_number, current_line, bytes_written):
4691 Now uintmax_t, not unsigned.
4692 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
4693 create_new_buffer, get_new_buffer, load_buffer, find_line,
4694 process_regexp, split_file, new_control_record, extract_regexp,
4695 get_format_width, get_format_prec, max_out):
4696 size args, locals, and returned values are now size_t, not unsigned
4698 (get_first_line_in_buffer, find_line, write_to_file,
4699 handle_line_error, process_line_count, regexp_error, process_regexp,
4701 File line, byte, and repetition counts are now uintmax_t, not unsigned.
4702 (check_for_offset): Don't require a sign before the offset.
4703 Use xstrtoimax to do the real work.
4704 (extract_regexp): Remove harmful cast of size to unsigned.
4705 256 -> 1<<CHAR_BIT, for clarity.
4706 (get_format_flags): Return at most 3, to avoid worries about overflow.
4708 (bytes_to_octal_digits): Remove.
4710 (cleanup): Don't check whether output_stream is NULL, since
4711 close_output_file does that for us.
4713 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
4714 (sizeof *p);" instead of the more long-winded alternatives.
4716 (get_new_buffer): Use O(1) algorithm for resizing a buffer
4717 to a much larger size, instead of an O(N) algorithm.
4719 (process_regexp): Use plain NULL rather than casted 0.
4721 (make_filename): Use %u, not %d, to format unsigned file number.
4723 (new_control_record): Use xrealloc exclusively, since it handles
4726 (extract_regexp): Change misspelled word in diagnostic.
4728 (get_format_width): Even if a minimum field width is specified,
4729 allow room for enough octal digits to represent the value of
4730 the maximum representible integer. This fixes a potential
4731 buffer overrun. Calculate this room at compile-time, not
4732 at run-time; this removes the need for bytes_to_octal_digits.
4733 Check for overflow; this removes a FIXME.
4735 (get_format_prec): Don't allow precision to be signed; it's
4736 not ANSI. Check for overflow. Remove hardcoded "11" as
4737 default precision; this fixes a potential buffer overrun
4738 on hosts with wider size_t.
4740 (get_format_conv_type): Change local variable to be of type
4741 unsigned char, not int; this removes a potential subscript
4742 violation on hosts where char is signed.
4744 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
4745 Allow "%%" in format. Don't overflow when
4746 counting lots of percents.
4748 (usage): Default sprintf format is %02u, not %d.
4750 2003-10-05 Jim Meyering <jim@meyering.net>
4752 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
4754 * src/du.c (du_files): Mark diagnostic for translation.
4756 2003-10-04 Jim Meyering <jim@meyering.net>
4758 * src/du.c (du_files): Ignore any failure of fts_close.
4759 Give better diagnostics for failed fts_open.
4761 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
4763 Deprecate existing use of -H (aka --si).
4764 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
4765 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
4766 (main): Warn that the meaning of -H will soon change to be
4769 2003-10-03 Jim Meyering <jim@meyering.net>
4771 * src/du.c: Accept --no-dereference (-P).
4773 2003-10-02 Jim Meyering <jim@meyering.net>
4775 * tests/du/trailing-slash: Adjust for slightly different output.
4777 Rewrite du.c to use fts.
4778 * src/du.c: Include "fts_.h", not ftw.h.
4779 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
4780 (IS_FTW_DIR_TYPE): Remove definition.
4781 (IS_DIR_TYPE): Define.
4782 (is_symlink_to_dir): Remove now-unnecessary function.
4783 (process_file, du_files): Rewrite to use fts.
4785 * tests/du/inaccessible-cwd: Ensure that even when run from an
4786 inaccessible directory, du can still operate on accessible
4787 directories elsewhere.
4788 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
4790 * tests/rm/deep-1: Ensure that du can process a hierarchy
4791 of depth 400 while using no more than 50KB of stack space.
4793 2003-10-01 Akim Demaille <akim@epita.fr>
4795 * announce-gen (print_news_deltas): New function, extracted from main.
4796 (main): Make `news_file' an array.
4797 Use '...=s' => \@var for --news and --url-directory specs.
4798 Before there were a couple of portability problems.
4800 2003-09-28 Jim Meyering <jim@meyering.net>
4802 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
4803 (syntax-check-rules): Add it.
4805 * src/copy.c: Remove unnecessary cast of alloca, since now it's
4806 guaranteed to be (void *).
4807 * src/cp.c: Likewise.
4808 * src/join.c: Likewise.
4809 * src/ln.c: Likewise.
4810 * src/ls.c: Likewise.
4811 * src/od.c: Likewise.
4812 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
4814 2003-09-27 Jim Meyering <jim@meyering.net>
4816 Don't exhaust virtual memory when processing large inputs.
4817 Fix this by removing csplit's internal free-list management;
4818 instead rely on malloc for that.
4820 * src/csplit.c (free_list): Remove global.
4821 (clear_all_line_control): Remove function.
4822 (get_new_buffer): Always use create_new_buffer to obtain a
4823 new buffer, rather than searching free_list.
4824 (free_buffer): Just call free.
4825 Reported by Nikola Milutinovic.
4827 2003-09-26 Jim Meyering <jim@meyering.net>
4829 * man/rm.x: Also list `chattr' in SEE ALSO section.
4830 Suggestion from Mark Hubbart.
4832 2003-09-25 Jim Meyering <jim@meyering.net>
4834 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
4835 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
4837 * Use autoconf-2.57d. Regenerate dependent files.
4839 2003-09-24 Jim Meyering <jim@meyering.net>
4841 Minor efficiency tweak.
4842 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
4843 (do_link): Likewise.
4845 2003-09-23 Jim Meyering <jim@meyering.net>
4847 * src/paste.c (paste_serial): Save errno after input error,
4848 to report proper errno value.
4849 Based on a patch from Paul Eggert.
4851 * src/tee.c (tee): Adjust fwrite arguments so that the return
4852 value is the number of bytes written.
4854 2003-09-16 Paul Eggert <eggert@twinsun.com>
4856 Don't assume ferror sets errno. Bug reported by Bruno Haible.
4858 * src/comm.c (compare_files): Save errno after input error,
4859 to report proper errno value.
4860 * src/fold.c (fold_file): Likewise.
4861 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
4862 * src/unexpand.c (unexpand): Likewise.
4864 * src/csplit.c (close_output_file): Don't report bogus errno value
4865 after ferror discovers an output error. We don't know the proper
4866 errno value, since it might have been caused by any of a whole
4867 bunch of calls, and it might have been trashed in the meantime.
4868 Fixing this problem will require much more extensive changes;
4869 in the meantime just say "write error".
4870 * src/od.c (check_and_close, dump, dump_strings): Likewise.
4871 * src/uniq.c (check_file): Likewise.
4873 * src/join.c (get_line): Report error right away if I/O fails,
4874 so that the proper errno value is used.
4875 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
4876 * src/tee.c (tee): Likewise.
4877 * src/uniq.c (check_file): Likewise.
4879 * src/od.c (skip): If a read fails, don't retry it later, so
4880 that we report the proper errno.
4882 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
4884 * src/tee.c (tee): Once a write failure has occurred, don't bother
4885 writing anything more to that stream.
4887 * src/uniq.c (check_file): Check for ferror (stdout) even if
4890 * src/yes.c (UNROLL): Remove.
4891 (main): Exit immediately when write failure is detected.
4892 Simplify code by assigning to argv when argc == 1.
4894 2003-09-21 Paul Eggert <eggert@twinsun.com>
4896 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
4897 (WRITTEN_BY): Change "Franc,ois" (actually using
4898 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
4901 2003-09-19 Jim Meyering <jim@meyering.net>
4903 `du -D symlink-to-dir' would mistakenly omit the slash in
4904 lines like this: 24 symlink-to-dir/subdir
4905 * src/du.c (process_file): Fix offset calculation.
4906 Reported by Jeff Sheinberg as Debian bug #211591;
4907 http://bugs.debian.org/205251
4909 * tests/du/deref-args: New file/test for the above.
4910 * tests/du/Makefile.am (TESTS): Add deref-args.
4912 * src/du.c (process_file): Remove useless disjunct.
4914 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
4916 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
4917 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
4918 Mark each WRITTEN_BY string as translatable.
4920 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
4921 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
4922 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
4923 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
4924 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
4925 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
4926 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
4927 * who.c, whoami.c, yes.c: Revert yesterday's changes.
4928 Instead, a subsequent change will embed `Written by ' in
4929 each string along with the author names.
4931 * src/true.c: Revert yesterday's changes.
4932 * src/sys2.h: Likewise.
4934 2003-09-18 Jim Meyering <jim@meyering.net>
4936 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
4937 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
4938 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
4939 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
4940 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
4941 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
4942 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
4943 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
4944 comma-separated list of strings and/or update the call to
4945 parse_long_options so that `AUTHORS, NULL' are the last parameters.
4946 * src/true.c (main): Append NULL to version_etc argument list.
4947 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
4949 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
4950 shadowing the math function name. Also rename loga to log_a.
4952 2003-09-14 Jim Meyering <jim@meyering.net>
4954 * src/factor.c (print_factors): Give a separate diagnostic
4955 for numbers that are too large, but otherwise valid.
4956 Reported by Dániel Varga.
4958 2003-09-10 Jim Meyering <jim@meyering.net>
4960 * Use automake-1.7.7. Regenerate dependent files.
4962 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
4963 of `fmt -1'. Using the just-built tr is a little cleaner.
4964 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
4965 * man/Makefile.am (programs, check-x-vs-1): Likewise.
4967 2003-09-09 Jim Meyering <jim@meyering.net>
4969 * src/copy.c: Alphabetize includes.
4970 Remove duplicate inclusion of "same.h".
4972 2003-09-08 Jim Meyering <jim@meyering.net>
4974 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
4975 Didn't give enough of a benefit, mainly because it's not yet
4980 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
4981 (check-programs-vs-x): Fail if $(programs) is empty.
4983 * src/remove.c: Add a comment.
4985 2003-09-07 Jim Meyering <jim@meyering.net>
4987 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
4988 Don't define. These symbols are no longer used.
4990 * tests/misc/tty-eof: Write ^D as \cD.
4991 Complete the change of 2003-08-02.
4993 * Makefile.maint (po-check): Use cvsu, so that a temporary source
4994 file in lib/ or src/ doesn't induce an unwarranted failure.
4995 Add a kludge to filter out the sole generated source file that
4996 also has translatable messages: src/false.c.
4998 2003-09-06 Jim Meyering <jim@meyering.net>
5000 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
5001 (parse_options): Give a diagnostic for (but still accept) the
5002 deprecated --allow-missing option.
5004 2003-09-04 Paul Eggert <eggert@twinsun.com>
5006 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
5007 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
5009 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
5010 size_bound ourselves. if an input file is a pipe and the user
5011 specified a size, use that size instead of trying to guess the
5012 pipe size. This has the beneficial side effect of avoiding the
5013 overhead of default_sort_size in that case. All callers changed.
5014 (sort): Remove static var size; now done by sort_buffer_size.
5016 2003-09-05 Jim Meyering <jim@meyering.net>
5018 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
5020 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
5021 to start, rather than just .1. Upon failure, print unexpected state.
5023 2003-09-04 Paul Eggert <eggert@twinsun.com>
5025 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
5026 SAFE_READ_ERROR to tmp->nbytes.
5027 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
5029 * src/head.c (struct linebuffer): Change nbytes and nlines
5030 from unsigned int to size_t. unsigned int is safe (after the
5031 2003-09-03 patch) but size_t is cleaner.
5032 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
5033 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
5035 Standardize on BUFSIZ as opposed to other macro names and values.
5036 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
5037 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
5038 stdio.h has always defined it,
5039 and other code already assumes it's defined.
5040 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
5041 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
5042 (io_buf): IO_BUF_SIZE -> BUFSIZ.
5044 2003-09-04 Paul Eggert <eggert@twinsun.com>
5046 * src/seq.c (step): Default to 1.
5047 (print_numbers): Allow the output to be empty.
5048 (main): The default step is 1, even if LAST < FIRST;
5049 as per documentation.
5050 * tests/seq/basic (onearg-2): Output should be empty.
5052 2003-09-05 Jim Meyering <jim@meyering.net>
5054 * Makefile.cfg (wget_files): Temporarily disable, until master
5055 versions are restored to ftp.gnu.org.
5057 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
5059 Make seq's --width (-w) option work properly even when the
5060 endpoint requiring the larger width is negative and smaller than
5062 * src/seq.c (get_width_format): Include `-' in the set of bytes
5063 allowed in a `simple' number (no decimal point, no exponent).
5064 Reported by Patrick Mauritz.
5066 2003-09-02 Paul Eggert <eggert@twinsun.com>
5068 * NEWS: sort -t '\0' now uses a NUL tab.
5069 sort option order no longer matters, unless POSIX requires it.
5070 * src/sort.c (usage): Say "blanks" instead of "whitespace",
5071 Similar fixes for many comments.
5072 (TAB_DEFAULT): New constant, so that we can support NUL as
5073 the field separator.
5074 (tab): Now int, not char. Initialize to TAB_DEFAULT.
5075 (specify_sort_size): If multiple sizes are specified, use the largest.
5076 (begfield, limfield): Support NUL tab char.
5077 (set_ordering): Do not let -i override -d.
5078 (main): Report an error if incompatible -o or -t options are given.
5079 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
5081 2003-09-05 Jim Meyering <jim@meyering.net>
5083 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
5085 2003-09-03 Andreas Schwab <schwab@suse.de>
5087 Bug report and patch here:
5088 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
5089 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
5090 * src/head.c (elide_tail_lines_pipe): Likewise.
5092 2003-09-03 Jim Meyering <jim@meyering.net>
5094 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
5095 small amount of code from him was first moved to lib/human.c, and was
5096 subsequently rewritten entirely.
5097 * src/df.c (AUTHORS): Likewise.
5099 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
5101 * src/md5sum.c (split_3): Accept the BSD format for generic
5102 message digest modes. Currently works with BSD's MD5 and SHA1
5103 formats since these are the two algorithms presently used in
5104 coreutils. Updated comments to reflect this change.
5105 (bsd_split_3): Updated comments.
5107 * tests/md5sum/basic-1: New test to make sure that
5108 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
5109 from `check-bsd' test in tests/sha1sum/basic-1).
5111 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
5112 --check exit status and BSD SHA1 format (adapted from tests
5113 in tests/md5sum/basic-1).
5115 2003-08-30 Jim Meyering <jim@meyering.net>
5117 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
5119 When source and destination arguments refer to the same file, reside
5120 on a partition (e.g. VFAT) on which distinct names may refer to the
5121 same directory entry (often due to variations in case), and when the
5122 link count for the file is 1, mv no longer unlinks the file. Instead,
5123 it gives the expected diagnostic that the source and destination are
5124 the same. WARNING: this is an incomplete fix. If the file happens
5125 to have a link count of 2 or greater, such an erroneous mv command
5126 will still unlink it.
5127 Although that is not possible on vfat or umsdos, it is possible on
5128 other file system types, e.g., ntfs, and hpfs.
5129 * src/copy.c (same_file_ok): Invoke same_name (which might still
5130 return false for names that refer to the same directory entry)
5131 only if the link count is 2 or more.
5132 * tests/mv/vfat: Show how to demonstrate the above problem.
5133 This test is not run.
5134 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
5136 2003-08-27 Jim Meyering <jim@meyering.net>
5138 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
5139 who's -l option has been eliciting an unconditional warning about
5140 this impending change since sh-utils-2.0.12 (April 2002).
5142 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
5143 This would happen for nonempty files not ending with a newline.
5144 Reported by Dan Jacobson.
5145 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
5146 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
5148 * src/stat.c (print_it): Avoid buffer overrun that would
5149 occur when the user-specified format string ends with `%'.
5150 Patch by Tommi Kyntola.
5151 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
5152 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
5154 2003-08-26 Jim Meyering <jim@meyering.net>
5156 Apply changes from bison.
5157 * GNUmakefile (SHELL): Define to `sh', if necessary.
5159 * Makefile.maint (WGETFLAGS): Define to `-C off'.
5160 Update all uses of $(WGET).
5162 2003-08-22 Akim Demaille <akim@epita.fr>
5164 * Makefile.cfg (local-checks-to-skip): New.
5165 * Makefile.maint (local-check): Rename as...
5166 (local-checks-available): this.
5169 2003-08-26 Akim Demaille <akim@epita.fr>
5171 * announce-gen (print_changelog_deltas): Neutralize "<#" as
5172 "<\#" to avoid magic from Gnus when posting parts of this script.
5174 2003-08-25 Jim Meyering <jim@meyering.net>
5176 * src/stat.c (main): Warn about use of deprecated `-l' option.
5178 2003-08-22 Jim Meyering <jim@meyering.net>
5180 * src/stat.c (do_stat): For link count at end of line, use %h format,
5181 instead of %-5h. The latter would make stat emit trailing spaces.
5182 Reported by Dan Jacobson.
5184 2003-08-20 Jim Meyering <jim@meyering.net>
5186 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
5188 2003-08-19 Jim Meyering <jim@meyering.net>
5190 * src/system.h: Include stdlib.h unconditionally,
5191 as we're now assuming that part of hosted C89.
5193 2003-08-18 Jim Meyering <jim@meyering.net>
5195 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
5196 to avoid warnings from gcc.
5198 2003-08-17 Jim Meyering <jim@meyering.net>
5200 Avoid unnecessary and sometimes time-consuming hostname lookups.
5201 * src/who.c (print_user): Use strchr, not strrchr.
5202 * src/pinky.c (print_entry): Likewise.
5203 Patch by Michael Stone.
5204 This fixes a typo I introduced in who-users.c on 1996-02-23.
5206 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
5207 disallowed between `@...@'.
5209 2003-08-16 Paul Eggert <eggert@twinsun.com>
5211 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
5212 done by gnulib .m4 files.
5213 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
5214 * src/sys2.h (strtoull): Remove unused declaration.
5216 2003-08-16 Jim Meyering <jim@meyering.net>
5218 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
5221 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
5222 race condition bug. The bug would be triggered when tailing a file
5223 with file pointer not at beginning of file, and where the file was
5224 truncated to have a length of less than the initial offset at just
5225 the right moment (between the two lseek calls in this function).
5227 An invalid initial value for *read_pos would result in
5228 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
5229 busy-wait rather than sleeping between iterations. The bug manifests
5230 itself only when tailing regular files that are initially nonempty.
5231 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
5233 (tail_lines): Likewise, after lseek calls.
5234 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
5235 * tests/tail-2/tail-n0f: New file. Test for above fix.
5236 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
5238 2003-08-15 Jim Meyering <jim@meyering.net>
5240 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
5241 (sc_sun_os_names): Likewise.
5242 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
5244 * man/help2man: Remove some SPACEs before TAB.
5246 2003-08-14 Paul Eggert <eggert@twinsun.com>
5248 * Makefile.maint (LC_ALL): Set to C.
5249 * man/Makefile.am (ASSORT): New var.
5250 (check-x-vs-1, programs): Use it.
5251 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
5252 * tests/Makefile.am (ASSORT, all_programs): Likewise.
5254 2003-08-11 Jim Meyering <jim@meyering.net>
5256 fold -s -wN would infloop for N < 8 with TABs in the input.
5257 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
5258 * src/fold.c (fold_file): Move contents of `else'-block
5259 out of conditional so it's used also for --spaces (-s).
5260 * tests/misc/fold: Test for the above fix.
5261 * tests/misc/Makefile.am (TESTS): Add fold.
5263 2003-08-10 Jim Meyering <jim@meyering.net>
5265 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
5266 system.h so the types from time.h and sys/time.h are available.
5267 It appears that this is necessary for OpenBSD, NetBSD, and
5268 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
5270 2003-08-06 Paul Eggert <eggert@twinsun.com>
5272 * NEWS: Add support for setting file timestamps to microsecond
5273 resolution, on hosts that support this.
5274 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
5275 * src/copy.c (copy_internal):
5276 Set file timestamps with utimens, not utime.
5277 * src/cp.c (re_protect): Likewise.
5278 * src/install.c (change_timestamps): Likewise.
5279 * src/touch.c (newtime, touch, main): Likewise.
5281 2003-08-09 Jim Meyering <jim@meyering.net>
5283 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
5285 (syntax-check-rules): Add it.
5287 * src/tail.c (main): Tweak Solaris OS version number in comment.
5288 * src/wc.c (wc): Likewise
5289 * tests/tail-2/fflush: Likewise.
5291 * src/tail.c: Add new undocumented option, --presume-input-pipe.
5292 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
5294 2003-08-08 Paul Eggert <eggert@twinsun.com>
5296 Use new gnulib 'extensions' module.
5297 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
5300 2003-08-08 Paul Eggert <eggert@twinsun.com>
5302 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
5304 2003-08-09 Jim Meyering <jim@meyering.net>
5306 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
5307 For tests of obsolete behavior, don't presume that unsetting
5308 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
5310 2003-08-07 Paul Eggert <eggert@twinsun.com>
5312 * doc/coreutils.texi (split invocation):
5313 Add -d or --numeric-suffixes option to 'split'.
5314 From a suggestion by Jesse Kornblum.
5315 * src/split.c (suffix_alphabet): New var.
5316 (longopts, usage, next_file_name, main): Support -d.
5317 (next_file_name, main): Allow -a0, as POSIX requires.
5318 (next_file_name): Don't assume ASCII-like encoding;
5319 'a' through 'z' are not contiguous in EBCDIC.
5321 2003-08-05 Paul Eggert <eggert@twinsun.com>
5323 Merge getline from gnulib.
5324 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
5325 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
5326 New files, from gnulib.
5327 * lib/getdelim2.c, lib/getdelim2.h: Remove.
5328 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
5329 getdelim2.h to getndelim2.c and getndelim2.h.
5330 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
5331 checking for getdelim.
5332 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
5333 than rolling our own.
5334 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
5335 (cut_fields): Invoke getndelim2 rather than getdelim2.
5337 2003-08-04 Jim Meyering <jim@meyering.net>
5339 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
5340 and for the indices to iterate through nsigs.
5342 2003-08-02 Paul Eggert <eggert@twinsun.com>
5344 * src/sort.c: Minor code cleanups, mostly to use more accurate
5345 types and to remove unnecessary casts.
5346 (min, max): Remove. All uses changed to MIN and MAX.
5347 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
5348 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
5349 keyfield.numeric, struct keyfield.general_numeric, struct
5350 keyfield.month, struct keyfield.reverse, reverse, unique,
5351 have_read_stdin): Now bool, not int. All uses changed.
5352 (eolchar): Now char, not int.
5353 (struct keyfield.ignore): Now bool const *, not int *.
5354 (struct keyfield.translate): Now char const *, not char *.
5355 (struct month.name): Likewise.
5356 (blanks, nonprinting, nondictionary): Now bool[], not int[].
5357 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
5358 check, sort, main): Use const * pointers when possible.
5359 (month_cmp): Rewrite to avoid casts.
5360 (inittables): Initialize tables unconditionally, to avoid branches.
5361 (fillbuf): Return bool, not int. All uses changed.
5362 (fillbuf, keycompare, new_key, main):
5363 Use SIZE_MAX rather than (size_t) -1.
5364 (trailing_blanks): Renamed from trim_trailing_blanks.
5365 Return the number of blanks to trim. All uses changed.
5366 (getmonth): Use trailing_blanks rather than open code.
5367 (keycompare): Do not cast char * to unsigned char *; not needed.
5368 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
5370 (compare, main): Use | rather than || to avoid jumps.
5371 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
5373 (check, first_same_file, sort, main):
5374 Use bool instead of int local vars when possible.
5375 (check): Merge the old 'checkfp' and 'check' into a single function,
5376 that returns a boolean (true if the file was ordered).
5378 (main): Use int instead of unsigned for iterating through nsigs.
5379 Rename local var "posix_pedantic" to "posixly_correct".
5381 2003-08-02 Jim Meyering <jim@meyering.net>
5383 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
5384 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
5386 * src/cut.c (cut_fields): Don't read again after encountering an
5387 initial EOF. E.g., `cut -f2' would do so.
5388 * tests/misc/tty-eof: Add a test for the above fix.
5390 * src/sort.c (sortlines): Add description and references.
5393 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
5394 the tests in help-version will use the just-built binaries.
5395 Reported by Christian Krackowizer.
5397 2003-07-31 Paul Eggert <eggert@twinsun.com>
5399 * NEWS: Add --rfc-2822 option to GNU date.
5400 * doc/coreutils.texi (Time directives, Options for date, Examples
5402 * src/date.c (long_options, usage, main): Likewise.
5403 * doc/getdate.texi (General date syntax): Likewise.
5404 * doc/coreutils.texi (Options for date): Fix a typo in format:
5405 it's now %d not %_d. Add URLs.
5407 2003-08-01 Jim Meyering <jim@meyering.net>
5409 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
5410 Otherwise, with at least the /bin/sh from HPUX 10.20,
5411 the trap code would end up converting that to exit 1 and thus an
5412 unexpected test failure. Reported by Christian Krackowizer.
5414 2003-07-31 Paul Eggert <eggert@twinsun.com>
5416 * src/ptx.c: Do not include bumpalloc.h.
5417 (WORD_TABLE): New member alloc.
5418 (ALLOC_NEW_WORD): Remove.
5419 (occurs_alloc): New var.
5420 (digest_word_file, find_occurs_in_text): Check for arithmetic
5421 overflow when computing table size. Use xrealloc rather than
5422 bumpalloc primitives.
5424 2003-07-29 Jim Meyering <jim@meyering.net>
5428 * README: When running tests as root, suggest using
5429 sudo with NON_ROOT_USERNAME=$USER.
5431 * tests/Makefile.am (all_programs): Makefile is in ../src, not
5434 2003-07-28 Jim Meyering <jim@meyering.net>
5436 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
5438 2003-07-28 Paul Eggert <eggert@twinsun.com>
5440 * lib/stdbool.hin (_Bool): Make it signed char, instead of
5441 an enum type, so that it's guaranteed to promote to int.
5442 * src/sort.c (sortlines_temp): Undo previous change.
5444 2003-07-28 Jim Meyering <jim@meyering.net>
5446 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
5447 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
5448 would cause lines[-1 - swap] (with swap = false) to evaluate to
5451 2003-07-27 Jim Meyering <jim@meyering.net>
5453 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
5454 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
5456 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
5457 directories, as required by POSIX. Reported by Karl Berry.
5458 * tests/rm/dir-no-w: New file. Test for the above fix.
5459 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
5461 * tests/mk-script: Emit `$xx', not its expansion.
5463 2003-07-27 Paul Eggert <eggert@twinsun.com>
5465 This change was inspired by a similar proposal by Stepan Kasal.
5466 * src/sort.c (mergelines, sortlines_temp): New functions.
5467 (sortlines): Use them, to reduce the number of times that
5468 we need to copy 'struct line' values. This improved CPU
5469 performance by about 30% on one 18 MB test.
5470 (sort): Don't invoke sortlines unless we have 2 or more lines.
5472 2003-07-26 Stepan Kasal <kasal@ucw.cz>
5474 * src/sort.c (sort): Don't require two `struct line's per text line,
5475 the new sort algorithm requires just 1.5.
5477 2003-07-27 Jim Meyering <jim@meyering.net>
5479 * src/pathchk.c (validate_path): Use %lu, not %ld.
5481 * src/cut.c (is_printable_field): Simplify bit arithmetic.
5483 * src/ls.c (sort_files): Put `volatile' in the right place.
5486 2003-07-26 Jim Meyering <jim@meyering.net>
5488 Use only one bit per field/offset in array, not one `int'.
5489 * src/cut.c (printable_field): Change type to `unsigned char'.
5490 (mark_printable_field, is_printable_field): New functions.
5491 Use them in place of all direct accesses of `printable_field'.
5493 * src/expand.c (parse_tabstops): Detect overflow properly.
5494 * src/cut.c (set_fields): Likewise.
5496 * src/rm.c: Include "dirname.h".
5497 (usage): Use base_name (program_name) in body of --help output.
5499 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
5500 Idea from Brendan O'Dea, who suggested using
5501 `program_name = basename (argv[0]);' everywhere --
5502 can't do that, but using base_name works just fine here.
5504 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
5506 2003-07-24 Paul Eggert <eggert@twinsun.com>
5508 Fix some POSIX-compliance problems with 'test'. This makes
5509 'test' more compatible with Bash.
5511 * NEWS, doc/coreutils.texi: Document the following.
5512 * src/test.c: Include exitfail.h.
5513 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
5514 (test-syntax_error): Use it.
5515 (binary_operator): Now takes bool arg specifying whether left operand
5516 is -l ARG, so that caller determines this rather than us.
5518 (term): Use posixtest to evaluate parenthesized subexpressions.
5519 (unary_operator, one_argument): Remove support for -t without operand.
5520 (one_argument): Take argument from argv[pos].
5521 (one_argument, two_arguments, three_arguments): Advance pos.
5522 All callers changed.
5523 (three_arguments): Look for binary ops before "!". Then look
5524 for parenthesized one_argument expressions, instead of trusting
5525 expr () to do the right thing.
5526 (posixtest): Now takes number of args. All callers changed.
5527 Treat "( A B )" like "A B".
5528 (main): Set exit_failure to TEST_FAILURE. Don't depend on
5529 POSIXLY_CORRECT, as we now conform to POSIX by default.
5530 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
5531 * tests/test/Test.pm (test_vector): Add several tests to check
5532 the above. Syntax errors now exit with status 2, not 1.
5533 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
5535 2003-07-26 Jim Meyering <jim@meyering.net>
5537 * tests/help-version: Adjust for above change in test behavior:
5538 `[' exits with 2, not 1, and test doesn't accept --help or --version.
5540 * Makefile.maint (ME): Don't use trick suggested in Make manual.
5541 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
5543 * Makefile.maint (sc_system_h_headers): Another syntax check.
5544 (syntax-check-rules): Add it to the list.
5546 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
5547 so it matches `%ld' format even on 32-bit systems.
5549 * src/fmt.c (flush_paragraph): Cast field width to `int' to
5550 avoid warning on 64-bit systems.
5552 * src/ls.c (sort_files): Make `func' volatile, so it can't be
5553 clobbered by a `longjmp' into this function.
5555 2003-07-25 Jim Meyering <jim@meyering.net>
5557 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
5560 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
5561 because it'd evoke spurious failure on 64-bit systems.
5563 2003-07-24 Jim Meyering <jim@meyering.net>
5565 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
5566 output its current record counts. Reported by Jurriaan.
5568 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
5569 `wc' with no options. This goes along with the change of 2003-07-20.
5571 2003-07-23 Jim Meyering <jim@meyering.net>
5573 Don't include headers already included by system.h:
5574 * src/tr.c: Don't include errno.h.
5575 * src/true.c: Don't include version-etc.h.
5576 * src/test.c: Don't include limits.h or error.h.
5577 * src/stat.c: Don't include unistd.h or time.h.
5578 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
5579 * src/pr.c: Don't include time.h.
5580 * src/pathchk.c: Don't include errno.h.
5581 * src/nice.c: Don't include sys/time.h.
5582 * src/ls.c: Don't include stdlib.h.
5584 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
5585 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
5586 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
5587 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
5588 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
5589 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
5590 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
5591 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
5592 Don't include closeout.h.
5594 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
5595 can access the required version of rm.
5596 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
5598 * tests/cut/Test.pm (out-delim3a): New test.
5600 * man/help2man: Update to version 1.33.
5602 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
5604 * src/dircolors.c: Include xstrndup.h.
5605 (xstrndup): Remove function, now that it's been factored out into
5608 2003-07-22 Paul Eggert <eggert@twinsun.com>
5610 * src/wc.c (wc): Fix typo in computation of file from file_x,
5611 which caused the former to be used uninitialized if file_x was
5614 2003-07-22 Jim Meyering <jim@meyering.net>
5616 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
5618 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
5619 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
5620 Thomas Luzat. See http://bugs.debian.org/202413 for details.
5622 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
5624 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
5626 * src/cut.c (set_fields): Mark all selected indices before trying to
5627 determine range endpoints.
5628 * tests/cut/Test.pm: New test for the above fix.
5630 Begin to address this comment: What if someone wants to
5631 extract the 1,000,000-th field of some huge input file?
5632 The first step is to rearrange things so that the values
5633 in the printable_field array are all 0/1 rather than 0/1/2.
5634 * src/cut.c (RANGE_START_SENTINEL): Remove.
5635 Store range-start indices in a hash table, rather than
5636 overloading the `printable_field' array.
5637 (range_start_ht): New global.
5638 (hash_int, hash_compare_ints, is_range_start_index): New functions.
5639 (print_kth): Use is_range_start_index; don't test printable_field.
5640 (set_fields): Detect overflow.
5641 (set_fields): Insert each range-start index into range_start_ht.
5642 (main): Call set_fields only once, and only after
5643 output_delimiter_specified and (if required) range_start_ht have
5646 2003-07-20 Paul Eggert <eggert@twinsun.com>
5648 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
5649 invoked with a null pointer when there were no file arguments.
5651 2003-07-20 Jim Meyering <jim@meyering.net>
5653 * Makefile.maint (sc_changelog): Add another nit-picky check.
5655 * src/wc.c (write_counts): Add a comment.
5656 (wc): Rename `file' parameter.
5657 Set new local, `file', to be the file name, or (when it's NULL)
5658 _("standard output") so that all uses of `file' use the proper value.
5659 Use STREQ, not strcmp.
5661 2003-07-20 Paul Eggert <eggert@twinsun.com>
5663 wc count field widths now are heuristically adjusted depending
5664 on the input size, if known. If only one count is printed, it
5665 is guaranteed to be printed without leading spaces.
5667 Previously, wc did not align the count fields if
5668 POSIXLY_CORRECT was set, but POSIX did not actually require
5669 this undesirable behavior, so it has been removed.
5671 * NEWS: Document this.
5672 * doc/coreutils.texi (wc invocation): Likewise.
5674 * src/wc.c (number_width): New var.
5675 (posixly_correct): Remove.
5676 (struct fstatus): New struct.
5677 (write_counts): Output fields of width number_width.
5678 Do not worry about POSIXLY_CORRECT.
5679 Use null file, not empty-string file, to denote stdin,
5680 since "" is a valid file name on some hosts.
5681 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
5683 (wc): Avoid problems if end_pos - current_pos overflows.
5684 Do not print odd message if stdin has a read error.
5685 (get_input_fstatus, compute_number_width): New functions.
5686 (main): Use them to implement the new behavior.
5687 Ignore POSIXLY_CORRECT.
5689 * tests/wc/Test.pm: Adjust to the new output widths.
5691 2003-07-19 Jim Meyering <jim@meyering.net>
5693 * tests/rm/fail-eperm: Don't create temporary directory --
5696 * tests/shred/remove: Don't open-code test for UID != 0.
5697 Use priv-check's require-non-root instead.
5698 Update to use newer framework.
5700 * tests/help-version (expected_failure_status_expr): Record that
5701 expr exits with status of 3 for e.g., a write error.
5703 * tests/priv-check: Use `id -u' to see if we're running as root,
5704 rather than trying go write to an write-protected file.
5705 When running as root, ensure $NON_ROOT_USERNAME is valid.
5706 When running as root with `require-non-root', ensure that `.'
5707 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
5708 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
5710 * src/printenv.c: Include "exitfail.h".
5711 (main): Set exit_failure rather than calling close_stdout_set_status.
5712 * src/date.c: Likewise.
5713 * src/sort.c: Likewise.
5714 * src/tty.c: Likewise.
5716 2003-07-18 Jim Meyering <jim@meyering.net>
5718 * tests/touch/not-owner: Update to use newer framework.
5720 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
5721 directory, and remove Perl-coded `you may not run as root' test.
5722 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
5723 hard-coding something not quite equivalent.
5724 Paul Jarc reported the inconsistent diagnostics.
5726 * src/sort.c (main): Use close_stdout via atexit.
5727 Now `sort --version' and `sort --help' fail, as they should
5728 when their output is redirected to /dev/full.
5730 * src/su.c (usage): Don't call close_stdout here.
5731 (main): Use close_stdout via atexit.
5732 Now `su --version > /dev/full' fails, as it should.
5733 Somehow, the change of 2000-05-07 that purports to fix this
5736 * tests/help-version (--help/--version vs. /dev/full): Special-case
5737 `[' to protect it from expected_failure_status-`eval'.
5739 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
5740 count and the corresponding line, as required by POSIX.
5741 Reported by Clement Wang.
5742 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
5744 * tests/expr/basic: Add tests for when exit status is 2.
5746 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
5747 Use an anonymous `enum', rather than #define.
5749 2003-07-17 Paul Eggert <eggert@twinsun.com>
5751 * src/expr.c: Include "exitfail.h", "quotearg.h".
5752 (EXPR_INVALID, EXPR_ERROR): New constants.
5753 (nomoreargs, null, toarith, nextarg): Return bool, not int.
5754 (syntax_error): New function, exiting with status 2. Use it
5755 insteading of printing "syntax error" ourselves.
5756 (main): Initialize exit_failure to EXPR_ERROR.
5757 Exit with EXPR_INVALID on syntax error (too few arguments).
5758 (nextarg): Use strcmp, not strcoll; strcoll might return
5759 an undesirable 0, or might fail.
5760 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
5761 or other such error.
5762 (eval2): Report an error if strcoll fails in a string comparison.
5763 * src/sort.c: Include "exitfail.h".
5764 (main): Set exit_failure, not xalloc_exit_failure and
5765 xmemcoll_exit_failure.
5766 * tests/expr/basic: Invalid value exits with status 3, not 2.
5768 2003-07-16 Jim Meyering <jim@meyering.net>
5770 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
5771 per GNU maintainer guidelines. The next non-beta release will be 5.1.
5773 This script would have caught at least two recent bugs:
5774 those in [ and kill.
5775 * tests/help-version: Revive this script.
5776 It wasn't doing anything useful, since $all_programs wasn't being
5777 defined by the invoking Makefile.am.
5778 Reflect that nohup is no longer a script, so don't exclude it.
5779 Add framework to handle the programs added since it was last run:
5780 kill, stat, unlink, [, link, readlink.
5781 Fix path-related problems deriving from the move of this script
5782 from src/ to its present location.
5783 * tests/Makefile.am (all_programs): Define.
5784 (TESTS_ENVIRONMENT): Use it.
5786 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
5787 whereby kill would always attempt to operate on argv[0] and fail.
5789 * src/test.c (integer_expected_error): Improve diagnostic -- now,
5790 it also matches the one from bash's builtin test.
5791 (binary_operator): Add \n at end of diagnostic.
5793 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
5794 * tests/priv-check: Move setuidgid-related and
5795 NON_ROOT_USERNAME-checking code to this file.
5797 * README: Update section on testing as `root'.
5798 Suggestion from Paul Jarc.
5800 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
5801 names of authors that I just found in bash's builtins/test.def.
5803 Running `[' with no arguments would evoke a segfault.
5804 * src/test.c (main) [LBRACKET]: Move initialization of argv to
5805 precede potential use via test_syntax_error.
5807 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
5808 warning from automake -Wall.
5810 2003-07-15 Jim Meyering <jim@meyering.net>
5814 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
5817 * announce-gen (print_changelog_deltas): Relax tests for matching
5818 version-number line in NEWS.
5819 Change the .sig suffix to .asc here, too.
5821 2003-07-14 Jim Meyering <jim@meyering.net>
5823 * Makefile.maint (%.asc): Renamed from %.sig.
5824 Generate and use ascii-armored signatures.
5825 Use gpg's -o option.
5827 2003-07-13 Jim Meyering <jim@meyering.net>
5829 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
5832 * Makefile.maint (syntax-check): Move each individual check into
5834 (syntax-check-rules): This is the list of syntax-check targets.
5835 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
5836 (sc_cast_of_x_alloc_return_value, sc_space_tab):
5837 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
5839 2003-07-12 Jim Meyering <jim@meyering.net>
5841 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
5842 traces of the nohup script.
5844 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
5845 $(OPTIONAL_BIN_ZCRIPTS).
5847 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
5848 target, not before the `>'.
5850 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
5851 now that that function no longer calls `error'.
5853 * src/df.c (find_mount_point): Emit a diagnostic for each
5854 failed syscall, rather than relying on caller to do that.
5855 The caller couldn't do a good job, anyhow -- too many different
5856 ways to fail (each with a different referent).
5857 Give a diagnostic upon failed save_cwd, now that that function
5858 no longer calls `error'.
5859 (show_point): Don't diagnose find_mount_point's errors, now that
5860 it handles them itself.
5862 * src/df.c (find_mount_point): Don't let free clobber errno upon
5865 * src/sys2.h: Remove alloca-related block.
5866 * src/system.h: Include <alloca.h> here, instead.
5868 It appears that the `#pragma alloca' included via "system.h" is
5869 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
5870 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
5871 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
5873 * src/chown-core.c (change_file_owner): Do not restore any special
5874 permission bits (e.g., set-user-ID, set-group-ID) that are reset
5875 by chown(2) on some systems. Suggestion and insistence :-) from
5878 * tests/input-tty: Also check `test -t 1'.
5879 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
5880 test would block when run in the background.
5882 2003-07-11 Jim Meyering <jim@meyering.net>
5884 * tests/sample-test: Also fail if cat-to-create-expected-output
5885 fails. Otherwise, if both `exp' and `out' were to end up empty
5886 because of e.g., a full disk, they would mistakenly compare equal.
5888 * src/nohup.c: New file. Rewrite of nohup.sh in C.
5889 This solves a portability problem: on at least Solaris systems,
5890 when nohup.sh used the vendor /bin/sh, it would exit with status
5891 of `1' rather than the required 126 or 127 upon failure to exec
5892 the specified program.
5894 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
5895 (bin_PROGRAMS): Add nohup.
5896 (EXTRA_DIST): Remove nohup.sh.
5897 (all_programs): Remove use of $(EXTRA_SCRIPTS).
5898 * src/nohup.sh: Remove file.
5899 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
5901 * tests/misc/nohup: Tests for the above.
5902 * tests/misc/Makefile.am (TESTS): Add nohup.
5904 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
5905 the macro, COPY_FD_DIAGNOSE.
5906 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
5907 (head_file): Likewise.
5909 * src/date.c: Include "quote.h".
5910 (batch_convert): Use the quote function rather than using literal `...'
5913 * src/setuidgid.c (main): Enclose diagnostic in _(...).
5914 * src/fmt.c (main): Likewise.
5915 * src/mknod.c (main): Likewise.
5916 * src/tac.c (tac_seekable): Likewise.
5917 * src/yes.c (main): Likewise.
5918 * src/od.c (main): Likewise.
5919 * src/install.c (change_attributes): Likewise.
5921 2003-07-10 Jim Meyering <jim@meyering.net>
5923 * src/head.c (usage): Use 1024*1024 in place of 1048576.
5924 * src/tail.c (usage): Likewise.
5926 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
5927 place of the kludge in this test. Suggestion from Paul Jarc.
5929 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
5930 * src/setuidgid.c: New program, solely for testing (not installed).
5932 * src/chown-core.c (change_file_owner): Don't leak file descriptors
5933 when dereferencing symlinks.
5935 2003-07-09 Jim Meyering <jim@meyering.net>
5937 * tests/du/slash: New file/test for today's lib/ftw.c fix.
5938 * tests/du/Makefile.am (TESTS): Add slash
5940 * src/tail.c (xlseek): Avoid warning about ``return without value
5941 from function returning non-void''.
5943 2003-07-08 Jim Meyering <jim@meyering.net>
5945 * man/help2man: Update to version 1.29.
5947 * man/help2man: Add END handler to close STDOUT and check for errors.
5949 2003-06-30 Paul Eggert <eggert@twinsun.com>
5951 Add support for a "[" that conforms to the GNU coding standards,
5952 i.e., that does not depend on its name.
5953 * src/lbracket.c: New file.
5955 * man/Makefile.am (programs): Ignore "[", since it doesn't have
5956 a separate man page.
5957 * src/Makefile.am (bin_PROGRAMS): Add "[".
5958 (__SOURCES): New var.
5959 * src/test.c (LBRACKET): Define to 0 if not defined.
5960 (main): Use LBRACKET rather than argv[0].
5962 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
5963 Reported by Paul Jarc and Dan Jacobson.
5965 * src/test.c (main): Do not recognize --help or --version if
5966 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
5967 Do not bother testing that margv[margc] is non-null.
5969 2003-07-04 Jim Meyering <jim@meyering.net>
5971 * src/who.c (print_line): Rewrite to use asprintf, in order to be
5972 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
5974 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
5975 option, and perform the +1600 invocations of head IFF the envvar
5976 RUN_EXPENSIVE_TESTS is set.
5978 2003-07-03 Jim Meyering <jim@meyering.net>
5980 * src/cp.c (do_copy): Give a better diagnostic when failing due
5981 to nonexistent destination directory. Reported by Dmitry Rutsky.
5982 See http://bugs.debian.org/199730 for details.
5984 2003-06-27 Jim Meyering <jim@meyering.net>
5986 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
5987 * src/split.c (longopts): Use `1', not `0' as the value for
5988 for &verbose. Reported by Keith Thompson.
5990 Test for the above fix.
5991 * tests/misc/split-a: Also use --verbose and compare stderr
5992 output with what we'd expect.
5994 2003-06-20 Jim Meyering <jim@meyering.net>
5996 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
5997 Use `error_t' (rather than int) as type for local `err'.
5998 From Alfred M. Szmidt.
6000 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
6002 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
6003 Fix author preservation code.
6005 2003-06-19 Jim Meyering <jim@meyering.net>
6007 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
6008 (do_link): Don't warn about hard link to symlink.
6010 2003-06-18 Jim Meyering <jim@meyering.net>
6012 * src/cut.c: Include "getdelim2.h", not "getstr.h".
6013 Reflect renaming: getstr -> getdelim2.
6015 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
6016 readline -> readlinebuffer.
6018 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
6020 * src/readlink.c: Include <sys/types.h> before system.h (because
6021 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
6023 2003-06-17 Jim Meyering <jim@meyering.net>
6025 * src/system.h (initialize_main): Define.
6026 Use it in every `main'. Applied via this:
6027 p='initialize_main (&argc, &argv);'
6028 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
6029 $(grep -l program_name.=.argv.0 *.c)
6030 test.c uses margc/margv, so I made the change manually for that file.
6031 Based on a patch from Bernard Giroud.
6033 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
6035 Fix for build failure on Ultrix 4.3.
6036 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
6037 Include sys/param.h and sys/mount.h on ultrix.
6039 2003-06-16 Jim Meyering <jim@meyering.net>
6041 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
6043 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
6044 them here instead, but with one change: define EISDIR to -1, not 0.
6046 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
6047 guaranteed to be defined.
6048 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
6050 * README: Mention the CVS repository.
6051 Encourage addition of test cases.
6053 2003-06-12 Jim Meyering <jim@meyering.net>
6055 * src/touch.c (touch): Call close only if necessary.
6058 * src/wc.c (usage): Correct wording: wc prints counts in the order
6059 `newline, word, byte'. Reported by Keith M. Briggs.
6060 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
6062 2003-06-10 Jim Meyering <jim@meyering.net>
6064 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
6066 2003-06-07 Jim Meyering <jim@meyering.net>
6068 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
6071 2003-06-06 Jim Meyering <jim@meyering.net>
6073 * src/extract-magic (main): Avoid newer 3-arg form of open,
6074 so this script works also with e.g., perl5.005_03.
6075 Patch by John David Anglin.
6077 2003-06-04 Paul Eggert <eggert@twinsun.com>
6079 * src/system.h: Include <stdbool.h> unconditionally.
6081 2003-06-04 Jim Meyering <jim@meyering.net>
6083 * man/Makefile.am (check-programs-vs-x): Rename target
6084 from check-programs-vs-1. Adjust rule to check for the
6085 primary (.x) file, not the generated one (.1).
6087 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
6089 * man/kill.x: New file.
6090 * man/Makefile.am (dist_man_MANS): Add kill.1.
6093 2003-06-04 Jim Meyering <jim@meyering.net>
6095 Ensure that the .x file for a new program is never forgotten again.
6096 * man/Makefile.am (programs): Define.
6097 (check-programs-vs-1): New phony target.
6098 (check-local): Depend on it.
6100 2003-06-03 Jim Meyering <jim@meyering.net>
6102 Avoid unnecessary copying of environment.
6103 * src/env.c (main): Rather than clearing the environment and --
6104 unless told to ignore environment -- copying all settings from
6105 the saved, original environment, clear the environment only when
6106 that is requested. Suggested by Jens Elkner.
6108 2003-06-02 Jim Meyering <jim@meyering.net>
6110 * src/system.h: Always include <string.h>, since we assume C89.
6111 Include <limits.h> without checking for HAVE_LIMITS_H.
6113 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
6114 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
6116 2003-06-01 Jim Meyering <jim@meyering.net>
6118 Avoid a race condition in `tail -f' described by Ken Raeburn in
6119 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
6120 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
6121 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
6122 (tail_bytes, tail_lines, tail): Likewise.
6123 (tail_file): Use the new `read_pos' value as the size,
6124 rather than stats.st_size from the fstat call.
6126 2003-05-28 Jim Meyering <jim@meyering.net>
6128 * src/extract-magic: Allow expansion of `$file' in the here-
6129 document corresponding to the comment at the top of fs.h.
6131 2003-05-26 Jim Meyering <jim@meyering.net>
6133 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
6134 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
6135 Use #if/#elif/... cascade so we get only one set of include files.
6136 Reported by Nelson Beebe.
6138 2003-05-24 Jim Meyering <jim@meyering.net>
6140 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
6141 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
6142 accept the BSD format.
6144 2003-03-28 Joe Orton <jorton@redhat.com>
6146 * src/md5sum.c (bsd_split_3): New function.
6147 (split_3): Detect checksums from BSD 'md5' command and handle them
6150 * tests/md5sum/basic-1: New tests for --check exit status, and for
6151 BSD-style checksum files.
6153 2003-05-21 Jim Meyering <jim@meyering.net>
6155 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
6156 This sort of thing is why it'd be *Really Good* to factor
6157 out the common code used here and in tail.c.
6159 2003-05-14 Jim Meyering <jim@meyering.net>
6161 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
6163 * tests/du/slink: Skip this test if `.' is on an XFS file system.
6165 * tests/du/fd-leak: New file. Test for the bug in du that
6166 was fixed by the 2003-05-12 change to lib/ftw.c.
6167 * tests/du/Makefile.am (TESTS): Add fd-leak.
6169 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
6170 includes a translatable word, `and'.
6172 * src/dd.c (usage): Don't use `,' as the thousands separator
6173 in e.g. 1,000,000 and 1,048,576. Instead, do this:
6174 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
6175 * src/df.c (usage): Likewise.
6176 * src/du.c (usage): Likewise.
6177 * src/ls.c (usage): Likewise.
6179 * Makefile.maint (syntax-check): Add another check.
6181 2003-05-13 Paul Eggert <eggert@twinsun.com>
6183 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
6184 must output nothing. Problem reported by Josh Hyman.
6186 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
6187 (output_unique, output_first_repeated, output_later_repeated):
6188 New vars. All uses of "mode" changed to use these variables,
6189 which are not mutually exclusive as "mode" was.
6190 (writeline): New arg "match", used to control whether to
6191 obey output_first_repeated or output_later_repeated.
6192 All callers changed.
6193 (check_file, main): Adjust to above changes.
6195 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
6197 2003-05-14 Jim Meyering <jim@meyering.net>
6199 * tests/rm/rm3: Use tr's \n notation rather than \012.
6200 This package can afford to do that, since its tests are guaranteed use
6201 GNU tr, which has accepted the more modern notation for 10 years.
6202 * tests/rm/rm5: Likewise.
6203 * tests/cp/same-file: Likewise.
6204 * tests/stty/row-col-1: Likewise.
6205 * tests/stty/basic-1: Likewise.
6206 * tests/rm/deep-1: Likewise.
6207 * tests/mv/part-symlink: Likewise.
6208 * tests/mkdir/perm: Likewise.
6209 * tests/misc/nice: Likewise.
6211 2003-05-13 Jim Meyering <jim@meyering.net>
6213 * src/copy.c (struct F_triple) [name]: Remove const attribute.
6214 (triple_free): Don't apply cast to argument of free.
6215 (seen_file): Add cast here instead.
6217 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
6218 (src_to_dest_free): Don't apply cast to argument of free.
6220 * src/sort.c (zaptemp): Don't apply cast to argument of free.
6221 * src/pr.c (init_fps, init_store_cols): Likewise.
6222 * src/join.c (delseq, freeline): Likewise.
6223 * src/expr.c (OLD): Likewise.
6224 * src/sort.c (sort): Likewise.
6225 * src/head.c (elide_tail_lines_pipe): Likewise.
6227 * src/tail.c: Include "quote.h".
6228 Use quote in diagnostics. Change many error format strings
6229 from just `%s' to e.g., `error reading %s'.
6230 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
6231 Rewrite newline-counting loop to use memchr.
6233 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
6234 Now that assert is no longer used, don't include <assert.h>.
6236 2003-05-12 Jim Meyering <jim@meyering.net>
6238 * src/head.c: Include <assert.h>.
6239 (AUTHORS): Add my name.
6240 (elide_tail_lines_pipe): New function.
6242 2003-05-10 Jim Meyering <jim@meyering.net>
6244 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
6246 * src/readlink.c (main): Set program_name before first use.
6247 Remove that (redundant) first use.
6248 Don't exit successfully just because --verbose was specified.
6249 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
6250 parameter is 0, error does not exit.
6252 * src/uname.c (main): When failing due to too many arguments, also say
6253 that, rather than just "Try `uname --help' for more information.".
6254 * src/comm.c (main): Likewise, but for too few arguments.
6255 * src/logname.c: Include error.h.
6256 (main): Say why we're failing.
6258 * src/uniq.c (main): Don't segfault when argc < optind.
6259 * src/who.c (main): Handle argc < optind.
6260 * src/df.c (main): Likewise.
6261 * src/install.c (main): Likewise.
6262 * src/mv.c (main): Likewise.
6263 * src/pwd.c (main): Likewise.
6264 * src/tty.c (main): Likewise.
6265 * src/chroot.c (main): Likewise.
6266 * src/hostname.c: Likewise.
6267 * src/du.c (main): Likewise.
6268 * src/expand.c (main): Likewise.
6269 * src/env.c (main): Likewise.
6270 * src/unexpand.c (main): Likewise.
6271 * src/printenv.c (main): Likewise.
6272 * src/sync.c (main): Handle argc == 0.
6273 * src/expr.c (main): Likewise.
6274 * src/printf.c (main): Likewise.
6275 * src/basename.c (main): Likewise.
6276 * src/ln.c (main): Test for `missing argument' before computing n_files.
6277 * src/tail.c (main): Test for the case of no arguments before
6280 * src/kill.c (send_signals): Don't check command line arguments here.
6281 (main): Check them here instead. Handle argc < optind.
6283 * src/logname.c (main): Use error, rather than fprintf, for the sake
6286 * src/rm.c (main): Don't overrun array bound if argc is 0.
6288 2003-05-09 Jim Meyering <jim@meyering.net>
6290 * src/sort.c (main): Don't overrun array bound if argc is 0.
6291 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
6292 Reported by Wartan Hachaturow.
6294 2003-05-07 Jim Meyering <jim@meyering.net>
6296 Implement support so that `head --lines=-N' works on seekable files.
6297 * src/head.c (enum Copy_fd_status): Define.
6298 (COPY_FD_DIAGNOSE): New macro.
6299 (elide_tail_lines_seekable): New funtion.
6300 (elide_tail_lines_file): Call it here.
6302 2003-05-06 Jim Meyering <jim@meyering.net>
6304 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
6306 2003-05-04 Jim Meyering <jim@meyering.net>
6308 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
6309 caused the addition of thousands of small files to the tar archive.
6310 * tests/misc/head-elide-tail: New file. Add them here instead.
6311 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
6313 2003-05-04 Paul Eggert <eggert@twinsun.com>
6315 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
6316 (IF_READDIR_NEEDS_REWINDDIR): Remove.
6317 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
6318 which was a bit weird because it couldn't be emulated by a function.
6320 2003-05-03 Jim Meyering <jim@meyering.net>
6322 Extend head to accept --lines=-N (--bytes=-N) and to print all
6323 but the N lines (bytes) at the end of the file.
6324 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
6325 Use quote() in diagnostics, rather than literal `' marks.
6326 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
6328 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
6329 (head_file): Reorganize so as to call head from only one place.
6330 (main): Likewise, for head_file.
6331 Handle new, undocumented option, --presume-input-pipe.
6332 Handle negative line and byte counts.
6333 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
6335 * tests/du/8gb: Skip test if the file system of `.' doesn't support
6336 sparse files -- otherwise it'd create a file of size 8GB.
6338 2003-05-02 Jim Meyering <jim@meyering.net>
6340 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
6341 Instead explain about `-' and standard input.
6342 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
6343 Reported by Keith Thompson.
6344 * tests/fmt/basic: Add test for the above fix.
6346 * src/fmt.c: Include "quote.h".
6347 Use quote() in diagnostics, rather than literal `' marks.
6348 (main): Exit nonzero when unable to open an input file.
6349 * tests/fmt/basic: Add test for the above fix.
6351 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
6352 specifications like `-72x'.
6353 * tests/fmt/basic: Add test for the above fix.
6355 Work around nasty readdir bug on Darwin6.5.
6356 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
6357 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
6358 returned NULL and there has been at least one successful unlink or
6359 rmdir call since the opendir or previous rewinddir, then call
6360 rewinddir and reiterate the loop.
6362 Factor out common code.
6363 * src/remove.c (readdir_ignoring_dotdirs): New function.
6364 (is_empty_dir): Use it here.
6365 (remove_cwd_entries): Use it here.
6367 2003-05-01 Jim Meyering <jim@meyering.net>
6369 * tests/rm/r-3: Create 500 rather than just 300 files.
6370 There's a bug in Darwin6.5's readdir that shows up only with
6372 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
6376 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
6377 (dump_remainder): Move two declarations `down' into the scope
6378 where they are used.
6379 (xlseek): Return the resulting offset.
6380 (file_lines): Rename parameter, file_length, to end_pos.
6381 (pipe_lines): Don't coerce safe_read return value to `int'.
6382 Adapt tests accordingly.
6383 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
6385 Change type of `total_bytes' from `int' to `size_t',
6386 since the former wouldn't always be wide enough.
6387 Don't coerce safe_read return value to `int',
6388 and adapt tests accordingly.
6389 Now that testing for a read error no longer involves
6390 using `tmp', handle that case *after* freeing `tmp'.
6391 (start_bytes): Clean up.
6392 (tail_bytes): Now that `n_bytes' may be larger than
6393 OFF_T_MAX, test for that condition and, if it's true, don't
6394 use lseek optimizations.
6395 (parse_options): Don't fail just because N_UNITS is larger than
6396 the maximum size of a file -- tail may be applied to an input
6397 stream (e.g., a pipe) with more data than that.
6399 * Makefile.maint (syntax-check): Rename from alloc-check.
6400 Also check for SPACE-TAB sequences.
6401 Also check for malloc/calloc/realloc casts.
6403 2003-05-01 Jim Meyering <jim@meyering.net>
6405 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
6407 2003-04-28 Jim Meyering <jim@meyering.net>
6409 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
6410 make the now-more-picky tsort fail.
6412 2003-04-24 Jim Meyering <jim@meyering.net>
6414 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
6415 (main): Minor syntactic clean-up.
6417 * src/tsort.c (tsort): Fail if the input contains an odd number of
6418 tokens. Reported by junkio@cox.net.
6420 * tests/tsort/basic-1: Test for the above fix.
6422 2003-04-21 Jim Meyering <jim@meyering.net>
6424 * tests/misc/printf: Add tests for the printf fixes below.
6426 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
6428 2003-04-20 Paul Eggert <eggert@twinsun.com>
6430 Fix printf POSIX compatibility bug reported by Ben Harris in
6431 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
6432 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
6433 \0NNN in the %b operand.
6434 * src/printf.c (usage): Likewise.
6435 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
6436 is desired. All uses changed. Behave like Bash printf if %b
6437 operand uses \NNN where the initial N is not 0.
6439 2003-04-17 Jim Meyering <jim@meyering.net>
6441 * src/stty.c: Remove uses of PROTOTYPE macro.
6443 2003-04-15 Jim Meyering <jim@meyering.net>
6445 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
6446 each sequence of spaces before a TAB character.
6448 2003-04-13 Jim Meyering <jim@meyering.net>
6450 * src/remove.c (is_empty_dir): Don't closedir (NULL).
6452 2003-04-12 Jim Meyering <jim@meyering.net>
6454 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
6455 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
6456 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
6457 * src/nl.c (main): Fix those problems and remove literal quote marks
6458 (e.g., "`%s'") from format string; instead use "%s" in each format
6459 string and `quote (optarg)' as the corresponding argument.
6460 Also, diagnose all invalid command line options before failing.
6462 * src/nl.c (proc_text): Fix a bug that would make nl output extra
6463 newlines in some cases. Details here: http://bugs.debian.org/177256.
6464 This bug was introduced on 2001-11-10 for textutils-2.0.17.
6465 * tests/misc/nl: Add test for the above-fixed bug.
6467 * tests/misc/readlink: New file. Test the --canonicalize option.
6468 * tests/misc/Makefile.am (TESTS): Add readlink.
6470 2003-04-11 Jim Meyering <jim@meyering.net>
6473 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
6474 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
6475 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
6476 retain alignment) each sequence of spaces before a TAB character.
6478 * src/ls.c: Include <stdlib.h> unconditionally.
6480 * Makefile.maint (xalloc-check): Rename from header-check.
6482 * src/yes.c: Include error.h after system.h, not before.
6485 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
6486 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
6487 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
6488 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
6489 * src/tr.c: * src/unexpand.c, src/users.c:
6490 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
6491 return values and of xrealloc's first argument.
6492 Fix the former with this:
6493 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
6495 2003-04-10 Jim Meyering <jim@meyering.net>
6497 * src/stty.c (wrapf): Declare with format attribute.
6499 The S_MAGIC_... names shouldn't be maintained in two places (prior
6500 to this change, one would have to keep stat.c and fs.h in sync).
6501 This change makes it so those names and the corresponding
6502 hexadecimal constants all reside in stat.c. fs.h is now generated.
6503 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
6504 (BUILT_SOURCES): Add fs.h, now that it's generated.
6505 (EXTRA_DIST): Add extract-magic.
6506 * src/extract-magic: New script to extract fs.h definitions from stat.c.
6507 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
6508 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
6510 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
6511 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
6513 * man/unexpand.x: Add `SEE ALSO' reference to expand.
6514 * man/expand.x: Add `SEE ALSO' reference to unexpand.
6515 Suggestion from Dan Jacobson.
6517 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
6519 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
6520 * src/stat.c (human_fstype): Handle Linux's devpts.
6522 2003-04-09 Paul Eggert <eggert@twinsun.com>
6524 * src/split.c (line_bytes_split): Arg is of type size_t, since
6525 that's all that is supported for now.
6526 (main): Check for overflow in obsolescent line count option.
6528 2003-04-09 Jim Meyering <jim@meyering.net>
6530 * tests/misc/split-fail: Add a new test for the above fix.
6532 * src/split.c (bytes_split): Use size_t temporary (rather than
6533 uintmax_t original) in remaining computations. From Paul Eggert.
6535 Handle command line option arguments larger than 2^31.
6536 This allows e.g., splitting into files of size 2GB and larger,
6537 and running split --lines=N with N=2^31 or more.
6538 But for --line-bytes=N, the restriction that N <= SIZE_MAX
6539 remains (for now), due to the way it is implemented.
6541 * src/split.c: Include "inttostr.h".
6542 (bytes_split, lines_split, line_bytes_split, main):
6543 Use uintmax_t, not size_t, for file sizes.
6544 (main): Give a better diagnostic for option arguments == 0.
6545 Use umaxtostr to print file sizes.
6546 Reported by Luke Hassell.
6548 2003-04-08 Jim Meyering <jim@meyering.net>
6550 * src/rm.c (usage): Mention that --directory (-d) works only
6551 on some systems. Suggestion from Samuel Tardieu.
6553 * tests/basename/basic: Run $PERL to see if it is available,
6554 rather than testing its value.
6555 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
6556 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
6557 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
6558 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
6559 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
6560 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
6561 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
6562 * tests/sum/basic-1, tests/seq/basic: Likewise.
6564 * tests/misc/Makefile.am (TESTS): Add split-fail.
6565 * tests/misc/split-fail: New file.
6567 * src/split.c: Rename local variables: nchars -> n_bytes.
6568 (lines_split): Rename local, nlines -> n_lines.
6569 (main): Rename local variable: s/accum/n_units/.
6570 (main): Use STDIN_FILENO, not literal `0'.
6572 2003-04-07 Jim Meyering <jim@meyering.net>
6574 * src/stat.c: Add #include directives for Ultrix 4.4.
6575 Based on a suggested change from Bert Deknuydt.
6577 2003-04-06 Jim Meyering <jim@meyering.net>
6579 * Makefile.maint (makefile-check): New rule.
6580 (local-check): Add it.
6582 2003-04-05 Jim Meyering <jim@meyering.net>
6584 * Makefile.am (nearly all of them):
6585 Use $(VAR) rather than @VAR@, now that we can rely on automake to
6586 emit a definition for each substituted variable.
6587 * tests/Makefile.am.in: Likewise.
6589 * tests/rm/rm5: Add a comment explaining why this test fails when
6590 using Tru64's broken sed.
6591 * tests/rm/rm3: Likewise.
6593 Make `kill -t' output signal descriptions (not `?') on Tru64.
6594 * src/kill.c (sys_siglist): Also check for __sys_siglist.
6595 Patch by Tony Leneis.
6596 * configure.ac: Also check for declaration of __sys_siglist.
6597 Required for Tru64 4.0D, 4.0F, and 5.1.
6598 Reported by Tony Leneis.
6600 2003-04-04 Jim Meyering <jim@meyering.net>
6602 * src/Makefile.am (PERL): Remove unnecessary definition.
6604 Because of inappropriate (but POSIX-mandated) behavior of rename,
6605 `mv a b' would not remove `a' in some unusual cases. Work around
6606 this by unlinking `a' when necessary.
6608 * src/copy.c (same_file_ok): Add an output parameter.
6609 Set it in the offending case.
6610 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
6611 Reported by Ed Avis.
6612 * tests/mv/hard-4: New test for the above.
6613 * tests/mv/Makefile.am (TESTS): Add hard-4.
6615 Clean up rules for automatically generated sources:
6616 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
6617 Make each generated file be read-only.
6618 Add each file name to BUILT_SOURCES separately.
6619 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
6621 Put LOCALEDIR macro definition in new file: localedir.h.
6622 * src/Makefile.am (DEFS): Remove definition.
6623 (localedir.h): New rule.
6624 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
6625 * src/system.h: Include "localedir.h".
6627 2003-04-02 Jim Meyering <jim@meyering.net>
6631 * tests/misc/Makefile.am (TESTS): Add false.
6633 * Makefile.maint (TMPDIR): Make sure it's defined.
6634 (my-distcheck): Build in $(TMPDIR), not `.'.
6636 * src/Makefile.am (false.c): Change all occurrences of
6637 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
6638 unsuccessfully also with --help. Reported by Paul Jarc,
6639 * tests/misc/false: New test for the above.
6641 2003-03-30 Jim Meyering <jim@meyering.net>
6643 * NEWS: Note the location of older NEWS files.
6645 * src/remove.c (is_empty_dir): Don't let a failing closedir
6646 clobber errno. Spotted by Arnold Robbins.
6648 * src/env.c: Fix typo in comment. From Arnold Robbins.
6650 2003-03-29 Jim Meyering <jim@meyering.net>
6654 * README: Note to expect build problems for stat.c on Ultrix 4.3.
6655 Note that there are some harmless test failures when running
6656 `make check' as root on some systems.
6658 2003-03-28 Jim Meyering <jim@meyering.net>
6660 * tests/stty/row-col-1: Skip this test if stty can't get window size.
6661 This happens when connecting to sparc-solaris5.7 via ssh from within
6662 emacs. Reported by Karl Berry.
6664 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
6665 Otherwise, on systems (DJGPP) that emulate pipes using files,
6666 this test would never complete, waiting for `yes' to terminate.
6667 * tests/du/slink: As above, use seq, not `yes' to generate link target.
6668 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
6669 Reported by Rich Dawe.
6671 2003-03-27 Jim Meyering <jim@meyering.net>
6673 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
6674 from `written by...' comment, at his request.
6676 2003-03-24 Paul Eggert <eggert@twinsun.com>
6678 Fix buffer overrun problem reported by TAKAI Kousuke, along
6679 with some other POSIX incompatibilities.
6681 * src/printf.c (print_esc): Do not treat \x specially if
6682 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
6683 in backslash. Treat incomplete escape sequences as strings
6684 of characters, as POSIX requires.
6685 (print_formatted): Allow multiple flags. Avoid buffer overrun
6686 if the format is incomplete.
6688 2003-03-24 Jim Meyering <jim@meyering.net>
6690 * tests/misc/printf: Add tests for the above fixes and changes.
6692 2003-03-26 Jim Meyering <jim@meyering.net>
6694 * src/copy.h (struct cp_options): Add a comment.
6696 2003-03-23 Jim Meyering <jim@meyering.net>
6698 * README: Describe problem with 64-bit mode on HPUX 11.x,
6699 with patch for /usr/include/inttypes.h.
6700 * TODO: Plan to add an autoconf test to work around the bug.
6702 2003-03-22 Jim Meyering <jim@meyering.net>
6704 * src/stat.c: Don't include <sys/sysmacros.h>.
6705 That is already done via system.h. Otherwise, the multiple
6706 inclusion would evoke redefinition warnings from Cray's /bin/cc,
6707 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
6708 (human_fstype): Factor some directives `up', out of this function.
6709 Cast away `const' to avoid error from Cray's /bin/cc.
6711 2003-03-20 Jim Meyering <jim@meyering.net>
6713 * announce-gen (print_changelog_deltas): Ensure that a newline
6714 precedes each row of `*'s.
6716 2003-03-20 Jim Meyering <jim@meyering.net>
6720 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
6721 format flag characters.
6722 Do not require that a field width be specified.
6723 Do not fail when given a field width of `0'.
6724 Reported by Dan Jacobson.
6725 * tests/seq/basic: Add new tests for the above-fixed bug.
6727 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
6728 (install-root): Likewise.
6729 (install-exec-local): Likewise.
6730 Based on a patch from Richard Dawe.
6732 2003-03-19 Jim Meyering <jim@meyering.net>
6734 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
6735 because the DJGPP 2.03 port of 'ln -s' doesn't work.
6736 Include $(EXEEXT) in program names.
6737 Since $(LN_S) may degenerate to `cp -p', be careful
6738 to invoke it from the destination directory.
6739 Mostly from Richard Dawe.
6740 * configure.ac: Use AC_PROG_LN_S.
6742 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
6743 CDPATH shell variable set could cause this test to fail.
6744 Reported by Karl Berry.
6746 2003-03-18 Jim Meyering <jim@meyering.net>
6748 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
6749 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
6750 AIX 5.1's xlc could not compile the former.
6751 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
6753 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
6755 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
6756 program names, since automake only adds $(EXEEXT) to programs
6759 2003-03-16 Jim Meyering <jim@meyering.net>
6761 * src/remove.c (rm): Put two local variables in static storage,
6762 so they can't be clobbered by the potential longjmp.
6764 2003-03-15 Jim Meyering <jim@meyering.net>
6766 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
6767 so that a version number with a two-digit component can still count
6768 as an alpha release. Reported by Richard A Downing.
6769 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
6771 2003-03-14 Jim Meyering <jim@meyering.net>
6773 * src/ansi2knr.c: Remove no-longer-used file.
6774 * src/ansi2knr.1: Likewise.
6776 * Makefile.maint (prev_version_file): Don't use ?= for this particular
6777 assignment, since it causes trouble with old versions of GNU make
6778 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
6779 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
6780 Patch from Alexandre Duret-Lutz.
6782 * Use patched automake-1.7.3. Regenerate Makefile.in files in
6783 subdirectories so that each includes a definition of ACLOCAL_M4.
6785 * announce-gen (main): Label the compressed source URLs.
6789 * tests/du/slink: Relax the test for the `local'ness of a file system,
6790 so that now it works also for tmpfs.
6792 * tests/du/hard-link: Transform output from first du, so that this
6793 test doesn't fail on file systems like tmpfs that order directory
6794 entries differently.
6796 2003-03-13 Jim Meyering <jim@meyering.net>
6798 * tests/du/8gb: Work around what appears to be an NFS failure that
6799 would make this test fail on some systems.
6801 2003-03-11 Jim Meyering <jim@meyering.net>
6803 * tests/du/basic: Make the test file exactly 4k bytes long.
6805 * src/split.c (longopts): Don't hard-code `2' here.
6806 Instead, just specify `&verbose', and ...
6807 (main): ... remove the `case 2:' block for --verbose.
6809 * tests/du/basic: Make the test file larger than 64 bytes, so that
6810 we don't immediately disqualify file systems (e.g., NetApp) on which
6811 smaller files take up zero disk blocks. Reported by Vin Shelton.
6813 2003-03-10 Jim Meyering <jim@meyering.net>
6815 Don't segfault for a negative field width or precision in format string.
6816 Note that this is just a stopgap fix. The longer term solution may
6817 involve adapting bash's builtins/printf.def.
6819 * src/printf.c: (UNSPECIFIED): Define.
6820 (print_direc): Use the special value, UNSPECIFIED, to indicate
6821 that field_width or precision has not been specified.
6822 (print_formatted): Fail if field_width or precision is the
6823 special value, UNSPECIFIED.
6824 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
6826 * src/sys2.h (INT_MIN): Define, if necessary.
6827 * tests/misc/printf: Add a test for the above-fixed bug.
6829 2003-03-09 Jim Meyering <jim@meyering.net>
6831 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
6832 changing its sign. This avoids a warning from gcc on 64-bit systems.
6833 Reported by Bob Proulx.
6834 (pop_dir): Reverse order of sign change and cast, to be consistent
6837 2003-03-08 Jim Meyering <jim@meyering.net>
6839 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
6840 shell variable, but only in the environment. With /bin/sh->bash, the
6841 shell variable is set to `y', and that would cause a spurious warning.
6842 Reported by Bob Proulx.
6844 * tests/Makefile.am (check-root): Remove touch/fifo.
6845 It doesn't appear to have to be run as root.
6847 * tests/rm/fail-2eperm: Rather than simply using the first non-root
6848 user name, make sure that the selected user name has a usable shell.
6849 Reported by Paul Jarc.
6851 Before, when using shred on a device, one had to specify --exact,
6852 or be careful to choose a size that would not be rounded up and
6853 exceed the maximum value; that could result in a failure of
6855 * src/shred.c (do_wipefd): --exact is now the default for non-regular
6856 files. Suggestion from Ben Elliston.
6859 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
6860 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
6861 Patch by Bob Proulx.
6863 * src/Makefile.am (check-misc): Check for use of `defined' in
6865 Change to $(srcdir) before running grep.
6867 * src/sleep.c: Remove now-unused #include and #define directives.
6869 * src/du.c (process_file): If a file's size is not being counted
6870 e.g., because it's a hard link to a file we've already counted,
6871 then don't print a line for it.
6873 * tests/du/hard-link: New test for the above-fixed bug.
6874 * tests/du/Makefile.am (TESTS): Add hard-link.
6877 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
6878 and make the two-array approach work.
6880 * tests/du/basic: Correct/add tests for the above fix.
6881 Set LC_ALL, etc., now that we use sort.
6882 Check the block/size of a small file, too.
6883 Correct expected results for simple dir1/dir2/file case.
6884 Add another test of du -S.
6886 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
6888 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
6889 middle-end/9986). As one of GCC's optimizations, it transforms a
6890 fputs_unlocked call to a fputc_unlocked call when the string is
6891 one character long. However, hpux doesn't have fputc_unlocked.
6893 * expr.c (usage): Use putchar, not fputs, to output a single character.
6894 * ls.c (dired_dump_obstack): Likewise.
6895 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
6896 * stat.c (print_it): Likewise.
6898 2003-03-07 Jim Meyering <jim@meyering.net>
6900 * src/cp.c: Remove everything associated with mmap-stack.c.
6901 This reverts the two changes of 2003-02-21.
6902 * src/du.c: Remove everything associated with mmap-stack.c.
6903 This reverts the change of 2003-02-19.
6905 2003-03-06 Jim Meyering <jim@meyering.net>
6907 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
6908 CDPATH shell variable set could cause this test to fail.
6909 Reported by Karl Berry.
6911 2003-03-05 Jim Meyering <jim@meyering.net>
6915 * src/printf.c (print_esc): Remove pointless comparison of unsigned
6916 integer with zero, to avoid a warning from Intel's ecc.
6917 Reported by Nelson Beebe.
6919 * src/du.c (process_file): Sizes must all be of type uintmax_t.
6920 Otherwise, for files or totals that are too big, numbers would
6921 be truncated. Patch mostly by Michael Stone.
6922 Reported by Ingo Saitz as Debian bug #183210.
6924 * tests/du/8gb: New test for the above-fixed bug.
6925 * tests/du/Makefile.am (TESTS): Add 8gb.
6927 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
6928 rather than UTILS_OPEN_MAX - 10.
6930 2003-03-04 Jim Meyering <jim@meyering.net>
6932 * README: Refer new feature discussion to bug-coreutils@gnu.org,
6933 rather than bug-gnu-utils, now that the former is better known.
6934 Suggestion from Göran Uddeborg.
6936 * src/stat.c (usage): Capitalize consistently.
6937 Reported by Göran Uddeborg.
6939 * Makefile.maint (rel-files): Include $(signatures), so that
6940 those files are also copied into $(release_archive_dir).
6942 * src/df.c (find_mount_point): Call error here, now that restore_cwd
6944 * src/remove.c (AD_pop_and_chdir): Likewise.
6946 * tests/Makefile.am (check-root): Add fail-2eperm.
6948 2003-03-03 Jim Meyering <jim@meyering.net>
6950 * src/remove.c (remove_cwd_entries): Include the full filename of
6951 the offending file, not just the basename.
6953 * tests/misc/tty-eof: Set $ME properly.
6955 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
6956 Remove now-unused variables.
6957 (tag-prev-version, prev-cvs-tag): Likewise.
6959 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
6960 accurate diagnostic when failing to remove a file owned by some other
6961 user. Reported by Ivo Timmermans via Michael Stone.
6962 This fixes Debian bug# 178471.
6964 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
6965 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
6966 Based on a report from Ivo Timmermans.
6968 2003-03-02 Jim Meyering <jim@meyering.net>
6970 * src/copy.c (copy_internal) [un_backup]: When recovering from a
6971 failure to create a hard link, do not remove the entry associating
6972 the source dev/ino with the destination file name.
6973 * tests/mv/Makefile.am (TESTS): Add hard-3.
6974 * tests/mv/hard-3: New test, for the above-fixed bug.
6975 Inspired by a report from Iida Yosiaki.
6977 2003-03-01 Jim Meyering <jim@meyering.net>
6979 * src/df.c (print_header): Don't embed spaces in a separate `Type'
6980 header string. Instead, put `Filesystem' and `Type' headers in the
6981 same string, so translators can use horizontal space as needed.
6982 Reported by Jean Charles Delepine.
6984 2003-02-28 Jim Meyering <jim@meyering.net>
6986 * src/copy.c (copy_internal): When link fails because of an
6987 existing destination file, unlink that file and try again.
6988 Reported by Iida Yosiaki.
6990 * tests/mv/Makefile.am (TESTS): Add hard-2.
6991 * tests/mv/hard-2: New test for the above-fixed bug.
6992 Based on a test case from Iida Yosiaki.
6994 2003-02-26 Jim Meyering <jim@meyering.net>
6996 * tests/du/basic: Don't test du's -b option here. Directory byte
6997 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
6998 and IBM AIX 4.2. Reported by Nelson Beebe.
7000 2003-02-25 Jim Meyering <jim@meyering.net>
7002 * Makefile.maint (announcement): Now that ChangeLog entries
7003 are output by announce-gen, don't do it here.
7004 * announce-gen (print_changelog_deltas): New function.
7007 2003-02-22 Jim Meyering <jim@meyering.net>
7009 * announce-gen: New option: --release-type=TYPE
7010 * Makefile.maint (beta, major): New targets. Remove `release'.
7011 Put them all together on a line.
7012 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
7013 invocation of `announcement'.
7014 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
7016 * announce-gen: New option: --news=NEWS_FILE.
7017 Extract NEWS entries here, not via rules in Makefile.maint.
7018 * Makefile.maint (announcement): Now that NEWS entries are
7019 extracted by announce-gen, don't do it here.
7020 (news-r1, news-r2): Remove now-unused definitions.
7022 2003-02-21 Jim Meyering <jim@meyering.net>
7026 Merge in changes from autoconf's version of this file.
7027 * Makefile.maint (www-gnu): Define.
7028 (standards.texi-url_prefix): Use $(www-gnu).
7029 (make-stds.texi-url_prefix): Likewise.
7031 * src/cp.c: Include "mmap-stack.h".
7032 (main): Invoke `run' through a macro that (when possible) runs it
7033 with a large, mmap'd stack.
7035 * src/cp.c (run): New function, preparing for the above.
7036 Exit from this function, not from main
7039 * src/du.c: New option: --apparent-size.
7040 (enum) [APPARENT_SIZE_OPTION]: New member.
7041 (long_options): Add it.
7042 (usage): Describe it.
7044 ['b']: Set apparent_size.
7045 David Eisner reported that the behavior of --bytes had changed.
7046 Paul Eggert proposed the use of a new option, --apparent-size.
7048 * src/du.c (apparent_size): New global.
7049 (print_only_size): Reflect the fact that we're printing byte counts,
7050 not ST_NBLOCKSIZE-byte-block counts.
7051 (print_size): Call print_only_size rather than duplicating its code.
7052 (process_file): Accumulate byte counts, rather than block counts.
7054 * src/du.c (process_file): Always reset size_to_propagate_to_parent
7055 for --separate-dirs (-S).
7057 2003-02-20 Jim Meyering <jim@meyering.net>
7059 * Use automake-1.7.3. Regenerate dependent files.
7061 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
7062 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
7063 (usage) [%B]: Describe it.
7066 * src/du.c (process_file): Reorganize the code to use only
7067 one `sum' array, and change how -S works back to the way it was
7068 before 2003-01-31. Patch by Bruno Haible.
7070 * tests/du/basic: New test.
7071 * tests/du/Makefile.am (TESTS): Add basic.
7073 * tests/envvar-check: Add checks for the following:
7074 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
7076 * tests/Makefile.am: Rename phony target envvar-check to evar-check
7077 so as not to conflict with the distributed file by the same name.
7079 * src/du.c (process_file): Set info->skip before any possible return.
7081 Report correct usage for directories, not 0.
7082 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
7083 _before_ recording the dev/ino of a directory.
7084 Reported by Bruno Haible.
7086 Now, df always displays the device file name corresponding to the
7087 listed mount point under `Filesystem'. Before, for an unmounted
7088 block- or character-special file argument, it would display the
7089 command-line argument instead.
7090 * src/df.c (show_disk): Return a value indicating whether
7091 there was a match. Don't try to find a mount point here.
7092 (show_entry): If show_disk doesn't find a match, call show_point.
7094 2003-02-19 Jim Meyering <jim@meyering.net>
7096 * src/du.c: Include "mmap-stack.h".
7097 (du_files): Add prototype with ATTRIBUTE_NORETURN.
7098 Exit from this function, not from...
7100 Instead, if possible, invoke du_files through a macro that
7101 runs it with a large, mmap'd stack.
7103 * src/join.c (usage): Change wording in --help output:
7104 use FILENUM instead of `SIDE' and say what FILENUM means.
7105 Reported by Bernhard Gabler.
7107 * src/df.c (print_header): Rather than using a hard-coded literal
7108 string of spaces matching the length of the English `...Type' header,
7109 output the right number of spaces to match the selected translation.
7110 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
7112 * src/split.c (bytes_split): Remove unnecessary `else' after break.
7113 (lines_split): Likewise. and correct misleading indentation.
7115 * src/split.c: Include "full-read.h".
7116 (bytes_split, lines_split, line_bytes_split): Use full_read,
7117 not safe_read. The way split was using the latter, a short read
7118 could cause split to terminate before EOF.
7120 * tests/misc/tty-eof: Test all programs that can read stdin,
7121 requiring no arguments and that write to standard output.
7123 * tests/misc/tty-eof: New file. Renamed from ...
7124 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
7125 * tests/misc/Makefile.am (TESTS): Reflect renaming.
7127 2003-02-18 Jim Meyering <jim@meyering.net>
7129 cksum would perform an extra read after encountering EOF
7130 * src/cksum.c (cksum): Exit the loop upon EOF, too.
7131 Patch by Michael Bacarella.
7133 Test for the bug fixed today in cksum, md5sum, and sha1sum.
7134 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
7135 cat, cksum, md5sum, and sha1sum all in the same loop.
7137 2003-02-14 Jim Meyering <jim@meyering.net>
7139 * src/remove.c: Include "euidaccess.h".
7140 Remove declaration of euidaccess.
7142 2003-02-12 Jim Meyering <jim@meyering.net>
7144 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
7145 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
7147 2003-02-10 Jim Meyering <jim@meyering.net>
7149 * src/test.c: Don't include group-member.h.
7150 Include euidaccess.h.
7151 (eaccess): Rewrite function to set the real uid and gid temporarily
7152 to the effective uid and gid, then invoke 'access', and then set the
7153 real uid and gid back. On systems that lack setreuid or setregid,
7154 fall back on the kludges in euidaccess. Before, it would not work
7155 for e.g., files with ACLs, files that were marked immutable,
7156 or on file systems mounted read-only. Nelson Beebe raised the issue.
7157 Paul Eggert suggested the new implementation.
7159 2003-02-09 Jim Meyering <jim@meyering.net>
7161 * src/test.c (test_stat): Remove function. It's job is done (only
7162 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
7164 2003-02-08 Jim Meyering <jim@meyering.net>
7168 * tests/mv/part-symlink: Don't assume that the file owner username
7169 length is less than 9 in ls output: instead, omit that field
7170 altogether. Reported by, and suggested fix from, Ferdinand.
7172 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
7173 * tests/du/Makefile.am (TESTS): Add restore-wd.
7175 * src/rm.c: Correct now-invalid comment about cycle-detection.
7177 2003-02-06 Jim Meyering <jim@meyering.net>
7179 * NEWS: Add entries from old/*/NEWS
7180 from fileutils-4.1 through 4.1.11 and
7181 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
7185 * src/du.c (process_file): Don't return early for excluded files
7186 or for files whose dev/inode we've already seen.
7188 2003-02-05 Jim Meyering <jim@meyering.net>
7190 * tests/du/exclude: New file.
7191 * tests/du/Makefile.am (TESTS): Add exclude.
7193 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
7195 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
7196 Fix memory allocation arithmetic.
7198 2003-02-04 Jim Meyering <jim@meyering.net>
7200 `df /dev/block-or-char-device-file--not-mounted' now reports
7201 the name of the file system on which the file resides, usually `/'.
7202 Before, it would leave the `Mounted on' field blank.
7203 * src/df.c (show_disk): Move function to precede find_mount_point.
7204 (show_disk): Add parameter: STATP.
7205 If we don't find a matching device name, then resort to calling
7206 find_mount_point. Reported by Bob Proulx.
7208 2003-02-03 Andreas Schwab <schwab@suse.de>
7210 * tests/rm/cycle: Require non-root.
7211 * tests/rm/isatty: Likewise.
7213 2003-02-02 Jim Meyering <jim@meyering.net>
7217 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
7219 Ensure that there are no offending uses of `:'.
7220 * Makefile.maint (makefile_path_separator_check): New rule.
7221 (local-check): Add it to the list.
7223 2003-02-01 Jim Meyering <jim@meyering.net>
7225 * src/du.c (MAX_N_DESCRIPTORS): Define.
7227 * src/stat.c (G_fail): New global.
7228 (human_time): Diagnose failed localtime, not failed nstrftime.
7229 (main): Fail if G_fail is set.
7231 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
7233 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
7234 hard-coding the path-separator. Also double-quote the new PATH,
7235 to avoid problems when the path-separator is a semi-colon or when
7236 `pwd` contains e.g. a space.
7237 * tests/chgrp/Makefile.am: Likewise.
7238 * tests/chmod/Makefile.am: Likewise.
7239 * tests/chown/Makefile.am: Likewise.
7240 * tests/cp/Makefile.am: Likewise.
7241 * tests/dd/Makefile.am: Likewise.
7242 * tests/dircolors/Makefile.am: Likewise.
7243 * tests/du/Makefile.am: Likewise.
7244 * tests/expr/Makefile.am: Likewise.
7245 * tests/factor/Makefile.am: Likewise.
7246 * tests/fmt/Makefile.am: Likewise.
7247 * tests/install/Makefile.am: Likewise.
7248 * tests/ln/Makefile.am: Likewise.
7249 * tests/ls/Makefile.am: Likewise.
7250 * tests/ls-2/Makefile.am: Likewise.
7251 * tests/md5sum/Makefile.am: Likewise.
7252 * tests/misc/Makefile.am: Likewise.
7253 * tests/mkdir/Makefile.am: Likewise.
7254 * tests/mv/Makefile.am: Likewise.
7255 * tests/od/Makefile.am: Likewise.
7256 * tests/rm/Makefile.am: Likewise.
7257 * tests/rmdir/Makefile.am: Likewise.
7258 * tests/seq/Makefile.am: Likewise.
7259 * tests/sha1sum/Makefile.am: Likewise.
7260 * tests/shred/Makefile.am: Likewise.
7261 * tests/stty/Makefile.am: Likewise.
7262 * tests/sum/Makefile.am: Likewise.
7263 * tests/tail-2/Makefile.am: Likewise.
7264 * tests/touch/Makefile.am: Likewise.
7265 * tests/tsort/Makefile.am: Likewise.
7266 * tests/unexpand/Makefile.am: Likewise.
7268 2003-01-31 Jim Meyering <jim@meyering.net>
7270 * src/stat.c: Include "file-type.h"
7271 (print_human_type): Remove function.
7272 (human_access): Rename from print_human_access. Return a string.
7273 (human_time): Rename from print_human_time. Return a string.
7274 (print_stat): Arrange so that field width and an alignment specifier
7275 are honored for the %A, %F, %x, %y, and %z formats.
7276 [%F]: Use file_type; this gives slightly different file type strings,
7277 e.g., `directory' instead of `Directory' and `regular file' or
7278 `regular empty file' instead of `Regular file'.
7279 Prompted by a report from Richard Dawe that the uses of
7280 S_IFSOCK and S_IFIFO in print_human_time were not portable
7281 to systems using e.g., DJGPP.
7283 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
7285 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
7286 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
7288 2003-01-31 Jim Meyering <jim@meyering.net>
7290 * src/du.c (main): Upon processing an invalid option or an invalid
7291 --exclude-from or --max-depth option argument, don't exit right away,
7292 in case there are others. Rather record the failure and exit after
7293 processing other options.
7295 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
7296 tar archive easier to reproduce.
7298 Rewrite to perform directory traversal using nftw.
7300 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
7301 (AUTHORS): Add self.
7302 (opt_one_file_system): Move global into `main'.
7303 (path, xstat, exit_status): Remove declarations.
7304 (arg_length, suffix_length): New globals.
7305 (G_fail): New global, sort of like the old `exit_status'.
7306 (IS_FTW_DIR_TYPE): Define.
7307 (print_only_size): New function.
7308 (process_file): New function.
7309 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
7310 (str_trunc, pop_dir, count_entry): Likewise.
7311 (du_files): Rewrite to use nftw.
7313 2003-01-30 Jim Meyering <jim@meyering.net>
7315 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
7316 symlink-to-directory with -L, even without the trailing slash.
7318 2003-01-27 Jim Meyering <jim@meyering.net>
7320 * src/Makefile.am (check-misc): Check for st_blocks, too.
7322 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
7323 Reported by Richard Dawe.
7325 2003-01-27 Andreas Schwab <schwab@suse.de>
7327 * src/ls.c (quote_name): Add fourth parameter, width, into which to
7328 store the screen columns, and return the number of bytes instead.
7329 (print_dir): Pass NULL as fourth parameter of quote_name.
7330 (print_name_with_quoting): Likewise.
7331 (length_of_file_name_and_frills): Get the width from the fourth
7332 parameter of quote_name instead of return value.
7334 2003-01-27 Jim Meyering <jim@meyering.net>
7336 * src/ls.c (decode_switches): If `dired' is set without
7337 `format == long_format', then silently reset dired. This doesn't
7338 change the behavior of ls (all prior uses of dired were protected
7339 by `&& format == long_format'), and lets us...
7340 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
7341 (PUSH_CURRENT_DIRED_POS): Likewise.
7344 2003-01-22 Jim Meyering <jim@meyering.net>
7346 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
7347 * tests/du/Makefile.am (TESTS): Add no-x.
7349 2003-01-21 Jim Meyering <jim@meyering.net>
7351 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
7352 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
7353 it may still be a directory -- or not (e.g., with FreeBSD on an
7354 NFS-mounted file system), so resort to calling lstat to find out.
7355 Based on a patch by Michael van Elst.
7357 * tests/cp/same-file: Don't assume that the file owner username
7358 length is less than 9 in ls output: instead, omit that field
7359 altogether. Reported by, and suggested fix from, Ferdinand.
7361 2003-01-20 Jim Meyering <jim@meyering.net>
7363 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
7364 large format widths no longer cause strftime to infloop.
7366 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
7368 2003-01-19 Jim Meyering <jim@meyering.net>
7370 * src/readlink.c: Include "canonicalize.h".
7372 2003-01-18 Jim Meyering <jim@meyering.net>
7374 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
7376 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
7377 (long_options): Add option --dereference-command-line-symlink-to-dir.
7378 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
7379 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
7380 -d, -F, -l options is specified.
7381 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
7382 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
7383 Change --dereference-command-line (-H) to dereference *all*
7384 command line arguments, including broken symlinks.
7386 2003-01-15 Paul Eggert <eggert@twinsun.com>
7388 Change ls -H back to the way it was yesterday, since this is
7389 compatible with FreeBSD and the POSIX spec is confusing
7390 and somewhat contradictory.
7392 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
7393 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
7394 (long_options): Change the long option name back.
7395 (usage): Change the usage back.
7396 (gobble_file): When -H is specified, dereference a top-level
7397 arg even if it points to a non-directory.
7399 2003-01-15 Jim Meyering <jim@meyering.net>
7401 * src/ls.c (gobble_file): Fall back on using lstat when required:
7402 when --dereference (-L) is not specified, and
7403 - when operating on a dangling symlink
7404 - when operating on command-line-symlink-to-directories
7405 This fixes numerous problems. Here are examples:
7406 - `ls dangling-symlink' would fail with `no such file...'
7407 Now it prints `dangling-symlink'.
7408 - `ls -i symlink' would mistakenly print the inode of the referent.
7409 Now it prints the inode of the symlink. Likewise for --size (-s).
7410 Based on a patch from Michael Stone.
7411 Reported by Deepak Goel as Debian bug #173793.
7413 Rename ls's --dereference-command-line (-H)
7414 option to --dereference-command-line-symlink-to-dir.
7415 * src/ls.c [enum Dereference_symlink]
7416 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
7417 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
7418 (long_options): Rename the long option.
7419 (usage): Say that --dereference-... changes how ls treats
7420 only symlinks to directories specified on the command line.
7422 2003-01-14 Jim Meyering <jim@meyering.net>
7424 * tests/ls/dangle: New file/test, for the above fix.
7425 * tests/ls/inode: Another new file/test, for the above fix.
7426 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
7428 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
7429 so that ls --color would no longer highlight the names of files with
7430 the execute bit set when not specified on the command line.
7431 Patch by Michael Stone. Reported by Stephen Depooter as
7434 * tests/ls-2/tests (color-exe): New test, for the above fix.
7436 2003-01-13 Jim Meyering <jim@meyering.net>
7438 * tests/shred/exact: Also test for just fixed bug with --zero.
7440 * src/shred.c (long_opts): --zero does not require an argument.
7441 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
7443 2003-01-12 Jim Meyering <jim@meyering.net>
7445 * Makefile.maint (cvs-update): Skip any file with local modifications.
7447 * src/unexpand.c (usage): Document --first-only and mention that
7448 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
7450 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
7452 * src/df.c: Include "canonicalize.h".
7453 Use canonicalize_file_name unconditionally.
7455 2003-01-09 Jim Meyering <jim@meyering.net>
7457 * README: Add readlink.
7459 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
7461 * src/df.c: Include "xgetcwd.h".
7462 * src/pwd.c: Likewise.
7464 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
7466 * src/shred.c: Remove declaration of xstrdup.
7467 We already get it via xalloc.h which is included via system.h.
7469 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
7471 New program: readlink.
7473 * src/Makefile.am (bin_PROGRAMS): Add readlink.
7474 * src/readlink.c: New file.
7476 * man/readlink.x: New file.
7477 * man/Makefile.am (dist_man_MANS): Add readlink.1.
7478 (readlink.1): New rule.
7480 2003-01-09 Jim Meyering <jim@meyering.net>
7482 When selecting ranges of byte offsets (as opposed to ranges of fields)
7483 and when --output-delimiter=STRING is specified, output STRING between
7484 ranges of selected bytes.
7485 * src/cut.c (RANGE_START_SENTINEL): Define.
7486 (output_delimiter_specified): New global.
7487 (print_kth): Add parameter. Adjust all callers.
7488 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
7489 (cut_bytes): When requested, output STRING between ranges of
7491 (main): Make a diagnostic a little clearer.
7492 Based on a patch from Jan Nieuwenhuizen.
7494 * tests/cut/Test.pm: New tests for the above.
7496 * src/cut.c (set_fields): Make code agree with comment:
7497 Don't merge abutting ranges like 4- and 2-3. This makes no
7498 difference currently, but is required to support an upcoming change.
7500 2003-01-07 Jim Meyering <jim@meyering.net>
7502 * src/cut.c (set_fields): Fix typo in comment.
7504 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
7505 * tests/touch/Makefile.am (TESTS): Add not-owner.
7506 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
7507 Now, this tests only the nonexistent-directory diagnostic.
7508 Suggestion from Michael Stone.
7510 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
7512 2003-01-04 Jim Meyering <jim@meyering.net>
7514 * src/copy.h: Remove use of PARAMS.
7515 * src/remove.h: Likewise.
7516 * src/chown-core.h: Likewise.
7518 rm could be tricked into mistakenly reporting a cycle.
7519 * src/remove.c: [cycle_check_state]: New global.
7520 (remove_cwd_entries): Adapt to new semantics of cycle_check.
7521 (rm): Call cycle_check_init and cycle_check_free for each file.
7522 * tests/rm/cycle (rm): New test, for the above fix.
7523 * tests/rm/Makefile.am (TESTS): Add cycle.
7525 When rm detects a cycle, don't abort the entire command,
7526 but rather just the affected command line argument.
7527 * src/remove.c: Include <setjmp.h>
7528 (struct dirstack_state) [current_arg_jumpbuf]: New member.
7529 (remove_cwd_entries): Call longjmp if we detect a cycle.
7530 (rm): Call setjmp here.
7532 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
7533 Instead, include cycle-check.h and use it.
7535 * src/remove.h (struct dev_ino): Remove declaration.
7537 * src/remove.c (remove_cwd_entries): Fix typos in comment.
7539 Don't include trailing /. in diagnostics about directories.
7540 * src/remove.c (full_filename_): When FILENAME is just `.'
7541 and there is a nonempty directory-name part, don't append `/.'.
7542 * tests/rm/unread2: Remove trailing /. from diagnostic.
7543 * tests/rm/rm2: Likewise.
7545 * src/remove.c (struct dirstack_state): Define.
7546 To be used in place of these file-scoped globals ...
7547 (dir_stack, len_stack, Active_dir): Remove globals.
7548 (ds_init, ds_free): New functions.
7549 (full_filename): Define.
7550 (full_filename_): Rename from full_filename.
7552 Begin to make AD_* functions more generic.
7553 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
7554 (AD_push): Likewise.
7555 (AD_INIT_OTHER_MEMBERS): Define.
7556 (remove_dir): Define the `status' member manually after each
7557 call to AD_push or AD_push_initial.
7559 * src/Makefile.am (check-misc): New rule, to ensure that no more
7560 S_IS* macro definitions sneak into the code.
7561 (check): Depend on check-misc.
7563 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
7564 * src/du.c (count_entry) [S_ISLNK]: Don't define.
7565 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
7567 2003-01-03 Jim Meyering <jim@meyering.net>
7569 * src/true.c: Add copyright.
7570 (AUTHORS): I suppose I've written it.
7572 * src/Makefile.am (false.c): Make the generated file be read-only.
7574 2003-01-04 Jim Meyering <jim@meyering.net>
7576 * src/ls.c: Include "dev-ino.h".
7577 [struct dev_ino]: Remove declaration.
7579 2003-01-02 Jim Meyering <jim@meyering.net>
7581 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
7582 from mv: s/missing file arguments/missing file argument/.
7583 With --target-directory=DIR, cp and mv work with a single file argument.
7584 Reported by Karl Berry.
7586 * tests/rm/isatty: Enable this test.
7588 2002-12-31 Jim Meyering <jim@meyering.net>
7590 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
7591 (AD_push): Likewise.
7592 (AD_INIT_OTHER_MEMBERS): Define.
7593 (remove_dir): Define the `status' member manually after each
7594 call to AD_push or AD_push_initial.
7596 * src/ls.c [struct dev_ino]: Remove definition.
7597 Include "dev-ino.h" instead.
7599 2002-12-28 Jim Meyering <jim@meyering.net>
7601 * tests/du/Makefile.am (TESTS): Add no-deref.
7602 * tests/du/no-deref: New script.
7604 2002-12-23 Jim Meyering <jim@meyering.net>
7606 * src/remove.c (remove_cwd_entries): Fix typo in comment.
7608 2002-12-21 Jim Meyering <jim@meyering.net>
7610 * announce-gen: Generate MML-formatted announcement.
7611 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
7613 2002-12-20 Jim Meyering <jim@meyering.net>
7615 * src/touch.c (touch): Change the wording of a diagnostic so
7616 that it makes sense both when the file exists and when it doesn't.
7617 Suggestion from Michael Stone.
7619 2002-12-18 Jim Meyering <jim@meyering.net>
7621 * src/stty.c (valid_options): Declare to be static.
7623 2002-12-15 Jim Meyering <jim@meyering.net>
7625 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
7627 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
7628 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
7629 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
7630 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
7631 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
7633 * src/remove.c (PARAMS): Remove definition.
7634 * src/sys2.h: Likewise.
7636 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
7637 Include strftime.h instead.
7639 2002-12-14 Jim Meyering <jim@meyering.net>
7641 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
7643 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
7644 This is necessary at least for Irix6.5 when using c89.
7645 Reported by Nelson Beebe.
7647 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
7649 * tests/misc/cat-tty-eof: New test.
7651 * src/mknod.c (usage): Specify how major and minor mode numbers
7652 are interpreted. Report forwarded by Kristin E Thomas.
7653 * src/mknod.c: Remove now-redundant usage-specifying comment.
7655 2002-12-13 Jim Meyering <jim@meyering.net>
7659 * tests/du/trailing-slash: Allow for a directory of size `0'.
7660 That happens at least on file systems of type tmpfs on linux-2.4.18.
7662 * announce-gen: New script to begin replacing the commands
7663 associated with the rule here...
7664 * Makefile.maint (announcement): Invoke announce-gen.
7665 * Makefile.am (EXTRA_DIST): Add announce-gen.
7667 * tests/cp/preserve-2: New file/test, for latest fix.
7668 * tests/cp/Makefile.am (TESTS): Add preserve-2.
7670 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
7672 Fix a bug whereby cp would fail to parse an option like
7673 --preserve=mode,ownership.
7674 * src/cp.c (decode_preserve_arg): Advance `comma' to
7675 point the character following the comma.
7677 2002-12-11 Jim Meyering <jim@meyering.net>
7679 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
7680 in case it's already defined.
7682 2002-12-09 Jim Meyering <jim@meyering.net>
7684 * tests/touch/fail-diag: Don't get a test failure if /no exists.
7685 Instead, evoke a framework failure if /no-$$ exists.
7686 Reported by Michael Stone.
7688 2002-12-08 Jim Meyering <jim@meyering.net>
7690 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
7691 Define to rpl_lstat, so that even on systems like Solaris 5.8,
7692 du honors (per POSIX) the trailing slash on an argument referring
7693 to a symlink-to-directory.
7695 2002-12-06 Jim Meyering <jim@meyering.net>
7697 * Use autoconf-2.57. Regenerate dependent files.
7698 * Use automake-1.7.2. Regenerate dependent files.
7700 * src/ls.c (gobble_file): Also stat the file if it's a
7701 regular file and --indicator-style=classify (aka -F).
7702 Thanks to Ed Santiago for opening my eyes.
7704 * tests/ls/file-type: New file. Test for the above.
7705 A test to contrast ls -F and ls --indicator-style=file-type.
7706 * tests/ls/Makefile.am (TESTS): Add file-type.
7708 2002-12-04 Jim Meyering <jim@meyering.net>
7710 * tests/ls/follow-slink: Make sure the symlink was created.
7711 Richard Dawe reported that `ln -s link link' succeeds, but creates
7712 no file on systems running some version of the DJGPP libc.
7714 2002-12-03 Jim Meyering <jim@meyering.net>
7716 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
7717 since this package no longer panders to K&R compilers.
7719 2002-12-02 Jim Meyering <jim@meyering.net>
7721 * tests/du/slink: Skip this test if `.' is on a non-local file system.
7723 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
7724 something to replace.
7726 2002-12-01 Jim Meyering <jim@meyering.net>
7728 * src/stat.c: Don't include <string.h> or <ctype.h>.
7729 That's already done via system.h.
7730 * src/dircolors.c: Don't include <ctype.h>.
7732 2002-11-30 Jim Meyering <jim@meyering.net>
7734 * ls.c (gobble_file): Remove the block of code that caused
7735 `ls --color -F symlink-to-dir' to list the files in
7736 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
7737 like `ls -F symlink-to-dir') but with the addition of highlighting.
7738 Similarly, `ls --color -dF symlink-to-dir' would print
7739 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
7740 Reported by Jeff Sheinberg as Debian bug #168203.
7741 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
7743 ls is now more efficient: with certain options, it no longer needs
7744 to stat each directory entry on systems with valid dirent.d_type.
7745 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
7746 (main): Make --recursive set format_needs_type, not format_needs_stat.
7747 (gobble_file): Remove a FIXME comment, now that it's fixed.
7749 2002-11-24 Jim Meyering <jim@meyering.net>
7751 * src/du.c (du_files): Don't strip any trailing slash.
7752 Rewrite so that `/' is no longer represented internally as
7754 (count_entry): When appending a file name component,
7755 account for the fact that the current path may end in `/'.
7756 François Pinard reported that `du symlink-to-dir/' was not
7757 equivalent to `du symlink-to-dir/.'. Now it is.
7758 * tests/du/trailing-slash: New file/test, for the above fix.
7759 * tests/du/Makefile.am (TESTS): Add trailing-slash.
7761 2002-11-23 Jim Meyering <jim@meyering.net>
7763 * src/tac.c (output): Declare some local variables to be of type size_t,
7764 rather than `int' to avoid warnings from gcc.
7766 2002-11-21 Paul Eggert <eggert@twinsun.com>
7768 * src/ls.c (decode_switches): Use case-sensitive matching to
7769 decode the QUOTING_STYLE environment variable. This is more
7770 consistent with the documentation, and with --quoting-style.
7772 2002-11-21 Martin Buck <martin.buck@ascom.ch
7774 * src/stty.c (struct speeds): Add support for all baud rates defined
7777 2002-11-19 Jim Meyering <jim@meyering.net>
7779 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
7780 run in a UTF locale. Report and suggested fix by Bruno Haible.
7781 * tests/fmt/basic: Likewise.
7783 2002-11-17 Jim Meyering <jim@meyering.net>
7785 * configure.ac: Update via autoupdate.
7786 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
7788 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
7789 Reported by Hans Ginzel.
7791 2002-11-15 Jim Meyering <jim@meyering.net>
7793 * Makefile.cfg (gnu_rel_host): Define.
7794 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
7795 on whether $(VERSION) looks like a major release number.
7797 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
7798 (release): Rename from `alpha'.
7799 (alpha): Depend on release.
7801 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
7803 2002-11-14 Jim Meyering <jim@meyering.net>
7805 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
7806 (announcement): Use the new variable.
7808 * Makefile.maint: Sync with Bison, i.e.:
7809 (po-check): Scan .l and .y files instead of the
7810 .c and the .h files that they generate. This fixes the bug
7811 reported by Tim Van Holder in:
7812 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
7813 Look for N_ as well as for _. Try to avoid matching #define for
7817 2002-11-12 Jim Meyering <jim@meyering.net>
7819 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
7820 Replace sole use with equivalent `#ifdef S_ISLNK'.
7821 Inconsistency reported by Dmitry V. Levin.
7823 2002-11-11 Jim Meyering <jim@meyering.net>
7825 * src/stat.c (usage): Transform --help items output via s/ - / /,
7826 so that help2man produces properly formatted man pages.
7827 Reported by Herbert Xu as Debian bug #168400.
7829 2002-11-10 Jim Meyering <jim@meyering.net>
7831 * src/ls.c (sighandler): Handle SIGTSTP specially.
7832 Based on suggestions from Solar Designer and Dmitry V. Levin.
7835 * Makefile.cfg (cvs_files): Define. From autoconf.
7836 (local_updates): Likewise.
7838 * src/ls.c (restore_default_color_handler, sigtstp_handler):
7840 (sighandler): New function, based on the one in sort.c.
7841 (main): Use sigaction, if possible; otherwise signal.
7842 Handle these signals:
7843 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
7844 Don't register our handler if the signal is already being ignored.
7846 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
7847 * src/csplit.c (interrupt_handler): Likewise.
7848 * src/sort.c (sighandler): Likewise.
7849 (main): Declare `i' and `nsigs' to be unsigned, not int.
7851 2002-11-09 Jim Meyering <jim@meyering.net>
7853 ls --color: restore terminal text color upon signal.
7854 * src/ls.c: Include "full-write.h" and <signal.h>.
7855 (restore_default_color, restore_default_color_handler): New functions.
7856 (sigtstp_handler, put_indicator_direct): New functions.
7857 (main) [print_with_color]: Register signal handlers.
7858 Patch mostly by Solar Designer and Stanislav Ievlev.
7860 Update from autoconf.
7861 * Makefile.maint (AMTAR): Remove definition.
7862 (update, cvs-update, po-update, do-po-update): New rules.
7863 (wget-update): Update (thus renaming to cvs-update).
7864 (automake_repo): Use anoncvs@sources.redhat.com.
7866 2002-11-06 Jim Meyering <jim@meyering.net>
7868 * tests/misc/Makefile.am (TESTS): Add printf-hex.
7870 * tests/misc/printf: Be careful to test the code in this package,
7871 not the shell built-in function.
7873 * src/printf.c (print_esc): A hexadecimal escape sequence has
7874 at most two hex. digits, not three. Reported by Padraig Brady.
7875 (usage): Update description.
7876 * tests/misc/printf-hex: New file/test, for the above fix.
7878 2002-10-07 Paul Eggert <eggert@twinsun.com>
7880 Add support for locale-specific size indications (e.g.,
7881 thousands-separators) and for explicit size suffixes on output.
7883 * doc/coreutils.texi (Block size): Say that:
7884 This affects display format as well as block size.
7885 Fractional block counts are rounded up.
7886 ls file size blocksize defaults to 1.
7887 A block size spec preceded by ' generates thousands separators.
7888 A suffix without a preceding integer generates suffixes.
7889 (tail invocation): 32k -> 32 KiB.
7890 (What information is listed): ls -h is now equivalent to
7891 ls --block-size=human, and ls -H is now equivalent to
7892 ls --block-size=si. Displayed file size is now always affected by
7895 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
7896 lib/umaxtostr.c: New files, taken from GNU tar.
7898 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
7900 (EXTRA_DIST): Add inttostr.c.
7902 * lib/human.c, lib/human.h: Rewrite to support locale-specific
7903 notations like thousands separators.
7904 Specify what includer of include.h must include beforehand.
7905 (human_group_digits, human_suppress_point_zero, human_autoscale,
7906 human_base_1024, human_SI, human_B): New enum values.
7907 (human_readable): Rename from human_readable_inexact; put the
7908 options before the sizes. All uses changed. The old human_readable
7909 function has been removed; use inttostr.h instead.
7910 (human_options): Renamed from human_block_size, with new signature
7911 that allows block sizes up to UINTMAX_MAX. All callers changed.
7913 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
7914 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
7915 freestanding C89. No need to check for stdlib.h or string.h since
7916 autoconf does this now.
7918 * src/cksum.c (cksum): Use primitives from inttostr.h, not
7919 human.h, to print large numbers simply.
7920 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
7921 * src/dd.c (print_stats, main): Likewise.
7922 * src/df.c (print_header): Likewise.
7923 * src/factor.c (print_factors): Likewise.
7924 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
7925 * src/shred.c (dopass): Likewise.
7926 * src/sort.c (checkfp): Likewise.
7927 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
7928 * src/tail.c (xlseek): Likewise.
7929 * src/wc.c (write_counts, wc): Likewise.
7931 * src/df.c (human_output_opts): New var.
7932 (output_block_size): Now uintmax_t, not int, to handle larger
7933 block sizes. All uses changed.
7934 * src/du.c: Likewise.
7935 * src/ls.c: Likewise.
7937 * src/df.c (print_header): In the header line, prefer SI to human
7938 representation if it's shorter; if neither is shorter, try to
7939 intuit what the user would prefer.
7941 * src/expr.c (inttostr): Remove; use new imaxtostr library
7944 * src/ls.c (file_output_block_size): New var, to distinguish
7945 file sizes from other sizes.
7946 (decode_switches): Set it.
7948 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
7949 (dopass): When printing progress, use floor for what has been done
7950 so far (since we should be conservative there), and ceiling for
7951 what needs to be done (since that's what other programs use).
7953 2002-10-19 Jim Meyering <jim@meyering.net>
7955 * src/pinky.c (print_heading): Align TTY and Name headings.
7956 Reported by Karl Eichwalder.
7958 2002-10-18 Jim Meyering <jim@meyering.net>
7960 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
7961 Remove now-useless cast.
7962 (stdread): Remove function.
7963 (bytes_split): Use size_t instead of int.
7964 Use safe_read, not stdread.
7965 (lines_split): Likewise.
7966 Use memchr rather than a `while' loop.
7967 (line_bytes_split): Use size_t instead of int.
7968 Use safe_read, not stdread.
7969 (main): Add some FIXME comments to remind me to remove casts.
7971 * src/system.h (ST_BLKSIZE): Correct comment describing how to
7972 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
7974 2002-10-17 Jim Meyering <jim@meyering.net>
7976 Fix a problem that could make e.g., `cat' misbehave on systems which
7977 give invalid (unreasonably large) values for stat.st_blksize.
7978 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
7979 Reported by Petter Reinholdtsen.
7981 2002-10-14 Jim Meyering <jim@meyering.net>
7983 Specifying a printf conversion specifer as nl's separator string
7984 could cause nl to segfault.
7985 * src/nl.c (build_print_fmt): Don't include separator string
7986 in the printf format; it might contain `%'.
7987 Use a better bound on the length of the print_fmt buffer.
7988 (print_lineno): Print the separator here instead.
7989 Reported by Doug Coleman.
7991 * tests/misc/nl: New file/tests, including a test for the above.
7992 * tests/misc/Makefile.am (TESTS): Add nl.
7994 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
7995 * tests/misc/Makefile.am (TESTS): Add split-l.
7997 2002-10-13 Jim Meyering <jim@meyering.net>
8001 * src/du.c (usage): Tweak description of --dereference-args/-D.
8003 * src/du.c (count_entry): Also save cwd when dereferencing (via
8004 --dereference-args, -D) a command-line argument.
8005 Reported by Michal Svec. Based on a patch by Andreas Schwab.
8007 * src/Makefile.am (../AUTHORS): New target/rule.
8009 2002-10-12 Jim Meyering <jim@meyering.net>
8011 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
8012 of type size_t, since that's the way it's used and avoids a warning.
8014 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
8015 since that's how it's always used and avoids a new warning from gcc.
8016 (read_input): Adapt to new safe_read ABI.
8018 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
8021 * src/pinky.c (print_long_entry): fread returns size_t.
8022 Declare local `bytes' accordingly, to avoid warning.
8024 tail -c +N would perform an extra read after encountering EOF
8025 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
8026 * src/tail.c (start_bytes): Detect EOF, inform caller.
8027 (tail_bytes): Upon EOF in start_bytes, return immediately.
8028 (file_lines): Reorganize to use memrchr rather than an explicit loop.
8029 Adapt to new safe_read ABI.
8031 2002-10-11 Jim Meyering <jim@meyering.net>
8033 * tests/du/deref: New file/test, for the above fix.
8034 * tests/du/Makefile.am (TESTS): Add deref.
8036 2002-10-10 Jim Meyering <jim@meyering.net>
8038 * tests/ln/Makefile.am (TESTS): Add target-1.
8039 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
8041 2002-10-09 Jim Meyering <jim@meyering.net>
8043 * tests/cp/backup-is-src: Ensure that certain environment variables
8044 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
8046 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
8047 consume 4GB of disk space on systems without support for sparse files.
8048 Fix a logic error that'd make it `cat err' even though dd didn't fail.
8050 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
8051 Patch by steven@magelico.net, forwarded by Michael Stone.
8053 * tests/ls/dired: Ensure that ls produces English messages.
8054 Patch by Alexey Vyskubov, forwarded by Michael Stone.
8056 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
8058 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
8060 2002-10-08 Jim Meyering <jim@meyering.net>
8062 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
8063 Fix syntax in test: use =, not ==.
8064 Reported by Bob Proulx.
8065 Change all the rest like this: grep -lR "testing framework'" .\
8066 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
8068 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
8069 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
8070 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
8071 * src/wc.c (wc): Likewise.
8073 2002-10-07 Paul Eggert <eggert@twinsun.com>
8076 Don't advance the write pointer past the end of the write buffer.
8077 * src/sort.c (begfield, limfield): Likewise.
8079 2002-10-07 Jim Meyering <jim@meyering.net>
8081 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
8082 * src/head.c (head_bytes, head_lines): Likewise.
8084 2002-10-06 Jim Meyering <jim@meyering.net>
8086 * src/dd.c (scanargs): Ensure that specified block sizes (specified
8087 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
8088 (skip, dd_copy): Adapt to new safe_read ABI.
8090 * Makefile.maint (signatures): Define.
8092 (announcement): Depend on $(signatures).
8094 * Makefile.maint (announcement): Output all URLs for detached
8095 signatures, not just the last one from the previous loop.
8097 2002-10-05 Jim Meyering <jim@meyering.net>
8101 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
8102 don't recurse into directory, DIR. Prompted by a report from
8105 * tests/rm/i-no-r: New file/test, for the above fix.
8106 * tests/rm/Makefile.am (TESTS): Add i-no-r.
8108 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
8109 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
8111 2002-10-03 Jim Meyering <jim@meyering.net>
8113 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
8114 * src/df.c (AUTHORS): Likewise.
8115 * src/du.c (AUTHORS): Likewise.
8116 * src/tail.c (AUTHORS): Likewise.
8117 * src/touch.c (AUTHORS): Likewise.
8119 2002-10-02 Jim Meyering <jim@meyering.net>
8121 * Makefile.am (SUBDIRS): Remove `old'.
8122 (EXTRA_DIST): List the files in old/.
8123 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
8124 Suggestion from Akim Demaille.
8126 2002-10-01 Jim Meyering <jim@meyering.net>
8128 * src/sys2.h (SSIZE_MAX): Define.
8130 2002-09-30 Jim Meyering <jim@meyering.net>
8132 * src/csplit.c: Don't include stdlib.h here. It's already included
8135 2002-09-29 Jim Meyering <jim@meyering.net>
8137 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
8138 expression to avoid bogus warning from gcc.
8140 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
8141 (cat): Declare insize and outsize to be of type size_t, not int.
8142 Rearrange pointer/integer expressions to avoid bogus warnings.
8143 (main): Declare insize and outsize to be of type size_t, not int.
8145 * src/tail.c (parse_options): Give a sensible diagnostic for
8146 an invalid byte or line count. Reported by Mikko Tuumanen.
8148 * src/touch.c (main): Split a long line.
8150 * tests/du/Makefile.am (TESTS): Add slink.
8151 * tests/du/slink: New test for system.h change of 2002-08-31.
8153 In move mode, always first try to rename. Before, upon failure to
8154 rename a directory, this code would never attempt to rename any
8155 other file in that directory, but would thenceforth always copy.
8156 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
8157 may fail with EXDEV, yet renaming files within that directory to
8158 a newly-created destination directory succeeds.
8159 * src/copy.c (copy_internal): Remove local, move_mode;
8160 use x->move_mode instead. Based on a patch from Tom Haynes.
8162 2002-09-28 Jim Meyering <jim@meyering.net>
8164 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
8165 Factor out some duplication.
8167 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
8169 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
8171 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
8172 to avoid compiler warnings.
8174 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
8177 Fix things so `mkdir -p' can create very deep directories, e.g.,
8178 mkdir -p $(perl -e 'print "a/" x 40000') now works.
8179 * src/mkdir.c (main): For --parents (-p), call make_path with the
8180 entire directory name, so we don't ever require that file operations
8181 like stat or chmod be performed on the entire command line argument.
8182 * makepath.c (make_path): Restore umask *before* creating the final
8185 2002-09-27 Andreas Schwab <schwab@suse.de>
8187 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
8188 to avoid overflow. Reported by Hans Lermen.
8190 2002-09-26 Jim Meyering <jim@meyering.net>
8192 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
8194 2002-09-25 Jim Meyering <jim@meyering.net>
8196 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
8197 and add a cast, to avoid a warning about `signed and unsigned type in
8198 conditional expression'.
8200 2002-09-22 Jim Meyering <jim@meyering.net>
8202 * src/rmdir.c: Include "dirname.h", for declaration of
8203 strip_trailing_slashes.
8205 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
8206 Now they're defined through system.h.
8208 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
8209 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
8210 since it's already included from sys2.h via system.h.
8212 * Use automake-1.6f. Regenerate dependent files.
8214 * src/Makefile.am (PERL): Remove duplicate definition.
8216 fmt's -s, -t, -c options didn't work properly for long lines.
8217 Since get_line may end up calling put_paragraph (for long lines),
8218 be sure to set global, `other_indent', before it is used there.
8220 * src/fmt.c (set_other_indent): New function, factored out of...
8221 (get_paragraph): ... here. Call it.
8222 (get_line): Call set_other_indent before calling flush_paragraph,
8223 which calls fmt_paragraph, which in turn calls put_paragraph,
8224 which uses other_indent.
8226 * tests/fmt/Makefile.am (TESTS): Add long-line.
8227 * tests/fmt/long-line: New file/test, for the above fix.
8229 2002-09-21 Jim Meyering <jim@meyering.net>
8231 * src/od.c: No longer include deprecated <values.h>.
8232 It was required solely for now-removed reference to BITSPERBYTE.
8233 * src/install.c: Likewise.
8234 Suggestion from Bruno Haible.
8236 2002-09-06 Andreas Schwab <schwab@suse.de>
8238 `rmdir -p dir-specified-with-trailing-slash/' would fail.
8239 * src/rmdir.c (remove_parents): Strip trailing slashes.
8241 2002-09-20 Jim Meyering <jim@meyering.net>
8243 * tests/rmdir/t-slash: New file/test, for the above fix.
8244 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
8246 * Makefile.maint (announcement): Arrange to gpg-sign the message.
8247 Add a URL for each detached signature file.
8249 2002-09-07 Bruno Haible <bruno@clisp.org>
8251 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
8253 2002-09-18 Jim Meyering <jim@meyering.net>
8255 `od -t x8' used the wrong (`l'-prefixed) printf format.
8256 Likewise for the o8 and u8 formats.
8257 * src/od.c (ISPEC_TO_FORMAT): Define macro.
8258 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
8259 Reported by Arun Sharma.
8261 2002-09-17 Jim Meyering <jim@meyering.net>
8263 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
8264 From gettext's intl/loadmsgcat.c.
8266 * tests/od/x8: New file/test, for the above fix.
8267 * tests/od/Makefile.am (TESTS): Add x8.
8269 2002-09-15 Jim Meyering <jim@meyering.net>
8271 * Use autoconf-2.54. Regenerate dependent files.
8273 * src/csplit.c (get_format_width): Add cast to avoid
8274 warning about `signed and unsigned type in conditional expression'.
8276 2002-09-14 Jim Meyering <jim@meyering.net>
8278 * src/who.c (print_user): Change type of local to size_t
8279 to avoid warnings about `comparison between signed and unsigned'.
8280 * src/ptx.c (generate_all_output): Likewise.
8282 * src/dd.c (main, skip): Add casts to avoid warnings about
8283 `comparison between signed and unsigned'.
8285 * src/id.c (print_full_info, print_group_list): Add casts to avoid
8286 warnings about `signed and unsigned type in conditional expression'.
8288 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
8289 to avoid warnings about `comparison between signed and unsigned'.
8290 (split_3): Change parameter names to be readable and add comment.
8291 Clean up the test for whether a line may be ignored.
8293 2002-09-13 Jim Meyering <jim@meyering.net>
8295 * src/printf.c (main): Handle leading command line argument of `--'.
8296 Reported by Raul: DervishD <raul@pleyades.net>
8297 * tests/misc/printf: New file: test for the above.
8298 * tests/misc/Makefile.am (TESTS): Add printf.
8300 * src/date.c (usage): Explain that %S's range of [0..60] is required --
8301 rather than 0..59 -- to accommodate the occasional positive leap second.
8302 Reported by Richard Neill.
8304 2002-09-12 Jim Meyering <jim@meyering.net>
8306 * src/Makefile.am (nanosec_libs): Define.
8307 (sleep_LDADD, tail_LDADD): Use it here.
8309 Factor nanosleep-related code into ../lib/xnanosleep.c.
8310 * src/sleep.c: Include xnanosleep.h.
8311 Factor out fenv.h-related code.
8312 (timespec_subtract): Remove function.
8313 (main): Remove code that deals with computing start and stop times
8314 as well as the loop around nanosleep. Now that's in xnanosleep.c.
8316 Allow S (in --sleep-interval=S) to be a floating point value.
8317 * src/tail.c: Include xnanosleep.h and xstrtod.h.
8318 Move declaration of global variable, sleep_interval, to ...
8320 (usage): Update description of --sleep-interval option.
8321 (tail_forever): New parameter, sleep_interval. Update caller.
8322 Use xnanosleep, rather than sleep.
8323 (parse_options): New parameter, sleep_interval. Update caller.
8324 Use xstrtod, now that we accept floating point values.
8325 Prompted by a patch from Augey Mikus.
8327 2002-09-06 Jim Meyering <jim@meyering.net>
8329 * src/remove.c (prompt): Change comment to give a better note to
8330 translators. From Michael Piefel.
8332 2002-09-02 Jim Meyering <jim@meyering.net>
8334 * README: A good problem report/patch includes diffs against
8335 the most recent test release.
8337 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
8338 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
8340 * src/kill.c (print_table_row): Use an unsigned type for widths
8341 to avoid warning about comparison between signed and unsigned.
8342 (list_signals): Likewise.
8344 * src/od.c (skip): Add a cast to avoid warning about comparison
8345 between signed and unsigned.
8346 * src/install.c (get_ids): Likewise. Also rearrange range-checking
8347 comparisons to make them more readable.
8349 2002-09-01 Jim Meyering <jim@meyering.net>
8353 2002-08-31 Jim Meyering <jim@meyering.net>
8355 Symlinks were always reported as using 0 blocks.
8356 * src/system.h (ST_NBLOCKS): Don't depend on file type.
8357 This reverts the change of 2000-01-30.
8358 Based on a report and patch from Neil Brown via Michael Stone.
8359 This fixes Debian Bug#156358.
8361 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
8362 `exit (1)' to `exit (EXIT_FAILURE)', and
8363 `usage (1)' to `usage (EXIT_FAILURE)'.
8365 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
8366 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
8367 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
8368 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
8369 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
8370 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
8371 error never exits successfully.
8373 2002-08-29 Jim Meyering <jim@meyering.net>
8375 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
8376 when ignoring any return value.
8378 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
8379 failures. On some systems (at least EMC Celerra and Solaris5.8),
8380 this appears to be necessary.
8381 (is_empty_dir): Likewise. Also, always close directory handle.
8382 * src/ls.c (print_dir): Likewise.
8383 (print_dir): Rename local variable: reading -> dirp.
8384 Reported by Mike Coleman.
8386 2002-08-28 Jim Meyering <jim@meyering.net>
8388 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
8389 Give a diagnostic and fail if closedir fails.
8391 2002-08-26 Jim Meyering <jim@meyering.net>
8393 * Makefile.am (THANKS-to-translators): New rule.
8394 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
8395 * THANKStt.in: New file.
8397 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
8399 (main): Register it with atexit.
8400 Close STDOUT_FILENO, to avoid a problem when writing to
8401 /dev/audio on at least Solaris 5.7 and 5.8 systems.
8402 Reported by Shing-Shong Shei.
8404 2002-08-25 Jim Meyering <jim@meyering.net>
8406 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
8407 * src/tac.c (main): Likewise.
8408 * src/tail.c (main): Likewise.
8409 * src/tee.c (main): Likewise.
8410 * src/tr.c (main): Likewise.
8411 * src/wc.c (main): Likewise.
8413 2002-08-20 Jim Meyering <jim@meyering.net>
8415 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
8417 2002-08-10 Paul Eggert <eggert@twinsun.com>
8419 * src/nohup.sh: Don't use "exec --"; it's not portable and
8420 shouldn't be needed.
8422 2002-08-09 Jim Meyering <jim@meyering.net>
8424 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
8425 (usage): Clarify help text for the -COLUMN option.
8426 Patch by Padraig Brady.
8427 * tests/pr/Test.pm [col-last]: New test for the above.
8429 * configure.ac: Start with version 4.5.1, chosen so that it's larger
8430 than the latest version numbers of the component packages.
8432 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
8435 2002-08-08 Jim Meyering <jim@meyering.net>
8437 * src/date.c: Guard inclusion of <langinfo.h> with
8438 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
8439 * src/sort.c: Likewise.
8440 Patch by GOTO Masanori.
8442 2002-08-05 Paul Eggert <eggert@twinsun.com>
8444 Fix some minor time-related bugs with POSIX time arguments.
8445 Some valid time stamps were being rejected (notably -1, and
8446 time stamps before 1900 on 64-bit hosts). And some invalid
8447 time stamps were being accepted, e.g. September 31.
8449 * src/date.c (main): Adjust to posixtime signature change.
8450 * src/touch.c (main): Likewise. Remove unnecessary initialization.
8451 Use localtime, not posixtm, to warn about obsolete "touch".
8453 2002-08-05 Jim Meyering <jim@meyering.net>
8455 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
8457 2002-08-04 Jim Meyering <jim@meyering.net>
8459 * src/Makefile.am (check-README): New target/rule.
8460 (check): Depend on it.
8462 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
8464 2002-08-03 Jim Meyering <jim@meyering.net>
8466 * Makefile.am (SUBDIRS): Add old.
8467 * old/: New directory, containing legacy ChangeLog* and NEWS files
8468 from the fileutils, sh-utils, and textutils packages.
8470 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
8472 2002-08-02 Paul Eggert <eggert@twinsun.com>
8474 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
8476 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
8477 (hard_LC_COLLATE): New var.
8478 (different): Args are now char *, not const char *.
8479 Use xmemcoll instead of memcmp to compare lines, so that
8480 LC_COLLATE has effect. However, use memcmp if it is an
8482 (check_file): Do not include newline in comparison, so that
8483 xmemcoll has a byte to stomp on temporarily.
8484 (main): Set hard_LC_COLLATE.
8486 2002-07-29 Jim Meyering <jim@meyering.net>
8488 * Makefile.am (SUBDIRS): Remove djgpp, for now.
8490 2002-07-20 Jim Meyering <jim@meyering.net>
8492 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
8493 into EXIT_FAILURE. Otherwise, false --help and false --version
8496 2002-07-08 Jim Meyering <jim@meyering.net>
8498 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
8499 rather than the hard-coded `sh-utils'.
8501 2002-07-01 Jim Meyering <jim@meyering.net>
8503 * configure.ac: Merge the three files from fileutils,
8504 textutils, and sh-utils.
8505 * Makefile.am: Likewise.
8506 * src/Makefile.am: Likewise.