1 2005-12-27 Jim Meyering <jim@meyering.net>
3 * Makefile.maint (sc_obsolete_symbols): Prohibit use of O_NDELAY.
4 (sc_prohibit_assert_without_use): New rule.
5 (syntax-check-rules): Add it to the list.
6 * .x-sc_prohibit_assert_without_use: New empty file.
7 * Makefile.am (EXTRA_DIST): Add it.
9 * Makefile.maint (CVS_LIST): Define in terms of $(srcdir).
11 * cp.c, df.c, link.c, mknod.c, nice.c, sleep.c, unlink.c:
12 Don't include <assert.h>; it wasn't used.
14 2005-12-26 Paul Eggert <eggert@cs.ucla.edu>
16 * src/chown-core.c (restricted_chown):
17 Don't try O_WRONLY unless O_RDONLY failed wth EACCES.
18 * src/remove.c (fd_to_subdirp): Open with O_DIRECTORY | O_NOCTTY
19 | O_NOFOLLOW too, for consistency with other dir-openers.
20 Use POSIX-preferred O_NONBLOCK rather than O_NDELAY.
21 (is_empty_dir): Likewise.
22 * src/shred.c (wipename): Likewise. Don't bother trying to open
23 dir for writing, since POSIX prohibits it.
25 2005-12-22 Jim Meyering <jim@meyering.net>
27 * tests/help-version: Redirect stderr to /dev/full, to suppress
28 write error diagnostic.
30 2005-12-19 Jim Meyering <jim@meyering.net>
32 * src/mkdir.c, src/mknod.c, src/mkfifo.c (main)
33 Avoid a minor race condition when `-m MODE' is specified, by using
34 open, fchown, and close rather than just chown. To do that reliably --
35 even with an overly restrictive umask -- ensure that each mkdir,
36 mknod and mkfifo call uses a mode including at least owner-read access.
37 * src/mknod.c (main): When `-m MODE' is specified, exit nonzero if
38 the subsequent chown (or equivalent open,fchown,close) fails.
39 * tests/misc/mknod: New tests.
40 * tests/misc/Makefile.am (TESTS): Add mknod.
42 2005-12-17 Jim Meyering <jim@meyering.net>
44 * src/remove.c (is_empty_dir): Open with O_NDELAY, so we don't hang,
45 e.g., on a named pipe.
46 (OPEN_NO_FOLLOW_SYMLINK): Remove definition. Use O_NOFOLLOW in
47 place of all uses, since it is guaranteed (system.h) to be defined.
49 2005-12-05 Andreas Gruenbacher <agruen@suse.de>
52 * src/ls.c: Switch back from HAVE_ACL to USE_ACL: The acl() syscall
53 is no requirement for ACL support; particularly, it does not exist
54 on systems that have POSIX ACLs.
55 * src/copy.h (cp_option_init) [umask_kill]: Remove member.
56 * src/cp.c (umask_kill): With default acls, the umask is not to be
57 applied. Remove umask_kill, don't change the process umask, and let
58 the kernel apply the umask where appropriate.
59 * src/cp.c (make_dir_parents_private): Fix logic for POSIX ACLs.
60 * src/copy.c (get_dest_mode): Remove; it is obsolete after removing
62 (copy_reg, copy_internal): Use copy_acl and set_acl
63 instead of fchown/chown. Fix the logic for POSIX ACLs.
64 (chown_succeded): Remove; we now always copy acls and
65 preserve S_ISUID, S_ISGID, and S_ISVTX when needed, no matter if we
66 did a chown before or not.
67 * src/mv.c, src/install.c (cp_option_init): Don't set umask_kill member.
68 * src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD, cp_LDADD,
69 mv_LDADD, ginstall_LDADD): On systems with an ACL library, arrange
70 to link with it via $(LIB_ACL), for the utilities that need it.
72 2005-12-16 Paul Eggert <eggert@cs.ucla.edu>
74 * src/remove.c (OPENAT_CWD_RESTORE__REQUIRE): Remove.
75 (OPENAT_CWD_RESTORE__ALLOW_FAILURE): Likewise.
76 (fd_to_subdirp): Remove openat_cwd_restore_allow_failure arg; its
77 value is now signified by whether cwd_errno is null.
78 (fd_to_subdirp, remove_dir, rm_1); Change cwd failure indicator from
79 pointer-to-bool to pointer-to-errno-value. All callers changed.
80 (rm_1): Don't bother setting a local cwd failure flag and then
81 ORing it into the caller's. Just set the caller's.
82 (rm): Use cwd failure errno value to print a slightly-better
85 2005-12-15 Jim Meyering <jim@meyering.net>
87 * src/stat.c (print_it): Properly handle a backslash at the
88 end of a --printf format string. Reported by Paul Eggert.
89 * tests/misc/stat-printf (end-bs): Add a test for the above.
91 2005-12-15 Paul Eggert <eggert@cs.ucla.edu>
93 * tests/acl: Port to pre-POSIX shells like Solaris 8 /bin/sh.
94 Don't assume /etc/passwd contains user names; use 'id' instead.
96 2005-12-15 Jim Meyering <jim@meyering.net>
98 stat: revert behavior of --format=FMT (-c)
99 stat: add new option: --printf=FMT
100 * NEWS: Mention this.
101 * src/stat.c (isodigit, octtobin, hextobin): Define.
102 (PRINTF_OPTION): Define.
103 (interpret_backslash_escapes, trailing_delim): New globals.
104 (usage): Document them. Alphabetize on long option names.
105 (print_esc_char): New function.
106 (print_it): Rewrite, in order to handle backslash escapes.
107 (main): Handle new option. Set globals for --format, too.
109 * tests/misc/stat-printf: Test --printf and --format.
110 * tests/misc/Makefile.am (TESTS): Add stat-printf.
112 2005-12-14 Paul Eggert <eggert@cs.ucla.edu>
114 * NEWS: sort now reports incompatible options.
115 * src/sort.c (incompatible_options, check_ordering_compatibility):
117 (main): Use them. Don't bother with a usage message for
118 "sort -c a b", for consistency with other error diagnostics.
119 * tests/sort/Test.pm (incompat1, incompat2, incompat3, incompat4):
122 * src/cat.c (main): Undo previous change. close_stdout already
123 does the check, so the previous change wasn't necessary.
125 2005-12-13 Paul Eggert <eggert@cs.ucla.edu>
127 * src/cat.c (main): Check for close (STDOUT_FILENO) failure.
129 2005-12-12 Paul Eggert <eggert@cs.ucla.edu>
131 Install a more-conservative approach for sort -R. It's the
132 same basic idea as the existing code, except it uses the full ISAAC
133 approach (called the "more kosher" approach in the existing comments).
134 This makes "sort -R" quite a bit slower (about a factor of 2 on my
135 little tests involving 10000 lines on a 2.4 GHz P4), but I think it's
136 better to be conservative here at first, and review any performance
137 improvements carefully.
138 * .x-sc_require_config_h: Add src/rand-isaac.c.
139 * src/rand-isaac.h: Remove. All uses now simply include rand-isaac.c.
140 * src/Makefile.am (noinst_HEADERS): Remove rand-isaac.h.
141 (shred_SOURCES, sort_SOURCES): Remove.
142 (EXTRA_DIST): Add rand-isaac.c.
143 * src/rand-isaac.c: Revert to what used to be in shred.c, without
144 changing it to allow for varying numbers of words in the state.
145 Alter so that we include rand-isaac.c directly rather than
146 compiling it and linking to it. Don't include config.h or
147 system.h; that's the includer's responsibility.
148 Omit functions that are specific to shred.
149 (ISAAC_LOG, ISAAC_WORDS, ISAAC_BYTES, struct isaac_state, ind):
150 (isaac_step, struct irand_state):
151 Resurrect these, with the same defns that used to be in shred.c.
152 (ISAAC_SIZE, isaac_new, isaac_copy): Remove.
153 (isaac_refill, isaac_seed_start, isaac_seed_data, irand_init, irand32):
155 (struct isaac_state, isaac_refill, isaac_mix, isaac_init):
156 (isaac_seed_start, isaac_seed_data, isaac_seed_finish, isaac_seed):
157 (irand_init, irand32, irand_mod):
158 Number of words is constant again.
159 (struct irand_state, irand_init, irand32, irand_mod): Move to shred.c.
160 * src/shred.c: Include rand-isaac.c rather than rand-isaac.h.
161 * src/sort.c: Likewise.
162 * src/shred.c (fillrand, dopass, main): Undo previous change.
163 (struct irand_state, irand_init, irand32, irand_mod): Moved back here,
165 * src/sort.c: Don't include md5.h; it wasn't needed.
166 (struct keyfield): Rename random_hash to random, for consistency
167 with the other member names. All uses changed.
168 (usage): Tweak wording to mention STRING for --seed option.
169 (short_options): Rorder for consistency with other programs.
170 (rand_state): Now a struct, not a pointer to one. All uses changed.
171 (HASH_WORDS, HASH_SIZE): Remove.
172 (get_hash): Remove comments around resbuf size, since we can assume C89.
173 Use a "more-kosher" (but slower) approach of invoking isaac_refill.
174 (keycompare): Adjust to the new get_hash.
176 (badfieldspec): Omit recently-introduced comment; it isn't needed.
177 (main): Don't set need_random simply because gkey has it set; that
178 doesn't necessarily mean we'll need random numbers.
179 Redo seeding to match new get_hash approach.
181 2005-12-10 Jim Meyering <jim@meyering.net>
183 * src/Makefile.am (noinst_HEADERS): Add rand-isaac.h.
185 Avoid shred segfault on 64-bit systems.
186 * src/rand-isaac.c (isaac_refill): Don't try to negate a
187 local of type uint32_t. Make the local an `int' instead.
189 * NEWS: Mention sort's new options.
191 * src/rand-isaac.c (isaac_mix): Declare to be static.
192 Mark all other functions as `extern' so the tight-scope
193 part of `make distcheck' passes once again.
194 * src/rand-isaac.h (isaac_mix): Remove declaration.
196 * src/sort.c (get_hash): Change position of `*' in parameter
197 type to conform with convention.
198 (main): Split a long line so it fits in 80 columns.
199 (keycompare): Remove stray SPACE before TAB that was
200 causing `make distcheck' to fail.
202 * src/shred.c: Don't include gethrxtime.h. No longer needed.
204 * tests/misc/sort-rand: New file: basic tests for the new options.
205 * tests/misc/Makefile.am (TESTS): Add sort-rand.
207 2005-12-10 Frederik Eaton <frederik@ofb.net>
209 * src/Makefile.am (sort_LDADD): Add $(LIB_GETHRXTIME).
210 (shred_SOURCES, sort_SOURCES): New macros, so we compile rand-isaac.c.
211 * src/rand-isaac.c: New file, containing ISAAC code that was in shred.c.
212 Make state size runtime-configurable.
213 (isaac_new, isaac_copy): New functions.
214 * src/rand-isaac.h: New file.
215 * src/shred.c: Include rand-isaac.h. Move ISAAC code to rand-isaac.c.
216 (fillrand, main): Adjust to the fact that the state size is now
217 runtime-configurable.
218 * src/sort.c (short_options, long_options, WORDS, keycompare, main):
219 (usage): Add options --random-sort and --seed to implement a random
221 Include md5.h and rand-isaac.h.
222 (get_hash): New function.
223 (rand_state): New var.
224 (HASH_WORDS, HASH_SIZE): New macros.
226 2005-12-09 Paul Eggert <eggert@cs.ucla.edu>
228 * tests/dd/misc: Add test for dd iflags=noatime.
230 2005-12-09 Jim Meyering <jim@meyering.net>
232 * src/sort.c (usage): Mention white space vs -b and -t options.
235 2005-12-09 Eric Blake <ebb9@byu.net>
237 * src/test.c (main): Fix misleading comment.
239 2005-12-07 Paul Eggert <eggert@cs.ucla.edu>
241 * NEWS: Mention dd's new noatime flag.
242 * src/system.h (O_NOATIME): Define to 0 if not already defined.
243 * src/dd.c (flags, usage): Add support for noatime flag.
245 2005-12-07 Jim Meyering <jim@meyering.net>
247 Distribute the cvsu script, used only by `make syntax-check'.
248 * Makefile.am (EXTRA_DIST): Add build-aux/cvsu.
249 * Makefile.maint (CVS_LIST): Use build-aux/cvsu, now that we
250 distribute a copy of this script.
251 * .x-sc_unmarked_diagnostics: Add build-aux/cvsu.
253 * tests/mv/acl: exit-77 before the trap, not after, if we fail
254 to create a temporary directory on another partition.
255 From Andreas Gruenbacher.
257 2005-12-06 Tomas Pospisek <tpo@sourcepole.ch> (tiny change)
259 * man/basename.x: Cross-reference to dirname and readlink.
260 * man/dirname.x: Cross-reference to basename and readlink.
262 2005-12-05 Andreas Gruenbacher
264 * src/copy.c [!HAVE_FCHOWN]: Define fchown(...) to -1.
265 (set_owner, preserve_author): New functions, factored out of copy_reg.
266 (copy_reg): Use them.
267 (copy_internal): Use them here, too.
269 2005-12-04 Jim Meyering <jim@meyering.net>
271 * src/sleep.c (usage): Say what happens with two or more arguments.
272 Suggested by Justin Pryzby.
274 * src/uptime.c (print_uptime): Move decl of `upsecs' into scope
277 2005-12-03 Jim Meyering <jim@meyering.net>
279 * src/rm.c (long_opts): Change the name of each undocumented, for-
280 testing-only option to start with `-', so that it cannot render
281 ambiguous any prefix it happens to share with some other option name.
282 Problem reported by Eric Blake.
283 * src/head.c (long_options): Likewise.
284 * src/tail.c (long_options): Likewise.
286 * tests/misc/head-elide-tail: Update uses of undocumented, for-
287 testing-only --presume* options to start with `---'.
288 * tests/rm/dangling-symlink: Likewise.
289 * tests/rm/dir-no-w: Likewise.
290 * tests/rm/isatty: Likewise.
292 2005-11-30 Jim Meyering <jim@meyering.net>
294 * Makefile.maint: Add a comment about cvsu.
296 2005-11-25 Paul Eggert <eggert@cs.ucla.edu>
298 * NEWS: df updates for "none", "proc", inaccessible file systems.
299 * src/df.c (show_point): Ignore inaccessible file systems.
300 (usage): -a includes dummy file systems, not size-0 file systems.
302 * src/od.c (unsigned_long_long_int): Renamed from ulonglong_t,
303 to avoid collision with POSIX name space. All uses changed.
305 2005-11-24 Jim Meyering <jim@meyering.net>
307 * tests/Makefile.am (EXTRA_DIST): Add acl to the list.
308 * tests/acl: Add `$0: ' prefix to diagnostics.
310 * .x-sc_require_config_h: Add lib/buffer-lcm.c to the list.
312 2005-11-23 Paul Eggert <eggert@cs.ucla.edu>
314 * src/copy.c: Improve performance a bit by optimizing away
315 unnecessary system calls and going to a block size of at least
316 8192 (on normal hosts, anyway). This improved performance 5% on my
317 Debian stable host (2.4.27 kernel, x86, copying from root
318 ext3 file system to itself).
319 Include "buffer-lcm.h".
320 (copy_reg): Omit last argument. All callers changed.
321 Use xmalloc to allocate rather than trusting alloca
322 (which is unwise with large block sizes).
323 Declare locals more locally, if possible.
324 Use uintptr_t words instead of int words, for a bit more speed
325 when looking for null blocks on 64-bit hosts.
326 Optimize away reads of zero bytes on regular files.
327 In the typical case, insist on 8 KiB buffers, at least.
328 Avoid unnecessary extra call to fstat when checking for sparse files.
329 Avoid now-unnecessary cast to off_t, and "0L".
330 Avoid unnecessary test of *new_dst when checking for same owner
333 2005-11-22 Paul Eggert <eggert@cs.ucla.edu>
335 * src/remove.c (rm): Don't assume C99 for-loop syntax.
337 2005-11-22 Jim Meyering <jim@meyering.net>
339 * src/remove.c (AD_push): Remove debugging cruft.
341 * tests/rm/unread2 (rm): Change expected diagnostic,
342 `cannot open directory' to `cannot remove', to align with
344 * tests/rm/rm2: Ensure that rm now continues removing entries
345 even after certain types of failure.
347 * src/remove.c: Rewrite. Now, this module is reentrant on systems
348 that provide openat (Solaris), and on systems like Linux+procfs
349 where our openat emulation code is reentrant. This also fixes a
350 few low-probability leaks and eliminates some code that could,
351 in very unusual circumstances, cause rm() (via a callee) to exit.
352 * NEWS: Mention this.
354 * configure.ac: Put copyright dates all on one line so the
355 emacs function that updates them works properly.
357 2005-11-18 Paul Eggert <eggert@cs.ucla.edu>
359 * configure.ac (AM_PROG_CC_C_O): Add. Needed for CVS Automake.
360 Problem reported by Eric Blake.
361 (AC_PROG_CC_STDC): Use this instead of AC_PROG_CC, so that
362 we get a standard-conforming compiler. This relies on the new
363 m4/c.m4 file. Note that it's a bit tricky, since c.m4 doesn't
364 define AC_PROG_CC_STDC; we are relying on Autoconf 2.59 internals.
365 m4/c.m4 can go away with Autoconf 2.60 comes out.
367 2005-11-17 Jim Meyering <jim@meyering.net>
369 * src/remove.c (AD_mark_helper): Make a `char *' parameter `const'.
370 (AD_mark_current_as_unremovable): Likewise, but for a local.
373 * tests/mv/acl: Let traps handle removing temporary directories.
375 Expect acl-related tests to fail, until the corresponding
376 patches are committed.
377 * tests/mv/Makefile.am (XFAIL_TESTS): Add acl.
378 * tests/cp/Makefile.am (XFAIL_TESTS): Likewise.
380 ACL tests, from Andreas Gruenbacher.
381 * tests/acl, tests/mv/acl, tests/cp/acl: New files.
382 * tests/mv/Makefile.am (TESTS): Add acl.
383 * tests/cp/Makefile.am (TESTS): Add acl.
385 * src/ls.c (basename_is_dot_or_dotdot): Correct wording in comment.
387 2005-11-16 Paul Eggert <eggert@cs.ucla.edu>
389 * NEWS: Improve quality of ln's diagnostics.
390 * src/ln.c (do_link, usage): Likewise.
391 (do_link): Don't use alloca on a buffer of unbounded size.
393 2005-11-16 Jim Meyering <jim@meyering.net>
395 * tests/cp/fail-perm: Accommodate HPUX. It appears to fail
396 with EACCES rather than EPERM. Reported by Peter O'Gorman here:
397 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/5766
398 This also affects AIX 4.3.3, according to Ralf Wildenhues, in
399 http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00192.html
401 2005-11-14 Jim Meyering <jim@meyering.net>
403 * NEWS (sort): Mention consequences of today's mkstemp-safer.c fix.
405 2005-11-13 Jim Meyering <jim@meyering.net>
407 * announce-gen: Accept new option, --gpg-key-id=ID and
408 emit a blurb telling how to use the .sig files.
409 * Makefile.cfg (gpg_key_ID): Define.
410 * Makefile.maint (announcement): Use new option and key.
412 Require that most .c files include <config.h>.
413 * Makefile.maint (sc_require_config_h): New rule.
414 (syntax-check-rules): Add it.
415 * .x-sc_require_config_h: New file listing exceptions to the
416 above rule. Some are legit, others are simply grandfathered in.
417 * Makefile.am (EXTRA_DIST): Add .x-sc_require_config_h here, too.
419 2005-11-12 Jim Meyering <jim@meyering.net>
421 * src/checksum.h, src/md5.c, src/sha1sum.c: Remove now-unused files.
423 2005-11-11 Jim Meyering <jim@meyering.net>
425 * NEWS: Mention `readlink -f' bug fix in 5.3.0 news.
426 Mention new readlink options in 5.3.0's `New features' section.
427 Spotted by Thomas Hood.
429 2005-11-08 Jim Meyering <jim@meyering.net>
431 * NEWS: Merge in changes from b5_9x branch.
433 2005-11-08 Paul Eggert <eggert@cs.ucla.edu>
435 * NEWS: ls now defaults to --time-style='locale', which in turn acts
436 like --time-style='posix-long-iso' if the locale settings are messed up.
437 * src/ls.c (decode_switches): Implement this.
439 2005-11-08 Jim Meyering <jim@meyering.net>
441 * tests/du/2g: s/expensive/very expensive/ in a comment.
444 2005-10-17 Eric Blake <ebb9@byu.net>
446 * src/ls.c (usage): Fix descriptions of --sort, --time.
447 Reported by Vitaly A. Ostanin.
449 2005-11-04 Paul Eggert <eggert@cs.ucla.edu>
451 * src/ln.c: Include filenamecat.c.
452 (FILE_BASENAME_CONCAT): Remove.
453 (do_link): Remove last arg DEST_IS_DIR. All callers changed.
454 (main): Use file_name_concat, base_name, and strip_trailing_slashes
455 instead of FILE_BASENAME_CONCAT. This simplifies the code, and avoids
458 2005-11-04 Jim Meyering <jim@meyering.net>
460 * src/du.c (process_file): Don't overflow for files of size >= 2^31
461 on systems with stat.st_blocks of a signed 32-bit type.
462 This bug causes trouble on some AIX 5.1 systems.
463 Report and trivial patch from Paul Townsend:
464 <http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00033.html>
465 * NEWS: Mention this.
467 * tests/du/2g: New (very-expensive) test for the above-fixed bug.
468 * tests/du/Makefile.am (TESTS): Add it here.
469 * tests/very-expensive: New file.
470 * tests/Makefile.am (EXTRA_DIST): Add it here.
471 * tests/cp/perm: Mark this test as `very-expensive', too.
473 2005-11-02 Paul Eggert <eggert@cs.ucla.edu>
475 * NEWS: Mention that rm -d and maybe ln -d are scheduled for
477 * src/remove.h (struct rm_options): Remove unlink_dirs. All uses
479 * src/rm.c (usage): Don't mention rm -d.
481 2005-11-02 Jim Meyering <jim@meyering.net>
483 * tests/dd/skip-seek: Fix typo in comment: s/fileutils/coreutils.
486 * tests/dd/unblock-sync: Redirect stderr to /dev/null so the
487 `M+N records in/out' lines don't pollute `make check' output.
489 * tests/dd/skip-seek (sk-seek4): New test, to exercise the bug
490 fixed on 2005-10-31. This test uses the new, IN_PIPE specifier.
491 * tests/Coreutils.pm: Accept a new type of input specifier: IN_PIPE,
492 to indicate that the input file should be piped into the command
493 under test (via `cat FILE | $prog ...').
495 * src/remove.c (remove_entry): Emit a better diagnostic when rm
496 (without -r) fails to remove a directory on a non-Linux system.
497 This change affects only newer Solaris systems (with priv_*
498 functions like priv_allocset). Reported by Keith Thompson.
500 * tests/rm/dir-nonrecur: New file/test for the above fix.
501 * tests/rm/Makefile.am (TESTS): Add dir-nonrecur.
503 2005-11-01 Paul Eggert <eggert@cs.ucla.edu>
505 * NEWS: "tail -c 2 FILE" and "touch 0101000000" now operate as
506 POSIX 1002.1-2001 requires.
507 * src/tail.c (parse_obsolete_option): Implement this.
508 Problem reported by Vincent Lefevre.
509 * src/touch.c (main): Pass PDS_PRE_2000 to posixtime.
510 * tests/tail/Test.pm (c-2, c-2-minus, c2, c2-minus): New tests.
511 (test_vector): Add special cases for _POSIX2_VERSION, and
512 regularize the old ones a bit.
513 * tests/touch/obsolescent: Add y2000 test.
515 2005-10-31 Paul Eggert <eggert@cs.ucla.edu>
517 * src/dd.c (skip): Fix off-by-one error reported by
518 Theodoros V. Kalamatianos.
520 2005-10-30 Paul Eggert <eggert@cs.ucla.edu>
522 * tests/mkdir/p-3: Require that the test be run as non-root.
523 Problem and trivial fix reported by Theodoros V. Kalamatianos.
525 2005-10-28 Paul Eggert <eggert@cs.ucla.edu>
527 * src/ln.c (FILE_BASENAME_CONCAT): Omit unnecessary slashes in the
528 boundary between DEST and SOURCE in the result.
530 2005-10-26 Dmitry V. Levin <ldv@altlinux.org>
532 * src/md5sum.c (main) [!O_BINARY]: Changed default read mode
533 back to text, to sync with documentation and for backwards
536 2005-10-25 Jim Meyering <jim@meyering.net>
538 * tests/dircolors/simple (other-wr): Add an explicit test for
539 the dircolors bug (NULL-dereference) fixed yesterday.
541 2005-10-24 Jim Meyering <jim@meyering.net>
543 * src/tac.c (tac_file): When determining whether a file is seekable,
544 also test whether it is a tty. Using only the lseek-based test would
545 give a false positive on Solaris. Reported by Peter Fales.
547 2005-10-24 Dmitry V. Levin <ldv@altlinux.org>
549 * tests/install/d-slashdot: New test, for "install -d" failure.
550 * tests/install/Makefile.am (TESTS): Add d-slashdot.
551 * tests/mkdir/p-slashdot: New test, for "mkdir -p" failure.
552 * tests/mkdir/Makefile.am (TESTS): Add p-slashdot.
554 2005-10-24 Jim Meyering <jim@meyering.net>
556 * src/dircolors.c (ls_codes): Add missing comma.
557 Anonymous report and patch from
558 http://savannah.gnu.org/bugs/?func=detailitem&item_id=14849
560 * src/dircolors.c: Add compile-time assertion that the slack_codes
561 and ls_codes arrays have the same number of elements. This would
562 have prevented the above-fixed bug.
564 * src/expand.c (parse_tab_stops): Add a comment to make this function
565 identical to the one in unexpand.c.
566 * src/unexpand.c (parse_tab_stops): Adjust syntax to make this function
567 identical to the one in expand.c.
569 * src/expand.c (next_file): Don't assume fopen cannot return stdin.
571 2005-10-23 Jim Meyering <jim@meyering.net>
573 * src/md5sum.c (digest_check, main): Use ptr_align rather than
574 a dangerous pointer-value-to-`unsigned' cast.
575 * NEWS: mention the new sha* programs.
576 * AUTHORS: Add new sha* programs.
578 2005-08-28 David Madore <david.madore@ens.fr>
580 Add new programs: sha224sum, sha256sum, sha384sum, sha512sum.
581 * README: Add their names to the list.
582 * src/md5sum.c: Provide framework for computing sha-2 hashes.
583 * src/Makefile.am (sha224sum, sha256sum, sha384sum, sha512sum):
584 Rules for compiling sha-2 utilities
585 (noinst_HEADERS): Remove checksum.h.
586 * man/sha512sum.x, man/sha384sum.x, man/sha256sum.x, man/sha224sum.x:
588 * man/Makefile.am (dist_man_MANS): Add the corresponding .1 names.
589 (sha224sum.1, sha256sum.1, sha384sum.1, sha512sum.1): New dependencies.
590 * tests/misc/sha224sum, tests/misc/sha256sum: New files.
591 * tests/misc/sha384sum, tests/misc/sha512sum: New files.
592 * tests/misc/Makefile.am (TESTS): Add new sha224sum, sha256sum,
593 sha384sum, sha512sum test scripts here rather that each in its
596 2005-08-28 David Madore <david.madore@ens.fr>
598 * tests/sha1sum/basic-1 (million-a): Add the "million a's" test (one
599 of the FIPS test vectors).
601 2005-10-23 Jim Meyering <jim@meyering.net>
603 * configure.ac: Use 6.0-cvs as the version string.
604 * NEWS: Adjust accordingly.
606 2005-10-22 Jim Meyering <jim@meyering.net>
610 * configure.ac: Remove -cvs suffix from version string.
611 * NEWS: Add today's date.
613 * tests/mkdir/writable-under-readonly: New test, neither run
614 nor distributed via tarballs.
616 2005-10-20 Jim Meyering <jim@meyering.net>
618 * tests/chmod/octal: New file/test, to exercise today's
619 lib/modechange.c fix.
620 * tests/chmod/Makefile.am (TESTS): Add octal.
621 * NEWS: Mention this chmod fix as well as the dircolors one.
623 2005-10-18 Paul Eggert <eggert@cs.ucla.edu>
625 * src/dircolors.c (append_quoted): Quote ' correctly.
626 Problem reported by Eric Blake.
628 2005-10-19 Jim Meyering <jim@meyering.net>
630 * tests/dircolors/simple (quote): Add test for the above fix.
632 2005-10-18 Jim Meyering <jim@meyering.net>
634 * tests/chgrp/basic: Add a comment explaining (probably) why this
635 test fails on OpenBSD 3.2 when run in an NFS-mounted directory.
637 2005-10-17 Jim Meyering <jim@meyering.net>
639 * configure.ac: Use 5.92-cvs as the version string.
640 * NEWS: Adjust accordingly.
642 * Makefile.maint (my-distcheck): Depend on
643 $(release_archive_dir)/$(prev-tgz) here, so that if it's missing
646 2005-10-16 Jim Meyering <jim@meyering.net>
650 * Makefile.maint (VERSION_REGEXP): New variable.
651 (news-date-check, changelog-check): Use tighter regular expressions.
653 * configure.ac: Remove -cvs suffix from version string.
654 * NEWS: Add today's date.
656 * NEWS: Mention the `mkdir -p' bug fix.
658 2005-10-15 Jim Meyering <jim@meyering.net>
660 * src/who.c (usage): Undocument deprecated --idle (-i) option.
662 * src/df.c (main): Warn about the deprecated --kilobytes option.
663 * src/ls.c (decode_switches): Likewise.
665 * src/du.c (usage): Document -m, once again.
666 (main): Warn about use of deprecated long options:
667 --kilobytes and --megabytes.
668 * src/tail.c (parse_options): Remove --allow-missing option.
669 You can use --retry instead.
670 * src/stat.c (main): Remove --link -l options.
671 You can use --dereference (-L) instead.
673 2005-09-30 Eric Blake <ebb9@byu.net> (tiny change)
675 * man/Makefile.am (.x.1): Remove temp directory first.
676 * NEWS: Document dircolors change of 2005-09-05.
678 2005-10-07 Paul Eggert <eggert@cs.ucla.edu>
680 * src/sort.c (sortlines_temp): Redo previous change, since I'm
681 no longer confident that the m4/stdbool.m4 patch suffices.
683 2005-10-06 Paul Eggert <eggert@cs.ucla.edu>
685 * src/sort.c (sortlines_temp): Undo previous change, since
686 today's change to m4/stdbool.m4 should catch it.
688 2005-10-06 Jim Meyering <jim@meyering.net>
690 * TODO: rm: add support for a -I option, like that from FreeBSD's.
692 2005-10-05 Jim Meyering <jim@meyering.net>
694 * src/sort.c (sortlines_temp): Declare temporary as `int' rather
695 than `bool' to work around AIX 5.3 compiler bug in 64-bit mode.
698 2005-10-03 Jim Meyering <jim@meyering.net>
700 * src/factor.c (MAX_N_FACTORS): Define in terms of sizeof (uintmax_t)
701 rather than hard-coding to 128. From Thomas M.Ott.
703 2005-10-02 Jim Meyering <jim@meyering.net>
705 * Makefile.maint (sc_unmarked_diagnostics):
706 Search only cvs-controlled files.
707 * .x-sc_unmarked_diagnostics: New file.
708 * Makefile.am (EXTRA_DIST): Add it.
710 2005-10-01 Jim Meyering <jim@meyering.net>
712 * src/factor.c (main): Don't stop processing arguments upon
713 the first invalid one. Suggestion from Eric Blake
714 * tests/factor/basic: Add a test for this.
716 2005-09-30 Jim Meyering <jim@meyering.net>
718 * configure.ac: Use 5.91-cvs as the version string.
719 * NEWS: Adjust accordingly.
721 2005-09-29 Paul Eggert <eggert@cs.ucla.edu>
723 * src/dd.c (main): Don't assume size_t has the same width
724 as unsigned long. Problem reported by Eric Blake.
726 * NEWS: Clarify "tail - f" example.
728 2005-09-29 Jim Meyering <jim@meyering.net>
732 * configure.ac: Remove -cvs suffix from version string.
733 * NEWS: Add today's date.
735 * NEWS: Mention this bug fix:
736 stat now exits nonzero if a file operand does not exist
738 2005-09-28 Paul Eggert <eggert@cs.ucla.edu>
740 * src/system.h (LONGEST_MODIFIER): Use ULONG_MAX_LT_ULLONG_MAX
741 instead of ULLONG_MAX, as the latter doesn't work with GCC 2.7.2.1.
743 2005-09-28 Jim Meyering <jim@meyering.net>
745 * configure.ac: Use 5.90-cvs as the version string, not 5.3.1-cvs.
746 * NEWS: Adjust accordingly.
748 * README: Remove note about FreeBSD make test failure.
750 2005-09-28 Paul Eggert <eggert@cs.ucla.edu>
752 * tests/install/trap: Work around a bug in FreeBSD 5.0.
754 2005-09-28 Jim Meyering <jim@meyering.net>
756 * README: Warn about a (now-)known problem on FreeBSD 5.0:
758 2005-09-26 Paul Eggert <eggert@cs.ucla.edu>
760 * src/touch.c (touch): Handle "touch -c - >&-" by checking for EBADF
762 Do not pass "-" to futimens; pass NULL instead.
763 If close (STDIN_FILENO) fails, report the error separately instead
764 of letting the 'close' pollute errno.
765 * tests/touch/empty-file: Test "touch -" too.
766 * tests/touch/no-create-missing: Likewise.
767 * tests/touch/read-only: Likewise.
769 2005-09-26 Jim Meyering <jim@meyering.net>
771 * tests/touch/read-only: New test, for root of chmod/usage failure.
772 * tests/touch/Makefile.am (TESTS): Add read-only.
774 Work around the root cause of alpha-linux-1.sf.net test failure.
775 * tests/chmod/usage: Remove *all* files before each inner loop
776 iteration. Otherwise, with a touch program that fails on unwritable
777 files, (this happens at least on linux-2.2.20) a -w file left behind
778 from a previous iteration could cause a spurious test failure.
780 2005-09-25 Paul Eggert <eggert@cs.ucla.edu>
782 * tests/chmod/usage: Undo the s/files/file/ change, but add
783 comments about why the old version was desired.
785 2005-09-25 Jim Meyering <jim@meyering.net>
787 * tests/ls-2/tests (setuid-etc): Work around output mismatch when
788 a just-created test file cannot be made set-group-ID.
790 Avoid test failures on alpha-linux-1.sf.net.
791 * tests/chmod/usage: Use newer trap and tmpdir-creation framework.
792 Fix apparent typos (s/files/file/) in inner loop.
794 2005-09-24 Paul Eggert <eggert@cs.ucla.edu>
796 * NEWS: "touch -" now touches standard output.
797 * src/touch.c (touch): Implement this.
798 (usage): Document this.
800 * src/copy.c (HAVE_FCHMOD, HAVE_FCHOWN): Define to 0 if not defined.
801 (copy_reg): New args CHOWN_SUCCEDED and DST_SB. All callers changed.
802 Add a "goto close_src_and_dst_desc;" that was missing in the
804 (copy_reg) [HAVE_FCHOWN]: Prefer fchown to chown.
805 (copy_reg) [HAVE_FCHMOD]: Prefer fchmod to chmod.
806 (copy_internal): Don't invoke chown if fchown worked,
807 and likewise for chmod and fchmod.
809 2005-09-24 Jim Meyering <jim@meyering.net>
811 * src/shred.c: Use `#ifdef HAVE_CONFIG_H', not `#if HAVE_CONFIG_H',
812 for consistency with gnulib.
813 * src/dircolors.c: Likewise.
815 * Makefile.maint (sc_no_if_have_config_h): New rule.
816 (syntax-check-rules): Add it.
817 .x-sc_no_if_have_config_h: New file.
818 * Makefile.am (EXTRA_DIST): Add it.
820 * tests/seq/basic (eq-wid-1, eq-wid-2): Disable these tests for now.
821 They fail with non-gcc compilers and some combinations
822 of options and libraries on Solaris systems.
824 * tests/misc/date (uninit-64): Restore this test.
825 Add start-up code to detect, and work around, the cases in
826 which the test might fail.
828 2005-09-24 Paul Eggert <eggert@cs.ucla.edu>
830 * tests/misc/date (uninit-64): Remove this test. It wasn't
831 portable in theory (it doesn't work on hosts where 'int' is 64
832 bits, example) or in practice (Solaris 8 localtime returns garbage
833 in tm_year for the specified date, but that's not coreutils's
836 2005-09-23 Paul Eggert <eggert@cs.ucla.edu>
838 * src/copy.c (copy_reg): Preserve time stamps if
839 x->preserve_timestamps is set, using futimens so that
840 we needn't resolve the path again.
841 (copy_internal): Don't preserve time stamps if copy_reg did it
843 * src/install.c (change_timestamps): First arg is source
844 struct stat, not file name. All uses changed.
845 (install_file_in_file): Stat the source file.
846 Don't try to change time stamps if copy_file did it.
847 * src/system.h: Don't include utime.h; not needed.
848 (struct utimbuf) [!defined HAVE_STRUCT_UTIMBUF]: Remove; not needed.
850 2005-09-23 Jim Meyering <jim@meyering.net>
852 * src/od.c: Use `verify' to ensure that our hard-coded
853 bytes_to_*_digits arrays are long enough. Of course, 17+-byte
854 integral types aren't on the near horizon, but just in case...
855 (MAX_INTEGRAL_TYPE_SIZE): Move definition to precede new first use.
856 (bytes_to_oct_digits, bytes_to_signed_dec_digits):
857 (bytes_to_unsigned_dec_digits, bytes_to_hex_digits): Change base
858 type from `char' to the clearer `unsigned int'.
860 2005-09-21 Paul Eggert <eggert@cs.ucla.edu>
862 * src/rmdir.c (EEXIST, ENOTEMPTY): Remove unused macros.
866 * src/dircolors.c: Include strcase.h.
867 * src/pinky.c: Include canon-host.h rather than declaring
868 canon_host ourselves.
869 * src/who.c: Likewise.
871 * src/system.h (X2NREALLOC, X2REALLOC): Moved here from
872 ../lib/xalloc.h, with args properly parenthesized, and using
873 verify_expr rather than the old VERIFY_EXPR.
875 2005-09-21 Jim Meyering <jim@meyering.net>
877 * tests/install/basic-1: Require that this test be run as non-root.
878 Otherwise, it fails due to the fact that the chmod 0 . doesn't
881 2005-09-20 Jim Meyering <jim@meyering.net>
883 * src/remove.c (write_protected_non_symlink): Change comment to
886 2005-09-19 Jim Meyering <jim@meyering.net>
888 * src/remove.c (remove_dir): Return RM_ERROR, not `1',
889 when attempting to remove `/' with --preserve-root.
891 * src/remove.c (remove_cwd_entries): Syntactic tweak: move an
892 assignment out of an if-expression.
894 2005-09-17 Jim Meyering <jim@meyering.net>
896 * src/extract-magic (usage): Request that additions be sent to
897 bug-coreutils@gnu.org, too.
899 2005-09-16 Jim Meyering <jim@meyering.net>
901 * tests/misc/date (rfc822-1): Compensate for Solaris 5.9's /bin/sh,
902 which emits a diagnostic to stderr when this test's LC_ALL=de_DE
903 setting cannot be honored.
905 * tests/misc/date (subfmt-up1): Put quotes around format string
906 to protect `^' from interpretation by some shells.
907 Add a use of OUT_SUBST to compensate for Solaris strftime's slightly
908 different formatting of %c.
910 * src/dd.c (main): When failing to truncate, mention both the seek
911 block count and the block size, in case the block size is very large.
912 Now `make distcheck' should pass, once again.
914 2005-09-16 Paul Eggert <eggert@cs.ucla.edu>
916 * src/copy.c: Include stat-time.h.
917 (copy_internal): Use its functions instead of the obsolete
919 * src/cp.c (re_protect): Likewise.
920 * src/date.c (main): Likewise.
921 * src/du.c (struct duinfo, duinfo_init, duinfo_set, duinfo_add):
922 (show_date, print_size, process_file): Likewise.
923 * src/install.c (change_timestamps): Likewise.
924 * src/ls.c (cmp_ctime, cmp_mtime, cmp_atime, print_long_format):
926 * src/pr.c (init_header): Likewise.
927 * src/stat.c (human_time, print_stat): Likewise.
928 * src/tail.c (record_open_fd, tail_forever): Likewise.
929 * src/test.c (get_mtime, binary_operator): Likewise.
930 * src/touch.c (touch, main): Likewise.
931 * src/test.c (get_mtime): Renamed from age_of. All uses changed.
933 2005-09-16 Jim Meyering <jim@meyering.net>
935 Date no longer needs to allocate virtual memory to do its job,
936 so it can no longer fail due to an out-of-memory condition.
938 * src/date.c: Include fprintftime.h.
939 Don't include strftime.h or xanstrftime.h -- no longer needed.
940 (show_date): Use new fprintftime function rather than xanstrftime.
941 Correct comment: this function no longer handles a NULL format string.
942 * src/du.c: Likewise.
943 * NEWS: Mention this.
945 * tests/misc/date (subfmt-up1): Test the combination of the
946 to-upper-case modifier (^) and a conversion specifier that
947 expands to a string containing lower case characters.
949 2005-09-15 Paul Eggert <eggert@cs.ucla.edu>
951 * NEWS: uname -a no longer generates the -p and -i outputs if they
953 * src/uname.c (usage): Document this.
954 (main): Implement this.
956 2005-09-14 Jim Meyering <jim@meyering.net>
958 * tests/misc/date (tz-5w, tz-5wf): Test new %:z format with
961 2005-09-13 Paul Eggert <eggert@cs.ucla.edu>
963 * src/dd.c: Detect some very unlikely buffer overflows.
964 (INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP): New macros.
965 (MAX_BLOCKSIZE): Now accepts an arg. All uses changed.
966 (page_size): New var.
967 (scanargs, skip, main): Use more-straightforward way to detect overflow.
968 (dd_copy): Use page_size rather than invoking getpagesize.
969 Use INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP.
970 (main): Set page_size.
971 Avoid a call to stat in the usual case where ftruncate succeeds.
973 * src/expr.c (docolon): Add IF_LINT check to avoid GCC warning.
975 * configure.ac: Don't invoke AC_CONFIGURE_HOST directly; AB_INIT
976 does it for us, and our invocation evokes a diagnostic from
979 * NEWS: date has a new --rfc-3339 option, and the old --iso-8601
980 option is deprecated. date, du, ls, and pr also have new time format
981 specifiers %:z, %::z, %:::z.
982 * src/date.c (TIME_SPEC_DATE): No longer needs to be nonzero, so
984 (TIME_SPEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put
986 (time_spec_string, time_spec): Hours and minutes must be at
987 start now, so put them there.
988 (rfc_2822_format): Now a string constant, not a boolean. All uses
990 (iso_8601_format, rfc_format): Remove.
991 (RFC_3339_OPTION): New constant.
992 (long_options): Add --rfc-3339.
993 (usage): Add --rfc-3339. Don't mention --iso-8601.
994 Mention %:z, %::z, %:::z.
995 (main): Simplify calculation of 'format'; it was getting too hairy
996 to follow. Add --rfc-3339.
997 (show_date): Assume format arg is not NULL, which is the case
998 now. The default code is moved to 'main'. This simplifies things
999 and allows the default to be calculated just once.
1000 * tests/misc/date: Add tests for --rfc-3339, %:z, %::z, %:::z.
1002 2005-09-13 Jim Meyering <jim@meyering.net>
1004 * Makefile.maint (GZIP_ENV): Add --rsyncable option.
1005 (makefile-check): Escape a `$' in a diagnostic.
1007 * configure.ac: Use AB_INIT (from autobuild).
1009 2005-09-11 Jim Meyering <jim@meyering.net>
1011 * src/factor.c (usage): Remove leading spaces in 2-line
1012 description, so that help2man doesn't mangle it.
1013 Reported by Justin Pryzby.
1015 2005-09-10 Jim Meyering <jim@meyering.net>
1017 csplit could produce corrupt output, given input lines longer than 8KB
1019 * src/csplit.c (load_buffer): Don't read from free'd memory
1020 when handling lines longer than the initial buffer length.
1021 (save_to_hold_area): Don't leak the previous hold_area buffer.
1022 Reported by Tristan Miller and Luke Kendall.
1023 * NEWS: Mention this.
1024 * tests/misc/csplit: New test for this.
1026 * src/csplit.c (load_buffer): Avoid integer overflow in buffer
1027 size calculations for very long lines.
1029 2005-09-09 Paul Eggert <eggert@cs.ucla.edu>
1031 Support regular expressions in 64-bit code correctly, by
1032 importing the latest gnulib regexp code, and not assuming
1033 that sizes fit in 32 bits.
1034 * src/csplit.c (process_regexp): Store match length in regoff_t,
1035 not int. Assume that negative return values less than -2
1036 represent regoff_t overflow.
1037 * src/expr.c (docolon): Likewise.
1038 * src/nl.c (proc_text): Likewise.
1039 * src/ptx.c (SKIP_SOMETHING, find_occurs_in_text): Likewise.
1040 * src/tac.c (tac_seekable): Likewise.
1041 * src/expr.c (docolon) Check for size calculation overflow.
1042 * src/nl.c (build_type_arg): Likewise.
1043 * src/ptx.c (matcher_error): New function.
1044 (SKIP_SOMETHING): Use it to report matcher errors.
1045 (alloc_and_compile_regex): No longer any need to worry about
1046 int versus size_t mismatch.
1048 * NEWS: Document "niceness" vs "nice value".
1049 * configure.ac (utils_cv_func_setpriority): Simplify the tests.
1050 Define HAVE_NICE rather than NICE_PRIORITY (since a niceness is
1051 not a priority); all uses changed.
1052 * src/nice.c (main): Hoist errno=0 outside the ifdef.
1054 2005-09-09 Jim Meyering <jim@meyering.net>
1056 * tests/misc/date (neg-secs2, fill-1, fill-2): Add new tests.
1058 2005-09-07 Paul Eggert <eggert@cs.ucla.edu>
1060 Use the phrase "niceness" instead of "nice value" to describe
1061 the biased nice value that can go negative. This corrects
1062 a discrepancy with POSIX, which states that nice values are
1064 * src/nice.c (GET_NICENESS): Renamed from GET_NICE_VALUE.
1066 (usage): Say "niceness" rather than "nice value".
1067 (main): Say "niceness" rather than "priority" (which is something else
1070 2005-09-07 Jim Meyering <jim@meyering.net>
1072 * src/du.c (time_args): Use NULL in place of 0.
1074 2005-09-05 Jim Meyering <jim@meyering.net>
1076 * src/dcgen: Don't omit comments until there is better documentation.
1078 Colorize set-user-ID and set-group-ID files and sticky,
1079 other-writable, and sticky-and-other-writable directories.
1080 * src/dircolors.c (slack_codes): Add new dircolors mode names.
1081 (ls_codes): Add corresponding two-letter ls mode strings.
1082 * src/ls.c (indicator_no[]): Add new symbols.
1083 (indicator_name[]): Add corresponding mode strings.
1084 (color_indicator[]): Add an entry for each new mode string.
1085 (print_color_indicator): Honor new types.
1086 * src/dircolors.hin: Document the default colors for the new strings.
1087 From Mike Frysinger, based on a patch from Fedora.
1088 * tests/ls-2/tests (setuid-etc): New test, for the above.
1090 2005-08-29 Paul Eggert <eggert@cs.ucla.edu>
1092 * NEWS: "rm -FOO" now suggests "rm ./-FOO" if the file "-FOO"
1093 exists and "-FOO" is not a valid option.
1094 * src/rm.c: Include lstat.h, quotearg.h.
1095 (diagnose_leading_hyphen): New function.
1098 2005-08-27 Jim Meyering <jim@meyering.net>
1100 * src/du.c: Go ahead and leave the patch in (i.e., revert
1101 today's change). It doesn't cause a problem after all, since
1102 --exclude-from=- is always handled before --files0-from=F.
1104 * src/du.c: Revert the du.c part of the change from 2005-07-02:
1105 That change (to reopen stdin on F for --files0-from=F) made it so
1106 --exclude-from=- and --files0-from=F would not work together.
1108 2005-08-23 Jim Meyering <jim@meyering.net>
1110 * configure.ac: Use `5.3.1-cvs' as the version string.
1111 * NEWS: Adjust accordingly.
1113 * Makefile.maint (sc_useless_cpp_parens): New rule.
1114 (syntax-check-rules): Add it.
1115 * .x-sc_useless_cpp_parens: New file.
1116 * Makefile.am (EXTRA_DIST): Add it.
1118 * src/od.c: Include <float.h> unconditionally.
1119 * src/uptime.c (print_uptime): Remove unnecessary parens in
1120 `#if defined (SYMBOL)' expressions.
1121 * src/system.h: Likewise.
1122 * src/hostname.c: Likewise.
1123 * src/su.c: Likewise.
1124 * src/test.c: Likewise.
1126 2005-08-22 Jim Meyering <jim@meyering.net>
1128 * src/tail.c (xwrite_stdout): Rename from xwrite. Remove always-
1129 equal-to-STDOUT_FILENO parameter and associated assertion.
1132 2005-08-21 Jim Meyering <jim@meyering.net>
1134 * src/ln.c (do_link): If ln is invoked with --interactive (-i),
1135 encounters an existing destination file, and gets an affirmative
1136 response, then first try to unlink the destination file rather
1137 than simply failing. Suggestion from Karl Berry.
1138 FIXME: add test for this
1140 * src/ln.c (main): Declare `target_directory' with const attribute.
1141 * src/du.c (time_style): Add `const' attribute.
1142 (tot_dui): Remove unnecessary (and too-short) initializer list.
1144 2005-08-19 Jim Meyering <jim@meyering.net>
1146 * src/sort.c (usage) [-b,-t]: Ensure that there are at least two
1147 spaces between each option and the corresponding description -- this
1148 lets help2man format entries properly. Reported by Edward Welbourne.
1150 2005-08-17 Jim Meyering <jim@meyering.net>
1152 * src/sort.c (usage): Fix typo s/POS 2/POS2/.
1153 Reported by Edward Welbourne.
1155 * tests/misc/date [neg-secs]: New test for today's strftime.c bug fix.
1156 * tests/misc/date: Remove terminating "\n"s once again.
1157 Automatically add them whenever EXIT != 0.
1159 2005-08-16 Paul Eggert <eggert@cs.ucla.edu>
1161 * src/df.c (show_dev): New arg STAT_FILE. All uses changed.
1162 This sometimes gives better results on networked file systems
1163 that do not respect POSIX semantics. Problem reported by
1166 2005-08-15 Jim Meyering <jim@meyering.net>
1168 Don't print uninitialized data (or anything else) to stdout
1169 upon localtime failure.
1170 * src/date.c (show_date): Remove stray `puts (buf);' (debugging?)
1171 from the 2004-02-02 change.
1172 * tests/misc/date (uninit-64): New test for the above.
1173 Rewrite all other OUT strings to include the terminating "\n".
1175 2005-08-14 Jim Meyering <jim@meyering.net>
1177 * src/md5sum.c (usage): Fix typo s/formated/formatted/ reported
1180 Use one fewer file descriptor in a common case.
1181 * src/touch.c: Include "fd-reopen.h", rather than "fcntl--.h".
1182 Use fd_reopen rather than open.
1184 2005-08-14 James Youngman <jay@gnu.org>
1186 * src/test.c (age_of): Return the nanoseconds part of the timestamp,
1188 (binary_operator) [-nt, -ot]: Use nanosecond values to break ties.
1190 2005-08-14 Jim Meyering <jim@meyering.net>
1192 * src/ls.c (long_time_expected_width): Revert last change, just to
1193 be paranoid, and add a comment explaining why. Paul Eggert mentioned
1196 * src/wc.c: Don't define mbrtowc at all.
1197 If mbstate_t is not defined, then AC_TYPE_MBSTATE_T will define
1198 it to `int' for us. Now wc.c really does compile on HP-UX 11.23.
1200 2005-08-13 Jim Meyering <jim@meyering.net>
1202 * tests/date: Remove directory
1203 * tests/Makefile.am (SUBDIRS): Remove date.
1204 * configure.ac (AC_CONFIG_FILES): Remove tests/date/Makefile.
1206 * tests/Coreutils.pm: New keywords, ENV and ENV_DEL, to support
1209 With today's additions, the generated shell script,
1210 tests/date/date-tests had becoming far too large (over 350KB),
1211 so use the superior-but-perl-requiring framework instead.
1212 * tests/date/Test.pm: Move all tests from here...
1213 * tests/misc/date: ...to this new file.
1214 * tests/misc/Makefile.am (TESTS): Add date.
1216 * tests/date/Test.pm (test_vector) [cross-dst]: New test for
1217 just-fixed getdate.y bug.
1218 * tests/date/Test.pm (test_vector): Add 364 more tests like the above.
1219 Remove unused $sunos4 variable.
1221 2005-08-12 Jim Meyering <jim@meyering.net>
1223 * src/nohup.c (main): Explain why we reopen stdin for write-only access.
1225 * src/ls.c (long_time_expected_width): Don't test for failed localtime.
1226 That cannot happen when the result date's year is in range.
1227 Add an assertion instead.
1229 * src/ls.c (sort_files): Use cleaner `sizeof *VAR_NAME'
1230 rather than `sizeof (TYPE_NAME)'.
1231 * src/ptx.c (sort_found_occurs, digest_word_file): Likewise.
1232 (alloc_and_compile_regex): Likewise.
1234 * src/wc.c: Test `!defined HAVE_MBSTATE_T' rather than
1235 `defined mbstate_t' to detect missing support for mbstate_t.
1236 The latter didn't work for HP-UX 11.23.
1238 Add bulletproofing in case stdin is closed.
1239 * src/dircolors.c (have_read_stdin): Remove global variable.
1240 (dc_parse_stream): Always use stdin (freopen, if needed) rather
1241 than sometimes using fopen to get a new file descriptor.
1242 Call fclose unconditionally.
1243 (main): Don't close stdin here. If needed, now it's already done
1246 * src/dircolors.c (dc_parse_file): Remove comment about
1247 now-removed OPENOPTS.
1249 * src/fold.c (fold_file): Cosmetic: use X2REALLOC rather than x2realloc.
1250 * src/pr.c (main): Likewise.
1252 * src/csplit.c (new_control_record): Cosmetic: use X2NREALLOC (only
1253 two arguments) rather than x2nrealloc (with three).
1254 * src/cut.c (ADD_RANGE_PAIR): Likewise.
1255 * src/expand.c (add_tab_stop): Likewise.
1256 * src/join.c (extract_field, getseq): Likewise.
1257 * src/od.c (decode_format_string): Likewise.
1258 * src/sort.c (add_temp_dir): Likewise.
1259 * src/unexpand.c (add_tab_stop): Likewise.
1261 * src/pr.c (main): Cosmetic: use '\0' in place of 0.
1263 2005-08-02 Jim Meyering <jim@meyering.net>
1265 * src/date.c: Include "xanstrftime.h".
1266 (show_date): Use xanstrftime instead of open-coding it.
1267 * src/du.c: Likewise.
1269 2005-07-29 Jim Meyering <jim@meyering.net>
1271 * src/date.c (show_date): Remove now-unnecessary code that
1272 treated an empty format string as a special case.
1273 * tests/date/Test.pm (empty-format): New test, for this case.
1275 2005-07-19 Jim Meyering <jim@meyering.net>
1277 * src/md5sum.c (usage): Adjust printf argument list to match
1280 2005-07-19 Paul Eggert <eggert@cs.ucla.edu>
1282 * NEWS: md5sum --check now accepts multiple input files, and
1283 similarly for sha1sum. Extension suggested by Chris Girling.
1284 * src/md5sum.c (usage, main): Support this new usage.
1286 2005-07-18 Paul Eggert <eggert@cs.ucla.edu>
1288 Fix a problem noted by James Youngman: VPATH-style builds don't
1289 work because of po file problems.
1290 * src/Makefile.am (BUILT_SOURCES): Remove false.c.
1291 (false.c): Remove; it's now a source file.
1292 * src/false.c: New file.
1293 * src/true.c (EXIT_STATUS): New macro.
1294 (PROGRAM_NAME, usage): Behave like "false" if EXIT_STATUS indicates.
1295 (usage): Remove "These option names may not be abbreviated."
1297 2005-07-15 Paul Eggert <eggert@cs.ucla.edu>
1299 * src/nohup.c (main): Don't worry about POSIXLY_CORRECT. Today's
1300 Austin Group Minutes says that the GNU behavior will be put
1301 forward as proposed text for a future revision.
1303 2005-07-13 Paul Eggert <eggert@cs.ucla.edu>
1305 * src/Makefile.am (nanosec_libs): Remove $(FESETROUND_LIBM); no longer
1306 needed. Problem reported by Jeff Bailey.
1308 2005-07-12 Jim Meyering <jim@meyering.net>
1310 * Makefile.maint (copyright-check): Reflect rearrangement in
1313 2005-07-11 Paul Eggert <eggert@cs.ucla.edu>
1315 * NEWS: Binary input and output are now implemented more consistently.
1316 These changes affect only platforms like MS-DOS that distinguish
1317 between binary and text files.
1318 * src/cat.c (usage, main, long_options) [O_BINARY]:
1319 Remove support for -B. Use same rules as other programs to decide
1320 whether to use binary I/O, except that the -bensAE options always
1322 * src/cat.c (main): Avoid setmode; use POSIX-specified routines instead.
1323 * src/cksum.c (cksum): Likewise.
1324 * src/head.c (head_lines, head_file): Likewise.
1325 * src/od.c (open_next_file): Likewise.
1326 * src/split.c (main): Likewise.
1327 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
1328 * src/tac.c (copy_to_temp, tac_file, main): Likewise.
1329 * src/tail.c (tail_bytes, tail_lines, tail_file, main): Likewise.
1330 * src/tee.c (tee): Likewise.
1331 * src/tr.c (main): Likewise.
1332 * src/wc.c (wc): Likewise.
1333 * src/copy.c (copy_reg): Always copy in binary mode.
1334 * src/expand.c (expand): Always copy in text mode. POSIX says
1335 the input and output must be text.
1336 * src/unexpand.c (unexpand): Likewise.
1337 * src/head.c (elide_tail_bytes_file, elide_tail_lines_file, head_bytes):
1338 (head_lines, head_file): Always use binary mode except for std tty.
1339 * src/md5sum.c (usage): Clarify whether text or binary is the default.
1340 (split_3, main): BINARY is now a 3-way value. All uses changed.
1341 (digest_file): Likewise. Clear *BINARY if we determine the file
1342 to be text. All uses changed.
1343 (main): Don't report a file to be binary if we actually read it
1344 as text in MS-DOS, because it was a terminal.
1345 * src/shred.c (wipefile): Always use binary mode. Clearly this
1346 never worked right on DOS!
1347 * src/system.h (setmode, fileno): Remove; no longer needed, we think.
1348 (SET_MODE, SET_BINARY, SET_BINARY2): Remove.
1349 [defined __DJGPP__]: Don't include <io.h> or <sys/exceptn.h>.
1350 * src/wc.c (wc_file): FILE might be null now.
1351 (main): Simplify code a bit, so that fewer places need the
1354 2005-07-09 Paul Eggert <eggert@cs.ucla.edu>
1356 * src/comm.c, src/csplit.c, src/dd.c, src/join.c, src/md5sum.c:
1357 * src/pr.c, src/sort.c, src/tee.c:
1358 Don't include stdio.h; no longer needed.
1360 2005-07-08 Paul Eggert <eggert@cs.ucla.edu>
1362 Fix porting problems reported by Eric Blake.
1364 * configure.ac: Remove check for AC_HEADER_TIOCGWINSZ.
1365 * src/cat.c, src/ls.c, src/stty.c: Include stropts.h if available,
1366 because POSIX says that's where ioctl is declared.
1367 * src/cat.c: Use HAVE_SYS_IOCTL_H instead of _POSIX_SOURCE
1368 to decide whether to include <sys/ioctl.h>.
1369 * src/stty.c: Use only HAVE_SYS_IOCTL_H to decide whether
1370 to include <sys/ioctl.h>.
1372 * src/id.c (print_user): Don't assume uid fits in unsigned int.
1373 (print_group): Likewise, for gid.
1375 2005-07-05 Paul Eggert <eggert@cs.ucla.edu>
1377 * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Generate a hard error
1378 (not just a warning) if GCC is used and the types don't match.
1380 2005-07-04 Paul Eggert <eggert@cs.ucla.edu>
1382 * src/system.h (VERIFY_W_TYPEOF): Remove; no longer needed.
1383 (DECIMAL_DIGIT_ACCUMULATE): Change last arg from T's maximum value
1384 to T itself. All callers changed. Check that T is unsigned, and
1385 that Accum is of type T. This fixes a bug in the unlikely case
1386 where SIZE_MAX <= INT_MAX, and it no longer requires typeof to do
1387 the proper validity checks.
1389 * src/od.c: Adjust to verify.h change.
1390 * src/system.h (VERIFY_W_TYPEOF): Likewise.
1392 2005-07-04 Jim Meyering <jim@meyering.net>
1394 * src/system.h: Include "verify.h".
1396 * src/system.h (verify): Rename from VERIFY_EXPR, to be lower case,
1397 like assert. Use sizeof, rather than equivalent ((...)0), for
1398 it's slightly simpler syntax. Suggestions from Paul Eggert.
1399 (verify_decl): Rename from VERIFY.
1400 * src/od.c: Reflect name change.
1402 2005-07-03 Jim Meyering <jim@meyering.net>
1404 * NEWS: cp and mv: the --reply=X option is deprecated
1405 Suggested by Bob Proulx, after numerous user complaints
1406 about how --reply=no appeared not to work.
1407 * src/mv.c (main): Using --reply now evokes a warning.
1408 (usage): Remove description of --reply.
1409 * src/cp.c (main): Using --reply now evokes a warning.
1410 (usage): Remove description of --reply.
1411 * tests/mv/i-link-no: Adjust for new diagnostic.
1412 * tests/mv/reply-no: Likewise.
1414 * src/printf.c (verify_numeric): Rename from verify.
1417 2005-07-03 Paul Eggert <eggert@cs.ucla.edu>
1419 * src/copy.h: Include "lstat.h" rather than rolling our own.
1420 * src/ls.c: Likewise.
1421 * src/remove.c: Likewise.
1423 2005-07-02 Paul Eggert <eggert@cs.ucla.edu>
1425 Cleanup to isolate "safer" functions to a small part of the code.
1426 * src/comm.c: Include stdio--.h, not stdio-safer.h.
1427 (compare_files): Use fopen, not fopen_safer.
1428 * src/copy.c: Include fcntl--.h, not unistd-safer.h.
1429 (copy_reg): Don't call fd_safer; no longer needed
1430 now that we include fcntl--.h.
1431 * src/csplit.c: Include fd-reopen.h.
1432 Include stdio--.h, not stdio-safer.h.
1433 (input_desc): Remove. All uses changed to STDIN_FILENO.
1434 (set_input_file): Reopen stdin, to simplify code.
1435 (create_output_file): Use fopen, not fopen_safer.
1436 * src/dd.c: Include fd-reopen.h.
1437 (open_fd): Remove. All callers changed to use fd_reopen instead.
1438 * src/join.c: Include stdio--.h, not stdio-safer.h.
1439 (main): Use fopen, not fopen_safer.
1440 * src/md5sum.c: Include stdio--.h.
1441 (digest_check): Don't try to read both checksums and data from stdin.
1442 * src/nohup.c: Include fd-reopen.h.
1443 Include unistd--.h, not unistd-safer.h.
1444 (main): Use fd_reopen to simplify code. When replacing stdin,
1445 use "/dev/null" not "/", as that's less likely to go wrong these days.
1446 (main): Use dup, not dup_safer.
1447 * src/pr.c: Include stdio--.h, not stdio-safer.h.
1448 (open_file): Invoke fopen, not fopen_safer.
1449 * src/shred.c: Include fcntl--.h, not unistd-safer.h.
1450 (wipename, wipe_file): Don't use fd_safer; no longer needed
1451 now that we include fcntl--.h.
1452 * src/sort.c: Include stdio--.h rather than stdio-safer.h.
1453 Include stdlib--.h. Do not include unistd-safer.h.
1454 (create_temp_file): Don't call fd_safer; no longer needed
1455 now that we include *--.h files.
1456 (xfopen): Don't call fopen_safer, for similar reasons.
1457 * src/split.c: Include fcntl--.h rather than unistd-safer.h.
1458 Include fd-reopen.h.
1459 (input_desc): Remove. All uses replaced by STDIN_FILENO.
1460 (cwrite): Don't call fd_safer; no longer needed now that
1461 we include fcntl--.h.
1462 (main): Reuse stdin rather than opening a new one. This
1463 saves a file descriptor.
1464 * src/stty.c: Include fd-reopen.h.
1465 (display_all, display_settings, display_window_size, set_window_size):
1466 Remove fd arg, since we now assume stdin. All callers changed.
1467 (main): Reuse stdin rather than opening a new one. This
1468 saves a file descriptor.
1469 * src/tac.c: Include stdlib--.h rather than unistd-safer.h.
1470 (copy_to_temp): Don't call fd_safer; no longer needed now
1471 that we include stdlib--.h.
1472 * src/tail.c: Include fcntl--.h, not unistd-safer.h.
1473 (recheck, tail_file): Don't call fd_safer; no longer needed
1474 now that we include fcntl--.h.
1475 * src/tee.c: Include stdio--.h, not stdio-safer.h.
1476 (tee): Don't call fopen_safer; no longer needed now that we
1478 * src/touch.c: Include fcntl--.h, not unistd-safer.h.
1479 (touch): Don't call fd_safer; no longer needed now that
1480 we include fcntl--.h.
1482 * src/du.c (main): Reuse stdin rather than opening a new stream.
1483 This saves a file descriptor.
1484 * src/uniq.c: Don't include stdio-safer.h; no longer needed.
1485 (writeline): Remove stream arg; we now always output to stdout.
1486 All callers changed.
1487 (check_file): Reuse stdout rather than opening a new stream.
1488 This saves a file descriptor.
1490 2005-07-02 Jim Meyering <jim@meyering.net>
1492 * Makefile.maint (sc_obsolete_symbols): New rule.
1493 (syntax-check-rules): Add it to the list.
1494 * Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols.
1495 * .x-sc_obsolete_symbols: New file.
1497 2005-07-01 Jim Meyering <jim@meyering.net>
1499 * src/system.h: Assume HAVE_FCNTL_H (i.e., include <fcntl.h>
1500 unconditionally, and don't include <sys/file.h>).
1501 * src/system.h: Likewise for HAVE_UNISTD_H.
1503 2005-06-30 Jim Meyering <jim@meyering.net>
1505 * src/cp.c: Add uses of ARGMATCH_VERIFY to ensure that
1506 corresponding option string and value arrays are consistent.
1507 * src/date.c: Likewise.
1508 * src/du.c: Likewise.
1509 * src/ls.c: Likewise.
1510 cp.c and date.c each had a harmless trailing `, 0' (now-removed)
1513 * src/system.h (VERIFY): Guard definition with #ifndef.
1514 (VERIFY_EXPR): Undef before defining.
1516 2005-06-29 Jim Meyering <jim@meyering.net>
1518 * src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
1519 * src/du.c (show_date): Likewise.
1520 * src/date.c (show_date): Likewise.
1521 * src/od.c (dump_strings): Likewise.
1522 * src/sort.c (fillbuf): Likewise.
1523 * src/chmod.c (main): Likewise.
1525 * src/system.h (VERIFY): Rewrite to use string-concatenation
1526 and __LINE__ so as not to require a struct name parameter.
1527 (GL_CONCAT, GL_CONCAT2): Define helper macros.
1528 * src/od.c: Update sole use.
1530 * src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
1531 when computing the --author column width. This bug might have
1532 resulted in misaligned columns when using the --author option
1533 on the Hurd. Spotted by Arnold Robbins.
1535 2005-06-28 Jim Meyering <jim@meyering.net>
1537 * src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
1538 not x2nrealloc. The former is a little more concise and readable.
1539 N.B. this sort of transformation is ok only when the base type is
1540 unlikely ever to change to a multibyte type.
1541 * src/du.c (show_date): Likewise.
1542 * src/date.c (show_date): Likewise.
1543 * src/od.c (dump_strings): Likewise.
1544 * src/sort.c (fillbuf): Likewise.
1546 2005-06-24 Jim Meyering <jim@meyering.net>
1548 * src/mv.c (usage): Clarify how --reply=no works.
1550 2005-06-23 Paul Eggert <eggert@cs.ucla.edu>
1552 Address the following "du" issues:
1554 - The option name "--last-time=TYPE" is different from the ls's option
1555 "--time=TYPE" with a similar meaning. I assume this wasn't intended.
1557 - --time-style implies --time, but this is not true for "ls". It's
1558 better to be consistent.
1560 - Since we don't have POSIX compatibility concerns, there's no need
1561 for the "posix-" styles, or for support of styles with newlines, or
1562 for the "locale" style, except for parsing the TIME_STYLE
1563 environment variable.
1565 - It's cleaner (and these days, no less efficient) to use functions
1566 rather than macros when possible.
1568 - struct duinfo doesn't need a 'valid' flag; you can simply use a time
1569 stamp that is less than all valid time stamps.
1571 - The code needs a bit of reformatting to fit the usual GNU style.
1573 * NEWS: du's --last-time option is now --time.
1574 * doc/coreutils.texi (ls invocation): Fix typo: --time=use is
1575 equivalent to --time=atime, not --time=ctime.
1576 (ls invocation, du invocation): Fix typo: --time-style=long-iso
1577 is equivalent to a time style with a leading "+".
1578 (du invocation): --last-time is now --time.
1579 --time-style no longer implies --time.
1580 The locale and posix- stuff now works only for TIME_STYLE, not
1581 for --time-style. Give equivalent format for --time-style=iso.
1582 * src/du.c: Do not include hard-locale.h.
1583 (struct duinfo): Remove 'valid' member. All uses changed to use
1584 negative nsec instead.
1585 (DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
1586 (duinfo_init, duinfo_set, duinfo_add): New functions, taking the
1587 role of the removed macros.
1588 (opt_time): Renamed from opt_last_time. All uses changed.
1589 (TIME_OPTION): Renamed from LAST_TIME_OPTION. All uses changed.
1590 (long_options, usage): Rename --last-time to --time.
1591 (locale_time_style): Remove.
1592 (time_style_args, time_style_types, usage): Remove support for
1593 --time-style=locale.
1594 (show_date): Now returns void, since nobody looked at the result.
1595 Assume FORMAT is not null. An empty FORMAT now outputs an empty time.
1596 Simplify nstrftime invocation.
1597 (main): Put in ls compatibility workarounds only for TIME_STYLE,
1598 not for --time-style. Omit unnecessary space in iso time style.
1600 2005-06-23 Jim Meyering <jim@meyering.net>
1602 * src/du.c (time_format): Add `const' attribute.
1604 * src/date.c (show_date): Use puts rather than printf ("%s\n",.
1606 * src/du.c (show_date): Rename local `time_format' so as not to
1607 shadow the file-scoped global by that name.
1608 (show_date): Add a FIXME comment.
1610 * src/du.c: Include hard-locale.h and strftime.h.
1611 (DUINFO_INI, DUINFO_SET, DUINFO_ADD):
1612 Enclose body in `do {...} while (0)', not just `{...}'.
1613 Adjust uses (add semicolons).
1614 Adjust formatting, indentation.
1615 (usage): Tweak formatting to maintain more or less constant indentation.
1617 2005-06-14 William Brendling <wbrendling@gmail.com>
1619 * src/du.c: Add --last-time and --time-style options.
1621 2005-06-22 Paul Eggert <eggert@cs.ucla.edu>
1623 * tests/umask-check: New file.
1624 * tests/Makefile.am (EXTRA_DIST): Add umask-check.
1625 * tests/mkdir/perm: Use umask-check.
1626 * tests/cp/cp-parents: Likewise, instead of using chmod
1627 as described below. Problem reported by Kevin Mudrick.
1629 2005-06-22 Jim Meyering <jim@meyering.net>
1631 Make rmdir produce diagnostics like this:
1632 rmdir: /tmp: Permission denied
1634 rmdir: `/tmp': Permission denied
1636 * src/rmdir.c: Include "quotearg.h", not "quote.h".
1637 (remove_parents, main): Use quotearg_colon, not quote.
1639 2005-06-22 Paul Eggert <eggert@cs.ucla.edu>
1641 * tests/cp/cp-parents: Use chmod to work around some hosts with
1642 ACL problems. Problem reported by Kevin Mudrick.
1644 2005-06-21 Jim Meyering <jim@meyering.net>
1646 * tests/du/deref-args: Use --apparent-size to avoid the vagaries
1647 of counting blocks. Kevin Mudrick reported that this test would
1648 fail on an nfs-mounted directory where attribute-caching is
1651 2005-06-19 Jim Meyering <jim@meyering.net>
1653 * src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
1655 * src/shred.c (usage): Use `file system', not `filesystem'.
1657 2005-06-18 Jim Meyering <jim@meyering.net>
1659 * src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
1661 2005-06-17 Jim Meyering <jim@meyering.net>
1663 * src/shred.c (usage): Clarify that shred works on an ext3 file
1664 system as long as it's not in data=journal mode.
1665 Tiny change by Mark Melahn.
1667 2005-06-16 Paul Eggert <eggert@cs.ucla.edu>
1669 * src/hostid.c (main): Don't print fewer than 8 digits, or spurious
1670 leading "f"s. "f" problem reported by Tim Waugh.
1671 * NEWS: Document this.
1673 2005-06-16 Jim Meyering <jim@meyering.net>
1675 Don't embed `this'-style quotes in format strings.
1676 * src/tr.c: Rather than this: error (..., "...`%s'...", arg);
1677 do this: error (..., "...%s...", quote (arg));
1678 * src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
1679 * src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
1680 * src/split.c, src/tail.c: Likewise.
1682 * src/sleep.c: Include "quote.h". Remove hard-coded quotes, as above.
1683 * src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
1684 * src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
1686 * src/mv.c: Finally remove support for --version-control=S (-V).
1687 It was deprecated nearly 6 years ago and has been warning
1688 users to switch to --backup=S since fileutils-4.0j.
1689 * src/cp.c, src/install.c, src/ln.c: Likewise.
1691 2005-06-15 Jim Meyering <jim@meyering.net>
1693 * src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
1694 * tests/install/basic-1: Ensure that each `-d'-specified directory
1695 is created. Ensure that rel-named dirs are not created when
1698 * tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
1700 2005-06-14 Paul Eggert <eggert@cs.ucla.edu>
1702 Improve diagnostics for restore_cwd failure.
1703 * src/install.c (main): Standardize on a diagnostic for
1704 restore_cwd failure, and report errno.
1705 (install_file_in_file_parents): Fail if restore_cwd fails and
1706 one of the files is relative. This fixes a bug (albeit unlikely).
1707 * src/mkdir.c (create_parents): Remove static var (now local to 'main').
1708 (main): Standardize on a diagnostic for restore_cwd failure,
1710 Don't bother to check cwd_errno unless create_parents.
1711 Use mkdir rather than make_dir; it's simpler.
1713 * src/install.c (main): Adjust to new make_dir_parents convention.
1714 * src/mkdir.c (main): Likewise.
1716 2005-06-14 Jim Meyering <jim@meyering.net>
1718 * tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
1719 is an absolute directory name.
1721 * Makefile.maint (my-distcheck): Add -Wall to the list of options that
1722 are used with -Werror. This target is not intended for general use.
1724 2005-06-13 Jim Meyering <jim@meyering.net>
1726 * src/mkdir.c (main): Give a diagnostic for -- and skip -- each
1727 relative directory name after make_dir_parents fails to restore
1728 the working directory. Before, `mkdir -p' could create directories
1729 in the wrong place in unusual circumstances.
1730 * src/install.c (main): Likewise.
1731 (install_file_in_file_parents): Update make_dir_parents caller.
1732 * tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
1733 * tests/mkdir/Makefile.am (TESTS): Add p-3.
1735 2005-06-10 Paul Eggert <eggert@cs.ucla.edu>
1737 Act on the Austin Group's response yesterday to XCU ERN 63; see
1738 <http://www.opengroup.org/austin/docs/austin_260.txt>.
1739 * NEWS: ls no longer outputs an extra space between mode and link count.
1740 * doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
1741 * src/ls.c (any_has_acl): New var.
1742 (clear_files): Clear it.
1743 (gobble_file): Set it if a file has an ACL.
1744 (print_long_format): Omit needless space unless some file has an ACL.
1746 2005-06-10 Jim Meyering <jim@meyering.net>
1748 * src/system.h (VERIFY_W_TYPEOF): Add parentheses.
1750 2005-06-02 Jim Meyering <jim@meyering.net>
1752 * src/sort.c (usage): Put `Ordering options:' line where it belongs.
1754 2005-06-01 Paul Eggert <eggert@cs.ucla.edu>
1756 Use "file name" when talking about file names, instead of "filename"
1757 or "path", as per the GNU coding standards.
1758 * src/basename.c: Don't use "path" or "filename".
1759 * src/copy.c: Likewise.
1760 * src/copy.h: Likewise.
1761 * src/cp-hash.c: Likewise.
1762 * src/cp.c: Likewise.
1763 * src/df.c: Likewise.
1764 * src/install.c: Likewise.
1765 * src/ls.c: Likewise.
1766 * src/pinky.c: Likewise.
1767 * src/pr.c: Likewise.
1768 * src/pwd.c: Likewise.
1769 * src/remove.c: Likewise.
1770 * src/rmdir.c: Likewise.
1771 * src/sort.c: Likewise.
1772 * src/system.h: Likewise.
1773 * src/tty.c: Likewise.
1774 * src/who.c: Likewise.
1775 * src/cp.c (parents_option): Renamed from flag_path. All uses changed.
1776 (make_dir_parents_private): Renamed from make_path_private.
1778 * src/cp.c (usage): Don't use "path" to describe a file name.
1779 * src/readlink.c (usage): Likewise.
1780 * src/rmdir.c (usage): Likewise.
1781 * src/df.c: Don't include "path-concat.h"; not needed.
1782 * src/install.c (install_file_in_file_parents): Renamed from
1783 install_file_to_path. All uses changed.
1784 * src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
1786 * src/ls.c (make_link_name): Renamed from make_link_path.
1788 * src/pwd.c (struct file_name): Renamed from struct Path.
1790 (file_name_free): Renamed from path_free. All uses changed.
1791 (file_name_init): Renamed from path_init. All uses changed.
1792 (file_name_prepend): Renamed from path_prepend. All uses changed.
1793 * src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
1795 (longopts): Add comment that --path is deprecated.
1797 2005-05-31 Jim Meyering <jim@meyering.net>
1799 * src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
1800 This is a crutch so that `make distcheck's sc_tight_scope rule
1801 knows that they really are deliberately declared that way.
1803 2005-05-30 Paul Eggert <eggert@cs.ucla.edu>
1805 Port to Solaris 10's rules for whether programs can chown files.
1806 * src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
1807 (DO_CHOWN): Remove. Replaced by chown_failure_ok. All callers
1809 (copy_internal): If chown failed, don't worry about what happened
1810 to the mode bits; they can't have changed.
1811 (chown_privileges, chown_failure_ok): New functions.
1812 * src/copy.h: Add copyright notice.
1813 (struct cp_options): Remove myeuid member. Add chown_privileges
1815 (chown_privileges, chown_failure_ok): New function decls.
1816 * src/cp.c (re_protect): Remove unnecessary call to geteuid.
1817 Use chown_failure_ok rather than our own code.
1818 * src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
1819 * src/install.c (cp_option_init): Likewise.
1820 * src/mv.c (cp_option_init): Likewise.
1822 2005-05-29 Paul Eggert <eggert@cs.ucla.edu>
1824 * src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
1825 * src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
1827 * src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
1828 * src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
1829 [!defined _POSIX_VERSION]: Remove decls.
1830 * src/install.c (getpwnam, getgrnam): Remove decl.
1831 (getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
1832 * src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
1833 (digest_file): Use O_BINARY-using expr instead of OPENOPTS.
1834 * src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
1835 * src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
1837 Don't include <sys/file.h>; no longer needed.
1838 (getegid, geteuid): Remove no-longer-necessary decls.
1840 * src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
1841 Define to 256, not 255, as per modern POSIX.
1843 2005-05-27 Paul Eggert <eggert@cs.ucla.edu>
1845 * NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
1846 * src/dd.c (skip): Return the number of records that were not
1847 skipped due to encountering EOF.
1848 (dd_copy): If the file wasn't seekable and EOF was encountered,
1849 write zeros past EOF until the desired offset is reached.
1851 * NEWS: expr and test now correctly compare integers of unlimited size.
1852 (Also, correct a comment that claimed that expr detects integer
1853 overflow; it does so only when converting from strings.)
1854 * src/expr.c: Include strnumcmp.h, xstrtol.h.
1855 (looks_like_integer): New function.
1856 (toarith): Use it. Also, use xstrtoimax rather than rolling our
1858 (eval2): Don't look for trouble if !evaluate; this simplifies things.
1859 Compare numbers using string comparison, so that overflow is
1861 * src/sort.c: Refactor so that others can use large-integer
1862 comparison functions.
1863 Include "strnumcmp.h".
1864 (NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
1865 Remove; moved to strnumcmp.
1866 (decimal_point): Now int, to simplify converison overhead with
1867 new API. All uses changed.
1868 (thousands_sep): Now -1 if there isn't one, as per new API.
1870 (numcompare): Move contents to strnumcmp module, except for
1872 * src/test.c: Include inttostr.h, strnumcmp.h.
1873 (whitespace, digit, digit_value, integer_expected_error): Remove.
1874 (is_int): Remove; replaced by...
1875 (find_int): New function.
1876 (binary_operator): Don't let integers overflow in comparisons;
1877 return the correct answer instead. Simplify the code.
1878 (unary_operator): Convert the integer ourself, since find_int
1880 * tests/expr/basic (bigcmp): New test.
1881 * tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
1883 2005-05-26 Paul Eggert <eggert@cs.ucla.edu>
1885 * NEWS: nohup now redirects a tty stdin to an unreadable fd
1886 instead of closing it.
1887 * doc/coreutils.texi (nohup invocation): Document this.
1888 * src/nohup.c (main): Implement this.
1890 2005-05-26 Jim Meyering <jim@meyering.net>
1892 * src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
1893 Reported by David Alan Gilbert.
1894 * tests/expr/basic: Add tests using arithmetic on negative integers.
1896 2005-05-19 Jim Meyering <jim@meyering.net>
1898 * src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
1899 Remove inaccurate-but-harmless `const' attributes.
1901 * src/join.c (decode_field_spec): Add an abort after
1902 `error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
1903 about variables being used uninitialized.
1905 2005-05-18 Paul Eggert <eggert@cs.ucla.edu>
1907 * configure.ac: Add copyright notice. gl_LIB_CHECK -> cu_LIB_CHECK.
1908 * src/Makefile.am: Add copyright notice.
1909 (factor_LDADD): Remove, as factor no longer needs sqrt.
1910 * src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
1911 it's always true now.
1913 2005-05-16 Paul Eggert <eggert@cs.ucla.edu>
1915 Fix Cygwin porting problem reported by Eric Blake.
1916 * src/remove.c (DT_IS_DIR): Remove.
1917 (DT_IS_KNOWN, DT_MUST_BE): New macros.
1918 (remove_entry): Use them.
1920 2005-05-14 Paul Eggert <eggert@cs.ucla.edu>
1922 * src/remove.c: Include unlinkdir.h.
1923 (UNLINK_CAN_UNLINK_DIRS): Remove.
1924 (remove_entry): Use cannot_unlink_dirs () rather than
1925 UNLINK_CAN_UNLINK_DIRS.
1927 2005-05-14 Jim Meyering <jim@meyering.net>
1929 Update FSF postal mail address.
1930 * Makefile.maint, Makefile.cfg, gnupload
1931 * src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
1932 * src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
1933 * src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
1934 * src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
1935 * src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
1936 * src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
1937 * src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
1938 * src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
1939 * src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
1940 * src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
1941 * src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
1942 * src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
1943 * src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
1944 * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
1945 * src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
1946 * src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
1947 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
1948 * src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
1949 * src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
1950 * src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
1951 * src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
1952 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
1954 2005-05-13 Jim Meyering <jim@meyering.net>
1956 * NEWS: `rm -r' now removes all of the files it should, even on
1957 systems with a buggy readdir affecting file systems inaccessible
1960 In some unusual circumstances `rm -r' would fail to remove --
1961 or even consider -- all entries in a directory with more than 254
1962 (SunOS) or 338 (Darwin) entries. This could cause trouble even on
1963 other types of systems when using an affected file system via e.g.,
1964 NFS. The underlying cause was a bug in readdir on those systems.
1965 Coreutils-5.2.1 and earlier used a configure-time test designed
1966 to detect precisely those problem systems, but it would detect
1967 the problem and enable remove.c's work-around code only when its
1968 configure-time test was run on a losing file system. Obviously,
1969 it couldn't detect a problem if the offending file system wasn't
1970 tested or even mounted at coreutils configure time. Now, rm itself
1971 performs a minimal-cost run-time test to detect the problem.
1973 * src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
1974 (remove_cwd_entries): When readdir returns NULL for a directory from
1975 which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
1976 entries, call rewinddir and then resume the readdir/unlink loop.
1977 (UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
1979 2005-05-12 Paul Eggert <eggert@cs.ucla.edu>
1981 * NEWS: nohup now closes stdin if it is a terminal, unless
1982 POSIXLY_CORRECT is set. This fixes a glitch noted by Wayne Pollock in
1983 <https://www.opengroup.org/sophocles/show_mail.tpl?
1984 source=L&listname=austin-group-l&id=8341>.
1985 * doc/coreutils.texi (nohup invocation): Document this.
1986 * src/nohup.c (main): Implement this.
1988 2005-05-12 Jim Meyering <jim@meyering.net>
1990 * src/date.c: Assume `free (NULL)' works.
1991 * src/dd.c: Likewise.
1992 * src/df.c:Likewise.
1993 * src/dircolors.c:Likewise.
1994 * src/head.c: Likewise.
1995 * src/ls.c: Likewise.
1996 * src/md5sum.c: Likewise.
1997 * src/pr.c: Likewise.
1998 * src/sort.c: Likewise.
2000 2005-05-10 Jim Meyering <jim@meyering.net>
2002 * tests/touch/not-owner: Skip this test if the user running it
2003 owns `/' or has write access to it.
2005 * src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
2006 This makes `mv -i --reply=no f1 f2' work as expected (in not
2007 performing the move operation). But note that specifying `-i'
2008 after `--reply=no' does *not* work.
2009 Tiny patch from Vlada Macek.
2011 * tests/mv/reply-no: New file. Test for the above fix.
2012 * tests/mv/Makefile.am (TESTS): Add reply-no.
2014 * tests/ls-2/tests: Don't print PATH to stderr.
2016 2005-05-08 Paul Eggert <eggert@cs.ucla.edu>
2018 * NEWS: cp, ln, mv, rm no longer discard white space when intepreting
2021 2005-05-06 Paul Eggert <eggert@cs.ucla.edu>
2023 * NEWS: dd has new iflag= and oflag= flags "binary" and "text".
2024 * src/dd.c (flags, usage): Add support for "binary" and "text".
2026 2005-05-04 Paul Eggert <eggert@cs.ucla.edu>
2028 * NEWS: chmod -w now complains if it differs from chmod a-w.
2029 * src/chmod.c: Include quotearg.h.
2030 (diagnose_surprises): New var.
2031 (process_file): Diagnose surprises. Simplify the logic a bit,
2033 (main): Prepare to diagnose surprises. Remove useless code for
2035 * tests/chmod/Makefile.am (TESTS): Add umask-x.
2036 * tests/chmod/umask-x: New file.
2038 2005-05-02 Paul Eggert <eggert@cs.ucla.edu>
2040 * NEWS: ls --indicator-style=directory renamed to ls
2041 --indicator-style=slash, to avoid confusion with ls --directory.
2042 * src/ls.c (usage): Likewise.
2043 (slash): Renamed from directory_only. All uses changed.
2045 2005-05-01 Paul Eggert <eggert@cs.ucla.edu>
2047 * NEWS: "chmod +1 foo" is now diagnosed.
2049 2005-04-29 Paul Eggert <eggert@cs.ucla.edu>
2051 * NEWS: ls -p now marks only directories. New option
2052 --indicator-style=directory equivalent to -p.
2053 * doc/coreutils.texi (ls invocation): Document this.
2054 Also, mention ">" is for doors.
2055 * src/ls.c (enum indicator_style): New constant directory_only,
2057 (indicator_style_args, indicator_style_types): Set it appropriately.
2058 (decode_switches, gobble_file, print_type_indicator):
2059 (length_of_file_name_and_frills):
2060 Implement the change described in NEWS.
2061 (decode_switches): Quote ">", too.
2062 (usage): Update to match the new behavior. Describe ">".
2063 * tests/ls/file-type: Test for new behavior. Omit -1 option.
2064 The "ls --color" test wasn't being checked; add a check for
2065 "ls --color=auto" instead.
2067 * tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
2068 * tests/misc/split-fail: Likewise.
2069 * tests/pr/Test.pm: Likewise.
2070 * tests/sort/Test.pm: Fix comment to match new behavior of "sort".
2071 * tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
2072 if they use file names starting with +.
2073 (test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
2074 * tests/uniq/Test.pm (tv, test_vector): Likewise.
2076 The following was partly derived from a tiny change by Eric Blake:
2077 * tests/misc/nice: Don't use 'set -'. It's not portable to strict
2078 POSIX 1003.1-2001 hosts. Also, don't set _POSIX2_VERSION.
2079 * tests/mkdir/perm: Don't use 'set -'. Simplify test construction.
2080 Work even if the underyling system attaches ACLs to new dirs.
2081 * tests/mv/part-hardlink: Don't use 'set -'.
2082 * tests/stty/row-col-1: Don't use 'set -'.
2084 2005-04-28 Paul Eggert <eggert@cs.ucla.edu>
2086 * NEWS: Document fixes described below.
2087 * src/chmod.c (change, umask_value): New static vars.
2088 (reference_file): Move this static var to inside "main".
2089 (process_file, process_files): Remove CHANGES arg; now taken from
2090 static var. All uses changed.
2091 (usage): Fix incorrect description of MODE operand.
2092 (main): For invalid mode usages, output a brief usage message.
2093 Adjust to new modechange API.
2094 * install.c (main): Adjust to new modechange API.
2095 Also, free the mode_change object when done.
2096 * mkdir.c (main): Likewise.
2097 * mkfifo.c (main): Likewise.
2098 * mknod.c (main): Likewise.
2099 * tests/chmod/equal-X: Check for =xX bug.
2100 * tests/chmod/equals: Check for =u bug.
2101 * tests/chmod/usage: Check for u+gr and ug,+x bugs.
2103 2005-04-26 Paul Eggert <eggert@cs.ucla.edu>
2105 Restore support for usages like "head -1" and "tail -1",
2106 even when conforming to POSIX 1003.1-2001.
2107 Fix bug with "POSIXLY_CORRECT=1 fold file -3".
2108 join now supports a NUL field separator, e.g., "join -t '\0'".
2109 join now detects and reports incompatible options, e.g.,
2111 * NEWS: Document this.
2112 * src/date.c: Remove posixver.h and its uses.
2113 (COMMON_SHORT_OPTIONS): Remove.
2114 (short_options): New constant.
2115 (short_options, usage): -I now always takes an optional arg.
2116 * src/expand.c: Remove posixver.h and its uses.
2117 (shortopts): New constant. -DIGIT now always takes an optional arg.
2118 (main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
2119 Don't complain about -DIGIT.
2120 * src/fold.c: Remove posixver.h and its uses.
2121 (shortopts): New constant. -DIGIT now always takes an optional arg.
2122 (main): Don't preprocess arg list; that was buggy. Use method
2124 * src/head.c: Remove posixver.h and its uses.
2125 (header_mode_option): Remove.
2126 (main): Don't complain about obsolete -NUM args.
2127 * src/join.c: Remove posixver.h and its uses.
2128 (obsolete_usage): Remove.
2129 (join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
2130 they haven't been set yet.
2131 (tab): Now int, not char. Initialize to -1 to indicate white space
2132 separates columns, so that we can use NUL as a separator.
2134 (OBSOLETE_LONG_OPTIONS, get_option): Remove.
2135 (string_to_join_field): Remove ERR_MSG_FMT arg; a single format
2136 suffices. Use xstrtoul for sizes; it suffices.
2137 (decode_field_spec): Report an error and exit on failure. Return void,
2139 (add_field_list): Likewise.
2140 (set_join_field): New function.
2141 (enum operand_status): New enum.
2142 (add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
2143 PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
2144 possibilities with obsolete option parsing.
2145 (main): Use it. Do not depend on POSIX version.
2146 Check for conflicting options. Parse obsolete options -j1 and -j2
2147 so that it is a pure extension to POSIX 1003.1-2001.
2148 Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
2149 * src/nice.c: Remove posixver.h and its uses.
2150 (main): Always support -NUM option.
2151 * src/od.c: Remove posixver.h and its uses.
2152 (short_options): New constant, which always supports -w[num].
2153 (COMMON_SHORT_OPTIONS): Remove.
2154 * src/pr.c: Remove posixver.h and its uses.
2155 (short_options): New constant, which always supports -S[string].
2156 (COMMON_SHORT_OPTIONS): Remove.
2157 * src/sort.c: Remove posixver.h and its uses.
2158 (short_options): New constant, which always supports -y arg.
2159 (COMMON_SHORT_OPTIONS): Remove.
2160 (main): Redo workaround for Solaris compatibility with -y.
2161 This change isn't visible to the user; it just cleans up the
2162 code so that we don't need posixver.h.
2163 * src/split.c: Remove posixver.h and its uses.
2164 (main): Don't complain about -NUM option.
2165 * src/tail.c (parse_obsolete_option): Don't complain about -NUM.
2166 * src/unexpand.c: Remove posixver.h and its uses.
2167 (main): Don't complain about -TAB.
2168 * src/uniq.c (main): Don't complain about -NUM.
2170 2005-04-22 Paul Eggert <eggert@cs.ucla.edu>
2172 * src/nohup.c (main): If getopt fails, exit with status 127,
2173 not status 1. POSIX requires this.
2174 * NEWS: Document this.
2176 * src/nice.c (main): Report proper program name when getopt finds
2177 trouble. Problem reported by Behdad Esfahbod.
2179 * NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
2180 when the "+x" was being evaluated.
2181 * mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
2182 * mkfifo.c (main): Likewise.
2183 * mknod.c (main): Likewise.
2184 * tests/mkdir/perm: Test for the above bug.
2186 2005-04-20 Paul Eggert <eggert@cs.ucla.edu>
2188 Port test cases to Microsoft-Windows-related environments,
2189 following suggestions from Eric Blake.
2190 * tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
2191 * tests/install/basic-1: Undo previous change.
2192 (dd, dd2): New vars, which use $EXEEXT. All uses of dd and dd2 changed.
2193 * tests/install/trap: Undo previous change.
2194 (sig): New var. Use it insted of "trap '' CHLD".
2195 Append $EXEEXT to executable name.
2197 "fetish" -> "coreutils" in more places.
2198 * tests/Coreutils.pm: Renamed from tests/Fetish.pm.
2199 (package Coreutils): Renamed from package Fetish. All uses changed.
2200 * tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
2203 2005-04-19 Paul Eggert <eggert@cs.ucla.edu>
2205 * tests/mv/setup (dot_mount_point): Use stat -L, in case the
2206 directory is actually a symbolic link. Problem reported by
2209 * tests/mv/mv-special-1: Use test -p to test for fifos, rather
2210 than the (incorrect) test -f and the (inadequate) ls. ls is
2211 inadequate because on some hosts a buggy mv will create a file of
2212 the wrong type (problem reported by Eric Blake). Skip this test
2213 if test -p doesn't work.
2215 * tests/chmod/setgid: Use numeric group ids, not symbolic group names,
2216 since the latter can have shell metacharacters in them (e.g., spaces).
2217 This follows up to the 2005-01-17 patch, which missed this occurrence.
2219 2005-04-18 Paul Eggert <eggert@cs.ucla.edu>
2221 "fetish" -> "coreutils" in several places.
2222 * Makefile.cfg (ftp): Remove fetish.sf.net.
2223 * Makefile.maint (emit_upload_commands): Likewise.
2224 * src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
2225 * tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
2226 * tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
2228 * tests/install/basic-1: Use "cat", not "test", to test for
2229 ../../src/dd. Problem reported by Eric Blake.
2231 2005-04-18 Jim Meyering <jim@meyering.net>
2233 * src/dd.c: Don't include stat-macros.h directly. system.h does that.
2235 2005-04-17 Paul Eggert <eggert@cs.ucla.edu>
2237 Work around a couple of "make check" failures reported for Cygwin
2238 and ash by Eric Blake.
2239 * tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
2240 * tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
2242 2005-04-16 Jim Meyering <jim@meyering.net>
2244 * src/dd.c (S_TYPEISSHM): Remove definition.
2245 Get the definition by including "stat-macros.h", instead.
2247 2005-04-14 Paul Eggert <eggert@cs.ucla.edu>
2249 Fix test suite problems reported by Eric Blake on Cygwin.
2250 * tests/mv/mv-special-1: Ignore chatter about when files are removed,
2251 since POSIX doesn't require rename to fail across file systems.
2252 * tests/mv/setup (dot_mount_point): Use stat rather than df, as
2254 (other_partition_tmpdir): Remove df from name as that would be
2257 2005-04-14 Jim Meyering <jim@meyering.net>
2259 * src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
2261 2005-04-12 Paul Eggert <eggert@cs.ucla.edu>
2263 * src/ls.c (usage): "uid" -> "user ID".
2265 2005-04-12 Jim Meyering <jim@meyering.net>
2267 * src/tsort.c (tsort): Use "%s" as the format string,
2268 rather than a diagnostic or a file name.
2270 * src/comm.c (compare_files): Remove declaration of unused local.
2272 * src/chown-core.c (chopt_free): Mark parameter as unused.
2274 2005-04-11 Paul Eggert <eggert@cs.ucla.edu>
2276 * man/chown.x: Reword to match user manual.
2277 * man/id.x: Likewise.
2278 * src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
2280 * src/whoami.c (usage, main): Likewise.
2282 Add bulletproofing for cases where stdin, stdout, or stderr are closed.
2283 * src/comm.c: Include stdio-safer.h.
2284 (compare_files): Exit right away on I/O error rather than continuing
2285 and producing confusing output and error messages.
2286 Return void, not int; all callers changed.
2287 Use fopen_safer to avoid confusion with file descriptors.
2288 * src/copy.c: Include unistd-safer.h.
2289 (copy_reg): Use fd_safer.
2290 * src/csplit.c: Include stdio-safer.h.
2291 (input_desc): Remove unnecessary static initialization.
2292 (set_input_file): Use STDIN_FILENO, not 0.
2293 (create_output_file): Use fopen_safer.
2294 * src/dircolors.c (dc_parse_file): Don't assume fopen does not
2296 * src/head.c (head_file): Don't assume open does not return 0.
2297 * src/join.c: Include stdio-safer.h.
2298 (main): Use fopen_safer. Simplify the resulting code.
2299 * src/md5sum.c (digest_file, digest_check):
2300 Don't assume that fopen does not return stdin.
2301 * src/nohup.c: Include unistd-safer.h.
2302 (main): Don't dup stderr to stdin or stdout by mistake.
2303 * src/od.c (check_and_close): Don't assume fopen does not return stdin.
2304 * src/paste.c (paste_serial): Likewise.
2305 * src/pr.c: Include stdio-safer.h.
2306 (open_file): Use fopen_safer.
2307 (close_file): Don't assume fopen does not return stdin.
2308 * src/ptx.c (main): Don't assume fopen returns stdout after closing
2309 stdout. Use freopen instead.
2310 * src/shred.c: Include unistd-safer.h.
2311 (wipename): Use fd_safer on directory file descriptor.
2312 (wipefile): Remove special case for /dev/fd/* on older hosts.
2313 It didn't work in general, and wasn't documented.
2315 * src/sort.c: Include unistd-safer.h.
2316 (create_temp_file): Use fd_safer.
2317 (xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
2318 * src/split.c: Include unistd-safer.h.
2319 (cwrite): Use fd_safer. Replace mystery constant 0666 with symbolic
2320 version, as POSIX requires.
2321 * src/sum.c (bsd_sum_file, sysv_sym_file):
2322 Use same pattern as elsewhere for checking for stdin.
2323 * src/tac.c: Include unistd-safer.h.
2324 (copy_to_temp): Use fd_safer.
2325 (tac_file): Don't assume fopen cannot return stdin.
2326 * src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
2327 (recheck, tail_file): Use fd_safer rather than open_safer.
2328 * src/tee.c: Include stdio-safer.h.
2329 (tee): Use fopen_safer.
2330 * src/touch.c: Include unistd-safer.h.
2331 (touch): Use fd_safer.
2332 * src/tsort.c (have_read_stdin): Remove; no longer needed. All uses
2334 (tsort): Do not assume fopen can't return stdin.
2335 Close stdin before returning. All uses changed.
2336 * src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
2337 * src/uniq.c: Include stdio_safer.h.
2338 (check_file): Don't assume fopen cannot return stdin or stdout.
2340 2005-04-09 Jim Meyering <jim@meyering.net>
2342 * src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
2344 Now that close_stdout closes standard output unconditionally,
2345 these workarounds for dd and cat are no longer necessary.
2346 * src/dd.c (close_stdout_wrapper): Remove function.
2347 (main): Call atexit with close_stdout, instead.
2348 * src/cat.c (close_stdout_wrapper): Likewise.
2349 Don't close STDOUT_FILENO explicitly; close_stdout does it.
2351 * src/system.h (__attribute__): Readability nit:
2353 # define __attribute__(x)
2355 # define __attribute__(x) /* empty */
2357 2005-04-09 Jim Meyering <jim@meyering.net>
2359 * src/rm.c (usage): Mention that --recursive removes listed
2360 directories too, not just their contents.
2361 Say that by default, rm does not remove directories.
2363 * src/pr.c: Don't include "timespec.h". system.h does that.
2364 * Makefile.maint (sc_system_h_headers): Propagate exit status
2367 2005-04-08 Paul Eggert <eggert@cs.ucla.edu>
2369 * NEWS: Document that dd no longer treats QUIT or PIPE specially,
2370 and when conforming to POSIX no longer treats USR1 specially.
2371 Document that dd no longer dumps core when handling signals.
2372 * src/system.h (RETSIGTYPE): Remove; no longer needed. All uses
2374 * src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
2376 (siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
2377 (delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
2378 behavior when called from a signal handler. All uses changed.
2379 (main) [!defined SA_NOCLDSTOP]:
2380 Use siginterrupt to specify that system calls should be interrupted.
2381 * src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
2382 (process_signals): Add forward decl.
2383 (SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
2385 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
2386 (SA_NODEFER) [!defined SA_NODEFER]: New macro.
2387 (SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
2388 (caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
2390 (usage): Mention -USR1 versus -INFO.
2391 (cleanup): Don't invoke print_stats; the caller must do it now.
2392 All callers changed.
2393 (quit): Process signals just before exiting.
2394 (interrupt_handler): Simply record the signal and return.
2395 (siginfo_handler): Simply increment the signal counter and return.
2396 (install_handler): Remove, replacing with:
2397 (install_signal_handlers, process_signals, iread, iwrite):
2398 New functions. All callers to safe_read and full_write replaced
2399 by iread and iwrite. All callers to install_handler replaced by
2401 * src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
2403 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
2404 (main) [! SA_NOCLDSTOP]: Use it.
2405 * src/shred.c: Remove all uses of signals; modern hosts have
2406 /dev/random and don't need this gorp.
2407 Do not include signal.h.
2408 (env, sigill_handler, isaac_seed_machdep): Remove. All uses removed.
2409 * src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
2411 (siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
2412 (main) [! SA_NOCLDSTOP]: Use it.
2414 * src/dd.c: Do not include inttostr.h, no longer needed.
2415 (print_stats, main): Rewrite and simplify formats to use PRIuMAX
2416 instead of umaxtostr.
2417 (print_stats): Work even in languages that have special
2418 forms for two of things, for r_truncate and w_bytes. We can't
2419 fix delta_s in this way, since ngettext doesn't support floating-point.
2420 (main): Rewrite to avoid casts.
2422 2005-04-07 Jim Meyering <jim@meyering.net>
2424 Placate gcc-4's -Wuninitialized.
2425 * src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
2426 * src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
2428 * src/test.c (is_int, age_of, binop): Declare `char *' parameters to
2430 (binop): Move function definition to precede first use so we can...
2431 (binop): ...remove prototype.
2433 2005-04-05 Paul Eggert <eggert@cs.ucla.edu>
2435 * man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
2436 * src/basename.c (usage): Add examples.
2437 * src/cat.c (usage): Likewise.
2438 * src/chgrp.c (usage): Likewise.
2439 * src/chown.c (usage): Likewise.
2440 * src/dirname.c (usage): Likewise.
2442 2005-04-05 Jim Meyering <jim@meyering.net>
2444 * src/nice.c (usage): Mention that some shells provide a
2445 built-in function by the same name.
2446 * src/nohup.c (usage): Likewise.
2447 * src/printenv.c (usage):Likewise.
2449 2005-04-04 Dmitry V. Levin <ldv@altlinux.org>
2451 * src/tee.c (tee): When closing files, do not close stdout,
2452 leave this job to close_stdout() instead.
2453 * configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
2454 * tests/Makefile.am (SUBDIRS): Add tee.
2455 * tests/tee/Makefile.am: New file.
2456 * tests/tee/.cvsignore: Likewise.
2457 * tests/tee/{basic,dash}: New tee tests.
2459 2005-04-04 Jim Meyering <jim@meyering.net>
2461 * src/echo.c (usage): Mention that some shells provide a
2462 built-in function by the same name.
2463 * src/kill.c (usage): Likewise
2464 * src/printf.c (usage): Likewise.
2465 * src/pwd.c (usage): Likewise.
2466 * src/stat.c (usage): Likewise.
2467 * src/test.c (usage): Likewise.
2468 * src/true.c (usage):
2469 * src/system.h (USAGE_BUILTIN_WARNING): New macro.
2471 * man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
2472 * man/printf.x: Likewise.
2473 * man/pwd.x: Likewise.
2475 2005-04-03 Jim Meyering <jim@meyering.net>
2477 * src/pr.c (main): Fix off-by-one error.
2478 pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
2479 end of a malloc'd buffer.
2481 2005-04-01 Jim Meyering <jim@meyering.net>
2483 * src/pr.c (main): Free column_count_string when done with it.
2485 Don't let pr treat +1:-1 like +1:18446744073709551615.
2486 * src/pr.c (strtoumax): Remove declaration.
2487 (first_last_page): Use xstrtoumax in place of strtoumax,
2488 so we don't interpret a negative page number (e.g., in an option
2489 like --pages=1:-1) as valid.
2490 * tests/pr/Test.pm (neg-page): Add a test for this.
2492 2005-03-30 Paul Eggert <eggert@cs.ucla.edu>
2494 * src/pinky.c (short_pinky): Adjust to read_utmp signature change.
2495 * src/uptime.c (uptime): New arg OPTIONS. All uses changed.
2496 * src/users.c (users): Likewise.
2497 * src/who.c (who): Likewise.
2498 * src/uptime.c (main): Check PIDs when invoked with zero arguments.
2499 * src/users.c (main): Likewise.
2500 * src/who.c (main): Likewise. Also with two arguments.
2501 Omit duplicate code in 2-arg case.
2502 (UT_PID): Moved to ../lib/readutmp.h.
2504 2005-03-29 Jim Meyering <jim@meyering.net>
2506 * src/system.h (ptr_align): Declare `ptr' parameter to be a
2507 `const' pointer, since this function never writes through it.
2509 * src/uname.c: Indent cpp directives to reflect nesting.
2511 2005-03-28 Jim Meyering <jim@meyering.net>
2513 * src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
2514 Add `void' to make this an ANSI-style function declaration.
2515 * src/remove.c (ds_init): Likewise.
2516 * src/pr.c (print_sep_string): Likewise.
2518 * src/stty.c (speeds): Declare this array to be static.
2519 * src/Makefile.am (sc_tight_scope): Adjust to catch any
2520 new declarations like that of stty.c's `speeds'.
2522 * src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
2523 (GETOPT_VERSION_OPTION_DECL): Likewise.
2524 * src/chown.c (long_options): Likewise.
2525 * src/chgrp.c (long_options): Likewise.
2526 * src/chmod.c (long_options): Likewise.
2527 * src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
2529 * src/chown-core.c (chopt_init): Likewise.
2530 * src/comm.c (long_options): Likewise.
2531 * src/copy.c (copy_reg): Likewise.
2532 * src/csplit.c (extract_regexp): Likewise.
2533 * src/cut.c (longopts): Likewise.
2534 * src/date.c (time_spec_string): Likewise.
2535 * src/df.c (find_mount_point, show_point): Likewise.
2536 * src/expr.c (docolon): Likewise.
2537 * src/fmt.c (long_options): Likewise.
2538 * src/ls.c (time_style_args, indicator_style_args, long_options)
2539 (format_args, sort_args, time_args, decode_switches)
2540 (gobble_file): Likewise.
2541 * src/md5sum.c (long_options): Likewise.
2542 * src/mv.c (reply_args): Likewise.
2543 * src/paste.c (longopts): Likewise.
2544 * src/pinky.c (print_entry): Likewise.
2545 * src/pr.c (long_options): Likewise.
2546 * src/ptx.c (long_options, format_args): Likewise.
2547 * src/readlink.c (longopts): Likewise.
2548 * src/sort.c (long_options, mergefps): Likewise.
2549 * src/stat.c (long_options): Likewise.
2550 * src/tac.c (main): Likewise.
2551 * src/tail.c (follow_mode_string): Likewise.
2552 * src/touch.c (longopts, time_args): Likewise.
2553 * src/uniq.c (delimit_method_string): Likewise.
2554 * src/uptime.c (print_uptime): Likewise.
2555 * src/who.c (print_user): Likewise.
2557 2005-03-27 Jim Meyering <jim@meyering.net>
2559 * src/dcgen: Simplify further, clean up.
2560 Add a standard-output-closing global destructor.
2562 * src/wheel-gen.pl: Use the same global destructor as dcgen.
2564 2005-03-26 Paul Eggert <eggert@cs.ucla.edu>
2566 * src/dcgen: Squeeze multiple blanks into one. Output a simple
2567 array of adjacent strings rather than a more complicated data
2568 structure; this saves space in the dircolors executable.
2569 * src/dircolors.c (parse_line): Use char *, not unsigned char *.
2571 (dc_parse_stream, main): Avoid casts.
2572 Adjust to simpler data structure generated by new dcgen.
2574 2005-03-25 Eric Blake <ebb9@byu.net> (tiny change)
2576 * src/ls.c (usage): Document usage of LS_COLORS.
2578 2005-03-25 Paul Eggert <eggert@cs.ucla.edu>
2580 * src/dircolors.hin: Add "TERM cygwin".
2582 2005-03-25 Jim Meyering <jim@meyering.net>
2584 * src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
2585 the return value, and update callers:
2586 * src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
2587 * src/expand.c (parse_tab_stops, main): Likewise.
2588 * src/split.c (main): Likewise.
2589 * src/unexpand.c (parse_tab_stops, main): Likewise.
2590 * src/uniq.c (main): Likewise.
2592 2005-03-22 Jim Meyering <jim@meyering.net>
2594 * build-aux: New directory. Renamed from config.
2595 * configure.ac: Reflect renaming: config -> build-aux.
2596 * Makefile.am (dist-hook): Likewise.
2597 * Makefile.maint: Likewise.
2598 * Makefile.cfg (cvs_files): Likewise.
2599 * .x-sc_sun_os_names: Likewise.
2600 * .x-sc_trailing_blank: Likewise.
2602 * src/ls.c (get_funky_string): Use '\a', rather than 7, for
2603 portability to EBCDIC hosts.
2605 2005-03-20 Jim Meyering <jim@meyering.net>
2607 * src/pr.c (init_header): Add missing `%' in new format string.
2608 (init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
2610 2005-03-19 Jim Meyering <jim@meyering.net>
2612 * src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
2613 $(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
2615 2005-03-18 Paul Eggert <eggert@cs.ucla.edu>
2617 * NEWS: pr -D "FORMAT" now accepts the same formats that
2618 date +"FORMAT" does.
2619 * src/pr.c: Include strftime.h, timespec.h.
2620 (init_header): Obtain and format nanosecond part of time stamp.
2622 * NEWS: nohup now ignores the umask when creating nohup.out.
2623 nohup now closes stderr if it is a terminal and stdout is closed.
2624 * src/nohup.c (main): Likewise. Be a little more paranoid about
2625 return values; e.g., check for any negative return from open.
2626 Assume free (NULL) works.
2627 Close file descriptor leak when redirecting standard output to a file.
2629 2005-03-17 Jim Meyering <jim@meyering.net>
2631 * src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
2632 in place of functionally-equivalent code.
2633 * src/expand.c (parse_tab_stops, main): Likewise.
2634 * src/split.c (main): Likewise.
2635 * src/unexpand.c (parse_tab_stops, main): Likewise.
2636 * src/uniq.c (main): Likewise.
2637 * src/od.c: Use VERIFY macro in place of an equivalent open-coded
2639 * src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
2642 Before, this command would make uniq skip 11 fields and print
2643 only the first line:
2644 $ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
2647 * src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
2648 not like `uniq -f11'.
2650 2005-03-15 Jim Meyering <jim@meyering.net>
2652 Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
2653 `pr -0' should give a better diagnostic and `pr -03' should be
2654 equivalent to `pr -3'.
2655 * src/pr.c (parse_column_count): Change return type to void.
2656 Call error (EXIT_FAILURE, ... for an invalid string.
2657 (main): Allocate space for column_count_string using malloc.
2658 Accumulate all old-style column-count digits before converting.
2659 When the number of columns is specified via both old-style,
2660 (e.g., -3), and a long option (--columns=5), ensure that only
2661 the last one specified takes effect.
2662 * tests/pr/Test.pm: Add tests for the above.
2664 2005-03-15 Corinna Vinschen <corinna@vinschen.de> (tiny change)
2666 * src/copy.c (copy_reg): Copy regular files in binary mode.
2668 2005-03-14 Paul Eggert <eggert@cs.ucla.edu>
2670 * NEWS: Restate why ls limits time stamp lengths.
2672 2005-03-12 Jim Meyering <jim@meyering.net>
2674 Add a little infrastructure to help prevent future bugs like the
2676 * src/stat.c (xstrcat): New function.
2677 (print_statfs, print_stat): Add buf_len parameter and convert all
2678 uses of strcat to xstrcat. Update callers.
2679 (print_it): Call print_func with buf_len parameter.
2681 Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
2682 could cause a buffer overrun error.
2683 * src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
2684 conversion of the stat %s format string to the longer printf %llu one.
2685 Patch from Guochun Shi.
2687 2005-03-11 Paul Eggert <eggert@cs.ucla.edu>
2689 * src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
2690 (long_time_expected_width, print_long_format): Use it, to avoid
2691 some possible denial-of-service attacks.
2692 * NEWS: Document this.
2694 2005-03-11 Jim Meyering <jim@meyering.net>
2696 Prompt once again for `mv -i A B' when A and B are hard links
2697 to the same file. This fixes a bug introduced by my 2003-04-04
2698 (coreutils-5.0.1) change. Reported by Thomas Wolff via Eric Blake.
2699 * src/copy.c (abandon_move): New function, factored out of
2700 copy_internal, now that this code is being used from two places.
2701 (copy_internal): Perform the same interactive-related test for
2702 whether it's alright to proceed and (usually) overwrite the
2704 * tests/mv/i-4: Add tests for the above.
2706 Don't segfault for a very long date format string, e.g.,
2707 ls -ld --time-style=+%99999999H .
2708 * src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
2709 so format string abuse cannot provoke stack overflow.
2710 (print_long_format): Likewise.
2712 Don't segfault for a long header date string, e.g.,
2713 echo a|pr -D +%9999999A
2714 * src/pr.c (init_header): Use x2nrealloc, rather than alloca.
2715 Don't bother with fixed-sized initial buffer; always use x*alloc.
2717 * src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
2718 in place of equivalent INT_STRLEN_BOUND + 1.
2719 * src/expr.c (tostring, printv): Likewise.
2721 2005-03-09 Paul Eggert <eggert@cs.ucla.edu>
2723 * src/system.h: Include intprops.h.
2724 (TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
2725 they are now defined in intprops.h.
2727 2005-03-09 Jim Meyering <jim@meyering.net>
2729 * TODO: Remove entry about named pipes. It was fixed in 5.3.0.
2731 2005-03-08 Paul Eggert <eggert@cs.ucla.edu>
2733 * src/date.c (usage): Redo to match recent documentation changes.
2734 Don't bother documenting which usages are GNU extensions; the list
2735 wasn't correct, and is better left to the printed manual anyway.
2737 2005-03-06 Jim Meyering <jim@meyering.net>
2739 Factor out column-count processing.
2740 * src/pr.c: Include "inttostr.h".
2741 (parse_column_count): New function.
2742 (main): Use the new function for both old-style, -9, and long,
2743 --columns=-9, options.
2745 * src/cksum.c: Remove `register' keyword.
2746 * src/cut.c: Likewise.
2747 * src/dd.c: Likewise.
2748 * src/env.c: Likewise.
2749 * src/factor.c: Likewise.
2750 * src/fmt.c: Likewise.
2751 * src/fold.c: Likewise.
2752 * src/id.c: Likewise.
2753 * src/logname.c: Likewise.
2754 * src/ls.c: Likewise.
2755 * src/pr.c: Likewise.
2756 * src/printf.c: Likewise.
2757 * src/shred.c: Likewise.
2758 * src/sort.c: Likewise.
2759 * src/sum.c: Likewise.
2760 * src/test.c: Likewise.
2761 * src/tsort.c: Likewise.
2762 * src/uniq.c: Likewise.
2763 * src/wc.c: Likewise.
2764 * src/whoami.c: Likewise.
2766 2005-03-01 Paul Eggert <eggert@cs.ucla.edu>
2768 * src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
2771 2005-03-01 Jim Meyering <jim@meyering.net>
2773 * src/copy.c (copy_internal): Change test of source type from
2774 !S_ISREG to S_ISLNK. Reported by Paul Eggert in
2775 http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
2777 2005-02-28 Jim Meyering <jim@meyering.net>
2779 * NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
2781 2005-02-21 Paul Eggert <eggert@cs.ucla.edu>
2783 * src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
2784 (nanosec_libs): Add $(LIB_XNANOSLEEP). Needed for newer GNU/Linux
2785 hosts with clock_gettime.
2787 2005-02-20 Paul Eggert <eggert@cs.ucla.edu>
2789 * NEWS: Describe user-visible change to dd.
2790 * src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
2791 Remove $(LIB_CLOCK_GETTIME). These functions now use
2793 * src/dd.c: Include gethrxtime.h, xtime.h.
2794 (start_time): Now of type xtime_t, not struct timespec.
2795 (print_stats, main): Use gethrxtime rather than gettime.
2796 * src/ls.c (time): Remove obsolete decl.
2797 (get_current_time): gettimeofday always returns 0, so don't
2799 * src/shred.c: Include gethrxtime.h.
2800 (isaac_seed): Use gethrxtime rather than a mishmash.
2801 * src/touch.c (time): Remove obsolete decl.
2803 * tests/misc/split-fail: Don't assume that the current host
2804 supports integers wider than 32 bits. Fix comment typo.
2805 * tests/od/x8: Likewise.
2807 * src/chown-core.c (enum RCH_status): Remove trailing comma,
2808 as it's not valid in standard C89.
2810 2005-02-15 Jim Meyering <jim@meyering.net>
2812 * src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
2813 so that file systems of type `xfs' are recognized as such.
2814 * src/fs.h: Regenerate.
2815 Reported by Bernd Eckenfels.
2816 * src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
2817 * src/fs.h: Regenerate.
2818 Reported by Andreas Schwab.
2820 * src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
2821 to work around the invalid definition from Darwin 7.7.0.
2822 Test failure reported by Sébastien Maret.
2824 2005-02-14 Paul Eggert <eggert@cs.ucla.edu>
2826 * src/sort.c (mergefps): Use binary search rather than linear one
2827 when comparing new line to lines already in main memory.
2828 Idea suggested by James Lemley.
2830 2005-02-09 Jim Meyering <jim@meyering.net>
2832 * src/copy.c (valid_options): Add an assertion that
2833 not both hard_link and symbolic_link are set.
2835 2005-02-08 Paul Eggert <eggert@cs.ucla.edu>
2837 * NEWS: Document stat -f -c %S, plus changes to default formats.
2838 * doc/coreutils.texi (stat invocation): Normalize terminology,
2839 capitalization, and sort order to match --help output. Mention %c
2840 for file systems. Add new -f -c format %S, and document %s versus %S;
2841 problem reported by Jeroen van Wolffelaar.
2842 * src/stat.c (usage): Likewise.
2843 (STATFS_FRSIZE): New macro.
2844 (print_statfs): Use it, for stat -f -c %S.
2845 (do_statfs): Change default formats to output %S.
2847 2005-02-03 Paul Eggert <eggert@cs.ucla.edu>
2849 * src/system.h: Include "memrchr.h".
2850 (memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
2852 2005-02-02 Jim Meyering <jim@meyering.net>
2854 * tests/du/8gb: Also adjust the test (s/64/128/) to detect
2855 systems that don't support sparse files.
2856 Check for $2 -ge 128, rather than $2 = 128, in case
2857 there is a file system type that doesn't support sparse files,
2858 yet for which metadata takes up additional space.
2859 Both reported by Andreas Schwab.
2861 2005-02-01 Eric Blake <ebb9@byu.net> (tiny change)
2863 * tests/du/8gb: Create a larger test file, so we properly
2864 detect that sparse files can be created on NTFS under cygwin.
2866 2005-01-30 Jim Meyering <jim@meyering.net>
2868 * src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
2870 * src/stty.c: Remove unnecessary parentheses in all #if directives.
2872 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
2874 * .cvsignore: Ignore config.cache and config.status.lineno.
2875 * src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
2876 instead of VSWTCH, for use with CSWTCH.
2878 2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
2880 * tests/Makefile.am (.PHONY): Add check-root and root-hint.
2881 * tests/rwx-to-mode: Ignore ACL designation.
2882 * tests/setgid-check: Likewise.
2883 * tests/chown/separator: Quote user and group names.
2885 2005-01-24 Jim Meyering <jim@meyering.net>
2887 * src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
2888 Suggestion from Johan Boule.
2890 2005-01-17 Eric Blake <ebb9@byu.net> (tiny change)
2892 * src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
2894 * man/Makefile.am (all_programs): Revert previous patch; updated
2895 all_programs.list fixes this.
2896 (.x.1): No need to add $(EXEEXT).
2898 2005-01-03 Corinna Vinschen <corinna@vinschen.de> (tiny change)
2900 * src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
2903 2005-01-22 Jim Meyering <jim@meyering.net>
2905 * Makefile.maint (v_etc_file): The version string has moved to
2906 version-etc-fsf.c, search that new file, not version-etc.c.
2908 2005-01-17 Paul Eggert <eggert@cs.ucla.edu>
2910 * tests/group-names: Use numeric group ids, not symbolic group names,
2911 since the latter can have shell metacharacters in them (e.g., spaces).
2912 Problem reported by Eric Blake.
2913 * tests/chgrp/basic: Assume groups are numeric, not symbolic.
2914 * tests/chgrp/deref: Likewise.
2915 * tests/chgrp/posix-H: Likewise.
2916 * tests/chgrp/recurse: Likewise.
2918 2005-01-15 Jim Meyering <jim@meyering.net>
2920 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
2921 because just calling gethrtime evokes an `illegal instruction'
2922 failure when compiled with Sun's c89 on Solaris 8 and 9.
2923 Reported by Nelson Beebe.
2925 * src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
2926 twice with the same value of `t'.
2927 Replace nested #if-#else blocks with #if-#elif-#elif chain.
2929 2005-01-14 Jim Meyering <jim@meyering.net>
2931 The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
2932 * src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
2933 sockets, since that's what you get when reading from a command-line-
2934 supplied pipe on Darwin 7.7.
2935 (IS_PIPE_LIKE_FILE_TYPE): Define.
2936 (main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
2937 Reported by Nelson Beebe.
2938 This same change is also required on NetBSD/sparc-1.5.
2939 Reported by Adrian Bunk.
2941 * src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
2942 rather than suffering silently.
2943 Before, expr would silently overflow and wrap around:
2944 $ expr 9223372036854775808 = 0 # $(echo 2^63|bc)
2946 Now it detects the problem and exits nonzero:
2947 $ ./expr $(echo 2^63|bc) = 0
2948 ./expr: 9223372036854775808: integer is too large
2950 * tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
2951 failure, so that doesn't cause `make check' to stop. Nelson Beebe
2952 reported that this test would fail with the diagnostic,
2953 `cannot find name for group ID 10', on one of his systems.
2955 2005-01-13 Jim Meyering <jim@meyering.net>
2957 * src/test.c (is_int): Don't overflow when evaluating integer
2958 constants. Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
2961 * tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
2962 names of temporary files that would clash on 8.3 file systems.
2963 * tests/mk-script (validate): Likewise.
2965 2005-01-12 Jim Meyering <jim@meyering.net>
2967 * tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
2969 * tests/tr/Test.pm (repeat-xC): Change test name from
2970 `repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
2971 Reported by Eric Blake.
2972 (repeat-000): Rename to `repeat-zeros' for the same reason.
2974 2005-01-11 Jim Meyering <jim@meyering.net>
2976 * configure.ac: Update version to 5.3.1.
2978 2005-01-11 Eric Blake <ebb9@byu.net>
2980 * src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
2981 * man/Makefile.am (all_programs): Account for $(EXEEXT).
2983 2005-01-11 Jim Meyering <jim@meyering.net>
2985 * src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
2986 with decreasing values.
2988 * src/expand.c (main): Likewise.
2989 * src/unexpand.c (main): Check for overflow in tabstop values
2990 specified via the obsolete form. E.g., now this command fails:
2991 _POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
2992 Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
2993 * tests/unexpand/basic-1 (obs-ovflo): New test for this.
2995 2005-01-10 Paul Eggert <eggert@cs.ucla.edu>
2997 Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
2998 * NEWS: Document the changes.
2999 * doc/coreutils.texi (pathchk invocation): Likewise.
3000 * src/pathchk.c (PORTABILITY_OPTION): New constant.
3001 (longopts, usage, main, validate_file_name):
3002 Add support for new -P option.
3003 Reject empty file names (unless -p is not specified and the
3004 current system allows empty file names).
3005 Change --portability so that is now equivalent to -p -P.
3006 Don't test whether file name is too long, if it is known to exist.
3007 (no_leading_hyphen): New function.
3008 * tests/misc/pathchk1: Add tests for empty file names and
3011 2005-01-08 Jim Meyering <jim@meyering.net>
3015 `pr --columns=N' was not equivalent to `pr -N' when also using
3018 * src/pr.c (main): Set `explicit_columns' for --columns=N,
3019 not just for -N. This bug has existed since the introduction
3020 of the --columns=N option on 1998-08-15.
3021 * NEWS: Document this.
3022 * tests/pr/Test.pm (test_vector): For each -N test, automatically
3023 create a new test vector using --columns=N.
3025 2005-01-07 Paul Eggert <eggert@twinsun.com>
3027 * src/pr.c (main): Check for column count overflow with
3028 usages like "pr -2147483648".
3030 2005-01-07 Jim Meyering <jim@meyering.net>
3032 * src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
3034 2005-01-06 Jim Meyering <jim@meyering.net>
3036 * README: List the precise HP-UX version numbers that are affected.
3037 Suggestion from Bob Proulx.
3039 * Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
3040 predicate before `-name ChangeLog' to avoid a harmless warning
3043 2005-01-05 Jim Meyering <jim@meyering.net>
3045 * tests/help-version: Punt on the uptime test, since it fails when
3046 it can't get boot time, and I don't want that to stop `make check'.
3048 * src/du.c (process_file): Evaluate exclusion rules against
3049 the entire file name, not just the last component.
3050 Reported by Robert Lindgren.
3051 * tests/du/exclude: Test for this.
3052 * NEWS: Document this.
3054 Ensure that tests/Makefile.am's check-root actions stay up to date.
3055 * Makefile.maint (sc_root_tests): New rule.
3056 (syntax-check-rules): Add it to the list.
3058 2005-01-04 Jim Meyering <jim@meyering.net>
3060 * man/shred.x: Change one-line summary to reflect that shred does
3061 not remove files by default. Suggestion from Helen Faulkner in
3062 http://bugs.debian.org/288552
3064 * README: Request VERBOSE=yes output when reporting test failures.
3065 Other minor changes.
3067 * tests/Makefile.am (check-root): Update.
3069 2005-01-03 Paul Eggert <eggert@cs.ucla.edu>
3071 * src/system.h: Undo previous change; we now use Autoconf.
3073 2005-01-03 Jim Meyering <jim@meyering.net>
3075 * tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
3076 a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems. Setting
3077 either (or both) to zero would succeed, but subsequent `stty size'
3078 would say `no size information for this device' due to the ioctl
3079 failing with EINVAL.
3081 * src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
3082 not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
3083 then fail at compile-time rather than let tools like od produce
3084 invalid results at run time.
3086 2004-12-21 Jim Meyering <jim@meyering.net>
3088 * src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
3089 not `xx01, xx02, ...'.
3090 Reported by Matt Kraai in http://bugs.debian.org/286605
3092 * tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
3095 2004-12-20 Paul Eggert <eggert@cs.ucla.edu>
3097 * src/split.c (usage): Mention default size. Suggested by Dan Jacobson.
3099 2004-12-19 Paul Eggert <eggert@cs.ucla.edu>
3101 * NEWS: Mention that one should eval "`dircolors`" rather than
3104 2004-12-17 Jim Meyering <jim@meyering.net>
3106 * tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
3107 so temporary directories aren't left behind upon e.g., interrupt.
3109 2004-12-16 Paul Eggert <eggert@cs.ucla.edu>
3111 * src/ls.c (print_dir): Use "%s: not listing already-listed
3112 directory", not "not listing already-listed directory: %s", to
3113 format already-listed directories, to be consistent with other
3114 diagnostics involving file names and colons.
3116 2004-12-15 Jim Meyering <jim@meyering.net>
3118 * src/Makefile.am (__LDADD): Define, so that building `[' on
3119 Solaris still uses the -lgen library that it requires in order
3120 to get a definition of eaccess.
3122 2004-12-14 Jim Meyering <jim@meyering.net>
3124 tac would exit immediately upon I/O or temp-file creation failure.
3125 Now it continues on, processing any remaining command line arguments.
3127 * src/tac.c: Include quotearg.h.
3128 Use quotearg_colon in most diagnostics.
3129 (copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
3130 failure. Before, this command (with /full/tmp being a full partition)
3131 TMPDIR=/full/tmp ./tac /proc/modules tac.c
3132 would exit immediately upon the write error while trying to copy
3133 non-seekable /proc/modules to the full partition. Now it still
3134 reports the failure but continues on with the remaining file.
3135 (tac_nonseekable): Return false also if copy_to_temp fails.
3136 [DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
3137 using atexit like this is wrong.
3138 * NEWS: Document this.
3139 * tests/misc/tac-continue: New test for this.
3140 * tests/misc/Makefile.am (TESTS): Add tac-continue.
3142 * tests/chown/basic: Add a few more tests.
3144 2004-12-13 Paul Eggert <eggert@cs.ucla.edu>
3146 * src/ls.c (gobble_file): Change arg name to be command_line_arg
3147 rather than explicit_arg, for consistency with copy.c.
3148 (extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
3149 it is deducible from dirname arg. All callers changed.
3150 (extract_dirs_from_files, print_dir, queue_directory):
3151 Add command_line_arg arg. All callers changed.
3152 (struct pending): Add command_line_arg member.
3153 (main): Use NULL rather than 0 when appropriate.
3154 (set_exit_status, file_failure): New functions.
3155 (queue_directory): Store command_line_arg into new structure.
3156 (print_dir, gobble_file, get_link_name):
3157 Use file_failure to report problems in accessing files,
3158 so that the exit status is set consistently.
3159 (print_dir): Simplify readdir failure code yet again.
3160 If closedir fails, report "closing directory" rather than "reading
3162 (xstrcoll): Use set_exit_status to set status on failure.
3163 * tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
3166 2004-12-11 Jim Meyering <jim@meyering.net>
3168 Avoid a race condition vulnerability in chown, when used with
3169 --from=O:G and without the (-h) --no-dereference option.
3170 * src/chown-core.c (restricted_chown): New function.
3171 (change_file_owner): Call it.
3172 Reported by Ulrich Drepper.
3173 * NEWS: Mention this.
3175 2004-12-09 Paul Eggert <eggert@cs.ucla.edu>
3177 * ls now exits with status 1 on minor problems, 2 if serious trouble.
3178 * NEWS: Document this.
3179 * src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
3180 All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
3182 (main): Initialize exit failure to LS_FAILURE.
3183 (print_dir, gobble_file, get_link_name, xstrcoll):
3184 Set exit status to LS_MINOR_PROBLEM if the failure is minor.
3185 (print_dir): Do not give up on entire directory merely because readdir
3187 (usage): Explain exit status.
3188 * tests/help-version: ls and variants now exit with status 2
3191 2004-12-08 Paul Eggert <eggert@cs.ucla.edu>
3193 * NEWS: Document new UTC+HH:MM date syntax, and put date changes
3196 2004-12-07 Paul Eggert <eggert@cs.ucla.edu>
3198 * src/factor.c (factor): Don't list 1 as a factor of 1.
3199 Problem reported by Thomas Folz-Donahue.
3201 2004-12-06 Jim Meyering <jim@meyering.net>
3203 * tests/du/files0-from: Sanitize environment.
3204 Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
3205 setting is the default (exported from /etc/profile) on at least one
3207 * tests/du/no-deref: Likewise.
3208 * tests/cp/symlink-slash: Likewise.
3209 * tests/ls/symlink-slash: Likewise
3211 2004-12-05 Jim Meyering <jim@meyering.net>
3213 * tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
3214 _POSIX2_VERSION=199209 is in the environment, or when building on
3217 2004-12-04 Jim Meyering <jim@meyering.net>
3219 * NEWS: Mention cut's new --complement option.
3221 2004-10-01 Paolo Bonzini <bonzini@gnu.org>
3223 * cut.c (complement, COMPLEMENT_OPTION): New.
3224 (longopts): Add --complement.
3225 (usage): Say not that -b, -c, and -f `print' fields,
3226 but rather that they `select' fields for printing.
3227 Describe the new --complement option.
3228 (mark_range_start): Extracted from set_fields.
3229 (print_kth): Support --complement.
3230 (compare_ranges): New function.
3231 (set_fields): Rewrite the part that populates range_start_ht,
3232 merging it with the part that populates printable_field.
3233 (main): Handle --complement.
3235 2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
3237 * src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
3238 failed. This works around an assertion failure reported by
3240 http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
3242 2004-12-02 Jim Meyering <jim@meyering.net>
3244 With using --color and with LS_COLORS saying not to color
3245 executables, don't stat every file.
3246 * src/ls.c (is_colored): New function.
3247 (gobble_file): Use it.
3248 (main): Use it here, in place of too-strict tests against NULL:
3249 if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
3250 old test would fail.
3252 2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
3254 * src/comm.c (compare_files): Assume setlocale exists.
3255 * src/join.c (keycmp): Likewise.
3256 * src/seq.c (decimal_point): Treat like sort. Now char.
3258 (main): Assume localeconv exists. Use same code as sort.
3259 * src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
3260 Assume setlocale exists.
3261 (thousands_sep): Renamed from th_sep.
3262 (IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
3263 (NONZERO): Parenthesize use of arg.
3264 (numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
3265 consistency. Avoid unnecessary negation by reversing
3267 (main): Rewrite localeconv call to match seq.c.
3268 * src/system.h: Assume locale.h exists.
3269 (HAVE_SETLOCALE): Remove.
3270 * src/uniq.c (different): Assume setlocale exists.
3272 * src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
3273 'volatile' on a local variable. Rewrite to avoid unnecessary
3274 double-assignment to 'func' in the usual case where strcoll does
3277 2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
3279 * src/pinky.c (gethostname): Remove decl.
3280 (scan_entries): Use IS_USER_PROCESS instead of by-hand code.
3281 * src/uptime.c (print_uptime): Use IS_USER_PROCESS and
3282 UT_TYPE_BOOT_TIME instead of by-hand code.
3283 * src/users.c (list_entries_users): Use IS_USER_PROCESS
3284 instead of by-hand code.
3285 * src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
3286 DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
3287 (IS_USER_PROCESS): Move to ../lib/readutmp.h.
3288 (UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
3289 UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
3290 (gethostname): Remove decl.
3291 (list_entries_who, scan_entries): Use the new macros defined above,
3292 for consistency with pinky, uptime, and users.
3294 2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
3296 Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
3297 HP's ANSI C compiler. Declaring int functions causes warnings on
3298 some modern systems and shouldn't be needed to compile on ancient
3300 * src/copy.h (stat, lstat, rename): Remove decls.
3301 * src/install.c (stat): Remove decl.
3302 * src/ln.c (link, symlink): Remove decls.
3304 2004-11-25 Jim Meyering <jim@meyering.net>
3306 * man/help2man: Import help2man-1.35.1.
3307 * man/Makefile.am (.x.1): Remove now-unnecessary use of
3308 locally-added --program-name=NAME option. Now, help2man gets
3309 the name from the [NAME] section (i.e. from our .x file).
3310 * man/install.x: Use `install', not `ginstall' in the one-line
3311 description. Reported by Brendan O'Dea.
3312 * man/sha1sum.x: Use `sha1sum', not `shasum'.
3314 2004-11-24 Jim Meyering <jim@meyering.net>
3316 Since the changes of 2004-05-22, the u.saved_cwd member at
3317 the bottom of the active-directory stack was no longer
3318 strictly necessary. This change removes that member and uses
3319 the newer cwd_state parameter for the final restore_cwd.
3321 * src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
3322 [dev_ino]: Rename from `a'.
3323 (AD_pop_and_chdir): Add a parameter to play the role of just-removed
3324 bottom-of-stack cwd-state member.
3325 (AD_pop_and_chdir): No longer return boolean. Adjust caller.
3326 (AD_push_initial): Remove CWD parameter. Adjust caller.
3328 2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
3330 Minor performance improvements and cleanups for "touch".
3331 * src/touch.c (posix_date): Remove; not needed as a static var.
3333 (touch): Use new futimens function to operate more efficiently
3334 in some cases. Don't stat/fstat existing file when
3335 (!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
3336 old time stamps aren't needed in that case.
3337 (main): change_times is int, not bool. Simplify test for
3340 2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
3342 * src/install.c (usage): Avoid usage that runs afoul of Docbook
3343 translation. Problem reported by Eric S. Raymond.
3345 Restore dd's noctty flag, reverting the change of 2004-04-08.
3346 POSIX does not allow "dd" to use O_NOCTTY by default.
3347 * NEWS: Add noctty flag to dd.
3348 * doc/coreutils.texi (dd invocation): Likewise.
3349 * src/dd.c (flags, usage, main): Likewise.
3351 2004-11-19 Alfred M. Szmidt <ams@gnu.org>
3353 * src/ls.c (usage): Clarified description of --no-group (-G),
3354 --human-readable (-h), --inode (-i), --size (-s), --time,
3357 2004-11-19 Jim Meyering <jim@meyering.net>
3359 * src/ls.c (usage): Clarify description of --author.
3360 Tweak indentation so that help2man creates better nroff.
3361 Reported by Dan Jacobson.
3363 * src/uniq.c (check_file): Don't check stdout for errors here.
3365 * src/pwd.c (find_dir_entry): Update comment to match reality.
3367 2004-11-18 Jim Meyering <jim@meyering.net>
3369 * src/pwd.c (robust_getcwd): Correct the comment: this function
3370 constructs the directory name. The caller prints it.
3372 2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
3374 * src/stat.c (STATFS): New macro, for portability to Solaris 9.
3375 (do_statfs): Use it.
3377 * src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
3378 src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
3379 src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
3380 src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
3381 src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
3382 * src/readlink.c (main): argv is not const.
3384 * src/cut.c (usage): Improve documentation along the lines suggested
3386 * src/echo.c (usage): Likewise.
3387 * src/expr.c (usage): Likewise.
3389 * src/dircolors.hin: Add putty, screen-bce.
3391 * src/pinky.c (print_entry): Fix memory leak.
3392 * src/who.c (print_user): Likewise.
3394 2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
3396 * NEWS: New dd operand "status=noxfer".
3397 * src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
3398 C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
3399 C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
3401 (STATUS_NOXFER, statuses): New constants.
3402 (usage, print_stats, scanargs): Add support for status=noxfer.
3403 (usage): Update status output to match new behavior.
3404 (print_stats): Always output complete byte count.
3405 Put space between numbers and units, as SI requires.
3406 Use ngettext so that i18n can use plurals for "byte" and "second".
3407 Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
3408 (iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
3410 * tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
3411 problems with regression testing.
3413 2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
3415 * NEWS: dd now outputs total bytes, seconds, and bytes per second.
3416 * src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
3417 * src/dd.c: Include "human.h".
3418 (w_bytes, start_time): New vars.
3419 (usage): Document new I/O statistics output
3420 (print_stats): Output new I/O statistics.
3421 (cleanup): Do statistics after closing stdin and stdout, so that
3422 the times are more accurate.
3423 (write_output, dd_copy): Count output bytes.
3424 (main): Get initial value of clock.
3426 2004-11-14 Jim Meyering <jim@meyering.net>
3428 Backslash-escape `-'s in email addresses, so that they are
3429 rendered properly in UTF-locales.
3430 * man/help2man (escape_hyphens): New function.
3431 (main): Call it on email addresses.
3433 * src/sort.c (zaptemp): Mark new diagnostic for translation.
3435 * tests/misc/close-stdout: New file. Test today's closeout.c change.
3436 * tests/misc/Makefile.am (TESTS): Add close-stdout.
3438 2004-11-13 Jim Meyering <jim@meyering.net>
3440 * src/test.c (usage): Put the description of `[-n] STRING'
3441 on two lines, one for `-n STRING' and one for `STRING' so that
3442 help2man properly escapes the `-'. Otherwise, the hyphen is
3443 rendered inappropriately in UTF-8 locales.
3444 Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
3446 2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
3448 * NEWS: Document the following changes.
3450 * src/sort.c: Avoid O(N**2) behavior when there are many temporary
3452 (temptail): New variable, so that we can easily append to list.
3453 (create_temp_file): Create new files at end of list, so that
3454 searching the list has O(N*NMERGE) behavior instead of O(N**2).
3455 (zaptemp): Update temptail if needed.
3456 (mergefps, merge): Accept new arg that counts temp files, and keep it
3457 up to date as we create and remove temporaries. This is for
3458 efficiency, so that we don't call zaptemp so often.
3459 All callers changed.
3460 (sort): Don't create array in reverse order, since the list of
3461 temporaries is now in the correct order.
3463 (zaptemp): Protect against race condition: if 'sort' is
3464 interrupted in the middle of zaptemp, it might unlink the
3465 temporary file twice, and the second time this happens the file
3466 might already have been created by some other process.
3468 (zaptemp): Warn if a temporary file is not removed.
3470 (create_temp_file): Use offsetof for clarity.
3471 (die): Move it up earlier, to clean up the code a bit.
3473 * src/pr.c (strtoumax): Declare if not declared.
3474 (skip_to_page, first_page_number, last_page_number, page_number,
3475 first_last_page, print_header):
3476 Use uintmax_t for page numbers.
3477 (first_last_page): Remove unnecessary forward declaration.
3478 Do not modify arg (it is now a const pointer).
3479 Return a true if successful, false (without print a diagnostic)
3481 (main): If +XXX does not specify a valid page range, treat it
3482 as a file name. This follows the response to Open Group XCU ERN 41
3483 <http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
3484 which says the behavior is allowed.
3485 (skip_to_page): When starting page number exceeds page count,
3486 print both numbers in the diagnostic.
3487 (print_header): Detect page number overflow.
3489 2004-11-07 Jim Meyering <jim@meyering.net>
3491 * src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
3492 (main) [__APPLE__]: Get the processor type via syscall rather than
3493 hard-coding "powerpc". From Toby Peterson.
3495 * src/sort.c (merge): Remove declarations of now-unused variables.
3497 2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
3499 * src/sort.c (first_same_file): Remove. Move most of the code to....
3500 (avoid_trashing_input): New function.
3501 (merge): Avoid some silly merges, e.g., copying a single file to
3502 a temporary file when there are exactly 17 input files to merge.
3503 Take a count of temporary files rather than a max_merge arg.
3506 2004-11-06 Jim Meyering <jim@meyering.net>
3508 * src/sort.c (xfclose): Don't close stdout here (just flush it),
3509 since close_stdout now closes stdout unconditionally.
3511 2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
3513 * src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
3514 first_same_file, merge, sort, main): Use size_t for indexes to arrays.
3515 This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
3517 (getmonth, keycompare, compare): Rewrite to avoid need for alloca,
3518 thus avoiding unchecked stack overflow in some cases. As a side
3519 effect this improve the performance of "sort -M" by a factor of 4
3522 2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
3524 * src/stty.c: Include "vasprintf.h" since we use vasprintf now.
3526 * src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
3527 expression; it's not portable. Problem reported by Albert Chin.
3528 Don't invoke a program more than once.
3529 * src/groups.sh (version): New variable, containing author info,
3530 for benefit of AUTHORS check. Use it when acting on --version option.
3531 * AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
3534 * src/system.h: Don't #define and #undef getopt around <stdlib.h>,
3535 as this breaks the new regime that does "#define getopt rpl_getopt".
3536 Problem reported by Albert Chin for Solaris 9 with Sun cc in:
3537 http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
3538 I suppose this may cause problems on ancient hosts with
3539 incompatible getopt declarations, but we'll cross that bridge if
3540 the problem gets reported to us by someone who can test the fix.
3542 2004-11-03 Jim Meyering <jim@meyering.net>
3544 * src/tac.c: quote(...) file names in diagnostics.
3546 2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
3548 * NEWS: Document getdate changes.
3550 2004-10-29 Jim Meyering <jim@meyering.net>
3552 * src/tac.c (tac_file): Remove temporary prototype and move this
3553 function `down' so that it precedes definition of tac_nonseekable.
3555 `tac /proc/modules' would print nothing
3556 Reported by Harald Dunkel in http://bugs.debian.org/278604.
3558 * src/tac.c (copy_to_temp): Renamed from save_stdin, since
3559 now it copies a general file descriptor, not just stdin.
3560 (tac_nonseekable): Renamed/adapted from tac_stdin.
3561 (tac_file): Get fd via `open' directly rather than via fopen/fileno,
3562 since we never used the stream. Perform "-" to stdin mapping here
3563 rather than in main. Determine whether a file is seekable,
3564 by trying to `lseek' to its end, and dispatch to tac_seekable or
3565 tac_nonseekable accordingly.
3566 (main): Rewrite argument handling now that it uses only tac_file.
3567 * NEWS: Mention it here.
3569 2004-10-21 Jim Meyering <jim@meyering.net>
3571 * tests/mv/leak-fd: New file.
3572 * tests/mv/Makefile.am (TESTS): Add it.
3573 * tests/rm/dot-rel: New file.
3574 * tests/rm/Makefile.am (TESTS): Add it.
3576 Correct my patch of 2004-10-18.
3577 * src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
3578 if necessary, not in remove_dir. Otherwise, removing multiple
3579 `.'-relative nonempty directories no longer worked.
3581 2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
3583 * src/fmt.c (usage): Improve description of --prefix.
3584 Problem reported by Edward Welbourne.
3586 * man/uniq.x: Change summary so that it doesn't imply that
3587 uniq writes to its input file. Problem reported by
3590 2004-10-18 Jim Meyering <jim@meyering.net>
3592 Plug a leak that would cause a cross-device mv to fail when
3593 operating on too many command-line-specified nonempty directories.
3594 * src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
3595 top of the stack before returning. This usually closes the file
3596 descriptor that was used to return to the original working directory.
3597 Reported by Cyril Bouthors in
3598 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
3599 * NEWS: Mention it here.
3601 * src/pathchk.c (validate_file_name): Give a more descriptive
3602 diagnostic when pathconf fails. This also avoids an unwarranted
3603 warning from gcc-3.3.5 about a format not being a string literal.
3605 * src/sleep.c (main): Remove declaration of unused local, c.
3606 * src/printenv.c (main): Likewise.
3607 * src/logname.c (main): Likewise.
3608 * src/uptime.c (main): Likewise, for optc.
3609 * src/tsort.c (main): Likewise, for opt.
3611 2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
3613 * AUTHORS: Add self to pathchk.
3614 * src/pathchk.c (AUTHORS): Add self.
3615 Change "path" to "file name" whenever possible.
3616 Remove usage comment, as it was a duplication of the code or doc.
3617 Include <wchar.h> if available.
3618 (mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
3619 (NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
3620 pathconf_wrapper, portable_chars, dir_ok): Remove.
3621 (NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
3622 (pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
3623 (portable_chars_only): New arg FILELEN.
3624 Don't assume ASCII; we might be on an EBCDIC host.
3625 Don't assume unibyte locale in diagnostic.
3626 (component_start, component_len): New functions.
3627 (validate_file_name): Renamed from validate_path. All uses changed.
3628 Pretty much a complete rewrite.
3629 Don't make copy of file arg. Always append trailing slash to
3630 pathconf arg, just in case it's a symlink (this is pure paranoia;
3631 we don't know of any hosts where the trailing slash is required).
3632 Use size_t instead of long int when possible.
3633 Avoid need to call pathconf in most practical cases.
3634 Don't use euidaccess several times to test searchability;
3635 just use lstat once. Reword diagnostic to put the (often very long)
3638 2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
3640 * src/printf.c (usage): Mention Unicode, and use H for hex digits.
3642 2004-10-13 Jim Meyering <jim@meyering.net>
3644 * NEWS: Mention today's fts.c fix.
3646 2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
3648 * tests/stty/row-col-1: Set LC_ALL=C.
3650 2004-10-12 Jim Meyering <jim@meyering.net>
3652 * src/dircolors.hin: Add .flac and .mpc as audio suffixes.
3653 From Jesus Climent in http://bugs.debian.org/276149.
3655 2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
3657 * src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
3658 problems. All uses changed.
3660 2004-10-05 Jim Meyering <jim@meyering.net>
3662 * .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
3663 since Karl says its trailing blanks are there to stay :-)
3665 2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
3667 * src/expr.c (NEW, OLD): Remove, partly to avoid
3668 reference to obsolescent macro XMALLOC.
3669 All uses replaced by xmalloc and free.
3671 2004-09-28 Jim Meyering <jim@meyering.net>
3673 * src/tail.c (usage): Clarify: --retry works only with --follow=name.
3674 Reported by Nik A. Melchior in http://bugs.debian.org/273781.
3676 2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
3678 * src/od.c (format_address_paren): c is optional, so don't output
3681 2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
3683 Add support for ls --hide. Idea suggested by Bardur Arantsson.
3684 * NEWS: Document this.
3685 * src/ls.c (file_ignored): Renamed from file_interesting, with
3686 inverted return value. Accept the file name, not a struct dirent *.
3687 All uses changed. Avoid the expense of calling fnmatch if the
3688 file is ignorable due to leading '.'.
3689 (all_files, really_all_files): Removed; replaced by:
3690 (ignore): New variable. All uses changed.
3691 (IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
3693 (hide_patterns): New variable.
3694 (long_options, decode_switches, file_ignored, usage):
3695 Add support for --hide.
3696 (patterns_match): New function.
3697 (usage): Replace "hide" with "ignore" in explanation, to avoid
3700 2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
3702 * src/ls.c (gobble_file, print_long_format): Don't assume that
3703 human-readable output has a byte count equal to its column width;
3704 this isn't always true in locales where the radix character is not
3706 (format_user_or_group): Revamp code to match the above fix;
3707 this avoids the (very faint) possibility of integer overflow.
3709 2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
3711 * NEWS: Mention that "chmod -r -w x" now works as expected.
3712 * src/chmod.c (main): Revamp option processing to support this.
3713 * tests/chmod/Makefile.am (TESTS): Add 'usage'.
3714 * tests/chmod/usage: New set of tests for usage like that.
3716 2004-09-24 Jim Meyering <jim@meyering.net>
3718 * Makefile.maint (CVS_LIST): Use --types=AFGM option so that
3719 it lists only cvs-controlled regular files.
3721 * src/csplit.c (xalloc_die): Declare to be `extern', not `static'
3722 to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
3724 2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
3726 * Makefile.maint (CVS_LIST): New macro.
3727 (sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
3728 sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
3729 sc_trailing_blank, po-check): Use it instead of the
3730 nonstandard "cvsu --list".
3732 * src/tail.c (parse_obsolete_option): Bring back support
3733 for obsolete option followed by non-obsolete, or by more
3734 than one file. When obsolete, conform to SUSv2 rather than
3735 original POSIX 1003.2-1992, as SUSv2 corrected the case of
3736 "tail -c". Add support for the SUSv2 "b" modifier.
3737 * NEWS: Mention the above.
3738 * tests/tail/Test.pm: New test case obs-b to check the above.
3739 err-[134] no longer need _POSIX2_VERSION=199209.
3740 Fix comments to match revised behavior.
3742 2004-09-22 Jim Meyering <jim@meyering.net>
3744 * Use automake-1.9.2. Regenerate dependent files.
3746 * src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
3747 Improve the comment.
3749 Clean up scoping etc. so that some make `distcheck' tests pass.
3750 * src/csplit.c (xalloc_die): Declare to be static.
3751 * src/chown-core.c (chown_files): Declare as `extern'.
3752 * src/cp-hash.c (remember_created): Likewise.
3753 * src/copy.c (copy): Likewise.
3754 * src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
3756 * src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
3757 * src/unexpand.c: Likewise.
3759 * src/Makefile.am (check-AUTHORS): New rule.
3760 (check): Depend on it.
3763 * Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
3764 (sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
3766 2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
3768 * src/ls.c (decode_switches): Don't compare a short value
3769 to SIZE_MAX: GCC sometimes complains.
3771 2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
3773 * NEWS: The following commands now reject unknown options:
3774 basename dirname factor hostname link nohup sync unlink yes
3775 Also, pathchk no longer accepts trailing options.
3777 * src/basename.c: Include <getopt.h>.
3778 * src/chroot.c: Likewise.
3779 * src/dirname.c: Likewise.
3780 * src/factor.c: Likewise.
3781 * src/hostid.c: Likewise.
3782 * src/hostname.c: Likewise.
3783 * src/nohup.c: Likewise.
3784 * src/pwd.c: Likewise.
3785 * src/setuidgid.c: Likewise.
3786 * src/sync.c: Likewise.
3788 * src/basename.c (main): Reject unknown options.
3789 * src/dirname.c (main): Likewise.
3790 * src/factor.c (main): Likewise.
3791 * src/hostid.c (main): Likewise.
3792 * src/hostname.c (main): Likewise.
3793 * src/link.c (main): Likewise.
3794 * src/nohup.c (main): Likewise.
3795 * src/pwd.c (main): Likewise.
3796 * src/setuidgid.c (main): Likewise.
3797 * src/sync.c (main): Likewise.
3798 * src/unlink.c (main): Likewise.
3799 * src/yes.c (main): Likewise.
3801 * src/cat.c (main): Remove unused "case 0".
3802 * src/chgrp.c (main): Likewise.
3803 * src/chmod.c (main): Likewise.
3804 * src/chown.c (main): Likewise.
3805 * src/comm.c (main): Likewise.
3806 * src/cp.c (main): Likewise.
3807 * src/csplit.c (main): Likewise.
3808 * src/cut.c (main): Likewise.
3809 * src/date.c (main): Likewise.
3810 * src/df.c (main): Likewise.
3811 * src/du.c (main): Likewise.
3812 * src/env.c (main): Likewise.
3813 * src/expand.c (main): Likewise.
3814 * src/fold.c (main): Likewise.
3815 * src/head.c (main): Likewise.
3816 * src/id.c (main): Likewise.
3817 * src/install.c (main): Likewise.
3818 * src/join.c (main): Likewise.
3819 * src/ln.c (main): Likewise.
3820 * src/ls.c (decode_switches): Likewise.
3821 * src/mkdir.c (main): Likewise.
3822 * src/mkfifo.c (main): Likewise.
3823 * src/mknode.c (main): Likewise.
3824 * src/mv.c (main): Likewise.
3825 * src/nl.c (main): Likewise.
3826 * src/paste.c (main): Likewise.
3827 * src/pinky.c (main): Likewise.
3828 * src/pr.c (main): Likewise.
3829 * src/ptx.c (main): Likewise.
3830 * src/readlink.c (main): Likewise.
3831 * src/rm.c (main): Likewise.
3832 * src/rmdir.c (main): Likewise.
3833 * src/seq.c (main): Likewise.
3834 * src/shred.c (main): Likewise.
3835 * src/split.c (main): Likewise.
3836 * src/sum.c (main): Likewise.
3837 * src/tac.c (main): Likewise.
3838 * src/tail.c (main): Likewise.
3839 * src/tee.c (main): Likewise.
3840 * src/touch.c (main): Likewise.
3841 * src/tr.c (main): Likewise.
3842 * src/tty.c (main): Likewise.
3843 * src/uname.c (main): Likewise.
3844 * src/unexpand.c (main): Likewise.
3845 * src/wc.c (main): Likewise.
3846 * src/who.c (main): Likewise.
3848 * src/chroot.c (main): Use getopt where it suffices, not getopt_long.
3849 * src/cksum.c (main): Likewise.
3850 * src/dd.c (main): Likewise.
3851 * src/logname.c (main): Likewise.
3852 * src/printenv.c (main): Likewise.
3853 * src/sleep.c (main): Likewise.
3854 * src/tsort.c (main): Likewise.
3855 * src/uptime.c (main): Likewise.
3856 * src/users.c (main): Likewise.
3857 * src/whoami.c (main): Likewise.
3859 * src/du.c (long_options): Standardize on NULL vs 0.
3860 * src/rm.c (long_opts): Likewise.
3862 * src/logname.c (long_options): Remove.
3863 * src/printenv.c (long_options): Likewise.
3864 * src/sleep.c (long_options): Likewise.
3865 * src/tsort.c (long_options): Likewise.
3866 * src/uptime.c (longopts): Likewise.
3867 * src/users.c (longopts): Likewise.
3868 * src/whoami.c (long_options): Likewise.
3870 * src/pathchk.c (longopts): Add --help, --version.
3871 (main): Use longopts rather than parse_long_options.
3872 * src/stty.c (longpts, main): Likewise.
3874 * src/pathchk.c (main): Don't reorder arguments, so that
3875 we can check weird file names.
3877 * src/readlink.c: Don't include "long-options.h".
3878 * src/sort.c: Likewise.
3879 * src/stty.c: Likewise.
3881 * src/split.c (verbose): Now bool, not int.
3882 (VERBOSE_OPTION): New enum.
3883 (longopts, main): Use it.
3885 * tests/factor/basic: Adjust to new wording in diagnostic
3886 that results from the above changes.
3888 2004-09-21 Jim Meyering <jim@meyering.net>
3890 * man/rm.x: Say "the response is affirmative" rather than "the
3891 response begins with y or Y", so that the documentation is
3892 accurate in non-English locales. Problem reported by Munzir Taha.
3894 2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
3896 * src/echo.c (main): Don't pass NULL to strcmp when
3897 POSIXLY_CORRECT and given no arguments.
3899 * src/md5sum.c (STRING_OPTION): Remove.
3900 (long_options, main): Remove support for undocumented and
3901 obsolete --string option, as suggested in the 1996-09-26 patch.
3902 * NEWS: Document this.
3904 * tests/rm/fail-eperm: Don't try to remove writeable files in a
3905 sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
3906 you remove such files. Problem reported by Bert Fischer in:
3907 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
3909 2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
3911 * src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
3912 (long_options, main): Use them instead of magic numbers 2 and 1.
3913 For --string, optarg can't possibly be NULL.
3915 * src/dd.c (usage): Distinguish between options and operands.
3916 (scanargs): Don't mess with argc, argv; getopt_long handles this now.
3917 Say "operands" for operands, not "options".
3918 (main): Use getopt_long, so that "dd --" works as POSIX requires.
3919 * tests/dd/misc: Check for "dd --".
3921 * src/chroot.c (main): Reject unknown options instead of
3922 interpreting them as a directory to chroot to.
3924 * src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
3925 The current standard (POSIX 1003.1-2004) is correct.
3926 (crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
3927 collision with builtin function.
3928 (main) [defined CRCTAB]: Output in lowercase hexadecimal, and
3929 output the first 0 as 8 digits, to make it easier to compare to
3930 the text of the standard. Output crctab to be a const array.
3931 (crctab): Use result of above changes.
3932 (long_options): Remove; not needed if empty.
3933 (main): getopt_long can't return 0 here, so simplify the code.
3935 2004-09-13 Jim Meyering <jim@meyering.net>
3937 * src/Makefile.am (localedir.h): Don't redirect directly to target.
3939 2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
3941 * src/id.c (print_full_info): Don't exit with failure status simply
3942 because a user or group number can't be turned into a name.
3943 Problem reported by Felipe Kellermann in:
3944 http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
3946 2004-09-12 Jim Meyering <jim@meyering.net>
3948 * Makefile.maint (my-distcheck): When building with -Werror, also
3951 2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
3953 * NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
3954 * src/tail.c (parse_obsolete_option): Renamed from
3955 parse_obsolescent_option, since the options are obsolete now.
3956 Remove bool *arg; just exit if there's an error. Revamp to follow
3957 POSIX 1003.2-1992 more precisely, to handle cases like "tail -
3958 file" and "tail -10 -- file" correctly when we are conforming to
3960 (main): Adjust to this change.
3961 * tests/tail/Test.pm (test_vector): minus-* requires
3962 _POSIX2_VERSION=199209 now, to work correctly if there is
3963 an input file. err-1 and err-3 no longer errors if there
3966 2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
3968 * src/test.c (usage): Document -r, -w, -x more carefully.
3970 2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
3972 * src/test.c (usage): Document "test" (with no args) and "[ ]".
3973 Document that -h and -L don't dereference.
3975 * NEWS: Document that "tr xy -z" now works as per POSIX.
3976 Sort the descriptions.
3977 * src/tr.c (main): Don't reorder options.
3978 * tests/tr/Test.pm (fowler-1): New test case.
3980 2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
3982 * src/touch.c (main): Fix POSIX-conformance bug: "touch --
3983 MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
3984 conforming to pre-2001 POSIX.
3985 * NEWS: Document this.
3986 * tests/touch/obsolescent: Test for this bug. Also, set
3987 _POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
3988 a better test for obsolescent features.
3990 * src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
3991 "sort -y abc" is like "sort abc" whereas "sort -y 100" is like
3994 * src/od.c: Several changes for POSIX and FreeBSD compatibility.
3995 (COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
3996 (long_options, main): --strings is now -S, not -s.
3997 (usage): Reflect the usage changes.
3998 (parse_old_offset): Do not issue a diagnostic on failure;
3999 callers now do this as necessary.
4000 (main): Support POSIX syntax. Remove unused case 0 from getopt_long.
4001 Add support for new short options (many undocumented) for
4002 compatibility with FreeBSD. Remove FIXME for -s; it's now
4003 POSIX-compatible. Default format is now oS, not o2.
4004 * NEWS: Describe the above.
4006 2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
4008 * src/stty.c (valid_options): Remove.
4009 (main): Fix some bugs in handling invalid option-combinations
4011 (recover_mode): Arg is now char const *, not char *.
4012 (main): Use STDIN_FILENO, not 0.
4013 Simplify option-parsing code a tad.
4014 * tests/stty/basic-1: Check for the fixed bugs.
4016 2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
4018 * src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
4019 it from ever being nonzero. Reported by Pozsar Balazs in:
4020 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
4021 (human_fstype): Add ramfs, squashfs, sysfs.
4022 Reported by Pozsar Balazs in:
4023 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
4024 (human_fstype): Return char const *, not char *.
4025 Simplify internals a bit, and avoid casts.
4027 * src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
4028 (bit_count): Remove. All uses changed to....
4029 (multiple_bits_set): New function.
4030 (scanargs): Use it, and check separately for each set of
4031 incompatible options, to improve diagnostics.
4033 (apply_translations): Move checks for incompatible options
4034 to scanargs, so that they're done consistently.
4036 2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
4038 Output correct errno-related diagnostic on "paste" I/O errors.
4039 * src/paste.c (write_error, xputchar): New functions.
4040 (paste_parallel): Use correct errno value after input error.
4041 (paste_parallel, paste_serial): Report errno value after output error.
4043 Port to diet libc. Problem reported by Felix von Leitner in:
4044 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
4045 * src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
4046 it's not portable C to assume FILE is a complete type.
4047 (paste_parallel): Use index test instead of ENDLIST, and NULL
4050 2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
4052 POSIX-conformance fixes for "expand" and "unexpand".
4053 Also, consistently use "tab stop" rather than "tabstop".
4054 * NEWS: Document fixes.
4055 * src/expand.c: Revamp to resemble the new unexpand.c better.
4056 (usage): -i does not convert tabs after non-tabs.
4057 (add_tab_stop): Renamed from add_tabstop. All uses changed.
4058 (parse_tab_stop): Renamed from parse_tabstop. All uses changed.
4059 (validate_tab_stop): Renamed from validate_tabstop. All uses changed.
4060 (next_file, main): Check fclose against 0, not EOF.
4061 (expand): Remove unnecessary casts.
4062 Add another loop nesting level, for lines, so that per-line variables
4063 are initialized cleanly.
4064 Revamp tab checking. Check for write error immediately, rather
4065 than just once at the end of the program.
4066 * src/unexpand.c: Lkewise (for the expand.c changes).
4067 (TAB_STOP_SENTINEL): Remove.
4068 (tab_size): Now size_t, not uintmax_t, since we need to store
4069 the sequences of blanks.
4070 (max_column_width): New var.
4071 (usage): Say "blank" where POSIX requires this.
4072 (add_tab_stop): Calculate maximum column width.
4073 (unexpand): Store the pending blanks, instead of merely counting them.
4074 Follow POSIX's rules about -a requiring two blanks before a tab stop.
4075 Get rid of internal label and goto.
4076 * tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
4077 Add blanks-1 through blanks-13.
4079 2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
4081 * NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
4082 succeed without changing the uid and gid, like FreeBSD.
4083 * src/chgrp.c (parse_group): Return gid_t rather than storing it
4084 through a pointer. Treat "chgrp '' file" as a no-op change,
4086 (main): Set chopt.group_name to NULL if the group is the empty
4088 * src/chown-core.c (describe_change): Describe changes to -1:-1
4089 without using "to OWNERSHIP" phrase.
4090 * src/chown.c (usage): "chown '' file" is now allowed.
4091 (main): Do not set user name to the empty string if the group
4093 * tests/chgrp/basic: Test "chgrp '' file".
4094 * tests/chown/Makefile.am (TESTS): Add separator.
4095 * tests/chown/separator: New file, partly taken from
4096 Dmitry V. Levin's suggestion in
4097 <http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
4099 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
4101 * tests/install/basic-1: Test for the -d regression.
4103 2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
4105 * src/install.c (main): Fix -d regression introduced with
4106 --target-directory support at 2004-06-25.
4108 2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
4110 * src/copy.c (copy_internal): When preserving links, unlink
4111 a destination with link count greater than one. This is so
4112 that commands like "cp -a" don't get confused when copying into
4113 a destination that already contains many hard links. Problem
4114 reported by Tim Waugh in:
4115 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
4117 2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
4119 Convert all files to UTF-8.
4120 * tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
4121 * tests/sort/Test.pm (16a): Likewise.
4122 * tests/uniq/Test.pm (8): Likewise.
4123 * tests/misc/printf-hex: Use ASCII, not Latin-1.
4125 * NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
4126 * src/shred.c (usage): "-" is an operand, not an option.
4127 * src/sort.c (die, xfopen, mergefps, first_same_file, merge):
4128 A null file arg means standard output.
4129 (main): "-o -" means to write to a file named "-",
4130 not to standard output.
4131 * src/tee.c (usage, tee): "tee -" writes to standard output, not
4132 to a file named "-".
4134 2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
4136 * src/install.c (change_timestamps): Fix int->bool conversion
4137 bugs introduced on 2004-07-29.
4139 2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
4141 * src/shred.c (wipename): Work even if the directory is writeable
4142 and not readable. Prefer write access, since this should work
4143 better with fdatasync.
4145 * src/csplit.c (xalloc_die): New function.
4146 (main): Remove now-obsolete initialization of xalloc_fail_func.
4148 * src/md5sum.c: Adjust to sha->sha1 renaming.
4150 2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
4153 * src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
4154 (can_mode): Make variable local.
4156 2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
4158 * src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
4159 Do not define, to avoid annoying compiler messages on QNX 6.3.
4160 Problem reported by Johan in:
4161 http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
4163 2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
4165 * src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
4166 Define to a concatenation of string literals, not to an expression;
4167 needed for concatenation contexts.
4168 (INTMAX_MAX, INTMAX_MIN): New macros.
4170 * src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
4171 unsigned long; this isn't true for st_ino on Solaris 9.
4173 2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
4175 * src/uname.c: Do not depend on HAVE_SYSCTL when deciding
4176 whether to include files. Include <sys/param.h> if
4177 HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
4178 (main) [defined __POWERPC__]: Add a kludge to work around a
4179 Mac OS X bug, so that uname -p defaults to "powerpc" if
4180 sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
4181 fails. Problem reported by Petter Reinholdtsen in:
4182 http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
4184 * src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
4185 main): Use bool for booleans.
4186 (writeline, check_file): Use uintmax_t for line counts.
4187 (check_file): Check for and report line number overflow,
4189 * src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
4190 (print_lines, print_words, print_chars, print_bytes, print_linelength,
4191 have_read_stdin, wc, wc_file, main):
4192 Use bool for booleans.
4193 (exit_status): Remove.
4194 (wc, wc_file): Return bool status. All callers changed.
4195 * src/who.c (scan_entries): 0 -> STDIN_FILENO.
4196 * src/whoami.c (main): Print uids using unsigned long int, not
4199 * src/unexpand.c: Int cleanup and minor reorganization to be more
4201 Include quote.h, xstrndup.h.
4202 (TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
4203 (convert_entire_line, have_read_stdin, parse_tabstops, next_file,
4205 Use bool for booleans.
4206 (tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
4207 Use uintmax_t for column counts.
4208 (first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
4209 (add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
4211 (parse_tabstops): Don't use ISBLANK on possibly-signed char.
4212 Detect overflow in tab stop string.
4213 (next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
4214 (unexpand): Concatenate input files the same way expand does.
4216 * src/touch.c (no_create, use_ref, posix_date, amtime_now,
4217 touch, main): Use bool for booleans.
4218 (main): Avoid integer overflow when given more than INT_MAX
4220 * src/tsort.c (struct item, n_strings): Use size_t for sizes.
4221 (have_read_stdin, count_items, scan_zeros, detect_loop,
4222 recurse_tree, walk_tree, tsort, main):
4223 Use bool for booleans.
4224 (exit_status): Remove.
4225 (tsort): Return a success flag instead of storing into a global.
4227 * src/tty.c (silent, main): Use bool for booleans.
4228 (main): 0 -> STDIN_FILENO.
4229 * src/uname.c (print_element): Use bool for booleans.
4231 * src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
4232 Remove. All uses replaced by C99 boolean primitives.
4233 (TEST_TRUE, TEST_FALSE): New constants, for readability.
4234 (test_unop, binop, unary_operator, binary_operator, two_arguments,
4235 three_arguments, posixtest, expr, term, and, or, is_int, age_of,
4236 one_argument, main): Use bool for booleans.
4237 (advance, unary_advance): Now inline procedures rather than a macros.
4238 (is_int): Renamed from isint, to avoid namespace clash with ctype.h.
4239 (term, and, or): When it's easy, loop instead of recursing.
4240 (term): Avoid integer overflow if there are INT_MAX-3 args (!).
4241 (binary_operator, unary_operator): Simplify by systematically rewriting
4242 true==FOO to FOO (where FOO is a boolean).
4243 (unary_operator): Don't consider a file to be a regular file
4244 merely because its mode&S_IFMT is zero. Just use S_ISREG.
4245 Remove unnecessary casts. Remove ifdefs for things like
4246 S_ISSOCK that are no longer needed, since stat-macros.h always
4249 * src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
4250 Use bool for booleans.
4251 (buf_init_from_stdin, buf_free, find_bol, print_line):
4252 Use size_t for sizes.
4253 * src/tac.c (separator_ends_record, tac_seekable, tac_file,
4254 tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
4255 (match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
4256 (tac_seekable): Use ptrdiff_t for pointer subtraction.
4257 Report an error if the result is out of range.
4258 (tac_seekable, main): Check for integer overflow in buffer size
4260 (main): Remove unnecessary casts.
4262 * src/su.c (run_shell): Pass a new n_additional_args arg, so that
4263 the callee doesn't have to count 'em. All callers changed.
4264 Don't allocate more space for the arg vector than we'll need.
4265 Use memcpy to copy the args rather than rolling our own loop.
4266 Use size_t for sizes.
4267 (fast_startup, simulate_login, change_environment, log_su,
4268 correct_password, restricted_shell, main): Use bool for booleans.
4269 (longopts): Don't assume change_environment is an int.
4270 Use NULL, not 0, for pointers.
4271 (xsetenv): New function, replacing xputenv and concat.
4272 All callers changed.
4273 (elements): Remove; no longer needed.
4274 (log_su, correct_passwd, main): Prefer !x to x==NULL.
4275 (log_su): 2 -> STDERR_FILENO.
4276 (modify_environment, main): Don't assume that getenv's returned value
4277 has an indefinite lifetime.
4278 (modify_environment): Allocate a larger environ.
4279 (main): Remove an impossible 'case 0'; if it happens now, it'll
4280 get diagnosed. Don't assume getpwnam results outlive endpwent.
4281 Check for null or empty pw_name, pw_dir and for null pw_passwd.
4283 * src/stty.c (VA_START): Remove. All callers now use va_start.
4284 (_POSIX_VDISABLE): Remove unnecessary cast.
4285 (struct control_info, visible): Use cc_t for control chars.
4286 (struct control_info): Use size_t for sizes.
4287 (recover_mode, set_mode, display_speed, display_window_size,
4288 valid_options, main, display_changed):
4289 Use bool for booleans.
4290 (integer_arg): Return unsigned long int, not long int.
4291 Accept new max arg; all callers changed, to specify a maximum
4292 value for integer parameters instead of silently overflowing.
4293 (wrap): Do not overrun the stack buffer if the output contains
4294 more than 1024 bytes. Instead, malloc a buffer.
4295 (main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
4296 Remove unnecessary casts.
4297 (set_control_char): Allow int values only up to cc_t range.
4298 (screen_columns): Don't reject INT_MAX.
4299 (display_changed, display_all, display_speed, recover_mode):
4300 Don't assume cc_t fits in int.
4302 * src/remove.h: Add copyright notice.
4303 (struct rm_options): Use bool for booleans.
4304 * src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
4305 errno_rmdir_non_empty, remove_parents, main): Likewise.
4306 * src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
4308 (main): Don't dump core if invoked with argv[0]==NULL.
4309 * src/tee.c (tee, append, ignore_interrupts, main, tee):
4310 Use bool for booleans.
4311 (tee): Use ssize_t for read returns.
4313 * src/ptx.c: Add a FIXME mentioning that there are many
4314 unchecked integer overflows in this file.
4315 (gnu_extensions, auto_reference, input_reference, right_reference,
4316 ignore_case, initialize_regex, fix_output_parameters,
4317 output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
4318 Use bool for booleans.
4319 (SKIP_SOMETHING, compare_words, digest_break_file,
4320 find_occurs_in_text, fix_output_parameters):
4321 Use to_uchar instead of a caset.
4322 (print_field): Rewrite to avoid cast.
4324 * src/printf.c (posixly_correct): Use bool for booleans.
4325 (verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
4326 (STRTOX): Rewrite to avoid casts.
4327 (print_esc_char): Arg is char, not int.
4328 * src/readlink.c (canonicalize): Remove. All uses now merely inspect
4330 (no_newline, verbose): Use bool for booleans.
4331 (can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
4332 * src/shred.c (struct Options, main): Use bool for booleans.
4333 (isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
4334 * src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
4335 Use bool for booleans.
4336 * src/stat.c (G_fail): Remove.
4337 (print_statfs): Print various gotta-be-nonnegative values using
4338 unsigned long int, not long int or int.
4339 (do_statfs, do_stat): Return a boolean success flag.
4340 (do_stat, main): Use bool for booleans.
4342 * src/pr.c: Add a FIXME mentioning that there are many
4343 unchecked integer overflows in this file.
4344 (TRUE, FALSE): Remove. All uses replaced by true and false.
4345 (struct COLUMN, read_line, print_page, print_stored, open_file,
4346 skip_to_page, init_fps, parallel_files, align_empty_cols,
4347 empty_line, FF_only, explicit_columns, extremities, keep_FF,
4348 print_a_FF, print_a_header, use_form_feed, have_read_stdin,
4349 print_across_flag, storing_columns, balance_columns,
4350 truncate_lines, join_lines, untabify_input, failed_opens,
4351 numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
4352 double_space, ignore_failed_opens, use_col_separator,
4353 pad_vertically, last_line, main, init_parameters, skip_read,
4354 read_line, print_stored):
4355 Use bool for booleans.
4356 (struct COLUMN, char_to_clump, store_char, print_char):
4358 (clump_buff, print_clump): Use char[], not int[], for an array whose
4359 elements are always chars.
4360 (first_last_page, main, getoptarg, balance, add_line_number,
4361 char_to_uclump): Remove unnecessary casts.
4362 (init_parameters): Allocate chars, not ints, for clump_buff.
4363 (print_char): Use to_uchar before invoking ISPRINT.
4364 (char_to_clump): Convert to unsigned char before invoking ISPRINT.
4366 * src/nohup.c (main): Use bool for booleans.
4367 * src/paste.c (paste_parallel, paste_serial, main): Likewise.
4368 * src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
4369 (portable_chars_only): Use to_uchar rather than a cast.
4370 * src/printenv.c (main): Use bool for booleans.
4371 Do not assume that the environ has at most one matching entry
4372 for each option (integer overflow was possible otherwise).
4374 * src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
4375 constant. Do not assume PRIdMAX etc. are strings of length 3 or
4377 (struct tspec): Use it. fmt_string is now an array, not
4378 a pointer, as there's little point to the indirection here.
4379 (struct tspec, flag_dump_strings,
4380 traditional, flag_pseudo_start, limit_bytes_to_format,
4381 abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
4382 decode_one_format, open_next_file, check_and_close,
4383 decode_format_string, skip, write_block, read_char, read_block,
4384 parse_old_offset, dump, dump_strings, main):
4385 Use bool for booleans.
4386 (struct tspec): Use void *, not char *, for generic pointers.
4387 (bytes_to_oct_digits, bytes_to_signed_dec_digits,
4388 bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
4389 Use char, not unsigned int, since char suffices.
4390 (print_s_char, print_char, print_s_short, print_short,
4391 print_int, print_long, print_long_long, print_float,
4392 print_double, print_long_double): Rewrite to avoid casts.
4393 These now take void * arguments, instead of char *.
4394 Use the same body for all functions, except for the choice
4395 of type. Assume C89 to simplify handling of signed char.
4396 (dump_hexl_mode_trailer, print_named_ascii, print_ascii):
4397 Rewrite to avoid casts.
4398 (print_named_ascii, print_ascii): Now takes void *, not char *.
4399 (decode_one_format): Use int for printf field widths, not
4400 unsigned int. Pass void * to subsidiary printers,
4401 not char *. Simplify handling of floating-point formats
4402 by factoring out common code dealing with precision and field width.
4403 (decode_format_string): Avoid need for temporary copy of
4404 each decoded struct tspec.
4405 (get_lcm): Remove unnecessary cast.
4406 (main): Fix bug where more than INT_MAX failed decodes were ignored.
4408 2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
4410 * src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
4411 (enum number_format): Remove.
4412 (FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
4414 (DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
4415 (section_del): Now const.
4416 (print_fmt): Remove.
4417 (starting_line_number, page_incr, blank_join, line_no,
4418 print_lineno, proc_text, main):
4419 Use intmax_t for line numbers.
4420 (reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
4421 Use bool for booleans.
4422 (lineno_format): Now a string, not an enum value.
4423 (build_print_fmt): Remove. All calls removed. This work is
4424 now done within print_lineno.
4425 (build_type_arg): Use size_t for sizes.
4426 (print_lineno): Check for line number overflow.
4427 (proc_text, main): Remove unnecessary cast.
4429 * src/ln.c (symbolic_link, interactive, remove_existing_files,
4430 verbose, hard_dir_link, dereference_dest_dir_symlinks,
4431 do_link, main): Use bool for booleans.
4433 * src/ls.c (struct fileinfo, file_interesting,
4434 extract_dirs_from_files, color_symlink_as_referent,
4435 FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
4436 numeric_ids, print_block_size, dired, print_with_color,
4437 check_symlink_color, print_inode, recursive, immediate_dirs,
4438 all_files, really_all_files, qmark_funny_chars,
4439 print_dir_name, format_needs_stat, format_needs_type, visit_dir,
4440 main, decode_switches, parse_ls_color, print_dir, file_interesting,
4441 gobble_file, make_link_path, basename_is_dot_or_dotdot,
4442 extract_dirs_from_files, print_long_format):
4443 Use bool for booleans.
4444 (dir_defaulted): Remove; no longer needed.
4445 (main): Use int to count files, since it suffices for argv.
4446 Rewrite to avoid need for dir_defaulted.
4447 (main, print_dir, gobble_file, get_link_name,
4449 Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
4450 (decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
4451 Remove unnecessary cast to int. Use int instead of unsigned
4452 int to count from 0 to 1.
4453 (get_funky_string, print_type_indicator): Use char for bytes, not int.
4454 (make_link_path): Use NULL for null pointers.
4455 (quote_name): Use to_uchar instead of cast.
4457 * src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
4458 print_full_info): Use bool for booleans.
4459 (problems): Remove, replacing with....
4460 (ok): New var (inverted from old sense).
4461 (print_user, print_group, print_full_info):
4462 Print uids/gids with %lu, not %u.
4463 (xgetgroups): Don't run out of memory if getgroups or getugroups
4465 * src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
4467 * src/factor.c (wheel_tab): Use unsigned char instead of unsigned
4468 int, since it suffices.
4469 (factor, print_factors): Use size_t for sizes.
4470 (print_factors, do_stdin, main): Use bool for booleans.
4471 * src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
4472 (fold_file, main): Use bool for booleans.
4473 (fold_file, main): Use size_t for sizes.
4474 (main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
4475 of prohibiting widths greater than INT_MAX.
4476 * src/head.c (presume_input_pipe, print_headers, have_read_stdin,
4477 write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
4478 elide_tail_lines_pipe, elide_tail_lines_seekable,
4479 elide_tail_lines_file, head_bytes, head_lines, head, head_file,
4480 string_to_integer, main):
4481 Use bool for booleans.
4482 (main): Rewrite to avoid cast.
4484 * src/csplit.c (struct line): Use size_t for sizes.
4485 (main): Remove unnecessary cast.
4486 * src/cut.c (cut_fields): Use to_uchar rather than a cast.
4487 * src/cut.c (cut_file, main): Use bool for booleans.
4488 * src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
4489 * src/env.c (main): Likewise.
4490 * src/expr.c (nextarg): Likewise.
4491 * src/env.c (main): Remove unused and nonstandard envp arg.
4493 * src/fmt.c (COST, MAXWORDS): Add a comment describing some of
4494 fmt's arbitrary limits.
4495 (TRUE, FALSE): Remove; all uses changed to (true, false).
4496 (main): Use bool for booleans.
4497 Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
4499 (copy_rest): Remove unnecessary cast.
4500 (get_prefix): Rewrite to avoid cast.
4501 (check_punctuation): Use char *, not unsigned char *; C89 requires
4502 this. Avoid off-by-one buffer read overrun when line is empty.
4503 (flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
4504 Remove unnecessary casts.
4505 * tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
4508 * src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
4509 next_file, expand, main):
4510 Use bool for booleans.
4511 (tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
4513 Use uintmax_t for column counts.
4514 (add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
4515 All callers changed.
4516 (parse_tabstops): Don't pass a negative char to isblank.
4517 Avoid memory leak with large tab stops.
4518 (validate_tabstops, expand): Don't assume number of tab stops is
4520 (next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
4521 storing values into exit_status.
4522 (expand): Use same pattern as unexpand for reading chars.
4523 Report an error when input line is too long, instead of silently
4524 screwing up. Do not mishandle tab stops when backspacing left
4527 * src/dircolors.c (have_read_stdin, append_quoted,
4528 dc_parse_stream, dc_parse_file, main): Use bool for booleans.
4529 (dc_parse_stream): Use enum for state, rather than int.
4530 Use ssize_t to store getline result.
4532 * src/dd.c (translation_needed, parse_integer, scanargs,
4533 apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
4534 Use bool for booleans.
4535 (translate_buffer): Use to_uchar rather than a cast.
4536 (swab_buffer, copy_simple, copy_with_unblock):
4537 Use size_t for sizes.
4539 * src/seq.c (equal_width, valid_format, main): Use bool for booleans.
4540 * src/sleep.c (apply_suffix): Likewise.
4541 * src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
4542 forever, from_start, print_headers, have_read_stdin, valid_file_spec,
4543 write_header, file_lines, pipe_lines, pipe_bytes, recheck,
4544 tail_forever, tail_bytes, tail_lines, tail, tail_file,
4545 parse_obsolescent_option, parse_options, main): Likewise.
4546 * src/sleep.c (apply_suffix): Invert sense of result.
4547 Use int (not unsigned int) for multiplier, as this generates better
4548 code with some compilers. Simplify code a bit.
4549 * src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
4550 parse_options): Use uintmax_t, not unsigned int or unsigned long int,
4552 (tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
4553 make it a bit clearer.
4555 * src/hostname.c: Include "xgethostname.h".
4556 (xgethostname): Remove decl; xgethostname.h has it.
4557 (sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
4558 && defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
4559 prototypes rather than K&R form. Assume any negative value from
4560 sysinfo denotes failure, not just -1.
4561 (main): Simplify use of sethostname.
4563 * src/pinky.c (include_idle, include_heading, include_fullname,
4564 include_project, include_plan, include_home_and_shell, do_short_format,
4565 include_where, main): Use bool for booleans.
4566 (count_ampersands, create_fullname, scan_entries, short_pinky):
4567 Use size_t for sizes.
4568 (create_fullname): Check for overflow in size calculations.
4569 (idle_string): Don't assume that the number of idle days
4570 is less than 10**8 and/or INT_MAX/(24*60*60).
4571 (main): No need to pass a non-NULL last arg to getopt_long.
4572 * src/uptime.c (print_uptime, uptime): Use size_t for sizes.
4573 (print_uptime): Remove unused local variable.
4574 (main): No need to pass a non-NULL last arg to getopt_long.
4575 * src/users.c (list_entries_users, users): Use size_t for sizes.
4576 (list_entries_users): Use char for bytes.
4577 (main): No need to pass a non-NULL last arg to getopt_long.
4578 * src/who.c (do_lookup, short_list, short_output, include_idle,
4579 include_heading, include_mesg, include_exit, need_boottime,
4580 need_deadprocs, need_login, need_initspawn, need_clockchange,
4581 need_runlevel, need_users, my_line_only, main): Use bool for booleans.
4582 (print_runlevel): Use unsigned char for bytes.
4583 (list_entries_who, scan_entries, who): Use size_t for sizes.
4584 (main): No need to pass a non-NULL last arg to getopt_long.
4586 * src/install.c (isdir): Remove decl.
4587 (install_file_to_path): Rely on make_path to fail if the destination
4588 is not a directory, by passing preserve_existing==true to it.
4589 Hence we no longer need to call isdir.
4590 Free dest_dir immediately when it's no longer needed, rather than
4591 waiting until the end of the function.
4592 (copy_file): Don't bother calling isdir, as copy will do the
4593 right thing if the destination is a directory.
4595 * src/du.c (fts_debug, opt_all, apparent_size, opt_count_all,
4596 print_grand_total, opt_separate_dirs, hash_ins, process_file, main):
4597 Use bool for booleans.
4598 (max_depth): Now size_t, not int, to avoid an arbitrary limit
4599 of INT_MAX on depth.
4600 (G_fail): Remove: no longer needed, now that the relevant
4601 functions return bool.
4602 (process_file): Use return value to signal success rather than
4603 setting a global. Remove first_call static var; not needed, since
4604 we can look at n_alloc. Use size_t for depths. Remove FIXME
4605 about size_t casts, as it's now fixed. Use xnrealloc rather
4606 than the obsolescent XREALLOC. Don't bother to check whether
4607 reallocation is needed unless level > prev_level.
4608 (du_files): Invert sense of result, for consistency with
4609 other coreutils code. All callers changed.
4610 (main): Allow --max-depth values up to SIZE_MAX.
4612 * src/df.c (inode_format, show_all_fs, show_local_fs,
4613 show_listed_fs, posix_format, require_sync, print_type,
4614 selected_fstype, excluded_fstype, show_dev, show_point, main):
4615 Use bool for booleans.
4616 (df_readable, show_dev): Use UINTMAX_MAX instead of -1.
4617 (show_dev, show_point, main):
4618 Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
4619 Don't assume disk name lengths are <= INT_MAX.
4620 Rewrite pct calculation to avoid cast.
4621 (show_point): Don't assume resolved length is <= SSIZE_MAX.
4623 * src/cut.c (hash_int) [!defined UINTPTR_MAX]: Use size_t
4624 instead of uintptr_t.
4625 * src/shred.c (UINT_MAX_32_BITS): Remove.
4626 (word32): Remove. All uses changed to uint32_t.
4627 (isaac_seed_data): Remove unnecessary cast.
4628 * src/system.h (ptr_align): Use size_t; in practice, this is just as
4629 good as uintptr_t in checking for alignments, and has fewer
4630 configuration hassles.
4632 * src/Makefile.am (localedir.h): Make it readonly; this
4633 undoes part of the 2004-07-27 patch.
4635 2004-07-30 Paul Eggert <eggert@cs.ucla.edu>
4637 * src/sort.c (UCHAR): Remove; all uses changed to to_uchar.
4638 (IS_THOUSANDS_SEP): Use bool when appropriate.
4639 (numcompare, main): Use char, not int, when the value is always a char.
4640 (numcompare): Remove "register"; compilers are smart enough these days.
4641 * src/system.h (errno, CHAR_BIT): Remove decls;
4642 no longer needed now we assume C89 or better.
4643 Include <inttypes.h> before <stdint.h>, as it's the
4644 Autoconf-recommended pattern.
4645 (to_uchar): New inline function, moved here from tr.c.
4646 Use full names for int types, e.g. "long int" rather than "long".
4647 * src/tr.c (to_uchar): Remove; now in system.h.
4648 (is_char_class_member): Use bool when appropriate.
4650 * src/mkdir.c (create_parents, main): Use bool when appropriate.
4651 (main): Use EXIT_SUCCESS/EXIT_FAILURE instead of 0/1.
4653 2004-07-29 Paul Eggert <eggert@cs.ucla.edu>
4655 * src/mkfifo.c (main): Use EXIT_SUCCESS and EXIT_FAILURE, not 0 and 1.
4657 * src/chmod.c (recurse, force_silent, process_file, process_files,
4658 main): Use bool when appropriate.
4659 * src/cksum.c (cksum, main): Likewise.
4660 * src/comm.c (hard_LC_COLLATE, only_file_1, only_file_2, both,
4661 compare_files, main): Likewise.
4663 * src/copy.h (struct cp_options): Likewise.
4664 * src/copy.c (copy_internal, is_ancestor, copy_dir, copy_reg,
4665 same_file_ok, seen_file, copy_internal, valid_options, copy): Likewise.
4666 * src/cp-hash.h (remember_created): Likewise.
4667 * src/cp-hash.c (remember_created): Likewise.
4668 * src/cp.c (struct dir_attr, flag_path, remove_trailing_slashes,
4669 re_protect, make_path_private, target_directory_operand, do_copy,
4670 cp_option_init, decode_preserve_arg, main): Likewise.
4671 * src/install.c (isdir, change_timestamps, change_attributes,
4672 copy_file, install_file_to_path, install_file_in_dir,
4673 install_file_in_file, strip_files, dir_arg, cp_option_init, main,
4674 change_attributes, change_timestamps): Likewise.
4675 * src/mv.c (remove_trailing_slashes, rm_option_init,
4676 cp_option_init, do_move, movefile, main): Likewise.
4677 * src/remove.c (right_justify), full_filename_, AD_pop_and_chdir,
4678 AD_push, prompt, remove_dir): Likewise.
4679 * src/rm.c (rm_option_init, main): Likewise.
4681 * src/remove.c (top_dir, pop_dir, full_filename_):
4682 Use size_t for sizes.
4683 * src/cp.c (target_directory_operand): Do not clear *NEW_DST if stat
4684 succeeds. It's not necessary in that case, as *NEW_DST is always
4686 (do_copy): Rewrite slightly to avoid need for "unreachable" comment.
4687 (main): Use EXIT_SUCCESS, EXIT_FAILURE instead of 0, 1.
4688 * src/rm.c (main): Likewise.
4690 md5sum, sha1sum integer cleanups.
4692 * src/checksum.h: Don't include config.h, sys/types.h, stdio.h:
4694 (ALG_UNSPECIFIED): Remove.
4695 (ALG_MDT): Don't make it equal to CHAR_MAX + 1; this isn't necessary.
4696 * src/md5.c: Don't include any files other than checksum.h.
4697 * src/sha1sum.c: Likewise.
4698 * src/md5sum.c (OPENOPTS, have_read_stdin, status_only, warn,
4699 bsd_split_3, split_3, hex_digits, digest_file, digest_check, main):
4700 Use bool when appropriate.
4701 (digest_check): Increase limit of number of input lines to
4702 UINTMAX_MAX from INT_MAX. Diagnose any overflows of this counter.
4703 Use ngettext instead of hard-to-i18nize hardcoded stuff for plurals.
4705 2004-07-28 Paul Eggert <eggert@cs.ucla.edu>
4707 * src/cat.c (exit_status): Remove. Now done by passing a boolean
4709 (simple_cat, cat): Return true if successful. All callers changed.
4710 (simple_cat, cat, main): Use bool for booleans.
4711 (simple_cat): Use size_t for sizes.
4712 (cat, main): Use the same names for parameters that we use for
4713 long options, to avoid confusion. This inverts the sense of the
4714 show_tabs (formerly output_tabs) and number_nonblank
4715 (formerly numbers_at_empty_lines) variables.
4716 (main): Don't mess up (due to integer overflow) if we are given
4717 INT_MAX - INT_MIN + 1 options.
4718 [O_BINARY]: Don't invoke isatty unless the other options require it.
4719 (main): When deciding whether to use simple_cat, don't worry
4720 about binary option; it's irrelevant.
4722 * src/dcgen: Remove comments, trailing white space, and empty
4723 lines from the output strings, to save space.
4724 Use a narrower type like 'unsigned char' for line lengths, if
4726 Make the output variables static, not extern.
4728 * src/chgrp.c (parse_group): Require base 10 when parsing
4730 (main): int -> bool when appropriate.
4731 * src/chown.c (main): Likewise.
4732 * src/chown-core.c: Include inttostr.h.
4733 (UINT_MAX_DECIMAL_DIGITS, uint_to_string): Remove.
4734 (gid_to_name, uid_to_name): Use imaxtostr/umaxtostr
4735 instead of uint_to_string).
4736 (describe_change): Instead of an int flag, use a char *
4737 auxiliary; this avoids the need for casts.
4738 Assume free (NULL) works.
4739 (change_file_owner): Return true/false, not 0/-1, since
4740 we don't set errno. All callers changed.
4741 Use bool when appropriate.
4742 (chown_files): Likewise.
4743 * src/chown-core.h (chown_files): Likewise.
4745 * tests/chown/basic: Test for proper handling of uids like
4746 "010", which must be parsed as decimal.
4748 * tests/misc/pwd: Don't assume that Perl's getpwd agrees with our
4749 pwd when there are multiple names for the working directory
4750 (which can happen with an automounter, sigh).
4752 * src/Makefile.am ($(SCRIPTS)): Don't depend on Makefile;
4753 this causes Solaris 8 'make' to refuse to build "groups".
4754 (localedir.h): Don't depend on Makefile: this causes Solaris
4755 8 'make' to build localedir.h unnecessarily. The dependence
4756 on Makefile is ineffective anyway, since $(localedir) might
4757 change even if Makefile hasn't.
4759 * src/remove.c (remove_dir): If we can't save the state of the
4760 working directory, pretend we started from "/", not ".".
4761 This avoids a bug on hosts like Solaris that don't let you
4762 remove the working directory.
4764 2004-07-27 Paul Eggert <eggert@cs.ucla.edu>
4766 * src/printf.c (strtiomax, strtoumax): Declare if not already
4767 declared: this fixes a portability bug with Solaris 8 + GCC.
4768 (STRTOX): Parenthesize use of macro arg as expression.
4769 (vstrtoimax, vstrtoumax, vstrtold): Remove now-unnecessary
4771 * configure.ac: Check for declaration of strtoumax, for
4774 * src/Makefile.am (cp_LDADD, ginstall_LDADD, mv_LDADD,
4775 pathchk_LDADD, rm_LDADD, test_LDADD): New vars, for eaccess.
4777 * tests/readlink/can-e: Don't assume that we can remove the
4778 working directory: this isn't possible under Solaris 8, say.
4779 * tests/readlink/can-f: Likewise.
4780 * tests/readlink/can-m: Likewise.
4782 * src/copy.c (copy_internal): find_backup_file_name no longer
4783 returns NULL, so don't bother to check for this.
4784 * src/cp.c (do_copy): Likewise.
4785 * src/ln.c (do_link): Likewise.
4787 2004-07-25 Paul Eggert <eggert@cs.ucla.edu>
4789 * src/nice.c (GET_NICE_VALUE): Renamed from GET_PRIORITY.
4791 (NZERO): New macro, if system doesn't define it already.
4792 (usage): Distinguish priorities from nice values.
4793 Don't assume NZERO is 20.
4794 (main): Use bool instead of int where appropriate.
4795 If user specifies an adjustment out of range, always truncate it
4796 to an inrange value instead of sometimes giving an error message
4798 Do not assume that -1 is an error return from "nice" or
4799 "getpriority", as it might be the current nice value minus NZERO.
4800 If nice/setpriority fails with errno == EPERM, go ahead and run
4801 the command anyway; POSIX requires this.
4803 * src/pathchk.c: Include euidaccess.h.
4804 (dir_ok): Use euidaccess, not access.
4805 * src/test.c (R_OK, W_OK, X_OK, FOK): Remove; system.h defines them.
4806 (eaccess): Remove. All users changed to use euidaccess instead.
4808 2004-07-24 Paul Eggert <eggert@cs.ucla.edu>
4810 * src/uptime.c (print_uptime) [defined BOOT_MSG]:
4811 Don't assume ut_line is null-terminated.
4812 * src/who.c (print_line): New arguments USERLEN and LINELEN,
4813 since USER and LINE might not be null terminated. All callers
4816 2004-07-23 Paul Eggert <eggert@cs.ucla.edu>
4818 Fix bug with "tail -f" reported by Rob Holland in
4819 <http://lists.gnu.org/archive/html/bug-coreutils/2004-07/msg00054.html>.
4820 Also, remove the undocumented and unsupported-since-2000
4821 --max-consecutive-size-changes options. Fix another related bug:
4822 "tail" got confused if stdin, stdout, or stderr were closed.
4823 Also, use output buffering even with "tail -f".
4825 * NEWS: Document this, plus yesterday's patch.
4826 * doc/coreutils.texi (tail invocation): "size has remained the same"
4827 -> "file has not changed", which is more accurate for fifos.
4828 * src/tail.c: Include fcntl-safer.h.
4829 (COPY_TO_EOF): Set to UINTMAX_MAX, not OFF_T_MAX (which was wrong).
4830 (COPY_A_BUFFER): New macro.
4831 (struct File_spec): New members mtime, mode, blocking.
4832 Remove member n_consecutive_size_changes.
4833 (DEFAULT_MAX_N_CONSECUTIVE_SIZE_CHANGES,
4834 max_n_consecutive_size_changes_between_opens,
4835 MAX_CONSECUTIVE_SIZE_CHANGES_OPTION): Remove.
4836 (long_options, tail_forever, parse_options):
4837 Remove (non-)support for --max-consecutive-size-changes.
4838 (record_open_fd): New function.
4839 (recheck, tail_file): Use it. Don't assume that stdin is open.
4840 (dump_remainder): Add support for new COPY_A_BUFFER special value.
4841 Treat errno==EAGAIN like EOF, since it might be a nonblocking read.
4842 (recheck): New arg BLOCKING, specifying whether to use blocking reads.
4844 (n_live_files): Remove, replacing with...
4845 (any_live_files): New function. All uses changed.
4846 (tail_forever): Use nonblocking I/O unless we know that blocking I/O
4847 is safe; this avoids some hangs when reading from a fifo.
4848 Avoid invoking fstat or sleep when using blocking I/O.
4849 Do not check for changes to size if the file is not a regular file,
4850 as the size is undefined in that case.
4851 Check for changes to mtime or mode, too; this works for non-regular
4853 (tail_forever, main): Redo fflush strategy to work even when input
4854 is nonblocking. Don't use unbuffered output; just flush when needed.
4856 2004-07-22 Paul Eggert <eggert@cs.ucla.edu>
4858 * src/tail.c (main): Ignore -f if no file operand is specified
4859 and standard input is a pipe.
4860 * doc/coreutils.texi (tail invocation): Do not ignore -f for
4861 all pipes, just for when standard input is a pipe and no
4862 file operand is specified.
4863 * tests/tail/Test.pm: Reinstate f-1 test, since we now pass.
4864 Add a new commented-out f-2 test, which we still fail.
4865 (test_vector): All f-* tests are special cases, not just f-1.
4867 2004-07-12 Paul Eggert <eggert@cs.ucla.edu>
4869 * src/uptime.c: Include c-strtod.h.
4870 (print_uptime): Use c_strtod instead of setlocale and sscanf.
4871 Use long int rather than int to count days (for 64-bit hosts),
4872 and check for arithmetic overflow when converting double to time_t.
4874 2004-07-11 Paul Eggert <eggert@cs.ucla.edu>
4876 * src/printf.c (vstrtold): Renamed from vstrtod.
4877 Now returns long double. All uses changed.
4878 (print_direc): Use "L" length modifier when printing floating point
4879 numbers, since we're now printing long double.
4881 2004-07-06 Paul Eggert <eggert@cs.ucla.edu>
4883 printf cleanup, to avoid undefined behavior, to add support for
4884 formats that Bash supports, and to support wide integers like
4887 * NEWS: Document this.
4888 * src/printf.c (UNSPECIFIED): Remove. All uses now replaced by
4889 booleans, so that we don't reserve any values for precision or
4891 (STRTOX): Use prototype, not K&R-style definition.
4892 (vstrtoimax): Renamed from xstrtol (to avoid confusion with xstrtol
4893 in ../lib), with type change to intmax_t.
4895 (vstrtoumax): Renamed from xstrtoul, with type change to uintmax_t.
4897 (vstrtod): Renamed from xstrtod. All uses changed.
4898 (print_direc): Use boolean arg instead of special value to indicate
4899 a missing precision or width. LENGTH no longer includes
4900 length modifiers or conversion character. New arg CONVERSION
4901 now specifies conversion character.
4902 Use intmax_t-width formatting for integers (like Bash).
4903 Add support for C99 %a, %A, %F (like Bash).
4904 Add support for field width with %c (POSIX requires this).
4905 Add a FIXME for lack of support for field width and precision
4907 Add support for '\'', '0' flags.
4908 Check for invalid combinations of flags, field width, precision,
4909 and conversion, to prevent use of undefined behavior.
4910 Allow multiple length modifiers, for formats like "%lld" (like Bash).
4911 Add support for C99 'j', 't', 'z' length modifiers (like Bash).
4912 In error message, output entire invalid conversion specification,
4913 instead of merely outputting % followed by the conversion char.
4914 * tests/misc/printf: Add tests for the above.
4916 2004-04-03 Dmitry V. Levin <ldv@altlinux.org>
4918 Change "readlink -f" to be more compatible with prior implementations.
4919 Add more canonicalize options, -e and -m.
4920 Add comprehensive tests for all readlink modes.
4922 * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME):
4923 Do not add canonicalize.c here.
4925 * src/readlink.c (longopts): Add new options.
4926 (usage): Document them.
4927 (canonicalize_fname): New proxy function.
4928 (main): Handle new options.
4929 * doc/coreutils.texi (readlink invocation): Document new
4930 "readlink -f" behaviour and new canonicalize options, -e and -m.
4932 * configure.ac (AC_CONFIG_FILES): Add tests/readlink/Makefile.
4933 * tests/Makefile.am (SUBDIRS): Add readlink.
4934 * tests/readlink/Makefile.am: New file.
4935 * tests/readlink/{rl-1,can-e,can-f,can-m}: New readlink tests.
4936 * tests/misc/Makefile.am (TESTS): Remove basic readlink test.
4937 * tests/misc/readlink: Remove file.
4939 2004-07-04 Jim Meyering <jim@meyering.net>
4941 * src/copy.c (copy_internal): Add a FIXME comment.
4943 2004-07-02 Paul Eggert <eggert@cs.ucla.edu>
4945 * src/copy.c (copy_dir): Assume path_concat returns non-NULL.
4946 * src/cp.c (do_copy): Likewise.
4947 * src/mv.c (movefile): Likewise.
4949 * src/cp.c (make_path_private): 2nd arg is now size_t, not int,
4950 to avoid problem when path_concat dir name is longer than 2 GiB (!).
4952 * src/nohup.c (main): Don't pass NULL first argument to path_concat.
4953 This cleans up the semantics a bit, as we no longer try to open the
4956 2004-07-01 Paul Eggert <eggert@cs.ucla.edu>
4958 * NEWS: Add short names -t and -T for --target-directory
4959 and --no-target-directory options, respectively.
4961 * src/cp.c (NO_TARGET_DIRECTORY_OPTION, TARGET_DIRECTORY_OPTION):
4962 Remove. All uses changed to 'T' and 't', respectively.
4963 * src/install.c, src/ln.c, src/mv.c: Likewise.
4965 * src/cp.c (long_opts, usage, do_copy, main): Add -t and -T as
4966 aliases for --target-directory and --no-target-directory,
4968 * src/install.c (long_options, main, usage): Likewise.
4969 * src/ln.c, src/mv.c: Likewise.
4971 2004-07-01 Jim Meyering <jim@meyering.net>
4973 * Makefile.maint (sc_file_system): New target.
4974 (syntax-check-rules): Add it.
4975 .x-sc_file_system: New file.
4976 * Makefile.am (EXTRA_DIST): Add it.
4978 * man/sync.x: Use "file system" rather than "filesystem".
4979 * man/stat.x, man/df.x: Likewise.
4981 2004-06-30 Paul Eggert <eggert@cs.ucla.edu>
4983 * src/df.c (usage, main): Output "file system" rather than
4985 * src/du.c (usage): Likewise.
4986 * src/shred.c (usage): Likewise.
4987 * src/stat.c (usage): Likewise.
4988 * src/stat.c (long_options, usage): Rename "--filesystem" to
4989 "--file-system". But keep the old name around, for compatibility
4992 2004-06-29 Paul Eggert <eggert@cs.ucla.edu>
4994 Add support for --no-target-directory option.
4996 * NEWS: Document it.
4997 * doc/coreutils.texi (Common options, Target directory, cp
4998 invocation, install invocation, mv invocation, ln invocation):
5000 (link invocation): Explain how to rewrite link using ln now
5001 that we have --no-target-directory.
5002 (ln invocation): Explain that --no-target-directory subsumes
5004 (unlink invocation): Modify wording to match new wording in
5007 * src/cp.c (NO_TARGET_DIRECTORY_OPTION): New constant.
5008 (long_opts, usage, do_copy, main): Add support for
5009 --no-target-directory,
5010 * src/install.c (NO_TARGET_DIRECTORY_OPTION, long_options, main,
5012 * src/ln.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
5014 * src/mv.c (NO_TARGET_DIRECTORY_OPTION, long_options, usage,
5016 * src/mv.c (enum): Sort values.
5018 2004-06-29 Jim Meyering <jim@meyering.net>
5020 Don't let verbose-mode output from a subshell obscure actual differences.
5021 * tests/rm/inaccessible: Turn off command-echoing just before
5022 invoking subshell, then turn it back on if VERBOSE=yes afterward.
5024 2004-06-25 Paul Eggert <eggert@cs.ucla.edu>
5026 Add support for 'install --target-directory', an option
5027 that has been documented for years but not implemented (!).
5028 * doc/coreutils.texi (install invocation): Document
5029 --target-directory in synopsis, too.
5030 * src/install.c (TARGET_DIRECTORY_OPTION): New var.
5031 (long_options, main, usage): Add --target-directory.
5032 (target_directory_operand): New function, stolen from mv.c.
5033 (main): Use it. Check for -d and --target-directory.
5034 Alter wording of diagnostics to match other programs.
5036 2004-06-28 Jim Meyering <jim@meyering.net>
5038 * src/cp.c (usage): Fix copy+paste error in description of
5039 --target-directory: s/move/copy/. From Paul Jarc.
5041 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
5043 Use more-consistent rules among cp, ln, and mv when dealing with
5044 last operands that are (or look like) directories.
5046 * src/cp.c (target_directory_operand): New, nearly-common function,
5047 It reports an error if the destination appears to be a directory
5048 (e.g., because it has a trailing slash) but is not.
5049 * src/ln.c, src/mv.c: Likewise.
5050 * src/cp.c (do_copy): Use it.
5051 * src/ln.c (main): Likewise.
5052 * src/mv.c (main): Likewise.
5054 * src/cp.c (do_copy): Don't assume argc is positive.
5055 Don't bother to lstat dest, since copy() will do that for us.
5056 Use "const" to avoid the need for cast.
5058 * src/cp.c (do_copy): Don't output a usage message because of file
5059 problems (e.g., an operand is not a directory). Use it only for
5060 syntax. Standardize on "target %s is not a directory" for the
5062 * src/ln.c (main): Likewise.
5063 * src/mv.c (main): Likewise.
5065 * src/cp.c (do_copy): Remove test for trailing slash, since
5066 target_directory_operand now does this.
5067 * src/ln.c (main): Likewise.
5068 * src/mv.c (movefile): Likewise.
5070 * src/cp.c (main): Reject multiple target directories.
5071 Check whether a specified target is a directory when parsing the
5072 options, using stat. This gives more-accurate diagnostics.
5073 * src/ln.c (main): Likewise.
5075 * src/ln.c (isdir): Remove decl; no longer needed.
5076 * src/mv.c (isdir, lstat): Likewise.
5078 * src/ln.c (do_link): New arg dest_is_dir. All uses changed.
5079 Don't check the destination ourself; rely on dest_is_dir.
5080 This way we can avoid lstatting the destination in the
5081 usual case, and in the worst case we lstat 1, not 3 times.
5082 Don't bother to unlink unless link failed; this saves a syscall.
5083 Remove unnecessary backup_succeeded flag;
5084 it was identical to "dest_backup != NULL".
5086 * src/ln.c (main): Use int to count to argc, not unsigned int.
5087 This handles negative operand counts.
5088 * src/mv.c (main): Likewise.
5090 * src/mv.c (do_move): Don't call hash_init; expect the caller to
5091 do it, for consistency with cp.c and ln.c. All callers changed.
5092 (movefile): dest_is_dir parameter is now bool, not int.
5093 (main): Standardize on "missing destination file operand after %s"
5094 for the diagnostic, for consistency with cp.c.
5096 * tests/mv/diag: Don't assume "mv --target=nonexistentdir"
5097 will complain about the arg count.
5098 Adjust to new (briefer) diagnostics.
5099 * tests/cp/fail-perm: Add a test to verify that we get the new
5100 diagnostic when failing to copy through a symlink-to-inaccessible-dir.
5102 2004-06-27 Paul Eggert <eggert@cs.ucla.edu>
5104 Fix a bug: formerly, if d/x was a directory and x a file, "ln x
5105 d/" incorrectly created a link d/x/x. It also saves some system
5108 * NEWS: Document the fix.
5110 * src/ln.c (main): Don't append basename to dest if this
5111 results in an existing directory name.
5112 * tests/ln/misc: See whether a trailing slash is followed too far.
5114 2004-06-26 Jim Meyering <jim@meyering.net>
5116 * src/printf.c (main): When given no arguments, print the standard
5117 "missing operand\nTry printf --help..." message -- to be consistent.
5119 2004-06-26 Jim Meyering <jim@meyering.net>
5121 * src/mknod.c (main): Add \n at the end of message output via fprintf.
5123 2004-06-25 Jim Meyering <jim@meyering.net>
5125 * tests/ln/misc: Add test for ln subscript error.
5127 2004-06-23 Paul Eggert <eggert@cs.ucla.edu>
5129 * src/ln.c (do_link): Remove unnecessary call to lstat.
5130 (main): Avoid subscript error when the destination is "".
5132 2004-06-23 Jim Meyering <jim@meyering.net>
5134 * tests/*: Replace all occurrences of `(exit N); exit' with
5135 `(exit N); exit N'. Otherwise, those many tests could exit with
5136 improper exit status when exiting via e.g., a trapped interrupt.
5137 Thanks to a report from Bob Proulx.
5139 2004-06-22 Paul Eggert <eggert@cs.ucla.edu>
5141 * src/who.c (idle_string, print_user): New arg boottime,
5142 specifying the most recent boot time. All uses changed.
5143 (idle_string) Consider a line to be "old" if it hasn't been used
5144 since the last boot time. Watch out for overflow when computing
5145 times, and for times in the future.
5146 (idle_string): Record latest boot time.
5148 2004-06-22 Jim Meyering <jim@meyering.net>
5150 * src/test.c (usage): Correct description of `-t FD'. The file
5151 descriptor, FD, is no longer optional. Reported by Ton Nijkes.
5153 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
5155 The 2004-06-19 fix for who and pinky was incomplete, as ctime
5156 has undefined behavior if the year precedes -999 or follows 9999.
5157 Since we have to stop using ctime anyway, we might as well use
5158 strftime and fix the FIXME, and support internationalized dates.
5160 * NEWS: Document the new behavior.
5161 * src/who.c: Include "hard-locale.h".
5162 (time_format, time_format_width): New vars.
5163 (time_string, print_line): Use them.
5165 (time_string): Use localtime + strftime instead of
5166 ctime, to avoid problems with years before -999 or after 9999.
5167 * src/pinky.c: Likewise.
5169 2004-06-21 Paul Eggert <eggert@cs.ucla.edu>
5171 Fix bug: GNU 'ls' didn't count columns correctly if user or group
5172 names contained multibyte characters where the column count
5173 differed from the byte count. This patch also corrects
5176 * src/ls.c (format_user_or_group): New function, which counts
5178 (format_user, format_group): Use it.
5179 (format_user_or_group_width): New function, which counts columns
5181 (format_user_width, format_group_width): Use it.
5183 2004-06-21 Jim Meyering <jim@meyering.net>
5185 * tests/priv-check: Quote "$PATH" in PATH=$PATH.
5186 Suggestion from Andreas Schwab.
5188 * tests/priv-check: When running as root, be sure to propagate
5189 PATH through to the process we exec as non-root.
5190 Reported by michael@aplatform.com.
5192 * src/mknod.c (main): Don't segfault when calculating the
5193 expected number of operands for `mknod NAME'.
5195 2004-06-20 Jim Meyering <jim@meyering.net>
5197 * src/dd.c (input_seek_errno): Declare file-scoped variable as static.
5199 2004-06-20 Paul Eggert <eggert@cs.ucla.edu>
5201 * src/basename.c (main):
5202 Standardize on the diagnostics given when someone gives
5203 too few operands ("missing operand after `xxx'") or
5204 too many operands ("extra operand `xxx'").
5205 Include "quote.h" and/or "error.h" if it wasn't already being included.
5206 * src/chgrp.c (main): Likewise.
5207 * src/chmod.c (main): Likewise.
5208 * src/chown.c (main): Likewise.
5209 * src/chroot.c (main): Likewise.
5210 * src/comm.c (main): Likewise.
5211 * src/cp.c (do_copy): Likewise.
5212 * src/csplit.c (main): Likewise.
5213 * src/date.c (main): Likewise.
5214 * src/dircolors.c (main): Likewise.
5215 * src/dirname.c (main): Likewise.
5216 * src/du.c (main): Likewise.
5217 * src/expr.c (main): Likewise.
5218 * src/hostid.c (main): Likewise.
5219 * src/hostname.c (main): Likewise.
5220 * src/id.c (main): Likewise.
5221 * src/install.c (main): Likewise.
5222 * src/join.c (add_file_name, main): Likewise.
5223 * src/link.c (main): Likewise.
5224 * src/ln.c (main): Likewise.
5225 * src/logname.c (main): Likewise.
5226 * src/md5sum.c (main): Likewise.
5227 * src/mkdir.c (main): Likewise.
5228 * src/mkfifo.c (main): Likewise.
5229 * src/mknod.c (main): Likewise.
5230 * src/mv.c (main): Likewise.
5231 * src/nohup.c (main): Likewise.
5232 * src/od.c (main): Likewise.
5233 * src/pathchk.c (main): Likewise.
5234 * src/ptx.c (main): Likewise.
5235 * src/readlink.c (main): Likewise.
5236 * src/rm.c (main): Likewise.
5237 * src/rmdir.c (main): Likewise.
5238 * src/seq.c (main): Likewise.
5239 * src/setuidgid.c (main): Likewise.
5240 * src/shred.c (main): Likewise.
5241 * src/sleep.c (main): Likewise.
5242 * src/sort.c (main): Likewise.
5243 * src/split.c (main): Likewise.
5244 * src/stat.c (main): Likewise.
5245 * src/test.c (beyond, main): Likewise.
5246 * src/touch.c (main): Likewise.
5247 * src/tr.c (main): Likewise.
5248 * src/tsort.c (main): Likewise.
5249 * src/tty.c (main): Likewise.
5250 * src/uname.c (main): Likewise.
5251 * src/uniq.c (main): Likewise.
5252 * src/unlink.c (main): Likewise.
5253 * src/uptime.c (main): Likewise.
5254 * src/users.c (main): Likewise.
5255 * src/who.c (main): Likewise.
5256 * src/whoami.c (main): Likewise.
5258 * tests/basename/basic: Adjust to new diagnostics.
5259 * tests/du/files0-from: Likewise.
5260 * tests/expr/basic: Likewise.
5261 * tests/mv/diag: Likewise.
5262 * tests/tsort/basic-1: Likewise.
5264 2004-06-20 Jim Meyering <jim@meyering.net>
5266 * src/ln.c: Remove declaration of yesno.
5267 Instead, include yesno.h.
5268 * src/copy.c: Likewise.
5270 * src/remove.c: Remove declaration of yesno.
5271 Instead, include yesno.h.
5272 (top_dir): Remove now-unnecessary cast of obstack_base.
5273 (pop_dir): Likewise.
5274 (full_filename_): Likewise.
5276 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
5278 Don't dump core if ctime returns NULL; this is possible on
5279 hosts with 64-bit time_t and 32-bit int.
5280 * src/who.c: Include "inttostr.h".
5281 (time_string): If ctime fails, print the raw time as an integer
5282 instead of dumping core.
5283 * src/pinky.c: Likewise, as follows:
5284 Include "inttostr.h".
5285 (time_string): New function, copied from who.c.
5286 (print_entry): Use it.
5288 2004-06-19 Paul Eggert <eggert@cs.ucla.edu>
5290 * src/who.c (print_line): Don't truncate user names at 8 bytes.
5291 Problem reported by Guido Leenders in:
5292 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00056.html
5293 * NEWS: document this.
5295 2004-06-19 Jim Meyering <jim@meyering.net>
5297 * src/system.h (case_GETOPT_VERSION_CHAR): Switch back to
5298 using GNU_PACKAGE (from PACKAGE) once again. This restores
5299 `GNU' to the parenthesized package name in --version output.
5300 Before, the first argument from AC_INIT, `GNU coreutils', would
5301 be propagated to the PACKAGE variable. Now, `GNU ' is trimmed.
5302 Reported by Richard Stallman.
5304 2004-06-17 Jim Meyering <jim@meyering.net>
5306 * src/tr.c (to_uchar): Rename function from `uchar'. The latter
5307 would clash with a typedef in Tru64's <sys/types.h>. From Albert Chin.
5309 2004-06-15 Paul Eggert <eggert@cs.ucla.edu>
5311 * NEWS: Remove more special cases for POSIXLY_CORRECT when POSIX
5312 allows the GNU behavior. "--" is now supported by chroot, hostid,
5313 hosname, pwd, sync, yes.
5314 * doc/coreutils.texi (yes invocation, false invocation,
5315 true invocation): Document this.
5316 * src/chroot.c (main): Handle "--".
5317 * src/hostid.c (main): Likewise.
5318 * src/hostname.c (main): Likewise.
5319 * src/pwd.c (main): Likewise.
5320 * src/sync.c (main): Likewise.
5321 * src/yes.c (main): Likewise.
5322 * src/true.c (main): Recognize --help and --version even if
5323 POSIXLY_CORRECT is set.
5324 * src/yes.c (main): Likewise.
5326 2004-06-09 Paul Eggert <eggert@cs.ucla.edu>
5328 * NEWS: Remove special cases for POSIXLY_CORRECT when POSIX allows
5330 * doc/coreutils.texi (pr invocation, unlink invocation): Document this.
5331 * src/ls.c (decode_switches): Pay attention to TABSIZE even if
5332 POSIXLY_CORRECT is set. POSIX reserves upper-case environment
5333 variables to the implementation, so it's OK for ls to depend on
5335 * src/pr.c: Include "hard-locale.h".
5336 (main): When in a non-POSIX locale, ignore POSIXLY_CORRECT, since
5337 POSIX specifies the behavior only in the POSIX locale.
5338 * src/printf.c (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT,
5339 since POSIX says the behavior is unspecified here.
5340 * src/tail.c (parse_obsolescent_option): Support multiple file operands
5341 even if POSIXLY_CORRECT, since POSIX does not require a diagnostic.
5342 * src/printf.c (main): Recognize --help, --version even if
5343 POSIXLY_CORRECT. POSIX does not specify any options, but it
5344 does not prohibit options either, so "printf" is like "expr" here.
5345 * src/unlink.c (main): Likewise.
5346 * tests/misc/printf: Adjust to the new semantics for \x if
5349 2004-06-14 Jim Meyering <jim@meyering.net>
5351 * tests/misc/pwd: New test, for fix of 2004-04-19.
5352 * tests/misc/Makefile.am (TESTS): Add pwd.
5353 (BUILD_SRC_DIR): Define BUILD_SRC_DIR.
5355 * src/copy.c: Remove declaration of euidaccess.
5356 Instead, include "euidaccess.h".
5358 2004-06-13 Paul Eggert <eggert@cs.ucla.edu>
5360 * src/who.c (PIDSTR_DECL_AND_INIT): Don't assume pid_t fits in int.
5361 (UT_ID) [!HAVE_STRUCT_XTMP_UT_ID]: Remove bogus comment,
5362 as (sizeof "??") reliably returns 3.
5363 (print_line): Guard against idle and pid being too long
5364 (which is possible when printing headers).
5365 (print_user): Allocate enough bytes for idlestr. Use IDLESTR_LEN.
5366 Avoid unnecessary cast of sizeof to int.
5367 (make_id_equals_comment): Do not assume that UT_ID returns
5368 a string; it might return a non-null-terminated array.
5369 Use strncat instead. It's not very often where strncat is
5370 exactly what you want, but this is one of those rare cases.
5372 2004-06-11 Paul Eggert <eggert@cs.ucla.edu>
5374 * src/who.c (list_entries_who): Don't output a trailing space.
5376 2004-06-09 Jim Meyering <jim@meyering.net>
5378 * src/touch.c (usage): Improve wording in description of the
5379 --time=WORD option. Reported by Dan Jacobson.
5381 * src/chown-core.c (change_file_owner): Change names of parameters
5382 old_uid and old_gid to required_uid and required_gid respectively.
5384 * src/chmod.c (mode_changed): Return false, not 0, now that the
5385 function returns `bool'.
5387 2004-06-08 Paul Eggert <eggert@cs.ucla.edu>
5389 Adjust chmod and chown to be similar if -c or -v are given. In
5390 particular, a no-op chown is no longer reported as a change; this
5391 reverts to previous behavior. Also, fix both commands so that -v
5392 report failures even if the failure is not due to the chmod or
5395 * src/chmod.c (CH_NOT_APPLIED): New constant.
5396 (describe_change): Handle it.
5397 (process_file): Use it, if a symlink wasn't changed.
5398 (mode_changed): Return bool, not int. Accept new argument
5399 NEW_MODE; all callers changed. This lets us avoid statting the
5400 file unless the new mode has unusual bits.
5401 (process_file): Return -1 on error. With -v, report all errors
5402 verbosely, not just some.
5404 * src/chown-core.c (change_file_owner): Return -1 on error, not
5405 1 sometimes and -1 on others. Our caller ORs together our results,
5406 and (-1 | 1) == 0 on ones-complement hosts.
5407 With -v report all errors verbosely, not just some.
5408 Fix bug when chopt->root_dev_ino && !chopt->affect_symlink_referent:
5409 file_stats wasn't set properly in that case.
5411 * tests/chgrp/basic: Adjust to above changes.
5413 2004-05-20 Paul Eggert <eggert@cs.ucla.edu>
5415 * tests/chgrp/basic: Test that chgrp -h does not fail on
5416 symlinks, even on hosts where that's not supported.
5417 Test that if -R is specified without -H or L, -h is assumed.
5418 Test that chown() is not optimized away.
5420 2004-05-18 Paul Eggert <eggert@cs.ucla.edu>
5422 Several fixes to chgrp and chown for compatibility with POSIX and BSD:
5424 Check for incompatible options. When -R and --dereference are
5425 both used, then either -H or -L must also be used. When -R and -h
5426 are both used, then -P must be in effect.
5428 -H, -L, and -P have no effect unless -R is also specified.
5429 If -P and -R are both specified, -h is assumed.
5431 Do not optimize away the chown() system call when the file's owner
5432 and group already have the desired value. This optimization was
5433 incorrect, as it failed to updated the last-changed time and reset
5434 special permission bits, as POSIX requires.
5436 Do not report an error if the owner or group of a
5437 recursively-encountered symbolic link cannot be updated because
5438 the file system does not support it.
5440 * NEWS: Document the above.
5442 * src/chgrp.c (main): Check for incompatible options. -R --dereference
5443 requires either -H or -L, and -R -h requires -P. If -H, specify
5444 FTS_PHYSICAL as well as FTS_COMFOLLOW; this is faster. Make this
5445 file as much like chown.c as possible.
5446 * src/chown.c (main): Likewise.
5448 * src/chown-core.c (change_file_owner): Use ent->fts_statp only if
5449 needed. Chown a directory only after chowning its children; this
5450 avoids problems if the new directory ownership doesn't permit
5451 access to the children. Dereference symlinks before doing
5452 ROOT_DEV_INO_CHECK, not after, so that we catch symlinks to /.
5453 Do not optimize away the chown() system call when the file's owner
5454 and group already have the desired value. POSIX does not permit
5455 this optimization. Rely on chown and lchown to do the right
5456 thing with symlinks and/or -1 arguments, now that we have wrappers
5457 to do this. Use ENOTSUPP not ENOSYS, and ignore all ENOTSUPP
5458 errors, not just command-line errors.
5459 (chown_files): Pass FTS_NOSTAT to xfts_open if we don't need file status.
5461 * src/system.h (ENOTSUP): Remove.
5463 * tests/chgrp/basic: Use chown --from to discover whether the
5464 group changed, since chgrp now changes unconditionally. This
5465 complicates the sed script a bit. Do not specify --dereference,
5466 since it's the default (and we want to test this). Adjust output
5467 to match the fact that chgrp no longer optimizes the case of
5468 changing a file's group to the same value as before.
5469 * tests/chgrp/posix-H: Do not attempt to combine -h and -H; these
5470 options are incompatible, and their behavior is undefined with POSIX.
5471 (changed, not_changed): Adjust to match the fact that -h is no longer
5472 specified. Sort names.
5473 * tests/chown/deref: Adjust error-diagnostic spelling to match new
5476 2004-06-07 Paul Eggert <eggert@cs.ucla.edu>
5478 * src/uname.c (main): Fix typo introduced on 2003-05-10 that
5479 prevented a diagnostic of any operands.
5481 2004-06-08 Jim Meyering <jim@meyering.net>
5483 * src/shred.c (direct_mode): Turn it on/off with directio, too.
5485 2004-06-07 Jim Meyering <jim@meyering.net>
5487 Enable direct-mode I/O (bypassing the buffer cache), if possible.
5488 Prompted by a suggestion from Kalle Olavi Niemitalo
5489 in http://bugs.debian.org/207035.
5490 * src/shred.c (direct_mode): New function.
5491 (do_wipefd): Turn on direct-mode I/O.
5492 (dopass): If a file's first write fails with EINVAL,
5493 turn off direct-mode I/O and retry the write.
5495 2004-06-05 Paul Eggert <eggert@cs.ucla.edu>
5497 * src/tr.c (main): "tr -d a b" is now a fatal error even if
5498 POSIXLY_CORRECT is set. The POSIX SYNOPSIS does not allow this
5501 2004-06-04 Paul Eggert <eggert@cs.ucla.edu>
5503 * src/shred.c (dopass): Don't subtract 1 from the offset after
5504 a write error. Problem reported by Jon Peatfield in:
5505 http://lists.gnu.org/archive/html/bug-coreutils/2004-06/msg00020.html
5507 2004-06-02 Paul Eggert <eggert@cs.ucla.edu>
5509 Fix bug reported by Buciuman Adrian in
5510 <http://mail.gnu.org/archive/html/bug-coreutils/2003-08/msg00105.html>
5511 where 'dd' created a file that was too large. The bug was that dd
5512 assumed that the input file offset does not advance after a failed
5513 read; but POSIX says that the input file offset is undefined after
5516 * src/dd.c (MAX_BLOCKSIZE): New macro.
5517 (input_seekable, input_seek_errno, input_offset,
5518 input_offset_overflow): New vars.
5519 (scanargs): Reject block sizes greater than MAX_BLOCKSIZE.
5520 (advance_input_offset): New function.
5521 (skip_via_lseek): Set errno to zero when reporting our failure,
5522 so that we don't report based on garbage errno.
5523 (skip): If fdesc is standard input, advance the input offset.
5524 Do not quit if reading, and if noerror was specified;
5525 POSIX seems to require this.
5526 If read fails on output file, report the earlier lseek failure
5527 instead; this fixes a FIXME in dd_copy.
5528 (advance_input_after_read_error): New function.
5529 (dd_copy): Use it, instead of assuming that failed reads
5530 do not advance the file pointer. Advance input offset
5531 after nonfailed reads. Advance only a partial block if
5532 the previous read (before the failed read) succeeded, and
5533 do not generate an output block of zeros in this case.
5534 (main): Determine initial input offset, seekability of input,
5535 and error if it wasn't seekable.
5537 2004-06-02 Jim Meyering <jim@meyering.net>
5539 rm (without -f) could hang unnecessarily when attempting to
5540 remove a symlink to a file on an off-line NFS-mounted partition.
5541 Reported by David Howells in https://bugzilla.redhat.com/124699.
5542 * src/remove.c (write_protected_non_symlink): New function.
5543 Don't invoke euidaccess on symlinks.
5544 (prompt): Use write_protected_non_symlink rather than using
5545 euidaccess directly, being careful not to call lstat twice for a file.
5547 Fix a bug in how the --output-delimiter=D option works with
5548 abutting byte or character ranges. Reported by David Krider in
5549 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00132.html
5550 * src/cut.c (print_kth): Remove special case for open-ended range.
5551 (set_fields): Record the range start index for an interval even
5552 when it abuts another interval on its low side.
5553 Also record the range start index of the longest right-open-interval.
5554 * tests/cut/Test.pm: Add tests of --output-delimiter=S with
5555 abutting and overlapping byte ranges.
5557 2004-06-01 Paul Eggert <eggert@cs.ucla.edu>
5559 Some POSIX-conformance cleanups for tr.
5561 * src/tr.c (posix_pedantic): Remove; no longer needed since
5562 we need to test this in just one place now.
5563 (usage): Mention -C.
5564 (unquote): Note that \055, \n, etc are escaped.
5565 Do not worry about POSIXLY_CORRECT when warning about ambiguous
5567 \ at end of string stands for itself.
5568 Do not diagnose invalid backslash escapes: POSIX says the behavior
5569 is unspecified in this case, so we don't need to diagnose it.
5570 (main): Add support for -C (currently an alias for -c).
5571 Do not diagnose 'tr [:upper:] [:upper:], as POSIX does not require
5573 * tests/tr/Test.pm: New tests bs-055, bs-at-end, repeat-Compl.
5574 Fix comment for range-a-a.
5576 2004-05-25 Paul Eggert <eggert@cs.ucla.edu>
5578 Improve the efficiency (and in one case, correctness) of code
5579 that reads symlinks.
5581 * src/copy.c (copy_internal): Don't use alloca, as it can mess up
5582 royally if the link length is long (e.g., GNU/Hurd). Use
5583 xreadlink instead, it's safer. Don't bother to read the link if
5584 it's the wrong size. Add a FIXME because this area is a bit murky
5586 * src/ls.c (get_link_name): Update use of xreadlink.
5587 * src/readlink.c (main): Likewise.
5588 * src/stat.c (print_stat): Likewise.
5590 2004-06-01 Jim Meyering <jim@meyering.net>
5592 * src/env.c (main): Prefer the notation `STREQ (a, b)'
5593 over `!strcmp (a, b)'.
5594 * src/sort.c (main, sort_buffer_size): Prefer the notation
5595 `STREQ (a, b)' over `strcmp (a, b) == 0'.
5596 * src/date.c (batch_convert): Likewise.
5597 * src/expr.c (nextarg): Likewise.
5598 * src/su.c (correct_password, restricted_shell, main): Likewise.
5599 * src/ptx.c (swallow_file_in_memory, main): Likewise.
5600 * src/test.c (binary_operator, and, or, main): Likewise.
5602 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
5604 * NEWS: echo compatibility cleanup.
5605 * doc/coreutils.texi (echo invocation): Document the changes.
5606 * src/echo.c (V9_ECHO): Remove; always enabled.
5607 (DEFAULT_ECHO_TO_XPG): Renamed from V9_DEFAULT, so that
5608 we use the same naming convention as bash. Now an enum,
5610 (usage): Reword to mention -e/-E more accurately.
5611 Mention \0NNN (the POSIX syntax) rather than \NNN (nonstandard).
5612 (hextobin): New function.
5613 (main): Use bool rather than int for local vars when appropriate.
5614 Do not allow options if POSIXLY_CORRECT, unless we are using
5615 BSD semantics and the first argument is "-n".
5616 Don't pass unnecessary extra arg to parse_long_options.
5617 do_v9 now defaults to DEFAULT_ECHO_TO_XPG, not to allow_options.
5618 Do not look for options if !allow_options.
5619 Use size_t rather than int when appropriate.
5620 Open-code option test rather than using strrchr.
5621 Use faster test for "-".
5622 Avoid redundant argc test.
5623 Add support for \x, for Bash compatibility.
5624 Use e.g. '\a' rather than '\007', for portability to EBCDIC hosts.
5625 When '\c' is encountered, stop printing immediately, as POSIX
5627 Add support for \xhh syntax.
5628 Add support for \0ooo syntax; POSIX requires this.
5630 2004-06-01 Jim Meyering <jim@meyering.net>
5632 * Use automake-1.8b. Regenerate dependent files.
5634 2004-05-31 Jim Meyering <jim@meyering.net>
5636 * tests/Makefile.am.in (TESTS_ENVIRONMENT): Define PATH to include
5637 the build src/ directory -- at the front.
5638 ($(srcdir)/$x-tests): Depend on Makefile.am.
5639 Use $x as the program name, except when it would be `test' (test is
5640 the sole program tested via mk-script that is also a shell built-in).
5641 In that case, use the old ../../src/$x.
5643 2004-05-30 Jim Meyering <jim@meyering.net>
5645 Work around HPUX /bin/cc compiler bug that is exposed, now that
5646 sets are arrays of type `bool'. More details here:
5647 http://lists.gnu.org/archive/html/bug-gnulib/2004-05/msg00094.html
5648 FIXME: verify that the above URL points to the right message
5650 * src/tr.c (card_of_complement): Use cleaner `sizeof in_set'
5651 rather than `N_CHARS * sizeof(in_set[0])'. Using HPUX's /bin/cc
5652 (aC++/ANSI C B3910B A.05.55 [Dec 04 2003]) on an ia64-hp-hpux11.22
5653 system, those two expressions are not the same (256 vs. 1024).
5654 The effect of this problem was that `tr -c x y' would fail:
5655 tr: when not truncating set1, string2 must be non-empty
5656 (set_initialize): Remove unnecessary initialization of the `in_set'
5657 buffer; that initialization triggered the same compiler bug as above.
5659 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
5661 tr cleanup, mostly having to do with integer type ranges.
5664 * tests/tr/Test.pm: Add a few tests for the below. Alas, most of
5665 the test cases wouldn't be portable, or would take too much CPU
5668 * src/tr.c (N_CHARS, N_CHAR_CLASSES): Now an enum, not a macro.
5669 This is safe since the code already assumes N_CHARS fits in int.
5670 (Filter): Remove: we want to prototype everything.
5671 (ORD, CHR): Remove. All uses removed. Some replaced with:
5672 (uchar): New function. All places where a char must be converted
5673 to an unsigned char are now done this way, not by ad-hoc methods.
5674 (count): New type. Use it whenever counts or states are needed.
5675 (BEGIN_STATE): Increase from INT_MAX - 1 (which was bogus, anyway,
5676 since we used it in an unsigned int context) to UINTMAX_MAX - 1.
5677 (REPEAT_COUNT_MAXIMUM): New macro. Use it in place of BEGIN_STATE
5678 whenever appropriate.
5679 (NOT_A_CHAR): Remove global macro; now a local enum.
5680 (UL_LOWER, UL_UPPER, UL_NONE): No longer specify values, since
5681 the rest of the code no longer depends on them.
5682 (class_ok): Remove; all uses changed to use inline comparisons.
5683 (RE_NO_TYPE): Remove; wasn't used or needed.
5684 (struct List_element): normal_char and equiv_code are now unsigned
5686 first_char, last_char, and the_repeated_char are now unsigned char,
5687 not unsigned int. repeat_count is now count, not size_t.
5689 (struct Spec_list): state is now count, not unsigned int.
5690 lengthis now count, not size_t.
5691 n_indefinite_repeats is now size_t, not int.
5692 has_equiv_class, has_char_class, and has_restricted_char_class
5693 are now bool, not int. All uses changed.
5694 (struct E_string): s is now char *, not unsigned char *.
5695 escaped is now bool *, not int *. All uses changed.
5696 (ES_MATCH): Remove macro, replacing with:
5697 (es_match): New inline function. All uses changed.
5698 (squeeze_repeats, complement, posix_pedantic, truncate_set1,
5699 translating): Now bool, not int.
5700 (io_buf): Now char array, not unsigned char.
5701 (SET_TYPE): Remove. All uses replaced with bool.
5702 (is_equiv_class_member, unquote, append_range, append_char_class,
5703 append_equiv_class, find_closing_delim, star_digits_closebracket,
5704 build_spec_list, parse_str, homogeneous_spec_list):
5705 Now returns bool, not int. All uses changed.
5706 (is_equiv_class_member): Now inline.
5707 (is_equiv_class_member, is_char_class_member, make_printable_str,
5708 append_normal_char, append_range, append_repeated_char,
5710 Args are now of proper integer type.
5711 (unquote, look_up_char_class, make_printable_str,
5712 append_equiv_class, build_spec_list, squeeze_filter):
5713 Avoid unsigned char *p; gently convert *p to unsigned char instead.
5714 (unquote, get_spec_stats): Do not jump past declarations and then
5715 use them; C doesn't allow this in portable programs.
5716 (make_printable_str): Check for overflow in size calculations.
5717 (xmemdup): Remove. All uses rewritten.
5718 (find_bracketed_repeat): Args are now of proper pointer-to-integer
5719 type. Do not reject [c*0]. Use xstrtoumax, not xstrtoul.
5720 (find_bracketed_repeat, star_digits_closebracket): Check that the
5721 digits are not escaped.
5722 (build_spec_list): Don't bother to copy opnd_str; not needed.
5723 (build_spec_list, get_next): Simplify internal logic a bit.
5724 (card_of_complement): Fix bug due to char overflow.
5725 (get_spec_stats): Don't assume len fits into int.
5726 Check for integer overflow. Use abort() rather than assert(0).
5727 (string2_extend): Fix subscript error: is_char_class_member (..., 255)
5729 (squeeze_filter): READER is never null now; simplify code.
5730 READER arg now has a simpler type. Remove unnecessary casts.
5731 (squeeze_filter, main): Calls to fwrite improperly checked result
5732 against zero, rather than against requested size.
5733 (plain_read): New function.
5734 (read_and_delete, read_and_xlate):
5735 Remove unused filter arg, and don't worry about hit_eof.
5736 Simplify by using plain_read.
5737 (set_initialize): Args are bool and bool *, not int and SET_TYPE *.
5738 (main): Always pass a non-null procedure to squeeze_filter.
5739 Rewrite so that class_ok isn't needed.
5741 2004-05-29 Paul Eggert <eggert@cs.ucla.edu>
5743 * src/shred.c (dosync): Ignore EBADF errors, as IRIX 6.5
5744 fdatasync reports EBADF when syncing (unwritable) directories.
5745 Problem reported by Albert Chin-A-Young in:
5746 http://lists.gnu.org/archive/html/bug-coreutils/2004-05/msg00165.html
5748 2004-05-29 Jim Meyering <jim@meyering.net>
5750 * tests/chown/deref: Fix typo: use ls -ldo, not ls -ldg.
5751 Patch from Albert Chin.
5753 * src/ptx.c (text_buffer_maxend): Remove declaration of unused variable.
5755 * src/remove.c (push_dir): Merge declaration and adjacent assignment
5756 into a single statement.
5758 2004-05-28 Jim Meyering <jim@meyering.net>
5760 * src/remove.c (AD_mark_helper): Eliminate an unnecessary comparison.
5762 2004-05-22 Jim Meyering <jim@meyering.net>
5764 rm -r would get a failed assertion when run from an inaccessible
5765 directory and with two or more command line arguments including an
5766 absolute-named directory followed by a relative-named directory.
5768 * src/remove.h (struct rm_options) [require_restore_cwd]: New member.
5769 * src/remove.c (struct cwd_state): Define.
5770 (AD_pop_and_chdir): Redesign interface so that a restore_cwd failure
5771 can be detected by the caller. Instead of returning a malloc'd
5772 directory name, communicate it to caller via a new parameter, and
5773 return an indication of whether restore_cwd failed. Update caller.
5774 Eliminate an unnecessary call to AC_stack_top.
5775 (remove_dir): Change type of cwd_state parameter to `struct cwd_state'
5776 so we can now communicate to caller whether/how functions like
5777 restore_cwd have failed. Update caller.
5778 (rm_1): Fail if we've failed to restore the working directory
5779 and the name of the next file to remove is `.'-relative.
5780 (rm): Fail if the require_restore_cwd flag is true and we've
5781 failed to restore the working directory.
5782 * src/mv.c (rm_option_init): Initialize new member,
5783 x->require_restore_cwd.
5784 * src/rm.c (rm_option_init): Likewise.
5786 2004-05-21 Jim Meyering <jim@meyering.net>
5788 * tests/rm/inaccessible: New test for the above fix.
5789 * tests/rm/Makefile.am (TESTS): Add inaccessible.
5791 * src/remove.c (rm): Use free rather than XFREE.
5792 (remove_dir): Use xmalloc, not XMALLOC.
5793 (ds_init): Likewise.
5795 2004-05-20 Jim Meyering <jim@meyering.net>
5797 * Makefile.maint (sc_unmarked_diagnostics): Now that the unmarked
5798 diagnostics in shred.c have been fixed, don't exempt shred.c from
5801 * src/shred.c: Use translatable diagnostics, e.g.
5802 change "%s: remove" to _("%s: failed to remove") and
5803 change "%s: close" to _("%s: failed to close").
5805 2004-05-17 Paul Eggert <eggert@cs.ucla.edu>
5807 * src/shred.c (names): Bring back lower-case letters, "_", and
5808 ".". But continue to omit +, =, %, @, #, as they're either
5809 shell metacharacters (for some shells) or are not in some
5810 character sets, or (in the case of '%') must be a
5811 metacharacter somewhere.
5813 2004-05-16 Paul Eggert <eggert@cs.ucla.edu>
5815 * src/cut.c (cut_fields): Adjust to new signature of getndelim2.
5817 2004-05-17 Jim Meyering <jim@meyering.net>
5819 * src/shred.c (incname): Decrement `len' only once per loop iteration.
5821 chgrp and chown now dereference symlinks by default, per POSIX.
5822 Reported by Michal Politowski as http://bugs.debian.org/249177.
5824 * src/chown-core.c (chopt_init): Affect each symlink referent by default.
5825 * src/chown.c (usage): Update to reflect this.
5826 * src/chgrp.c (usage): Likewise.
5827 * NEWS: Describe the change.
5828 Adapt tests accordingly.
5829 * tests/chgrp/basic: Use -h where necessary to retain semantics.
5830 * tests/chgrp/deref: Likewise.
5831 * tests/chgrp/posix-H: Likewise.
5833 2004-05-15 Paul Eggert <eggert@cs.ucla.edu>
5835 In shred, check for errors from fdatasync more carefully. If
5836 fdatasync fails with errno==EINVAL, it means this implementation
5837 does not support synchronized I/O for this file. Do not report
5838 this as an error, as (for example) AIX 5.2 fdatasync reports it
5839 for raw disk devices. Problem reported by Albert Chin in
5840 <http://mail.gnu.org/archive/html/bug-gnu-utils/2004-05/msg00028.html>.
5842 Check for write errors, though: the old code ignored them.
5843 Improve error checking in a few other cases, too (e.g., close of a
5846 Also, change several 'int' values to 'bool', so that the error
5847 checking is a bit clearer. Similarly, change unsigned values
5848 to size_t where appropriate.
5850 * src/shred.c: Include "dirname.h".
5851 (datasync) [!HAVE_FDATASYNC]: Remove.
5852 (dosync): New function.
5853 (dopass): Use it. Return 1 on write error, -1 on other error.
5854 All callers changed. Report write error if dosync does.
5855 (do_wipefd, wipefd, wipename, wipefile): Return bool (true/false),
5856 not int (0/-1). All callers changed. Return false if there's a
5858 (incname): Return bool (true/false), not int (0/1). Accept
5859 size_t length, not unsigned. All callers changed. Do not
5860 bother checking for non-digits; it can't happen. Replace
5861 recursion with iteration.
5862 (wipename): Use dir_name, base_name, etc. instead of assuming
5863 Unix file names. Use size_t for length, not unsigned.
5864 Report error if unlink or close fails.
5865 (wipename, main): Use bool for booleans.
5867 (names): Use only digits and uppercase letters, for greater
5870 2004-05-16 Jim Meyering <jim@meyering.net>
5872 * tests/chown/deref: New test for the yesterday's change.
5873 * tests/chown/Makefile.am (TESTS): Add deref.
5875 2004-05-15 Jim Meyering <jim@meyering.net>
5877 chown --dereference did nothing when the owner/group of a
5878 symlink matched the desired owner/group. Reported by David Malone.
5879 Also reported in 1999 as http://bugs.debian.org/39642.
5881 * src/chown-core.c (change_file_owner): When --dereference has
5882 been specified, and when processing a symlink, stat it to get the
5883 owner and group of the referent.
5885 2004-05-14 Jim Meyering <jim@meyering.net>
5887 * man/pwd.x, man/echo.x, man/printf.x: Fix typo:
5888 s/supercede/supersede/ reported by Andrew Fabbro.
5890 2004-05-13 Paul Eggert <eggert@cs.ucla.edu>
5892 Improve performance of `sort -m' on large files, at the cost of
5893 making some contrived examples unsafe. POSIX allows this
5894 optimization. Performance problem reported by Jonathan Baker in
5895 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00071.html>.
5897 * src/sort.c (first_same_file): Do not treat input pipes
5898 differently from other files.
5899 * doc/coreutils.texi (sort invocation): Document that "sort -m -o F"
5900 might write F before reading all the input.
5903 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
5905 * src/od.c (print_ascii, dump_strings): Use e.g. '\a' rather than
5906 '\007', for portability to EBCDIC hosts.
5907 * src/printf.c (print_esc_char): Likewise.
5908 * src/tr.c (unquote, make_printable_str): Likewise.
5910 2004-05-12 Jim Meyering <jim@meyering.net>
5912 * src/remove.c (AD_pop_and_chdir): Move lstat-`.' into if-block
5913 where the result is used. This avoids one unnecessary lstat call
5914 per command line argument.
5916 2004-05-12 Paul Eggert <eggert@cs.ucla.edu>
5918 Don't assume that "make -C" works; Solaris "make" doesn't have -C.
5920 * src/Makefile.am (all_programs.list): New rule, copied from
5921 man/Makefile.am and tests/Makefile.am, except that we use the
5922 system tr rather than ./tr and we don't use tr -s.
5923 * tests/Makefile.am (all_programs): Use it.
5924 * man/Makefile.am (all_programs): Likewise. Renamed from programs,
5925 for consistency. All uses changed.
5927 2004-05-11 Jim Meyering <jim@meyering.net>
5929 * tests/rm/unread3: New test, for the above fix and today's
5930 lib/save-cwd.c improvement.
5931 * tests/rm/Makefile.am (TESTS): Add unread3.
5933 * src/rm.c: Don't include "save-cwd.h". It's no longer used.
5935 2004-05-10 Jim Meyering <jim@meyering.net>
5937 * tests/install/trap: New file. Test for bug fix of 2004-04-18.
5938 * tests/install/Makefile.am (TESTS): Add trap.
5940 * src/remove.c (AD_push): Don't use errno in diagnostic about
5943 Remove these generated files from CVS.
5944 * tests/cut/cut-tests, tests/date/date-tests, tests/join/join-tests:
5945 * tests/ls/ls-tests, tests/pr/pr-tests, tests/tac/tac-tests:
5946 * tests/tail/tail-tests, tests/test/test-tests, tests/tr/range-tests:
5947 * tests/tr/tr-tests, tests/wc/wc-tests:
5949 2004-05-09 Jim Meyering <jim@meyering.net>
5951 * src/tr.c (unquote): Use xcalloc rather than xmalloc and
5952 a loop initializing the just-allocated memory to zero.
5954 2004-05-08 Jim Meyering <jim@meyering.net>
5956 * tests/rm/no-give-up: New file; check for today's fix.
5957 * tests/rm/Makefile.am (TESTS): Add no-give-up.
5959 2004-05-08 Paul Eggert <eggert@cs.ucla.edu>
5961 Fix bug where "rm" gave up too easily, reported by Dan Jacobsen in
5962 <http://mail.gnu.org/archive/html/bug-coreutils/2004-05/msg00013.html>.
5964 * src/remove.c (remove_entry): Check for errno values like ENOENT
5965 that show the file cannot be directory, instead of for errno
5966 values like EPERM that show the file might be a directory. This
5967 is necessary because, when a single unlink() call has multiple
5968 reasons to fail, it can set errno to any of those reasons; it's
5969 only the rare errno value like ENOENT that excludes all the other
5970 possible reasons to fail even when the file is a directory.
5971 (remove_cwd_entries): Don't attempt chdir if the file is known
5972 to not be a directory.
5973 (remove_dir): Use the same method that remove_cwd_entries uses
5974 (for some reason they differed). Don't assert that saved_errno
5975 must be EPERM; it might be just about anything.
5977 2004-05-06 Jim Meyering <jim@meyering.net>
5979 * src/id.c (xgetgroups): Use xnmalloc, rather than xmalloc.
5980 Don't add `1' to the buffer size (it was to protect against malloc
5981 implementations that fail to allocate a buffer of size zero).
5982 That is no longer necessary, since we use a malloc wrapper
5985 * src/wc.c (get_input_fstatus): Use xnmalloc, rather than xmalloc.
5986 * src/head.c (elide_tail_bytes_pipe): Likewise.
5987 * src/df.c (main): Likewise.
5988 * src/shred.c (do_wipefd): Likewise.
5989 * src/users.c (list_entries_users): Likewise.
5990 * src/tail.c (main): Likewise.
5991 * src/md5sum.c (main): Likewise.
5993 2004-04-29 Paul Eggert <eggert@cs.ucla.edu>
5995 * src/df.c (show_disk, show_point): If several filesystems are
5996 mounted on the same mount point, prefer the last one, not the first.
5997 Problem reported by Christian Jones in
5998 <http://mail.gnu.org/archive/html/bug-coreutils/2004-04/msg00200.html>.
5999 (show_disk): Remove unused statp arg. Return bool, not int.
6000 (show_point): Rewrite to avoid gotos. Use the same algorithm
6001 for lofs and dummies for each pass through the mount table,
6002 rather than subtly different algorithms (which are probably
6005 2004-05-03 Jim Meyering <jim@meyering.net>
6007 * Makefile.am (EXTRA_DIST): Add m4/ChangeLog, now that we no longer
6010 2004-05-01 Jim Meyering <jim@meyering.net>
6012 When chown or chgrp is modifying the referent of a symlink,
6013 use the chown(2) function, if possible.
6014 * src/chown-core.c (change_file_owner): Don't hard-code the
6015 open/fchown/close kludge here. Use `chown' instead.
6016 The chown function works just fine on conforming systems.
6017 Other systems now go through the new chown wrapper that
6018 resorts to the old kludge.
6020 * src/chown-core.c (change_file_owner): Add a comment.
6022 2004-04-27 Jim Meyering <jim@meyering.net>
6024 * src/ptx.c: Make over 40 global extern variables `static'.
6025 (syntax_table, re_syntax_table): Remove declarations of two unused
6026 variables (they were exposed by the above change).
6028 * src/du.c (G_fail, opt_nul_terminate_output): Declare `static'.
6029 * src/ln.c (backup_type): Likewise.
6031 * src/remove.c (rm): Add `extern' keyword.
6032 * src/cp-hash.c (forget_created, remember_created)
6033 (src_to_dest_lookup, remember_copied, hash_init, forget_all): Likewise.
6034 * src/copy.c (dest_info_init, src_info_init, copy): Likewise.
6035 * src/chown-core.c (chopt_init, chopt_free, gid_to_name)
6036 (uid_to_name, chown_files): Likewise.
6038 * src/Makefile.am (sc_tight_scope): New rule.
6039 * Makefile.maint (sc_tight_scope): New rule.
6040 (syntax-check-rules): Add it.
6042 2004-04-26 Jim Meyering <jim@meyering.net>
6044 * Use automake-1.8.4. Regenerate dependent files.
6046 * src/sort.c (limfield): Make a comment clearer.
6048 2004-04-25 Paul Eggert <eggert@twinsun.com>
6050 Fix POSIX-conformance bug: "sort -k 3,3.5b" is supposed to skip
6051 leading blanks when computing the location of the field end;
6052 it is not supposed to skip trailing blanks. Solaris 8 "sort"
6053 does conform to POSIX. Also fix the documentation to clarify
6054 this and related issues.
6056 * doc/coreutils.texi (sort invocation): Mention -k earlier, so
6057 that the options are in alphabetical order. Describe how -b works
6058 more-accurately; this involves fixing some examples, too. Mention
6059 what happens if the start field falls after an end field or after
6060 a line end. Warn about using -k without -b, -g, -M, -n, or -t.
6061 Add an example of how to sort IPv4 addresses and Apache Common
6062 Log Format dates. Remove a duplicate example.
6063 (Putting the tools together): Use separate options rather
6064 than agglomerating them.
6065 * src/sort.c (limfield): Use skipeblanks, not skipsblanks, to
6066 decode whether to skip leading blanks.
6067 (trailing_blanks): Remove.
6068 (fillbuf, getmonth, keycompare): Don't trim trailing blanks.
6070 * tests/pr/Test.pm: Fix typo in env_default comment.
6071 * tests/sort/Test.pm: Likewise.
6072 (18c, 18d): Reverse the order of output lines, so that the
6073 test cases conform to POSIX.
6075 2004-04-22 Paul Eggert <eggert@twinsun.com>
6077 More signal-handling cleanup for ls.c. Do not allow signals to
6078 happen between arbitrary output bytes, as the
6079 restore-default-color sequence can bollix up multibyte chars or
6080 color-change sequences in the ordinary output. Instead, process
6081 signals only between printing a file name and changing the color
6082 back to non_filename_text color. That way, if the signal handler
6083 changes the color (to the default), 'ls' will change it back when
6084 'ls' continues (after being suspended).
6086 Also, do not bother with signal-handling unless stdout is a
6087 controlling terminal; this lets stdio buffer better when "ls
6088 --color" is piped or sent to a file.
6090 * src/ls.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]: New macros.
6091 Do not include "full-write.h"; no longer needed.
6092 (tcgetpgrp) [! HAVE_TCGETPGRP]: New macro.
6093 (put_indicator_direct): Remove. All callers changed to use
6095 (caught_signals, interrupt_signal, stop_signal_count): New vars.
6096 (restore_default_color): Don't bother checking for put_indicator
6098 (sighandler): Don't handle SIGTSTP; that's another handler now.
6099 Simply set interrupt_signal to the signal, then exit.
6100 (stophandler, process_signals): New functions.
6101 (main): Don't output any color changes until _after_ the signal
6102 handlers are set up. This fixes a race condition where 'ls'
6103 could be interrupted while initializing colors, and leaving the
6104 terminal in an undesirable state.
6105 Don't mess with signal-handling if standard output is not a
6106 controlling terminal.
6107 When exiting, restore the default color, then restore the
6108 default signal handling, then act on any signals that weren't
6110 Do not print //DIRED// etc. in colors; this avoids the need
6111 to catch signals when printing them.
6112 (print_name_with_quoting): Process signals just before switching
6113 color back to non_filename_text.
6115 2004-04-23 Jim Meyering <jim@meyering.net>
6117 Avoid segfault on systems for which SIZE_MAX != (size_t) -1.
6118 * src/ls.c (quote_name): Use SIZE_MAX, not -1, in calls
6119 of quotearg_buffer. Patch by Mikulas Patocka.
6121 2004-04-18 Paul Eggert <eggert@twinsun.com>
6123 tee ignored SIGPIPE, but POSIX doesn't allow this.
6125 * src/tee.c (main): Do not ignore SIGPIPE, as POSIX 1003.1-2001
6126 does not allow this. This undoes the 1996-10-24 patch.
6128 2004-04-18 Paul Eggert <eggert@twinsun.com>
6130 Signal-handling cleanup for coreutils. Here are the highlights:
6132 - csplit sometimes failed to remove files when interrupted.
6133 - csplit didn't clean up if two signals arrived nearly simultaneously.
6134 - install -s would infloop on System V if SIGCHLD was ignored.
6135 - ls could incorrectly restore color if multiple signals
6136 arrived nearly simultaneously.
6138 * src/csplit.c (sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
6140 (filename_space, prefix, suffix, digits, files_created, remove_files):
6142 (caught_signals): New var.
6143 (cleanup): Block signals while deleting all files.
6144 (cleanup_fatal, handle_line_error, regexp_error):
6145 Mark with ATTRIBUTE_NORETURN.
6146 (create_output_file, close_output_file, interrupt_handler):
6147 Block signals while changing the number of output files,
6148 to fix some race conditions.
6149 (delete_all_files): Do nothing if remove_files is zero.
6150 Clear files_created.
6151 (main): Don't mess with signals until after argument processing
6154 * src/csplit.c (main): Rewrite signal-catching code to make it
6155 similar to other coreutils programs. When processing signals,
6156 block all signals that we catch, but do not block signals that we
6157 don't catch. Avoid problems with unsigned int warnings.
6158 * src/ls.c (main): Likewise.
6159 * src/sort.c (main): Likewise.
6161 * src/csplit.c (interrupt_handler):
6162 Use void, not (obsolete) RETSIGTYPE.
6163 * src/shred.c (sigill_handler, isaac_seed_machdep): Likewise.
6165 * src/csplit.c (interrupt_handler) [defined SA_NOCLDSTOP]:
6166 Use simpler "signal (sig, SIG_DFL)" rather than sigaction equivalent.
6167 * src/ls.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
6168 * src/sort.c (sighandler) [defined SA_NOCLDSTOP]: Likewise.
6169 * src/nohup.c (main) [!defined _POSIX_SOURCE]: Likewise, except
6171 * src/tee.c (main) [!defined _POSIX_SOURCE]: Likewise.
6173 * src/install.c: Include <signal.h>.
6174 (main) [defined SIGCHLD]: Set SIGCHLD handler to the default, if -s is
6175 given, since System V fork+wait does not work if SIGCHLD is ignored.
6177 * src/ls.c (sighandler) [!defined SA_NOCLDSTOP]: Reset signal
6178 handler to self, not to SIG_IGN, since SIGTSTP can be received
6180 (main): Use SA_RESTART, as that is simpler than checking for EINTR
6181 failures all over the place.
6183 2004-04-20 Jim Meyering <jim@meyering.net>
6185 * src/remove.c (is_empty_dir): Clarify comment.
6187 * man/help2man: Accept new option: --program-name=NAME, so that we
6188 can override the one in --version output. This is needed solely
6189 so that test.1 doesn't refer to `[' as the program name.
6190 Reported by Benjamin Cutler as http://bugs.debian.org/205251.
6191 * man/Makefile.am (.x.1): Use help2man's new --program-name option.
6193 * src/pwd.c: Don't include pathmax.h; system.h already does it.
6195 * src/cut.c (cut_fields): Free buffer upon getndelim2 failure.
6197 2004-04-19 Jim Meyering <jim@meyering.net>
6199 * src/shred.c (isaac_seed_start) [AVOID_USED_UNINITIALIZED_WARNINGS]:
6200 Initialize a buffer to avoid warnings from tools like valgrind.
6202 * Makefile.maint (sc_trailing_blank): New rule.
6203 (syntax-check-rules): Add it.
6204 * .x-sc_trailing_blank: New file.
6206 Make pwd work even if the resulting name is so long that getcwd fails.
6207 * src/pwd.c: (path_free, path_init, path_prepend): New functions.
6208 (nth_parent, find_dir_entry, robust_getcwd): New functions.
6209 (main): First try getcwd, then, upon failure, robust_getcwd.
6211 2004-04-18 Jim Meyering <jim@meyering.net>
6213 * src/who.c (print_user): Use xrealloc here, rather than
6214 unchecked realloc. Remove anachronistic casts.
6216 * src/remove.c (full_filename_): Don't leak upon failed realloc.
6218 * src/system.h (readdir_ignoring_dot_and_dotdot): New inline function,
6220 * src/remove.c (readdir_ignoring_dotdirs): Move function to system.h,
6221 renaming it. Update uses.
6223 2004-04-17 Jim Meyering <jim@meyering.net>
6225 * configure.ac: Depend on automake-1.8.3.
6227 * src/join.c (add_file_name): Declare function to be `static'.
6228 (string_to_join_field): Likewise.
6229 * src/remove.c (ds_init, ds_free): Likewise.
6231 * Makefile.maint (sc_prohibit_jm_in_m4): New rule.
6232 (syntax-check-rules): Add to the list.
6234 2004-04-13 Paul Eggert <eggert@twinsun.com>
6236 Use page-aligned buffers whenever we bother to do I/O using buffer
6237 sizes that are tailored for the files.
6239 * src/cat.c: Include getpagesize.h.
6240 * src/copy.c: Likewise.
6241 * src/shred.c: Likewise.
6242 * src/split.c: Likewise.
6243 * src/cat.c (main): Align I/O buffers to page boundaries.
6244 * src/copy.c (copy_reg): Likewise.
6245 * src/shred.c (dopass): Likewise.
6246 * src/split.c (main): Likewise.
6247 * src/dd.c (ROUND_UP_OFFSET, PTR_ALIGN): Remove.
6248 All uses replaced by ptr_align.
6249 * src/od.c (gcd, lcm): Remove; now in system.h.
6250 * src/system.h (gcd, lcm, ptr_align): New functions, moved from od.c.
6252 2004-04-14 Jim Meyering <jim@meyering.net>
6254 Remove m4/Makefile.am: it's no longer needed, with newer automake
6255 * configure.ac (AC_CONFIG_FILES): Remove m4/Makefile.in from the list.
6256 * Makefile.am (SUBDIRS): Remove `m4' from the list.
6258 2004-04-13 Jim Meyering <jim@meyering.net>
6260 * configure.ac: Change `jm_' in AC_DEFINE'd names to `gl_'.
6262 2004-03-27 Paul Eggert <eggert@twinsun.com>
6264 * NEWS: cp -pu and mv -u (when copying) now take the destination
6265 file system time stamp resolution into account.
6266 * doc/coreutils.texi (mv invocation): Document this.
6267 (cp invocation): Document -u (it was missing!) with new behavior.
6269 * src/copy.c: Include "utimecmp.h".
6270 (copy_internal): Compare time stamps using utimecmp rather than
6273 2004-04-09 Jim Meyering <jim@meyering.net>
6275 * Makefile.maint (.re-list): New rule/file, to replace
6276 hard-coded list of header file names.
6277 (sc_system_h_headers): Use the new file.
6278 Don't look for sys2.h anymore.
6280 * src/system.h: Include new "stat-macros.h" rather than hard-coding
6281 all of its macro definitions -- the list was slightly out of date.
6282 Suggestion from Dmitry V. Levin.
6284 2004-04-08 Paul Eggert <eggert@cs.ucla.edu>
6286 * NEWS: Remove noctty flag from dd. Suggested by Philippe Troin.
6287 * doc/coreutils.texi (dd invocation): Likewise.
6288 * src/shred.c (O_NOCTTY): Remove redundant decl.
6289 * src/dd.c (flags, usage): Remove noctty flag.
6290 (main): Always use O_NOCTTY when opening files.
6292 2004-04-08 Jim Meyering <jim@meyering.net>
6294 * src/dd.c (dd_copy): Mark two diagnostics for translations.
6295 (set_fd_flags): Undo part of today's change: it's a little
6296 cleaner -- and more efficient in the common case -- to go
6297 ahead and OR in the -1 when fcntl fails.
6299 * Makefile.maint (sc_dd_max_sym_length): New target.
6300 (syntax-check-rules): Add it.
6302 * src/md5sum.c (PROGRAM_NAME) [algorithm == ALG_SHA1]:
6303 Correct spelling: s/shasum/sha1sum. Reported by Jesse Kornblum.
6305 * src/dd.c (set_fd_flags): Don't OR in -1 when fcntl fails.
6306 Rename parameter, flags, to avoid shadowing global.
6307 (LONGEST_SYMBOL): Tweak comment.
6309 2004-04-07 Paul Eggert <eggert@twinsun.com>
6311 * NEWS: New dd conv= symbols nocreat, excl, fdatasync, fsync,
6312 and new dd options iflag= and oflag=.
6313 * src/dd.c (usage): Likewise.
6314 * src/Makefile.am (dd_LDADD, shred_LDADD): Add fdatasync's lib.
6315 * src/dd.c (fdatasync) [!HAVE_FDATASYNC]: New macro.
6316 (C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): New macros.
6317 (input_flags, output_flags): New vars.
6318 (LONGEST_SYMBOL): New macro.
6319 (struct symbol_value): Renamed from struct conversion. Members
6320 symbol and value renamed from convname and conversion. The
6321 symbol value is now an array instead of a pointer; this saves
6322 a bit of space and time in practice. All uses changed.
6323 (conversions): Add nocreat, excl, fdatasync, fsync. Now const.
6324 (flags): New constant array.
6325 (iflag_error_msgid, oflag_error_msgid): New constants.
6326 (parse_symbols): Renamed from parse_conversion and generalized
6327 to handle either conversion or flag symbols.
6328 (scanargs): Adjust uses of parse_symbols accodingly. Add
6329 support for iflag= and oflag=. Reject attempts to use
6330 both excl and nocreat.
6331 (set_fd_flags): New function.
6332 (dd_copy): Just return X rather than calling quit (X), since our
6333 caller invokes quit with the returned value. Add support for
6334 fdatasync and fsync.
6335 (main): Add support for iflag=, oflag=, and new conv= symbols.
6336 * src/system.h (O_DIRECT, O_DSYNC, O_NDELAY, O_NOFOLLOW,
6337 O_RSYNC, O_SYNC): Define to 0 if not already defined.
6339 * NEWS: Remove duplicate mention of BLOCKSIZE.
6341 2004-04-02 Andreas Schwab <schwab@suse.de>
6343 * src/stty.c: Add support for IUTF8 input flag.
6345 2004-04-06 Jim Meyering <jim@meyering.net>
6347 * src/system.h (makedev) [mkdev && !makedev]: Define in terms of mkdev.
6348 Interix spells it `mkdev'. Reported by Mark Funkenhauser.
6350 2004-04-04 Jim Meyering <jim@meyering.net>
6352 A specified format is no longer automatically newline terminated.
6353 If you want a newline at the end of your format, use `\n'.
6354 * src/stat.c (print_it): Don't print a newline at the end of
6356 (do_statfs): Add a newline at end of each default format string.
6358 2004-03-30 Paul Eggert <eggert@twinsun.com>
6360 * src/nohup.c (main): Adjust to new calling convention
6361 for set_cloexec_flag.
6363 2004-03-31 Jim Meyering <jim@meyering.net>
6365 * tests/Fetish.pm (run_tests): Remove `.orig' file.
6366 Remove debugging diagnostic.
6368 Specifying an invalid --width=N (-w) or --gap-size=N (-g)
6369 would not elicit an error.
6370 * src/ptx.c: Include "xstrtol.h" and "quotearg.h".
6371 (main): Don't use atoi. Use xstrtoul instead.
6373 2004-03-30 Jim Meyering <jim@meyering.net>
6375 * Makefile.maint (sc_prohibit_atoi_atof): New rule.
6376 (syntax-check-rules): Add it.
6377 * .x-sc_prohibit_atoi_atof: New file.
6379 2004-03-29 Jim Meyering <jim@meyering.net>
6381 * tests/du/files0-from: Use new OUT_SUBST directive, so that this
6382 test is not sensitive to system-dependent block size differences.
6383 Prompted by a report of Solaris 8 differences from Paul Eggert.
6385 * tests/Fetish.pm: Accept new directives: OUT_SUBST, ERR_SUBST.
6386 Rename `%tmp' to `%actual'. Reverse order of last two args to
6387 _compare_files (to $actual, $expected) so as to match declaration.
6389 2004-03-28 Paul Eggert <eggert@twinsun.com>
6391 Fix some gotchas encountered when porting to Solaris 8, using
6392 the Forte 6u2 compiler.
6394 * src/hostname.c [HAVE_SETHOSTNAME && !defined sethostname]:
6395 Declare sethostname, since no Solaris header does it.
6396 * src/who.c: Include "vasprintf.h", for asprintf.
6398 2004-03-28 Jim Meyering <jim@meyering.net>
6401 * src/du.c (process_file): Don't record dev/inode for directories.
6403 Under some circumstances, without -c, du would mistakenly count the
6404 space of hard-linked files, not just the first one it encountered.
6405 Reported by Anthony Thyssen.
6406 * src/du.c (du_files): Don't ever clear the set of `seen' dev/inodes.
6408 * src/du.c: Rename global `print_totals' to `print_grand_total'.
6410 * src/du.c (main): Rearrange filtering loop to be a tiny bit
6413 * src/chown-core.c: Don't include savedir.h -- no longer needed.
6414 * src/chmod.c: Likewise.
6416 2004-03-25 Jim Meyering <jim@meyering.net>
6418 * src/du.c (main): Remove now-unused declaration of `i'.
6420 2004-03-24 Paul Eggert <eggert@twinsun.com>
6422 * src/du.c (main): Filter out file names of length zero before
6423 invoking fts, so that they don't cause fatal errors.
6425 2004-03-25 Jim Meyering <jim@meyering.net>
6427 * tests/du/files0-from (zero-len): Add a test for the above.
6429 2004-02-25 Paul Eggert <eggert@twinsun.com>
6431 * NEWS: New environment var BLOCKSIZE.
6432 * lib/human.c (humblock): Support BLOCKSIZE as well as BLOCK_SIZE.
6433 * tests/envvar-check: Test for it. Factor the code to simplify it.
6435 2004-03-23 Paul Eggert <eggert@twinsun.com>
6437 * NEWS: Shorten the du --files0-from announcement, and say
6438 "NUL-terminated" rather than "NUL-separated".
6439 * src/du.c (EXPECTED_BYTES_PER_FILE_NAME, DEFAULT_PROJECTED_N_FILES):
6441 (usage): Say "NUL-terminated", not "NUL-separated".
6442 (main): Check for I/O error when istream is closed.
6443 Allow --files0-from=F even if F is empty; this specifies no files.
6444 (du_files): Now that we allow the list of files to be empty,
6446 * tests/du/files0-from: Adjust to above changes to src/du.c.
6448 2004-03-24 Jim Meyering <jim@meyering.net>
6450 * tests/tail-2/assert: Avoid race condition that could cause
6451 spurious failure. Based on a patch from Andreas Schwab.
6453 2004-03-23 Jim Meyering <jim@meyering.net>
6455 * src/du.c (main): Free the hash table, too.
6457 2004-03-22 Jim Meyering <jim@meyering.net>
6459 * man/Makefile.am (.x.1): Remove --info-page= option, reverting
6460 the change of 2004-01-22. I can no longer reproduce the problem
6461 that prompted that change, and `info coreutils pr' would display the
6462 `printing text' section of the manual, not the one on `pr invocation'.
6464 * tests/du/files0-from (nul-1, nul-2): Adjust expected diagnostics
6465 to match corrected output.
6467 * src/du.c: Include "readtokens0.h" rather than "readtokens.h".
6468 (main): Use readtoken0 functions rather than readtokens.
6469 Don't use errno when diagnosing readtokens0 failure.
6470 Fix off-by-one error in the token number reported in a diagnostic.
6471 (du_files): Return bool, rather than int.
6472 (main): Call readtokens0_free.
6474 2004-03-21 Jim Meyering <jim@meyering.net>
6476 * src/remove.c (ds_free): Plug a small leak.
6478 * tests/Fetish.pm: Fix typo in comment.
6480 2004-03-07 Jim Meyering <jim@meyering.net>
6482 * NEWS: du accepts a new option --files0-from=FILE, where FILE
6483 contains a list of NUL-separated file names.
6485 * src/du.c: Include "readtokens.h".
6486 (usage): Describe the new option, and adjust the `Usage':
6487 with this option, no FILE may be specified on the command line.
6488 (main): Handle the new option.
6490 * tests/du/files0-from: New tests, for the above.
6491 * tests/du/Makefile.am (TESTS): Add files0-from.
6493 * src/factor.c (do_stdin): Reflect changes in use of readtoken.
6494 * src/tsort.c (tsort): Likewise.
6496 2004-02-29 Paul Eggert <eggert@twinsun.com>
6498 * NEWS: Add support for a new notation @N to get_date to represent
6499 the time stamp with numeric value N. Improve support for
6500 fractional time stamps. date's -d and -f options now accept them.
6501 Likewise for touch -t. date has a new option --iso-8601=ns.
6503 * doc/coreutils.texi (touch invocation):
6504 Describe use of fractional seconds.
6505 (date invocation, Options for date): Likewise.
6506 * doc/getdate.texi (General date syntax, Time of day items): Likewise.
6507 * doc/coreutils.texi (date invocation): Mention effect of LC_TIME.
6508 (Options for date): Describe new --iso-8601=ns option.
6510 * doc/getdate.texi: Add copyright notice. Change getdate to
6511 get_date when talking about the function name.
6512 (Seconds since the Epoch): New section, containing the time_t
6513 info moved from Date input formats section, along with new
6514 info about the @ syntax. Mention negative time stamps,
6515 fractional time stamps, and leap seconds.
6516 (General date syntax): Modernize examples a bit to reflect new
6518 (General date syntax, Relative items in date strings):
6519 Use ' rather than " to quote formats.
6520 (Time of day items): Add an example with fractional seconds.
6521 Describe fractional-second syntax.
6523 * src/Makefile.am (touch_LDADD): New macro, since `touch' now
6524 needs clock_gettime.
6526 * src/date.c (enum Time_spec): New enum TIME_SPEC_NS.
6527 (time_spec_string, time_spec, show_date): Support it.
6528 (usage): Remove description of -ITIMESPEC, as it's obsolete and
6529 confusing. Mention --iso-8601=ns.
6530 (batch_convert): getline returns ssize_t, not int.
6532 * src/touch.c (newtime): Now an array of two timespecs, one
6533 for access and one for modification.
6534 (ref_stats): Remove.
6535 (get_reldate): Use get_date's parameter profile.
6536 (touch, main): Adjust to above changes.
6537 (main): Work even if tm_year == INT_MAX (so long as long int is wider).
6538 Use gettime instead of gettimeofday, for new get_date signature.
6540 * tests/date/Test.pm (test_vector): New tests epoch, ns-10, ns-max32,
6543 2004-03-15 Jim Meyering <jim@meyering.net>
6545 * Makefile.maint (alpha beta major): `Make' the emit_upload_commands
6546 target before updating $(prev_version_file).
6548 * tests/misc/date-sec: New file, to test for just-fixed bug in date.
6549 See today's change in lib/getdate.y.
6550 * tests/misc/Makefile.am (TESTS): Add date-sec.
6552 2004-03-14 Jim Meyering <jim@meyering.net>
6554 * announce-gen (print_changelog_deltas): Use `.sig' suffix for
6555 signature files, not `.asc'. Reported by angico@yahoo.com.
6557 2004-03-13 Jim Meyering <jim@meyering.net>
6559 * src/cp.c (do_copy): Tweak wording in a diagnostic.
6560 Suggestion from Karl Berry.
6561 Include "quoatearg.h".
6562 (do_copy): Use quotearg_colon (not quote) for diagnostics
6563 that begin with `"%s:'.
6565 * src/nl.c (usage): Specify that nl uses _basic_ regular expressions.
6566 Suggestion from Dan Jacobson.
6568 2004-03-12 Jim Meyering <jim@meyering.net>
6572 Sometimes, when source and destination partition are different,
6573 mv mistakenly fails to preserve a hard link. Reported by IIDA Yosiaki.
6575 * src/copy.c: When moving a set of N hard-linked files between
6576 partitions, via two or more command line arguments where the
6577 command line argument containing the Nth link contains no other
6578 link to that same file, mv would mistakenly copy the file, rather
6579 than hard-linking it to the other(s). That happens because when the
6580 final link is processed, its link count has been reduced to 1 since
6581 the other links have been `copied' to the destination partition
6582 and the source links have been removed.
6583 (copy_internal): When in move mode, use the source dev/inode
6584 pair to look up destination name even when st_nlink == 1.
6585 * src/cp-hash.c (src_to_dest_lookup): New function.
6586 * src/cp-hash.h (src_to_dest_lookup): Add prototype.
6587 * tests/mv/part-hardlink: New file. Test for the above fix.
6588 * tests/mv/Makefile.am (TESTS): Add part-hardlink.
6590 * announce-gen: Sync with autoconf.
6592 * tests/ls/time-1: Exit 77 (not 1) if we can't set up for the test.
6593 This was triggered on a Linux-2.2.19 system using a file system
6594 NFS-mounted from some sort of Sun.
6596 2004-03-11 Jim Meyering <jim@meyering.net>
6598 * Use automake-1.8.3. Regenerate dependent files.
6600 2004-03-10 Jim Meyering <jim@meyering.net>
6602 * tests/du/deref-args: Also convert sizes in the 70-79 kB range,
6603 so that this test works with SELinux-enabled systems.
6604 Based on a patch from Tim Waugh.
6606 `join -1 x' would give a misleading diagnostic
6607 * src/join.c (string_to_join_field): Report that a non-numeric field
6608 number is invalid, rather than `so large that it is not representable'.
6609 * tests/join/Test.pm (invalid-j): New partial test for the above fix.
6611 2004-03-06 Jim Meyering <jim@meyering.net>
6613 cp --sparse=always sparse-image-file.img /dev/hda1 could
6614 produce an invalid copy on the destination device.
6616 * src/copy.c (copy_reg): Even with --sparse=always, try to
6617 make `holes' only if the destination is a regular file.
6618 Reported by Szakacsits Szabolcs.
6620 2004-03-03 Paul Eggert <eggert@twinsun.com>
6622 * src/nohup.c (main): Don't invoke set_cloexec_flag with
6623 a file descriptor of -1.
6625 2004-03-02 Dmitry V. Levin <ldv@altlinux.org>
6627 * src/nohup.c: Include "cloexec.h".
6628 (main): Set the copy of stderr to close on exec.
6630 2004-03-01 Paul Eggert <eggert@twinsun.com>
6632 * configure.ac: Include <signal.h> when checking for strsignal,
6633 sys_siglist, and friends. Problem reported by Tony Leneis in
6634 <http://mail.gnu.org/archive/html/bug-coreutils/2004-02/msg00136.html>.
6636 2004-02-25 Paul Eggert <eggert@twinsun.com>
6638 * tests/du/deref-args, tests/du/exclude, tests/du/slash:
6639 * tests/du/trailing-slash: Run envvar-check in case BLOCK_SIZE
6642 2004-02-23 Paul Eggert <eggert@twinsun.com>
6644 * NEWS: Document how chown's USER.GROUP argument is now parsed.
6646 2004-02-23 Jim Meyering <jim@meyering.net>
6648 * src/seq.c (usage): Remove stray space after \n in --help output.
6650 2004-02-22 Jim Meyering <jim@meyering.net>
6652 * src/du.c (usage): Separate -H and --si. Say that the meaning
6653 of -H will soon change to that of --dereference-args (-D).
6655 2004-02-21 Jim Meyering <jim@meyering.net>
6657 * src/comm.c (usage): Tell what comm does when there are no options.
6658 Reword in terms of FILE1 and FILE2 rather than `left file' and
6659 `right file'. Suggestion from Dan Jacobson.
6661 2004-02-15 Paul Eggert <eggert@twinsun.com>
6663 Fix some POSIX-conformance bugs in expr.
6665 * NEWS: document the following changes to src/expr.c.
6666 * doc/coreutils.texi (expr invocation): Likewise.
6667 Document what forms integers may take, and say "integer"
6668 consistently instead of "number". Warn about operands
6669 that "expr" can misinterpret, and how to work around the
6671 * src/expr.c (eval, eval7, eval6, eval5, eval4, eval3, eval2, eval1):
6672 Accept a bool argument specifying whether to evaluate the
6673 expression. This is to allow short-circuit evaluation. All
6675 (null): Report that a string is zero even if it has
6676 a form like "-0" or "00".
6677 (eval1, eval): Use short-circuit evaluation for | and &.
6678 (eval): Return 0 if both arguments are null or zero, instead
6679 of returning the first argument.
6680 * tests/expr/basic: Add some tests for the above.
6682 2004-02-17 Jim Meyering <jim@meyering.net>
6686 `make check' from a build inside a chroot environment would fail
6687 * tests/help-version: Specify an argument (`/') for df, in the
6688 unusual event that there is no valid entry in /etc/mtab.
6689 Likewise for id: add the -u option, so we don't get spurious
6690 failures when there are no user or group names.
6693 * src/sort.c (usage) [-u]: Add punctuation so that the description in
6694 the help2man-generated (line-joined) man page is more readable.
6695 Reported by Tim Waugh.
6696 [-T]: Add a semicolon, for the same reason.
6698 2004-02-15 Jim Meyering <jim@meyering.net>
6700 * Makefile.am (dist-hook): Qualify target with $(srcdir)/ prefix.
6702 2004-02-11 Jim Meyering <jim@meyering.net>
6704 * tests/Makefile.am.in ($(srcdir)/Makefile.am): Use more portable
6705 $(srcdir)/../Makefile.am.in, rather than $<.
6706 Suggestion from Michael Elizabeth Chastain.
6708 2004-02-10 Jim Meyering <jim@meyering.net>
6710 * config/install-sh: Make this script executable.
6711 * Makefile.am (dist-hook): New target, to ensure that config/install-sh
6712 is executable. Otherwise, on systems that lack a suitable install
6713 binary, `make install' would fail, because of the way this script
6714 is invoked (without `$SHELL ' prefix).
6715 Reported by Bob Proulx.
6717 2004-02-08 Jim Meyering <jim@meyering.net>
6721 * tests/rm/rm5: Avoid triggering a bug in OSF/Tru64's sed
6722 that would cause an unwarranted test failure.
6723 * tests/rm/rm3: Likewise.
6725 2004-02-07 Jim Meyering <jim@meyering.net>
6727 Remove xstat function pointer member. The way it was used was not
6728 portable, since some systems (OSF V5.1, Solaris 2.5.1) provide static
6729 inline `stat' and `lstat' functions, thus making the tests of
6730 `xstat == lstat' in copy.c always fail.
6731 * src/copy.h (struct cp_options) [xstat]: Remove member.
6733 * src/copy.c (copy_dir): Set `.dereference' member, not .xstat.
6734 (copy_internal): Use `XSTAT (x, ...)' in place of `*(x->xstat) (...)'.
6735 Use `x->dereference == DEREF_NEVER' in place of `x->xstat == lstat'.
6736 (valid_options): Remove now-obsolete FIXME comments.
6738 * src/cp.c (re_protect): Use `XSTAT (x, ...)' in place of
6739 `*(x->xstat) (...)'.
6740 (do_copy): Declare/use local xstat rather than x->xstat.
6741 (main): Remove code that set x.xstat.
6742 * src/mv.c (cp_option_init): Don't initialize xstat member.
6743 * src/install.c (cp_option_init): Likewise.
6745 * Makefile.cfg (gnu_ftp_host-alpha, etc.): Un-factor .gnu.org suffix,
6746 so that emit_upload_commands can use these variables, too.
6748 2004-02-06 Jim Meyering <jim@meyering.net>
6750 * tests/rm/deep-1: Remove `du' stack space test.
6751 Apparently, `ulimit -s N' isn't portable enough.
6752 This test will be restored (with a guard against losing ulimit)
6753 in its own file later.
6755 * tests/rm/deep-1 (deep): Remove progress-style diagnostics,
6756 since this test doesn't take long enough to merit them.
6757 Run du on $tmp (the containing dir), not $deep, the full path to leaf.
6759 * Makefile.maint (signatures): Remove definition.
6760 Now, automake's gnupload handles this.
6761 (%.sig: %): Remove now-unused rule.
6762 (rel-files): Use automake's $(DIST_ARCHIVES), rather than
6763 `$(distdir).tar.bz2 $(distdir).tar.gz'.
6764 (emit-upload-commands): Adjust to use gnupload.
6766 2004-02-05 Jim Meyering <jim@meyering.net>
6768 * src/system.h (ST_TIME_CMP_NS, ST_TIME_CMP): Remove definitions.
6769 (ATIME_CMP, CTIME_CMP, MTIME_CMP, TIMESPEC_NS): Likewise.
6770 Now, those are all defined in timespec.h.
6773 * src/date.c: Don't include timespec.h, now that system.h does it.
6775 2004-02-02 Paul Eggert <eggert@twinsun.com>
6777 Don't dump core if localtime returns NULL (possible on
6778 hosts with 64-bit time_t and 32-bit int).
6779 * src/date.c: Include "inttostr.h".
6780 (batch_convert, main):
6781 If time conversion fails, exit with nonzero status.
6782 (show_date): Return int to report conversion failure.
6783 Print the time as an int if localtime fails.
6784 * src/uptime.c: Print "??" if the current clock can't
6785 be converted by localtime. This won't happen until the year
6786 2*31 + 1900, but we don't want to dump core even if the current
6787 clock has the wrong value.
6789 * src/stat.c: Include "inttostr.h".
6790 (human_time): Print the date/time as a number of seconds since the
6791 epoch if it can't be converted by localtime. This is better than
6792 just saying "invalid", and is consistent with what "ls" does.
6793 Don't dump core if the year has more than 48 digits; this isn't
6794 possible on any contemporary host, but we might as well do it right.
6796 2004-01-31 Paul Eggert <eggert@twinsun.com>
6798 * src/stat.c (human_time): Accept time rather than
6799 pointer-to-const-time parameter, for clarity. All callers changed.
6801 2004-02-02 Jim Meyering <jim@meyering.net>
6803 * src/stat.c (do_stat): Remove extra trailing newline from
6804 default formats. Reported by Nelson H. F. Beebe.
6806 Print actual fractional seconds in time stamps, not just `.00000000'.
6807 * src/stat.c (human_time): Add and use new parameter, t_ns.
6808 (print_stat): Update callers.
6809 * src/ls.c (TIMESPEC_NS): Remove definition.
6810 * src/system.h (TIMESPEC_NS): Define here, instead, now that stat.c
6811 also uses this macro.
6812 Nelson H. F. Beebe noticed that ls --full-time printed nonzero
6813 fractional seconds for files on an XFS file system, but that stat's
6814 fractional seconds were always zero.
6816 2004-01-28 Paul Eggert <eggert@twinsun.com>
6818 * src/seq.c (print_numbers): Use 'double' for loop index, not
6819 'int', to avoid problems with integer overflow. On almost all
6820 machines 'double' works in every case where 'int' works, and
6821 it works on other cases besides.
6823 2004-01-27 Jim Meyering <jim@meyering.net>
6825 * src/seq.c (usage): Mention that if INCREMENT is omitted,
6826 it defaults to 1, even when FIRST is larger than LAST.
6827 Reword so as not to exclude the possibility that INCREMENT be zero.
6829 2004-01-25 Jim Meyering <jim@meyering.net>
6833 * Makefile.maint (signatures): Comment out definition.
6835 2004-01-23 Jim Meyering <jim@meyering.net>
6837 * Makefile.maint (header_regexp): Add exitfail.
6839 * man/Makefile.am (EXTRA_DIST): Add help2man.
6840 Reported by Nelson H. F. Beebe.
6842 * man/Makefile.am (.x.1): Prefix help2man invocation with `$(PERL) --'
6843 so it works on systems with Perl installed somewhere other than in
6846 * src/paste.c (paste_parallel): Declare local, chr, to be of type
6847 `int', not `char', since it must hold EOF. This bug would make
6848 paste infloop on some systems. Test failures reported by
6849 Nelson H. F. Beebe and Christian Krackowizer.
6851 2004-01-22 Jim Meyering <jim@meyering.net>
6853 * tests/rmdir/fail-perm: New file. Test for just-fixed rmdir bug.
6854 * tests/rmdir/Makefile.am (TESTS): Add fail-perm.
6856 * man/help2man: Fix it so using --info-page='coreutils PROG' works.
6857 * man/Makefile.am (.x.1): Invoke our own (tweaked) copy of help2man.
6858 Use --info-page='coreutils PROG' option.
6859 Now, readlink.1 refers the user to `info coreutils readlink'
6860 rather than to `info readlink'. Reported by Matt Swift.
6862 2004-01-21 Paul Eggert <eggert@twinsun.com>
6864 Exit status cleanup.
6866 * src/basename.c (usage): Use EXIT_SUCCESS, not 0, for clarity.
6867 * src/cat.c, src/chgrp.c, src/chmod.c, src/chown.c, src/chroot.c,
6868 * src/cksum.c, src/comm.c, src/cp.c, src/csplit.c, src/cut.c,
6869 * src/date.c, src/dd.c, src/df.c, src/dircolors.c, src/dirname.c,
6870 * src/du.c, src/echo.c, src/env.c, src/expand.c, src/expr.c,
6871 * src/factor.c, src/fmt.c, src/fold.c, src/head.c, src/hostid.c,
6872 * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c,
6873 * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/md5sum.c,
6874 * src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c,
6875 * src/nl.c, src/nohup.c, src/od.c, src/paste.c, src/pathchk.c,
6876 * src/pinky.c, src/pr.c, src/printenv.c, src/printf.c, src/pwd.c,
6877 * src/rm.c, src/rmdir.c, src/seq.c, src/setuidgid.c, src/shred.c,
6878 * src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c,
6879 * src/su.c, src/sum.c, src/sync.c, src/tac.c, src/tail.c, src/tee.c,
6880 * src/test.c, src/touch.c, src/tr.c, src/tsort.c, src/tty.c,
6881 * src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c,
6882 * src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c: Likewise.
6884 * src/cat.c (usage): Don't bother normalizing exit status
6885 since the arg is already the correct exit status now.
6886 * src/cksum.c, src/comm.c, src/csplit.c, src/cut.c,
6887 * src/dircolors.c, src/expand.c, src/fmt.c, src/fold.c, src/head.c,
6888 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c,
6889 * src/pr.c, src/split.c, src/sum.c, src/tac.c, src/tail.c, src/tr.c,
6890 * src/tsort.c, unexpand.c, src/src/uniq.c, src/src/wc.c: Likewise.
6892 * src/chown.c (main): Removed unused local 'fail'.
6894 * src/chroot.c (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE):
6897 * src/chroot.c (main): Initialize exit_failure to EXIT_FAIL.
6898 * src/env.c, src/nice.c, src/su.c: Likewise.
6899 * src/nohup.c (main): Likewise, to NOHUP_FAILURE.
6900 * src/setuidgid.c (main): Likewise, to SETUIDGID_FAILURE.
6901 * src/expr.c (main): Use initialize_exit_failure rather than
6902 setting exit_failure directly; this optimizes away redundant
6904 * src/printenv.c, src/sort.c, src/test.c, src/tty.c: Likewise.
6906 * src/chroot.c (main): Exit with status 1 rather than 127
6907 if chroot itself fails, as per documentation.
6909 * src/chroot.c (main): Use EXIT_ENOENT and EXIT_CANNOT_INVOKE
6910 rather than roll-your-own symbols or integers.
6911 * src/env.c (main): Likewise.
6912 * src/nohup.c (main): Likewise.
6913 * src/su.c (run_shell): Likewise.
6915 * src/cp.c (exit_status): Remove static var....
6916 (main): Making it local here instead. Use =, not |=, to set it.
6918 * src/cut.c (FATAL_ERROR, main): Exit with status EXIT_FAILURE,
6920 * src/date.c (batch_convert, main): Likewise.
6921 * src/dd.c (dd_copy): Likewise.
6922 * src/pr.c (first_last_page, main, getoptarg): Likewise.
6923 * src/tr.c (main): Likewise.
6924 * src/date.c (main): Don't assume EXIT_FAILURE == 1, as
6925 POSIX doesn't require it.
6926 * src/dd.c (write_output, skip, dd_copy): Likewise.
6927 * src/df.c (main): Likewise.
6928 * src/id.c (main): Likewise.
6929 * src/install.c (main): Likewise.
6930 * src/ln.c (main): Likewise.
6931 * src/ls.c (main): Likewise.
6932 * src/mv.c (main): Likewise.
6933 * src/shred.c (main): Likewise.
6935 * src/env.c (main): Exit with status 1, not 2, on errors detected
6937 * src/hostname.c (main): Likewise.
6938 * src/nl.c (main): Likewise.
6939 * src/stty.c (main): Likewise.
6941 * src/expr.c (EXPR_FAILURE): Renamed from EXPR_ERROR, for
6942 consistency with the other programs' naming conventions.
6945 * src/factor.c (main): Do not report a usage error simply
6946 because stdin has bad numbers.
6948 * src/id.c (problems): Now a boolean int, not a counter,
6949 so that we don't have to worry about int overflow. All uses changed.
6950 * src/touch.c (err): Likewise.
6952 * src/md5sum.c (main): Use int, not size_t, to store boolean int.
6954 * src/mkfifo.c (main): Exit with status 1, not 4, if not implemented.
6955 * src/mknod.c: Likewise.
6957 * src/nice.c (main): Exit with status EXIT_FAIL, not EXIT_FAILURE,
6958 on error; this is in case EXIT_FAILURE is unusual.
6959 * src/su.c (main): Likewise.
6961 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE): Remove; all uses
6962 changed to EXIT_CANNOT_INVOKE.
6964 * src/printenv.c (PRINTENV_FAILURE): New constant.
6965 (main): Exit with status PRINTENV_FAILURE, not EXIT_FAILURE, on
6966 command-line syntax problems.
6968 * src/rmdir.c (remove_parents): Don't set 'fail' to a negative number.
6969 (main): Avoid integer overflow when seeing whether errors occurred.
6971 * src/seq.c (print_numbers): Now returns void, not (zero) int.
6972 All callers changed.
6973 (main): Remove unused local variable 'errs'. Always exit successfully
6974 if we reach the end.
6976 * src/setuidgid.c (SETUIDGID_FAILURE): Renamed from FAIL_STATUS,
6977 for consistency with other programs here. All uses changed.
6978 (main): Use 'error' to exit rather than invoking 'exit' here.
6980 * src/sort.c: Don't include <assert.h>.
6981 (SORT_OUT_OF_ORDER, SORT_FAILURE): Now enums, not macros.
6982 (usage): Don't use 'assert'.
6983 (main): Remove redundant assignment to exit_failure.
6985 * src/system.h (EXIT_FAIL, EXIT_CANNOT_INVOKE, EXIT_ENOENT):
6987 (initialize_exit_failure): New inline function.
6988 Include exitfail.h here, since we refer to exit_failure.
6989 All callers changed to not include exitfail.h.
6991 * src/tty.c (TTY_FAILURE, TTY_WRITE_ERROR): New enum values;
6992 substitute them for the corresponding integer constants.
6994 * tests/help-version (expected_failure_status_date): Remove, as
6995 'date' is now normal.
6996 (expected_failure_status_nohup): New var.
6998 2004-01-21 Jim Meyering <jim@meyering.net>
7000 * tests/touch/relative: Remove `command' syntax.
7001 Thanks to Nelson H. F. Beebe and Paul Eggert.
7003 * tests/touch/relative: Test only year/month/day, not hours/min/sec,
7004 so as to avoid problems with systems using TAI clocks.
7005 Although it's no longer necessary, set TZ=UTC0 also for the
7006 initial touch command. Reported by Paul Jarc here:
7007 http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/1504
7009 2004-01-20 Diego Biurrun <diego@biurrun.de>
7011 * src/dircolors.hin: Add .mov to the list of media files.
7013 2004-01-19 Paul Eggert <eggert@twinsun.com>
7015 * tests/touch/relative: Use TZ=UTC0, not TZ=utc (which isn't
7016 portable). Problem reported by Christian Krackowizer. Also, use
7017 +0000 rather than +0 to specify a time zone, as the documentation
7018 requires four digits.
7020 2004-01-19 Jim Meyering <jim@meyering.net>
7022 * tests/mv/hard-4: Run envvar-check in case SIMPLE_BACKUP_SUFFIX is set.
7023 * tests/mv/backup-is-src: Likewise.
7024 Problem reported by Peter Horst
7026 2004-01-17 Jim Meyering <jim@meyering.net>
7028 * announce-gen (print_changelog_deltas): Use .sig suffix, not .asc.
7032 2003-12-15 Paul Eggert <eggert@twinsun.com>
7034 * NEWS, doc/coreutils.texi: touch -r and -d can now both be specified,
7035 with -r specifying the origin for -d.
7036 * src/touch.c (flexible_date): Remove static var.
7037 (get_reldate): New function.
7038 (main): Use it, to implement this new behavior.
7040 2004-01-16 Jim Meyering <jim@meyering.net>
7042 * tests/touch/relative: New test for the above.
7043 * tests/touch/Makefile.am (TESTS): Add relative.
7045 2004-01-13 Jim Meyering <jim@meyering.net>
7047 * src/system.h: Include contents of sys2.h.
7048 * src/sys2.h: Remove file.
7049 * src/Makefile.am (noinst_HEADERS): Remove sys2.h.
7051 * Use automake-1.8.2. Regenerate dependent files.
7053 * Update to gettext-0.13.1.
7054 * configure.ac: Use gettext-0.13.1.
7055 * .x-sc_space_tab: Add m4/po.m4 to the list of exceptions.
7057 2004-01-12 Jim Meyering <jim@meyering.net>
7059 * Makefile.maint (%.sig): Use .sig suffix rather than .asc.
7061 * Makefile.maint (po-check): Ensure that cvsu works before using it.
7062 Reported by Alexandre Duret-Lutz.
7064 * src/tail.c (main): Warn about following stdin only when it's a tty.
7066 * configure.ac: Use gl_DEFAULT_POSIX2_VERSION.
7068 2004-01-10 Jim Meyering <jim@meyering.net>
7070 * tests/misc/stat-fmt: Use backticks, not `$()' notation.
7072 2004-01-09 Jim Meyering <jim@meyering.net>
7074 * configure.ac: Quote underquoted `jm_DUMMY_1' to avoid new warning.
7076 2004-01-08 Jim Meyering <jim@meyering.net>
7078 * src/stat.c (human_fstype): Use %lx, not %x format for `unsigned long'.
7079 From Andreas Schwab.
7081 * tests/Makefile.am (TESTS_ENVIRONMENT): Remove `/vg' (prerelease test
7082 remnant) from PATH component. That would cause tests in this directory
7083 not to run the just-built binaries, but rather whatever happened
7084 to be in one's PATH. Reported by Christian Krackowizer.
7086 2004-01-04 Jim Meyering <jim@meyering.net>
7088 * src/csplit.c (new_control_record): Use x2nrealloc
7089 rather than xrealloc.
7091 * src/cp.c (re_protect): Use ASSIGN_STRDUPA rather than
7093 (make_path_private): Likewise.
7095 2004-01-03 Jim Meyering <jim@meyering.net>
7097 * src/paste.c: Use `bool' (not int) as the type for a few
7099 (collapse_escapes): Rewrite to set globals rather than modifying
7101 Use size_t (not int) for all counters and related index variables.
7102 (paste_parallel): Remove needless complexity of
7103 using xrealloc in the loop; just allocate the buffers up front.
7104 Free the two temporary buffers.
7105 Move declarations of locals `down' into scope where used.
7106 (paste_serial): Remove `register' attributes.
7107 (main): Simplify delim-related code.
7108 Free `delims', now that it's malloc'd.
7110 2004-01-02 Jim Meyering <jim@meyering.net>
7112 * src/chroot.c: Include "quote.h".
7113 (CHROOT_FOUND_BUT_CANNOT_INVOKE, CHROOT_FAILURE): Define.
7114 (main): Exit with status of 127, not 1, for too-few-args,
7115 chroot failure, or chdir failure.
7116 Give a better diagnostic upon execvp failure.
7118 * src/du.c (usage): Mention that, with its current meaning,
7121 * src/tail.c (main): Warn about following stdin when it's a tty.
7122 Fail when following by name but no names are specified.
7124 2003-12-30 Jim Meyering <jim@meyering.net>
7126 * src/fold.c (main): Use memcpy, not strcpy.
7128 * src/copy.c (copy_internal): Use ASSIGN_STRDUPA rather than
7131 2003-12-28 Jim Meyering <jim@meyering.net>
7133 * src/unexpand.c (n_tabs_allocated): New global.
7134 (add_tabstop): Use x2nrealloc rather than xrealloc.
7135 * src/expand.c: Likewise.
7137 * tests/misc/expand: New file.
7138 * tests/misc/Makefile.am (TESTS): Add expand.
7140 * src/sort.c (add_temp_dir): Use x2nrealloc rather than xrealloc.
7141 (fillbuf): Use x2nrealloc rather than xrealloc.
7142 (sort): Use xnmalloc rather than xmalloc.
7145 2003-12-27 Jim Meyering <jim@meyering.net>
7147 * src/tee.c (tee): Use xnmalloc rather than xmalloc.
7149 2003-12-29 Paul Eggert <eggert@twinsun.com>
7151 * NEWS: Remove support for join -j1 FIELD, -j2 FIELD, and -o LIST1
7152 LIST2 in POSIX 1003.1-2001 hosts, as required by POSIX.
7154 * doc/coreutils.texi (join invocation): Remove documentation
7155 accordingly. Document that -t makes all separators significant.
7157 * src/join.c: Include posixver.h.
7158 (obsolete_usage): New var.
7159 (longopts): Put obsolete options first.
7160 (OBSOLETE_LONG_OPTIONS): New constant.
7161 (get_option, add_file_name): New functions.
7162 (main): Use them to support new behavior.
7163 (usage): Remove documentation for -j1 FIELD and -j2 FIELD.
7164 Do not mark -j FIELD as obsolescent; it is longstanding
7165 UNIX tradition and is a valid extension to POSIX.
7167 * tests/join/Test.pm (tv): Avoid obsolete -o usage.
7169 2003-12-28 Paul Eggert <eggert@twinsun.com>
7171 * src/join.c (add_field_list): Don't use alloca with unbounded
7172 size; just modify the argument, which is no longer const *.
7174 Various other minor cleanups, mostly to avoid the need for casts.
7176 (extract_field): Renamed from ADD_FIELD, as it's now a function.
7178 (struct field.beg): Now char *, not unsigned char const *. All
7179 uses changed. It shouldn't be const since xmemcoll writes on its
7181 (extract_field): Likewise, for 2nd arg.
7182 (keycmp): Remove now-unnecessary cast of xmemcoll args.
7184 (is_blank): New function, to avoid need to cast arg to unsigned char.
7185 (extract_field): Use it.
7187 (xfields): Rewrite pretty much from scratch.
7189 (hard_LC_COLLATE): Now bool, not int.
7190 (get_line, getseq, add_field_list): Now returns bool, not int.
7191 (decode_field_spec, add_field_list): Return true on success (not
7192 false), for consistency with the rest of the code. All uses changed.
7194 (tab): Now char, not unsigned char. This wasn't 100% necessary
7195 but is slightly cleaner.
7196 (prjoin): Hoist (tab ? tab : ' ') expression, to help the compiler.
7198 (empty_filler): Now const *.
7200 (make_blank): Remove; wasn't needed. Remove all calls.
7201 (main): Don't set uni_blank.nfields; zero is fine.
7203 2003-12-27 Jim Meyering <jim@meyering.net>
7205 * src/join.c: Include "quote.h".
7206 (min, max): Remove definitions.
7207 Make a few function parameters and corresponding
7208 locals `const'. Use bool for boolean variables.
7209 Use size_t (not int) for all counters and related index variables.
7210 (prjoin): Remove now-useless assertion.
7211 (string_to_join_field): New function.
7212 (main): Accept join fields as large as SIZE_MAX.
7213 (keycmp): Rename `min' to MIN and max to MAX.
7215 2003-12-26 Jim Meyering <jim@meyering.net>
7217 fold -s didn't work on e.g., alpha-based systems.
7218 * src/fold.c (fold_file): Adjust types (int->size_t) so that using
7219 x2nrealloc works properly on systems with differing sizes for int
7220 and size_t. Reported by Nelson Beebe.
7222 * src/fold.c: Use `bool' (not int) as the type for a few
7225 2003-12-23 Paul Eggert <eggert@twinsun.com>
7227 * src/ls.c (length_of_file_names_and_frills):
7228 Remove forward decl; not needed.
7229 (print_file_name_and_frills, length_of_file_name_and_frills):
7230 With -m, don't output spaces before inum or size.
7231 (print_with_commas): Don't output space just before newline.
7233 2003-12-24 Jim Meyering <jim@meyering.net>
7235 * tests/ls/Makefile.am (TESTS): Add m-option.
7236 * tests/ls/m-option: New file. Test for above fixes.
7238 2003-12-20 Jim Meyering <jim@meyering.net>
7242 * src/pr.c: Change type of global, buff_allocated, to size_t.
7244 * src/join.c [struct seq]: Change types of members count and alloc
7245 from `int' to `size_t'.
7247 * tests/Makefile.am (root-hint): Tweak wording.
7249 * src/du.c: Accept new option (-0, --null) that makes it so each
7250 output line is NUL-terminated rather than newline-terminated.
7252 * src/dd.c (apply_translations): Don't prohibit conv=unblock,sync.
7253 Reported by Volker Paul.
7254 * tests/dd/Makefile.am (TESTS): Add unblock-sync.
7255 * tests/dd/unblock-sync: New test for the above.
7257 2003-12-19 Jim Meyering <jim@meyering.net>
7259 * tests/misc/nohup: Double quote back-ticked expression,
7260 in case it ends up having an unexpected value.
7262 * tests/ls/no-arg: Use ls's -1 option in both runs.
7264 * src/du.c (fts_debug): New global.
7265 (FTS_CROSS_CHECK, DEBUG_OPT): Define.
7266 (main): Make fts use FTS_TIGHT_CYCLE_CHECK.
7267 (main) [DU_DEBUG]: Accept -d option.
7269 2003-12-18 Jim Meyering <jim@meyering.net>
7271 * src/ls.c (format_user): Increment dired_pos via two statements,
7272 `dired_pos += width; dired_pos++;' rather than one,
7273 `dired_pos += width + 1;' since the latter could conceivably overflow.
7274 (format_group): Likewise.
7277 * configure.ac: Require automake-1.8.
7279 2003-12-12 Jim Meyering <jim@meyering.net>
7281 * Use automake-1.8. Regenerate dependent files.
7283 2003-12-08 Jim Meyering <jim@meyering.net>
7285 * Makefile.maint (news-date-check): New rule.
7286 (alpha beta major): Depend on it.
7288 2003-12-03 Paul Eggert <eggert@twinsun.com>
7290 * NEWS: ls -l (and similar options) now adjust all columns to
7291 fit the data. Generalized from a suggestion by Leah Q for file sizes.
7292 * src/ls.c (INODE_DIGITS, LOGIN_NAME_MAX, ID_LENGTH_MAX): Remove.
7293 (format_user_width, format_group_width, unsigned_file_size,
7294 format_group): New functions.
7295 (block_size_width): Renamed from block_size_size.
7296 (inode_number_width, nlink_width, owner_width, group_width,
7297 author_width, major_device_number_width, minor_device_number_width,
7298 file_size_width): New vars.
7299 (clear_files): Initialize them.
7300 (gobble_file): Set them. Don't ceiling block_size_width to 7.
7301 (print_long_file): Use them.
7302 (gobble_file): Use a new local variable 'f' to make the code
7303 smaller and more consistent with other functions.
7304 (format_user): Output to stdout, not to a buffer, so that we
7305 don't have to worry about buffer overrun. Update dired_pos.
7306 (print_long_file): Don't put owner, group, author into buffer;
7307 just print them directly. Don't assume link counts and
7308 major and minor numbers fit into unsigned long int.
7309 * tests/cp/same-file, tests/mv/part-symlink: Don't assume that
7310 'ls' output is fixed-width.
7312 2003-12-02 Jim Meyering <jim@meyering.net>
7314 * src/md5sum.c: Include sha1.h (reflect renaming: sha.h -> sha1.h.
7316 2003-11-27 Jim Meyering <jim@meyering.net>
7318 * Use automake-1.7f. Regenerate dependent files.
7320 2003-11-24 Paul Eggert <eggert@twinsun.com>
7322 Parse floating-point operands and options in the C locale.
7323 POSIX requires this for printf, and we might as well be
7324 consistent elsewhere (tail, sleep, seq).
7326 * src/printf.c: Remove decls of strtod, strtol, strtoul; no longer
7327 needed now that we assume C89. Include "c-strtod.h".
7328 (xstrtod): Call c_strtod, not strtod.
7329 * src/sleep.c: Include "c-strtod.h".
7330 (main): Update xstrtod call to include new argument, c_strtod.
7331 * src/seq.c (scan_double_arg): Likewise.
7332 * src/tail.c (parse_options): Likewise.
7334 2003-11-24 Jim Meyering <jim@meyering.net>
7336 * tests/rm/fail-2eperm: Handle another errno variant (HPUX, EPERM).
7337 Reported by Mark Conty.
7339 2003-11-22 Jim Meyering <jim@meyering.net>
7341 * Makefile.maint (sc_xalloc_h_in_src): Remove rule. Subsumed by...
7342 (sc_system_h_headers): Do this test only if sys2.h exists.
7344 2003-11-20 Jim Meyering <jim@meyering.net>
7346 * tests/help-version: Ensure that the bug-reporting address is
7347 included in the --help output for every program.
7348 * tests/Makefile.am (TESTS_ENVIRONMENT): Add $PACKAGE_BUGREPORT.
7350 * src/ptx.c (usage): Output bug-reporting address.
7351 Reported by Dan Jacobson.
7353 2003-11-19 Jim Meyering <jim@meyering.net>
7355 * src/join.c (usage): Mention that FILE1 and FILE2 must be sorted
7356 on the join fields. Suggestion from Bruce Robertson.
7358 2003-11-18 Jim Meyering <jim@meyering.net>
7360 `od -c -w9999999' could segfault
7361 * src/od.c (dump): Use xnmalloc/free, not alloca.
7363 2003-11-16 Jim Meyering <jim@meyering.net>
7365 * Use autoconf-2.59. Regenerate dependent files.
7367 * tests/du/hard-link: Minor tweak: use mkdir -p.
7369 Fix read-from-free'd-buffer error detected by valgrind.
7370 * src/csplit.c (remove_line): Don't return a pointer to data in
7371 a freed buffer. Instead, arrange to free the buffer on the
7374 * tests/misc/csplit: New test for above fix.
7376 2003-11-11 Jim Meyering <jim@meyering.net>
7378 * src/ls.c (extract_dirs_from_files): Avoid useless copy operations.
7379 This avoids a warning from valgrind about memcpy with overlapping
7380 source and destination.
7382 * configure.ac: Require automake-1.7.8.
7384 2003-11-09 Jim Meyering <jim@meyering.net>
7386 * Use automake-1.7.9. Regenerate dependent files.
7388 * src/rm.c: Support new options: --preserve-root and --no-preserve-root.
7389 * src/chown.c: Likewise.
7391 * src/chown-core.c: Include "root-dev-ino.h".
7392 (chopt_init): Initialize new member.
7393 (change_file_owner): Support rm's new --preserve-root option.
7395 * src/remove.c: Include "root-dev-ino.h".
7396 (remove_cwd_entries): Remove now-obsolete FIXME comment.
7397 (remove_dir): Support rm's new --preserve-root option.
7399 * src/chown.c: Include "root-dev-ino.h".
7400 Add new options: --preserve-root and --no-preserve-root.
7402 * src/chmod.c: Include "root-dev-ino.h".
7403 (process_file): Use newly-factored-out ROOT_DEV_INO_CHECK and
7404 ROOT_DEV_INO_WARN macros.
7405 (get_root_dev_ino): Remove function definition, now that it's
7406 been moved to a separate file.
7407 (usage): Describe new options.
7409 * src/mv.c (rm_option_init): Initialized new member.
7411 * src/remove.h: Include "dev-ino.h".
7412 (struct rm_options): Add new member: root_dev_ino.
7413 * src/chown-core.h: Include "dev-ino.h".
7414 (struct Chown_option): Add new member: root_dev_ino.
7416 2003-11-06 Jim Meyering <jim@meyering.net>
7418 * src/paste.c (paste_parallel): Use `sizeof *var' rather than
7419 hard-coding `sizeof FILE*'.
7421 2003-11-05 Dennis Smit <ds@nerds-incorporated.org>
7423 * src/wc.c (main): Free `fstatus' so there is no confusion about
7424 whether it's leaked or not.
7425 * src/who.c (who): Likewise for `utmp_buf'.
7427 2003-11-05 Paul Eggert <eggert@twinsun.com>
7429 Fix 'cut' problems with size_t overflow and unsigned int.
7430 More generally, resize integer variables to fit use more precisely.
7431 * src/cut.c (ADD_RANGE_PAIR): Remove unnecessary parens.
7432 (struct range_pair): Make members to be of type size_t, not unsigned.
7433 (max_range_endpoint, eol_range_start): Now size_t, not unsigned.
7434 (suppress_non_delimited, output_delimiter_specified,
7435 have_read_stdin, print_kth, set_fields): Now bool, nt int.
7436 (delim): Now unsigned char, not int.
7437 (mark_printable_field, is_printable_field, is_range_start_index,
7438 set_fields, set_fields, cut_bytes, cut_fields):
7439 Use size_t, not unsigned, for field and byte counts.
7440 (hash_int): Use uintptr_t, not unsigned, for pointers converted
7441 to integers. This squeezes more info out of them.
7442 (set_fields, cut_bytes, cut_fields, main):
7443 Use bool, not int, for booleans.
7444 (set_fields): Allocate zeroed byte array with xzalloc, not xcalloc.
7446 2003-11-05 Paul Eggert <eggert@twinsun.com>
7448 * man/Makefile.am (check-programs-vs-x):
7449 Work even if $(programs) contains '$'.
7450 Work even if 'missing=1' in environment.
7451 Don't report an error simply because $(programs) outputs nothing.
7453 2003-11-05 Jim Meyering <jim@meyering.net>
7455 * Use autoconf-2.58. Regenerate dependent files.
7457 * src/tr.c (spec_init): Fix typo in last change.
7459 * src/sys2.h (case_GETOPT_VERSION_CHAR): Cast NULL to `(char *)' in
7460 call to variadic version_etc function, so that it works even on systems
7461 for which sizeof char* != sizeof int.
7462 * src/true.c (main): Likewise.
7463 * basename.c, chroot.c, cksum.c, dd.c, dirname.c, echo.c, expr.c:
7464 * factor.c, hostid.c, hostname.c, link.c, logname.c, nice.c, nohup.c:
7465 * pathchk.c, printenv.c, printf.c, pwd.c, setuidgid.c, sleep.c, stty.c:
7466 * sync.c, test.c, tsort.c, unlink.c, uptime.c, users.c, whoami.c, yes.c:
7467 Similarly, cast NULL to `(char *)' in call to variadic function,
7468 parse_long_options, so that it works even on systems for which
7469 sizeof char* != sizeof int.
7470 A similar problem was reported by Harti Brandt in
7471 http://mail.gnu.org/archive/html/bug-gnu-utils/2003-10/msg00320.html.
7473 * src/users.c (users): Free `utmp_buf' explicitly so that people
7474 don't mistake this for a real leak.
7475 Patch by Dennis Smit <ds@nerds-incorporated.org.
7477 2003-11-04 Paul Eggert <eggert@twinsun.com>
7479 * README: Document _POSIX2_VERSION.
7481 2003-11-04 Jim Meyering <jim@meyering.net>
7483 * src/tac.c (memrchr): Remove #if-0'd function.
7484 (tac_stdin_to_mem): Clean up #if-0'd code.
7486 * src/od.c (decode_format_string): Remove unnecessary casts.
7487 Use more maintainable `sizeof *var'.
7488 (main): Call decode_format_string rather than decode_one_format,
7489 now that `spec' may be NULL.
7491 * src/chmod.c (AUTHORS): Add my name.
7493 * src/split.c (next_file_name): Use `sizeof *var' rather than
7494 hard-coding `sizeof size_t'.
7496 * src/sort.c (new_key): Use xzalloc, not xcalloc (1, ...).
7498 * src/cut.c (ADD_RANGE_PAIR): Use x2nrealloc rather than xrealloc,
7499 to avoid potential overflow in pointer arithmetic.
7500 (set_fields): Use not `1', but rather `sizeof *printable_field' as
7501 second argument to xcalloc.
7502 * src/od.c (decode_format_string, dump_strings): Use x2nrealloc
7503 rather than xrealloc.
7504 * src/date.c (show_date): Likewise.
7505 * src/join.c (ADD_FIELD, initseq, getseq): Likewise.
7506 * src/pr.c (store_char): Likewise.
7507 * src/fold.c (fold_file): Likewise.
7509 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
7510 type changes (unsigned int -> size_t) in hash.c.
7511 * src/cp-hash.c (src_to_dest_hash): Likewise.
7512 * src/du.c (entry_hash): Likewise.
7513 * src/ls.c (dev_ino_hash): Likewise.
7514 * src/cut.c (hash_int): Likewise. Declare function as static.
7516 2003-11-03 Jim Meyering <jim@meyering.net>
7518 * tests/misc/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
7519 * tests/misc/fold: Fail the test immediately if we're not running
7520 the expected version of fold.
7522 2003-11-02 Jim Meyering <jim@meyering.net>
7524 * src/tr.c (append_normal_char, append_range, append_char_class)
7525 (append_repeated_char, append_equiv_class, spec_init): Use `sizeof *var'
7526 rather than `sizeof EXPLICIT_TYPE'. The former is more maintainable
7527 and usually shorter.
7528 * src/copy.c (copy_internal): Likewise.
7529 * src/join.c (initseq, add_field, make_blank): Likewise.
7530 * src/od.c (main): Likewise.
7531 * src/cp.c (make_path_private): Likewise.
7532 * src/tsort.c (new_item, record_relation): Likewise.
7534 * src/df.c (add_fs_type, add_excluded_fs_type, main): Likewise.
7535 (main): Also remove anachronistic cast of xmalloc return value.
7536 * src/ptx.c (alloc_and_compile_regex, main): Likewise.
7537 (main): Also remove anachronistic cast of xmalloc return value.
7538 * src/sort.c (inittables): Likewise.
7539 (sort): Also Split a long line.
7541 2003-10-25 Jim Meyering <jim@meyering.net>
7543 * src/copy.c (triple_hash, triple_hash_no_name): Adjust to reflect
7544 type changes (unsigned int -> size_t) in hash.c.
7545 * src/cp-hash.c (src_to_dest_hash): Likewise.
7546 * src/du.c (entry_hash): Likewise.
7547 * src/ls.c (dev_ino_hash): Likewise.
7548 * src/cut.c (hash_int): Likewise. Declare function as static.
7550 2003-10-21 Jim Meyering <jim@meyering.net>
7552 Don't fail when run with VERBOSE=yes.
7553 * tests/chgrp/basic: Do `set +x' before starting the subshell
7554 from which we invoke chgrp. Otherwise, the output from the
7555 VERBOSE=yes-induced `set -x' would result in spurious differences.
7556 Reported by Russel Coker via Michael Stone.
7558 2003-10-19 Jim Meyering <jim@meyering.net>
7560 chmod now uses fts to perform a directory traversal when -R is
7561 specified. Before, it operated on full path names, and as such
7562 would encounter the PATH_MAX (often 4096) limit.
7564 * src/chmod.c: Include "xfts.h".
7565 (process_file): Rename from change_file_mode.
7566 Adapt to be used with fts.
7567 (process_files): New function.
7569 2003-10-18 Jim Meyering <jim@meyering.net>
7571 * tests/du/deref-args: Ensure that du -D now dereferences all
7572 symlinks specified on the command line, not just those that
7573 reference directories.
7575 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
7576 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
7577 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
7578 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
7579 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
7580 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
7581 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
7582 * who.c, whoami.c, yes.c (AUTHORS): Revert the WRITTEN_BY/AUTHORS change
7583 of 2003-09-19. Now, AUTHORS is a comma-separated list of strings.
7584 Update the call to parse_long_options so that `AUTHORS, NULL' are the
7586 * src/true.c (main): Append NULL to version_etc argument list.
7587 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
7589 2003-10-17 Andreas Schwab <schwab@suse.de>
7591 * tests/mk-script: Get $srcdir from first parameter instead of
7593 (main): Update usage.
7595 * tests/Makefile.am.in ($(srcdir)/$x-tests): Pass $(srcdir) as
7596 first argument of mk-script.
7597 ($(srcdir)/Makefile.am): Likewise. Prepend $(srcdir) to target.
7599 2003-10-17 Jim Meyering <jim@meyering.net>
7601 * src/mv.c (usage): Tweak descriptions of -i and -f so that the
7602 generated `man' page is more readable. Suggestion from Dan Jacobson.
7604 * src/chown-core.c (change_file_owner): Handle the cases in
7605 which fts_info indicates an error with the given entry.
7607 * src/du.c (main): Simply assign to bit_flags.
7608 Don't bother with bit arithmetic.
7610 * tests/chmod/no-x: New file.
7611 * tests/chgrp/no-x: New file.
7612 * tests/chmod/Makefile.am (TESTS): Add no-x.
7613 * tests/chgrp/Makefile.am (TESTS): Likewise.
7615 * src/du.c: Include "xfts.h".
7616 (du_files): Use xfts_open, rather than fts_open.
7617 * src/chown-core.c (chown_files): Likewise.
7619 2003-10-16 Jim Meyering <jim@meyering.net>
7621 * src/chgrp.c (main): Simply assign to bit_flags.
7622 Don't bother with bit arithmetic.
7623 * src/chown.c (main): Likewise.
7624 Rename a couple of local variables.
7625 Remove unnecessary casts.
7627 * src/tail.c (start_bytes): Rename local, remainder, to avoid
7628 gcc's warning about shadowing a global.
7630 2003-10-15 Jim Meyering <jim@meyering.net>
7632 chown and chgrp now accept POSIX-mandated -H, -L, -P options and
7633 use fts to perform a directory traversal when -R is specified.
7634 Before, they operated on full path names, and as such would
7635 encounter the PATH_MAX (often 4096) limit.
7636 They are more efficient. For example, before, chgrp -R would
7637 take almost 5 seconds to change about 2000 directories and fail
7638 (with `File name too long'), while now it succeeds on a hierarchy
7639 of depth 20,000 in 1/10 the time.
7641 * src/chown.c: Include "userspec.h" and "fts_.h".
7642 (WRITTEN_BY): Add my name.
7643 (getpwnam, getgrnam, getgrgid): Remove declarations.
7644 (endpwent): Remove definition.
7646 (main): Handle new options.
7647 Call new function, chown_files rather than change_file_owner.
7649 * src/chgrp.c: Include "fts_.h".
7650 (WRITTEN_BY): Add my name.
7651 (MAXUID, MAXGID): Remove definitions. Use GID_T_MAX instead of
7654 (main): Handle new options.
7655 Call new function, chown_files rather than change_file_owner.
7657 Rewrite to iterate through hierarchies using fts rather than
7658 via explicit recursion.
7659 * src/chown-core.c: Include "fts_.h"
7660 (change_file_owner): Rewrite to use FTS* and FTSENT* and to operate
7661 on a single file at a time.
7662 (chown_files): New function.
7663 * src/chown-core.h [enum Dereference_symlink]: Remove declaration.
7664 [struct Chown_option] (recurse, force_silent): Change type to `bool'.
7665 [struct Chown_option] (dereference): Remove member with ambiguous name.
7666 [struct Chown_option] (affect_symlink_referent): New member.
7667 (chown_files): New prototype.
7669 * tests/chgrp/recurse: Update tests accordingly.
7670 * tests/chgrp/posix-H: New tests for the above.
7671 * tests/chgrp/Makefile.am (TESTS): Add posix-H.
7673 * src/ln.c (usage): Clarify that --directory, -d, -F probably won't
7674 work even for superuser. Suggestion from Dan Jacobson.
7676 2003-10-14 Paul Eggert <eggert@twinsun.com>
7678 Fix some number-parsing bugs, e.g., "head -n 100k@" wasn't
7680 * lib/human.c, lib/xstrtoimax.c, lib/xstrtol.c, lib/xstrtol.h,
7681 lib/xstrtoul.c, lib/xstrtoumax.c: Sync with gnulib.
7682 * src/sort.c (parse_field_count): Handle the case where overflow
7683 and invalid suffix char are both reported.
7685 2003-10-14 Jim Meyering <jim@meyering.net>
7687 * src/ls.c (decode_switches) [TIOCGWINSZ]: Comment out the
7688 warning-inducing test, ws.ws_col <= SIZE_MAX, since it was always
7691 2003-10-13 Paul Eggert <eggert@twinsun.com>
7693 Fix to avoid a denial-of-service attack if the display width is
7694 enormous. Also, clean up the code a bit by removing duplicate code.
7696 * src/ls.c (init_column_info): Remove forward decl; no longer needed.
7697 (calculate_columns): New function, that contains code that used
7698 to be common to print_many_per_line and print_horizontal.
7699 (print_many_per_line, print_horizontal): Use it.
7700 (decode_switches): Set max_idx here, not in calculate_columns.
7701 (print_current_files): Don't call init_column_info; calculate_columns
7703 (init_column_info): Don't allocate a lot more space than is needed
7704 to represent the current set of files. Allocate all the new
7705 size_t cells in one call to xnmalloc, rather than a row at a time.
7707 2003-10-13 Jim Meyering <jim@meyering.net>
7709 * src/ls.c (init_column_info): Add another FIXME comment.
7711 2003-10-13 Paul Eggert <eggert@twinsun.com>
7713 Fix address-arithmetic bug in 'ls', reported by Georgi Guninski.
7714 Remove several arbitrary limits on hosts where int cannot represent
7717 * src/ls.c (struct bin_str.len, length_of_file_name_and_frills, indent,
7718 nfiles, files_index, tabsize, line_length, struct column_info.line_len,
7719 struct column_info.col_arr[0], max_idx):
7720 Now size_t, not int.
7721 (get_funky_string): Return bool indicating success, instead of
7722 a negative count to indicate failure. Store number of columns
7723 through new parameter OUTPUT_COUNT; that way, they can never
7724 go negative. Change equals_end from int to bool. All uses
7726 (struct column_info.valid_len): Now bool, not int. All uses changed.
7727 (dired_dump_obstack, get_funky_string, clear_files,
7728 extract_dirs_from_files, print_current_files,
7729 print_many_per_line, print_horizontal, init_column_info,
7730 put_indicator, length_of_file_name_and_frills,
7731 print_with_commas): Use size_t, not int, for local variables
7733 (decode_switches): Decode sizes using xstrtoul, not xstrtol.
7734 Check for TIOCGWINSZ returing negative values (or values greater
7736 (visit_dir, main, parse_ls_color, queue_directory, add_ignore_pattern,
7738 Use xmalloc and xnmalloc, not XMALLOC.
7739 (gobble_file): Use xnrealloc, not XREALLOC.
7740 (print_color_indicator): Remove now-unnecessary cast to size_t.
7742 2003-10-12 Paul Eggert <eggert@twinsun.com>
7744 * tests/du/no-x: Change wording of diagnostic to match latest du.c.
7745 * tests/sort/sort-tests: Remove from CVS; assume that people
7746 brave enough to check coreutils out from CVS can rebuild it.
7748 2003-10-12 Jim Meyering <jim@meyering.net>
7750 New options: --preserve-root and --no-preserve-root.
7751 * src/chmod.c (change_file_mode): Honor new option.
7752 (change_file_mode): Strip trailing slashes on directory
7753 argument passed to change_dir_mode.
7754 (get_root_dev_ino): New function.
7755 (main): Initialize global, root_dev_ino.
7757 * src/copy.c (copy_internal): Don't #ifdef-out simple uses of
7758 S_ISLNK or S_ISSOCK. The S_IS* macros are guaranteed to be defined
7760 * src/chmod.c (change_file_mode): Likewise.
7762 2003-10-08 Jim Meyering <jim@meyering.net>
7764 * src/csplit.c (main): Remove obsolete FIXME.
7766 2003-10-07 Jim Meyering <jim@meyering.net>
7768 * Use automake-1.7.8. Regenerate dependent files.
7770 2003-09-29 Paul Eggert <eggert@twinsun.com>
7774 * doc/coreutils.texi (csplit invocation):
7775 The regexp offset need not have a sign; POSIX requires support
7776 for signless offets.
7778 Be more careful about int widths. For example, remove some
7779 arbitrary limits by replacing 'unsigned' with 'size_t',
7780 'uintmax_t', etc. Use standard bool rather than a homegrown type.
7781 * lib/Makefile.am (libfetish_a_SOURCES): Add xstrtoimax.c.
7782 * src/csplit.c (FALSE, TRUE, boolean): Remove. All uses changed
7783 to <stdbool.h> usage.
7784 (struct control): offset is now intmax_t, not int.
7785 repeat_forever is now bool, not int.
7786 (struct cstring): len is now size_t, not unsigned int.
7787 (struct buffer_record): bytes_alloc, bytes_used, num_lines are now
7788 size_t, not unsigned. start_line, first_available are now
7789 uintmax_t, not unsigned.
7790 (hold_count, control_used): Now size_t, not unsigned.
7791 (last_line_number, current_line, bytes_written):
7792 Now uintmax_t, not unsigned.
7793 (save_to_hold_area, red_input, keep_new_line, record_line_starts,
7794 create_new_buffer, get_new_buffer, load_buffer, find_line,
7795 process_regexp, split_file, new_control_record, extract_regexp,
7796 get_format_width, get_format_prec, max_out):
7797 size args, locals, and returned values are now size_t, not unsigned
7799 (get_first_line_in_buffer, find_line, write_to_file,
7800 handle_line_error, process_line_count, regexp_error, process_regexp,
7802 File line, byte, and repetition counts are now uintmax_t, not unsigned.
7803 (check_for_offset): Don't require a sign before the offset.
7804 Use xstrtoimax to do the real work.
7805 (extract_regexp): Remove harmful cast of size to unsigned.
7806 256 -> 1<<CHAR_BIT, for clarity.
7807 (get_format_flags): Return at most 3, to avoid worries about overflow.
7809 (bytes_to_octal_digits): Remove.
7811 (cleanup): Don't check whether output_stream is NULL, since
7812 close_output_file does that for us.
7814 (new_line_control, create_new_buffer): Use "foo *p = xmalloc
7815 (sizeof *p);" instead of the more long-winded alternatives.
7817 (get_new_buffer): Use O(1) algorithm for resizing a buffer
7818 to a much larger size, instead of an O(N) algorithm.
7820 (process_regexp): Use plain NULL rather than casted 0.
7822 (make_filename): Use %u, not %d, to format unsigned file number.
7824 (new_control_record): Use xrealloc exclusively, since it handles
7827 (extract_regexp): Change misspelled word in diagnostic.
7829 (get_format_width): Even if a minimum field width is specified,
7830 allow room for enough octal digits to represent the value of
7831 the maximum representible integer. This fixes a potential
7832 buffer overrun. Calculate this room at compile-time, not
7833 at run-time; this removes the need for bytes_to_octal_digits.
7834 Check for overflow; this removes a FIXME.
7836 (get_format_prec): Don't allow precision to be signed; it's
7837 not ANSI. Check for overflow. Remove hardcoded "11" as
7838 default precision; this fixes a potential buffer overrun
7839 on hosts with wider size_t.
7841 (get_format_conv_type): Change local variable to be of type
7842 unsigned char, not int; this removes a potential subscript
7843 violation on hosts where char is signed.
7845 (max_out): Replace "for (;*p;)" with more-standard "while (*p)".
7846 Allow "%%" in format. Don't overflow when
7847 counting lots of percents.
7849 (usage): Default sprintf format is %02u, not %d.
7851 2003-10-05 Jim Meyering <jim@meyering.net>
7853 * src/chown-core.c (change_file_owner): Remove set-but-not-used local.
7855 * src/du.c (du_files): Mark diagnostic for translation.
7857 2003-10-04 Jim Meyering <jim@meyering.net>
7859 * src/du.c (du_files): Ignore any failure of fts_close.
7860 Give better diagnostics for failed fts_open.
7862 * src/du.c (MAX_N_DESCRIPTORS): Remove now-unused definition.
7864 Deprecate existing use of -H (aka --si).
7865 * src/du.c (enum) [HUMAN_SI_OPTION]: New member.
7866 [long_options]: Use HUMAN_SI_OPTION, not 'H'.
7867 (main): Warn that the meaning of -H will soon change to be
7870 2003-10-03 Jim Meyering <jim@meyering.net>
7872 * src/du.c: Accept --no-dereference (-P).
7874 2003-10-02 Jim Meyering <jim@meyering.net>
7876 * tests/du/trailing-slash: Adjust for slightly different output.
7878 Rewrite du.c to use fts.
7879 * src/du.c: Include "fts_.h", not ftw.h.
7880 (opt_dereference_arguments, arg_length, suffix_length): Remove globals.
7881 (IS_FTW_DIR_TYPE): Remove definition.
7882 (IS_DIR_TYPE): Define.
7883 (is_symlink_to_dir): Remove now-unnecessary function.
7884 (process_file, du_files): Rewrite to use fts.
7886 * tests/du/inaccessible-cwd: Ensure that even when run from an
7887 inaccessible directory, du can still operate on accessible
7888 directories elsewhere.
7889 * tests/du/Makefile.am (TESTS): Add inaccessible-cwd.
7891 * tests/rm/deep-1: Ensure that du can process a hierarchy
7892 of depth 400 while using no more than 50KB of stack space.
7894 2003-10-01 Akim Demaille <akim@epita.fr>
7896 * announce-gen (print_news_deltas): New function, extracted from main.
7897 (main): Make `news_file' an array.
7898 Use '...=s' => \@var for --news and --url-directory specs.
7899 Before there were a couple of portability problems.
7901 2003-09-28 Jim Meyering <jim@meyering.net>
7903 * Makefile.maint (sc_cast_of_alloca_return_value): New rule.
7904 (syntax-check-rules): Add it.
7906 * src/copy.c: Remove unnecessary cast of alloca, since now it's
7907 guaranteed to be (void *).
7908 * src/cp.c: Likewise.
7909 * src/join.c: Likewise.
7910 * src/ln.c: Likewise.
7911 * src/ls.c: Likewise.
7912 * src/od.c: Likewise.
7913 * src/sys2.h (ASSIGN_STRDUPA): Likewise.
7915 2003-09-27 Jim Meyering <jim@meyering.net>
7917 Don't exhaust virtual memory when processing large inputs.
7918 Fix this by removing csplit's internal free-list management;
7919 instead rely on malloc for that.
7921 * src/csplit.c (free_list): Remove global.
7922 (clear_all_line_control): Remove function.
7923 (get_new_buffer): Always use create_new_buffer to obtain a
7924 new buffer, rather than searching free_list.
7925 (free_buffer): Just call free.
7926 Reported by Nikola Milutinovic.
7928 2003-09-26 Jim Meyering <jim@meyering.net>
7930 * man/rm.x: Also list `chattr' in SEE ALSO section.
7931 Suggestion from Mark Hubbart.
7933 2003-09-25 Jim Meyering <jim@meyering.net>
7935 * configure.ac: Don't invoke AC_AIX or AC_MINIX explicitly, now
7936 that we use gl_USE_SYSTEM_EXTENSIONS, since it AC_REQUIREs them.
7938 * Use autoconf-2.57d. Regenerate dependent files.
7940 2003-09-24 Jim Meyering <jim@meyering.net>
7942 Minor efficiency tweak.
7943 * src/ln.c (PATH_BASENAME_CONCAT): Use memcpy rather than strcpy.
7944 (do_link): Likewise.
7946 2003-09-23 Jim Meyering <jim@meyering.net>
7948 * src/paste.c (paste_serial): Save errno after input error,
7949 to report proper errno value.
7950 Based on a patch from Paul Eggert.
7952 * src/tee.c (tee): Adjust fwrite arguments so that the return
7953 value is the number of bytes written.
7955 2003-09-16 Paul Eggert <eggert@twinsun.com>
7957 Don't assume ferror sets errno. Bug reported by Bruno Haible.
7959 * src/comm.c (compare_files): Save errno after input error,
7960 to report proper errno value.
7961 * src/fold.c (fold_file): Likewise.
7962 * src/od.c (check_and_close, skip, read_char, read_block): Likewise.
7963 * src/unexpand.c (unexpand): Likewise.
7965 * src/csplit.c (close_output_file): Don't report bogus errno value
7966 after ferror discovers an output error. We don't know the proper
7967 errno value, since it might have been caused by any of a whole
7968 bunch of calls, and it might have been trashed in the meantime.
7969 Fixing this problem will require much more extensive changes;
7970 in the meantime just say "write error".
7971 * src/od.c (check_and_close, dump, dump_strings): Likewise.
7972 * src/uniq.c (check_file): Likewise.
7974 * src/join.c (get_line): Report error right away if I/O fails,
7975 so that the proper errno value is used.
7976 * src/tac.c (tac_seekable, tac_file, save_stdin): Likewise.
7977 * src/tee.c (tee): Likewise.
7978 * src/uniq.c (check_file): Likewise.
7980 * src/od.c (skip): If a read fails, don't retry it later, so
7981 that we report the proper errno.
7983 * src/tac.c (tac_mem): Don't return a value; nobody uses it.
7985 * src/tee.c (tee): Once a write failure has occurred, don't bother
7986 writing anything more to that stream.
7988 * src/uniq.c (check_file): Check for ferror (stdout) even if
7991 * src/yes.c (UNROLL): Remove.
7992 (main): Exit immediately when write failure is detected.
7993 Simplify code by assigning to argv when argc == 1.
7995 2003-09-21 Paul Eggert <eggert@twinsun.com>
7997 * src/ptx.c: Switch encoding from Latin-1 to UTF-8.
7998 (WRITTEN_BY): Change "Franc,ois" (actually using
7999 c-with-cedilla in Latin-1) to "F.", so that it's ASCII, as
8002 2003-09-19 Jim Meyering <jim@meyering.net>
8004 `du -D symlink-to-dir' would mistakenly omit the slash in
8005 lines like this: 24 symlink-to-dir/subdir
8006 * src/du.c (process_file): Fix offset calculation.
8007 Reported by Jeff Sheinberg as Debian bug #211591;
8008 http://bugs.debian.org/205251
8010 * tests/du/deref-args: New file/test for the above.
8011 * tests/du/Makefile.am (TESTS): Add deref-args.
8013 * src/du.c (process_file): Remove useless disjunct.
8015 * src/sys2.h (case_GETOPT_VERSION_CHAR): Rename parameter, Authors,
8017 * nearly all src/*.c files (WRITTEN_BY): Rename from AUTHORS.
8018 Begin each WRITTEN_BY string with `Written by ' and end it with `.'.
8019 Mark each WRITTEN_BY string as translatable.
8021 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
8022 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
8023 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
8024 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
8025 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
8026 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
8027 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
8028 * who.c, whoami.c, yes.c: Revert yesterday's changes.
8029 Instead, a subsequent change will embed `Written by ' in
8030 each string along with the author names.
8032 * src/true.c: Revert yesterday's changes.
8033 * src/sys2.h: Likewise.
8035 2003-09-18 Jim Meyering <jim@meyering.net>
8037 * basename.c, cat.c, chroot.c, cksum.c, comm.c, cp.c, csplit.c, cut.c:
8038 * dd.c, df.c, dirname.c, du.c, echo.c, env.c, expr.c, factor.c, head.c:
8039 * hostid.c, hostname.c, id.c, link.c, ln.c, logname.c, ls.c, md5sum.c:
8040 * mv.c, nice.c, nl.c, nohup.c, paste.c, pathchk.c, pinky.c, pr.c:
8041 * printenv.c, printf.c, pwd.c, rm.c, setuidgid.c, sleep.c, sort.c:
8042 * split.c, stty.c, sum.c, sync.c, tac.c, tail.c, tee.c, test.c:
8043 * touch.c, tsort.c, uniq.c, unlink.c, uptime.c, users.c, wc.c:
8044 * who.c, whoami.c, yes.c: Update AUTHORS definition to be a
8045 comma-separated list of strings and/or update the call to
8046 parse_long_options so that `AUTHORS, NULL' are the last parameters.
8047 * src/true.c (main): Append NULL to version_etc argument list.
8048 * src/sys2.h (case_GETOPT_VERSION_CHAR): Likewise.
8050 * src/sort.c (numcompare): Rename local, logb, to log_b to avoid
8051 shadowing the math function name. Also rename loga to log_a.
8053 2003-09-14 Jim Meyering <jim@meyering.net>
8055 * src/factor.c (print_factors): Give a separate diagnostic
8056 for numbers that are too large, but otherwise valid.
8057 Reported by Dániel Varga.
8059 2003-09-10 Jim Meyering <jim@meyering.net>
8061 * Use automake-1.7.7. Regenerate dependent files.
8063 * tests/Makefile.am (all_programs): Use ../src/tr -s ' ' '\n' in place
8064 of `fmt -1'. Using the just-built tr is a little cleaner.
8065 Christian Krackowizer reported that HPUX 10.20 doesn't have fmt.
8066 * man/Makefile.am (programs, check-x-vs-1): Likewise.
8068 2003-09-09 Jim Meyering <jim@meyering.net>
8070 * src/copy.c: Alphabetize includes.
8071 Remove duplicate inclusion of "same.h".
8073 2003-09-08 Jim Meyering <jim@meyering.net>
8075 * Makefile.maint (GZIP_ENV): Remove --rsyncable.
8076 Didn't give enough of a benefit, mainly because it's not yet
8081 * man/Makefile.am (programs): Use ../src, not $(srcdir)/../src.
8082 (check-programs-vs-x): Fail if $(programs) is empty.
8084 * src/remove.c: Add a comment.
8086 2003-09-07 Jim Meyering <jim@meyering.net>
8088 * src/remove.c (D_INO, ENABLE_CYCLE_CHECK) [D_INO_IN_DIRENT]:
8089 Don't define. These symbols are no longer used.
8091 * tests/misc/tty-eof: Write ^D as \cD.
8092 Complete the change of 2003-08-02.
8094 * Makefile.maint (po-check): Use cvsu, so that a temporary source
8095 file in lib/ or src/ doesn't induce an unwarranted failure.
8096 Add a kludge to filter out the sole generated source file that
8097 also has translatable messages: src/false.c.
8099 2003-09-06 Jim Meyering <jim@meyering.net>
8101 * src/tail.c (enum): Add ALLOW_MISSING_OPTION.
8102 (parse_options): Give a diagnostic for (but still accept) the
8103 deprecated --allow-missing option.
8105 2003-09-04 Paul Eggert <eggert@twinsun.com>
8107 Don't ignore -S if input is a pipe. Bug report by Michael McFarland in
8108 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00008.html>.
8110 * src/sort.c (sort_buffer_size): Omit SIZE_BOUND arg. Compute the
8111 size_bound ourselves. if an input file is a pipe and the user
8112 specified a size, use that size instead of trying to guess the
8113 pipe size. This has the beneficial side effect of avoiding the
8114 overhead of default_sort_size in that case. All callers changed.
8115 (sort): Remove static var size; now done by sort_buffer_size.
8117 2003-09-05 Jim Meyering <jim@meyering.net>
8119 * Use automake-1.7.6b and autoconf-2.57b. Regenerate dependent files.
8121 * tests/tail-2/tail-n0f: Wait .5 seconds for backgrounded process
8122 to start, rather than just .1. Upon failure, print unexpected state.
8124 2003-09-04 Paul Eggert <eggert@twinsun.com>
8126 * src/head.c (elide_tail_lines_pipe): Don't assign 0 or
8127 SAFE_READ_ERROR to tmp->nbytes.
8128 * src/tail.c (pipe_lines, pipe_bytes): Likewise.
8130 * src/head.c (struct linebuffer): Change nbytes and nlines
8131 from unsigned int to size_t. unsigned int is safe (after the
8132 2003-09-03 patch) but size_t is cleaner.
8133 * src/tail.c (struct linebuffer, struct charbuffer): Likewise.
8134 (pipe_bytes): Likewise for local variable 'i', which was 'int'.
8136 Standardize on BUFSIZ as opposed to other macro names and values.
8137 * src/head.c (BUFSIZE): Remove. All uses changed to BUFSIZ.
8138 * src/tail.c (BUFSIZ) [!defined BUFSIZ]: Remove.
8139 stdio.h has always defined it,
8140 and other code already assumes it's defined.
8141 * src/tr.c (BUFSIZ) [!defined BUFSIZ]: Likewise.
8142 (IO_BUF_SIZE): Remove; replace all uses with sizeof io_buf.
8143 (io_buf): IO_BUF_SIZE -> BUFSIZ.
8145 2003-09-04 Paul Eggert <eggert@twinsun.com>
8147 * src/seq.c (step): Default to 1.
8148 (print_numbers): Allow the output to be empty.
8149 (main): The default step is 1, even if LAST < FIRST;
8150 as per documentation.
8151 * tests/seq/basic (onearg-2): Output should be empty.
8153 2003-09-05 Jim Meyering <jim@meyering.net>
8155 * Makefile.cfg (wget_files): Temporarily disable, until master
8156 versions are restored to ftp.gnu.org.
8158 * configure.ac (AM_INIT_AUTOMAKE): Specify automake-1.7.6.
8160 Make seq's --width (-w) option work properly even when the
8161 endpoint requiring the larger width is negative and smaller than
8163 * src/seq.c (get_width_format): Include `-' in the set of bytes
8164 allowed in a `simple' number (no decimal point, no exponent).
8165 Reported by Patrick Mauritz.
8167 2003-09-02 Paul Eggert <eggert@twinsun.com>
8169 * NEWS: sort -t '\0' now uses a NUL tab.
8170 sort option order no longer matters, unless POSIX requires it.
8171 * src/sort.c (usage): Say "blanks" instead of "whitespace",
8172 Similar fixes for many comments.
8173 (TAB_DEFAULT): New constant, so that we can support NUL as
8174 the field separator.
8175 (tab): Now int, not char. Initialize to TAB_DEFAULT.
8176 (specify_sort_size): If multiple sizes are specified, use the largest.
8177 (begfield, limfield): Support NUL tab char.
8178 (set_ordering): Do not let -i override -d.
8179 (main): Report an error if incompatible -o or -t options are given.
8180 Report an error for "-t ''". Allow "-t '\0'" to specify a NUL tab.
8182 2003-09-05 Jim Meyering <jim@meyering.net>
8184 * tests/sort/Test.pm [o2, nul-tab]: New tests for the above.
8186 2003-09-03 Andreas Schwab <schwab@suse.de>
8188 Bug report and patch here:
8189 <http://mail.gnu.org/archive/html/bug-coreutils/2003-09/msg00009.html>
8190 * src/tail.c (pipe_lines): Don't truncate return value from safe_read.
8191 * src/head.c (elide_tail_lines_pipe): Likewise.
8193 2003-09-03 Jim Meyering <jim@meyering.net>
8195 * src/du.c (AUTHORS): Remove Larry McVoy's name, since the relatively
8196 small amount of code from him was first moved to lib/human.c, and was
8197 subsequently rewritten entirely.
8198 * src/df.c (AUTHORS): Likewise.
8200 2003-08-22 Lawrence Teo <lcteo@uncc.edu>
8202 * src/md5sum.c (split_3): Accept the BSD format for generic
8203 message digest modes. Currently works with BSD's MD5 and SHA1
8204 formats since these are the two algorithms presently used in
8205 coreutils. Updated comments to reflect this change.
8206 (bsd_split_3): Updated comments.
8208 * tests/md5sum/basic-1: New test to make sure that
8209 `md5sum --check' doesn't accept the BSD SHA1 format (adapted
8210 from `check-bsd' test in tests/sha1sum/basic-1).
8212 * tests/sha1sum/basic-1 (check-bsd2, check-bsd3): New tests for
8213 --check exit status and BSD SHA1 format (adapted from tests
8214 in tests/md5sum/basic-1).
8216 2003-08-30 Jim Meyering <jim@meyering.net>
8218 * src/ln.c (do_link): Use SAME_INODE rather than open-coding it.
8220 When source and destination arguments refer to the same file, reside
8221 on a partition (e.g. VFAT) on which distinct names may refer to the
8222 same directory entry (often due to variations in case), and when the
8223 link count for the file is 1, mv no longer unlinks the file. Instead,
8224 it gives the expected diagnostic that the source and destination are
8225 the same. WARNING: this is an incomplete fix. If the file happens
8226 to have a link count of 2 or greater, such an erroneous mv command
8227 will still unlink it.
8228 Although that is not possible on vfat or umsdos, it is possible on
8229 other file system types, e.g., ntfs, and hpfs.
8230 * src/copy.c (same_file_ok): Invoke same_name (which might still
8231 return false for names that refer to the same directory entry)
8232 only if the link count is 2 or more.
8233 * tests/mv/vfat: Show how to demonstrate the above problem.
8234 This test is not run.
8235 * tests/mv/Makefile.am (EXTRA_DIST): Add vfat.
8237 2003-08-27 Jim Meyering <jim@meyering.net>
8239 * src/who.c: Change meaning of -l from --lookup to --login, per POSIX.
8240 who's -l option has been eliciting an unconditional warning about
8241 this impending change since sh-utils-2.0.12 (April 2002).
8243 * src/paste.c (paste_parallel): Don't output `EOF' (aka -1) as a `char'.
8244 This would happen for nonempty files not ending with a newline.
8245 Reported by Dan Jacobson.
8246 * tests/misc/paste-no-nl: New file. Test for above-fixed bug.
8247 * tests/misc/Makefile.am (TESTS): Add paste-no-nl.
8249 * src/stat.c (print_it): Avoid buffer overrun that would
8250 occur when the user-specified format string ends with `%'.
8251 Patch by Tommi Kyntola.
8252 * tests/misc/stat-fmt: New file. Test for above-fixed bug.
8253 * tests/misc/Makefile.am (TESTS): Add stat-fmt.
8255 2003-08-26 Jim Meyering <jim@meyering.net>
8257 Apply changes from bison.
8258 * GNUmakefile (SHELL): Define to `sh', if necessary.
8260 * Makefile.maint (WGETFLAGS): Define to `-C off'.
8261 Update all uses of $(WGET).
8263 2003-08-22 Akim Demaille <akim@epita.fr>
8265 * Makefile.cfg (local-checks-to-skip): New.
8266 * Makefile.maint (local-check): Rename as...
8267 (local-checks-available): this.
8270 2003-08-26 Akim Demaille <akim@epita.fr>
8272 * announce-gen (print_changelog_deltas): Neutralize "<#" as
8273 "<\#" to avoid magic from Gnus when posting parts of this script.
8275 2003-08-25 Jim Meyering <jim@meyering.net>
8277 * src/stat.c (main): Warn about use of deprecated `-l' option.
8279 2003-08-22 Jim Meyering <jim@meyering.net>
8281 * src/stat.c (do_stat): For link count at end of line, use %h format,
8282 instead of %-5h. The latter would make stat emit trailing spaces.
8283 Reported by Dan Jacobson.
8285 2003-08-20 Jim Meyering <jim@meyering.net>
8287 * Makefile.am (EXTRA_DIST): Add .x-sc_space_tab .x-sc_sun_os_names
8289 2003-08-19 Jim Meyering <jim@meyering.net>
8291 * src/system.h: Include stdlib.h unconditionally,
8292 as we're now assuming that part of hosted C89.
8294 2003-08-18 Jim Meyering <jim@meyering.net>
8296 * src/sys2.h (textdomain, bindtextdomain) [! ENABLE_NLS]: Define away,
8297 to avoid warnings from gcc.
8299 2003-08-17 Jim Meyering <jim@meyering.net>
8301 Avoid unnecessary and sometimes time-consuming hostname lookups.
8302 * src/who.c (print_user): Use strchr, not strrchr.
8303 * src/pinky.c (print_entry): Likewise.
8304 Patch by Michael Stone.
8305 This fixes a typo I introduced in who-users.c on 1996-02-23.
8307 * Makefile.maint (makefile-check): Add 0-9 to the range of characters
8308 disallowed between `@...@'.
8310 2003-08-16 Paul Eggert <eggert@twinsun.com>
8312 * configure.ac (fu_cv_sys_truncating_statfs): Remove; now
8313 done by gnulib .m4 files.
8314 (jm_DUMMY_1): Require gl_READUTMP, not jm_PREREQ_READUTMP.
8315 * src/sys2.h (strtoull): Remove unused declaration.
8317 2003-08-16 Jim Meyering <jim@meyering.net>
8319 * man/Makefile.am (.x.1): Ensure that generated PROGRAM.1 files
8322 * src/tail.c (tail_lines): Fix a potential (but very hard to exercise)
8323 race condition bug. The bug would be triggered when tailing a file
8324 with file pointer not at beginning of file, and where the file was
8325 truncated to have a length of less than the initial offset at just
8326 the right moment (between the two lseek calls in this function).
8328 An invalid initial value for *read_pos would result in
8329 `tail -n0 -f FILE' and `tail -c0 -f FILE' doing what amounted to a
8330 busy-wait rather than sleeping between iterations. The bug manifests
8331 itself only when tailing regular files that are initially nonempty.
8332 * src/tail.c (tail_bytes): Set *read_pos to new file offset after
8334 (tail_lines): Likewise, after lseek calls.
8335 Reported by Nick Estes. See http://bugs.debian.org/205251 for details.
8336 * tests/tail-2/tail-n0f: New file. Test for above fix.
8337 * tests/tail-2/Makefile.am (TESTS): Add tail-n0f.
8339 2003-08-15 Jim Meyering <jim@meyering.net>
8341 * Makefile.maint (sc_space_tab): Use exclusion list in separate file.
8342 (sc_sun_os_names): Likewise.
8343 * .x-sc_space_tab, .x-sc_sun_os_names: New files.
8345 * man/help2man: Remove some SPACEs before TAB.
8347 2003-08-14 Paul Eggert <eggert@twinsun.com>
8349 * Makefile.maint (LC_ALL): Set to C.
8350 * man/Makefile.am (ASSORT): New var.
8351 (check-x-vs-1, programs): Use it.
8352 * src/Makefile.am (ASSORT, check-README, ../AUTHORS): Likewise.
8353 * tests/Makefile.am (ASSORT, all_programs): Likewise.
8355 2003-08-11 Jim Meyering <jim@meyering.net>
8357 fold -s -wN would infloop for N < 8 with TABs in the input.
8358 E.g., this would not terminate: printf 'a\tb' | fold -w2 -s
8359 * src/fold.c (fold_file): Move contents of `else'-block
8360 out of conditional so it's used also for --spaces (-s).
8361 * tests/misc/fold: Test for the above fix.
8362 * tests/misc/Makefile.am (TESTS): Add fold.
8364 2003-08-10 Jim Meyering <jim@meyering.net>
8366 * src/nice.c [!NICE_PRIORITY]: Include <sys/resource.h> after
8367 system.h so the types from time.h and sys/time.h are available.
8368 It appears that this is necessary for OpenBSD, NetBSD, and
8369 Darwin 6.5 (MacOS 10.2.5). Reported by Nelson Beebe.
8371 2003-08-06 Paul Eggert <eggert@twinsun.com>
8373 * NEWS: Add support for setting file timestamps to microsecond
8374 resolution, on hosts that support this.
8375 * src/copy.c, src/cp.c, src/install.c, src/touch.c: Include utimens.h.
8376 * src/copy.c (copy_internal):
8377 Set file timestamps with utimens, not utime.
8378 * src/cp.c (re_protect): Likewise.
8379 * src/install.c (change_timestamps): Likewise.
8380 * src/touch.c (newtime, touch, main): Likewise.
8382 2003-08-09 Jim Meyering <jim@meyering.net>
8384 * Makefile.maint (sc_sun_os_names): New rule based on a regexp
8386 (syntax-check-rules): Add it.
8388 * src/tail.c (main): Tweak Solaris OS version number in comment.
8389 * src/wc.c (wc): Likewise
8390 * tests/tail-2/fflush: Likewise.
8392 * src/tail.c: Add new undocumented option, --presume-input-pipe.
8393 (pipe_lines): Use memchr to skip lines, rather than an explicit loop.
8395 2003-08-08 Paul Eggert <eggert@twinsun.com>
8397 Use new gnulib 'extensions' module.
8398 * configure.ac: Invoke gl_USE_SYSTEM_EXTENSIONS instead of
8401 2003-08-08 Paul Eggert <eggert@twinsun.com>
8403 * tests/du/basic: Ensure that a/b/F has at least 65 bytes too.
8405 2003-08-09 Jim Meyering <jim@meyering.net>
8407 * tests/misc/split-fail: Reflect that `split -a 0' is now accepted.
8408 For tests of obsolete behavior, don't presume that unsetting
8409 _POSIX2_VERSION is equivalent to _POSIX2_VERSION=199209.
8411 2003-08-07 Paul Eggert <eggert@twinsun.com>
8413 * doc/coreutils.texi (split invocation):
8414 Add -d or --numeric-suffixes option to 'split'.
8415 From a suggestion by Jesse Kornblum.
8416 * src/split.c (suffix_alphabet): New var.
8417 (longopts, usage, next_file_name, main): Support -d.
8418 (next_file_name, main): Allow -a0, as POSIX requires.
8419 (next_file_name): Don't assume ASCII-like encoding;
8420 'a' through 'z' are not contiguous in EBCDIC.
8422 2003-08-05 Paul Eggert <eggert@twinsun.com>
8424 Merge getline from gnulib.
8425 * lib/getline.h, lib/getline.c, m4/getline.m4: Merge from gnulib.
8426 * lib/getndelim2.h, lib/getndelim2.c, m4/getndelim2.m4, m4/ssize_t.m4:
8427 New files, from gnulib.
8428 * lib/getdelim2.c, lib/getdelim2.h: Remove.
8429 * lib/Makefile.am (libfetish_a_SOURCES): Change getdelim2.c and
8430 getdelim2.h to getndelim2.c and getndelim2.h.
8431 * m4/jm-macros.m4 (jm_MACROS): Use gl_GETNDELIM2 rather than
8432 checking for getdelim.
8433 (jm_CHECK_ALL_TYPES): Use gt_TYPE_SSIZE_T for ssize_t rather
8434 than rolling our own.
8435 * src/cut.c: Include getndelim2.h rather than getdelim2.h.
8436 (cut_fields): Invoke getndelim2 rather than getdelim2.
8438 2003-08-04 Jim Meyering <jim@meyering.net>
8440 * src/sort.c (main): Use unsigned int instead of int for `nsigs'
8441 and for the indices to iterate through nsigs.
8443 2003-08-02 Paul Eggert <eggert@twinsun.com>
8445 * src/sort.c: Minor code cleanups, mostly to use more accurate
8446 types and to remove unnecessary casts.
8447 (min, max): Remove. All uses changed to MIN and MAX.
8448 (hard_lc_collate, hard_LC_TIME, struct buffer.eof, struct
8449 keyfield.skipsblanks, struct keyfield.skipeblanks, struct
8450 keyfield.numeric, struct keyfield.general_numeric, struct
8451 keyfield.month, struct keyfield.reverse, reverse, unique,
8452 have_read_stdin): Now bool, not int. All uses changed.
8453 (eolchar): Now char, not int.
8454 (struct keyfield.ignore): Now bool const *, not int *.
8455 (struct keyfield.translate): Now char const *, not char *.
8456 (struct month.name): Likewise.
8457 (blanks, nonprinting, nondictionary): Now bool[], not int[].
8458 (cleanup, inittables, keycompare, check, mergefps, first_same_file,
8459 check, sort, main): Use const * pointers when possible.
8460 (month_cmp): Rewrite to avoid casts.
8461 (inittables): Initialize tables unconditionally, to avoid branches.
8462 (fillbuf): Return bool, not int. All uses changed.
8463 (fillbuf, keycompare, new_key, main):
8464 Use SIZE_MAX rather than (size_t) -1.
8465 (trailing_blanks): Renamed from trim_trailing_blanks.
8466 Return the number of blanks to trim. All uses changed.
8467 (getmonth): Use trailing_blanks rather than open code.
8468 (keycompare): Do not cast char * to unsigned char *; not needed.
8469 CMP_WITH_IGNORE converts args to UCHAR, so no need to convert it
8471 (compare, main): Use | rather than || to avoid jumps.
8472 Replace "diff = NONZERO (alen)" with "diff = 1", since alen must
8474 (check, first_same_file, sort, main):
8475 Use bool instead of int local vars when possible.
8476 (check): Merge the old 'checkfp' and 'check' into a single function,
8477 that returns a boolean (true if the file was ordered).
8479 (main): Use int instead of unsigned for iterating through nsigs.
8480 Rename local var "posix_pedantic" to "posixly_correct".
8482 2003-08-02 Jim Meyering <jim@meyering.net>
8484 * src/nice.c [!NICE_PRIORITY]: Include <time.h> before <sys/resource.h>
8485 to avoid compilation error on Ultrix. Reported by Christian Krackowizer.
8487 * src/cut.c (cut_fields): Don't read again after encountering an
8488 initial EOF. E.g., `cut -f2' would do so.
8489 * tests/misc/tty-eof: Add a test for the above fix.
8491 * src/sort.c (sortlines): Add description and references.
8494 * tests/Makefile.am (TESTS_ENVIRONMENT): Set PATH so that
8495 the tests in help-version will use the just-built binaries.
8496 Reported by Christian Krackowizer.
8498 2003-07-31 Paul Eggert <eggert@twinsun.com>
8500 * NEWS: Add --rfc-2822 option to GNU date.
8501 * doc/coreutils.texi (Time directives, Options for date, Examples
8503 * src/date.c (long_options, usage, main): Likewise.
8504 * doc/getdate.texi (General date syntax): Likewise.
8505 * doc/coreutils.texi (Options for date): Fix a typo in format:
8506 it's now %d not %_d. Add URLs.
8508 2003-08-01 Jim Meyering <jim@meyering.net>
8510 * tests/shred/remove: Ensure that $? is 0 for the final `exit 0'.
8511 Otherwise, with at least the /bin/sh from HPUX 10.20,
8512 the trap code would end up converting that to exit 1 and thus an
8513 unexpected test failure. Reported by Christian Krackowizer.
8515 2003-07-31 Paul Eggert <eggert@twinsun.com>
8517 * src/ptx.c: Do not include bumpalloc.h.
8518 (WORD_TABLE): New member alloc.
8519 (ALLOC_NEW_WORD): Remove.
8520 (occurs_alloc): New var.
8521 (digest_word_file, find_occurs_in_text): Check for arithmetic
8522 overflow when computing table size. Use xrealloc rather than
8523 bumpalloc primitives.
8525 2003-07-29 Jim Meyering <jim@meyering.net>
8529 * README: When running tests as root, suggest using
8530 sudo with NON_ROOT_USERNAME=$USER.
8532 * tests/Makefile.am (all_programs): Makefile is in ../src, not
8535 2003-07-28 Jim Meyering <jim@meyering.net>
8537 * Makefile.maint (GZIP_ENV): Try Debian/gzip's new --rsyncable option.
8539 2003-07-28 Paul Eggert <eggert@twinsun.com>
8541 * lib/stdbool.hin (_Bool): Make it signed char, instead of
8542 an enum type, so that it's guaranteed to promote to int.
8543 * src/sort.c (sortlines_temp): Undo previous change.
8545 2003-07-28 Jim Meyering <jim@meyering.net>
8547 * src/sort.c (sortlines_temp): Declare local `swap' to be `int', not
8548 `bool'. Otherwise, at least one buggy compiler (alpha gcc-2.95.4)
8549 would cause lines[-1 - swap] (with swap = false) to evaluate to
8552 2003-07-27 Jim Meyering <jim@meyering.net>
8554 * tests/priv-check (my_uid): Use `!', not `^' in case pattern `[!0-9]',
8555 since /bin/sh of at least NetBSD 1.6 and OpenBSD 3.2 don't accept `^'.
8557 * src/remove.c (prompt) [! recursive]: Don't prompt about unwritable
8558 directories, as required by POSIX. Reported by Karl Berry.
8559 * tests/rm/dir-no-w: New file. Test for the above fix.
8560 * tests/rm/Makefile.am (TESTS): Add dir-no-w.
8562 * tests/mk-script: Emit `$xx', not its expansion.
8564 2003-07-27 Paul Eggert <eggert@twinsun.com>
8566 This change was inspired by a similar proposal by Stepan Kasal.
8567 * src/sort.c (mergelines, sortlines_temp): New functions.
8568 (sortlines): Use them, to reduce the number of times that
8569 we need to copy 'struct line' values. This improved CPU
8570 performance by about 30% on one 18 MB test.
8571 (sort): Don't invoke sortlines unless we have 2 or more lines.
8573 2003-07-26 Stepan Kasal <kasal@ucw.cz>
8575 * src/sort.c (sort): Don't require two `struct line's per text line,
8576 the new sort algorithm requires just 1.5.
8578 2003-07-27 Jim Meyering <jim@meyering.net>
8580 * src/pathchk.c (validate_path): Use %lu, not %ld.
8582 * src/cut.c (is_printable_field): Simplify bit arithmetic.
8584 * src/ls.c (sort_files): Put `volatile' in the right place.
8587 2003-07-26 Jim Meyering <jim@meyering.net>
8589 Use only one bit per field/offset in array, not one `int'.
8590 * src/cut.c (printable_field): Change type to `unsigned char'.
8591 (mark_printable_field, is_printable_field): New functions.
8592 Use them in place of all direct accesses of `printable_field'.
8594 * src/expand.c (parse_tabstops): Detect overflow properly.
8595 * src/cut.c (set_fields): Likewise.
8597 * src/rm.c: Include "dirname.h".
8598 (usage): Use base_name (program_name) in body of --help output.
8600 * man/Makefile.am (.x.1): ...back out the kludge of 2003-07-22.
8601 Idea from Brendan O'Dea, who suggested using
8602 `program_name = basename (argv[0]);' everywhere --
8603 can't do that, but using base_name works just fine here.
8605 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Exempt test.
8607 2003-07-24 Paul Eggert <eggert@twinsun.com>
8609 Fix some POSIX-compliance problems with 'test'. This makes
8610 'test' more compatible with Bash.
8612 * NEWS, doc/coreutils.texi: Document the following.
8613 * src/test.c: Include exitfail.h.
8614 (TEST_FAILURE): New constant, used for exit status if 'test' fails.
8615 (test-syntax_error): Use it.
8616 (binary_operator): Now takes bool arg specifying whether left operand
8617 is -l ARG, so that caller determines this rather than us.
8619 (term): Use posixtest to evaluate parenthesized subexpressions.
8620 (unary_operator, one_argument): Remove support for -t without operand.
8621 (one_argument): Take argument from argv[pos].
8622 (one_argument, two_arguments, three_arguments): Advance pos.
8623 All callers changed.
8624 (three_arguments): Look for binary ops before "!". Then look
8625 for parenthesized one_argument expressions, instead of trusting
8626 expr () to do the right thing.
8627 (posixtest): Now takes number of args. All callers changed.
8628 Treat "( A B )" like "A B".
8629 (main): Set exit_failure to TEST_FAILURE. Don't depend on
8630 POSIXLY_CORRECT, as we now conform to POSIX by default.
8631 (main) [!LBRACKET]: Do not recognize "--help" or "--verbose" unless.
8632 * tests/test/Test.pm (test_vector): Add several tests to check
8633 the above. Syntax errors now exit with status 2, not 1.
8634 * man/Makefile.am (mapped_name): Use `../src/[' binary to create test.1.
8636 2003-07-26 Jim Meyering <jim@meyering.net>
8638 * tests/help-version: Adjust for above change in test behavior:
8639 `[' exits with 2, not 1, and test doesn't accept --help or --version.
8641 * Makefile.maint (ME): Don't use trick suggested in Make manual.
8642 It doesn't work for make-3.79.1. Reported by Christian Krackowizer.
8644 * Makefile.maint (sc_system_h_headers): Another syntax check.
8645 (syntax-check-rules): Add it to the list.
8647 * src/pathchk.c (validate_path): Cast strlen value to `unsigned long'
8648 so it matches `%ld' format even on 32-bit systems.
8650 * src/fmt.c (flush_paragraph): Cast field width to `int' to
8651 avoid warning on 64-bit systems.
8653 * src/ls.c (sort_files): Make `func' volatile, so it can't be
8654 clobbered by a `longjmp' into this function.
8656 2003-07-25 Jim Meyering <jim@meyering.net>
8658 * src/pathchk.c (validate_path): Use %ld format (not %d) for size_t
8661 * tests/misc/split-fail: Disable the --line-bytes=$_4gb test,
8662 because it'd evoke spurious failure on 64-bit systems.
8664 2003-07-24 Jim Meyering <jim@meyering.net>
8666 * src/dd.c (usage): Document the fact that SIGUSR1 makes dd
8667 output its current record counts. Reported by Jurriaan.
8669 * tests/wc/Test.pm (test_vector): Disable the `PIPE' tests when running
8670 `wc' with no options. This goes along with the change of 2003-07-20.
8672 2003-07-23 Jim Meyering <jim@meyering.net>
8674 Don't include headers already included by system.h:
8675 * src/tr.c: Don't include errno.h.
8676 * src/true.c: Don't include version-etc.h.
8677 * src/test.c: Don't include limits.h or error.h.
8678 * src/stat.c: Don't include unistd.h or time.h.
8679 * src/readlink.c: Don't include stdlib.h, unistd.h, or limits.h.
8680 * src/pr.c: Don't include time.h.
8681 * src/pathchk.c: Don't include errno.h.
8682 * src/nice.c: Don't include sys/time.h.
8683 * src/ls.c: Don't include stdlib.h.
8685 * basename.c, cat.c, chroot.c, cksum.c, comm.c, csplit.c, cut.c, date.c:
8686 * dd.c, dirname.c, echo.c, env.c, expand.c, expr.c, factor.c, fmt.c:
8687 * fold.c, head.c, hostid.c, hostname.c, id.c, join.c, kill.c, logname.c:
8688 * md5sum.c, nice.c, nl.c, nohup.c, od.c, paste.c, pathchk.c, pinky.c:
8689 * pr.c, printenv.c, printf.c, ptx.c, pwd.c, seq.c, setuidgid.c, shred.c:
8690 * sleep.c, sort.c, split.c, stat.c, stty.c, su.c, sum.c, tac.c, tail.c:
8691 * tee.c, test.c, tr.c, true.c, tsort.c, tty.c, uname.c, unexpand.c:
8692 * uniq.c, uptime.c, users.c, wc.c, who.c, whoami.c, yes.c:
8693 Don't include closeout.h.
8695 * tests/rm/fail-2eperm: Add a check for whether $NON_ROOT_USERNAME
8696 can access the required version of rm.
8697 * tests/rm/Makefile.am (TESTS_ENVIRONMENT): Define PACKAGE_VERSION.
8699 * tests/cut/Test.pm (out-delim3a): New test.
8701 * man/help2man: Update to version 1.33.
8703 * src/expand.c (parse_tabstops): Detect overflow in tabstop sizes.
8705 * src/dircolors.c: Include xstrndup.h.
8706 (xstrndup): Remove function, now that it's been factored out into
8709 2003-07-22 Paul Eggert <eggert@twinsun.com>
8711 * src/wc.c (wc): Fix typo in computation of file from file_x,
8712 which caused the former to be used uninitialized if file_x was
8715 2003-07-22 Jim Meyering <jim@meyering.net>
8717 * src/cut.c (set_fields): Use xcalloc in place of xmalloc+memset.
8719 * man/Makefile.am (.x.1): Substitute 's,$t/$*,$*,' on output of
8720 help2man, to avoid having `rm.td/rm' appear in rm.1. Reported by
8721 Thomas Luzat. See http://bugs.debian.org/202413 for details.
8723 * src/cut.c (main) [lint]: Initialize spec_list_string to avoid warning.
8725 * src/hostid.c: Don't include <unistd.h>. system.h already does that.
8727 * src/cut.c (set_fields): Mark all selected indices before trying to
8728 determine range endpoints.
8729 * tests/cut/Test.pm: New test for the above fix.
8731 Begin to address this comment: What if someone wants to
8732 extract the 1,000,000-th field of some huge input file?
8733 The first step is to rearrange things so that the values
8734 in the printable_field array are all 0/1 rather than 0/1/2.
8735 * src/cut.c (RANGE_START_SENTINEL): Remove.
8736 Store range-start indices in a hash table, rather than
8737 overloading the `printable_field' array.
8738 (range_start_ht): New global.
8739 (hash_int, hash_compare_ints, is_range_start_index): New functions.
8740 (print_kth): Use is_range_start_index; don't test printable_field.
8741 (set_fields): Detect overflow.
8742 (set_fields): Insert each range-start index into range_start_ht.
8743 (main): Call set_fields only once, and only after
8744 output_delimiter_specified and (if required) range_start_ht have
8747 2003-07-20 Paul Eggert <eggert@twinsun.com>
8749 * src/wc.c (get_input_fstatus): Fix typo: `stat' was being
8750 invoked with a null pointer when there were no file arguments.
8752 2003-07-20 Jim Meyering <jim@meyering.net>
8754 * Makefile.maint (sc_changelog): Add another nit-picky check.
8756 * src/wc.c (write_counts): Add a comment.
8757 (wc): Rename `file' parameter.
8758 Set new local, `file', to be the file name, or (when it's NULL)
8759 _("standard output") so that all uses of `file' use the proper value.
8760 Use STREQ, not strcmp.
8762 2003-07-20 Paul Eggert <eggert@twinsun.com>
8764 wc count field widths now are heuristically adjusted depending
8765 on the input size, if known. If only one count is printed, it
8766 is guaranteed to be printed without leading spaces.
8768 Previously, wc did not align the count fields if
8769 POSIXLY_CORRECT was set, but POSIX did not actually require
8770 this undesirable behavior, so it has been removed.
8772 * NEWS: Document this.
8773 * doc/coreutils.texi (wc invocation): Likewise.
8775 * src/wc.c (number_width): New var.
8776 (posixly_correct): Remove.
8777 (struct fstatus): New struct.
8778 (write_counts): Output fields of width number_width.
8779 Do not worry about POSIXLY_CORRECT.
8780 Use null file, not empty-string file, to denote stdin,
8781 since "" is a valid file name on some hosts.
8782 (wc, wc_file): New arg fstatus. Use it to avoid invoking fstat
8784 (wc): Avoid problems if end_pos - current_pos overflows.
8785 Do not print odd message if stdin has a read error.
8786 (get_input_fstatus, compute_number_width): New functions.
8787 (main): Use them to implement the new behavior.
8788 Ignore POSIXLY_CORRECT.
8790 * tests/wc/Test.pm: Adjust to the new output widths.
8792 2003-07-19 Jim Meyering <jim@meyering.net>
8794 * tests/rm/fail-eperm: Don't create temporary directory --
8797 * tests/shred/remove: Don't open-code test for UID != 0.
8798 Use priv-check's require-non-root instead.
8799 Update to use newer framework.
8801 * tests/help-version (expected_failure_status_expr): Record that
8802 expr exits with status of 3 for e.g., a write error.
8804 * tests/priv-check: Use `id -u' to see if we're running as root,
8805 rather than trying go write to an write-protected file.
8806 When running as root, ensure $NON_ROOT_USERNAME is valid.
8807 When running as root with `require-non-root', ensure that `.'
8808 is writable by $NON_ROOT_USERNAME, then reinvoke $0 set-user-ID
8809 to $NON_ROOT_USERNAME. If `.' is not writable, then skip the test.
8811 * src/printenv.c: Include "exitfail.h".
8812 (main): Set exit_failure rather than calling close_stdout_set_status.
8813 * src/date.c: Likewise.
8814 * src/sort.c: Likewise.
8815 * src/tty.c: Likewise.
8817 2003-07-18 Jim Meyering <jim@meyering.net>
8819 * tests/touch/not-owner: Update to use newer framework.
8821 * tests/rm/fail-eperm: Use $srcdir/../priv-check, create a temporary
8822 directory, and remove Perl-coded `you may not run as root' test.
8823 * tests/cp/fail-perm: Use $srcdir/../priv-check, rather than
8824 hard-coding something not quite equivalent.
8825 Paul Jarc reported the inconsistent diagnostics.
8827 * src/sort.c (main): Use close_stdout via atexit.
8828 Now `sort --version' and `sort --help' fail, as they should
8829 when their output is redirected to /dev/full.
8831 * src/su.c (usage): Don't call close_stdout here.
8832 (main): Use close_stdout via atexit.
8833 Now `su --version > /dev/full' fails, as it should.
8834 Somehow, the change of 2000-05-07 that purports to fix this
8837 * tests/help-version (--help/--version vs. /dev/full): Special-case
8838 `[' to protect it from expected_failure_status-`eval'.
8840 * src/uniq.c (writeline): Use a SPACE, not a TAB between the
8841 count and the corresponding line, as required by POSIX.
8842 Reported by Clement Wang.
8843 * tests/uniq/Test.pm (101, 102): Update tests of -c accordingly.
8845 * tests/expr/basic: Add tests for when exit status is 2.
8847 * src/nohup.c (NOHUP_FOUND_BUT_CANNOT_INVOKE, NOHUP_FAILURE):
8848 Use an anonymous `enum', rather than #define.
8850 2003-07-17 Paul Eggert <eggert@twinsun.com>
8852 * src/expr.c: Include "exitfail.h", "quotearg.h".
8853 (EXPR_INVALID, EXPR_ERROR): New constants.
8854 (nomoreargs, null, toarith, nextarg): Return bool, not int.
8855 (syntax_error): New function, exiting with status 2. Use it
8856 insteading of printing "syntax error" ourselves.
8857 (main): Initialize exit_failure to EXPR_ERROR.
8858 Exit with EXPR_INVALID on syntax error (too few arguments).
8859 (nextarg): Use strcmp, not strcoll; strcoll might return
8860 an undesirable 0, or might fail.
8861 (docolon, eval4, eval3): Exit with status 3 on invalid argument type
8862 or other such error.
8863 (eval2): Report an error if strcoll fails in a string comparison.
8864 * src/sort.c: Include "exitfail.h".
8865 (main): Set exit_failure, not xalloc_exit_failure and
8866 xmemcoll_exit_failure.
8867 * tests/expr/basic: Invalid value exits with status 3, not 2.
8869 2003-07-16 Jim Meyering <jim@meyering.net>
8871 * configure.ac (AC_INIT): Use 5.0.90 as the version, rather than 5.0.2,
8872 per GNU maintainer guidelines. The next non-beta release will be 5.1.
8874 This script would have caught at least two recent bugs:
8875 those in [ and kill.
8876 * tests/help-version: Revive this script.
8877 It wasn't doing anything useful, since $all_programs wasn't being
8878 defined by the invoking Makefile.am.
8879 Reflect that nohup is no longer a script, so don't exclude it.
8880 Add framework to handle the programs added since it was last run:
8881 kill, stat, unlink, [, link, readlink.
8882 Fix path-related problems deriving from the move of this script
8883 from src/ to its present location.
8884 * tests/Makefile.am (all_programs): Define.
8885 (TESTS_ENVIRONMENT): Use it.
8887 * src/kill.c (main): Fix bug introduced on 2003-05-10 (for 5.0.1)
8888 whereby kill would always attempt to operate on argv[0] and fail.
8890 * src/test.c (integer_expected_error): Improve diagnostic -- now,
8891 it also matches the one from bash's builtin test.
8892 (binary_operator): Add \n at end of diagnostic.
8894 * tests/rm/fail-2eperm: Remove setuidgid-related code. Move it to ...
8895 * tests/priv-check: Move setuidgid-related and
8896 NON_ROOT_USERNAME-checking code to this file.
8898 * README: Update section on testing as `root'.
8899 Suggestion from Paul Jarc.
8901 * src/test.c (AUTHORS): Replace 3-letter usernames with the actual
8902 names of authors that I just found in bash's builtins/test.def.
8904 Running `[' with no arguments would evoke a segfault.
8905 * src/test.c (main) [LBRACKET]: Move initialization of argv to
8906 precede potential use via test_syntax_error.
8908 * src/Makefile.am (AM_CPPFLAGS): Rename from `INCLUDES', to avoid
8909 warning from automake -Wall.
8911 2003-07-15 Jim Meyering <jim@meyering.net>
8915 * Makefile.maint (%.asc): Remove target first, so gpg doesn't
8918 * announce-gen (print_changelog_deltas): Relax tests for matching
8919 version-number line in NEWS.
8920 Change the .sig suffix to .asc here, too.
8922 2003-07-14 Jim Meyering <jim@meyering.net>
8924 * Makefile.maint (%.asc): Renamed from %.sig.
8925 Generate and use ascii-armored signatures.
8926 Use gpg's -o option.
8928 2003-07-13 Jim Meyering <jim@meyering.net>
8930 * src/nohup.c (NOHUP_FAILURE, NOHUP_FOUND_BUT_CANNOT_INVOKE): Define.
8933 * Makefile.maint (syntax-check): Move each individual check into
8935 (syntax-check-rules): This is the list of syntax-check targets.
8936 (sc_unmarked_diagnostics, sc_cast_of_argument_to_free):
8937 (sc_cast_of_x_alloc_return_value, sc_space_tab):
8938 (sc_error_exit_success, sc_xalloc_h_in_src): New targets.
8940 2003-07-12 Jim Meyering <jim@meyering.net>
8942 * configure.ac: Remove uses of OPTIONAL_BIN_ZCRIPTS and last
8943 traces of the nohup script.
8945 * src/Makefile.am (bin_SCRIPTS): Remove use of just-removed
8946 $(OPTIONAL_BIN_ZCRIPTS).
8948 * src/Makefile.am (localedir.h): Put the `2>&1' after the redirect
8949 target, not before the `>'.
8951 * src/remove.c (remove_dir): Give a diagnostic upon failed save_cwd,
8952 now that that function no longer calls `error'.
8954 * src/df.c (find_mount_point): Emit a diagnostic for each
8955 failed syscall, rather than relying on caller to do that.
8956 The caller couldn't do a good job, anyhow -- too many different
8957 ways to fail (each with a different referent).
8958 Give a diagnostic upon failed save_cwd, now that that function
8959 no longer calls `error'.
8960 (show_point): Don't diagnose find_mount_point's errors, now that
8961 it handles them itself.
8963 * src/df.c (find_mount_point): Don't let free clobber errno upon
8966 * src/sys2.h: Remove alloca-related block.
8967 * src/system.h: Include <alloca.h> here, instead.
8969 It appears that the `#pragma alloca' included via "system.h" is
8970 adequate, since join.c uses alloca, yet lacked an in-file #pragma.
8971 * src/copy.c, src/cp.c, src/df.c, src/install.c, src/ln.c:
8972 * src/ls.c, src/mv.c, src/remove.c: Remove `#pragma alloca'.
8974 * src/chown-core.c (change_file_owner): Do not restore any special
8975 permission bits (e.g., set-user-ID, set-group-ID) that are reset
8976 by chown(2) on some systems. Suggestion and insistence :-) from
8979 * tests/input-tty: Also check `test -t 1'.
8980 This is necessary on linux-2.4.21. Otherwise, the stty/basic-1
8981 test would block when run in the background.
8983 2003-07-11 Jim Meyering <jim@meyering.net>
8985 * tests/sample-test: Also fail if cat-to-create-expected-output
8986 fails. Otherwise, if both `exp' and `out' were to end up empty
8987 because of e.g., a full disk, they would mistakenly compare equal.
8989 * src/nohup.c: New file. Rewrite of nohup.sh in C.
8990 This solves a portability problem: on at least Solaris systems,
8991 when nohup.sh used the vendor /bin/sh, it would exit with status
8992 of `1' rather than the required 126 or 127 upon failure to exec
8993 the specified program.
8995 * src/Makefile.am (EXTRA_SCRIPTS): Remove definition.
8996 (bin_PROGRAMS): Add nohup.
8997 (EXTRA_DIST): Remove nohup.sh.
8998 (all_programs): Remove use of $(EXTRA_SCRIPTS).
8999 * src/nohup.sh: Remove file.
9000 * man/Makefile.am (nohup.1): Depend on nohup.c, rather than nohup.sh.
9002 * tests/misc/nohup: Tests for the above.
9003 * tests/misc/Makefile.am (TESTS): Add nohup.
9005 * src/head.c (diagnose_copy_fd_failure): New function, renamed from
9006 the macro, COPY_FD_DIAGNOSE.
9007 (diagnose_copy_fd_failure): Enclose diagnostic in _(...).
9008 (head_file): Likewise.
9010 * src/date.c: Include "quote.h".
9011 (batch_convert): Use the quote function rather than using literal `...'
9014 * src/setuidgid.c (main): Enclose diagnostic in _(...).
9015 * src/fmt.c (main): Likewise.
9016 * src/mknod.c (main): Likewise.
9017 * src/tac.c (tac_seekable): Likewise.
9018 * src/yes.c (main): Likewise.
9019 * src/od.c (main): Likewise.
9020 * src/install.c (change_attributes): Likewise.
9022 2003-07-10 Jim Meyering <jim@meyering.net>
9024 * src/head.c (usage): Use 1024*1024 in place of 1048576.
9025 * src/tail.c (usage): Likewise.
9027 * tests/rm/fail-2eperm: Now that we have setuidgid, use it in
9028 place of the kludge in this test. Suggestion from Paul Jarc.
9030 * src/Makefile.am (noinst_PROGRAMS): Define to setuidgid.
9031 * src/setuidgid.c: New program, solely for testing (not installed).
9033 * src/chown-core.c (change_file_owner): Don't leak file descriptors
9034 when dereferencing symlinks.
9036 2003-07-09 Jim Meyering <jim@meyering.net>
9038 * tests/du/slash: New file/test for today's lib/ftw.c fix.
9039 * tests/du/Makefile.am (TESTS): Add slash
9041 * src/tail.c (xlseek): Avoid warning about ``return without value
9042 from function returning non-void''.
9044 2003-07-08 Jim Meyering <jim@meyering.net>
9046 * man/help2man: Update to version 1.29.
9048 * man/help2man: Add END handler to close STDOUT and check for errors.
9050 2003-06-30 Paul Eggert <eggert@twinsun.com>
9052 Add support for a "[" that conforms to the GNU coding standards,
9053 i.e., that does not depend on its name.
9054 * src/lbracket.c: New file.
9056 * man/Makefile.am (programs): Ignore "[", since it doesn't have
9057 a separate man page.
9058 * src/Makefile.am (bin_PROGRAMS): Add "[".
9059 (__SOURCES): New var.
9060 * src/test.c (LBRACKET): Define to 0 if not defined.
9061 (main): Use LBRACKET rather than argv[0].
9063 * src/test.c (one_argument): Do not check for -t if POSIXLY_CORRECT.
9064 Reported by Paul Jarc and Dan Jacobson.
9066 * src/test.c (main): Do not recognize --help or --version if
9067 POSIXLY_CORRECT, when invoked as "test". Handle "[ ]" correctly.
9068 Do not bother testing that margv[margc] is non-null.
9070 2003-07-04 Jim Meyering <jim@meyering.net>
9072 * src/who.c (print_line): Rewrite to use asprintf, in order to be
9073 able to avoid emitting trailing spaces. Reported by Dan Jacobson.
9075 * tests/misc/head-elide-tail: Add tests of head's new --lines=-N
9076 option, and perform the +1600 invocations of head IFF the envvar
9077 RUN_EXPENSIVE_TESTS is set.
9079 2003-07-03 Jim Meyering <jim@meyering.net>
9081 * src/cp.c (do_copy): Give a better diagnostic when failing due
9082 to nonexistent destination directory. Reported by Dmitry Rutsky.
9083 See http://bugs.debian.org/199730 for details.
9085 2003-06-27 Jim Meyering <jim@meyering.net>
9087 split's --verbose option did nothing [broken in 4.5.10 and 5.0]
9088 * src/split.c (longopts): Use `1', not `0' as the value for
9089 &verbose. Reported by Keith Thompson.
9091 Test for the above fix.
9092 * tests/misc/split-a: Also use --verbose and compare stderr
9093 output with what we'd expect.
9095 2003-06-20 Jim Meyering <jim@meyering.net>
9097 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
9098 Use `error_t' (rather than int) as type for local `err'.
9099 From Alfred M. Szmidt.
9101 2003-06-19 Marcus Brinkmann <marcus@gnu.org>
9103 * src/copy.c (copy_internal) [HAVE_STRUCT_STAT_ST_AUTHOR]:
9104 Fix author preservation code.
9106 2003-06-19 Jim Meyering <jim@meyering.net>
9108 * src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Define to 0.
9109 (do_link): Don't warn about hard link to symlink.
9111 2003-06-18 Jim Meyering <jim@meyering.net>
9113 * src/cut.c: Include "getdelim2.h", not "getstr.h".
9114 Reflect renaming: getstr -> getdelim2.
9116 * src/comm.c, src/join.c, src/nl.c, src/uniq.c: Reflect renaming:
9117 readline -> readlinebuffer.
9119 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
9121 * src/readlink.c: Include <sys/types.h> before system.h (because
9122 the latter includes <sys/stat.h>). Required on Ultrix 4.3.
9124 2003-06-17 Jim Meyering <jim@meyering.net>
9126 * src/system.h (initialize_main): Define.
9127 Use it in every `main'. Applied via this:
9128 p='initialize_main (&argc, &argv);'
9129 perl -ni -e '/program_name.=.argv.0/ and print " '"$p"'\n"; print' \
9130 $(grep -l program_name.=.argv.0 *.c)
9131 test.c uses margc/margv, so I made the change manually for that file.
9132 Based on a patch from Bernard Giroud.
9134 2003-06-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
9136 Fix for build failure on Ultrix 4.3.
9137 * src/stat.c: Include sys/statvfs.h in preference to sys/vfs.h.
9138 Include sys/param.h and sys/mount.h on ultrix.
9140 2003-06-16 Jim Meyering <jim@meyering.net>
9142 * src/touch.c (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Remove
9144 * src/system.h (O_NDELAY, O_NONBLOCK, O_NOCTTY, EISDIR): Define
9145 them here instead, but with one change: define EISDIR to -1, not 0.
9147 * src/cat.c (cat): Remove `#ifndef ENOSYS', now that it's
9148 guaranteed to be defined.
9149 * src/system.h (ENOSYS, ENOTSUP): Define to -1 if not defined.
9151 * README: Mention the CVS repository.
9152 Encourage addition of test cases.
9154 2003-06-12 Jim Meyering <jim@meyering.net>
9156 * src/touch.c (touch): Call close only if necessary.
9159 * src/wc.c (usage): Correct wording: wc prints counts in the order
9160 `newline, word, byte'. Reported by Keith M. Briggs.
9161 * man/wc.x: Fix it here, too. And change `lines' to `newlines'.
9163 2003-06-10 Jim Meyering <jim@meyering.net>
9165 * tests/date/Test.pm: Add a test for the new format, e.g., May-23-2003.
9167 2003-06-07 Jim Meyering <jim@meyering.net>
9169 * Makefile.maint (syntax-check): Add commented-out (over-aggressive)
9172 2003-06-06 Jim Meyering <jim@meyering.net>
9174 * src/extract-magic (main): Avoid newer 3-arg form of open,
9175 so this script works also with e.g., perl5.005_03.
9176 Patch by John David Anglin.
9178 2003-06-04 Paul Eggert <eggert@twinsun.com>
9180 * src/system.h: Include <stdbool.h> unconditionally.
9182 2003-06-04 Jim Meyering <jim@meyering.net>
9184 * man/Makefile.am (check-programs-vs-x): Rename target
9185 from check-programs-vs-1. Adjust rule to check for the
9186 primary (.x) file, not the generated one (.1).
9188 2003-06-03 Tim Mooney <mooney@dogbert.cc.ndsu.NoDak.edu>
9190 * man/kill.x: New file.
9191 * man/Makefile.am (dist_man_MANS): Add kill.1.
9194 2003-06-04 Jim Meyering <jim@meyering.net>
9196 Ensure that the .x file for a new program is never forgotten again.
9197 * man/Makefile.am (programs): Define.
9198 (check-programs-vs-1): New phony target.
9199 (check-local): Depend on it.
9201 2003-06-03 Jim Meyering <jim@meyering.net>
9203 Avoid unnecessary copying of environment.
9204 * src/env.c (main): Rather than clearing the environment and --
9205 unless told to ignore environment -- copying all settings from
9206 the saved, original environment, clear the environment only when
9207 that is requested. Suggested by Jens Elkner.
9209 2003-06-02 Jim Meyering <jim@meyering.net>
9211 * src/system.h: Always include <string.h>, since we assume C89.
9212 Include <limits.h> without checking for HAVE_LIMITS_H.
9214 * src/test.c [!TEST_STANDALONE]: Remove #if-0'd block.
9215 (STREQ, S_IXUGO): Remove redundant (in system.h) definitions.
9217 2003-06-01 Jim Meyering <jim@meyering.net>
9219 Avoid a race condition in `tail -f' described by Ken Raeburn in
9220 http://mail.gnu.org/archive/html/bug-textutils/2003-05/msg00007.html
9221 * src/tail.c (file_lines): Add new parameter, *read_pos, and set it.
9222 (pipe_lines, pipe_bytes, start_bytes, start_lines): Likewise.
9223 (tail_bytes, tail_lines, tail): Likewise.
9224 (tail_file): Use the new `read_pos' value as the size,
9225 rather than stats.st_size from the fstat call.
9227 2003-05-28 Jim Meyering <jim@meyering.net>
9229 * src/extract-magic: Allow expansion of `$file' in the here-
9230 document corresponding to the comment at the top of fs.h.
9232 2003-05-26 Jim Meyering <jim@meyering.net>
9234 * src/stat.c: Fix portability problem on FreeBSD5.0: don't include
9235 <sys/statvfs.h> on systems without HAVE_STRUCT_STATVFS_F_BASETYPE.
9236 Use #if/#elif/... cascade so we get only one set of include files.
9237 Reported by Nelson Beebe.
9239 2003-05-24 Jim Meyering <jim@meyering.net>
9241 * src/md5sum.c (split_3): Accept the BSD format only when in MD5 mode.
9242 * tests/sha1sum/basic-1: Make sure `sha1sum --check' doesn't
9243 accept the BSD format.
9245 2003-03-28 Joe Orton <jorton@redhat.com>
9247 * src/md5sum.c (bsd_split_3): New function.
9248 (split_3): Detect checksums from BSD 'md5' command and handle them
9251 * tests/md5sum/basic-1: New tests for --check exit status, and for
9252 BSD-style checksum files.
9254 2003-05-21 Jim Meyering <jim@meyering.net>
9256 * src/head.c (elide_tail_lines_pipe): Fix a thinko.
9257 This sort of thing is why it'd be *Really Good* to factor
9258 out the common code used here and in tail.c.
9260 2003-05-14 Jim Meyering <jim@meyering.net>
9262 * src/head.c (usage): Document new feature: --bytes=-N and --lines=-N.
9264 * tests/du/slink: Skip this test if `.' is on an XFS file system.
9266 * tests/du/fd-leak: New file. Test for the bug in du that
9267 was fixed by the 2003-05-12 change to lib/ftw.c.
9268 * tests/du/Makefile.am (TESTS): Add fd-leak.
9270 * src/head.c (AUTHORS): Enclose string in N_(...), now that it
9271 includes a translatable word, `and'.
9273 * src/dd.c (usage): Don't use `,' as the thousands separator
9274 in e.g. 1,000,000 and 1,048,576. Instead, do this:
9275 `SIZE may be ..., MB 1000*1000, M 1024*1024 and so on...'
9276 * src/df.c (usage): Likewise.
9277 * src/du.c (usage): Likewise.
9278 * src/ls.c (usage): Likewise.
9280 * Makefile.maint (syntax-check): Add another check.
9282 2003-05-13 Paul Eggert <eggert@twinsun.com>
9284 Fix uniq to conform to POSIX, which requires that "uniq -d -u"
9285 must output nothing. Problem reported by Josh Hyman.
9287 * src/uniq.c (enum output_mode, mode): Remove, replacing with:
9288 (output_unique, output_first_repeated, output_later_repeated):
9289 New vars. All uses of "mode" changed to use these variables,
9290 which are not mutually exclusive as "mode" was.
9291 (writeline): New arg "match", used to control whether to
9292 obey output_first_repeated or output_later_repeated.
9293 All callers changed.
9294 (check_file, main): Adjust to above changes.
9296 * tests/uniq/Test.pm: Test that 'uniq -d -u' outputs nothing.
9298 2003-05-14 Jim Meyering <jim@meyering.net>
9300 * tests/rm/rm3: Use tr's \n notation rather than \012.
9301 This package can afford to do that, since its tests are guaranteed use
9302 GNU tr, which has accepted the more modern notation for 10 years.
9303 * tests/rm/rm5: Likewise.
9304 * tests/cp/same-file: Likewise.
9305 * tests/stty/row-col-1: Likewise.
9306 * tests/stty/basic-1: Likewise.
9307 * tests/rm/deep-1: Likewise.
9308 * tests/mv/part-symlink: Likewise.
9309 * tests/mkdir/perm: Likewise.
9310 * tests/misc/nice: Likewise.
9312 2003-05-13 Jim Meyering <jim@meyering.net>
9314 * src/copy.c (struct F_triple) [name]: Remove const attribute.
9315 (triple_free): Don't apply cast to argument of free.
9316 (seen_file): Add cast here instead.
9318 * src/cp-hash.c (struct Src_to_dest) [name]: Remove const attribute.
9319 (src_to_dest_free): Don't apply cast to argument of free.
9321 * src/sort.c (zaptemp): Don't apply cast to argument of free.
9322 * src/pr.c (init_fps, init_store_cols): Likewise.
9323 * src/join.c (delseq, freeline): Likewise.
9324 * src/expr.c (OLD): Likewise.
9325 * src/sort.c (sort): Likewise.
9326 * src/head.c (elide_tail_lines_pipe): Likewise.
9328 * src/tail.c: Include "quote.h".
9329 Use quote in diagnostics. Change many error format strings
9330 from just `%s' to e.g., `error reading %s'.
9331 (pipe_lines): Change type of parameter, n_lines, to uintmax_t.
9332 Rewrite newline-counting loop to use memchr.
9334 * src/head.c (elide_tail_lines_pipe): Use `if', not assert.
9335 Now that assert is no longer used, don't include <assert.h>.
9337 2003-05-12 Jim Meyering <jim@meyering.net>
9339 * src/head.c: Include <assert.h>.
9340 (AUTHORS): Add my name.
9341 (elide_tail_lines_pipe): New function.
9343 2003-05-10 Jim Meyering <jim@meyering.net>
9345 * Makefile.maint (syntax-check): Check for `error (EXIT_SUCCESS,'.
9347 * src/readlink.c (main): Set program_name before first use.
9348 Remove that (redundant) first use.
9349 Don't exit successfully just because --verbose was specified.
9350 Pass 0, not EXIT_SUCCESS, as first argument to error; when that
9351 parameter is 0, error does not exit.
9353 * src/uname.c (main): When failing due to too many arguments, also say
9354 that, rather than just "Try `uname --help' for more information.".
9355 * src/comm.c (main): Likewise, but for too few arguments.
9356 * src/logname.c: Include error.h.
9357 (main): Say why we're failing.
9359 * src/uniq.c (main): Don't segfault when argc < optind.
9360 * src/who.c (main): Handle argc < optind.
9361 * src/df.c (main): Likewise.
9362 * src/install.c (main): Likewise.
9363 * src/mv.c (main): Likewise.
9364 * src/pwd.c (main): Likewise.
9365 * src/tty.c (main): Likewise.
9366 * src/chroot.c (main): Likewise.
9367 * src/hostname.c: Likewise.
9368 * src/du.c (main): Likewise.
9369 * src/expand.c (main): Likewise.
9370 * src/env.c (main): Likewise.
9371 * src/unexpand.c (main): Likewise.
9372 * src/printenv.c (main): Likewise.
9373 * src/sync.c (main): Handle argc == 0.
9374 * src/expr.c (main): Likewise.
9375 * src/printf.c (main): Likewise.
9376 * src/basename.c (main): Likewise.
9377 * src/ln.c (main): Test for `missing argument' before computing n_files.
9378 * src/tail.c (main): Test for the case of no arguments before
9381 * src/kill.c (send_signals): Don't check command line arguments here.
9382 (main): Check them here instead. Handle argc < optind.
9384 * src/logname.c (main): Use error, rather than fprintf, for the sake
9387 * src/rm.c (main): Don't overrun array bound if argc is 0.
9389 2003-05-09 Jim Meyering <jim@meyering.net>
9391 * src/sort.c (main): Don't overrun array bound if argc is 0.
9392 That would happen when invoked via: execl ("/usr/bin/sort", NULL);
9393 Reported by Wartan Hachaturow.
9395 2003-05-07 Jim Meyering <jim@meyering.net>
9397 Implement support so that `head --lines=-N' works on seekable files.
9398 * src/head.c (enum Copy_fd_status): Define.
9399 (COPY_FD_DIAGNOSE): New macro.
9400 (elide_tail_lines_seekable): New funtion.
9401 (elide_tail_lines_file): Call it here.
9403 2003-05-06 Jim Meyering <jim@meyering.net>
9405 * src/sys2.h (CHAR_BIT): Remove duplicate definition.
9407 2003-05-04 Jim Meyering <jim@meyering.net>
9409 * tests/head/Test.pm: Remove tests of --bytes=-N; using that framework
9410 caused the addition of thousands of small files to the tar archive.
9411 * tests/misc/head-elide-tail: New file. Add them here instead.
9412 * tests/misc/Makefile.am (TESTS): Add head-elide-tail.
9414 2003-05-04 Paul Eggert <eggert@twinsun.com>
9416 * src/remove.c (HAVE_WORKING_READDIR): Define to 0 if not defined.
9417 (IF_READDIR_NEEDS_REWINDDIR): Remove.
9418 (remove_cwd_entries): Rewrite to avoid IF_READDIR_NEEDS_REWINDDIR,
9419 which was a bit weird because it couldn't be emulated by a function.
9421 2003-05-03 Jim Meyering <jim@meyering.net>
9423 Extend head to accept --lines=-N (--bytes=-N) and to print all
9424 but the N lines (bytes) at the end of the file.
9425 * src/head.c: Include full-write.h, full-read.h, inttostr.h, quote.h.
9426 Use quote() in diagnostics, rather than literal `' marks.
9427 (copy_fd, elide_tail_bytes_pipe, elide_tail_bytes_file):
9429 (elide_tail_lines_pipe, elide_tail_lines_file): New functions.
9430 (head_file): Reorganize so as to call head from only one place.
9431 (main): Likewise, for head_file.
9432 Handle new, undocumented option, --presume-input-pipe.
9433 Handle negative line and byte counts.
9434 * tests/head/Test.pm: Add lots of tests to exercise --bytes=-N.
9436 * tests/du/8gb: Skip test if the file system of `.' doesn't support
9437 sparse files -- otherwise it'd create a file of size 8GB.
9439 2003-05-02 Jim Meyering <jim@meyering.net>
9441 * src/fmt.c (usage): Don't mention obsolescent -WIDTH option.
9442 Instead explain about `-' and standard input.
9443 (main): Give a proper diagnostic for e.g., `fmt -c -72'.
9444 Reported by Keith Thompson.
9445 * tests/fmt/basic: Add test for the above fix.
9447 * src/fmt.c: Include "quote.h".
9448 Use quote() in diagnostics, rather than literal `' marks.
9449 (main): Exit nonzero when unable to open an input file.
9450 * tests/fmt/basic: Add test for the above fix.
9452 * src/fmt.c (main): Diagnose invalid suffix on obsolescent width
9453 specifications like `-72x'.
9454 * tests/fmt/basic: Add test for the above fix.
9456 Work around nasty readdir bug on Darwin6.5.
9457 * src/remove.c (IF_READDIR_NEEDS_REWINDDIR): Define.
9458 [! HAVE_WORKING_READDIR] (remove_cwd_entries): If readdir has just
9459 returned NULL and there has been at least one successful unlink or
9460 rmdir call since the opendir or previous rewinddir, then call
9461 rewinddir and reiterate the loop.
9463 Factor out common code.
9464 * src/remove.c (readdir_ignoring_dotdirs): New function.
9465 (is_empty_dir): Use it here.
9466 (remove_cwd_entries): Use it here.
9468 2003-05-01 Jim Meyering <jim@meyering.net>
9470 * tests/rm/r-3: Create 500 rather than just 300 files.
9471 There's a bug in Darwin6.5's readdir that shows up only with
9473 Fix a bug in this test: `cd $pwd' (not to `..'), now that $tmp
9477 Change type of n_units, n_bytes, n_lines to be `uintmax_t'.
9478 (dump_remainder): Move two declarations `down' into the scope
9479 where they are used.
9480 (xlseek): Return the resulting offset.
9481 (file_lines): Rename parameter, file_length, to end_pos.
9482 (pipe_lines): Don't coerce safe_read return value to `int'.
9483 Adapt tests accordingly.
9484 (pipe_bytes) [struct charbuffer] (nbytes): Change type from `int'
9486 Change type of `total_bytes' from `int' to `size_t',
9487 since the former wouldn't always be wide enough.
9488 Don't coerce safe_read return value to `int',
9489 and adapt tests accordingly.
9490 Now that testing for a read error no longer involves
9491 using `tmp', handle that case *after* freeing `tmp'.
9492 (start_bytes): Clean up.
9493 (tail_bytes): Now that `n_bytes' may be larger than
9494 OFF_T_MAX, test for that condition and, if it's true, don't
9495 use lseek optimizations.
9496 (parse_options): Don't fail just because N_UNITS is larger than
9497 the maximum size of a file -- tail may be applied to an input
9498 stream (e.g., a pipe) with more data than that.
9500 * Makefile.maint (syntax-check): Rename from alloc-check.
9501 Also check for SPACE-TAB sequences.
9502 Also check for malloc/calloc/realloc casts.
9504 2003-05-01 Jim Meyering <jim@meyering.net>
9506 * src/tail.c (start_lines): Rewrite to use memchr. Clean up.
9508 2003-04-28 Jim Meyering <jim@meyering.net>
9510 * tests/misc/tty-eof: Send two tokens, not just one, so we don't
9511 make the now-more-picky tsort fail.
9513 2003-04-24 Jim Meyering <jim@meyering.net>
9515 * src/tsort.c (tsort): Remove unnecessary test of have_read_stdin.
9516 (main): Minor syntactic clean-up.
9518 * src/tsort.c (tsort): Fail if the input contains an odd number of
9519 tokens. Reported by junkio@cox.net.
9521 * tests/tsort/basic-1: Test for the above fix.
9523 2003-04-21 Jim Meyering <jim@meyering.net>
9525 * tests/misc/printf: Add tests for the printf fixes below.
9527 * Makefile.cfg (cvs_files): Add $(srcdir)/config/depcomp to the list.
9529 2003-04-20 Paul Eggert <eggert@twinsun.com>
9531 Fix printf POSIX compatibility bug reported by Ben Harris in
9532 <http://mail.gnu.org/archive/html/bug-coreutils/2003-04/msg00070.html>.
9533 * doc/coreutils.texi (printf invocation): It's \NNN in the format,
9534 \0NNN in the %b operand.
9535 * src/printf.c (usage): Likewise.
9536 (print_esc): New arg OCTAL0 to specify whether \0NNN or \NNN
9537 is desired. All uses changed. Behave like Bash printf if %b
9538 operand uses \NNN where the initial N is not 0.
9540 2003-04-17 Jim Meyering <jim@meyering.net>
9542 * src/stty.c: Remove uses of PROTOTYPE macro.
9544 2003-04-15 Jim Meyering <jim@meyering.net>
9546 * Makefile.maint: Remove (or replace-with-TAB(s) to retain alignment)
9547 each sequence of spaces before a TAB character.
9549 2003-04-13 Jim Meyering <jim@meyering.net>
9551 * src/remove.c (is_empty_dir): Don't closedir (NULL).
9553 2003-04-12 Jim Meyering <jim@meyering.net>
9555 Giving nl an invalid STYLE argument (in --header-numbering=STYLE (-h),
9556 --body-numbering=STYLE (-b), or --footer-numbering=STYLE (-f)) or
9557 FORMAT (--number-format=FORMAT (-n)) would not give a useful diagnostic.
9558 * src/nl.c (main): Fix those problems and remove literal quote marks
9559 (e.g., "`%s'") from format string; instead use "%s" in each format
9560 string and `quote (optarg)' as the corresponding argument.
9561 Also, diagnose all invalid command line options before failing.
9563 * src/nl.c (proc_text): Fix a bug that would make nl output extra
9564 newlines in some cases. Details here: http://bugs.debian.org/177256.
9565 This bug was introduced on 2001-11-10 for textutils-2.0.17.
9566 * tests/misc/nl: Add test for the above-fixed bug.
9568 * tests/misc/readlink: New file. Test the --canonicalize option.
9569 * tests/misc/Makefile.am (TESTS): Add readlink.
9571 2003-04-11 Jim Meyering <jim@meyering.net>
9574 * src/chown.c, src/cp.c, src/dircolors.hin, src/du.c, src/ln.c:
9575 * src/mkfifo.c, src/ptx.c, src/spline.c, src/stty.c, src/tail.c:
9576 * src/test.c, src/unexpand.c: Remove (or replace-with-TAB(s) to
9577 retain alignment) each sequence of spaces before a TAB character.
9579 * src/ls.c: Include <stdlib.h> unconditionally.
9581 * Makefile.maint (xalloc-check): Rename from header-check.
9583 * src/yes.c: Include error.h after system.h, not before.
9586 * src/copy.c, src/cp-hash.c, src/cp.c, src/csplit.c, src/cut.c:
9587 * src/date.c, src/df.c, src/du.c, src/expand.c, src/expr.c, src/id.c:
9588 * src/join.c, src/md5sum.c, src/nl.c, src/od.c, src/paste.c, src/pr.c:
9589 * src/ptx.c, src/sort.c, src/split.c, src/su.c, src/tail.c, src/tee.c:
9590 * src/tr.c: * src/unexpand.c, src/users.c:
9591 Remove anachronistic casts of xmalloc, xrealloc, and xcalloc
9592 return values and of xrealloc's first argument.
9593 Fix the former with this:
9594 perl -pi -e 's/\([^(]*?\*\) *(x(m|c|re)alloc)\b/$1/'
9596 2003-04-10 Jim Meyering <jim@meyering.net>
9598 * src/stty.c (wrapf): Declare with format attribute.
9600 The S_MAGIC_... names shouldn't be maintained in two places (prior
9601 to this change, one would have to keep stat.c and fs.h in sync).
9602 This change makes it so those names and the corresponding
9603 hexadecimal constants all reside in stat.c. fs.h is now generated.
9604 * src/Makefile.am (fs.h): New rule to generate fs.h from stat.c.
9605 (BUILT_SOURCES): Add fs.h, now that it's generated.
9606 (EXTRA_DIST): Add extract-magic.
9607 * src/extract-magic: New script to extract fs.h definitions from stat.c.
9608 * src/stat.c (human_fstype) [__linux__]: Append each hex constant from
9609 fs.h in a comment after the corresponding `case S_MAGIC_...:' statement.
9611 * tests/tail-2/big-4gb: Skip this test (don't fail) if creating a
9612 file with nominal length > 4GB fails. Reported by Michael Deutschmann.
9614 * man/unexpand.x: Add `SEE ALSO' reference to expand.
9615 * man/expand.x: Add `SEE ALSO' reference to unexpand.
9616 Suggestion from Dan Jacobson.
9618 2003-04-10 Maciej W. Rozycki <macro@ds2.pg.gda.pl>
9620 * src/fs.h (S_MAGIC_DEVPTS): New magic for Linux's devpts.
9621 * src/stat.c (human_fstype): Handle Linux's devpts.
9623 2003-04-09 Paul Eggert <eggert@twinsun.com>
9625 * src/split.c (line_bytes_split): Arg is of type size_t, since
9626 that's all that is supported for now.
9627 (main): Check for overflow in obsolescent line count option.
9629 2003-04-09 Jim Meyering <jim@meyering.net>
9631 * tests/misc/split-fail: Add a new test for the above fix.
9633 * src/split.c (bytes_split): Use size_t temporary (rather than
9634 uintmax_t original) in remaining computations. From Paul Eggert.
9636 Handle command line option arguments larger than 2^31.
9637 This allows e.g., splitting into files of size 2GB and larger,
9638 and running split --lines=N with N=2^31 or more.
9639 But for --line-bytes=N, the restriction that N <= SIZE_MAX
9640 remains (for now), due to the way it is implemented.
9642 * src/split.c: Include "inttostr.h".
9643 (bytes_split, lines_split, line_bytes_split, main):
9644 Use uintmax_t, not size_t, for file sizes.
9645 (main): Give a better diagnostic for option arguments == 0.
9646 Use umaxtostr to print file sizes.
9647 Reported by Luke Hassell.
9649 2003-04-08 Jim Meyering <jim@meyering.net>
9651 * src/rm.c (usage): Mention that --directory (-d) works only
9652 on some systems. Suggestion from Samuel Tardieu.
9654 * tests/basename/basic: Run $PERL to see if it is available,
9655 rather than testing its value.
9656 * tests/sum/sysv, tests/tsort/basic-1, tests/unexpand/basic-1:
9657 * tests/basename/basic, tests/dd/skip-seek, tests/dircolors/simple:
9658 * tests/expr/basic, tests/factor/basic, tests/fmt/basic:
9659 * tests/ls-2/tests, tests/md5sum/basic-1, tests/md5sum/newline-1:
9660 * tests/misc/sort, tests/misc/tty-eof, tests/mv/i-1:
9661 * tests/rm/empty-name, tests/rm/fail-eperm, tests/rm/unreadable:
9662 * tests/seq/basic, tests/sha1sum/basic-1, tests/sha1sum/sample-vec:
9663 * tests/sum/basic-1, tests/seq/basic: Likewise.
9665 * tests/misc/Makefile.am (TESTS): Add split-fail.
9666 * tests/misc/split-fail: New file.
9668 * src/split.c: Rename local variables: nchars -> n_bytes.
9669 (lines_split): Rename local, nlines -> n_lines.
9670 (main): Rename local variable: s/accum/n_units/.
9671 (main): Use STDIN_FILENO, not literal `0'.
9673 2003-04-07 Jim Meyering <jim@meyering.net>
9675 * src/stat.c: Add #include directives for Ultrix 4.4.
9676 Based on a suggested change from Bert Deknuydt.
9678 2003-04-06 Jim Meyering <jim@meyering.net>
9680 * Makefile.maint (makefile-check): New rule.
9681 (local-check): Add it.
9683 2003-04-05 Jim Meyering <jim@meyering.net>
9685 * Makefile.am (nearly all of them):
9686 Use $(VAR) rather than @VAR@, now that we can rely on automake to
9687 emit a definition for each substituted variable.
9688 * tests/Makefile.am.in: Likewise.
9690 * tests/rm/rm5: Add a comment explaining why this test fails when
9691 using Tru64's broken sed.
9692 * tests/rm/rm3: Likewise.
9694 Make `kill -t' output signal descriptions (not `?') on Tru64.
9695 * src/kill.c (sys_siglist): Also check for __sys_siglist.
9696 Patch by Tony Leneis.
9697 * configure.ac: Also check for declaration of __sys_siglist.
9698 Required for Tru64 4.0D, 4.0F, and 5.1.
9699 Reported by Tony Leneis.
9701 2003-04-04 Jim Meyering <jim@meyering.net>
9703 * src/Makefile.am (PERL): Remove unnecessary definition.
9705 Because of inappropriate (but POSIX-mandated) behavior of rename,
9706 `mv a b' would not remove `a' in some unusual cases. Work around
9707 this by unlinking `a' when necessary.
9709 * src/copy.c (same_file_ok): Add an output parameter.
9710 Set it in the offending case.
9711 (copy_internal): When necessary, unlink SRC_PATH and inform caller.
9712 Reported by Ed Avis.
9713 * tests/mv/hard-4: New test for the above.
9714 * tests/mv/Makefile.am (TESTS): Add hard-4.
9716 Clean up rules for automatically generated sources:
9717 * src/Makefile.am (dircolors.h, wheel-size.h, wheel.h, false.c):
9718 Make each generated file be read-only.
9719 Add each file name to BUILT_SOURCES separately.
9720 (MAINTAINERCLEANFILES): Set to $(BUILT_SOURCES).
9722 Put LOCALEDIR macro definition in new file: localedir.h.
9723 * src/Makefile.am (DEFS): Remove definition.
9724 (localedir.h): New rule.
9725 (BUILT_SOURCES, DISTCLEANFILES): Add localedir.h.
9726 * src/system.h: Include "localedir.h".
9728 2003-04-02 Jim Meyering <jim@meyering.net>
9732 * tests/misc/Makefile.am (TESTS): Add false.
9734 * Makefile.maint (TMPDIR): Make sure it's defined.
9735 (my-distcheck): Build in $(TMPDIR), not `.'.
9737 * src/Makefile.am (false.c): Change all occurrences of
9738 `(EXIT_SUCCESS)' to `(EXIT_FAILURE)' so that false exits
9739 unsuccessfully also with --help. Reported by Paul Jarc,
9740 * tests/misc/false: New test for the above.
9742 2003-03-30 Jim Meyering <jim@meyering.net>
9744 * NEWS: Note the location of older NEWS files.
9746 * src/remove.c (is_empty_dir): Don't let a failing closedir
9747 clobber errno. Spotted by Arnold Robbins.
9749 * src/env.c: Fix typo in comment. From Arnold Robbins.
9751 2003-03-29 Jim Meyering <jim@meyering.net>
9755 * README: Note to expect build problems for stat.c on Ultrix 4.3.
9756 Note that there are some harmless test failures when running
9757 `make check' as root on some systems.
9759 2003-03-28 Jim Meyering <jim@meyering.net>
9761 * tests/stty/row-col-1: Skip this test if stty can't get window size.
9762 This happens when connecting to sparc-solaris5.7 via ssh from within
9763 emacs. Reported by Karl Berry.
9765 * tests/du/basic: Use seq, not `yes' to generate 4KB of data.
9766 Otherwise, on systems (DJGPP) that emulate pipes using files,
9767 this test would never complete, waiting for `yes' to terminate.
9768 * tests/du/slink: As above, use seq, not `yes' to generate link target.
9769 * tests/rm/hash: As above, use seq, not `yes' to generate dir name.
9770 Reported by Rich Dawe.
9772 2003-03-27 Jim Meyering <jim@meyering.net>
9774 * src/id.c: Remove Arnold Robbins' obsolete e-mail address
9775 from `written by...' comment, at his request.
9777 2003-03-24 Paul Eggert <eggert@twinsun.com>
9779 Fix buffer overrun problem reported by TAKAI Kousuke, along
9780 with some other POSIX incompatibilities.
9782 * src/printf.c (print_esc): Do not treat \x specially if
9783 POSIXLY_CORRECT. Avoid buffer overrun if the format ends
9784 in backslash. Treat incomplete escape sequences as strings
9785 of characters, as POSIX requires.
9786 (print_formatted): Allow multiple flags. Avoid buffer overrun
9787 if the format is incomplete.
9789 2003-03-24 Jim Meyering <jim@meyering.net>
9791 * tests/misc/printf: Add tests for the above fixes and changes.
9793 2003-03-26 Jim Meyering <jim@meyering.net>
9795 * src/copy.h (struct cp_options): Add a comment.
9797 2003-03-23 Jim Meyering <jim@meyering.net>
9799 * README: Describe problem with 64-bit mode on HPUX 11.x,
9800 with patch for /usr/include/inttypes.h.
9801 * TODO: Plan to add an autoconf test to work around the bug.
9803 2003-03-22 Jim Meyering <jim@meyering.net>
9805 * src/stat.c: Don't include <sys/sysmacros.h>.
9806 That is already done via system.h. Otherwise, the multiple
9807 inclusion would evoke redefinition warnings from Cray's /bin/cc,
9808 aka Cray Standard C Version 4.0.3 (057126) Mar 22 2003 22:02:28.
9809 (human_fstype): Factor some directives `up', out of this function.
9810 Cast away `const' to avoid error from Cray's /bin/cc.
9812 2003-03-20 Jim Meyering <jim@meyering.net>
9814 * announce-gen (print_changelog_deltas): Ensure that a newline
9815 precedes each row of `*'s.
9817 2003-03-20 Jim Meyering <jim@meyering.net>
9821 * src/seq.c (valid_format): Also accept ` ' and `'' as valid
9822 format flag characters.
9823 Do not require that a field width be specified.
9824 Do not fail when given a field width of `0'.
9825 Reported by Dan Jacobson.
9826 * tests/seq/basic: Add new tests for the above-fixed bug.
9828 * src/Makefile.am (all-local): Append $(EXEEXT) to use of `su'
9829 (install-root): Likewise.
9830 (install-exec-local): Likewise.
9831 Based on a patch from Richard Dawe.
9833 2003-03-19 Jim Meyering <jim@meyering.net>
9835 * man/Makefile.am (.x.1): Use $(LN_S) instead of 'ln -s',
9836 because the DJGPP 2.03 port of 'ln -s' doesn't work.
9837 Include $(EXEEXT) in program names.
9838 Since $(LN_S) may degenerate to `cp -p', be careful
9839 to invoke it from the destination directory.
9840 Mostly from Richard Dawe.
9841 * configure.ac: Use AC_PROG_LN_S.
9843 * tests/mv/part-symlink: Unset CDPATH. Otherwise, having the
9844 CDPATH shell variable set could cause this test to fail.
9845 Reported by Karl Berry.
9847 2003-03-18 Jim Meyering <jim@meyering.net>
9849 * src/fmt.c [struct Word] (paren, period, punct, final): Change the
9850 type of each member from bool <MEMBER>:1 to unsigned int <MEMBER>:1.
9851 AIX 5.1's xlc could not compile the former.
9852 Patch by Petter Reinholdtsen. Also reported by Mike Jetzer.
9854 2003-03-17 Richard Dawe <rich@phekda.freeserve.co.uk>
9856 * configure.ac: Include $(EXEEXT) in OPTIONAL_BIN_PROGS'
9857 program names, since automake only adds $(EXEEXT) to programs
9860 2003-03-16 Jim Meyering <jim@meyering.net>
9862 * src/remove.c (rm): Put two local variables in static storage,
9863 so they can't be clobbered by the potential longjmp.
9865 2003-03-15 Jim Meyering <jim@meyering.net>
9867 * Makefile.cfg (gnu_rel_host): Fix code to match the comment
9868 so that a version number with a two-digit component can still count
9869 as an alpha release. Reported by Richard A Downing.
9870 (gnu_rel_host): Define in terms of $(RELEASE_TYPE) instead.
9872 2003-03-14 Jim Meyering <jim@meyering.net>
9874 * src/ansi2knr.c: Remove no-longer-used file.
9875 * src/ansi2knr.1: Likewise.
9877 * Makefile.maint (prev_version_file): Don't use ?= for this particular
9878 assignment, since it causes trouble with old versions of GNU make
9879 (e.g. 3.76.1). The other uses of `?=' are inoffensive. Details here.
9880 http://mail.gnu.org/archive/html/bug-coreutils/2003-03/msg00028.html
9881 Patch from Alexandre Duret-Lutz.
9883 * Use patched automake-1.7.3. Regenerate Makefile.in files in
9884 subdirectories so that each includes a definition of ACLOCAL_M4.
9886 * announce-gen (main): Label the compressed source URLs.
9890 * tests/du/slink: Relax the test for the `local'ness of a file system,
9891 so that now it works also for tmpfs.
9893 * tests/du/hard-link: Transform output from first du, so that this
9894 test doesn't fail on file systems like tmpfs that order directory
9895 entries differently.
9897 2003-03-13 Jim Meyering <jim@meyering.net>
9899 * tests/du/8gb: Work around what appears to be an NFS failure that
9900 would make this test fail on some systems.
9902 2003-03-11 Jim Meyering <jim@meyering.net>
9904 * tests/du/basic: Make the test file exactly 4k bytes long.
9906 * src/split.c (longopts): Don't hard-code `2' here.
9907 Instead, just specify `&verbose', and ...
9908 (main): ... remove the `case 2:' block for --verbose.
9910 * tests/du/basic: Make the test file larger than 64 bytes, so that
9911 we don't immediately disqualify file systems (e.g., NetApp) on which
9912 smaller files take up zero disk blocks. Reported by Vin Shelton.
9914 2003-03-10 Jim Meyering <jim@meyering.net>
9916 Don't segfault for a negative field width or precision in format string.
9917 Note that this is just a stopgap fix. The longer term solution may
9918 involve adapting bash's builtins/printf.def.
9920 * src/printf.c: (UNSPECIFIED): Define.
9921 (print_direc): Use the special value, UNSPECIFIED, to indicate
9922 that field_width or precision has not been specified.
9923 (print_formatted): Fail if field_width or precision is the
9924 special value, UNSPECIFIED.
9925 Reported by Oliver Kiddle <okiddle@yahoo.co.uk>
9927 * src/sys2.h (INT_MIN): Define, if necessary.
9928 * tests/misc/printf: Add a test for the above-fixed bug.
9930 2003-03-09 Jim Meyering <jim@meyering.net>
9932 * src/remove.c (AD_stack_pop): Cast sizeof... to int before
9933 changing its sign. This avoids a warning from gcc on 64-bit systems.
9934 Reported by Bob Proulx.
9935 (pop_dir): Reverse order of sign change and cast, to be consistent
9938 2003-03-08 Jim Meyering <jim@meyering.net>
9940 * tests/Makefile.am (evar-check): Check for POSIXLY_CORRECT not as a
9941 shell variable, but only in the environment. With /bin/sh->bash, the
9942 shell variable is set to `y', and that would cause a spurious warning.
9943 Reported by Bob Proulx.
9945 * tests/Makefile.am (check-root): Remove touch/fifo.
9946 It doesn't appear to have to be run as root.
9948 * tests/rm/fail-2eperm: Rather than simply using the first non-root
9949 user name, make sure that the selected user name has a usable shell.
9950 Reported by Paul Jarc.
9952 Before, when using shred on a device, one had to specify --exact,
9953 or be careful to choose a size that would not be rounded up and
9954 exceed the maximum value; that could result in a failure of
9956 * src/shred.c (do_wipefd): --exact is now the default for non-regular
9957 files. Suggestion from Ben Elliston.
9960 * tests/misc/tty-eof: Require at least version 1.11 of Expect.pm.
9961 Old versions of Expect.pm (e.g., 1.07) lack the log_user function.
9962 Patch by Bob Proulx.
9964 * src/Makefile.am (check-misc): Check for use of `defined' in
9966 Change to $(srcdir) before running grep.
9968 * src/sleep.c: Remove now-unused #include and #define directives.
9970 * src/du.c (process_file): If a file's size is not being counted
9971 e.g., because it's a hard link to a file we've already counted,
9972 then don't print a line for it.
9974 * tests/du/hard-link: New test for the above-fixed bug.
9975 * tests/du/Makefile.am (TESTS): Add hard-link.
9978 * src/du.c: Revert most of the `reorganization' change of 2003-02-20,
9979 and make the two-array approach work.
9981 * tests/du/basic: Correct/add tests for the above fix.
9982 Set LC_ALL, etc., now that we use sort.
9983 Check the block/size of a small file, too.
9984 Correct expected results for simple dir1/dir2/file case.
9985 Add another test of du -S.
9987 2003-03-07 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
9989 Avoid build failure with gcc on hppa1.1-hp-hpux10.20 (see GCC PR
9990 middle-end/9986). As one of GCC's optimizations, it transforms a
9991 fputs_unlocked call to a fputc_unlocked call when the string is
9992 one character long. However, hpux doesn't have fputc_unlocked.
9994 * expr.c (usage): Use putchar, not fputs, to output a single character.
9995 * ls.c (dired_dump_obstack): Likewise.
9996 * ptx.c (output_one_tex_line, output_one_dumb_line): Likewise.
9997 * stat.c (print_it): Likewise.
9999 2003-03-07 Jim Meyering <jim@meyering.net>
10001 * src/cp.c: Remove everything associated with mmap-stack.c.
10002 This reverts the two changes of 2003-02-21.
10003 * src/du.c: Remove everything associated with mmap-stack.c.
10004 This reverts the change of 2003-02-19.
10006 2003-03-06 Jim Meyering <jim@meyering.net>
10008 * tests/cp/same-file: Unset CDPATH. Otherwise, having the
10009 CDPATH shell variable set could cause this test to fail.
10010 Reported by Karl Berry.
10012 2003-03-05 Jim Meyering <jim@meyering.net>
10016 * src/printf.c (print_esc): Remove pointless comparison of unsigned
10017 integer with zero, to avoid a warning from Intel's ecc.
10018 Reported by Nelson Beebe.
10020 * src/du.c (process_file): Sizes must all be of type uintmax_t.
10021 Otherwise, for files or totals that are too big, numbers would
10022 be truncated. Patch mostly by Michael Stone.
10023 Reported by Ingo Saitz as Debian bug #183210.
10025 * tests/du/8gb: New test for the above-fixed bug.
10026 * tests/du/Makefile.am (TESTS): Add 8gb.
10028 * src/du.c (MAX_N_DESCRIPTORS): Use 3 * UTILS_OPEN_MAX / 4
10029 rather than UTILS_OPEN_MAX - 10.
10031 2003-03-04 Jim Meyering <jim@meyering.net>
10033 * README: Refer new feature discussion to bug-coreutils@gnu.org,
10034 rather than bug-gnu-utils, now that the former is better known.
10035 Suggestion from Göran Uddeborg.
10037 * src/stat.c (usage): Capitalize consistently.
10038 Reported by Göran Uddeborg.
10040 * Makefile.maint (rel-files): Include $(signatures), so that
10041 those files are also copied into $(release_archive_dir).
10043 * src/df.c (find_mount_point): Call error here, now that restore_cwd
10045 * src/remove.c (AD_pop_and_chdir): Likewise.
10047 * tests/Makefile.am (check-root): Add fail-2eperm.
10049 2003-03-03 Jim Meyering <jim@meyering.net>
10051 * src/remove.c (remove_cwd_entries): Include the full filename of
10052 the offending file, not just the basename.
10054 * tests/misc/tty-eof: Set $ME properly.
10056 * Makefile.maint (THIS_VERSION_REGEXP, PREV_VERSION_REGEXP):
10057 Remove now-unused variables.
10058 (tag-prev-version, prev-cvs-tag): Likewise.
10060 * src/remove.c (remove_cwd_entries) [!ROOT_CAN_UNLINK_DIRS]: Give an
10061 accurate diagnostic when failing to remove a file owned by some other
10062 user. Reported by Ivo Timmermans via Michael Stone.
10063 This fixes Debian bug# 178471.
10065 * tests/rm/Makefile.am (TESTS): Add fail-2eperm.
10066 * tests/rm/fail-2eperm: New test, for the above-fixed bug.
10067 Based on a report from Ivo Timmermans.
10069 2003-03-02 Jim Meyering <jim@meyering.net>
10071 * src/copy.c (copy_internal) [un_backup]: When recovering from a
10072 failure to create a hard link, do not remove the entry associating
10073 the source dev/ino with the destination file name.
10074 * tests/mv/Makefile.am (TESTS): Add hard-3.
10075 * tests/mv/hard-3: New test, for the above-fixed bug.
10076 Inspired by a report from Iida Yosiaki.
10078 2003-03-01 Jim Meyering <jim@meyering.net>
10080 * src/df.c (print_header): Don't embed spaces in a separate `Type'
10081 header string. Instead, put `Filesystem' and `Type' headers in the
10082 same string, so translators can use horizontal space as needed.
10083 Reported by Jean Charles Delepine.
10085 2003-02-28 Jim Meyering <jim@meyering.net>
10087 * src/copy.c (copy_internal): When link fails because of an
10088 existing destination file, unlink that file and try again.
10089 Reported by Iida Yosiaki.
10091 * tests/mv/Makefile.am (TESTS): Add hard-2.
10092 * tests/mv/hard-2: New test for the above-fixed bug.
10093 Based on a test case from Iida Yosiaki.
10095 2003-02-26 Jim Meyering <jim@meyering.net>
10097 * tests/du/basic: Don't test du's -b option here. Directory byte
10098 counts are smaller (512 rather than 4096) on at least OSF/1 5.1
10099 and IBM AIX 4.2. Reported by Nelson Beebe.
10101 2003-02-25 Jim Meyering <jim@meyering.net>
10103 * Makefile.maint (announcement): Now that ChangeLog entries
10104 are output by announce-gen, don't do it here.
10105 * announce-gen (print_changelog_deltas): New function.
10108 2003-02-22 Jim Meyering <jim@meyering.net>
10110 * announce-gen: New option: --release-type=TYPE
10111 * Makefile.maint (beta, major): New targets. Remove `release'.
10112 Put them all together on a line.
10113 Pass the release type (via RELEASE_TYPE envvar) to the MAKE
10114 invocation of `announcement'.
10115 (announcement): Invoke announce-gen with --release-type=$RELEASE_TYPE.
10117 * announce-gen: New option: --news=NEWS_FILE.
10118 Extract NEWS entries here, not via rules in Makefile.maint.
10119 * Makefile.maint (announcement): Now that NEWS entries are
10120 extracted by announce-gen, don't do it here.
10121 (news-r1, news-r2): Remove now-unused definitions.
10123 2003-02-21 Jim Meyering <jim@meyering.net>
10127 Merge in changes from autoconf's version of this file.
10128 * Makefile.maint (www-gnu): Define.
10129 (standards.texi-url_prefix): Use $(www-gnu).
10130 (make-stds.texi-url_prefix): Likewise.
10132 * src/cp.c: Include "mmap-stack.h".
10133 (main): Invoke `run' through a macro that (when possible) runs it
10134 with a large, mmap'd stack.
10136 * src/cp.c (run): New function, preparing for the above.
10137 Exit from this function, not from main
10140 * src/du.c: New option: --apparent-size.
10141 (enum) [APPARENT_SIZE_OPTION]: New member.
10142 (long_options): Add it.
10143 (usage): Describe it.
10145 ['b']: Set apparent_size.
10146 David Eisner reported that the behavior of --bytes had changed.
10147 Paul Eggert proposed the use of a new option, --apparent-size.
10149 * src/du.c (apparent_size): New global.
10150 (print_only_size): Reflect the fact that we're printing byte counts,
10151 not ST_NBLOCKSIZE-byte-block counts.
10152 (print_size): Call print_only_size rather than duplicating its code.
10153 (process_file): Accumulate byte counts, rather than block counts.
10155 * src/du.c (process_file): Always reset size_to_propagate_to_parent
10156 for --separate-dirs (-S).
10158 2003-02-20 Jim Meyering <jim@meyering.net>
10160 * Use automake-1.7.3. Regenerate dependent files.
10162 * src/stat.c (print_stat): New format: %B (to print ST_NBLOCKSIZE).
10163 This makes %b (number of ST_NBLOCKSIZE-byte blocks) more useful.
10164 (usage) [%B]: Describe it.
10167 * src/du.c (process_file): Reorganize the code to use only
10168 one `sum' array, and change how -S works back to the way it was
10169 before 2003-01-31. Patch by Bruno Haible.
10171 * tests/du/basic: New test.
10172 * tests/du/Makefile.am (TESTS): Add basic.
10174 * tests/envvar-check: Add checks for the following:
10175 BLOCK_SIZE, DU_BLOCK_SIZE, DF_BLOCK_SIZE, LS_BLOCK_SIZE.
10177 * tests/Makefile.am: Rename phony target envvar-check to evar-check
10178 so as not to conflict with the distributed file by the same name.
10180 * src/du.c (process_file): Set info->skip before any possible return.
10182 Report correct usage for directories, not 0.
10183 * src/du.c (process_file): Return for `file_type == FTW_DPRE'
10184 _before_ recording the dev/ino of a directory.
10185 Reported by Bruno Haible.
10187 Now, df always displays the device file name corresponding to the
10188 listed mount point under `Filesystem'. Before, for an unmounted
10189 block- or character-special file argument, it would display the
10190 command-line argument instead.
10191 * src/df.c (show_disk): Return a value indicating whether
10192 there was a match. Don't try to find a mount point here.
10193 (show_entry): If show_disk doesn't find a match, call show_point.
10195 2003-02-19 Jim Meyering <jim@meyering.net>
10197 * src/du.c: Include "mmap-stack.h".
10198 (du_files): Add prototype with ATTRIBUTE_NORETURN.
10199 Exit from this function, not from...
10201 Instead, if possible, invoke du_files through a macro that
10202 runs it with a large, mmap'd stack.
10204 * src/join.c (usage): Change wording in --help output:
10205 use FILENUM instead of `SIDE' and say what FILENUM means.
10206 Reported by Bernhard Gabler.
10208 * src/df.c (print_header): Rather than using a hard-coded literal
10209 string of spaces matching the length of the English `...Type' header,
10210 output the right number of spaces to match the selected translation.
10211 Reported by Yann Dirson and Jean Charles Delepine as Debian bug 131113.
10213 * src/split.c (bytes_split): Remove unnecessary `else' after break.
10214 (lines_split): Likewise. and correct misleading indentation.
10216 * src/split.c: Include "full-read.h".
10217 (bytes_split, lines_split, line_bytes_split): Use full_read,
10218 not safe_read. The way split was using the latter, a short read
10219 could cause split to terminate before EOF.
10221 * tests/misc/tty-eof: Test all programs that can read stdin,
10222 requiring no arguments and that write to standard output.
10224 * tests/misc/tty-eof: New file. Renamed from ...
10225 * tests/misc/cat-tty-eof: Remove file. Rename to tty-eof.
10226 * tests/misc/Makefile.am (TESTS): Reflect renaming.
10228 2003-02-18 Jim Meyering <jim@meyering.net>
10230 cksum would perform an extra read after encountering EOF
10231 * src/cksum.c (cksum): Exit the loop upon EOF, too.
10232 Patch by Michael Bacarella.
10234 Test for the bug fixed today in cksum, md5sum, and sha1sum.
10235 * tests/misc/cat-tty-eof: Generalize, clean-up, and test for
10236 cat, cksum, md5sum, and sha1sum all in the same loop.
10238 2003-02-14 Jim Meyering <jim@meyering.net>
10240 * src/remove.c: Include "euidaccess.h".
10241 Remove declaration of euidaccess.
10243 2003-02-12 Jim Meyering <jim@meyering.net>
10245 * src/pathchk.c (portable_chars_only): Remove unnecessary `const'
10246 in cast to avoid warning from icc. Reported by Alexandre Duret-Lutz.
10248 2003-02-10 Jim Meyering <jim@meyering.net>
10250 * src/test.c: Don't include group-member.h.
10251 Include euidaccess.h.
10252 (eaccess): Rewrite function to set the real uid and gid temporarily
10253 to the effective uid and gid, then invoke 'access', and then set the
10254 real uid and gid back. On systems that lack setreuid or setregid,
10255 fall back on the kludges in euidaccess. Before, it would not work
10256 for e.g., files with ACLs, files that were marked immutable,
10257 or on file systems mounted read-only. Nelson Beebe raised the issue.
10258 Paul Eggert suggested the new implementation.
10260 2003-02-09 Jim Meyering <jim@meyering.net>
10262 * src/test.c (test_stat): Remove function. It's job is done (only
10263 when necessary) by the wrapper in lib/stat.c. Adjust all uses.
10265 2003-02-08 Jim Meyering <jim@meyering.net>
10269 * tests/mv/part-symlink: Don't assume that the file owner username
10270 length is less than 9 in ls output: instead, omit that field
10271 altogether. Reported by, and suggested fix from, Ferdinand.
10273 * tests/du/restore-wd: New test for just-fixed bug in ftw.c.
10274 * tests/du/Makefile.am (TESTS): Add restore-wd.
10276 * src/rm.c: Correct now-invalid comment about cycle-detection.
10278 2003-02-06 Jim Meyering <jim@meyering.net>
10280 * NEWS: Add entries from old/*/NEWS
10281 from fileutils-4.1 through 4.1.11 and
10282 from sh-utils-2.0 through 2.0.15. Suggestion from Karl Berry.
10286 * src/du.c (process_file): Don't return early for excluded files
10287 or for files whose dev/inode we've already seen.
10289 2003-02-05 Jim Meyering <jim@meyering.net>
10291 * tests/du/exclude: New file.
10292 * tests/du/Makefile.am (TESTS): Add exclude.
10294 2003-02-04 Dmitry V. Levin <ldv@altlinux.org>
10296 * src/who.c (print_boottime, print_deadprocs, print_runlevel):
10297 Fix memory allocation arithmetic.
10299 2003-02-04 Jim Meyering <jim@meyering.net>
10301 `df /dev/block-or-char-device-file--not-mounted' now reports
10302 the name of the file system on which the file resides, usually `/'.
10303 Before, it would leave the `Mounted on' field blank.
10304 * src/df.c (show_disk): Move function to precede find_mount_point.
10305 (show_disk): Add parameter: STATP.
10306 If we don't find a matching device name, then resort to calling
10307 find_mount_point. Reported by Bob Proulx.
10309 2003-02-03 Andreas Schwab <schwab@suse.de>
10311 * tests/rm/cycle: Require non-root.
10312 * tests/rm/isatty: Likewise.
10314 2003-02-02 Jim Meyering <jim@meyering.net>
10318 * man/Makefile.am (check-x-vs-1): Use @PATH_SEPARATOR@, not `:'.
10320 Ensure that there are no offending uses of `:'.
10321 * Makefile.maint (makefile_path_separator_check): New rule.
10322 (local-check): Add it to the list.
10324 2003-02-01 Jim Meyering <jim@meyering.net>
10326 * src/du.c (MAX_N_DESCRIPTORS): Define.
10328 * src/stat.c (G_fail): New global.
10329 (human_time): Diagnose failed localtime, not failed nstrftime.
10330 (main): Fail if G_fail is set.
10332 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
10334 * tests/basename/Makefile.am: Use @PATH_SEPARATOR@ instead of
10335 hard-coding the path-separator. Also double-quote the new PATH,
10336 to avoid problems when the path-separator is a semi-colon or when
10337 `pwd` contains e.g. a space.
10338 * tests/chgrp/Makefile.am: Likewise.
10339 * tests/chmod/Makefile.am: Likewise.
10340 * tests/chown/Makefile.am: Likewise.
10341 * tests/cp/Makefile.am: Likewise.
10342 * tests/dd/Makefile.am: Likewise.
10343 * tests/dircolors/Makefile.am: Likewise.
10344 * tests/du/Makefile.am: Likewise.
10345 * tests/expr/Makefile.am: Likewise.
10346 * tests/factor/Makefile.am: Likewise.
10347 * tests/fmt/Makefile.am: Likewise.
10348 * tests/install/Makefile.am: Likewise.
10349 * tests/ln/Makefile.am: Likewise.
10350 * tests/ls/Makefile.am: Likewise.
10351 * tests/ls-2/Makefile.am: Likewise.
10352 * tests/md5sum/Makefile.am: Likewise.
10353 * tests/misc/Makefile.am: Likewise.
10354 * tests/mkdir/Makefile.am: Likewise.
10355 * tests/mv/Makefile.am: Likewise.
10356 * tests/od/Makefile.am: Likewise.
10357 * tests/rm/Makefile.am: Likewise.
10358 * tests/rmdir/Makefile.am: Likewise.
10359 * tests/seq/Makefile.am: Likewise.
10360 * tests/sha1sum/Makefile.am: Likewise.
10361 * tests/shred/Makefile.am: Likewise.
10362 * tests/stty/Makefile.am: Likewise.
10363 * tests/sum/Makefile.am: Likewise.
10364 * tests/tail-2/Makefile.am: Likewise.
10365 * tests/touch/Makefile.am: Likewise.
10366 * tests/tsort/Makefile.am: Likewise.
10367 * tests/unexpand/Makefile.am: Likewise.
10369 2003-01-31 Jim Meyering <jim@meyering.net>
10371 * src/stat.c: Include "file-type.h"
10372 (print_human_type): Remove function.
10373 (human_access): Rename from print_human_access. Return a string.
10374 (human_time): Rename from print_human_time. Return a string.
10375 (print_stat): Arrange so that field width and an alignment specifier
10376 are honored for the %A, %F, %x, %y, and %z formats.
10377 [%F]: Use file_type; this gives slightly different file type strings,
10378 e.g., `directory' instead of `Directory' and `regular file' or
10379 `regular empty file' instead of `Regular file'.
10380 Prompted by a report from Richard Dawe that the uses of
10381 S_IFSOCK and S_IFIFO in print_human_time were not portable
10382 to systems using e.g., DJGPP.
10384 2003-01-31 Richard Dawe <rich@phekda.freeserve.co.uk>
10386 * src/stat.c (print_stat): Use S_ISLNK rather than an explicit
10387 test using S_IFMT and S_IFLNK. S_IFLNK may not be defined.
10389 2003-01-31 Jim Meyering <jim@meyering.net>
10391 * src/du.c (main): Upon processing an invalid option or an invalid
10392 --exclude-from or --max-depth option argument, don't exit right away,
10393 in case there are others. Rather record the failure and exit after
10394 processing other options.
10396 * GNUmakefile (TAR_OPTIONS): Set and export, in order to make
10397 tar archive easier to reproduce.
10399 Rewrite to perform directory traversal using nftw.
10401 * src/du.c: Include "dirname.h", "ftw.h", and "quotearg.h".
10402 (AUTHORS): Add self.
10403 (opt_one_file_system): Move global into `main'.
10404 (path, xstat, exit_status): Remove declarations.
10405 (arg_length, suffix_length): New globals.
10406 (G_fail): New global, sort of like the old `exit_status'.
10407 (IS_FTW_DIR_TYPE): Define.
10408 (print_only_size): New function.
10409 (process_file): New function.
10410 (str_init, ensure_space, str_copyc, str_concatc): Remove functions.
10411 (str_trunc, pop_dir, count_entry): Likewise.
10412 (du_files): Rewrite to use nftw.
10414 2003-01-30 Jim Meyering <jim@meyering.net>
10416 * tests/du/trailing-slash: Ensure that du/ftw follows a command-line
10417 symlink-to-directory with -L, even without the trailing slash.
10419 2003-01-27 Jim Meyering <jim@meyering.net>
10421 * src/Makefile.am (check-misc): Check for st_blocks, too.
10423 * src/stat.c (print_stat): Use ST_NBLOCKS rather than `->st_blocks'.
10424 Reported by Richard Dawe.
10426 2003-01-27 Andreas Schwab <schwab@suse.de>
10428 * src/ls.c (quote_name): Add fourth parameter, width, into which to
10429 store the screen columns, and return the number of bytes instead.
10430 (print_dir): Pass NULL as fourth parameter of quote_name.
10431 (print_name_with_quoting): Likewise.
10432 (length_of_file_name_and_frills): Get the width from the fourth
10433 parameter of quote_name instead of return value.
10435 2003-01-27 Jim Meyering <jim@meyering.net>
10437 * src/ls.c (decode_switches): If `dired' is set without
10438 `format == long_format', then silently reset dired. This doesn't
10439 change the behavior of ls (all prior uses of dired were protected
10440 by `&& format == long_format'), and lets us...
10441 (DIRED_INDENT): ... remove the `format == long_format' conjunct.
10442 (PUSH_CURRENT_DIRED_POS): Likewise.
10445 2003-01-22 Jim Meyering <jim@meyering.net>
10447 * tests/du/no-x: New test, for functionality added to lib/ftw.c.
10448 * tests/du/Makefile.am (TESTS): Add no-x.
10450 2003-01-21 Jim Meyering <jim@meyering.net>
10452 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS
10453 && HAVE_STRUCT_DIRENT_D_TYPE]: If a file has d_type == DT_UNKNOWN
10454 it may still be a directory -- or not (e.g., with FreeBSD on an
10455 NFS-mounted file system), so resort to calling lstat to find out.
10456 Based on a patch by Michael van Elst.
10458 * tests/cp/same-file: Don't assume that the file owner username
10459 length is less than 9 in ls output: instead, omit that field
10460 altogether. Reported by, and suggested fix from, Ferdinand.
10462 2003-01-20 Jim Meyering <jim@meyering.net>
10464 * tests/date/Test.pm (wide-fmt): New test to demonstrate that
10465 large format widths no longer cause strftime to infloop.
10467 * Makefile.maint (mail_gpg_sign_cookie): Remove now-unused definition.
10469 2003-01-19 Jim Meyering <jim@meyering.net>
10471 * src/readlink.c: Include "canonicalize.h".
10473 2003-01-18 Jim Meyering <jim@meyering.net>
10475 * src/ls.c (Dereference_symlink) [DEREF_COMMAND_LINE_SYMLINK_TO_DIR]:
10477 (enum) [DEREFERENCE_COMMAND_LINE_SYMLINK_TO_DIR_OPTION]: New member.
10478 (long_options): Add option --dereference-command-line-symlink-to-dir.
10479 (main): Make DEREF_COMMAND_LINE_SYMLINK_TO_DIR be the default,
10480 rather than DEREF_COMMAND_LINE_ARGUMENTS, when none of the
10481 -d, -F, -l options is specified.
10482 (decode_switches): Handle --dereference-command-line-symlink-to-dir.
10483 (gobble_file): Honor DEREF_COMMAND_LINE_SYMLINK_TO_DIR.
10484 Change --dereference-command-line (-H) to dereference *all*
10485 command line arguments, including broken symlinks.
10487 2003-01-15 Paul Eggert <eggert@twinsun.com>
10489 Change ls -H back to the way it was yesterday, since this is
10490 compatible with FreeBSD and the POSIX spec is confusing
10491 and somewhat contradictory.
10493 * src/ls.c (DEREF_COMMAND_LINE_ARGUMENTS): Change name back
10494 from DEREF_COMMAND_LINE_SYMLINK_TO_DIR, updating all uses.
10495 (long_options): Change the long option name back.
10496 (usage): Change the usage back.
10497 (gobble_file): When -H is specified, dereference a top-level
10498 arg even if it points to a non-directory.
10500 2003-01-15 Jim Meyering <jim@meyering.net>
10502 * src/ls.c (gobble_file): Fall back on using lstat when required:
10503 when --dereference (-L) is not specified, and
10504 - when operating on a dangling symlink
10505 - when operating on command-line-symlink-to-directories
10506 This fixes numerous problems. Here are examples:
10507 - `ls dangling-symlink' would fail with `no such file...'
10508 Now it prints `dangling-symlink'.
10509 - `ls -i symlink' would mistakenly print the inode of the referent.
10510 Now it prints the inode of the symlink. Likewise for --size (-s).
10511 Based on a patch from Michael Stone.
10512 Reported by Deepak Goel as Debian bug #173793.
10514 Rename ls's --dereference-command-line (-H)
10515 option to --dereference-command-line-symlink-to-dir.
10516 * src/ls.c [enum Dereference_symlink]
10517 (DEREF_COMMAND_LINE_SYMLINK_TO_DIR): Rename from
10518 DEREF_COMMAND_LINE_ARGUMENTS. Update all uses.
10519 (long_options): Rename the long option.
10520 (usage): Say that --dereference-... changes how ls treats
10521 only symlinks to directories specified on the command line.
10523 2003-01-14 Jim Meyering <jim@meyering.net>
10525 * tests/ls/dangle: New file/test, for the above fix.
10526 * tests/ls/inode: Another new file/test, for the above fix.
10527 * tests/ls/Makefile.am (TESTS): Add dangle and inode.
10529 * src/ls.c (gobble_file): Fix a bug introduced in 4.5.4 that made it
10530 so that ls --color would no longer highlight the names of files with
10531 the execute bit set when not specified on the command line.
10532 Patch by Michael Stone. Reported by Stephen Depooter as
10535 * tests/ls-2/tests (color-exe): New test, for the above fix.
10537 2003-01-13 Jim Meyering <jim@meyering.net>
10539 * tests/shred/exact: Also test for just fixed bug with --zero.
10541 * src/shred.c (long_opts): --zero does not require an argument.
10542 Patch by Michael Stone. Reported by Roland Turner as Debian bug 172019.
10544 2003-01-12 Jim Meyering <jim@meyering.net>
10546 * Makefile.maint (cvs-update): Skip any file with local modifications.
10548 * src/unexpand.c (usage): Document --first-only and mention that
10549 --tabs=N (-t) enables --all (-a). Reported by wiregauze@yahoo.com.
10551 2002-12-01 Dmitry V. Levin <ldv@altlinux.org>
10553 * src/df.c: Include "canonicalize.h".
10554 Use canonicalize_file_name unconditionally.
10556 2003-01-09 Jim Meyering <jim@meyering.net>
10558 * README: Add readlink.
10560 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
10562 * src/df.c: Include "xgetcwd.h".
10563 * src/pwd.c: Likewise.
10565 2002-11-30 Dmitry V. Levin <ldv@altlinux.org>
10567 * src/shred.c: Remove declaration of xstrdup.
10568 We already get it via xalloc.h which is included via system.h.
10570 2002-08-27 Dmitry V. Levin <ldv@altlinux.org>
10572 New program: readlink.
10574 * src/Makefile.am (bin_PROGRAMS): Add readlink.
10575 * src/readlink.c: New file.
10577 * man/readlink.x: New file.
10578 * man/Makefile.am (dist_man_MANS): Add readlink.1.
10579 (readlink.1): New rule.
10581 2003-01-09 Jim Meyering <jim@meyering.net>
10583 When selecting ranges of byte offsets (as opposed to ranges of fields)
10584 and when --output-delimiter=STRING is specified, output STRING between
10585 ranges of selected bytes.
10586 * src/cut.c (RANGE_START_SENTINEL): Define.
10587 (output_delimiter_specified): New global.
10588 (print_kth): Add parameter. Adjust all callers.
10589 (set_fields): Mark each range-start index with RANGE_START_SENTINEL.
10590 (cut_bytes): When requested, output STRING between ranges of
10592 (main): Make a diagnostic a little clearer.
10593 Based on a patch from Jan Nieuwenhuizen.
10595 * tests/cut/Test.pm: New tests for the above.
10597 * src/cut.c (set_fields): Make code agree with comment:
10598 Don't merge abutting ranges like 4- and 2-3. This makes no
10599 difference currently, but is required to support an upcoming change.
10601 2003-01-07 Jim Meyering <jim@meyering.net>
10603 * src/cut.c (set_fields): Fix typo in comment.
10605 * tests/touch/not-owner: New test, mostly extracted from fail-diag.
10606 * tests/touch/Makefile.am (TESTS): Add not-owner.
10607 * tests/touch/fail-diag: Remove the test for non-owner diagnostic.
10608 Now, this tests only the nonexistent-directory diagnostic.
10609 Suggestion from Michael Stone.
10611 * tests/touch/fail-diag: Fix typo: s/ld/ls/.
10613 2003-01-04 Jim Meyering <jim@meyering.net>
10615 * src/copy.h: Remove use of PARAMS.
10616 * src/remove.h: Likewise.
10617 * src/chown-core.h: Likewise.
10619 rm could be tricked into mistakenly reporting a cycle.
10620 * src/remove.c: [cycle_check_state]: New global.
10621 (remove_cwd_entries): Adapt to new semantics of cycle_check.
10622 (rm): Call cycle_check_init and cycle_check_free for each file.
10623 * tests/rm/cycle (rm): New test, for the above fix.
10624 * tests/rm/Makefile.am (TESTS): Add cycle.
10626 When rm detects a cycle, don't abort the entire command,
10627 but rather just the affected command line argument.
10628 * src/remove.c: Include <setjmp.h>
10629 (struct dirstack_state) [current_arg_jumpbuf]: New member.
10630 (remove_cwd_entries): Call longjmp if we detect a cycle.
10631 (rm): Call setjmp here.
10633 * src/remove.c (cycle_check, is_power_of_two): Remove functions.
10634 Instead, include cycle-check.h and use it.
10636 * src/remove.h (struct dev_ino): Remove declaration.
10638 * src/remove.c (remove_cwd_entries): Fix typos in comment.
10640 Don't include trailing /. in diagnostics about directories.
10641 * src/remove.c (full_filename_): When FILENAME is just `.'
10642 and there is a nonempty directory-name part, don't append `/.'.
10643 * tests/rm/unread2: Remove trailing /. from diagnostic.
10644 * tests/rm/rm2: Likewise.
10646 * src/remove.c (struct dirstack_state): Define.
10647 To be used in place of these file-scoped globals ...
10648 (dir_stack, len_stack, Active_dir): Remove globals.
10649 (ds_init, ds_free): New functions.
10650 (full_filename): Define.
10651 (full_filename_): Rename from full_filename.
10653 Begin to make AD_* functions more generic.
10654 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
10655 (AD_push): Likewise.
10656 (AD_INIT_OTHER_MEMBERS): Define.
10657 (remove_dir): Define the `status' member manually after each
10658 call to AD_push or AD_push_initial.
10660 * src/Makefile.am (check-misc): New rule, to ensure that no more
10661 S_IS* macro definitions sneak into the code.
10662 (check): Depend on check-misc.
10664 * src/remove.c [S_ISLNK]: Don't define. It's already defined in sys2.h.
10665 * src/du.c (count_entry) [S_ISLNK]: Don't define.
10666 * src/shred.c [S_ISLNK, S_ISFIFO, S_ISSOCK]: Don't define.
10668 2003-01-03 Jim Meyering <jim@meyering.net>
10670 * src/true.c: Add copyright.
10671 (AUTHORS): I suppose I've written it.
10673 * src/Makefile.am (false.c): Make the generated file be read-only.
10675 2003-01-04 Jim Meyering <jim@meyering.net>
10677 * src/ls.c: Include "dev-ino.h".
10678 [struct dev_ino]: Remove declaration.
10680 2003-01-02 Jim Meyering <jim@meyering.net>
10682 * src/cp.c (do_copy): Tweak diagnostic to be consistent with the one
10683 from mv: s/missing file arguments/missing file argument/.
10684 With --target-directory=DIR, cp and mv work with a single file argument.
10685 Reported by Karl Berry.
10687 * tests/rm/isatty: Enable this test.
10689 2002-12-31 Jim Meyering <jim@meyering.net>
10691 * src/remove.c (AD_push_initial): Don't set status to RM_OK here.
10692 (AD_push): Likewise.
10693 (AD_INIT_OTHER_MEMBERS): Define.
10694 (remove_dir): Define the `status' member manually after each
10695 call to AD_push or AD_push_initial.
10697 * src/ls.c [struct dev_ino]: Remove definition.
10698 Include "dev-ino.h" instead.
10700 2002-12-28 Jim Meyering <jim@meyering.net>
10702 * tests/du/Makefile.am (TESTS): Add no-deref.
10703 * tests/du/no-deref: New script.
10705 2002-12-23 Jim Meyering <jim@meyering.net>
10707 * src/remove.c (remove_cwd_entries): Fix typo in comment.
10709 2002-12-21 Jim Meyering <jim@meyering.net>
10711 * announce-gen: Generate MML-formatted announcement.
10712 This makes it a *lot* harder to send stale MD5/SHA1 signatures.
10714 2002-12-20 Jim Meyering <jim@meyering.net>
10716 * src/touch.c (touch): Change the wording of a diagnostic so
10717 that it makes sense both when the file exists and when it doesn't.
10718 Suggestion from Michael Stone.
10720 2002-12-18 Jim Meyering <jim@meyering.net>
10722 * src/stty.c (valid_options): Declare to be static.
10724 2002-12-15 Jim Meyering <jim@meyering.net>
10726 * Makefile.cfg: Remove rules related to generating m4/jm-glibc-io.m4.
10728 * src/chmod.c, src/copy.c, src/copy.h, src/cp-hash.h, src/csplit.c:
10729 * src/date.c, src/expr.c, src/fmt.c, src/id.c, src/install.c:
10730 * src/ls.c, src/od.c, src/pathchk.c, src/pr.c, src/remove.c:
10731 * src/shred.c, src/sort.c, src/stat.c, src/stty.c, src/sum.c:
10732 * src/tee.c, src/test.c: Remove all uses of `PARAMS'.
10734 * src/remove.c (PARAMS): Remove definition.
10735 * src/sys2.h: Likewise.
10737 * src/ls.c, src/stat.c, src/date.c: Remove declaration of nstrftime.
10738 Include strftime.h instead.
10740 2002-12-14 Jim Meyering <jim@meyering.net>
10742 * Makefile.cfg ($(url_dir_list)): Use .../coreutils, not .../fetish.
10744 * src/system.h [! HAVE_DECL_MEMRCHR]: Declare memrchr.
10745 This is necessary at least for Irix6.5 when using c89.
10746 Reported by Nelson Beebe.
10748 * tests/misc/Makefile.am (TESTS): Add cat-tty-eof.
10750 * tests/misc/cat-tty-eof: New test.
10752 * src/mknod.c (usage): Specify how major and minor mode numbers
10753 are interpreted. Report forwarded by Kristin E Thomas.
10754 * src/mknod.c: Remove now-redundant usage-specifying comment.
10756 2002-12-13 Jim Meyering <jim@meyering.net>
10760 * tests/du/trailing-slash: Allow for a directory of size `0'.
10761 That happens at least on file systems of type tmpfs on linux-2.4.18.
10763 * announce-gen: New script to begin replacing the commands
10764 associated with the rule here...
10765 * Makefile.maint (announcement): Invoke announce-gen.
10766 * Makefile.am (EXTRA_DIST): Add announce-gen.
10768 * tests/cp/preserve-2: New file/test, for latest fix.
10769 * tests/cp/Makefile.am (TESTS): Add preserve-2.
10771 2002-12-11 TAKAI Kousuke <takai@vlsi.kuee.kyoto-u.ac.jp>
10773 Fix a bug whereby cp would fail to parse an option like
10774 --preserve=mode,ownership.
10775 * src/cp.c (decode_preserve_arg): Advance `comma' to
10776 point the character following the comma.
10778 2002-12-11 Jim Meyering <jim@meyering.net>
10780 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Undefine before defining,
10781 in case it's already defined.
10783 2002-12-09 Jim Meyering <jim@meyering.net>
10785 * tests/touch/fail-diag: Don't get a test failure if /no exists.
10786 Instead, evoke a framework failure if /no-$$ exists.
10787 Reported by Michael Stone.
10789 2002-12-08 Jim Meyering <jim@meyering.net>
10791 * src/du.c (lstat) [! LSTAT_FOLLOWS_SLASHED_SYMLINK]:
10792 Define to rpl_lstat, so that even on systems like Solaris 5.8,
10793 du honors (per POSIX) the trailing slash on an argument referring
10794 to a symlink-to-directory.
10796 2002-12-06 Jim Meyering <jim@meyering.net>
10798 * Use autoconf-2.57. Regenerate dependent files.
10799 * Use automake-1.7.2. Regenerate dependent files.
10801 * src/ls.c (gobble_file): Also stat the file if it's a
10802 regular file and --indicator-style=classify (aka -F).
10803 Thanks to Ed Santiago for opening my eyes.
10805 * tests/ls/file-type: New file. Test for the above.
10806 A test to contrast ls -F and ls --indicator-style=file-type.
10807 * tests/ls/Makefile.am (TESTS): Add file-type.
10809 2002-12-04 Jim Meyering <jim@meyering.net>
10811 * tests/ls/follow-slink: Make sure the symlink was created.
10812 Richard Dawe reported that `ln -s link link' succeeds, but creates
10813 no file on systems running some version of the DJGPP libc.
10815 2002-12-03 Jim Meyering <jim@meyering.net>
10817 * src/Makefile.am (AUTOMAKE_OPTIONS): Remove definition (to ansi2knr)
10818 since this package no longer panders to K&R compilers.
10820 2002-12-02 Jim Meyering <jim@meyering.net>
10822 * tests/du/slink: Skip this test if `.' is on a non-local file system.
10824 * tests/Fetish.pm (_at_replace): Do the substitution only if there's
10825 something to replace.
10827 2002-12-01 Jim Meyering <jim@meyering.net>
10829 * src/stat.c: Don't include <string.h> or <ctype.h>.
10830 That's already done via system.h.
10831 * src/dircolors.c: Don't include <ctype.h>.
10833 2002-11-30 Jim Meyering <jim@meyering.net>
10835 * ls.c (gobble_file): Remove the block of code that caused
10836 `ls --color -F symlink-to-dir' to list the files in
10837 `symlink-to-dir/.'. Now, it prints `symlink-to-dir@', (just
10838 like `ls -F symlink-to-dir') but with the addition of highlighting.
10839 Similarly, `ls --color -dF symlink-to-dir' would print
10840 `symlink-to-dir/'; now it prints `symlink-to-dir@'.
10841 Reported by Jeff Sheinberg as Debian bug #168203.
10842 * tests/ls-2/tests (sl-F-color, sl-dF-color): New tests for the above.
10844 ls is now more efficient: with certain options, it no longer needs
10845 to stat each directory entry on systems with valid dirent.d_type.
10846 * src/ls.c (print_dir): Add DT_LNK and DT_REG.
10847 (main): Make --recursive set format_needs_type, not format_needs_stat.
10848 (gobble_file): Remove a FIXME comment, now that it's fixed.
10850 2002-11-24 Jim Meyering <jim@meyering.net>
10852 * src/du.c (du_files): Don't strip any trailing slash.
10853 Rewrite so that `/' is no longer represented internally as
10855 (count_entry): When appending a file name component,
10856 account for the fact that the current path may end in `/'.
10857 François Pinard reported that `du symlink-to-dir/' was not
10858 equivalent to `du symlink-to-dir/.'. Now it is.
10859 * tests/du/trailing-slash: New file/test, for the above fix.
10860 * tests/du/Makefile.am (TESTS): Add trailing-slash.
10862 2002-11-23 Jim Meyering <jim@meyering.net>
10864 * src/tac.c (output): Declare some local variables to be of type size_t,
10865 rather than `int' to avoid warnings from gcc.
10867 2002-11-21 Paul Eggert <eggert@twinsun.com>
10869 * src/ls.c (decode_switches): Use case-sensitive matching to
10870 decode the QUOTING_STYLE environment variable. This is more
10871 consistent with the documentation, and with --quoting-style.
10873 2002-11-21 Martin Buck <martin.buck@ascom.ch
10875 * src/stty.c (struct speeds): Add support for all baud rates defined
10878 2002-11-19 Jim Meyering <jim@meyering.net>
10880 * tests/sum/sysv: Export LC_ALL=C, to avoid failure when
10881 run in a UTF locale. Report and suggested fix by Bruno Haible.
10882 * tests/fmt/basic: Likewise.
10884 2002-11-17 Jim Meyering <jim@meyering.net>
10886 * configure.ac: Update via autoupdate.
10887 Add `AM_GNU_GETTEXT_VERSION(0.11.5)'.
10889 * src/mv.c (movefile): Don't remove trailing slashes from SOURCE.
10890 Reported by Hans Ginzel.
10892 2002-11-15 Jim Meyering <jim@meyering.net>
10894 * Makefile.cfg (gnu_rel_host): Define.
10895 (url_dir_list): Choose from (alpha|ftp).gnu.org depending
10896 on whether $(VERSION) looks like a major release number.
10898 * Makefile.maint (mail_gpg_sign_cookie): Backslash-escape `#'.
10899 (release): Rename from `alpha'.
10900 (alpha): Depend on release.
10902 * Makefile.maint (signatures): Define with ?=, so it's easy to override.
10904 2002-11-14 Jim Meyering <jim@meyering.net>
10906 * Makefile.maint (mail_gpg_sign_cookie): Make optional.
10907 (announcement): Use the new variable.
10909 * Makefile.maint: Sync with Bison, i.e.:
10910 (po-check): Scan .l and .y files instead of the
10911 .c and the .h files that they generate. This fixes the bug
10912 reported by Tim Van Holder in:
10913 <http://mail.gnu.org/pipermail/bison-patches/2002-November/001352.html>
10914 Look for N_ as well as for _. Try to avoid matching #define for
10918 2002-11-12 Jim Meyering <jim@meyering.net>
10920 * src/ls.c (HAVE_SYMLINKS): Remove unnecessary macro definition.
10921 Replace sole use with equivalent `#ifdef S_ISLNK'.
10922 Inconsistency reported by Dmitry V. Levin.
10924 2002-11-11 Jim Meyering <jim@meyering.net>
10926 * src/stat.c (usage): Transform --help items output via s/ - / /,
10927 so that help2man produces properly formatted man pages.
10928 Reported by Herbert Xu as Debian bug #168400.
10930 2002-11-10 Jim Meyering <jim@meyering.net>
10932 * src/ls.c (sighandler): Handle SIGTSTP specially.
10933 Based on suggestions from Solar Designer and Dmitry V. Levin.
10936 * Makefile.cfg (cvs_files): Define. From autoconf.
10937 (local_updates): Likewise.
10939 * src/ls.c (restore_default_color_handler, sigtstp_handler):
10941 (sighandler): New function, based on the one in sort.c.
10942 (main): Use sigaction, if possible; otherwise signal.
10943 Handle these signals:
10944 SIGHUP, SIGINT, SIGPIPE, SIGQUIT, SIGTERM, SIGTSTP.
10945 Don't register our handler if the signal is already being ignored.
10947 * src/dd.c (interrupt_handler): Use raise, rather than kill+getpid.
10948 * src/csplit.c (interrupt_handler): Likewise.
10949 * src/sort.c (sighandler): Likewise.
10950 (main): Declare `i' and `nsigs' to be unsigned, not int.
10952 2002-11-09 Jim Meyering <jim@meyering.net>
10954 ls --color: restore terminal text color upon signal.
10955 * src/ls.c: Include "full-write.h" and <signal.h>.
10956 (restore_default_color, restore_default_color_handler): New functions.
10957 (sigtstp_handler, put_indicator_direct): New functions.
10958 (main) [print_with_color]: Register signal handlers.
10959 Patch mostly by Solar Designer and Stanislav Ievlev.
10961 Update from autoconf.
10962 * Makefile.maint (AMTAR): Remove definition.
10963 (update, cvs-update, po-update, do-po-update): New rules.
10964 (wget-update): Update (thus renaming to cvs-update).
10965 (automake_repo): Use anoncvs@sources.redhat.com.
10967 2002-11-06 Jim Meyering <jim@meyering.net>
10969 * tests/misc/Makefile.am (TESTS): Add printf-hex.
10971 * tests/misc/printf: Be careful to test the code in this package,
10972 not the shell built-in function.
10974 * src/printf.c (print_esc): A hexadecimal escape sequence has
10975 at most two hex. digits, not three. Reported by Padraig Brady.
10976 (usage): Update description.
10977 * tests/misc/printf-hex: New file/test, for the above fix.
10979 2002-10-07 Paul Eggert <eggert@twinsun.com>
10981 Add support for locale-specific size indications (e.g.,
10982 thousands-separators) and for explicit size suffixes on output.
10984 * doc/coreutils.texi (Block size): Say that:
10985 This affects display format as well as block size.
10986 Fractional block counts are rounded up.
10987 ls file size blocksize defaults to 1.
10988 A block size spec preceded by ' generates thousands separators.
10989 A suffix without a preceding integer generates suffixes.
10990 (tail invocation): 32k -> 32 KiB.
10991 (What information is listed): ls -h is now equivalent to
10992 ls --block-size=human, and ls -H is now equivalent to
10993 ls --block-size=si. Displayed file size is now always affected by
10996 * lib/inttostr.c, lib/inttostr.h, lib/imaxtostr.c, lib/offtostr.c,
10997 lib/umaxtostr.c: New files, taken from GNU tar.
10999 * lib/Makefile.am (libfetish_a_SOURCES): Add imaxtostr.c, offtostr.c,
11001 (EXTRA_DIST): Add inttostr.c.
11003 * lib/human.c, lib/human.h: Rewrite to support locale-specific
11004 notations like thousands separators.
11005 Specify what includer of include.h must include beforehand.
11006 (human_group_digits, human_suppress_point_zero, human_autoscale,
11007 human_base_1024, human_SI, human_B): New enum values.
11008 (human_readable): Rename from human_readable_inexact; put the
11009 options before the sizes. All uses changed. The old human_readable
11010 function has been removed; use inttostr.h instead.
11011 (human_options): Renamed from human_block_size, with new signature
11012 that allows block sizes up to UINTMAX_MAX. All callers changed.
11014 * m4/prereq.m4 (jm_PREREQ_HUMAN): Check for locale.h, localeconv,
11015 AC_HEADER_STDBOOL. No need to check for limits.h since it's in
11016 freestanding C89. No need to check for stdlib.h or string.h since
11017 autoconf does this now.
11019 * src/cksum.c (cksum): Use primitives from inttostr.h, not
11020 human.h, to print large numbers simply.
11021 * src/csplit.c (handle_line_error, parse_patterns): Likewise.
11022 * src/dd.c (print_stats, main): Likewise.
11023 * src/df.c (print_header): Likewise.
11024 * src/factor.c (print_factors): Likewise.
11025 * src/ls.c (print_long_format, print_file_name_and_frills): Likewise.
11026 * src/shred.c (dopass): Likewise.
11027 * src/sort.c (checkfp): Likewise.
11028 * src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
11029 * src/tail.c (xlseek): Likewise.
11030 * src/wc.c (write_counts, wc): Likewise.
11032 * src/df.c (human_output_opts): New var.
11033 (output_block_size): Now uintmax_t, not int, to handle larger
11034 block sizes. All uses changed.
11035 * src/du.c: Likewise.
11036 * src/ls.c: Likewise.
11038 * src/df.c (print_header): In the header line, prefer SI to human
11039 representation if it's shorter; if neither is shorter, try to
11040 intuit what the user would prefer.
11042 * src/expr.c (inttostr): Remove; use new imaxtostr library
11045 * src/ls.c (file_output_block_size): New var, to distinguish
11046 file sizes from other sizes.
11047 (decode_switches): Set it.
11049 * src/shred.c (OUTPUT_BLOCK_SIZE): remove.
11050 (dopass): When printing progress, use floor for what has been done
11051 so far (since we should be conservative there), and ceiling for
11052 what needs to be done (since that's what other programs use).
11054 2002-10-19 Jim Meyering <jim@meyering.net>
11056 * src/pinky.c (print_heading): Align TTY and Name headings.
11057 Reported by Karl Eichwalder.
11059 2002-10-18 Jim Meyering <jim@meyering.net>
11061 * src/split.c (cwrite): Change type of `bytes' parameter to size_t
11062 Remove now-useless cast.
11063 (stdread): Remove function.
11064 (bytes_split): Use size_t instead of int.
11065 Use safe_read, not stdread.
11066 (lines_split): Likewise.
11067 Use memchr rather than a `while' loop.
11068 (line_bytes_split): Use size_t instead of int.
11069 Use safe_read, not stdread.
11070 (main): Add some FIXME comments to remind me to remove casts.
11072 * src/system.h (ST_BLKSIZE): Correct comment describing how to
11073 reproduce HPUX-11 cat failure. From Petter Reinholdtsen.
11075 2002-10-17 Jim Meyering <jim@meyering.net>
11077 Fix a problem that could make e.g., `cat' misbehave on systems which
11078 give invalid (unreasonably large) values for stat.st_blksize.
11079 * src/system.h (ST_BLKSIZE): Ensure that the result is in [1..4MB].
11080 Reported by Petter Reinholdtsen.
11082 2002-10-14 Jim Meyering <jim@meyering.net>
11084 Specifying a printf conversion specifer as nl's separator string
11085 could cause nl to segfault.
11086 * src/nl.c (build_print_fmt): Don't include separator string
11087 in the printf format; it might contain `%'.
11088 Use a better bound on the length of the print_fmt buffer.
11089 (print_lineno): Print the separator here instead.
11090 Reported by Doug Coleman.
11092 * tests/misc/nl: New file/tests, including a test for the above.
11093 * tests/misc/Makefile.am (TESTS): Add nl.
11095 * tests/misc/split-l: New test, to make sure `split --lines=N' works.
11096 * tests/misc/Makefile.am (TESTS): Add split-l.
11098 2002-10-13 Jim Meyering <jim@meyering.net>
11102 * src/du.c (usage): Tweak description of --dereference-args/-D.
11104 * src/du.c (count_entry): Also save cwd when dereferencing (via
11105 --dereference-args, -D) a command-line argument.
11106 Reported by Michal Svec. Based on a patch by Andreas Schwab.
11108 * src/Makefile.am (../AUTHORS): New target/rule.
11110 2002-10-12 Jim Meyering <jim@meyering.net>
11112 * src/paste.c (paste_parallel): Declare local, `delims_saved', to be
11113 of type size_t, since that's the way it's used and avoids a warning.
11115 * src/csplit.c (struct cstring) [len]: Declare to be unsigned int,
11116 since that's how it's always used and avoids a new warning from gcc.
11117 (read_input): Adapt to new safe_read ABI.
11119 * src/cut.c (cut_fields): Add a temporary size_t variable, n_bytes,
11122 * src/pinky.c (print_long_entry): fread returns size_t.
11123 Declare local `bytes' accordingly, to avoid warning.
11125 tail -c +N would perform an extra read after encountering EOF
11126 [this change is analogous (bytes vs. lines) to the one of 2002-01-27]
11127 * src/tail.c (start_bytes): Detect EOF, inform caller.
11128 (tail_bytes): Upon EOF in start_bytes, return immediately.
11129 (file_lines): Reorganize to use memrchr rather than an explicit loop.
11130 Adapt to new safe_read ABI.
11132 2002-10-11 Jim Meyering <jim@meyering.net>
11134 * tests/du/deref: New file/test, for the above fix.
11135 * tests/du/Makefile.am (TESTS): Add deref.
11137 2002-10-10 Jim Meyering <jim@meyering.net>
11139 * tests/ln/Makefile.am (TESTS): Add target-1.
11140 * tests/ln/target-1: New file/test, for the fix on 2002-10-08.
11142 2002-10-09 Jim Meyering <jim@meyering.net>
11144 * tests/cp/backup-is-src: Ensure that certain environment variables
11145 are not set (e.g., SIMPLE_BACKUP_SUFFIX). Reported by Duncan Roe.
11147 * tests/tail-2/big-4gb: Mark this as an expensive test; it would
11148 consume 4GB of disk space on systems without support for sparse files.
11149 Fix a logic error that'd make it `cat err' even though dd didn't fail.
11151 * src/dircolors.hin (.jar): Fix typo: s/;3$/;31/.
11152 Patch by steven@magelico.net, forwarded by Michael Stone.
11154 * tests/ls/dired: Ensure that ls produces English messages.
11155 Patch by Alexey Vyskubov, forwarded by Michael Stone.
11157 2002-10-08 Dmitry V. Levin <ldv@altlinux.org>
11159 * src/ln.c (main): Fix target_directory parsing when n_files == 1.
11161 2002-10-08 Jim Meyering <jim@meyering.net>
11163 * tests/tail-2/big-4gb: Use double quotes around diagnostic.
11164 Fix syntax in test: use =, not ==.
11165 Reported by Bob Proulx.
11166 Change all the rest like this: grep -lR "testing framework'" .\
11167 |xargs perl -pi -e 's/'\''(\$0: failure in testing framework)'\''/"$1"/'
11169 * src/sum.c (sysv_sum_file): Adapt to new safe_read ABI.
11170 * src/tr.c (squeeze_filter, read_and_delete, read_and_xlate): Likewise.
11171 * src/tac.c (save_stdin, tac_stdin_to_mem): Likewise.
11172 * src/wc.c (wc): Likewise.
11174 2002-10-07 Paul Eggert <eggert@twinsun.com>
11177 Don't advance the write pointer past the end of the write buffer.
11178 * src/sort.c (begfield, limfield): Likewise.
11180 2002-10-07 Jim Meyering <jim@meyering.net>
11182 * src/cat.c (simple_cat, cat): Adapt to new safe_read ABI.
11183 * src/head.c (head_bytes, head_lines): Likewise.
11185 2002-10-06 Jim Meyering <jim@meyering.net>
11187 * src/dd.c (scanargs): Ensure that specified block sizes (specified
11188 via ibs=N, obs=N, and bs=N) are no larger than SSIZE_MAX.
11189 (skip, dd_copy): Adapt to new safe_read ABI.
11191 * Makefile.maint (signatures): Define.
11193 (announcement): Depend on $(signatures).
11195 * Makefile.maint (announcement): Output all URLs for detached
11196 signatures, not just the last one from the previous loop.
11198 2002-10-05 Jim Meyering <jim@meyering.net>
11202 * src/remove.c (remove_entry) [ROOT_CAN_UNLINK_DIRS]: With `rm -i DIR',
11203 don't recurse into directory, DIR. Prompted by a report from
11206 * tests/rm/i-no-r: New file/test, for the above fix.
11207 * tests/rm/Makefile.am (TESTS): Add i-no-r.
11209 * tests/tail-2/big-4gb: New file/test, for the fix of 2002-09-27.
11210 * tests/tail-2/Makefile.am (TESTS): Add big-4gb.
11212 2002-10-03 Jim Meyering <jim@meyering.net>
11214 * src/rm.c (AUTHORS): Mark translatable string with `N_ (...)'.
11215 * src/df.c (AUTHORS): Likewise.
11216 * src/du.c (AUTHORS): Likewise.
11217 * src/tail.c (AUTHORS): Likewise.
11218 * src/touch.c (AUTHORS): Likewise.
11220 2002-10-02 Jim Meyering <jim@meyering.net>
11222 * Makefile.am (SUBDIRS): Remove `old'.
11223 (EXTRA_DIST): List the files in old/.
11224 * configure.ac (AC_CONFIG_FILES): Remove old/* names.
11225 Suggestion from Akim Demaille.
11227 2002-10-01 Jim Meyering <jim@meyering.net>
11229 * src/sys2.h (SSIZE_MAX): Define.
11231 2002-09-30 Jim Meyering <jim@meyering.net>
11233 * src/csplit.c: Don't include stdlib.h here. It's already included
11236 2002-09-29 Jim Meyering <jim@meyering.net>
11238 * src/tr.c (find_bracketed_repeat): Rearrange pointer/integer
11239 expression to avoid bogus warning from gcc.
11241 * src/cat.c (simple_cat): Use a temporary to avoid bogus warnings.
11242 (cat): Declare insize and outsize to be of type size_t, not int.
11243 Rearrange pointer/integer expressions to avoid bogus warnings.
11244 (main): Declare insize and outsize to be of type size_t, not int.
11246 * src/tail.c (parse_options): Give a sensible diagnostic for
11247 an invalid byte or line count. Reported by Mikko Tuumanen.
11249 * src/touch.c (main): Split a long line.
11251 * tests/du/Makefile.am (TESTS): Add slink.
11252 * tests/du/slink: New test for system.h change of 2002-08-31.
11254 In move mode, always first try to rename. Before, upon failure to
11255 rename a directory, this code would never attempt to rename any
11256 other file in that directory, but would thenceforth always copy.
11257 On some systems (e.g., NetApp's OnTap-6.4), renaming a directory
11258 may fail with EXDEV, yet renaming files within that directory to
11259 a newly-created destination directory succeeds.
11260 * src/copy.c (copy_internal): Remove local, move_mode;
11261 use x->move_mode instead. Based on a patch from Tom Haynes.
11263 2002-09-28 Jim Meyering <jim@meyering.net>
11265 * src/split.c (FAIL_ONLY_ONE_WAY): New macro.
11266 Factor out some duplication.
11268 [case 'a']: Use strtoul rather than strtol to avoid compiler warnings.
11270 * src/sort.c (begfield, limfield): Rearrange comparisons to avoid
11272 (fillbuf, keycompare): Cast literal `-1' to size_t in comparisons,
11273 to avoid compiler warnings.
11275 * src/shred.c (dopass): Use a uintmax_t temporary to avoid bogus
11278 Fix things so `mkdir -p' can create very deep directories, e.g.,
11279 mkdir -p $(perl -e 'print "a/" x 40000') now works.
11280 * src/mkdir.c (main): For --parents (-p), call make_path with the
11281 entire directory name, so we don't ever require that file operations
11282 like stat or chmod be performed on the entire command line argument.
11283 * makepath.c (make_path): Restore umask *before* creating the final
11286 2002-09-27 Andreas Schwab <schwab@suse.de>
11288 * src/tail.c (tail_bytes): Change type of bytes_remaining to off_t
11289 to avoid overflow. Reported by Hans Lermen.
11291 2002-09-26 Jim Meyering <jim@meyering.net>
11293 * src/install.c (get_ids): Use strtoul, not strtol. Remove some casts.
11295 2002-09-25 Jim Meyering <jim@meyering.net>
11297 * src/test.c (eaccess): Change type of local `euid' from int to uid_t
11298 and add a cast, to avoid a warning about `signed and unsigned type in
11299 conditional expression'.
11301 2002-09-22 Jim Meyering <jim@meyering.net>
11303 * src/rmdir.c: Include "dirname.h", for declaration of
11304 strip_trailing_slashes.
11306 * src/stat.c (PRIdMAX, PRIuMAX): Remove definitions.
11307 Now they're defined through system.h.
11309 * src/cp-hash.c, src/dd.c, src/df.c, src/du.c, src/ls.c,
11310 * src/stat.c, src/wc.c: Remove all inclusions of inttypes.h,
11311 since it's already included from sys2.h via system.h.
11313 * Use automake-1.6f. Regenerate dependent files.
11315 * src/Makefile.am (PERL): Remove duplicate definition.
11317 fmt's -s, -t, -c options didn't work properly for long lines.
11318 Since get_line may end up calling put_paragraph (for long lines),
11319 be sure to set global, `other_indent', before it is used there.
11321 * src/fmt.c (set_other_indent): New function, factored out of...
11322 (get_paragraph): ... here. Call it.
11323 (get_line): Call set_other_indent before calling flush_paragraph,
11324 which calls fmt_paragraph, which in turn calls put_paragraph,
11325 which uses other_indent.
11327 * tests/fmt/Makefile.am (TESTS): Add long-line.
11328 * tests/fmt/long-line: New file/test, for the above fix.
11330 2002-09-21 Jim Meyering <jim@meyering.net>
11332 * src/od.c: No longer include deprecated <values.h>.
11333 It was required solely for now-removed reference to BITSPERBYTE.
11334 * src/install.c: Likewise.
11335 Suggestion from Bruno Haible.
11337 2002-09-06 Andreas Schwab <schwab@suse.de>
11339 `rmdir -p dir-specified-with-trailing-slash/' would fail.
11340 * src/rmdir.c (remove_parents): Strip trailing slashes.
11342 2002-09-20 Jim Meyering <jim@meyering.net>
11344 * tests/rmdir/t-slash: New file/test, for the above fix.
11345 * tests/rmdir/Makefile.am (TESTS): Add t-slash.
11347 * Makefile.maint (announcement): Arrange to gpg-sign the message.
11348 Add a URL for each detached signature file.
11350 2002-09-07 Bruno Haible <bruno@clisp.org>
11352 * configure.ac: Add need-ngettext to AM_GNU_GETTEXT invocation.
11354 2002-09-18 Jim Meyering <jim@meyering.net>
11356 `od -t x8' used the wrong (`l'-prefixed) printf format.
11357 Likewise for the o8 and u8 formats.
11358 * src/od.c (ISPEC_TO_FORMAT): Define macro.
11359 (decode_one_format): Use PRIdMAX, PRIoMAX, etc. for LONG_LONG.
11360 Reported by Arun Sharma.
11362 2002-09-17 Jim Meyering <jim@meyering.net>
11364 * src/sys2.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX): Define if necessary.
11365 From gettext's intl/loadmsgcat.c.
11367 * tests/od/x8: New file/test, for the above fix.
11368 * tests/od/Makefile.am (TESTS): Add x8.
11370 2002-09-15 Jim Meyering <jim@meyering.net>
11372 * Use autoconf-2.54. Regenerate dependent files.
11374 * src/csplit.c (get_format_width): Add cast to avoid
11375 warning about `signed and unsigned type in conditional expression'.
11377 2002-09-14 Jim Meyering <jim@meyering.net>
11379 * src/who.c (print_user): Change type of local to size_t
11380 to avoid warnings about `comparison between signed and unsigned'.
11381 * src/ptx.c (generate_all_output): Likewise.
11383 * src/dd.c (main, skip): Add casts to avoid warnings about
11384 `comparison between signed and unsigned'.
11386 * src/id.c (print_full_info, print_group_list): Add casts to avoid
11387 warnings about `signed and unsigned type in conditional expression'.
11389 * src/md5sum.c: Change type of global, digest_hex_bytes, to size_t
11390 to avoid warnings about `comparison between signed and unsigned'.
11391 (split_3): Change parameter names to be readable and add comment.
11392 Clean up the test for whether a line may be ignored.
11394 2002-09-13 Jim Meyering <jim@meyering.net>
11396 * src/printf.c (main): Handle leading command line argument of `--'.
11397 Reported by Raul: DervishD <raul@pleyades.net>
11398 * tests/misc/printf: New file: test for the above.
11399 * tests/misc/Makefile.am (TESTS): Add printf.
11401 * src/date.c (usage): Explain that %S's range of [0..60] is required --
11402 rather than 0..59 -- to accommodate the occasional positive leap second.
11403 Reported by Richard Neill.
11405 2002-09-12 Jim Meyering <jim@meyering.net>
11407 * src/Makefile.am (nanosec_libs): Define.
11408 (sleep_LDADD, tail_LDADD): Use it here.
11410 Factor nanosleep-related code into ../lib/xnanosleep.c.
11411 * src/sleep.c: Include xnanosleep.h.
11412 Factor out fenv.h-related code.
11413 (timespec_subtract): Remove function.
11414 (main): Remove code that deals with computing start and stop times
11415 as well as the loop around nanosleep. Now that's in xnanosleep.c.
11417 Allow S (in --sleep-interval=S) to be a floating point value.
11418 * src/tail.c: Include xnanosleep.h and xstrtod.h.
11419 Move declaration of global variable, sleep_interval, to ...
11421 (usage): Update description of --sleep-interval option.
11422 (tail_forever): New parameter, sleep_interval. Update caller.
11423 Use xnanosleep, rather than sleep.
11424 (parse_options): New parameter, sleep_interval. Update caller.
11425 Use xstrtod, now that we accept floating point values.
11426 Prompted by a patch from Augey Mikus.
11428 2002-09-06 Jim Meyering <jim@meyering.net>
11430 * src/remove.c (prompt): Change comment to give a better note to
11431 translators. From Michael Piefel.
11433 2002-09-02 Jim Meyering <jim@meyering.net>
11435 * README: A good problem report/patch includes diffs against
11436 the most recent test release.
11438 * src/pathchk.c (NEED_PATHCONF_WRAPPER): Define.
11439 (pathconf_wrapper): Define only if NEED_PATHCONF_WRAPPER is set.
11441 * src/kill.c (print_table_row): Use an unsigned type for widths
11442 to avoid warning about comparison between signed and unsigned.
11443 (list_signals): Likewise.
11445 * src/od.c (skip): Add a cast to avoid warning about comparison
11446 between signed and unsigned.
11447 * src/install.c (get_ids): Likewise. Also rearrange range-checking
11448 comparisons to make them more readable.
11450 2002-09-01 Jim Meyering <jim@meyering.net>
11454 2002-08-31 Jim Meyering <jim@meyering.net>
11456 Symlinks were always reported as using 0 blocks.
11457 * src/system.h (ST_NBLOCKS): Don't depend on file type.
11458 This reverts the change of 2000-01-30.
11459 Based on a report and patch from Neil Brown via Michael Stone.
11460 This fixes Debian Bug#156358.
11462 * Most files: Change `exit (0)' to `exit (EXIT_SUCCESS)',
11463 `exit (1)' to `exit (EXIT_FAILURE)', and
11464 `usage (1)' to `usage (EXIT_FAILURE)'.
11466 * chgrp.c, chmod.c, chown.c, chroot.c, cp.c, date.c, dd.c, du.c,
11467 * hostname.c, id.c, install.c, ln.c, mkdir.c, mkfifo.c, mknod.c,
11468 * nice.c, pinky.c, printf.c, pwd.c, shred.c, sleep.c, stty.c,
11469 * su.c, tac-pipe.c, tail.c, tee.c, touch.c, uname.c, uptime.c,
11470 * users.c, who.c: Change `error (1, ...' to `error (EXIT_FAILURE, ...'.
11471 But don't change `error (0, ...' to `error (EXIT_SUCCESS, ...', since
11472 error never exits successfully.
11474 2002-08-29 Jim Meyering <jim@meyering.net>
11476 * src/remove.c (remove_cwd_entries): Use closedir (not CLOSEDIR)
11477 when ignoring any return value.
11479 * src/remove.c (remove_cwd_entries): Detect and diagnose readdir
11480 failures. On some systems (at least EMC Celerra and Solaris5.8),
11481 this appears to be necessary.
11482 (is_empty_dir): Likewise. Also, always close directory handle.
11483 * src/ls.c (print_dir): Likewise.
11484 (print_dir): Rename local variable: reading -> dirp.
11485 Reported by Mike Coleman.
11487 2002-08-28 Jim Meyering <jim@meyering.net>
11489 * src/remove.c (remove_cwd_entries): Use CLOSEDIR, not closedir.
11490 Give a diagnostic and fail if closedir fails.
11492 2002-08-26 Jim Meyering <jim@meyering.net>
11494 * Makefile.am (THANKS-to-translators): New rule.
11495 (EXTRA_DIST): Add both THANKS-to-translators and THANKStt.in.
11496 * THANKStt.in: New file.
11498 * src/cat.c (close_stdout_wrapper): New, kludgey, function and
11499 file-scoped global.
11500 (main): Register it with atexit.
11501 Close STDOUT_FILENO, to avoid a problem when writing to
11502 /dev/audio on at least Solaris 5.7 and 5.8 systems.
11503 Reported by Shing-Shong Shei.
11505 2002-08-25 Jim Meyering <jim@meyering.net>
11507 * src/cat.c (main): Close STDIN_FILENO rather than a literal `0'.
11508 * src/tac.c (main): Likewise.
11509 * src/tail.c (main): Likewise.
11510 * src/tee.c (main): Likewise.
11511 * src/tr.c (main): Likewise.
11512 * src/wc.c (main): Likewise.
11514 2002-08-20 Jim Meyering <jim@meyering.net>
11516 * tests/mv/setup: Rewrite not to use `: ${VAR=not_set}' paradigm.
11518 2002-08-10 Paul Eggert <eggert@twinsun.com>
11520 * src/nohup.sh: Don't use "exec --"; it's not portable and
11521 shouldn't be needed.
11523 2002-08-09 Jim Meyering <jim@meyering.net>
11525 * src/pr.c (main): Don't ignore -COLUMN if it's the last option.
11526 (usage): Clarify help text for the -COLUMN option.
11527 Patch by Padraig Brady.
11528 * tests/pr/Test.pm [col-last]: New test for the above.
11530 * configure.ac: Start with version 4.5.1, chosen so that it's larger
11531 than the latest version numbers of the component packages.
11533 * man/Makefile.am (check-x-vs-1): Set and export PATH so we use
11534 programs in ../src.
11536 2002-08-08 Jim Meyering <jim@meyering.net>
11538 * src/date.c: Guard inclusion of <langinfo.h> with
11539 `#if HAVE_LANGINFO_CODESET', not `#if HAVE_LANGINFO_H'.
11540 * src/sort.c: Likewise.
11541 Patch by GOTO Masanori.
11543 2002-08-05 Paul Eggert <eggert@twinsun.com>
11545 Fix some minor time-related bugs with POSIX time arguments.
11546 Some valid time stamps were being rejected (notably -1, and
11547 time stamps before 1900 on 64-bit hosts). And some invalid
11548 time stamps were being accepted, e.g. September 31.
11550 * src/date.c (main): Adjust to posixtime signature change.
11551 * src/touch.c (main): Likewise. Remove unnecessary initialization.
11552 Use localtime, not posixtm, to warn about obsolete "touch".
11554 2002-08-05 Jim Meyering <jim@meyering.net>
11556 * tests/misc/Makefile.am (TESTS): Add nice and pathchk1.
11558 2002-08-04 Jim Meyering <jim@meyering.net>
11560 * src/Makefile.am (check-README): New target/rule.
11561 (check): Depend on it.
11563 * configure.ac (AC_CONFIG_FILES): Add old/Makefile and old/*/Makefile.
11565 2002-08-03 Jim Meyering <jim@meyering.net>
11567 * Makefile.am (SUBDIRS): Add old.
11568 * old/: New directory, containing legacy ChangeLog* and NEWS files
11569 from the fileutils, sh-utils, and textutils packages.
11571 * src/Makefile.am (AM_INSTALLCHECK_STD_OPTIONS_EXEMPT): Set to false.
11573 2002-08-02 Paul Eggert <eggert@twinsun.com>
11575 * NEWS, doc/coreutils.texi: uniq now obeys LC_COLLATE.
11577 * src/uniq.c: Include hard-locale.h, xmemcoll.h.
11578 (hard_LC_COLLATE): New var.
11579 (different): Args are now char *, not const char *.
11580 Use xmemcoll instead of memcmp to compare lines, so that
11581 LC_COLLATE has effect. However, use memcmp if it is an
11583 (check_file): Do not include newline in comparison, so that
11584 xmemcoll has a byte to stomp on temporarily.
11585 (main): Set hard_LC_COLLATE.
11587 2002-07-29 Jim Meyering <jim@meyering.net>
11589 * Makefile.am (SUBDIRS): Remove djgpp, for now.
11591 2002-07-20 Jim Meyering <jim@meyering.net>
11593 * Makefile.am (false.c): Convert only the final EXIT_SUCCESS
11594 into EXIT_FAILURE. Otherwise, false --help and false --version
11597 2002-07-08 Jim Meyering <jim@meyering.net>
11599 * src/Makefile.am (uninstall-local): Search for @GNU_PACKAGE@,
11600 rather than the hard-coded `sh-utils'.
11602 2002-07-01 Jim Meyering <jim@meyering.net>
11604 * configure.ac: Merge the three files from fileutils,
11605 textutils, and sh-utils.
11606 * Makefile.am: Likewise.
11607 * src/Makefile.am: Likewise.
11612 Copyright (C) 2002-2013 Free Software Foundation, Inc.
11614 Copying and distribution of this file, with or without
11615 modification, are permitted provided the copyright notice
11616 and this notice are preserved.