Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Branch: master
Fetching contributors…

Cannot retrieve contributors at this time

11617 lines (8881 sloc) 448.871 kB
2005-12-27 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_obsolete_symbols): Prohibit use of O_NDELAY.
(sc_prohibit_assert_without_use): New rule.
(syntax-check-rules): Add it to the list.
* .x-sc_prohibit_assert_without_use: New empty file.
* Makefile.am (EXTRA_DIST): Add it.
* Makefile.maint (CVS_LIST): Define in terms of $(srcdir).
* cp.c, df.c, link.c, mknod.c, nice.c, sleep.c, unlink.c:
Don't include <assert.h>; it wasn't used.
2005-12-26 Paul Eggert <eggert@cs.ucla.edu>
* src/chown-core.c (restricted_chown):
Don't try O_WRONLY unless O_RDONLY failed wth EACCES.
* src/remove.c (fd_to_subdirp): Open with O_DIRECTORY | O_NOCTTY
| O_NOFOLLOW too, for consistency with other dir-openers.
Use POSIX-preferred O_NONBLOCK rather than O_NDELAY.
(is_empty_dir): Likewise.
* src/shred.c (wipename): Likewise. Don't bother trying to open
dir for writing, since POSIX prohibits it.
2005-12-22 Jim Meyering <jim@meyering.net>
* tests/help-version: Redirect stderr to /dev/full, to suppress
write error diagnostic.
2005-12-19 Jim Meyering <jim@meyering.net>
* src/mkdir.c, src/mknod.c, src/mkfifo.c (main)
Avoid a minor race condition when `-m MODE' is specified, by using
open, fchown, and close rather than just chown. To do that reliably --
even with an overly restrictive umask -- ensure that each mkdir,
mknod and mkfifo call uses a mode including at least owner-read access.
* src/mknod.c (main): When `-m MODE' is specified, exit nonzero if
the subsequent chown (or equivalent open,fchown,close) fails.
* tests/misc/mknod: New tests.
* tests/misc/Makefile.am (TESTS): Add mknod.
2005-12-17 Jim Meyering <jim@meyering.net>
* src/remove.c (is_empty_dir): Open with O_NDELAY, so we don't hang,
e.g., on a named pipe.
(OPEN_NO_FOLLOW_SYMLINK): Remove definition. Use O_NOFOLLOW in
place of all uses, since it is guaranteed (system.h) to be defined.
2005-12-05 Andreas Gruenbacher <agruen@suse.de>
Add POSIX ACL support
* src/ls.c: Switch back from HAVE_ACL to USE_ACL: The acl() syscall
is no requirement for ACL support; particularly, it does not exist
on systems that have POSIX ACLs.
* src/copy.h (cp_option_init) [umask_kill]: Remove member.
* src/cp.c (umask_kill): With default acls, the umask is not to be
applied. Remove umask_kill, don't change the process umask, and let
the kernel apply the umask where appropriate.
* src/cp.c (make_dir_parents_private): Fix logic for POSIX ACLs.
* src/copy.c (get_dest_mode): Remove; it is obsolete after removing
umask_kill.
(copy_reg, copy_internal): Use copy_acl and set_acl
instead of fchown/chown. Fix the logic for POSIX ACLs.
(chown_succeded): Remove; we now always copy acls and
preserve S_ISUID, S_ISGID, and S_ISVTX when needed, no matter if we
did a chown before or not.
* src/mv.c, src/install.c (cp_option_init): Don't set umask_kill member.
* src/Makefile.am (dir_LDADD, ls_LDADD, vdir_LDADD, cp_LDADD,
mv_LDADD, ginstall_LDADD): On systems with an ACL library, arrange
to link with it via $(LIB_ACL), for the utilities that need it.
2005-12-16 Paul Eggert <eggert@cs.ucla.edu>
* src/remove.c (OPENAT_CWD_RESTORE__REQUIRE): Remove.
(OPENAT_CWD_RESTORE__ALLOW_FAILURE): Likewise.
(fd_to_subdirp): Remove openat_cwd_restore_allow_failure arg; its
value is now signified by whether cwd_errno is null.
(fd_to_subdirp, remove_dir, rm_1); Change cwd failure indicator from
pointer-to-bool to pointer-to-errno-value. All callers changed.
(rm_1): Don't bother setting a local cwd failure flag and then
ORing it into the caller's. Just set the caller's.
(rm): Use cwd failure errno value to print a slightly-better
diagnostic.
2005-12-15 Jim Meyering <jim@meyering.net>
* src/stat.c (print_it): Properly handle a backslash at the
end of a --printf format string. Reported by Paul Eggert.
* tests/misc/stat-printf (end-bs): Add a test for the above.
2005-12-15 Paul Eggert <eggert@cs.ucla.edu>
* tests/acl: Port to pre-POSIX shells like Solaris 8 /bin/sh.
Don't assume /etc/passwd contains user names; use 'id' instead.
2005-12-15 Jim Meyering <jim@meyering.net>
stat: revert behavior of --format=FMT (-c)
stat: add new option: --printf=FMT
* NEWS: Mention this.
* src/stat.c (isodigit, octtobin, hextobin): Define.
(PRINTF_OPTION): Define.
(interpret_backslash_escapes, trailing_delim): New globals.
(usage): Document them. Alphabetize on long option names.
(print_esc_char): New function.
(print_it): Rewrite, in order to handle backslash escapes.
(main): Handle new option. Set globals for --format, too.
* tests/misc/stat-printf: Test --printf and --format.
* tests/misc/Makefile.am (TESTS): Add stat-printf.
2005-12-14 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: sort now reports incompatible options.
* src/sort.c (incompatible_options, check_ordering_compatibility):
New functions.
(main): Use them. Don't bother with a usage message for
"sort -c a b", for consistency with other error diagnostics.
* tests/sort/Test.pm (incompat1, incompat2, incompat3, incompat4):
New tests.
* src/cat.c (main): Undo previous change. close_stdout already
does the check, so the previous change wasn't necessary.
2005-12-13 Paul Eggert <eggert@cs.ucla.edu>
* src/cat.c (main): Check for close (STDOUT_FILENO) failure.
2005-12-12 Paul Eggert <eggert@cs.ucla.edu>
Install a more-conservative approach for sort -R. It's the
same basic idea as the existing code, except it uses the full ISAAC
approach (called the "more kosher" approach in the existing comments).
This makes "sort -R" quite a bit slower (about a factor of 2 on my
little tests involving 10000 lines on a 2.4 GHz P4), but I think it's
better to be conservative here at first, and review any performance
improvements carefully.
* .x-sc_require_config_h: Add src/rand-isaac.c.
* src/rand-isaac.h: Remove. All uses now simply include rand-isaac.c.
* src/Makefile.am (noinst_HEADERS): Remove rand-isaac.h.
(shred_SOURCES, sort_SOURCES): Remove.
(EXTRA_DIST): Add rand-isaac.c.
* src/rand-isaac.c: Revert to what used to be in shred.c, without
changing it to allow for varying numbers of words in the state.
Alter so that we include rand-isaac.c directly rather than
compiling it and linking to it. Don't include config.h or
system.h; that's the includer's responsibility.
Omit functions that are specific to shred.
(ISAAC_LOG, ISAAC_WORDS, ISAAC_BYTES, struct isaac_state, ind):
(isaac_step, struct irand_state):
Resurrect these, with the same defns that used to be in shred.c.
(ISAAC_SIZE, isaac_new, isaac_copy): Remove.
(isaac_refill, isaac_seed_start, isaac_seed_data, irand_init, irand32):
static again.
(struct isaac_state, isaac_refill, isaac_mix, isaac_init):
(isaac_seed_start, isaac_seed_data, isaac_seed_finish, isaac_seed):
(irand_init, irand32, irand_mod):
Number of words is constant again.
(struct irand_state, irand_init, irand32, irand_mod): Move to shred.c.
* src/shred.c: Include rand-isaac.c rather than rand-isaac.h.
* src/sort.c: Likewise.
* src/shred.c (fillrand, dopass, main): Undo previous change.
(struct irand_state, irand_init, irand32, irand_mod): Moved back here,
from rand-isaac.c.
* src/sort.c: Don't include md5.h; it wasn't needed.
(struct keyfield): Rename random_hash to random, for consistency
with the other member names. All uses changed.
(usage): Tweak wording to mention STRING for --seed option.
(short_options): Rorder for consistency with other programs.
(rand_state): Now a struct, not a pointer to one. All uses changed.
(HASH_WORDS, HASH_SIZE): Remove.
(get_hash): Remove comments around resbuf size, since we can assume C89.
Use a "more-kosher" (but slower) approach of invoking isaac_refill.
(keycompare): Adjust to the new get_hash.
Add a FIXME.
(badfieldspec): Omit recently-introduced comment; it isn't needed.
(main): Don't set need_random simply because gkey has it set; that
doesn't necessarily mean we'll need random numbers.
Redo seeding to match new get_hash approach.
2005-12-10 Jim Meyering <jim@meyering.net>
* src/Makefile.am (noinst_HEADERS): Add rand-isaac.h.
Avoid shred segfault on 64-bit systems.
* src/rand-isaac.c (isaac_refill): Don't try to negate a
local of type uint32_t. Make the local an `int' instead.
* NEWS: Mention sort's new options.
* src/rand-isaac.c (isaac_mix): Declare to be static.
Mark all other functions as `extern' so the tight-scope
part of `make distcheck' passes once again.
* src/rand-isaac.h (isaac_mix): Remove declaration.
* src/sort.c (get_hash): Change position of `*' in parameter
type to conform with convention.
(main): Split a long line so it fits in 80 columns.
(keycompare): Remove stray SPACE before TAB that was
causing `make distcheck' to fail.
* src/shred.c: Don't include gethrxtime.h. No longer needed.
* tests/misc/sort-rand: New file: basic tests for the new options.
* tests/misc/Makefile.am (TESTS): Add sort-rand.
2005-12-10 Frederik Eaton <frederik@ofb.net>
* src/Makefile.am (sort_LDADD): Add $(LIB_GETHRXTIME).
(shred_SOURCES, sort_SOURCES): New macros, so we compile rand-isaac.c.
* src/rand-isaac.c: New file, containing ISAAC code that was in shred.c.
Make state size runtime-configurable.
(isaac_new, isaac_copy): New functions.
* src/rand-isaac.h: New file.
* src/shred.c: Include rand-isaac.h. Move ISAAC code to rand-isaac.c.
(fillrand, main): Adjust to the fact that the state size is now
runtime-configurable.
* src/sort.c (short_options, long_options, WORDS, keycompare, main):
(usage): Add options --random-sort and --seed to implement a random
shuffle.
Include md5.h and rand-isaac.h.
(get_hash): New function.
(rand_state): New var.
(HASH_WORDS, HASH_SIZE): New macros.
2005-12-09 Paul Eggert <eggert@cs.ucla.edu>
* tests/dd/misc: Add test for dd iflags=noatime.
2005-12-09 Jim Meyering <jim@meyering.net>
* src/sort.c (usage): Mention white space vs -b and -t options.
From The Wanderer.
2005-12-09 Eric Blake <ebb9@byu.net>
* src/test.c (main): Fix misleading comment.
2005-12-07 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Mention dd's new noatime flag.
* src/system.h (O_NOATIME): Define to 0 if not already defined.
* src/dd.c (flags, usage): Add support for noatime flag.
2005-12-07 Jim Meyering <jim@meyering.net>
Distribute the cvsu script, used only by `make syntax-check'.
* Makefile.am (EXTRA_DIST): Add build-aux/cvsu.
* Makefile.maint (CVS_LIST): Use build-aux/cvsu, now that we
distribute a copy of this script.
* .x-sc_unmarked_diagnostics: Add build-aux/cvsu.
* tests/mv/acl: exit-77 before the trap, not after, if we fail
to create a temporary directory on another partition.
From Andreas Gruenbacher.
2005-12-06 Tomas Pospisek <tpo@sourcepole.ch> (tiny change)
* man/basename.x: Cross-reference to dirname and readlink.
* man/dirname.x: Cross-reference to basename and readlink.
2005-12-05 Andreas Gruenbacher
* src/copy.c [!HAVE_FCHOWN]: Define fchown(...) to -1.
(set_owner, preserve_author): New functions, factored out of copy_reg.
(copy_reg): Use them.
(copy_internal): Use them here, too.
2005-12-04 Jim Meyering <jim@meyering.net>
* src/sleep.c (usage): Say what happens with two or more arguments.
Suggested by Justin Pryzby.
* src/uptime.c (print_uptime): Move decl of `upsecs' into scope
where it's used.
2005-12-03 Jim Meyering <jim@meyering.net>
* src/rm.c (long_opts): Change the name of each undocumented, for-
testing-only option to start with `-', so that it cannot render
ambiguous any prefix it happens to share with some other option name.
Problem reported by Eric Blake.
* src/head.c (long_options): Likewise.
* src/tail.c (long_options): Likewise.
* tests/misc/head-elide-tail: Update uses of undocumented, for-
testing-only --presume* options to start with `---'.
* tests/rm/dangling-symlink: Likewise.
* tests/rm/dir-no-w: Likewise.
* tests/rm/isatty: Likewise.
2005-11-30 Jim Meyering <jim@meyering.net>
* Makefile.maint: Add a comment about cvsu.
2005-11-25 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: df updates for "none", "proc", inaccessible file systems.
* src/df.c (show_point): Ignore inaccessible file systems.
(usage): -a includes dummy file systems, not size-0 file systems.
* src/od.c (unsigned_long_long_int): Renamed from ulonglong_t,
to avoid collision with POSIX name space. All uses changed.
2005-11-24 Jim Meyering <jim@meyering.net>
* tests/Makefile.am (EXTRA_DIST): Add acl to the list.
* tests/acl: Add `$0: ' prefix to diagnostics.
* .x-sc_require_config_h: Add lib/buffer-lcm.c to the list.
2005-11-23 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c: Improve performance a bit by optimizing away
unnecessary system calls and going to a block size of at least
8192 (on normal hosts, anyway). This improved performance 5% on my
Debian stable host (2.4.27 kernel, x86, copying from root
ext3 file system to itself).
Include "buffer-lcm.h".
(copy_reg): Omit last argument. All callers changed.
Use xmalloc to allocate rather than trusting alloca
(which is unwise with large block sizes).
Declare locals more locally, if possible.
Use uintptr_t words instead of int words, for a bit more speed
when looking for null blocks on 64-bit hosts.
Optimize away reads of zero bytes on regular files.
In the typical case, insist on 8 KiB buffers, at least.
Avoid unnecessary extra call to fstat when checking for sparse files.
Avoid now-unnecessary cast to off_t, and "0L".
Avoid unnecessary test of *new_dst when checking for same owner
and group.
2005-11-22 Paul Eggert <eggert@cs.ucla.edu>
* src/remove.c (rm): Don't assume C99 for-loop syntax.
2005-11-22 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_push): Remove debugging cruft.
* tests/rm/unread2 (rm): Change expected diagnostic,
`cannot open directory' to `cannot remove', to align with
new version of rm.
* tests/rm/rm2: Ensure that rm now continues removing entries
even after certain types of failure.
* src/remove.c: Rewrite. Now, this module is reentrant on systems
that provide openat (Solaris), and on systems like Linux+procfs
where our openat emulation code is reentrant. This also fixes a
few low-probability leaks and eliminates some code that could,
in very unusual circumstances, cause rm() (via a callee) to exit.
* NEWS: Mention this.
* configure.ac: Put copyright dates all on one line so the
emacs function that updates them works properly.
2005-11-18 Paul Eggert <eggert@cs.ucla.edu>
* configure.ac (AM_PROG_CC_C_O): Add. Needed for CVS Automake.
Problem reported by Eric Blake.
(AC_PROG_CC_STDC): Use this instead of AC_PROG_CC, so that
we get a standard-conforming compiler. This relies on the new
m4/c.m4 file. Note that it's a bit tricky, since c.m4 doesn't
define AC_PROG_CC_STDC; we are relying on Autoconf 2.59 internals.
m4/c.m4 can go away with Autoconf 2.60 comes out.
2005-11-17 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_mark_helper): Make a `char *' parameter `const'.
(AD_mark_current_as_unremovable): Likewise, but for a local.
(rm_1): Likewise.
* tests/mv/acl: Let traps handle removing temporary directories.
Expect acl-related tests to fail, until the corresponding
patches are committed.
* tests/mv/Makefile.am (XFAIL_TESTS): Add acl.
* tests/cp/Makefile.am (XFAIL_TESTS): Likewise.
ACL tests, from Andreas Gruenbacher.
* tests/acl, tests/mv/acl, tests/cp/acl: New files.
* tests/mv/Makefile.am (TESTS): Add acl.
* tests/cp/Makefile.am (TESTS): Add acl.
* src/ls.c (basename_is_dot_or_dotdot): Correct wording in comment.
2005-11-16 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Improve quality of ln's diagnostics.
* src/ln.c (do_link, usage): Likewise.
(do_link): Don't use alloca on a buffer of unbounded size.
2005-11-16 Jim Meyering <jim@meyering.net>
* tests/cp/fail-perm: Accommodate HPUX. It appears to fail
with EACCES rather than EPERM. Reported by Peter O'Gorman here:
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/5766
This also affects AIX 4.3.3, according to Ralf Wildenhues, in
http://lists.gnu.org/archive/html/bug-coreutils/2006-05/msg00192.html
2005-11-14 Jim Meyering <jim@meyering.net>
* NEWS (sort): Mention consequences of today's mkstemp-safer.c fix.
2005-11-13 Jim Meyering <jim@meyering.net>
* announce-gen: Accept new option, --gpg-key-id=ID and
emit a blurb telling how to use the .sig files.
* Makefile.cfg (gpg_key_ID): Define.
* Makefile.maint (announcement): Use new option and key.
Require that most .c files include <config.h>.
* Makefile.maint (sc_require_config_h): New rule.
(syntax-check-rules): Add it.
* .x-sc_require_config_h: New file listing exceptions to the
above rule. Some are legit, others are simply grandfathered in.
* Makefile.am (EXTRA_DIST): Add .x-sc_require_config_h here, too.
2005-11-12 Jim Meyering <jim@meyering.net>
* src/checksum.h, src/md5.c, src/sha1sum.c: Remove now-unused files.
2005-11-11 Jim Meyering <jim@meyering.net>
* NEWS: Mention `readlink -f' bug fix in 5.3.0 news.
Mention new readlink options in 5.3.0's `New features' section.
Spotted by Thomas Hood.
2005-11-08 Jim Meyering <jim@meyering.net>
* NEWS: Merge in changes from b5_9x branch.
2005-11-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: ls now defaults to --time-style='locale', which in turn acts
like --time-style='posix-long-iso' if the locale settings are messed up.
* src/ls.c (decode_switches): Implement this.
2005-11-08 Jim Meyering <jim@meyering.net>
* tests/du/2g: s/expensive/very expensive/ in a comment.
From Paul Townsend.
2005-10-17 Eric Blake <ebb9@byu.net>
* src/ls.c (usage): Fix descriptions of --sort, --time.
Reported by Vitaly A. Ostanin.
2005-11-04 Paul Eggert <eggert@cs.ucla.edu>
* src/ln.c: Include filenamecat.c.
(FILE_BASENAME_CONCAT): Remove.
(do_link): Remove last arg DEST_IS_DIR. All callers changed.
(main): Use file_name_concat, base_name, and strip_trailing_slashes
instead of FILE_BASENAME_CONCAT. This simplifies the code, and avoids
the use of alloca.
2005-11-04 Jim Meyering <jim@meyering.net>
* src/du.c (process_file): Don't overflow for files of size >= 2^31
on systems with stat.st_blocks of a signed 32-bit type.
This bug causes trouble on some AIX 5.1 systems.
Report and trivial patch from Paul Townsend:
<http://lists.gnu.org/archive/html/bug-coreutils/2005-11/msg00033.html>
* NEWS: Mention this.
* tests/du/2g: New (very-expensive) test for the above-fixed bug.
* tests/du/Makefile.am (TESTS): Add it here.
* tests/very-expensive: New file.
* tests/Makefile.am (EXTRA_DIST): Add it here.
* tests/cp/perm: Mark this test as `very-expensive', too.
2005-11-02 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Mention that rm -d and maybe ln -d are scheduled for
removal in 2006.
* src/remove.h (struct rm_options): Remove unlink_dirs. All uses
removed.
* src/rm.c (usage): Don't mention rm -d.
2005-11-02 Jim Meyering <jim@meyering.net>
* tests/dd/skip-seek: Fix typo in comment: s/fileutils/coreutils.
From Andreas Schwab.
* tests/dd/unblock-sync: Redirect stderr to /dev/null so the
`M+N records in/out' lines don't pollute `make check' output.
* tests/dd/skip-seek (sk-seek4): New test, to exercise the bug
fixed on 2005-10-31. This test uses the new, IN_PIPE specifier.
* tests/Coreutils.pm: Accept a new type of input specifier: IN_PIPE,
to indicate that the input file should be piped into the command
under test (via `cat FILE | $prog ...').
* src/remove.c (remove_entry): Emit a better diagnostic when rm
(without -r) fails to remove a directory on a non-Linux system.
This change affects only newer Solaris systems (with priv_*
functions like priv_allocset). Reported by Keith Thompson.
* tests/rm/dir-nonrecur: New file/test for the above fix.
* tests/rm/Makefile.am (TESTS): Add dir-nonrecur.
2005-11-01 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "tail -c 2 FILE" and "touch 0101000000" now operate as
POSIX 1002.1-2001 requires.
* src/tail.c (parse_obsolete_option): Implement this.
Problem reported by Vincent Lefevre.
* src/touch.c (main): Pass PDS_PRE_2000 to posixtime.
* tests/tail/Test.pm (c-2, c-2-minus, c2, c2-minus): New tests.
(test_vector): Add special cases for _POSIX2_VERSION, and
regularize the old ones a bit.
* tests/touch/obsolescent: Add y2000 test.
2005-10-31 Paul Eggert <eggert@cs.ucla.edu>
* src/dd.c (skip): Fix off-by-one error reported by
Theodoros V. Kalamatianos.
2005-10-30 Paul Eggert <eggert@cs.ucla.edu>
* tests/mkdir/p-3: Require that the test be run as non-root.
Problem and trivial fix reported by Theodoros V. Kalamatianos.
2005-10-28 Paul Eggert <eggert@cs.ucla.edu>
* src/ln.c (FILE_BASENAME_CONCAT): Omit unnecessary slashes in the
boundary between DEST and SOURCE in the result.
2005-10-26 Dmitry V. Levin <ldv@altlinux.org>
* src/md5sum.c (main) [!O_BINARY]: Changed default read mode
back to text, to sync with documentation and for backwards
compatibility.
2005-10-25 Jim Meyering <jim@meyering.net>
* tests/dircolors/simple (other-wr): Add an explicit test for
the dircolors bug (NULL-dereference) fixed yesterday.
2005-10-24 Jim Meyering <jim@meyering.net>
* src/tac.c (tac_file): When determining whether a file is seekable,
also test whether it is a tty. Using only the lseek-based test would
give a false positive on Solaris. Reported by Peter Fales.
2005-10-24 Dmitry V. Levin <ldv@altlinux.org>
* tests/install/d-slashdot: New test, for "install -d" failure.
* tests/install/Makefile.am (TESTS): Add d-slashdot.
* tests/mkdir/p-slashdot: New test, for "mkdir -p" failure.
* tests/mkdir/Makefile.am (TESTS): Add p-slashdot.
2005-10-24 Jim Meyering <jim@meyering.net>
* src/dircolors.c (ls_codes): Add missing comma.
Anonymous report and patch from
http://savannah.gnu.org/bugs/?func=detailitem&item_id=14849
* src/dircolors.c: Add compile-time assertion that the slack_codes
and ls_codes arrays have the same number of elements. This would
have prevented the above-fixed bug.
* src/expand.c (parse_tab_stops): Add a comment to make this function
identical to the one in unexpand.c.
* src/unexpand.c (parse_tab_stops): Adjust syntax to make this function
identical to the one in expand.c.
* src/expand.c (next_file): Don't assume fopen cannot return stdin.
2005-10-23 Jim Meyering <jim@meyering.net>
* src/md5sum.c (digest_check, main): Use ptr_align rather than
a dangerous pointer-value-to-`unsigned' cast.
* NEWS: mention the new sha* programs.
* AUTHORS: Add new sha* programs.
2005-08-28 David Madore <david.madore@ens.fr>
Add new programs: sha224sum, sha256sum, sha384sum, sha512sum.
* README: Add their names to the list.
* src/md5sum.c: Provide framework for computing sha-2 hashes.
* src/Makefile.am (sha224sum, sha256sum, sha384sum, sha512sum):
Rules for compiling sha-2 utilities
(noinst_HEADERS): Remove checksum.h.
* man/sha512sum.x, man/sha384sum.x, man/sha256sum.x, man/sha224sum.x:
New files.
* man/Makefile.am (dist_man_MANS): Add the corresponding .1 names.
(sha224sum.1, sha256sum.1, sha384sum.1, sha512sum.1): New dependencies.
* tests/misc/sha224sum, tests/misc/sha256sum: New files.
* tests/misc/sha384sum, tests/misc/sha512sum: New files.
* tests/misc/Makefile.am (TESTS): Add new sha224sum, sha256sum,
sha384sum, sha512sum test scripts here rather that each in its
own directory.
2005-08-28 David Madore <david.madore@ens.fr>
* tests/sha1sum/basic-1 (million-a): Add the "million a's" test (one
of the FIPS test vectors).
2005-10-23 Jim Meyering <jim@meyering.net>
* configure.ac: Use 6.0-cvs as the version string.
* NEWS: Adjust accordingly.
2005-10-22 Jim Meyering <jim@meyering.net>
* Version 5.92.
* configure.ac: Remove -cvs suffix from version string.
* NEWS: Add today's date.
* tests/mkdir/writable-under-readonly: New test, neither run
nor distributed via tarballs.
2005-10-20 Jim Meyering <jim@meyering.net>
* tests/chmod/octal: New file/test, to exercise today's
lib/modechange.c fix.
* tests/chmod/Makefile.am (TESTS): Add octal.
* NEWS: Mention this chmod fix as well as the dircolors one.
2005-10-18 Paul Eggert <eggert@cs.ucla.edu>
* src/dircolors.c (append_quoted): Quote ' correctly.
Problem reported by Eric Blake.
2005-10-19 Jim Meyering <jim@meyering.net>
* tests/dircolors/simple (quote): Add test for the above fix.
2005-10-18 Jim Meyering <jim@meyering.net>
* tests/chgrp/basic: Add a comment explaining (probably) why this
test fails on OpenBSD 3.2 when run in an NFS-mounted directory.
2005-10-17 Jim Meyering <jim@meyering.net>
* configure.ac: Use 5.92-cvs as the version string.
* NEWS: Adjust accordingly.
* Makefile.maint (my-distcheck): Depend on
$(release_archive_dir)/$(prev-tgz) here, so that if it's missing
we fail earlier.
2005-10-16 Jim Meyering <jim@meyering.net>
* Version 5.91.
* Makefile.maint (VERSION_REGEXP): New variable.
(news-date-check, changelog-check): Use tighter regular expressions.
* configure.ac: Remove -cvs suffix from version string.
* NEWS: Add today's date.
* NEWS: Mention the `mkdir -p' bug fix.
2005-10-15 Jim Meyering <jim@meyering.net>
* src/who.c (usage): Undocument deprecated --idle (-i) option.
* src/df.c (main): Warn about the deprecated --kilobytes option.
* src/ls.c (decode_switches): Likewise.
* src/du.c (usage): Document -m, once again.
(main): Warn about use of deprecated long options:
--kilobytes and --megabytes.
* src/tail.c (parse_options): Remove --allow-missing option.
You can use --retry instead.
* src/stat.c (main): Remove --link -l options.
You can use --dereference (-L) instead.
2005-09-30 Eric Blake <ebb9@byu.net> (tiny change)
* man/Makefile.am (.x.1): Remove temp directory first.
* NEWS: Document dircolors change of 2005-09-05.
2005-10-07 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (sortlines_temp): Redo previous change, since I'm
no longer confident that the m4/stdbool.m4 patch suffices.
2005-10-06 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (sortlines_temp): Undo previous change, since
today's change to m4/stdbool.m4 should catch it.
2005-10-06 Jim Meyering <jim@meyering.net>
* TODO: rm: add support for a -I option, like that from FreeBSD's.
2005-10-05 Jim Meyering <jim@meyering.net>
* src/sort.c (sortlines_temp): Declare temporary as `int' rather
than `bool' to work around AIX 5.3 compiler bug in 64-bit mode.
From James Lemley.
2005-10-03 Jim Meyering <jim@meyering.net>
* src/factor.c (MAX_N_FACTORS): Define in terms of sizeof (uintmax_t)
rather than hard-coding to 128. From Thomas M.Ott.
2005-10-02 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_unmarked_diagnostics):
Search only cvs-controlled files.
* .x-sc_unmarked_diagnostics: New file.
* Makefile.am (EXTRA_DIST): Add it.
2005-10-01 Jim Meyering <jim@meyering.net>
* src/factor.c (main): Don't stop processing arguments upon
the first invalid one. Suggestion from Eric Blake
* tests/factor/basic: Add a test for this.
2005-09-30 Jim Meyering <jim@meyering.net>
* configure.ac: Use 5.91-cvs as the version string.
* NEWS: Adjust accordingly.
2005-09-29 Paul Eggert <eggert@cs.ucla.edu>
* src/dd.c (main): Don't assume size_t has the same width
as unsigned long. Problem reported by Eric Blake.
* NEWS: Clarify "tail - f" example.
2005-09-29 Jim Meyering <jim@meyering.net>
* Version 5.90.
* configure.ac: Remove -cvs suffix from version string.
* NEWS: Add today's date.
* NEWS: Mention this bug fix:
stat now exits nonzero if a file operand does not exist
2005-09-28 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (LONGEST_MODIFIER): Use ULONG_MAX_LT_ULLONG_MAX
instead of ULLONG_MAX, as the latter doesn't work with GCC 2.7.2.1.
2005-09-28 Jim Meyering <jim@meyering.net>
* configure.ac: Use 5.90-cvs as the version string, not 5.3.1-cvs.
* NEWS: Adjust accordingly.
* README: Remove note about FreeBSD make test failure.
2005-09-28 Paul Eggert <eggert@cs.ucla.edu>
* tests/install/trap: Work around a bug in FreeBSD 5.0.
2005-09-28 Jim Meyering <jim@meyering.net>
* README: Warn about a (now-)known problem on FreeBSD 5.0:
2005-09-26 Paul Eggert <eggert@cs.ucla.edu>
* src/touch.c (touch): Handle "touch -c - >&-" by checking for EBADF
and ENOSYS.
Do not pass "-" to futimens; pass NULL instead.
If close (STDIN_FILENO) fails, report the error separately instead
of letting the 'close' pollute errno.
* tests/touch/empty-file: Test "touch -" too.
* tests/touch/no-create-missing: Likewise.
* tests/touch/read-only: Likewise.
2005-09-26 Jim Meyering <jim@meyering.net>
* tests/touch/read-only: New test, for root of chmod/usage failure.
* tests/touch/Makefile.am (TESTS): Add read-only.
Work around the root cause of alpha-linux-1.sf.net test failure.
* tests/chmod/usage: Remove *all* files before each inner loop
iteration. Otherwise, with a touch program that fails on unwritable
files, (this happens at least on linux-2.2.20) a -w file left behind
from a previous iteration could cause a spurious test failure.
2005-09-25 Paul Eggert <eggert@cs.ucla.edu>
* tests/chmod/usage: Undo the s/files/file/ change, but add
comments about why the old version was desired.
2005-09-25 Jim Meyering <jim@meyering.net>
* tests/ls-2/tests (setuid-etc): Work around output mismatch when
a just-created test file cannot be made set-group-ID.
Avoid test failures on alpha-linux-1.sf.net.
* tests/chmod/usage: Use newer trap and tmpdir-creation framework.
Fix apparent typos (s/files/file/) in inner loop.
2005-09-24 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "touch -" now touches standard output.
* src/touch.c (touch): Implement this.
(usage): Document this.
* src/copy.c (HAVE_FCHMOD, HAVE_FCHOWN): Define to 0 if not defined.
(copy_reg): New args CHOWN_SUCCEDED and DST_SB. All callers changed.
Add a "goto close_src_and_dst_desc;" that was missing in the
previous patch.
(copy_reg) [HAVE_FCHOWN]: Prefer fchown to chown.
(copy_reg) [HAVE_FCHMOD]: Prefer fchmod to chmod.
(copy_internal): Don't invoke chown if fchown worked,
and likewise for chmod and fchmod.
2005-09-24 Jim Meyering <jim@meyering.net>
* src/shred.c: Use `#ifdef HAVE_CONFIG_H', not `#if HAVE_CONFIG_H',
for consistency with gnulib.
* src/dircolors.c: Likewise.
* Makefile.maint (sc_no_if_have_config_h): New rule.
(syntax-check-rules): Add it.
.x-sc_no_if_have_config_h: New file.
* Makefile.am (EXTRA_DIST): Add it.
* tests/seq/basic (eq-wid-1, eq-wid-2): Disable these tests for now.
They fail with non-gcc compilers and some combinations
of options and libraries on Solaris systems.
* tests/misc/date (uninit-64): Restore this test.
Add start-up code to detect, and work around, the cases in
which the test might fail.
2005-09-24 Paul Eggert <eggert@cs.ucla.edu>
* tests/misc/date (uninit-64): Remove this test. It wasn't
portable in theory (it doesn't work on hosts where 'int' is 64
bits, example) or in practice (Solaris 8 localtime returns garbage
in tm_year for the specified date, but that's not coreutils's
fault).
2005-09-23 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c (copy_reg): Preserve time stamps if
x->preserve_timestamps is set, using futimens so that
we needn't resolve the path again.
(copy_internal): Don't preserve time stamps if copy_reg did it
already.
* src/install.c (change_timestamps): First arg is source
struct stat, not file name. All uses changed.
(install_file_in_file): Stat the source file.
Don't try to change time stamps if copy_file did it.
* src/system.h: Don't include utime.h; not needed.
(struct utimbuf) [!defined HAVE_STRUCT_UTIMBUF]: Remove; not needed.
2005-09-23 Jim Meyering <jim@meyering.net>
* src/od.c: Use `verify' to ensure that our hard-coded
bytes_to_*_digits arrays are long enough. Of course, 17+-byte
integral types aren't on the near horizon, but just in case...
(MAX_INTEGRAL_TYPE_SIZE): Move definition to precede new first use.
(bytes_to_oct_digits, bytes_to_signed_dec_digits):
(bytes_to_unsigned_dec_digits, bytes_to_hex_digits): Change base
type from `char' to the clearer `unsigned int'.
2005-09-21 Paul Eggert <eggert@cs.ucla.edu>
* src/rmdir.c (EEXIST, ENOTEMPTY): Remove unused macros.
Sync from gnulib.
* src/dircolors.c: Include strcase.h.
* src/pinky.c: Include canon-host.h rather than declaring
canon_host ourselves.
* src/who.c: Likewise.
* src/system.h (X2NREALLOC, X2REALLOC): Moved here from
../lib/xalloc.h, with args properly parenthesized, and using
verify_expr rather than the old VERIFY_EXPR.
2005-09-21 Jim Meyering <jim@meyering.net>
* tests/install/basic-1: Require that this test be run as non-root.
Otherwise, it fails due to the fact that the chmod 0 . doesn't
affect root.
2005-09-20 Jim Meyering <jim@meyering.net>
* src/remove.c (write_protected_non_symlink): Change comment to
agree with the code.
2005-09-19 Jim Meyering <jim@meyering.net>
* src/remove.c (remove_dir): Return RM_ERROR, not `1',
when attempting to remove `/' with --preserve-root.
* src/remove.c (remove_cwd_entries): Syntactic tweak: move an
assignment out of an if-expression.
2005-09-17 Jim Meyering <jim@meyering.net>
* src/extract-magic (usage): Request that additions be sent to
bug-coreutils@gnu.org, too.
2005-09-16 Jim Meyering <jim@meyering.net>
* tests/misc/date (rfc822-1): Compensate for Solaris 5.9's /bin/sh,
which emits a diagnostic to stderr when this test's LC_ALL=de_DE
setting cannot be honored.
* tests/misc/date (subfmt-up1): Put quotes around format string
to protect `^' from interpretation by some shells.
Add a use of OUT_SUBST to compensate for Solaris strftime's slightly
different formatting of %c.
* src/dd.c (main): When failing to truncate, mention both the seek
block count and the block size, in case the block size is very large.
Now `make distcheck' should pass, once again.
2005-09-16 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c: Include stat-time.h.
(copy_internal): Use its functions instead of the obsolete
TIMESPEC_NS macro.
* src/cp.c (re_protect): Likewise.
* src/date.c (main): Likewise.
* src/du.c (struct duinfo, duinfo_init, duinfo_set, duinfo_add):
(show_date, print_size, process_file): Likewise.
* src/install.c (change_timestamps): Likewise.
* src/ls.c (cmp_ctime, cmp_mtime, cmp_atime, print_long_format):
Likewise.
* src/pr.c (init_header): Likewise.
* src/stat.c (human_time, print_stat): Likewise.
* src/tail.c (record_open_fd, tail_forever): Likewise.
* src/test.c (get_mtime, binary_operator): Likewise.
* src/touch.c (touch, main): Likewise.
* src/test.c (get_mtime): Renamed from age_of. All uses changed.
2005-09-16 Jim Meyering <jim@meyering.net>
Date no longer needs to allocate virtual memory to do its job,
so it can no longer fail due to an out-of-memory condition.
* src/date.c: Include fprintftime.h.
Don't include strftime.h or xanstrftime.h -- no longer needed.
(show_date): Use new fprintftime function rather than xanstrftime.
Correct comment: this function no longer handles a NULL format string.
* src/du.c: Likewise.
* NEWS: Mention this.
* tests/misc/date (subfmt-up1): Test the combination of the
to-upper-case modifier (^) and a conversion specifier that
expands to a string containing lower case characters.
2005-09-15 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: uname -a no longer generates the -p and -i outputs if they
are unknown.
* src/uname.c (usage): Document this.
(main): Implement this.
2005-09-14 Jim Meyering <jim@meyering.net>
* tests/misc/date (tz-5w, tz-5wf): Test new %:z format with
a field width.
2005-09-13 Paul Eggert <eggert@cs.ucla.edu>
* src/dd.c: Detect some very unlikely buffer overflows.
(INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP): New macros.
(MAX_BLOCKSIZE): Now accepts an arg. All uses changed.
(page_size): New var.
(scanargs, skip, main): Use more-straightforward way to detect overflow.
(dd_copy): Use page_size rather than invoking getpagesize.
Use INPUT_BLOCK_SLOP, OUTPUT_BLOCK_SLOP.
(main): Set page_size.
Avoid a call to stat in the usual case where ftruncate succeeds.
* src/expr.c (docolon): Add IF_LINT check to avoid GCC warning.
* configure.ac: Don't invoke AC_CONFIGURE_HOST directly; AB_INIT
does it for us, and our invocation evokes a diagnostic from
Autoconf 2.59.
* NEWS: date has a new --rfc-3339 option, and the old --iso-8601
option is deprecated. date, du, ls, and pr also have new time format
specifiers %:z, %::z, %:::z.
* src/date.c (TIME_SPEC_DATE): No longer needs to be nonzero, so
remove the "=1".
(TIME_SPEC_HOURS, TIME_SPEC_MINUTES): Must be at end now, so put
them there.
(time_spec_string, time_spec): Hours and minutes must be at
start now, so put them there.
(rfc_2822_format): Now a string constant, not a boolean. All uses
changed.
(iso_8601_format, rfc_format): Remove.
(RFC_3339_OPTION): New constant.
(long_options): Add --rfc-3339.
(usage): Add --rfc-3339. Don't mention --iso-8601.
Mention %:z, %::z, %:::z.
(main): Simplify calculation of 'format'; it was getting too hairy
to follow. Add --rfc-3339.
(show_date): Assume format arg is not NULL, which is the case
now. The default code is moved to 'main'. This simplifies things
and allows the default to be calculated just once.
* tests/misc/date: Add tests for --rfc-3339, %:z, %::z, %:::z.
2005-09-13 Jim Meyering <jim@meyering.net>
* Makefile.maint (GZIP_ENV): Add --rsyncable option.
(makefile-check): Escape a `$' in a diagnostic.
* configure.ac: Use AB_INIT (from autobuild).
2005-09-11 Jim Meyering <jim@meyering.net>
* src/factor.c (usage): Remove leading spaces in 2-line
description, so that help2man doesn't mangle it.
Reported by Justin Pryzby.
2005-09-10 Jim Meyering <jim@meyering.net>
csplit could produce corrupt output, given input lines longer than 8KB
* src/csplit.c (load_buffer): Don't read from free'd memory
when handling lines longer than the initial buffer length.
(save_to_hold_area): Don't leak the previous hold_area buffer.
Reported by Tristan Miller and Luke Kendall.
* NEWS: Mention this.
* tests/misc/csplit: New test for this.
* src/csplit.c (load_buffer): Avoid integer overflow in buffer
size calculations for very long lines.
2005-09-09 Paul Eggert <eggert@cs.ucla.edu>
Support regular expressions in 64-bit code correctly, by
importing the latest gnulib regexp code, and not assuming
that sizes fit in 32 bits.
* src/csplit.c (process_regexp): Store match length in regoff_t,
not int. Assume that negative return values less than -2
represent regoff_t overflow.
* src/expr.c (docolon): Likewise.
* src/nl.c (proc_text): Likewise.
* src/ptx.c (SKIP_SOMETHING, find_occurs_in_text): Likewise.
* src/tac.c (tac_seekable): Likewise.
* src/expr.c (docolon) Check for size calculation overflow.
* src/nl.c (build_type_arg): Likewise.
* src/ptx.c (matcher_error): New function.
(SKIP_SOMETHING): Use it to report matcher errors.
(alloc_and_compile_regex): No longer any need to worry about
int versus size_t mismatch.
* NEWS: Document "niceness" vs "nice value".
* configure.ac (utils_cv_func_setpriority): Simplify the tests.
Define HAVE_NICE rather than NICE_PRIORITY (since a niceness is
not a priority); all uses changed.
* src/nice.c (main): Hoist errno=0 outside the ifdef.
2005-09-09 Jim Meyering <jim@meyering.net>
* tests/misc/date (neg-secs2, fill-1, fill-2): Add new tests.
2005-09-07 Paul Eggert <eggert@cs.ucla.edu>
Use the phrase "niceness" instead of "nice value" to describe
the biased nice value that can go negative. This corrects
a discrepancy with POSIX, which states that nice values are
nonnegative.
* src/nice.c (GET_NICENESS): Renamed from GET_NICE_VALUE.
All uses changed.
(usage): Say "niceness" rather than "nice value".
(main): Say "niceness" rather than "priority" (which is something else
entirely nowadays).
2005-09-07 Jim Meyering <jim@meyering.net>
* src/du.c (time_args): Use NULL in place of 0.
2005-09-05 Jim Meyering <jim@meyering.net>
* src/dcgen: Don't omit comments until there is better documentation.
Colorize set-user-ID and set-group-ID files and sticky,
other-writable, and sticky-and-other-writable directories.
* src/dircolors.c (slack_codes): Add new dircolors mode names.
(ls_codes): Add corresponding two-letter ls mode strings.
* src/ls.c (indicator_no[]): Add new symbols.
(indicator_name[]): Add corresponding mode strings.
(color_indicator[]): Add an entry for each new mode string.
(print_color_indicator): Honor new types.
* src/dircolors.hin: Document the default colors for the new strings.
From Mike Frysinger, based on a patch from Fedora.
* tests/ls-2/tests (setuid-etc): New test, for the above.
2005-08-29 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "rm -FOO" now suggests "rm ./-FOO" if the file "-FOO"
exists and "-FOO" is not a valid option.
* src/rm.c: Include lstat.h, quotearg.h.
(diagnose_leading_hyphen): New function.
(main): Use it.
2005-08-27 Jim Meyering <jim@meyering.net>
* src/du.c: Go ahead and leave the patch in (i.e., revert
today's change). It doesn't cause a problem after all, since
--exclude-from=- is always handled before --files0-from=F.
* src/du.c: Revert the du.c part of the change from 2005-07-02:
That change (to reopen stdin on F for --files0-from=F) made it so
--exclude-from=- and --files0-from=F would not work together.
2005-08-23 Jim Meyering <jim@meyering.net>
* configure.ac: Use `5.3.1-cvs' as the version string.
* NEWS: Adjust accordingly.
* Makefile.maint (sc_useless_cpp_parens): New rule.
(syntax-check-rules): Add it.
* .x-sc_useless_cpp_parens: New file.
* Makefile.am (EXTRA_DIST): Add it.
* src/od.c: Include <float.h> unconditionally.
* src/uptime.c (print_uptime): Remove unnecessary parens in
`#if defined (SYMBOL)' expressions.
* src/system.h: Likewise.
* src/hostname.c: Likewise.
* src/su.c: Likewise.
* src/test.c: Likewise.
2005-08-22 Jim Meyering <jim@meyering.net>
* src/tail.c (xwrite_stdout): Rename from xwrite. Remove always-
equal-to-STDOUT_FILENO parameter and associated assertion.
Adjust all callers.
2005-08-21 Jim Meyering <jim@meyering.net>
* src/ln.c (do_link): If ln is invoked with --interactive (-i),
encounters an existing destination file, and gets an affirmative
response, then first try to unlink the destination file rather
than simply failing. Suggestion from Karl Berry.
FIXME: add test for this
* src/ln.c (main): Declare `target_directory' with const attribute.
* src/du.c (time_style): Add `const' attribute.
(tot_dui): Remove unnecessary (and too-short) initializer list.
2005-08-19 Jim Meyering <jim@meyering.net>
* src/sort.c (usage) [-b,-t]: Ensure that there are at least two
spaces between each option and the corresponding description -- this
lets help2man format entries properly. Reported by Edward Welbourne.
2005-08-17 Jim Meyering <jim@meyering.net>
* src/sort.c (usage): Fix typo s/POS 2/POS2/.
Reported by Edward Welbourne.
* tests/misc/date [neg-secs]: New test for today's strftime.c bug fix.
* tests/misc/date: Remove terminating "\n"s once again.
Automatically add them whenever EXIT != 0.
2005-08-16 Paul Eggert <eggert@cs.ucla.edu>
* src/df.c (show_dev): New arg STAT_FILE. All uses changed.
This sometimes gives better results on networked file systems
that do not respect POSIX semantics. Problem reported by
Bruno Haible.
2005-08-15 Jim Meyering <jim@meyering.net>
Don't print uninitialized data (or anything else) to stdout
upon localtime failure.
* src/date.c (show_date): Remove stray `puts (buf);' (debugging?)
from the 2004-02-02 change.
* tests/misc/date (uninit-64): New test for the above.
Rewrite all other OUT strings to include the terminating "\n".
2005-08-14 Jim Meyering <jim@meyering.net>
* src/md5sum.c (usage): Fix typo s/formated/formatted/ reported
by Norbert Kiesel.
Use one fewer file descriptor in a common case.
* src/touch.c: Include "fd-reopen.h", rather than "fcntl--.h".
Use fd_reopen rather than open.
2005-08-14 James Youngman <jay@gnu.org>
* src/test.c (age_of): Return the nanoseconds part of the timestamp,
if available.
(binary_operator) [-nt, -ot]: Use nanosecond values to break ties.
2005-08-14 Jim Meyering <jim@meyering.net>
* src/ls.c (long_time_expected_width): Revert last change, just to
be paranoid, and add a comment explaining why. Paul Eggert mentioned
the possibility.
* src/wc.c: Don't define mbrtowc at all.
If mbstate_t is not defined, then AC_TYPE_MBSTATE_T will define
it to `int' for us. Now wc.c really does compile on HP-UX 11.23.
2005-08-13 Jim Meyering <jim@meyering.net>
* tests/date: Remove directory
* tests/Makefile.am (SUBDIRS): Remove date.
* configure.ac (AC_CONFIG_FILES): Remove tests/date/Makefile.
* tests/Coreutils.pm: New keywords, ENV and ENV_DEL, to support
tests/misc/date.
With todays additions, the generated shell script,
tests/date/date-tests had becoming far too large (over 350KB),
so use the superior-but-perl-requiring framework instead.
* tests/date/Test.pm: Move all tests from here...
* tests/misc/date: ...to this new file.
* tests/misc/Makefile.am (TESTS): Add date.
* tests/date/Test.pm (test_vector) [cross-dst]: New test for
just-fixed getdate.y bug.
* tests/date/Test.pm (test_vector): Add 364 more tests like the above.
Remove unused $sunos4 variable.
2005-08-12 Jim Meyering <jim@meyering.net>
* src/nohup.c (main): Explain why we reopen stdin for write-only access.
* src/ls.c (long_time_expected_width): Don't test for failed localtime.
That cannot happen when the result date's year is in range.
Add an assertion instead.
* src/ls.c (sort_files): Use cleaner `sizeof *VAR_NAME'
rather than `sizeof (TYPE_NAME)'.
* src/ptx.c (sort_found_occurs, digest_word_file): Likewise.
(alloc_and_compile_regex): Likewise.
* src/wc.c: Test `!defined HAVE_MBSTATE_T' rather than
`defined mbstate_t' to detect missing support for mbstate_t.
The latter didn't work for HP-UX 11.23.
Add bulletproofing in case stdin is closed.
* src/dircolors.c (have_read_stdin): Remove global variable.
(dc_parse_stream): Always use stdin (freopen, if needed) rather
than sometimes using fopen to get a new file descriptor.
Call fclose unconditionally.
(main): Don't close stdin here. If needed, now it's already done
by dc_parse_stream.
* src/dircolors.c (dc_parse_file): Remove comment about
now-removed OPENOPTS.
* src/fold.c (fold_file): Cosmetic: use X2REALLOC rather than x2realloc.
* src/pr.c (main): Likewise.
* src/csplit.c (new_control_record): Cosmetic: use X2NREALLOC (only
two arguments) rather than x2nrealloc (with three).
* src/cut.c (ADD_RANGE_PAIR): Likewise.
* src/expand.c (add_tab_stop): Likewise.
* src/join.c (extract_field, getseq): Likewise.
* src/od.c (decode_format_string): Likewise.
* src/sort.c (add_temp_dir): Likewise.
* src/unexpand.c (add_tab_stop): Likewise.
* src/pr.c (main): Cosmetic: use '\0' in place of 0.
2005-08-02 Jim Meyering <jim@meyering.net>
* src/date.c: Include "xanstrftime.h".
(show_date): Use xanstrftime instead of open-coding it.
* src/du.c: Likewise.
2005-07-29 Jim Meyering <jim@meyering.net>
* src/date.c (show_date): Remove now-unnecessary code that
treated an empty format string as a special case.
* tests/date/Test.pm (empty-format): New test, for this case.
2005-07-19 Jim Meyering <jim@meyering.net>
* src/md5sum.c (usage): Adjust printf argument list to match
new format string.
2005-07-19 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: md5sum --check now accepts multiple input files, and
similarly for sha1sum. Extension suggested by Chris Girling.
* src/md5sum.c (usage, main): Support this new usage.
2005-07-18 Paul Eggert <eggert@cs.ucla.edu>
Fix a problem noted by James Youngman: VPATH-style builds don't
work because of po file problems.
* src/Makefile.am (BUILT_SOURCES): Remove false.c.
(false.c): Remove; it's now a source file.
* src/false.c: New file.
* src/true.c (EXIT_STATUS): New macro.
(PROGRAM_NAME, usage): Behave like "false" if EXIT_STATUS indicates.
(usage): Remove "These option names may not be abbreviated."
2005-07-15 Paul Eggert <eggert@cs.ucla.edu>
* src/nohup.c (main): Don't worry about POSIXLY_CORRECT. Today's
Austin Group Minutes says that the GNU behavior will be put
forward as proposed text for a future revision.
2005-07-13 Paul Eggert <eggert@cs.ucla.edu>
* src/Makefile.am (nanosec_libs): Remove $(FESETROUND_LIBM); no longer
needed. Problem reported by Jeff Bailey.
2005-07-12 Jim Meyering <jim@meyering.net>
* Makefile.maint (copyright-check): Reflect rearrangement in
version-etc files.
2005-07-11 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Binary input and output are now implemented more consistently.
These changes affect only platforms like MS-DOS that distinguish
between binary and text files.
* src/cat.c (usage, main, long_options) [O_BINARY]:
Remove support for -B. Use same rules as other programs to decide
whether to use binary I/O, except that the -bensAE options always
select text mode.
* src/cat.c (main): Avoid setmode; use POSIX-specified routines instead.
* src/cksum.c (cksum): Likewise.
* src/head.c (head_lines, head_file): Likewise.
* src/od.c (open_next_file): Likewise.
* src/split.c (main): Likewise.
* src/sum.c (bsd_sum_file, sysv_sym_file): Likewise.
* src/tac.c (copy_to_temp, tac_file, main): Likewise.
* src/tail.c (tail_bytes, tail_lines, tail_file, main): Likewise.
* src/tee.c (tee): Likewise.
* src/tr.c (main): Likewise.
* src/wc.c (wc): Likewise.
* src/copy.c (copy_reg): Always copy in binary mode.
* src/expand.c (expand): Always copy in text mode. POSIX says
the input and output must be text.
* src/unexpand.c (unexpand): Likewise.
* src/head.c (elide_tail_bytes_file, elide_tail_lines_file, head_bytes):
(head_lines, head_file): Always use binary mode except for std tty.
* src/md5sum.c (usage): Clarify whether text or binary is the default.
(split_3, main): BINARY is now a 3-way value. All uses changed.
(digest_file): Likewise. Clear *BINARY if we determine the file
to be text. All uses changed.
(main): Don't report a file to be binary if we actually read it
as text in MS-DOS, because it was a terminal.
* src/shred.c (wipefile): Always use binary mode. Clearly this
never worked right on DOS!
* src/system.h (setmode, fileno): Remove; no longer needed, we think.
(SET_MODE, SET_BINARY, SET_BINARY2): Remove.
[defined __DJGPP__]: Don't include <io.h> or <sys/exceptn.h>.
* src/wc.c (wc_file): FILE might be null now.
(main): Simplify code a bit, so that fewer places need the
setmode fixes.
2005-07-09 Paul Eggert <eggert@cs.ucla.edu>
* src/comm.c, src/csplit.c, src/dd.c, src/join.c, src/md5sum.c:
* src/pr.c, src/sort.c, src/tee.c:
Don't include stdio.h; no longer needed.
2005-07-08 Paul Eggert <eggert@cs.ucla.edu>
Fix porting problems reported by Eric Blake.
* configure.ac: Remove check for AC_HEADER_TIOCGWINSZ.
* src/cat.c, src/ls.c, src/stty.c: Include stropts.h if available,
because POSIX says that's where ioctl is declared.
* src/cat.c: Use HAVE_SYS_IOCTL_H instead of _POSIX_SOURCE
to decide whether to include <sys/ioctl.h>.
* src/stty.c: Use only HAVE_SYS_IOCTL_H to decide whether
to include <sys/ioctl.h>.
* src/id.c (print_user): Don't assume uid fits in unsigned int.
(print_group): Likewise, for gid.
2005-07-05 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (DECIMAL_DIGIT_ACCUMULATE): Generate a hard error
(not just a warning) if GCC is used and the types don't match.
2005-07-04 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (VERIFY_W_TYPEOF): Remove; no longer needed.
(DECIMAL_DIGIT_ACCUMULATE): Change last arg from T's maximum value
to T itself. All callers changed. Check that T is unsigned, and
that Accum is of type T. This fixes a bug in the unlikely case
where SIZE_MAX <= INT_MAX, and it no longer requires typeof to do
the proper validity checks.
* src/od.c: Adjust to verify.h change.
* src/system.h (VERIFY_W_TYPEOF): Likewise.
2005-07-04 Jim Meyering <jim@meyering.net>
* src/system.h: Include "verify.h".
* src/system.h (verify): Rename from VERIFY_EXPR, to be lower case,
like assert. Use sizeof, rather than equivalent ((...)0), for
it's slightly simpler syntax. Suggestions from Paul Eggert.
(verify_decl): Rename from VERIFY.
* src/od.c: Reflect name change.
2005-07-03 Jim Meyering <jim@meyering.net>
* NEWS: cp and mv: the --reply=X option is deprecated
Suggested by Bob Proulx, after numerous user complaints
about how --reply=no appeared not to work.
* src/mv.c (main): Using --reply now evokes a warning.
(usage): Remove description of --reply.
* src/cp.c (main): Using --reply now evokes a warning.
(usage): Remove description of --reply.
* tests/mv/i-link-no: Adjust for new diagnostic.
* tests/mv/reply-no: Likewise.
* src/printf.c (verify_numeric): Rename from verify.
Update caller.
2005-07-03 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.h: Include "lstat.h" rather than rolling our own.
* src/ls.c: Likewise.
* src/remove.c: Likewise.
2005-07-02 Paul Eggert <eggert@cs.ucla.edu>
Cleanup to isolate "safer" functions to a small part of the code.
* src/comm.c: Include stdio--.h, not stdio-safer.h.
(compare_files): Use fopen, not fopen_safer.
* src/copy.c: Include fcntl--.h, not unistd-safer.h.
(copy_reg): Don't call fd_safer; no longer needed
now that we include fcntl--.h.
* src/csplit.c: Include fd-reopen.h.
Include stdio--.h, not stdio-safer.h.
(input_desc): Remove. All uses changed to STDIN_FILENO.
(set_input_file): Reopen stdin, to simplify code.
(create_output_file): Use fopen, not fopen_safer.
* src/dd.c: Include fd-reopen.h.
(open_fd): Remove. All callers changed to use fd_reopen instead.
* src/join.c: Include stdio--.h, not stdio-safer.h.
(main): Use fopen, not fopen_safer.
* src/md5sum.c: Include stdio--.h.
(digest_check): Don't try to read both checksums and data from stdin.
* src/nohup.c: Include fd-reopen.h.
Include unistd--.h, not unistd-safer.h.
(main): Use fd_reopen to simplify code. When replacing stdin,
use "/dev/null" not "/", as that's less likely to go wrong these days.
(main): Use dup, not dup_safer.
* src/pr.c: Include stdio--.h, not stdio-safer.h.
(open_file): Invoke fopen, not fopen_safer.
* src/shred.c: Include fcntl--.h, not unistd-safer.h.
(wipename, wipe_file): Don't use fd_safer; no longer needed
now that we include fcntl--.h.
* src/sort.c: Include stdio--.h rather than stdio-safer.h.
Include stdlib--.h. Do not include unistd-safer.h.
(create_temp_file): Don't call fd_safer; no longer needed
now that we include *--.h files.
(xfopen): Don't call fopen_safer, for similar reasons.
* src/split.c: Include fcntl--.h rather than unistd-safer.h.
Include fd-reopen.h.
(input_desc): Remove. All uses replaced by STDIN_FILENO.
(cwrite): Don't call fd_safer; no longer needed now that
we include fcntl--.h.
(main): Reuse stdin rather than opening a new one. This
saves a file descriptor.
* src/stty.c: Include fd-reopen.h.
(display_all, display_settings, display_window_size, set_window_size):
Remove fd arg, since we now assume stdin. All callers changed.
(main): Reuse stdin rather than opening a new one. This
saves a file descriptor.
* src/tac.c: Include stdlib--.h rather than unistd-safer.h.
(copy_to_temp): Don't call fd_safer; no longer needed now
that we include stdlib--.h.
* src/tail.c: Include fcntl--.h, not unistd-safer.h.
(recheck, tail_file): Don't call fd_safer; no longer needed
now that we include fcntl--.h.
* src/tee.c: Include stdio--.h, not stdio-safer.h.
(tee): Don't call fopen_safer; no longer needed now that we
include stdio--.h.
* src/touch.c: Include fcntl--.h, not unistd-safer.h.
(touch): Don't call fd_safer; no longer needed now that
we include fcntl--.h.
* src/du.c (main): Reuse stdin rather than opening a new stream.
This saves a file descriptor.
* src/uniq.c: Don't include stdio-safer.h; no longer needed.
(writeline): Remove stream arg; we now always output to stdout.
All callers changed.
(check_file): Reuse stdout rather than opening a new stream.
This saves a file descriptor.
2005-07-02 Jim Meyering <jim@meyering.net>
* Makefile.maint (sc_obsolete_symbols): New rule.
(syntax-check-rules): Add it to the list.
* Makefile.am (EXTRA_DIST): Add .x-sc_obsolete_symbols.
* .x-sc_obsolete_symbols: New file.
2005-07-01 Jim Meyering <jim@meyering.net>
* src/system.h: Assume HAVE_FCNTL_H (i.e., include <fcntl.h>
unconditionally, and don't include <sys/file.h>).
* src/system.h: Likewise for HAVE_UNISTD_H.
2005-06-30 Jim Meyering <jim@meyering.net>
* src/cp.c: Add uses of ARGMATCH_VERIFY to ensure that
corresponding option string and value arrays are consistent.
* src/date.c: Likewise.
* src/du.c: Likewise.
* src/ls.c: Likewise.
cp.c and date.c each had a harmless trailing `, 0' (now-removed)
in a value list.
* src/system.h (VERIFY): Guard definition with #ifndef.
(VERIFY_EXPR): Undef before defining.
2005-06-29 Jim Meyering <jim@meyering.net>
* src/pr.c (main, store_char): Use X2REALLOC rather than x2realloc.
* src/du.c (show_date): Likewise.
* src/date.c (show_date): Likewise.
* src/od.c (dump_strings): Likewise.
* src/sort.c (fillbuf): Likewise.
* src/chmod.c (main): Likewise.
* src/system.h (VERIFY): Rewrite to use string-concatenation
and __LINE__ so as not to require a struct name parameter.
(GL_CONCAT, GL_CONCAT2): Define helper macros.
* src/od.c: Update sole use.
* src/ls.c (gobble_file): Use stat.st_author, not stat.st_uid
when computing the --author column width. This bug might have
resulted in misaligned columns when using the --author option
on the Hurd. Spotted by Arnold Robbins.
2005-06-28 Jim Meyering <jim@meyering.net>
* src/pr.c (main, store_char): Use x2realloc on 1-byte base types,
not x2nrealloc. The former is a little more concise and readable.
N.B. this sort of transformation is ok only when the base type is
unlikely ever to change to a multibyte type.
* src/du.c (show_date): Likewise.
* src/date.c (show_date): Likewise.
* src/od.c (dump_strings): Likewise.
* src/sort.c (fillbuf): Likewise.
2005-06-24 Jim Meyering <jim@meyering.net>
* src/mv.c (usage): Clarify how --reply=no works.
2005-06-23 Paul Eggert <eggert@cs.ucla.edu>
Address the following "du" issues:
- The option name "--last-time=TYPE" is different from the ls's option
"--time=TYPE" with a similar meaning. I assume this wasn't intended.
- --time-style implies --time, but this is not true for "ls". It's
better to be consistent.
- Since we don't have POSIX compatibility concerns, there's no need
for the "posix-" styles, or for support of styles with newlines, or
for the "locale" style, except for parsing the TIME_STYLE
environment variable.
- It's cleaner (and these days, no less efficient) to use functions
rather than macros when possible.
- struct duinfo doesn't need a 'valid' flag; you can simply use a time
stamp that is less than all valid time stamps.
- The code needs a bit of reformatting to fit the usual GNU style.
* NEWS: du's --last-time option is now --time.
* doc/coreutils.texi (ls invocation): Fix typo: --time=use is
equivalent to --time=atime, not --time=ctime.
(ls invocation, du invocation): Fix typo: --time-style=long-iso
is equivalent to a time style with a leading "+".
(du invocation): --last-time is now --time.
--time-style no longer implies --time.
The locale and posix- stuff now works only for TIME_STYLE, not
for --time-style. Give equivalent format for --time-style=iso.
* src/du.c: Do not include hard-locale.h.
(struct duinfo): Remove 'valid' member. All uses changed to use
negative nsec instead.
(DUIINFO_INI, DUINFO_SET, DUINFO_ADD): Remove.
(duinfo_init, duinfo_set, duinfo_add): New functions, taking the
role of the removed macros.
(opt_time): Renamed from opt_last_time. All uses changed.
(TIME_OPTION): Renamed from LAST_TIME_OPTION. All uses changed.
(long_options, usage): Rename --last-time to --time.
(locale_time_style): Remove.
(time_style_args, time_style_types, usage): Remove support for
--time-style=locale.
(show_date): Now returns void, since nobody looked at the result.
Assume FORMAT is not null. An empty FORMAT now outputs an empty time.
Simplify nstrftime invocation.
(main): Put in ls compatibility workarounds only for TIME_STYLE,
not for --time-style. Omit unnecessary space in iso time style.
2005-06-23 Jim Meyering <jim@meyering.net>
* src/du.c (time_format): Add `const' attribute.
* src/date.c (show_date): Use puts rather than printf ("%s\n",.
* src/du.c (show_date): Rename local `time_format' so as not to
shadow the file-scoped global by that name.
(show_date): Add a FIXME comment.
* src/du.c: Include hard-locale.h and strftime.h.
(DUINFO_INI, DUINFO_SET, DUINFO_ADD):
Enclose body in `do {...} while (0)', not just `{...}'.
Adjust uses (add semicolons).
Adjust formatting, indentation.
(usage): Tweak formatting to maintain more or less constant indentation.
2005-06-14 William Brendling <wbrendling@gmail.com>
* src/du.c: Add --last-time and --time-style options.
2005-06-22 Paul Eggert <eggert@cs.ucla.edu>
* tests/umask-check: New file.
* tests/Makefile.am (EXTRA_DIST): Add umask-check.
* tests/mkdir/perm: Use umask-check.
* tests/cp/cp-parents: Likewise, instead of using chmod
as described below. Problem reported by Kevin Mudrick.
2005-06-22 Jim Meyering <jim@meyering.net>
Make rmdir produce diagnostics like this:
rmdir: /tmp: Permission denied
not like this:
rmdir: `/tmp': Permission denied
* src/rmdir.c: Include "quotearg.h", not "quote.h".
(remove_parents, main): Use quotearg_colon, not quote.
2005-06-22 Paul Eggert <eggert@cs.ucla.edu>
* tests/cp/cp-parents: Use chmod to work around some hosts with
ACL problems. Problem reported by Kevin Mudrick.
2005-06-21 Jim Meyering <jim@meyering.net>
* tests/du/deref-args: Use --apparent-size to avoid the vagaries
of counting blocks. Kevin Mudrick reported that this test would
fail on an nfs-mounted directory where attribute-caching is
turned on.
2005-06-19 Jim Meyering <jim@meyering.net>
* src/tac.c (tac_mem, tac_stdin_to_mem): Remove #if-0'd functions.
* src/shred.c (usage): Use `file system', not `filesystem'.
2005-06-18 Jim Meyering <jim@meyering.net>
* src/tr.c (unquote): Remove unnecessary `' quotes from a diagnostic.
2005-06-17 Jim Meyering <jim@meyering.net>
* src/shred.c (usage): Clarify that shred works on an ext3 file
system as long as it's not in data=journal mode.
Tiny change by Mark Melahn.
2005-06-16 Paul Eggert <eggert@cs.ucla.edu>
* src/hostid.c (main): Don't print fewer than 8 digits, or spurious
leading "f"s. "f" problem reported by Tim Waugh.
* NEWS: Document this.
2005-06-16 Jim Meyering <jim@meyering.net>
Don't embed `this'-style quotes in format strings.
* src/tr.c: Rather than this: error (..., "...`%s'...", arg);
do this: error (..., "...%s...", quote (arg));
* src/od.c, src/tr.c, src/csplit.c, src/date.c, src/hostname.c:
* src/join.c, src/ptx.c, src/seq.c, src/sort.c, src/split.c:
* src/split.c, src/tail.c: Likewise.
* src/sleep.c: Include "quote.h". Remove hard-coded quotes, as above.
* src/nice.c, src/printf.c, src/fold.c, src/pr.c: Likewise.
* src/factor.c, src/cat.c, src/expr.c, src/stty.c: Likewise.
* src/mv.c: Finally remove support for --version-control=S (-V).
It was deprecated nearly 6 years ago and has been warning
users to switch to --backup=S since fileutils-4.0j.
* src/cp.c, src/install.c, src/ln.c: Likewise.
2005-06-15 Jim Meyering <jim@meyering.net>
* src/install.c (main): Fix my typo: s/argv[optind]/file[i]/.
* tests/install/basic-1: Ensure that each `-d'-specified directory
is created. Ensure that rel-named dirs are not created when
chdir($PWD) fails.
* tests/mkdir/p-3: Add a test for just-fixed bug in mkdir-p.c.
2005-06-14 Paul Eggert <eggert@cs.ucla.edu>
Improve diagnostics for restore_cwd failure.
* src/install.c (main): Standardize on a diagnostic for
restore_cwd failure, and report errno.
(install_file_in_file_parents): Fail if restore_cwd fails and
one of the files is relative. This fixes a bug (albeit unlikely).
* src/mkdir.c (create_parents): Remove static var (now local to 'main').
(main): Standardize on a diagnostic for restore_cwd failure,
and report errno.
Don't bother to check cwd_errno unless create_parents.
Use mkdir rather than make_dir; it's simpler.
* src/install.c (main): Adjust to new make_dir_parents convention.
* src/mkdir.c (main): Likewise.
2005-06-14 Jim Meyering <jim@meyering.net>
* tests/mkdir/p-3: Ensure mkdir succeeds if the following argument
is an absolute directory name.
* Makefile.maint (my-distcheck): Add -Wall to the list of options that
are used with -Werror. This target is not intended for general use.
2005-06-13 Jim Meyering <jim@meyering.net>
* src/mkdir.c (main): Give a diagnostic for -- and skip -- each
relative directory name after make_dir_parents fails to restore
the working directory. Before, `mkdir -p' could create directories
in the wrong place in unusual circumstances.
* src/install.c (main): Likewise.
(install_file_in_file_parents): Update make_dir_parents caller.
* tests/mkdir/p-3: New test for today's mkdir.c/mkdir-p.c bug fixes.
* tests/mkdir/Makefile.am (TESTS): Add p-3.
2005-06-10 Paul Eggert <eggert@cs.ucla.edu>
Act on the Austin Group's response yesterday to XCU ERN 63; see
<http://www.opengroup.org/austin/docs/austin_260.txt>.
* NEWS: ls no longer outputs an extra space between mode and link count.
* doc/coreutils.texi: Remove the extra spaces in "ls -l" output.
* src/ls.c (any_has_acl): New var.
(clear_files): Clear it.
(gobble_file): Set it if a file has an ACL.
(print_long_format): Omit needless space unless some file has an ACL.
2005-06-10 Jim Meyering <jim@meyering.net>
* src/system.h (VERIFY_W_TYPEOF): Add parentheses.
2005-06-02 Jim Meyering <jim@meyering.net>
* src/sort.c (usage): Put `Ordering options:' line where it belongs.
2005-06-01 Paul Eggert <eggert@cs.ucla.edu>
Use "file name" when talking about file names, instead of "filename"
or "path", as per the GNU coding standards.
* src/basename.c: Don't use "path" or "filename".
* src/copy.c: Likewise.
* src/copy.h: Likewise.
* src/cp-hash.c: Likewise.
* src/cp.c: Likewise.
* src/df.c: Likewise.
* src/install.c: Likewise.
* src/ls.c: Likewise.
* src/pinky.c: Likewise.
* src/pr.c: Likewise.
* src/pwd.c: Likewise.
* src/remove.c: Likewise.
* src/rmdir.c: Likewise.
* src/sort.c: Likewise.
* src/system.h: Likewise.
* src/tty.c: Likewise.
* src/who.c: Likewise.
* src/cp.c (parents_option): Renamed from flag_path. All uses changed.
(make_dir_parents_private): Renamed from make_path_private.
All uses changed.
* src/cp.c (usage): Don't use "path" to describe a file name.
* src/readlink.c (usage): Likewise.
* src/rmdir.c (usage): Likewise.
* src/df.c: Don't include "path-concat.h"; not needed.
* src/install.c (install_file_in_file_parents): Renamed from
install_file_to_path. All uses changed.
* src/ln.c (FILE_BASENAME_CONCAT): Renamed from PATH_BASENAME_CONCAT.
All uses changed.
* src/ls.c (make_link_name): Renamed from make_link_path.
All uses changed.
* src/pwd.c (struct file_name): Renamed from struct Path.
All uses changed.
(file_name_free): Renamed from path_free. All uses changed.
(file_name_init): Renamed from path_init. All uses changed.
(file_name_prepend): Renamed from path_prepend. All uses changed.
* src/rmdir.c (remove_empty_parents): Renamed from empty_paths.
All uses changed.
(longopts): Add comment that --path is deprecated.
2005-05-31 Jim Meyering <jim@meyering.net>
* src/copy.c (chown_privileges, chown_failure_ok): Mark as `extern'.
This is a crutch so that `make distcheck's sc_tight_scope rule
knows that they really are deliberately declared that way.
2005-05-30 Paul Eggert <eggert@cs.ucla.edu>
Port to Solaris 10's rules for whether programs can chown files.
* src/copy.c [HAVE_PRIV_H]: Include <priv.h>.
(DO_CHOWN): Remove. Replaced by chown_failure_ok. All callers
changed.
(copy_internal): If chown failed, don't worry about what happened
to the mode bits; they can't have changed.
(chown_privileges, chown_failure_ok): New functions.
* src/copy.h: Add copyright notice.
(struct cp_options): Remove myeuid member. Add chown_privileges
member.
(chown_privileges, chown_failure_ok): New function decls.
* src/cp.c (re_protect): Remove unnecessary call to geteuid.
Use chown_failure_ok rather than our own code.
* src/cp.c (cp_options_init): Use chown_privileges rather than geteuid.
* src/install.c (cp_option_init): Likewise.
* src/mv.c (cp_option_init): Likewise.
2005-05-29 Paul Eggert <eggert@cs.ucla.edu>
* src/chgrp.c (getgrnam) [!defined _POSIX_VERSION]: Remove decl.
* src/chown-core.c (getgrnam, getgrgid) [!defined _POSIX_VERSION]:
Remove decls.
* src/cp.c (geteuid) [!defined _POSIX_VERSION]: Remove decl.
* src/id.c (getpwuid, getgrgid, getuid, getgid, geteuid, getegid)
[!defined _POSIX_VERSION]: Remove decls.
* src/install.c (getpwnam, getgrnam): Remove decl.
(getuid, getgid) [!defined _POSIX_VERSION]: Remove decls.
* src/md5sum.c (OPENOPTS, TEXT1T01, TEXTCNVT): Remove.
(digest_file): Use O_BINARY-using expr instead of OPENOPTS.
* src/system.h: Don't bother mentioning _POSIX_VERSION in comment.
* src/test.c: Include sys/param.h if it exists, not if _POSIX_VERSION
isn't defined.
Don't include <sys/file.h>; no longer needed.
(getegid, geteuid): Remove no-longer-necessary decls.
* src/pathchk.c (_POSIX_PATH_MAX) [!defined _POSIX_PATH_MAX]:
Define to 256, not 255, as per modern POSIX.
2005-05-27 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: dd seek=N now conforms to POSIX if the output isn't seekable.
* src/dd.c (skip): Return the number of records that were not
skipped due to encountering EOF.
(dd_copy): If the file wasn't seekable and EOF was encountered,
write zeros past EOF until the desired offset is reached.
* NEWS: expr and test now correctly compare integers of unlimited size.
(Also, correct a comment that claimed that expr detects integer
overflow; it does so only when converting from strings.)
* src/expr.c: Include strnumcmp.h, xstrtol.h.
(looks_like_integer): New function.
(toarith): Use it. Also, use xstrtoimax rather than rolling our
own diagnostics.
(eval2): Don't look for trouble if !evaluate; this simplifies things.
Compare numbers using string comparison, so that overflow is
not possible.
* src/sort.c: Refactor so that others can use large-integer
comparison functions.
Include "strnumcmp.h".
(NEGATION_SIGN, NUMERIC_ZERO, fraccompare):
Remove; moved to strnumcmp.
(decimal_point): Now int, to simplify converison overhead with
new API. All uses changed.
(thousands_sep): Now -1 if there isn't one, as per new API.
All uses changed.
(numcompare): Move contents to strnumcmp module, except for
skipping blanks.
* src/test.c: Include inttostr.h, strnumcmp.h.
(whitespace, digit, digit_value, integer_expected_error): Remove.
(is_int): Remove; replaced by...
(find_int): New function.
(binary_operator): Don't let integers overflow in comparisons;
return the correct answer instead. Simplify the code.
(unary_operator): Convert the integer ourself, since find_int
no longer does so.
* tests/expr/basic (bigcmp): New test.
* tests/test/Test.pm (eq-6, gt-5, lt-5): New tests.
2005-05-26 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: nohup now redirects a tty stdin to an unreadable fd
instead of closing it.
* doc/coreutils.texi (nohup invocation): Document this.
* src/nohup.c (main): Implement this.
2005-05-26 Jim Meyering <jim@meyering.net>
* src/expr.c (toarith): Fix a sign error introduced on 2005-01-14.
Reported by David Alan Gilbert.
* tests/expr/basic: Add tests using arithmetic on negative integers.
2005-05-19 Jim Meyering <jim@meyering.net>
* src/remove.c (AD_mark_helper, AD_mark_current_as_unremovable):
Remove inaccurate-but-harmless `const' attributes.
* src/join.c (decode_field_spec): Add an abort after
`error (EXIT_FAILURE, ...' to avoid a gcc warning in caller,
about variables being used uninitialized.
2005-05-18 Paul Eggert <eggert@cs.ucla.edu>
* configure.ac: Add copyright notice. gl_LIB_CHECK -> cu_LIB_CHECK.
* src/Makefile.am: Add copyright notice.
(factor_LDADD): Remove, as factor no longer needs sqrt.
* src/hostname.c: Remove test for HAVE_LIMITS_H; we can assume
it's always true now.
2005-05-16 Paul Eggert <eggert@cs.ucla.edu>
Fix Cygwin porting problem reported by Eric Blake.
* src/remove.c (DT_IS_DIR): Remove.
(DT_IS_KNOWN, DT_MUST_BE): New macros.
(remove_entry): Use them.
2005-05-14 Paul Eggert <eggert@cs.ucla.edu>
* src/remove.c: Include unlinkdir.h.
(UNLINK_CAN_UNLINK_DIRS): Remove.
(remove_entry): Use cannot_unlink_dirs () rather than
UNLINK_CAN_UNLINK_DIRS.
2005-05-14 Jim Meyering <jim@meyering.net>
Update FSF postal mail address.
* Makefile.maint, Makefile.cfg, gnupload
* src/basename.c, src/cat.c, src/checksum.h, src/chgrp.c
* src/chmod.c, src/chown-core.c, src/chown-core.h, src/chown.c
* src/chroot.c, src/cksum.c, src/comm.c, src/copy.c, src/copy.h
* src/cp-hash.c, src/cp-hash.h, src/cp.c, src/csplit.c, src/cut.c
* src/date.c, src/dcgen, src/dd.c, src/df.c, src/dircolors.c
* src/dirname.c, src/du.c, src/echo.c, src/env.c, src/expand.c
* src/expr.c, src/factor.c, src/fmt.c, src/fold.c, src/fs.h
* src/groups.sh, src/head.c, src/hostid.c, src/hostname.c, src/id.c
* src/install.c, src/join.c, src/kill.c, src/lbracket.c, src/link.c
* src/ln.c, src/logname.c, src/ls-dir.c, src/ls-ls.c, src/ls-vdir.c
* src/ls.c, src/ls.h, src/md5.c, src/md5sum.c, src/mkdir.c
* src/mkfifo.c, src/mknod.c, src/mv.c, src/nice.c, src/nl.c
* src/nohup.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c
* src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c
* src/readlink.c, src/remove.c, src/remove.h, src/rm.c, src/rmdir.c
* src/seq.c, src/setuidgid.c, src/sha1sum.c, src/shred.c
* src/sleep.c, src/sort.c, src/split.c, src/stat.c, src/stty.c
* src/su.c, src/sum.c, src/sync.c, src/system.h, src/tac-pipe.c
* src/tac.c, src/tail.c, src/tee.c, src/test.c, src/touch.c
* src/tr.c, src/true.c, src/tsort.c, src/tty.c, src/uname.c
* src/unexpand.c, src/uniq.c, src/unlink.c, src/uptime.c
* src/users.c, src/wc.c, src/who.c, src/whoami.c, src/yes.c
2005-05-13 Jim Meyering <jim@meyering.net>
* NEWS: `rm -r' now removes all of the files it should, even on
systems with a buggy readdir affecting file systems inaccessible
at configure time.
In some unusual circumstances `rm -r' would fail to remove --
or even consider -- all entries in a directory with more than 254
(SunOS) or 338 (Darwin) entries. This could cause trouble even on
other types of systems when using an affected file system via e.g.,
NFS. The underlying cause was a bug in readdir on those systems.
Coreutils-5.2.1 and earlier used a configure-time test designed
to detect precisely those problem systems, but it would detect
the problem and enable remove.c's work-around code only when its
configure-time test was run on a losing file system. Obviously,
it couldn't detect a problem if the offending file system wasn't
tested or even mounted at coreutils configure time. Now, rm itself
performs a minimal-cost run-time test to detect the problem.
* src/remove.c (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Define.
(remove_cwd_entries): When readdir returns NULL for a directory from
which we've removed more than CONSECUTIVE_READDIR_UNLINK_THRESHOLD
entries, call rewinddir and then resume the readdir/unlink loop.
(UNLINK_CAN_UNLINK_DIRS): Rename from ROOT_CAN_UNLINK_DIRS.
2005-05-12 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: nohup now closes stdin if it is a terminal, unless
POSIXLY_CORRECT is set. This fixes a glitch noted by Wayne Pollock in
<https://www.opengroup.org/sophocles/show_mail.tpl?
source=L&listname=austin-group-l&id=8341>.
* doc/coreutils.texi (nohup invocation): Document this.
* src/nohup.c (main): Implement this.
2005-05-12 Jim Meyering <jim@meyering.net>
* src/date.c: Assume `free (NULL)' works.
* src/dd.c: Likewise.
* src/df.c:Likewise.
* src/dircolors.c:Likewise.
* src/head.c: Likewise.
* src/ls.c: Likewise.
* src/md5sum.c: Likewise.
* src/pr.c: Likewise.
* src/sort.c: Likewise.
2005-05-10 Jim Meyering <jim@meyering.net>
* tests/touch/not-owner: Skip this test if the user running it
owns `/' or has write access to it.
* src/copy.c (abandon_move): Remove erroneous UNWRITABLE check.
This makes `mv -i --reply=no f1 f2' work as expected (in not
performing the move operation). But note that specifying `-i'
after `--reply=no' does *not* work.
Tiny patch from Vlada Macek.
Correct a comment.
* tests/mv/reply-no: New file. Test for the above fix.
* tests/mv/Makefile.am (TESTS): Add reply-no.
* tests/ls-2/tests: Don't print PATH to stderr.
2005-05-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: cp, ln, mv, rm no longer discard white space when intepreting
responses.
2005-05-06 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: dd has new iflag= and oflag= flags "binary" and "text".
* src/dd.c (flags, usage): Add support for "binary" and "text".
2005-05-04 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: chmod -w now complains if it differs from chmod a-w.
* src/chmod.c: Include quotearg.h.
(diagnose_surprises): New var.
(process_file): Diagnose surprises. Simplify the logic a bit,
while we're at it.
(main): Prepare to diagnose surprises. Remove useless code for
'-' option.
* tests/chmod/Makefile.am (TESTS): Add umask-x.
* tests/chmod/umask-x: New file.
2005-05-02 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: ls --indicator-style=directory renamed to ls
--indicator-style=slash, to avoid confusion with ls --directory.
* src/ls.c (usage): Likewise.
(slash): Renamed from directory_only. All uses changed.
2005-05-01 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "chmod +1 foo" is now diagnosed.
2005-04-29 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: ls -p now marks only directories. New option
--indicator-style=directory equivalent to -p.
* doc/coreutils.texi (ls invocation): Document this.
Also, mention ">" is for doors.
* src/ls.c (enum indicator_style): New constant directory_only,
for -p.
(indicator_style_args, indicator_style_types): Set it appropriately.
(decode_switches, gobble_file, print_type_indicator):
(length_of_file_name_and_frills):
Implement the change described in NEWS.
(decode_switches): Quote ">", too.
(usage): Update to match the new behavior. Describe ">".
* tests/ls/file-type: Test for new behavior. Omit -1 option.
The "ls --color" test wasn't being checked; add a check for
"ls --color=auto" instead.
* tests/head/Test.pm: Don't set _POSIX2_VERSION; no longer needed.
* tests/misc/split-fail: Likewise.
* tests/pr/Test.pm: Likewise.
* tests/sort/Test.pm: Fix comment to match new behavior of "sort".
* tests/tail/Test.pm (tv): Rename tests from obs to obs-plus
if they use file names starting with +.
(test_vector): Don't set _POSIX2_VERSION if obs but not obs-plus.
* tests/uniq/Test.pm (tv, test_vector): Likewise.
The following was partly derived from a tiny change by Eric Blake:
* tests/misc/nice: Don't use 'set -'. It's not portable to strict
POSIX 1003.1-2001 hosts. Also, don't set _POSIX2_VERSION.
* tests/mkdir/perm: Don't use 'set -'. Simplify test construction.
Work even if the underyling system attaches ACLs to new dirs.
* tests/mv/part-hardlink: Don't use 'set -'.
* tests/stty/row-col-1: Don't use 'set -'.
2005-04-28 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document fixes described below.
* src/chmod.c (change, umask_value): New static vars.
(reference_file): Move this static var to inside "main".
(process_file, process_files): Remove CHANGES arg; now taken from
static var. All uses changed.
(usage): Fix incorrect description of MODE operand.
(main): For invalid mode usages, output a brief usage message.
Adjust to new modechange API.
* install.c (main): Adjust to new modechange API.
Also, free the mode_change object when done.
* mkdir.c (main): Likewise.
* mkfifo.c (main): Likewise.
* mknod.c (main): Likewise.
* tests/chmod/equal-X: Check for =xX bug.
* tests/chmod/equals: Check for =u bug.
* tests/chmod/usage: Check for u+gr and ug,+x bugs.
2005-04-26 Paul Eggert <eggert@cs.ucla.edu>
Restore support for usages like "head -1" and "tail -1",
even when conforming to POSIX 1003.1-2001.
Fix bug with "POSIXLY_CORRECT=1 fold file -3".
join now supports a NUL field separator, e.g., "join -t '\0'".
join now detects and reports incompatible options, e.g.,
"join -t x -t y",
* NEWS: Document this.
* src/date.c: Remove posixver.h and its uses.
(COMMON_SHORT_OPTIONS): Remove.
(short_options): New constant.
(short_options, usage): -I now always takes an optional arg.
* src/expand.c: Remove posixver.h and its uses.
(shortopts): New constant. -DIGIT now always takes an optional arg.
(main): Revamp parsing of -DIGIT to let parse_tab_stops handle it.
Don't complain about -DIGIT.
* src/fold.c: Remove posixver.h and its uses.
(shortopts): New constant. -DIGIT now always takes an optional arg.
(main): Don't preprocess arg list; that was buggy. Use method
similar to expand.
* src/head.c: Remove posixver.h and its uses.
(header_mode_option): Remove.
(main): Don't complain about obsolete -NUM args.
* src/join.c: Remove posixver.h and its uses.
(obsolete_usage): Remove.
(join_field_1, join_field_2): Initialize to SIZE_MAX to indicate
they haven't been set yet.
(tab): Now int, not char. Initialize to -1 to indicate white space
separates columns, so that we can use NUL as a separator.
All uses changed.
(OBSOLETE_LONG_OPTIONS, get_option): Remove.
(string_to_join_field): Remove ERR_MSG_FMT arg; a single format
suffices. Use xstrtoul for sizes; it suffices.
(decode_field_spec): Report an error and exit on failure. Return void,
not bool.
(add_field_list): Likewise.
(set_join_field): New function.
(enum operand_status): New enum.
(add_file_name): New args OPERAND_STATUS, JOPTION_COUNT,
PREV_OPTC_STATUS, OPTC_STATUS to handle the bewildering array of
possibilities with obsolete option parsing.
(main): Use it. Do not depend on POSIX version.
Check for conflicting options. Parse obsolete options -j1 and -j2
so that it is a pure extension to POSIX 1003.1-2001.
Allow '-t\0' to specify a NUL tab, stealing the code from 'sort'.
* src/nice.c: Remove posixver.h and its uses.
(main): Always support -NUM option.
* src/od.c: Remove posixver.h and its uses.
(short_options): New constant, which always supports -w[num].
(COMMON_SHORT_OPTIONS): Remove.
* src/pr.c: Remove posixver.h and its uses.
(short_options): New constant, which always supports -S[string].
(COMMON_SHORT_OPTIONS): Remove.
* src/sort.c: Remove posixver.h and its uses.
(short_options): New constant, which always supports -y arg.
(COMMON_SHORT_OPTIONS): Remove.
(main): Redo workaround for Solaris compatibility with -y.
This change isn't visible to the user; it just cleans up the
code so that we don't need posixver.h.
* src/split.c: Remove posixver.h and its uses.
(main): Don't complain about -NUM option.
* src/tail.c (parse_obsolete_option): Don't complain about -NUM.
* src/unexpand.c: Remove posixver.h and its uses.
(main): Don't complain about -TAB.
* src/uniq.c (main): Don't complain about -NUM.
2005-04-22 Paul Eggert <eggert@cs.ucla.edu>
* src/nohup.c (main): If getopt fails, exit with status 127,
not status 1. POSIX requires this.
* NEWS: Document this.
* src/nice.c (main): Report proper program name when getopt finds
trouble. Problem reported by Behdad Esfahbod.
* NEWS: Fix bug with "mkdir -m =+x dir"; the umask was being ignored
when the "+x" was being evaluated.
* mkdir.c (main): Compile mode with MODE_MASK_ALL and initial umask.
* mkfifo.c (main): Likewise.
* mknod.c (main): Likewise.
* tests/mkdir/perm: Test for the above bug.
2005-04-20 Paul Eggert <eggert@cs.ucla.edu>
Port test cases to Microsoft-Windows-related environments,
following suggestions from Eric Blake.
* tests/install/Makefile.am (TESTS_ENVIRONMENT): Add EXEEXT.
* tests/install/basic-1: Undo previous change.
(dd, dd2): New vars, which use $EXEEXT. All uses of dd and dd2 changed.
* tests/install/trap: Undo previous change.
(sig): New var. Use it insted of "trap '' CHLD".
Append $EXEEXT to executable name.
"fetish" -> "coreutils" in more places.
* tests/Coreutils.pm: Renamed from tests/Fetish.pm.
(package Coreutils): Renamed from package Fetish. All uses changed.
* tests/Makefile.am (EXTRA_DIST): Add Coreutils.pm and
remove Fetish.pm.
2005-04-19 Paul Eggert <eggert@cs.ucla.edu>
* tests/mv/setup (dot_mount_point): Use stat -L, in case the
directory is actually a symbolic link. Problem reported by
Eric Blake.
* tests/mv/mv-special-1: Use test -p to test for fifos, rather
than the (incorrect) test -f and the (inadequate) ls. ls is
inadequate because on some hosts a buggy mv will create a file of
the wrong type (problem reported by Eric Blake). Skip this test
if test -p doesn't work.
* tests/chmod/setgid: Use numeric group ids, not symbolic group names,
since the latter can have shell metacharacters in them (e.g., spaces).
This follows up to the 2005-01-17 patch, which missed this occurrence.
2005-04-18 Paul Eggert <eggert@cs.ucla.edu>
"fetish" -> "coreutils" in several places.
* Makefile.cfg (ftp): Remove fetish.sf.net.
* Makefile.maint (emit_upload_commands): Likewise.
* src/Makefile.am (LDADD, $(PROGRAMS)): fetish -> coreutils.
* tests/group-names (COREUTILS_GROUPS): Renamed from FETISH_GROUPS.
* tests/chmod/setgid (FETISH_GROUP): Renamed from COREUTILS_GROUP.
* tests/install/basic-1: Use "cat", not "test", to test for
../../src/dd. Problem reported by Eric Blake.
2005-04-18 Jim Meyering <jim@meyering.net>
* src/dd.c: Don't include stat-macros.h directly. system.h does that.
2005-04-17 Paul Eggert <eggert@cs.ucla.edu>
Work around a couple of "make check" failures reported for Cygwin
and ash by Eric Blake.
* tests/install/basic-1: Skip this test if ../../src/dd isn't readable.
* tests/install/trap: Skip this test if "trap '' CHLD" doesn't work.
2005-04-16 Jim Meyering <jim@meyering.net>
* src/dd.c (S_TYPEISSHM): Remove definition.
Get the definition by including "stat-macros.h", instead.
2005-04-14 Paul Eggert <eggert@cs.ucla.edu>
Fix test suite problems reported by Eric Blake on Cygwin.
* tests/mv/mv-special-1: Ignore chatter about when files are removed,
since POSIX doesn't require rename to fail across file systems.
* tests/mv/setup (dot_mount_point): Use stat rather than df, as
it's more reliable.
(other_partition_tmpdir): Remove df from name as that would be
misleading now.
2005-04-14 Jim Meyering <jim@meyering.net>
* src/chown-core.c: Correct typo, fchmod -> fchown, in a comment.
2005-04-12 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (usage): "uid" -> "user ID".
2005-04-12 Jim Meyering <jim@meyering.net>
* src/tsort.c (tsort): Use "%s" as the format string,
rather than a diagnostic or a file name.
* src/comm.c (compare_files): Remove declaration of unused local.
* src/chown-core.c (chopt_free): Mark parameter as unused.
2005-04-11 Paul Eggert <eggert@cs.ucla.edu>
* man/chown.x: Reword to match user manual.
* man/id.x: Likewise.
* src/setuidgid.c (usage): Use "user ID", not "UID", and similarly
for "group ID".
* src/whoami.c (usage, main): Likewise.
Add bulletproofing for cases where stdin, stdout, or stderr are closed.
* src/comm.c: Include stdio-safer.h.
(compare_files): Exit right away on I/O error rather than continuing
and producing confusing output and error messages.
Return void, not int; all callers changed.
Use fopen_safer to avoid confusion with file descriptors.
* src/copy.c: Include unistd-safer.h.
(copy_reg): Use fd_safer.
* src/csplit.c: Include stdio-safer.h.
(input_desc): Remove unnecessary static initialization.
(set_input_file): Use STDIN_FILENO, not 0.
(create_output_file): Use fopen_safer.
* src/dircolors.c (dc_parse_file): Don't assume fopen does not
return stdin.
* src/head.c (head_file): Don't assume open does not return 0.
* src/join.c: Include stdio-safer.h.
(main): Use fopen_safer. Simplify the resulting code.
* src/md5sum.c (digest_file, digest_check):
Don't assume that fopen does not return stdin.
* src/nohup.c: Include unistd-safer.h.
(main): Don't dup stderr to stdin or stdout by mistake.
* src/od.c (check_and_close): Don't assume fopen does not return stdin.
* src/paste.c (paste_serial): Likewise.
* src/pr.c: Include stdio-safer.h.
(open_file): Use fopen_safer.
(close_file): Don't assume fopen does not return stdin.
* src/ptx.c (main): Don't assume fopen returns stdout after closing
stdout. Use freopen instead.
* src/shred.c: Include unistd-safer.h.
(wipename): Use fd_safer on directory file descriptor.
(wipefile): Remove special case for /dev/fd/* on older hosts.
It didn't work in general, and wasn't documented.
Use fd_safer.
* src/sort.c: Include unistd-safer.h.
(create_temp_file): Use fd_safer.
(xfclose): Don't assume fileno (stdin) == STDIN_FILENO, etc.
* src/split.c: Include unistd-safer.h.
(cwrite): Use fd_safer. Replace mystery constant 0666 with symbolic
version, as POSIX requires.
* src/sum.c (bsd_sum_file, sysv_sym_file):
Use same pattern as elsewhere for checking for stdin.
* src/tac.c: Include unistd-safer.h.
(copy_to_temp): Use fd_safer.
(tac_file): Don't assume fopen cannot return stdin.
* src/tail.c: Include unistd-safer.h rather than fcntl-safer.h.
(recheck, tail_file): Use fd_safer rather than open_safer.
* src/tee.c: Include stdio-safer.h.
(tee): Use fopen_safer.
* src/touch.c: Include unistd-safer.h.
(touch): Use fd_safer.
* src/tsort.c (have_read_stdin): Remove; no longer needed. All uses
removed.
(tsort): Do not assume fopen can't return stdin.
Close stdin before returning. All uses changed.
* src/unexpand.c (next_file): Don't assume fopen cannot return stdin.
* src/uniq.c: Include stdio_safer.h.
(check_file): Don't assume fopen cannot return stdin or stdout.
2005-04-09 Jim Meyering <jim@meyering.net>
* src/dd.c (quit): Define with ATTRIBUTE_NORETURN.
Now that close_stdout closes standard output unconditionally,
these workarounds for dd and cat are no longer necessary.
* src/dd.c (close_stdout_wrapper): Remove function.
(main): Call atexit with close_stdout, instead.
* src/cat.c (close_stdout_wrapper): Likewise.
Don't close STDOUT_FILENO explicitly; close_stdout does it.
* src/system.h (__attribute__): Readability nit:
Change this:
# define __attribute__(x)
to this:
# define __attribute__(x) /* empty */
2005-04-09 Jim Meyering <jim@meyering.net>
* src/rm.c (usage): Mention that --recursive removes listed
directories too, not just their contents.
Say that by default, rm does not remove directories.
* src/pr.c: Don't include "timespec.h". system.h does that.
* Makefile.maint (sc_system_h_headers): Propagate exit status
through trap.
2005-04-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document that dd no longer treats QUIT or PIPE specially,
and when conforming to POSIX no longer treats USR1 specially.
Document that dd no longer dumps core when handling signals.
* src/system.h (RETSIGTYPE): Remove; no longer needed. All uses
replaced with void.
* src/csplit.c (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [!HAVE_SIGINTERRUPT]: New macro.
(delete_all_files): New arg IN_SIGNAL_HANDLER, to avoid undefined
behavior when called from a signal handler. All uses changed.
(main) [!defined SA_NOCLDSTOP]:
Use siginterrupt to specify that system calls should be interrupted.
* src/dd.c: Do not include safe-read.h or full-write.h; no longer needed.
(process_signals): Add forward decl.
(SA_NOCLDSTOP, sigprocmask, sigset_t) [!defined SA_NOCLDSTOP]:
New macros.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(SA_NODEFER) [!defined SA_NODEFER]: New macro.
(SA_RESETHAND) [!defined SA_RESETHAND]: New macro.
(caught_signals, interrupt_signal, info_signal_count, catch_siginfo):
New vars.
(usage): Mention -USR1 versus -INFO.
(cleanup): Don't invoke print_stats; the caller must do it now.
All callers changed.
(quit): Process signals just before exiting.
(interrupt_handler): Simply record the signal and return.
(siginfo_handler): Simply increment the signal counter and return.
(install_handler): Remove, replacing with:
(install_signal_handlers, process_signals, iread, iwrite):
New functions. All callers to safe_read and full_write replaced
by iread and iwrite. All callers to install_handler replaced by
install_handlers.
* src/ls.c (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(main) [! SA_NOCLDSTOP]: Use it.
* src/shred.c: Remove all uses of signals; modern hosts have
/dev/random and don't need this gorp.
Do not include signal.h.
(env, sigill_handler, isaac_seed_machdep): Remove. All uses removed.
* src/sort.c (SA_NOCLDSTOP): Define to 0 if not defined.
All uses changed.
(siginterrupt) [! HAVE_SIGINTERRUPT]: New macro.
(main) [! SA_NOCLDSTOP]: Use it.
* src/dd.c: Do not include inttostr.h, no longer needed.
(print_stats, main): Rewrite and simplify formats to use PRIuMAX
instead of umaxtostr.
(print_stats): Work even in languages that have special
forms for two of things, for r_truncate and w_bytes. We can't
fix delta_s in this way, since ngettext doesn't support floating-point.
(main): Rewrite to avoid casts.
2005-04-07 Jim Meyering <jim@meyering.net>
Placate gcc-4's -Wuninitialized.
* src/md5sum.c (digest_check) [lint]: Initialize hex_digest to NULL.
* src/test.c (binary_operator) [lint]: Initialize lt and rt to 0.
* src/test.c (is_int, age_of, binop): Declare `char *' parameters to
be `const'.
(binop): Move function definition to precede first use so we can...
(binop): ...remove prototype.
2005-04-05 Paul Eggert <eggert@cs.ucla.edu>
* man/Makefile.am (.x.1): Remove "COMMAND.td/" from examples.
* src/basename.c (usage): Add examples.
* src/cat.c (usage): Likewise.
* src/chgrp.c (usage): Likewise.
* src/chown.c (usage): Likewise.
* src/dirname.c (usage): Likewise.
2005-04-05 Jim Meyering <jim@meyering.net>
* src/nice.c (usage): Mention that some shells provide a
built-in function by the same name.
* src/nohup.c (usage): Likewise.
* src/printenv.c (usage):Likewise.
2005-04-04 Dmitry V. Levin <ldv@altlinux.org>
* src/tee.c (tee): When closing files, do not close stdout,
leave this job to close_stdout() instead.
* configure.ac (AC_CONFIG_FILES): Add tests/tee/Makefile.
* tests/Makefile.am (SUBDIRS): Add tee.
* tests/tee/Makefile.am: New file.
* tests/tee/.cvsignore: Likewise.
* tests/tee/{basic,dash}: New tee tests.
2005-04-04 Jim Meyering <jim@meyering.net>
* src/echo.c (usage): Mention that some shells provide a
built-in function by the same name.
* src/kill.c (usage): Likewise
* src/printf.c (usage): Likewise.
* src/pwd.c (usage): Likewise.
* src/stat.c (usage): Likewise.
* src/test.c (usage): Likewise.
* src/true.c (usage):
* src/system.h (USAGE_BUILTIN_WARNING): New macro.
* man/echo.x: Remove `DESCRIPTION' section, now that --help includes it.
* man/printf.x: Likewise.
* man/pwd.x: Likewise.
2005-04-03 Jim Meyering <jim@meyering.net>
* src/pr.c (main): Fix off-by-one error.
pr -$(perl -e 'print "0"x63 . 1') would write one byte beyond the
end of a malloc'd buffer.
2005-04-01 Jim Meyering <jim@meyering.net>
* src/pr.c (main): Free column_count_string when done with it.
Don't let pr treat +1:-1 like +1:18446744073709551615.
* src/pr.c (strtoumax): Remove declaration.
(first_last_page): Use xstrtoumax in place of strtoumax,
so we don't interpret a negative page number (e.g., in an option
like --pages=1:-1) as valid.
* tests/pr/Test.pm (neg-page): Add a test for this.
2005-03-30 Paul Eggert <eggert@cs.ucla.edu>
* src/pinky.c (short_pinky): Adjust to read_utmp signature change.
* src/uptime.c (uptime): New arg OPTIONS. All uses changed.
* src/users.c (users): Likewise.
* src/who.c (who): Likewise.
* src/uptime.c (main): Check PIDs when invoked with zero arguments.
* src/users.c (main): Likewise.
* src/who.c (main): Likewise. Also with two arguments.
Omit duplicate code in 2-arg case.
(UT_PID): Moved to ../lib/readutmp.h.
2005-03-29 Jim Meyering <jim@meyering.net>
* src/system.h (ptr_align): Declare `ptr' parameter to be a
`const' pointer, since this function never writes through it.
* src/uname.c: Indent cpp directives to reflect nesting.
2005-03-28 Jim Meyering <jim@meyering.net>
* src/seq.c (get_width_format) [HAVE_RINT && HAVE_MODF && HAVE_FLOOR]:
Add `void' to make this an ANSI-style function declaration.
* src/remove.c (ds_init): Likewise.
* src/pr.c (print_sep_string): Likewise.
* src/stty.c (speeds): Declare this array to be static.
* src/Makefile.am (sc_tight_scope): Adjust to catch any
new declarations like that of stty.c's `speeds'.
* src/system.h (GETOPT_HELP_OPTION_DECL): Use NULL, not `0'.
(GETOPT_VERSION_OPTION_DECL): Likewise.
* src/chown.c (long_options): Likewise.
* src/chgrp.c (long_options): Likewise.
* src/chmod.c (long_options): Likewise.
* src/cp.c (sparse_type_string, reply_args, decode_preserve_arg):
Likewise.
* src/chown-core.c (chopt_init): Likewise.
* src/comm.c (long_options): Likewise.
* src/copy.c (copy_reg): Likewise.
* src/csplit.c (extract_regexp): Likewise.
* src/cut.c (longopts): Likewise.
* src/date.c (time_spec_string): Likewise.
* src/df.c (find_mount_point, show_point): Likewise.
* src/expr.c (docolon): Likewise.
* src/fmt.c (long_options): Likewise.
* src/ls.c (time_style_args, indicator_style_args, long_options)
(format_args, sort_args, time_args, decode_switches)
(gobble_file): Likewise.
* src/md5sum.c (long_options): Likewise.
* src/mv.c (reply_args): Likewise.
* src/paste.c (longopts): Likewise.
* src/pinky.c (print_entry): Likewise.
* src/pr.c (long_options): Likewise.
* src/ptx.c (long_options, format_args): Likewise.
* src/readlink.c (longopts): Likewise.
* src/sort.c (long_options, mergefps): Likewise.
* src/stat.c (long_options): Likewise.
* src/tac.c (main): Likewise.
* src/tail.c (follow_mode_string): Likewise.
* src/touch.c (longopts, time_args): Likewise.
* src/uniq.c (delimit_method_string): Likewise.
* src/uptime.c (print_uptime): Likewise.
* src/who.c (print_user): Likewise.
2005-03-27 Jim Meyering <jim@meyering.net>
* src/dcgen: Simplify further, clean up.
Add a standard-output-closing global destructor.
Require perl-5.002.
* src/wheel-gen.pl: Use the same global destructor as dcgen.
2005-03-26 Paul Eggert <eggert@cs.ucla.edu>
* src/dcgen: Squeeze multiple blanks into one. Output a simple
array of adjacent strings rather than a more complicated data
structure; this saves space in the dircolors executable.
* src/dircolors.c (parse_line): Use char *, not unsigned char *.
This avoids casts.
(dc_parse_stream, main): Avoid casts.
Adjust to simpler data structure generated by new dcgen.
2005-03-25 Eric Blake <ebb9@byu.net> (tiny change)
* src/ls.c (usage): Document usage of LS_COLORS.
2005-03-25 Paul Eggert <eggert@cs.ucla.edu>
* src/dircolors.hin: Add "TERM cygwin".
2005-03-25 Jim Meyering <jim@meyering.net>
* src/system.h (DECIMAL_DIGIT_ACCUMULATE): Reverse the sense of
the return value, and update callers:
* src/cut.c (set_fields): Update use of DECIMAL_DIGIT_ACCUMULATE.
* src/expand.c (parse_tab_stops, main): Likewise.
* src/split.c (main): Likewise.
* src/unexpand.c (parse_tab_stops, main): Likewise.
* src/uniq.c (main): Likewise.
2005-03-22 Jim Meyering <jim@meyering.net>
* build-aux: New directory. Renamed from config.
* configure.ac: Reflect renaming: config -> build-aux.
* Makefile.am (dist-hook): Likewise.
* Makefile.maint: Likewise.
* Makefile.cfg (cvs_files): Likewise.
* .x-sc_sun_os_names: Likewise.
* .x-sc_trailing_blank: Likewise.
* src/ls.c (get_funky_string): Use '\a', rather than 7, for
portability to EBCDIC hosts.
2005-03-20 Jim Meyering <jim@meyering.net>
* src/pr.c (init_header): Add missing `%' in new format string.
(init_header): Use zero-filled `.%09d' format, not space-filled `.%9d'.
2005-03-19 Jim Meyering <jim@meyering.net>
* src/Makefile.am (pr_LDADD): Now that pr uses gettime, add
$(LIB_CLOCK_GETTIME) to get the required -lrt on newer Linux systems.
2005-03-18 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: pr -D "FORMAT" now accepts the same formats that
date +"FORMAT" does.
* src/pr.c: Include strftime.h, timespec.h.
(init_header): Obtain and format nanosecond part of time stamp.
* NEWS: nohup now ignores the umask when creating nohup.out.
nohup now closes stderr if it is a terminal and stdout is closed.
* src/nohup.c (main): Likewise. Be a little more paranoid about
return values; e.g., check for any negative return from open.
Assume free (NULL) works.
Close file descriptor leak when redirecting standard output to a file.
2005-03-17 Jim Meyering <jim@meyering.net>
* src/cut.c (set_fields): Use DECIMAL_DIGIT_ACCUMULATE macro,
in place of functionally-equivalent code.
* src/expand.c (parse_tab_stops, main): Likewise.
* src/split.c (main): Likewise.
* src/unexpand.c (parse_tab_stops, main): Likewise.
* src/uniq.c (main): Likewise.
* src/od.c: Use VERIFY macro in place of an equivalent open-coded
declaration.
* src/system.h (VERIFY, VERIFY_EXPR, DECIMAL_DIGIT_ACCUMULATE):
New macros.
Before, this command would make uniq skip 11 fields and print
only the first line:
$ _POSIX2_VERSION=1 ./uniq -f1 -1 <(seq --format='1 %g' 2)
1 1
1 2
* src/uniq.c (main): Interpret `uniq -f1 -1' like `uniq -f1',
not like `uniq -f11'.
2005-03-15 Jim Meyering <jim@meyering.net>
Both `pr -0' and e.g., `pr -03' would evoke `column count too large'.
`pr -0' should give a better diagnostic and `pr -03' should be
equivalent to `pr -3'.
* src/pr.c (parse_column_count): Change return type to void.
Call error (EXIT_FAILURE, ... for an invalid string.
(main): Allocate space for column_count_string using malloc.
Accumulate all old-style column-count digits before converting.
When the number of columns is specified via both old-style,
(e.g., -3), and a long option (--columns=5), ensure that only
the last one specified takes effect.
* tests/pr/Test.pm: Add tests for the above.
2005-03-15 Corinna Vinschen <corinna@vinschen.de> (tiny change)
* src/copy.c (copy_reg): Copy regular files in binary mode.
2005-03-14 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Restate why ls limits time stamp lengths.
2005-03-12 Jim Meyering <jim@meyering.net>
Add a little infrastructure to help prevent future bugs like the
one fixed below.
* src/stat.c (xstrcat): New function.
(print_statfs, print_stat): Add buf_len parameter and convert all
uses of strcat to xstrcat. Update callers.
(print_it): Call print_func with buf_len parameter.
Invoking stat -c FMT with a lone format directive of %s, %f, %h, %s,
could cause a buffer overrun error.
* src/stat.c (print_it): Allocate 2 more bytes, to accommodate our
conversion of the stat %s format string to the longer printf %llu one.
Patch from Guochun Shi.
2005-03-11 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (TIME_STAMP_LEN_MAXIMUM): New constant.
(long_time_expected_width, print_long_format): Use it, to avoid
some possible denial-of-service attacks.
* NEWS: Document this.
2005-03-11 Jim Meyering <jim@meyering.net>
Prompt once again for `mv -i A B' when A and B are hard links
to the same file. This fixes a bug introduced by my 2003-04-04
(coreutils-5.0.1) change. Reported by Thomas Wolff via Eric Blake.
* src/copy.c (abandon_move): New function, factored out of
copy_internal, now that this code is being used from two places.
(copy_internal): Perform the same interactive-related test for
whether it's alright to proceed and (usually) overwrite the
destination file.
* tests/mv/i-4: Add tests for the above.
Don't segfault for a very long date format string, e.g.,
ls -ld --time-style=+%99999999H .
* src/ls.c (long_time_expected_width): Use x2nrealloc, not alloca,
so format string abuse cannot provoke stack overflow.
(print_long_format): Likewise.
Don't segfault for a long header date string, e.g.,
echo a|pr -D +%9999999A
* src/pr.c (init_header): Use x2nrealloc, rather than alloca.
Don't bother with fixed-sized initial buffer; always use x*alloc.
* src/pr.c (init_header): Use slightly clearer INT_BUFSIZE_BOUND
in place of equivalent INT_STRLEN_BOUND + 1.
* src/expr.c (tostring, printv): Likewise.
2005-03-09 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h: Include intprops.h.
(TYPE_SIGNED, TYPE_MINIMUM, TYPE_MAXIMUM, INT_STRLEN_BOUND): Remove;
they are now defined in intprops.h.
2005-03-09 Jim Meyering <jim@meyering.net>
* TODO: Remove entry about named pipes. It was fixed in 5.3.0.
2005-03-08 Paul Eggert <eggert@cs.ucla.edu>
* src/date.c (usage): Redo to match recent documentation changes.
Don't bother documenting which usages are GNU extensions; the list
wasn't correct, and is better left to the printed manual anyway.
2005-03-06 Jim Meyering <jim@meyering.net>
Factor out column-count processing.
* src/pr.c: Include "inttostr.h".
(parse_column_count): New function.
(main): Use the new function for both old-style, -9, and long,
--columns=-9, options.
* src/cksum.c: Remove `register' keyword.
* src/cut.c: Likewise.
* src/dd.c: Likewise.
* src/env.c: Likewise.
* src/factor.c: Likewise.
* src/fmt.c: Likewise.
* src/fold.c: Likewise.
* src/id.c: Likewise.
* src/logname.c: Likewise.
* src/ls.c: Likewise.
* src/pr.c: Likewise.
* src/printf.c: Likewise.
* src/shred.c: Likewise.
* src/sort.c: Likewise.
* src/sum.c: Likewise.
* src/test.c: Likewise.
* src/tsort.c: Likewise.
* src/uniq.c: Likewise.
* src/wc.c: Likewise.
* src/whoami.c: Likewise.
2005-03-01 Paul Eggert <eggert@cs.ucla.edu>
* src/Makefile.am (nanosec_libs): Remove $(LIB_XANOSLEEP); no
longer needed.
2005-03-01 Jim Meyering <jim@meyering.net>
* src/copy.c (copy_internal): Change test of source type from
!S_ISREG to S_ISLNK. Reported by Paul Eggert in
http://lists.gnu.org/archive/html/bug-coreutils/2004-10/msg00050.html.
2005-02-28 Jim Meyering <jim@meyering.net>
* NEWS: Mention that xnanosleep fixes sleep failure on linux-2.6.8.1.
2005-02-21 Paul Eggert <eggert@cs.ucla.edu>
* src/Makefile.am (dd_LDADD, shred_LDADD): Add $(LIB_GETHRXTIME).
(nanosec_libs): Add $(LIB_XNANOSLEEP). Needed for newer GNU/Linux
hosts with clock_gettime.
2005-02-20 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Describe user-visible change to dd.
* src/Makefile.am (dd_LDADD, shred_LDADD, nanosec_libs):
Remove $(LIB_CLOCK_GETTIME). These functions now use
gethrxtime instead.
* src/dd.c: Include gethrxtime.h, xtime.h.
(start_time): Now of type xtime_t, not struct timespec.
(print_stats, main): Use gethrxtime rather than gettime.
* src/ls.c (time): Remove obsolete decl.
(get_current_time): gettimeofday always returns 0, so don't
check its result.
* src/shred.c: Include gethrxtime.h.
(isaac_seed): Use gethrxtime rather than a mishmash.
* src/touch.c (time): Remove obsolete decl.
* tests/misc/split-fail: Don't assume that the current host
supports integers wider than 32 bits. Fix comment typo.
* tests/od/x8: Likewise.
* src/chown-core.c (enum RCH_status): Remove trailing comma,
as it's not valid in standard C89.
2005-02-15 Jim Meyering <jim@meyering.net>
* src/stat.c (human_fstype): Add case/definition for S_MAGIC_XFS
so that file systems of type `xfs' are recognized as such.
* src/fs.h: Regenerate.
Reported by Bernd Eckenfels.
* src/stat.c (human_fstype): Likewise for S_MAGIC_JFS/jfs.
* src/fs.h: Regenerate.
Reported by Andreas Schwab.
* src/nice.c (NZERO) [NZERO == 0]: Undefine and define to 20,
to work around the invalid definition from Darwin 7.7.0.
Test failure reported by Sébastien Maret.
2005-02-14 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (mergefps): Use binary search rather than linear one
when comparing new line to lines already in main memory.
Idea suggested by James Lemley.
2005-02-09 Jim Meyering <jim@meyering.net>
* src/copy.c (valid_options): Add an assertion that
not both hard_link and symbolic_link are set.
2005-02-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document stat -f -c %S, plus changes to default formats.
* doc/coreutils.texi (stat invocation): Normalize terminology,
capitalization, and sort order to match --help output. Mention %c
for file systems. Add new -f -c format %S, and document %s versus %S;
problem reported by Jeroen van Wolffelaar.
* src/stat.c (usage): Likewise.
(STATFS_FRSIZE): New macro.
(print_statfs): Use it, for stat -f -c %S.
(do_statfs): Change default formats to output %S.
2005-02-03 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h: Include "memrchr.h".
(memrchr) [!HAVE_DECL_MEMRCHR]: Remove decl.
2005-02-02 Jim Meyering <jim@meyering.net>
* tests/du/8gb: Also adjust the test (s/64/128/) to detect
systems that don't support sparse files.
Check for $2 -ge 128, rather than $2 = 128, in case
there is a file system type that doesn't support sparse files,
yet for which metadata takes up additional space.
Both reported by Andreas Schwab.
2005-02-01 Eric Blake <ebb9@byu.net> (tiny change)
* tests/du/8gb: Create a larger test file, so we properly
detect that sparse files can be created on NTFS under cygwin.
2005-01-30 Jim Meyering <jim@meyering.net>
* src/head.c (elide_tail_bytes_pipe): Correct wording in diagnostic.
* src/stty.c: Remove unnecessary parentheses in all #if directives.
2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
* .cvsignore: Ignore config.cache and config.status.lineno.
* src/stty.c [VSWTCH]: Some systems, like Cygwin, use VSWTC
instead of VSWTCH, for use with CSWTCH.
2005-01-29 Eric Blake <ebb9@byu.net> (tiny change)
* tests/Makefile.am (.PHONY): Add check-root and root-hint.
* tests/rwx-to-mode: Ignore ACL designation.
* tests/setgid-check: Likewise.
* tests/chown/separator: Quote user and group names.
2005-01-24 Jim Meyering <jim@meyering.net>
* src/cp.c (usage): Merge the descriptions of --no-dereference and -P.
Suggestion from Johan Boule.
2005-01-17 Eric Blake <ebb9@byu.net> (tiny change)
* src/Makefile.am (all_programs.list): Strip $(EXEEXT) and remove
duplicates.
* man/Makefile.am (all_programs): Revert previous patch; updated
all_programs.list fixes this.
(.x.1): No need to add $(EXEEXT).
2005-01-03 Corinna Vinschen <corinna@vinschen.de> (tiny change)
* src/system.h: Use S_BLKSIZE value for ST_NBLOCKSIZE where
available.
2005-01-22 Jim Meyering <jim@meyering.net>
* Makefile.maint (v_etc_file): The version string has moved to
version-etc-fsf.c, search that new file, not version-etc.c.
2005-01-17 Paul Eggert <eggert@cs.ucla.edu>
* tests/group-names: Use numeric group ids, not symbolic group names,
since the latter can have shell metacharacters in them (e.g., spaces).
Problem reported by Eric Blake.
* tests/chgrp/basic: Assume groups are numeric, not symbolic.
* tests/chgrp/deref: Likewise.
* tests/chgrp/posix-H: Likewise.
* tests/chgrp/recurse: Likewise.
2005-01-15 Jim Meyering <jim@meyering.net>
* src/shred.c (isaac_seed) [HAVE_GETHRTIME]: #if-0 this block,
because just calling gethrtime evokes an `illegal instruction'
failure when compiled with Sun's c89 on Solaris 8 and 9.
Reported by Nelson Beebe.
* src/shred.c (isaac_seed) [HAVE_GETHRTIME]: Don't call ISAAC_SEED
twice with the same value of `t'.
Replace nested #if-#else blocks with #if-#elif-#elif chain.
2005-01-14 Jim Meyering <jim@meyering.net>
The test, tests/tail/f-1, failed on powerpc-apple-darwin7.7.0.
* src/tail.c (IS_TAILABLE_FILE_TYPE): Adjust definition also to include
sockets, since that's what you get when reading from a command-line-
supplied pipe on Darwin 7.7.
(IS_PIPE_LIKE_FILE_TYPE): Define.
(main): Use new IS_PIPE_LIKE_FILE_TYPE rather than simply S_ISFIFO.
Reported by Nelson Beebe.
This same change is also required on NetBSD/sparc-1.5.
Reported by Adrian Bunk.
* src/expr.c (toarith): Rewrite to detect/diagnose integer overflow,
rather than suffering silently.
Before, expr would silently overflow and wrap around:
$ expr 9223372036854775808 = 0 # $(echo 2^63|bc)
1
Now it detects the problem and exits nonzero:
$ ./expr $(echo 2^63|bc) = 0
./expr: 9223372036854775808: integer is too large
* tests/chown/separator (id_gn): Exit 77, not 1, for a test-framework
failure, so that doesn't cause `make check' to stop. Nelson Beebe
reported that this test would fail with the diagnostic,
`cannot find name for group ID 10', on one of his systems.
2005-01-13 Jim Meyering <jim@meyering.net>
* src/test.c (is_int): Don't overflow when evaluating integer
constants. Before, ./test $(echo 2^64|bc) -eq 0 && echo FAIL
would print `FAIL'.
* tests/Fetish.pm (run_tests): Add code (if-0'd out) to detect
names of temporary files that would clash on 8.3 file systems.
* tests/mk-script (validate): Likewise.
2005-01-12 Jim Meyering <jim@meyering.net>
* tests/dd/skip-seek: Shorten test names to accommodate 8.3 systems.
* tests/tr/Test.pm (repeat-xC): Change test name from
`repeat-Compl', to avoid 8.3 conflict with `repeat-compl'.
Reported by Eric Blake.
(repeat-000): Rename to `repeat-zeros' for the same reason.
2005-01-11 Jim Meyering <jim@meyering.net>
* configure.ac: Update version to 5.3.1.
2005-01-11 Eric Blake <ebb9@byu.net>
* src/Makefile.am (check-README, check-AUTHORS): Account for $(EXEEXT).
* man/Makefile.am (all_programs): Account for $(EXEEXT).
2005-01-11 Jim Meyering <jim@meyering.net>
* src/unexpand.c (add_tab_stop): Properly diagnose a tabstop list
with decreasing values.
* src/expand.c (main): Likewise.
* src/unexpand.c (main): Check for overflow in tabstop values
specified via the obsolete form. E.g., now this command fails:
_POSIX2_VERSION=1 ./unexpand -$(echo '2^64+1'|bc)
Before it would act like `_POSIX2_VERSION=1 ./unexpand -1'.
* tests/unexpand/basic-1 (obs-ovflo): New test for this.
2005-01-10 Paul Eggert <eggert@cs.ucla.edu>
Respond to POSIX interpretations about pathchk -p dated 2005-01-06.
* NEWS: Document the changes.
* doc/coreutils.texi (pathchk invocation): Likewise.
* src/pathchk.c (PORTABILITY_OPTION): New constant.
(longopts, usage, main, validate_file_name):
Add support for new -P option.
Reject empty file names (unless -p is not specified and the
current system allows empty file names).
Change --portability so that is now equivalent to -p -P.
Don't test whether file name is too long, if it is known to exist.
(no_leading_hyphen): New function.
* tests/misc/pathchk1: Add tests for empty file names and
pathchk -P.
2005-01-08 Jim Meyering <jim@meyering.net>
* Version 5.3.0.
`pr --columns=N' was not equivalent to `pr -N' when also using
either -s or -w.
* src/pr.c (main): Set `explicit_columns' for --columns=N,
not just for -N. This bug has existed since the introduction
of the --columns=N option on 1998-08-15.
* NEWS: Document this.
* tests/pr/Test.pm (test_vector): For each -N test, automatically
create a new test vector using --columns=N.
2005-01-07 Paul Eggert <eggert@twinsun.com>
* src/pr.c (main): Check for column count overflow with
usages like "pr -2147483648".
2005-01-07 Jim Meyering <jim@meyering.net>
* src/pr.c (init_fps): Use xnmalloc, rather than xmalloc.
2005-01-06 Jim Meyering <jim@meyering.net>
* README: List the precise HP-UX version numbers that are affected.
Suggestion from Bob Proulx.
* Makefile.maint (sc_changelog): Specify find's `-maxdepth 2'
predicate before `-name ChangeLog' to avoid a harmless warning
from find-4.2.10.
2005-01-05 Jim Meyering <jim@meyering.net>
* tests/help-version: Punt on the uptime test, since it fails when
it can't get boot time, and I don't want that to stop `make check'.
* src/du.c (process_file): Evaluate exclusion rules against
the entire file name, not just the last component.
Reported by Robert Lindgren.
* tests/du/exclude: Test for this.
* NEWS: Document this.
Ensure that tests/Makefile.am's check-root actions stay up to date.
* Makefile.maint (sc_root_tests): New rule.
(syntax-check-rules): Add it to the list.
2005-01-04 Jim Meyering <jim@meyering.net>
* man/shred.x: Change one-line summary to reflect that shred does
not remove files by default. Suggestion from Helen Faulkner in
http://bugs.debian.org/288552
* README: Request VERBOSE=yes output when reporting test failures.
Other minor changes.
* tests/Makefile.am (check-root): Update.
2005-01-03 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h: Undo previous change; we now use Autoconf.
2005-01-03 Jim Meyering <jim@meyering.net>
* tests/stty/row-col-1: Don't set rows or columns to zero, to avoid
a bug in the TIOCGWINSZ ioctl on at least Solaris5.9 systems. Setting
either (or both) to zero would succeed, but subsequent `stty size'
would say `no size information for this device' due to the ioctl
failing with EINVAL.
* src/system.h: If PRIdMAX, PRIoMAX, PRIuMAX, and PRIxMAX are
not all defined and either ULONG_MAX or ULLONG_MAX is not defined,
then fail at compile-time rather than let tools like od produce
invalid results at run time.
2004-12-21 Jim Meyering <jim@meyering.net>
* src/csplit.c (usage): Say the default names are `xx00, xx01, ...',
not `xx01, xx02, ...'.
Reported by Matt Kraai in http://bugs.debian.org/286605
* tests/misc/split-fail: Avoid spurious failure on x86 Solaris5.9
when using c89.
2004-12-20 Paul Eggert <eggert@cs.ucla.edu>
* src/split.c (usage): Mention default size. Suggested by Dan Jacobson.
2004-12-19 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Mention that one should eval "`dircolors`" rather than
`dircolors`.
2004-12-17 Jim Meyering <jim@meyering.net>
* tests/mv/hard-link-1: Rearrange to use newer trap-handling code,
so temporary directories aren't left behind upon e.g., interrupt.
2004-12-16 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (print_dir): Use "%s: not listing already-listed
directory", not "not listing already-listed directory: %s", to
format already-listed directories, to be consistent with other
diagnostics involving file names and colons.
2004-12-15 Jim Meyering <jim@meyering.net>
* src/Makefile.am (__LDADD): Define, so that building `[' on
Solaris still uses the -lgen library that it requires in order
to get a definition of eaccess.
2004-12-14 Jim Meyering <jim@meyering.net>
tac would exit immediately upon I/O or temp-file creation failure.
Now it continues on, processing any remaining command line arguments.
* src/tac.c: Include quotearg.h.
Use quotearg_colon in most diagnostics.
(copy_to_temp): Rewrite not to exit upon I/O or temp-file-creation
failure. Before, this command (with /full/tmp being a full partition)
TMPDIR=/full/tmp ./tac /proc/modules tac.c
would exit immediately upon the write error while trying to copy
non-seekable /proc/modules to the full partition. Now it still
reports the failure but continues on with the remaining file.
(tac_nonseekable): Return false also if copy_to_temp fails.
[DONT_UNLINK_WHILE_OPEN]: Add a FIXME comment explaining that
using atexit like this is wrong.
* NEWS: Document this.
* tests/misc/tac-continue: New test for this.
* tests/misc/Makefile.am (TESTS): Add tac-continue.
* tests/chown/basic: Add a few more tests.
2004-12-13 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (gobble_file): Change arg name to be command_line_arg
rather than explicit_arg, for consistency with copy.c.
(extract_dirs_from_files): Remove ignore_dot_and_dot_dot arg, since
it is deducible from dirname arg. All callers changed.
(extract_dirs_from_files, print_dir, queue_directory):
Add command_line_arg arg. All callers changed.
(struct pending): Add command_line_arg member.
(main): Use NULL rather than 0 when appropriate.
(set_exit_status, file_failure): New functions.
(queue_directory): Store command_line_arg into new structure.
(print_dir, gobble_file, get_link_name):
Use file_failure to report problems in accessing files,
so that the exit status is set consistently.
(print_dir): Simplify readdir failure code yet again.
If closedir fails, report "closing directory" rather than "reading
directory" failure.
(xstrcoll): Use set_exit_status to set status on failure.
* tests/ls-2/tests (no-a-isdir-b): This now exits with status 2,
not status 1.
2004-12-11 Jim Meyering <jim@meyering.net>
Avoid a race condition vulnerability in chown, when used with
--from=O:G and without the (-h) --no-dereference option.
* src/chown-core.c (restricted_chown): New function.
(change_file_owner): Call it.
Reported by Ulrich Drepper.
* NEWS: Mention this.
2004-12-09 Paul Eggert <eggert@cs.ucla.edu>
* ls now exits with status 1 on minor problems, 2 if serious trouble.
* NEWS: Document this.
* src/ls.c (LS_MINOR_PROBLEM, LS_FAILURE): New constants.
All uses of EXIT_FAILURE replaced with LS_FAILURE, unless
specified below.
(main): Initialize exit failure to LS_FAILURE.
(print_dir, gobble_file, get_link_name, xstrcoll):
Set exit status to LS_MINOR_PROBLEM if the failure is minor.
(print_dir): Do not give up on entire directory merely because readdir
returns EOVERFLOW.
(usage): Explain exit status.
* tests/help-version: ls and variants now exit with status 2
on serious trouble.
2004-12-08 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document new UTC+HH:MM date syntax, and put date changes
together.
2004-12-07 Paul Eggert <eggert@cs.ucla.edu>
* src/factor.c (factor): Don't list 1 as a factor of 1.
Problem reported by Thomas Folz-Donahue.
2004-12-06 Jim Meyering <jim@meyering.net>
* tests/du/files0-from: Sanitize environment.
Otherwise, e.g., BLOCKSIZE=k would cause a failure, and that
setting is the default (exported from /etc/profile) on at least one
NetBSD 1.6 system.
* tests/du/no-deref: Likewise.
* tests/cp/symlink-slash: Likewise.
* tests/ls/symlink-slash: Likewise
2004-12-05 Jim Meyering <jim@meyering.net>
* tests/tail/Test.pm (err-6) ["tail -c"]: Avoid test failure when
_POSIX2_VERSION=199209 is in the environment, or when building on
e.g., OpenBSD 3.2.
2004-12-04 Jim Meyering <jim@meyering.net>
* NEWS: Mention cut's new --complement option.
2004-10-01 Paolo Bonzini <bonzini@gnu.org>
* cut.c (complement, COMPLEMENT_OPTION): New.
(longopts): Add --complement.
(usage): Say not that -b, -c, and -f `print' fields,
but rather that they `select' fields for printing.
Describe the new --complement option.
(mark_range_start): Extracted from set_fields.
(print_kth): Support --complement.
(compare_ranges): New function.
(set_fields): Rewrite the part that populates range_start_ht,
merging it with the part that populates printable_field.
(main): Handle --complement.
2004-12-03 Paul Eggert <eggert@cs.ucla.edu>
* src/tail.c (tail_file): Set errnum to -1 if the initial "tail"
failed. This works around an assertion failure reported by
Roberto Nibali in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-12/msg00012.html
2004-12-02 Jim Meyering <jim@meyering.net>
With using --color and with LS_COLORS saying not to color
executables, don't stat every file.
* src/ls.c (is_colored): New function.
(gobble_file): Use it.
(main): Use it here, in place of too-strict tests against NULL:
if either ORPHAN or MISSING was set to 0 from LS_COLORS, the
old test would fail.
2004-12-01 Paul Eggert <eggert@cs.ucla.edu>
* src/comm.c (compare_files): Assume setlocale exists.
* src/join.c (keycmp): Likewise.
* src/seq.c (decimal_point): Treat like sort. Now char.
All uses changed.
(main): Assume localeconv exists. Use same code as sort.
* src/sort.c (C_DECIMAL_POINT): Remove. Use changed to '.'.
Assume setlocale exists.
(thousands_sep): Renamed from th_sep.
(IS_THOUSANDS_SEP): Remove. All uses replaced by comparisons.
(NONZERO): Parenthesize use of arg.
(numcompare): Avoid duplicate loads. Use ISDIGIT as boolean, for
consistency. Avoid unnecessary negation by reversing
fraccompare args.
(main): Rewrite localeconv call to match seq.c.
* src/system.h: Assume locale.h exists.
(HAVE_SETLOCALE): Remove.
* src/uniq.c (different): Assume setlocale exists.
* src/ls.c (sort_files): Minor cleanup. Remove an unnecessary
'volatile' on a local variable. Rewrite to avoid unnecessary
double-assignment to 'func' in the usual case where strcoll does
not fail.
2004-11-30 Paul Eggert <eggert@cs.ucla.edu>
* src/pinky.c (gethostname): Remove decl.
(scan_entries): Use IS_USER_PROCESS instead of by-hand code.
* src/uptime.c (print_uptime): Use IS_USER_PROCESS and
UT_TYPE_BOOT_TIME instead of by-hand code.
* src/users.c (list_entries_users): Use IS_USER_PROCESS
instead of by-hand code.
* src/who.c (USER_PROCESS, RUN_LVL, INIT_PROCESS, LOGIN_PROCESS,
DEAD_PROCESS, BOOT_TIME, NEW_TIME, UT_TYPE_UNDEF, UT_TYPE): Remove.
(IS_USER_PROCESS): Move to ../lib/readutmp.h.
(UT_TYPE_RUN_LVL, UT_TYPE_INIT_PROCESS, UT_TYPE_LOGIN_PROCESS,
UT_TYPE_DEAD_PROCESS, UT_TYPE_NEW_TIME): New macros.
(gethostname): Remove decl.
(list_entries_who, scan_entries): Use the new macros defined above,
for consistency with pinky, uptime, and users.
2004-11-25 Paul Eggert <eggert@cs.ucla.edu>
Fix problem reported by Scott S. Tinsley for HP-UX 11.11 using
HP's ANSI C compiler. Declaring int functions causes warnings on
some modern systems and shouldn't be needed to compile on ancient
ones.
* src/copy.h (stat, lstat, rename): Remove decls.
* src/install.c (stat): Remove decl.
* src/ln.c (link, symlink): Remove decls.
2004-11-25 Jim Meyering <jim@meyering.net>
* man/help2man: Import help2man-1.35.1.
* man/Makefile.am (.x.1): Remove now-unnecessary use of
locally-added --program-name=NAME option. Now, help2man gets
the name from the [NAME] section (i.e. from our .x file).
* man/install.x: Use `install', not `ginstall' in the one-line
description. Reported by Brendan O'Dea.
* man/sha1sum.x: Use `sha1sum', not `shasum'.
2004-11-24 Jim Meyering <jim@meyering.net>
Since the changes of 2004-05-22, the u.saved_cwd member at
the bottom of the active-directory stack was no longer
strictly necessary. This change removes that member and uses
the newer cwd_state parameter for the final restore_cwd.
* src/remove.c (struct AD_ent) [u]: Remove now-unnecessary union.
[dev_ino]: Rename from `a'.
(AD_pop_and_chdir): Add a parameter to play the role of just-removed
bottom-of-stack cwd-state member.
(AD_pop_and_chdir): No longer return boolean. Adjust caller.
(AD_push_initial): Remove CWD parameter. Adjust caller.
2004-11-23 Paul Eggert <eggert@cs.ucla.edu>
Minor performance improvements and cleanups for "touch".
* src/touch.c (posix_date): Remove; not needed as a static var.
All uses rewritten.
(touch): Use new futimens function to operate more efficiently
in some cases. Don't stat/fstat existing file when
(!amtime_now && change_times == (CH_ATIME | CH_MTIME)); the
old time stamps aren't needed in that case.
(main): change_times is int, not bool. Simplify test for
change_times.
2004-11-20 Paul Eggert <eggert@cs.ucla.edu>
* src/install.c (usage): Avoid usage that runs afoul of Docbook
translation. Problem reported by Eric S. Raymond.
Restore dd's noctty flag, reverting the change of 2004-04-08.
POSIX does not allow "dd" to use O_NOCTTY by default.
* NEWS: Add noctty flag to dd.
* doc/coreutils.texi (dd invocation): Likewise.
* src/dd.c (flags, usage, main): Likewise.
2004-11-19 Alfred M. Szmidt <ams@gnu.org>
* src/ls.c (usage): Clarified description of --no-group (-G),
--human-readable (-h), --inode (-i), --size (-s), --time,
and --time-style.
2004-11-19 Jim Meyering <jim@meyering.net>
* src/ls.c (usage): Clarify description of --author.
Tweak indentation so that help2man creates better nroff.
Reported by Dan Jacobson.
* src/uniq.c (check_file): Don't check stdout for errors here.
* src/pwd.c (find_dir_entry): Update comment to match reality.
2004-11-18 Jim Meyering <jim@meyering.net>
* src/pwd.c (robust_getcwd): Correct the comment: this function
constructs the directory name. The caller prints it.
2004-11-16 Paul Eggert <eggert@cs.ucla.edu>
* src/stat.c (STATFS): New macro, for portability to Solaris 9.
(do_statfs): Use it.
* src/basename.c, src/chroot.c, src/cksum.c, src/dd.c, src/dirname.c,
src/factor.c, src/hostid.c, src/hostname.c, src/link.c, src/logname.c,
src/nohup.c, src/printenv.c, src/pwd.c, src/setuidgid.c, src/sleep.c,
src/sync.c, src/tsort.c, src/unlink.c, src/uptime.c, src/users.c,
src/whoami.c, src/yes.c (main): Use getopt_long rather than getopt.
* src/readlink.c (main): argv is not const.
* src/cut.c (usage): Improve documentation along the lines suggested
by Debian 5.2.1-2.
* src/echo.c (usage): Likewise.
* src/expr.c (usage): Likewise.
* src/dircolors.hin: Add putty, screen-bce.
* src/pinky.c (print_entry): Fix memory leak.
* src/who.c (print_user): Likewise.
2004-11-15 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: New dd operand "status=noxfer".
* src/dd.c (C_ASCII, C_EBCDIC, C_IBM, C_BLOCK, C_UNBLOCK,
C_LCASE, C_UCASE, C_SWAB, C_NOERROR, C_NOTRUNC, C_SYNC, C_TWOBUFS,
C_NOCREAT, C_EXCL, C_FDATASYNC, C_FSYNC): Now constants, not
macros.
(STATUS_NOXFER, statuses): New constants.
(usage, print_stats, scanargs): Add support for status=noxfer.
(usage): Update status output to match new behavior.
(print_stats): Always output complete byte count.
Put space between numbers and units, as SI requires.
Use ngettext so that i18n can use plurals for "byte" and "second".
Don't multiply by 1e-9 (inexact); divide by 1e9 (which is exact).
(iflag_error_msgid, oflag_error_msgid): Remove; replace uses by
the string.
* tests/dd/skip-seek (@Tests): Use status=noxfer to avoid
problems with regression testing.
2004-11-14 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: dd now outputs total bytes, seconds, and bytes per second.
* src/Makefile.am (dd_LDADD): Add $(LIB_CLOCK_GETTIME).
* src/dd.c: Include "human.h".
(w_bytes, start_time): New vars.
(usage): Document new I/O statistics output
(print_stats): Output new I/O statistics.
(cleanup): Do statistics after closing stdin and stdout, so that
the times are more accurate.
(write_output, dd_copy): Count output bytes.
(main): Get initial value of clock.
2004-11-14 Jim Meyering <jim@meyering.net>
Backslash-escape `-'s in email addresses, so that they are
rendered properly in UTF-locales.
* man/help2man (escape_hyphens): New function.
(main): Call it on email addresses.
* src/sort.c (zaptemp): Mark new diagnostic for translation.
* tests/misc/close-stdout: New file. Test today's closeout.c change.
* tests/misc/Makefile.am (TESTS): Add close-stdout.
2004-11-13 Jim Meyering <jim@meyering.net>
* src/test.c (usage): Put the description of `[-n] STRING'
on two lines, one for `-n STRING' and one for `STRING' so that
help2man properly escapes the `-'. Otherwise, the hyphen is
rendered inappropriately in UTF-8 locales.
Reported by Uwe Zeisberger in http://bugs.debian.org/281069.
2004-11-12 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document the following changes.
* src/sort.c: Avoid O(N**2) behavior when there are many temporary
files.
(temptail): New variable, so that we can easily append to list.
(create_temp_file): Create new files at end of list, so that
searching the list has O(N*NMERGE) behavior instead of O(N**2).
(zaptemp): Update temptail if needed.
(mergefps, merge): Accept new arg that counts temp files, and keep it
up to date as we create and remove temporaries. This is for
efficiency, so that we don't call zaptemp so often.
All callers changed.
(sort): Don't create array in reverse order, since the list of
temporaries is now in the correct order.
(zaptemp): Protect against race condition: if 'sort' is
interrupted in the middle of zaptemp, it might unlink the
temporary file twice, and the second time this happens the file
might already have been created by some other process.
(zaptemp): Warn if a temporary file is not removed.
(create_temp_file): Use offsetof for clarity.
(die): Move it up earlier, to clean up the code a bit.
* src/pr.c (strtoumax): Declare if not declared.
(skip_to_page, first_page_number, last_page_number, page_number,
first_last_page, print_header):
Use uintmax_t for page numbers.
(first_last_page): Remove unnecessary forward declaration.
Do not modify arg (it is now a const pointer).
Return a true if successful, false (without print a diagnostic)
otherwise.
(main): If +XXX does not specify a valid page range, treat it
as a file name. This follows the response to Open Group XCU ERN 41
<http://www.opengroup.org/sophocles/show_mail.tpl?source=L&listname=austin-group-l&id=7717>,
which says the behavior is allowed.
(skip_to_page): When starting page number exceeds page count,
print both numbers in the diagnostic.
(print_header): Detect page number overflow.
2004-11-07 Jim Meyering <jim@meyering.net>
* src/uname.c [__APPLE__]: Include <mach/machine.h> and <mach-o/arch.h>.
(main) [__APPLE__]: Get the processor type via syscall rather than
hard-coding "powerpc". From Toby Peterson.
* src/sort.c (merge): Remove declarations of now-unused variables.
2004-11-06 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (first_same_file): Remove. Move most of the code to....
(avoid_trashing_input): New function.
(merge): Avoid some silly merges, e.g., copying a single file to
a temporary file when there are exactly 17 input files to merge.
Take a count of temporary files rather than a max_merge arg.
All uses changed.
2004-11-06 Jim Meyering <jim@meyering.net>
* src/sort.c (xfclose): Don't close stdout here (just flush it),
since close_stdout now closes stdout unconditionally.
2004-11-05 Paul Eggert <eggert@cs.ucla.edu>
* src/sort.c (inittables, sort_buffer_size, getmonth, mergefps,
first_same_file, merge, sort, main): Use size_t for indexes to arrays.
This fixes some unlikely havoc-wreaking bugs (e.g., more than INT_MAX
temporary files).
(getmonth, keycompare, compare): Rewrite to avoid need for alloca,
thus avoiding unchecked stack overflow in some cases. As a side
effect this improve the performance of "sort -M" by a factor of 4
on my benchmarks.
2004-11-03 Paul Eggert <eggert@cs.ucla.edu>
* src/stty.c: Include "vasprintf.h" since we use vasprintf now.
* src/Makefile.am (check-AUTHORS): Don't assume \? works in a sed
expression; it's not portable. Problem reported by Albert Chin.
Don't invoke a program more than once.
* src/groups.sh (version): New variable, containing author info,
for benefit of AUTHORS check. Use it when acting on --version option.
* AUTHORS: Remove duplicate lines. Remove bogus "chroot:"
in groups line.
* src/system.h: Don't #define and #undef getopt around <stdlib.h>,
as this breaks the new regime that does "#define getopt rpl_getopt".
Problem reported by Albert Chin for Solaris 9 with Sun cc in:
http://lists.gnu.org/archive/html/bug-gnulib/2004-11/msg00019.html
I suppose this may cause problems on ancient hosts with
incompatible getopt declarations, but we'll cross that bridge if
the problem gets reported to us by someone who can test the fix.
2004-11-03 Jim Meyering <jim@meyering.net>
* src/tac.c: quote(...) file names in diagnostics.
2004-10-29 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Document getdate changes.
2004-10-29 Jim Meyering <jim@meyering.net>
* src/tac.c (tac_file): Remove temporary prototype and move this
function `down' so that it precedes definition of tac_nonseekable.
`tac /proc/modules' would print nothing
Reported by Harald Dunkel in http://bugs.debian.org/278604.
* src/tac.c (copy_to_temp): Renamed from save_stdin, since
now it copies a general file descriptor, not just stdin.
(tac_nonseekable): Renamed/adapted from tac_stdin.
(tac_file): Get fd via `open' directly rather than via fopen/fileno,
since we never used the stream. Perform "-" to stdin mapping here
rather than in main. Determine whether a file is seekable,
by trying to `lseek' to its end, and dispatch to tac_seekable or
tac_nonseekable accordingly.
(main): Rewrite argument handling now that it uses only tac_file.
* NEWS: Mention it here.
2004-10-21 Jim Meyering <jim@meyering.net>
* tests/mv/leak-fd: New file.
* tests/mv/Makefile.am (TESTS): Add it.
* tests/rm/dot-rel: New file.
* tests/rm/Makefile.am (TESTS): Add it.
Correct my patch of 2004-10-18.
* src/remove.c (rm): Destroy the saved_cwd here (via cwd_state),
if necessary, not in remove_dir. Otherwise, removing multiple
`.'-relative nonempty directories no longer worked.
2004-10-20 Paul Eggert <eggert@cs.ucla.edu>
* src/fmt.c (usage): Improve description of --prefix.
Problem reported by Edward Welbourne.
* man/uniq.x: Change summary so that it doesn't imply that
uniq writes to its input file. Problem reported by
Dan Jacobson.
2004-10-18 Jim Meyering <jim@meyering.net>
Plug a leak that would cause a cross-device mv to fail when
operating on too many command-line-specified nonempty directories.
* src/remove.c (remove_dir): Destroy the `struct saved_cwd' on the
top of the stack before returning. This usually closes the file
descriptor that was used to return to the original working directory.
Reported by Cyril Bouthors in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/3048
* NEWS: Mention it here.
* src/pathchk.c (validate_file_name): Give a more descriptive
diagnostic when pathconf fails. This also avoids an unwarranted
warning from gcc-3.3.5 about a format not being a string literal.
* src/sleep.c (main): Remove declaration of unused local, c.
* src/printenv.c (main): Likewise.
* src/logname.c (main): Likewise.
* src/uptime.c (main): Likewise, for optc.
* src/tsort.c (main): Likewise, for opt.
2004-10-17 Paul Eggert <eggert@cs.ucla.edu>
* AUTHORS: Add self to pathchk.
* src/pathchk.c (AUTHORS): Add self.
Change "path" to "file name" whenever possible.
Remove usage comment, as it was a duplication of the code or doc.
Include <wchar.h> if available.
(mbrlen, mbstate_t) [! (HAVE_MBRLEN && HAVE_MBSTATE_T)]: Define.
(NEED_PATHCONF_WRAPPER, PATH_MAX, PATH_MAX_FOR, NAME_MAX,
pathconf_wrapper, portable_chars, dir_ok): Remove.
(NAME_MAX_MINIMUM, PATH_MAX_MINIMUM): New macros.
(pathconf, _PC_NAME_MAX, _PC_PATH_MAX): Define if nonexistent.
(portable_chars_only): New arg FILELEN.
Don't assume ASCII; we might be on an EBCDIC host.
Don't assume unibyte locale in diagnostic.
(component_start, component_len): New functions.
(validate_file_name): Renamed from validate_path. All uses changed.
Pretty much a complete rewrite.
Don't make copy of file arg. Always append trailing slash to
pathconf arg, just in case it's a symlink (this is pure paranoia;
we don't know of any hosts where the trailing slash is required).
Use size_t instead of long int when possible.
Avoid need to call pathconf in most practical cases.
Don't use euidaccess several times to test searchability;
just use lstat once. Reword diagnostic to put the (often very long)
file names last.
2004-10-15 Paul Eggert <eggert@cs.ucla.edu>
* src/printf.c (usage): Mention Unicode, and use H for hex digits.
2004-10-13 Jim Meyering <jim@meyering.net>
* NEWS: Mention today's fts.c fix.
2004-10-13 Paul Eggert <eggert@cs.ucla.edu>
* tests/stty/row-col-1: Set LC_ALL=C.
2004-10-12 Jim Meyering <jim@meyering.net>
* src/dircolors.hin: Add .flac and .mpc as audio suffixes.
From Jesus Climent in http://bugs.debian.org/276149.
2004-10-05 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (ignore_mode): Renamed from ignore, to avoid shadowing
problems. All uses changed.
2004-10-05 Jim Meyering <jim@meyering.net>
* .x-sc_trailing_blank: Add an exclusion for config/texinfo.tex,
since Karl says its trailing blanks are there to stay :-)
2004-10-04 Paul Eggert <eggert@cs.ucla.edu>
* src/expr.c (NEW, OLD): Remove, partly to avoid
reference to obsolescent macro XMALLOC.
All uses replaced by xmalloc and free.
2004-09-28 Jim Meyering <jim@meyering.net>
* src/tail.c (usage): Clarify: --retry works only with --follow=name.
Reported by Nik A. Melchior in http://bugs.debian.org/273781.
2004-09-27 Paul Eggert <eggert@cs.ucla.edu>
* src/od.c (format_address_paren): c is optional, so don't output
it if it's '\0'.
2004-09-26 Paul Eggert <eggert@cs.ucla.edu>
Add support for ls --hide. Idea suggested by Bardur Arantsson.
* NEWS: Document this.
* src/ls.c (file_ignored): Renamed from file_interesting, with
inverted return value. Accept the file name, not a struct dirent *.
All uses changed. Avoid the expense of calling fnmatch if the
file is ignorable due to leading '.'.
(all_files, really_all_files): Removed; replaced by:
(ignore): New variable. All uses changed.
(IGNORE_DEFAULT, IGNORE_DOT_AND_DOTDOT, IGNORE_MINIMAL, HIDE_OPTION):
New constants.
(hide_patterns): New variable.
(long_options, decode_switches, file_ignored, usage):
Add support for --hide.
(patterns_match): New function.
(usage): Replace "hide" with "ignore" in explanation, to avoid
confusion.
2004-09-25 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (gobble_file, print_long_format): Don't assume that
human-readable output has a byte count equal to its column width;
this isn't always true in locales where the radix character is not
'.' or ','.
(format_user_or_group): Revamp code to match the above fix;
this avoids the (very faint) possibility of integer overflow.
2004-09-24 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: Mention that "chmod -r -w x" now works as expected.
* src/chmod.c (main): Revamp option processing to support this.
* tests/chmod/Makefile.am (TESTS): Add 'usage'.
* tests/chmod/usage: New set of tests for usage like that.
2004-09-24 Jim Meyering <jim@meyering.net>
* Makefile.maint (CVS_LIST): Use --types=AFGM option so that
it lists only cvs-controlled regular files.
* src/csplit.c (xalloc_die): Declare to be `extern', not `static'
to avoid a warning from gcc-3.4.1. Reported by Paul Eggert.
2004-09-23 Paul Eggert <eggert@cs.ucla.edu>
* Makefile.maint (CVS_LIST): New macro.
(sc_space_tab, sc_prohibit_atoi_atof, sc_file_system,
sc_prohibit_jm_in_m4, sc_system_h_headers, sc_sun_os_names,
sc_trailing_blank, po-check): Use it instead of the
nonstandard "cvsu --list".
* src/tail.c (parse_obsolete_option): Bring back support
for obsolete option followed by non-obsolete, or by more
than one file. When obsolete, conform to SUSv2 rather than
original POSIX 1003.2-1992, as SUSv2 corrected the case of
"tail -c". Add support for the SUSv2 "b" modifier.
* NEWS: Mention the above.
* tests/tail/Test.pm: New test case obs-b to check the above.
err-[134] no longer need _POSIX2_VERSION=199209.
Fix comments to match revised behavior.
2004-09-22 Jim Meyering <jim@meyering.net>
* Use automake-1.9.2. Regenerate dependent files.
* src/remove.c (struct dirstack_state) [current_arg_jumpbuf]:
Improve the comment.
Clean up scoping etc. so that some make `distcheck' tests pass.
* src/csplit.c (xalloc_die): Declare to be static.
* src/chown-core.c (chown_files): Declare as `extern'.
* src/cp-hash.c (remember_created): Likewise.
* src/copy.c (copy): Likewise.
* src/checksum.h (enum) [ALG_MD5]: Define to be 1, not 0.
* src/id.c, src/nl.c, src/expand.c: Remove trailing blanks.
* src/unexpand.c: Likewise.
* src/Makefile.am (check-AUTHORS): New rule.
(check): Depend on it.
* AUTHORS: Update.
* Makefile.maint (syntax-check-rules): Remove duplicate sc_tight_scope.
(sc_system_h_headers): Also exclude copy.h; it includes <stdbool.h>.
2004-09-22 Paul Eggert <eggert@cs.ucla.edu>
* src/ls.c (decode_switches): Don't compare a short value
to SIZE_MAX: GCC sometimes complains.
2004-09-21 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: The following commands now reject unknown options:
basename dirname factor hostname link nohup sync unlink yes
Also, pathchk no longer accepts trailing options.
* src/basename.c: Include <getopt.h>.
* src/chroot.c: Likewise.
* src/dirname.c: Likewise.
* src/factor.c: Likewise.
* src/hostid.c: Likewise.
* src/hostname.c: Likewise.
* src/nohup.c: Likewise.
* src/pwd.c: Likewise.
* src/setuidgid.c: Likewise.
* src/sync.c: Likewise.
* src/basename.c (main): Reject unknown options.
* src/dirname.c (main): Likewise.
* src/factor.c (main): Likewise.
* src/hostid.c (main): Likewise.
* src/hostname.c (main): Likewise.
* src/link.c (main): Likewise.
* src/nohup.c (main): Likewise.
* src/pwd.c (main): Likewise.
* src/setuidgid.c (main): Likewise.
* src/sync.c (main): Likewise.
* src/unlink.c (main): Likewise.
* src/yes.c (main): Likewise.
* src/cat.c (main): Remove unused "case 0".
* src/chgrp.c (main): Likewise.
* src/chmod.c (main): Likewise.
* src/chown.c (main): Likewise.
* src/comm.c (main): Likewise.
* src/cp.c (main): Likewise.
* src/csplit.c (main): Likewise.
* src/cut.c (main): Likewise.
* src/date.c (main): Likewise.
* src/df.c (main): Likewise.
* src/du.c (main): Likewise.
* src/env.c (main): Likewise.
* src/expand.c (main): Likewise.
* src/fold.c (main): Likewise.
* src/head.c (main): Likewise.
* src/id.c (main): Likewise.
* src/install.c (main): Likewise.
* src/join.c (main): Likewise.
* src/ln.c (main): Likewise.
* src/ls.c (decode_switches): Likewise.
* src/mkdir.c (main): Likewise.
* src/mkfifo.c (main): Likewise.
* src/mknode.c (main): Likewise.
* src/mv.c (main): Likewise.
* src/nl.c (main): Likewise.
* src/paste.c (main): Likewise.
* src/pinky.c (main): Likewise.
* src/pr.c (main): Likewise.
* src/ptx.c (main): Likewise.
* src/readlink.c (main): Likewise.
* src/rm.c (main): Likewise.
* src/rmdir.c (main): Likewise.
* src/seq.c (main): Likewise.
* src/shred.c (main): Likewise.
* src/split.c (main): Likewise.
* src/sum.c (main): Likewise.
* src/tac.c (main): Likewise.
* src/tail.c (main): Likewise.
* src/tee.c (main): Likewise.
* src/touch.c (main): Likewise.
* src/tr.c (main): Likewise.
* src/tty.c (main): Likewise.
* src/uname.c (main): Likewise.
* src/unexpand.c (main): Likewise.
* src/wc.c (main): Likewise.
* src/who.c (main): Likewise.
* src/chroot.c (main): Use getopt where it suffices, not getopt_long.
* src/cksum.c (main): Likewise.
* src/dd.c (main): Likewise.
* src/logname.c (main): Likewise.
* src/printenv.c (main): Likewise.
* src/sleep.c (main): Likewise.
* src/tsort.c (main): Likewise.
* src/uptime.c (main): Likewise.
* src/users.c (main): Likewise.
* src/whoami.c (main): Likewise.
* src/du.c (long_options): Standardize on NULL vs 0.
* src/rm.c (long_opts): Likewise.
* src/logname.c (long_options): Remove.
* src/printenv.c (long_options): Likewise.
* src/sleep.c (long_options): Likewise.
* src/tsort.c (long_options): Likewise.
* src/uptime.c (longopts): Likewise.
* src/users.c (longopts): Likewise.
* src/whoami.c (long_options): Likewise.
* src/pathchk.c (longopts): Add --help, --version.
(main): Use longopts rather than parse_long_options.
* src/stty.c (longpts, main): Likewise.
* src/pathchk.c (main): Don't reorder arguments, so that
we can check weird file names.
* src/readlink.c: Don't include "long-options.h".
* src/sort.c: Likewise.
* src/stty.c: Likewise.
* src/split.c (verbose): Now bool, not int.
(VERBOSE_OPTION): New enum.
(longopts, main): Use it.
* tests/factor/basic: Adjust to new wording in diagnostic
that results from the above changes.
2004-09-21 Jim Meyering <jim@meyering.net>
* man/rm.x: Say "the response is affirmative" rather than "the
response begins with y or Y", so that the documentation is
accurate in non-English locales. Problem reported by Munzir Taha.
2004-09-19 Paul Eggert <eggert@cs.ucla.edu>
* src/echo.c (main): Don't pass NULL to strcmp when
POSIXLY_CORRECT and given no arguments.
* src/md5sum.c (STRING_OPTION): Remove.
(long_options, main): Remove support for undocumented and
obsolete --string option, as suggested in the 1996-09-26 patch.
* NEWS: Document this.
* tests/rm/fail-eperm: Don't try to remove writeable files in a
sticky /tmp directory, as SVR4-like systems (e.g., Solaris 9) let
you remove such files. Problem reported by Bert Fischer in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00074.html
2004-09-18 Paul Eggert <eggert@cs.ucla.edu>
* src/md5sum.c (STATUS_OPTION, STRING_OPTION): New enums.
(long_options, main): Use them instead of magic numbers 2 and 1.
For --string, optarg can't possibly be NULL.
* src/dd.c (usage): Distinguish between options and operands.
(scanargs): Don't mess with argc, argv; getopt_long handles this now.
Say "operands" for operands, not "options".
(main): Use getopt_long, so that "dd --" works as POSIX requires.
* tests/dd/misc: Check for "dd --".
* src/chroot.c (main): Reject unknown options instead of
interpreting them as a directory to chroot to.
* src/cksum.c: Remove obsolete comment about POSIX 1003.2/D11.2.
The current standard (POSIX 1003.1-2004) is correct.
(crc_remainder) [defined CRCTAB]: Renamed from "remainder" to avoid
collision with builtin function.
(main) [defined CRCTAB]: Output in lowercase hexadecimal, and
output the first 0 as 8 digits, to make it easier to compare to
the text of the standard. Output crctab to be a const array.
(crctab): Use result of above changes.
(long_options): Remove; not needed if empty.
(main): getopt_long can't return 0 here, so simplify the code.
2004-09-13 Jim Meyering <jim@meyering.net>
* src/Makefile.am (localedir.h): Don't redirect directly to target.
2004-09-13 Paul Eggert <eggert@cs.ucla.edu>
* src/id.c (print_full_info): Don't exit with failure status simply
because a user or group number can't be turned into a name.
Problem reported by Felipe Kellermann in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-09/msg00081.html
2004-09-12 Jim Meyering <jim@meyering.net>
* Makefile.maint (my-distcheck): When building with -Werror, also
require -Wshadow.
2004-09-10 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "tail" now handles obscure POSIX 1003.2-1992 cases better.
* src/tail.c (parse_obsolete_option): Renamed from
parse_obsolescent_option, since the options are obsolete now.
Remove bool *arg; just exit if there's an error. Revamp to follow
POSIX 1003.2-1992 more precisely, to handle cases like "tail -
file" and "tail -10 -- file" correctly when we are conforming to
the older standard.
(main): Adjust to this change.
* tests/tail/Test.pm (test_vector): minus-* requires
_POSIX2_VERSION=199209 now, to work correctly if there is
an input file. err-1 and err-3 no longer errors if there
is another file.
2004-09-09 Paul Eggert <eggert@cs.ucla.edu>
* src/test.c (usage): Document -r, -w, -x more carefully.
2004-09-08 Paul Eggert <eggert@cs.ucla.edu>
* src/test.c (usage): Document "test" (with no args) and "[ ]".
Document that -h and -L don't dereference.
* NEWS: Document that "tr xy -z" now works as per POSIX.
Sort the descriptions.
* src/tr.c (main): Don't reorder options.
* tests/tr/Test.pm (fowler-1): New test case.
2004-09-06 Paul Eggert <eggert@cs.ucla.edu>
* src/touch.c (main): Fix POSIX-conformance bug: "touch --
MMDDhhmm file" must be treated like "touch MMDDhhmm file" when
conforming to pre-2001 POSIX.
* NEWS: Document this.
* tests/touch/obsolescent: Test for this bug. Also, set
_POSIX2_VERSION=199209 and POSIXLY_CORRECT=1 so that it's
a better test for obsolescent features.
* src/sort.c (main): Emulate Solaris 8 and 9 "sort -y", so that
"sort -y abc" is like "sort abc" whereas "sort -y 100" is like
plain "sort".
* src/od.c: Several changes for POSIX and FreeBSD compatibility.
(COMMON_SHORT_OPTIONS): Add -B, -D, -e, -F, -H, -I, -L, -O, -s, -X.
(long_options, main): --strings is now -S, not -s.
(usage): Reflect the usage changes.
(parse_old_offset): Do not issue a diagnostic on failure;
callers now do this as necessary.
(main): Support POSIX syntax. Remove unused case 0 from getopt_long.
Add support for new short options (many undocumented) for
compatibility with FreeBSD. Remove FIXME for -s; it's now
POSIX-compatible. Default format is now oS, not o2.
* NEWS: Describe the above.
2004-09-05 Paul Eggert <eggert@cs.ucla.edu>
* src/stty.c (valid_options): Remove.
(main): Fix some bugs in handling invalid option-combinations
like "stty -F".
(recover_mode): Arg is now char const *, not char *.
(main): Use STDIN_FILENO, not 0.
Simplify option-parsing code a tad.
* tests/stty/basic-1: Check for the fixed bugs.
2004-09-03 Paul Eggert <eggert@cs.ucla.edu>
* src/stat.c (HAVE_STRUCT_STATXFS_F_TYPE): Fix typo that prevented
it from ever being nonzero. Reported by Pozsar Balazs in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00189.html
(human_fstype): Add ramfs, squashfs, sysfs.
Reported by Pozsar Balazs in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00188.html
(human_fstype): Return char const *, not char *.
Simplify internals a bit, and avoid casts.
* src/dd.c (usage): "alternated EBCDIC" -> "alternate EBCDIC".
(bit_count): Remove. All uses changed to....
(multiple_bits_set): New function.
(scanargs): Use it, and check separately for each set of
incompatible options, to improve diagnostics.
(MX): Remove.
(apply_translations): Move checks for incompatible options
to scanargs, so that they're done consistently.
2004-09-02 Paul Eggert <eggert@cs.ucla.edu>
Output correct errno-related diagnostic on "paste" I/O errors.
* src/paste.c (write_error, xputchar): New functions.
(paste_parallel): Use correct errno value after input error.
(paste_parallel, paste_serial): Report errno value after output error.
Port to diet libc. Problem reported by Felix von Leitner in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00171.html
* src/paste.c (dummy_closed, CLOSED, dummy_endlist, ENDLIST): Remove;
it's not portable C to assume FILE is a complete type.
(paste_parallel): Use index test instead of ENDLIST, and NULL
instead of CLOSED.
2004-08-24 Paul Eggert <eggert@cs.ucla.edu>
POSIX-conformance fixes for "expand" and "unexpand".
Also, consistently use "tab stop" rather than "tabstop".
* NEWS: Document fixes.
* src/expand.c: Revamp to resemble the new unexpand.c better.
(usage): -i does not convert tabs after non-tabs.
(add_tab_stop): Renamed from add_tabstop. All uses changed.
(parse_tab_stop): Renamed from parse_tabstop. All uses changed.
(validate_tab_stop): Renamed from validate_tabstop. All uses changed.
(next_file, main): Check fclose against 0, not EOF.
(expand): Remove unnecessary casts.
Add another loop nesting level, for lines, so that per-line variables
are initialized cleanly.
Revamp tab checking. Check for write error immediately, rather
than just once at the end of the program.
* src/unexpand.c: Lkewise (for the expand.c changes).
(TAB_STOP_SENTINEL): Remove.
(tab_size): Now size_t, not uintmax_t, since we need to store
the sequences of blanks.
(max_column_width): New var.
(usage): Say "blank" where POSIX requires this.
(add_tab_stop): Calculate maximum column width.
(unexpand): Store the pending blanks, instead of merely counting them.
Follow POSIX's rules about -a requiring two blanks before a tab stop.
Get rid of internal label and goto.
* tests/unexpand/basic-1: Fix infloop-3 to match POSIX.
Add blanks-1 through blanks-13.
2004-08-19 Paul Eggert <eggert@cs.ucla.edu>
* NEWS: "chown : file", "chown '' file", and "chgrp '' file" now
succeed without changing the uid and gid, like FreeBSD.
* src/chgrp.c (parse_group): Return gid_t rather than storing it
through a pointer. Treat "chgrp '' file" as a no-op change,
as FreeBSD does.
(main): Set chopt.group_name to NULL if the group is the empty
string.
* src/chown-core.c (describe_change): Describe changes to -1:-1
without using "to OWNERSHIP" phrase.
* src/chown.c (usage): "chown '' file" is now allowed.
(main): Do not set user name to the empty string if the group
name is null.
* tests/chgrp/basic: Test "chgrp '' file".
* tests/chown/Makefile.am (TESTS): Add separator.
* tests/chown/separator: New file, partly taken from
Dmitry V. Levin's suggestion in
<http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00102.html>
2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
* tests/install/basic-1: Test for the -d regression.
2004-08-11 Dmitry V. Levin <ldv@altlinux.org>
* src/install.c (main): Fix -d regression introduced with
--target-directory support at 2004-06-25.
2004-08-11 Paul Eggert <eggert@cs.ucla.edu>
* src/copy.c (copy_internal): When preserving links, unlink
a destination with link count greater than one. This is so
that commands like "cp -a" don't get confused when copying into
a destination that already contains many hard links. Problem
reported by Tim Waugh in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00053.html
2004-08-10 Paul Eggert <eggert@cs.ucla.edu>
Convert all files to UTF-8.
* tests/fmt/basic (8-bit-pfx): Use UTF-8, not Latin-1.
* tests/sort/Test.pm (16a): Likewise.
* tests/uniq/Test.pm (8): Likewise.
* tests/misc/printf-hex: Use ASCII, not Latin-1.
* NEWS: Document "sort -o -" and "tee -" POSIX-conformance fixes.
* src/shred.c (usage): "-" is an operand, not an option.
* src/sort.c (die, xfopen, mergefps, first_same_file, merge):
A null file arg means standard output.
(main): "-o -" means to write to a file named "-",
not to standard output.
* src/tee.c (usage, tee): "tee -" writes to standard output, not
to a file named "-".
2004-08-10 Dmitry V. Levin <ldv@altlinux.org>
* src/install.c (change_timestamps): Fix int->bool conversion
bugs introduced on 2004-07-29.
2004-08-09 Paul Eggert <eggert@cs.ucla.edu>
* src/shred.c (wipename): Work even if the directory is writeable
and not readable. Prefer write access, since this should work
better with fdatasync.
* src/csplit.c (xalloc_die): New function.
(main): Remove now-obsolete initialization of xalloc_fail_func.
* src/md5sum.c: Adjust to sha->sha1 renaming.
2004-08-08 Dmitry V. Levin <ldv@altlinux.org>
Minor code cleanup.
* src/readlink.c (canonicalize_fname): Remove unneeded proxy function.
(can_mode): Make variable local.
2004-08-07 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (O_BINARY) [!O_BINARY && defined O_BINARY]:
Do not define, to avoid annoying compiler messages on QNX 6.3.
Problem reported by Johan in:
http://lists.gnu.org/archive/html/bug-coreutils/2004-08/msg00050.html
2004-08-04 Paul Eggert <eggert@cs.ucla.edu>
* src/system.h (PRIdMAX, PRIoMAX, PRIuMAX, PRIxMAX):
Define to a concatenation of string literals, not to an expression;
needed for concatenation contexts.
(INTMAX_MAX, INTMAX_MIN): New macros.
* src/stat.c (print_stat): Don't assume st_ino / st_dev fits in
unsigned long; this isn't true for st_ino on Solaris 9.
2004-08-03 Paul Eggert <eggert@cs.ucla.edu>
* src/uname.c: Do not depend on HAVE_SYSCTL when deciding
whether to include files. Include <sys/param.h> if
HAVE_SYS_PARAM_H (not HAVE_SYSCTL).
(main) [defined __POWERPC__]: Add a kludge to work around a
Mac OS X bug, so that uname -p defaults to "powerpc" if
sysctl ((int[]) {CTL_HW, HW_MACHINE_ARCH}, 2, buffer, &bufsize, 0, 0)
fails. Problem reported by Petter Reinholdtsen in:
http://lists.gnu.org/archive/html/bug-gnu-utils/2003-02/msg00201.html
* src/uniq.c (hard_LC_COLLATE, ignore_case, different, check_file,
main): Use bool for booleans.
(writeline, check_file): Use uintmax_t for line counts.
(check_file): Check for and report line number overflow,
when that matters.
* src/wc.c (iswspace, wc): Use to_uchar rather than a cast.
(print_lines, print_words, print_chars, print_bytes, print_linelength,
have_read_stdin, wc, wc_file, main):
Use bool for booleans.
(exit_status): Remove.
(wc, wc_file): Return bool status. All callers changed.
* src/who.c (scan_entries): 0 -> STDIN_FILENO.
* src/whoami.c (main): Print uids using unsigned long int, not
unsigned int.
* src/unexpand.c: Int cleanup and minor reorganization to be more
like src/expand.c.
Include quote.h, xstrndup.h.
(TAB_STOP_SENTINEL): Increase from INT_MAX to INTMAX_MAX.
(convert_entire_line, have_read_stdin, parse_tabstops, next_file,
unexpand, main):
Use bool for booleans.
(tab_size, tab_list, add_tabstop, validate_tabstops, unexpand):
Use uintmax_t for column counts.
(first_free_tab, validate_tabstops, unexpand): Use size_t for sizes.
(add_tabstop, parse_tabstops, main): Don't reserve UINTMAX_MAX
as a tab stop.
(parse_tabstops): Don't use ISBLANK on possibly-signed char.
Detect overflow in tab stop string.
(next_file, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
(unexpand): Concatenate input files the same way expand does.
* src/touch.c (no_create, use_ref, posix_date, amtime_now,
touch, main): Use bool for booleans.
(main): Avoid integer overflow when given more than INT_MAX
options.
* src/tsort.c (struct item, n_strings): Use size_t for sizes.
(have_read_stdin, count_items, scan_zeros, detect_loop,
recurse_tree, walk_tree, tsort, main):
Use bool for booleans.
(exit_status): Remove.
(tsort): Return a success flag instead of storing into a global.
(main): Use it.
* src/tty.c (silent, main): Use bool for booleans.
(main): 0 -> STDIN_FILENO.
* src/uname.c (print_element): Use bool for booleans.
* src/test.c (TRUE, FALSE, SHELL_BOOLEAN, TRUTH_OR, TRUTH_AND):
Remove. All uses replaced by C99 boolean primitives.
(TEST_TRUE, TEST_FALSE): New constants, for readability.
(test_unop, binop, unary_operator, binary_operator, two_arguments,
three_arguments, posixtest, expr, term, and, or, is_int, age_of,
one_argument, main): Use bool for booleans.
(advance, unary_advance): Now inline procedures rather than a macros.
(is_int): Renamed from isint, to avoid namespace clash with ctype.h.
(term, and, or): When it's easy, loop instead of recursing.
(term): Avoid integer overflow if there are INT_MAX-3 args (!).
(binary_operator, unary_operator): Simplify by systematically rewriting
true==FOO to FOO (where FOO is a boolean).
(unary_operator): Don't consider a file to be a regular file
merely because its mode&S_IFMT is zero. Just use S_ISREG.
Remove unnecessary casts. Remove ifdefs for things like
S_ISSOCK that are no longer needed, since stat-macros.h always
defines them now.
* src/tac-pipe.c (buf_init_from_stdin, find_bol, tac_mem):
Use bool for booleans.
(buf_init_from_stdin, buf_free, find_bol, print_line):
Use size_t for sizes.
* src/tac.c (separator_ends_record, tac_seekable, tac_file,
tac_stdin, tac_stdin_to_mem, main): Use bool for booleans.
(match_length, G_buffer_size, tac_seekable, main): Use size_t for sizes.
(tac_seekable): Use ptrdiff_t for pointer subtraction.
Report an error if the result is out of range.
(tac_seekable, main): Check for integer overflow in buffer size
calculations.
(main): Remove unnecessary casts.
* src/su.c (run_shell): Pass a new n_additional_args arg, so that
the callee doesn't have to count 'em. All callers changed.
Don't allocate more space for the arg vector than we'll need.
Use memcpy to copy the args rather than rolling our own loop.
Use size_t for sizes.
(fast_startup, simulate_login, change_environment, log_su,
correct_password, restricted_shell, main): Use bool for booleans.
(longopts): Don't assume change_environment is an int.
Use NULL, not 0, for pointers.
(xsetenv): New function, replacing xputenv and concat.
All callers changed.
(elements): Remove; no longer needed.
(log_su, correct_passwd, main): Prefer !x to x==NULL.
(log_su): 2 -> STDERR_FILENO.
(modify_environment, main): Don't assume that getenv's returned value
has an indefinite lifetime.
(modify_environment): Allocate a larger environ.
(main): Remove an impossible 'case 0'; if it happens now, it'll
get diagnosed. Don't assume getpwnam results outlive endpwent.
Check for null or empty pw_name, pw_dir and for null pw_passwd.
* src/stty.c (VA_START): Remove. All callers now use va_start.
(_POSIX_VDISABLE): Remove unnecessary cast.
(struct control_info, visible): Use cc_t for control chars.
(struct control_info): Use size_t for sizes.
(recover_mode, set_mode, display_speed, display_window_size,
valid_options, main, display_changed):
Use bool for booleans.
(integer_arg): Return unsigned long int, not long int.
Accept new max arg; all callers changed, to specify a maximum
value for integer parameters instead of silently overflowing.
(wrap): Do not overrun the stack buffer if the output contains
more than 1024 bytes. Instead, malloc a buffer.
(main): Remove a "what is this?!?" FIXME. Nobody knows what it is.
Remove unnecessary casts.
(set_control_char): Allow int values only up to cc_t range.
(screen_columns): Don't reject INT_MAX.
(display_changed, display_all, display_speed, recover_mode):
Don't assume cc_t fits in int.
* src/remove.h: Add copyright notice.
(struct rm_options): Use bool for booleans.
* src/rmdir.c (empty_paths, ignore_fail_on_non_empty, verbose,
errno_rmdir_non_empty, remove_parents, main): Likewise.
* src/sum.c (have_read_stdin, bsd_sum_file, sysv_sum_file,
main): Likewise.
(main): Don't dump core if invoked with argv[0]==NULL.
* src/tee.c (tee, append, ignore_interrupts, main, tee):
Use bool for booleans.
(tee): Use ssize_t for read returns.
* src/ptx.c: Add a FIXME mentioning that there are many
unchecked integer overflows in this file.
(gnu_extensions, auto_reference, input_reference, right_reference,
ignore_case, initialize_regex, fix_output_parameters,
output_one_roff_line, output_one_text_line, output_one_dumb_line, main):
Use bool for booleans.
(SKIP_SOMETHING, compare_words, digest_break_file,
find_occurs_in_text, fix_output_parameters):
Use to_uchar instead of a caset.
(print_field): Rewrite to avoid cast.
* src/printf.c (posixly_correct): Use bool for booleans.
(verify, main): Use EXIT_FAILURE/EXIT_SUCCESS instead of 1/0.
(STRTOX): Rewrite to avoid casts.
(print_esc_char): Arg is char, not int.
* src/readlink.c (canonicalize): Remove. All uses now merely inspect
can_mode.
(no_newline, verbose): Use bool for booleans.
(can_mode): Now of type int; use -1 to denote otherwise-uninitialized.
* src/shred.c (struct Options, main): Use bool for booleans.
(isaac_seed_data, fillpattern, wipefile): Rewrite to avoid casts.
* src/split.c (cwrite, bytes_split, lines_split, line_bytes_split):
Use bool for booleans.
* src/stat.c (G_fail): Remove.
(print_statfs): Print various gotta-be-nonnegative values using
unsigned long int, not long int or int.
(do_statfs, do_stat): Return a boolean success flag.
(do_stat, main): Use bool for booleans.
* src/pr.c: Add a FIXME mentioning that there are many
unchecked integer overflows in this file.
(TRUE, FALSE): Remove. All uses replaced by true and false.
(struct COLUMN, read_line, print_page, print_stored, open_file,
skip_to_page, init_fps, parallel_files, align_empty_cols,
empty_line, FF_only, explicit_columns, extremities, keep_FF,
print_a_FF, print_a_header, use_form_feed, have_read_stdin,
print_across_flag, storing_columns, balance_columns,
truncate_lines, join_lines, untabify_input, failed_opens,
numbered_lines, skip_count, use_esc_sequence, use_cntrl_prefix,
double_space, ignore_failed_opens, use_col_separator,
pad_vertically, last_line, main, init_parameters, skip_read,
read_line, print_stored):
Use bool for booleans.
(struct COLUMN, char_to_clump, store_char, print_char):
Use char for chars.
(clump_buff, print_clump): Use char[], not int[], for an array whose
elements are always chars.
(first_last_page, main, getoptarg, balance, add_line_number,
char_to_uclump): Remove unnecessary casts.
(init_parameters): Allocate chars, not ints, for clump_buff.
(print_char): Use to_uchar before invoking ISPRINT.
(char_to_clump): Convert to unsigned char before invoking ISPRINT.
* src/nohup.c (main): Use bool for booleans.
* src/paste.c (paste_parallel, paste_serial, main): Likewise.
* src/pathchk.c (validate-path, main, portable_chars_only): Likewise.
(portable_chars_only): Use to_uchar rather than a cast.
* src/printenv.c (main): Use bool for booleans.
Do not assume that the environ has at most one matching entry
for each option (integer overflow was possible otherwise).
* src/od.c (FMT_BYTES_ALLOCATED): Now an enum, not a decimal
constant. Do not assume PRIdMAX etc. are strings of length 3 or
less.
(struct tspec): Use it. fmt_string is now an array, not
a pointer, as there's little point to the indirection here.
(struct tspec, flag_dump_strings,
traditional, flag_pseudo_start, limit_bytes_to_format,
abbreviate_duplicate_blocks, have_read_stdin, simple_strtoul,
decode_one_format, open_next_file, check_and_close,
decode_format_string, skip, write_block, read_char, read_block,
parse_old_offset, dump, dump_strings, main):
Use bool for booleans.
(struct tspec): Use void *, not char *, for generic pointers.
(bytes_to_oct_digits, bytes_to_signed_dec_digits,
bytes_to_unsigned_dec_digits, bytes_to_hex_digits):
Use char, not unsigned int, since char suffices.
(print_s_char, print_char, print_s_short, print_short,
print_int, print_long, print_long_long, print_float,
print_double, print_long_double): Rewrite to avoid casts.
These now take void * arguments, instead of char *.
Use the same body for all functions, except for the choice
of type. Assume C89 to simplify handling of signed char.
(dump_hexl_mode_trailer, print_named_ascii, print_ascii):
Rewrite to avoid casts.
(print_named_ascii, print_ascii): Now takes void *, not char *.
(decode_one_format): Use int for printf field widths, not
unsigned int. Pass void * to subsidiary printers,
not char *. Simplify handling of floating-point formats
by factoring out common code dealing with precision and field width.
(decode_format_string): Avoid need for temporary copy of
each decoded struct tspec.
(get_lcm): Remove unnecessary cast.
(main): Fix bug where more than INT_MAX failed decodes were ignored.
2004-08-02 Paul Eggert <eggert@cs.ucla.edu>
* src/nl.c (TRUE, FALSE): Remove; all uses changed to true, false.
(enum number_format): Remove.
(FORMAT_RIGHT_NOLZ, FORMAT_RIGHT_LZ, FORMAT_LEFT): Now strings,
not enum values.
(DEFAULT_SECTION_DELIMITERS): Now an array constant, not a macro.
(section_del): Now const.
(print_fmt): Remove.
(starting_line_number, page_incr, blank_join, line_no,
print_lineno, proc_text, main):
Use intmax_t for line numbers.
(reset_numbers, have_read_stdin, build_type_arg, nl_file, main):
Use bool for booleans.
(lineno_format): Now a string, not an enum value.
(build_print_fmt): Remove. All calls removed. This work is
now done within print_lineno.
(build_type_arg): Use size_t for sizes.
(print_lineno): Check for line number overflow.
(proc_text, main): Remove unnecessary cast.
* src/ln.c (symbolic_link, interactive, remove_existing_files,
verbose, hard_dir_link, dereference_dest_dir_symlinks,
do_link, main): Use bool for booleans.
* src/ls.c (struct fileinfo, file_interesting,
extract_dirs_from_files, color_symlink_as_referent,
FILE_OR_LINK_MODE, sort_reverse, print_owner, print_group,
numeric_ids, print_block_size, dired, print_with_color,
check_symlink_color, print_inode, recursive, immediate_dirs,
all_files, really_all_files, qmark_funny_chars,
print_dir_name, format_needs_stat, format_needs_type, visit_dir,
main, decode_switches, parse_ls_color, print_dir, file_interesting,
gobble_file, make_link_path, basename_is_dot_or_dotdot,
extract_dirs_from_files, print_long_format):
Use bool for booleans.
(dir_defaulted): Remove; no longer needed.
(main): Use int to count files, since it suffices for argv.
Rewrite to avoid need for dir_defaulted.
(main, print_dir, gobble_file, get_link_name,
xstrcoll):
Set exit status to EXIT_SUCCES/EXIT_FAILURE rather than 0/1.
(decode_switches): Put back check for ws.ws_col <= SIZE_MAX.
Remove unnecessary cast to int. Use int instead of unsigned
int to count from 0 to 1.
(get_funky_string, print_type_indicator): Use char for bytes, not int.
(make_link_path): Use NULL for null pointers.
(quote_name): Use to_uchar instead of cast.
* src/id.c (use_name, main, print_user, xgetgroups, print_group_list,
print_full_info): Use bool for booleans.
(problems): Remove, replacing with....
(ok): New var (inverted from old sense).
(print_user, print_group, print_full_info):
Print uids/gids with %lu, not %u.
(xgetgroups): Don't run out of memory if getgroups or getugroups
returns -1.
* src/setuidgid.c (main): Print uids/gids with %lu, not %ld.
* src/factor.c (wheel_tab): Use unsigned char instead of unsigned
int, since it suffices.
(factor, print_factors): Use size_t for sizes.
(print_factors, do_stdin, main): Use bool for booleans.
* src/fold.c (TAB_WIDTH): New macro; use it instead of "8".
(fold_file, main): Use bool for booleans.
(fold_file, main): Use size_t for sizes.
(main): Allow -w options up to SIZE_MAX - TAB_WIDTH - 1, instead
of prohibiting widths greater than INT_MAX.
* src/head.c (presume_input_pipe, print_headers, have_read_stdin,
write_header, elide_tail_bytes_pipe, elide_tail_bytes_file,
elide_tail_lines_pipe, elide_tail_lines_seekable,
elide_tail_lines_file, head_bytes, head_lines, head, head_file,
string_to_integer, main):
Use bool for booleans.
(main): Rewrite to avoid cast.
* src/csplit.c (struct line): Use size_t for sizes.
(main): Remove unnecessary cast.
* src/cut.c (cut_fields): Use to_uchar rather than a cast.
* src/cut.c (cut_file, main): Use bool for booleans.
* src/date.c (show_date, rfc_format, batch_convert, main): Likewise.
* src/env.c (main): Likewise.
* src/expr.c (nextarg): Likewise.
* src/env.c (main): Remove unused and nonstandard envp arg.
* src/fmt.c (COST, MAXWORDS): Add a comment describing some of
fmt's arbitrary limits.
(TRUE, FALSE): Remove; all uses changed to (true, false).
(main): Use bool for booleans.
Limit maximum width to MAXCHARS / 2. Use xstrtoul, not xstrtol,
to parse width.
(copy_rest): Remove unnecessary cast.
(get_prefix): Rewrite to avoid cast.
(check_punctuation): Use char *, not unsigned char *; C89 requires
this. Avoid off-by-one buffer read overrun when line is empty.
(flush_paragraph): Don't assume wptr-parabuf is <= INT_MAX.
Remove unnecessary casts.
* tests/fmt/basic (wide-1, wide-2, bad-suffix): Adjust to above
changes.
* src/expand.c (convert_entire_line, have_read_stdin, parse_tabstops,
next_file, expand, main):
Use bool for booleans.
(tab_size, tab_list, add_tabstop, parse_tabstops, validate_tabstops,
expand, main):
Use uintmax_t for column counts.
(add_tabstop): Don't reserve -1 (now UINTMAX_MAX) as a special value.
All callers changed.
(parse_tabstops): Don't pass a negative char to isblank.
Avoid memory leak with large tab stops.
(validate_tabstops, expand): Don't assume number of tab stops is
<= INT_MAX.
(next_file, main): Use EXIT_SUCCESS/EXIT_FAILURE rather than 0/1 when
storing values into exit_status.
(expand): Use same pattern as unexpand for reading chars.
Report an error when input line is too long, instead of silently
screwing up. Do not mishandle tab stops when backspacing left
over start of line.
* src/dircolors.c (have_read_stdin, append_quoted,
dc_parse_stream, dc_parse_file, main): Use bool for booleans.
(dc_parse_stream): Use enum for state, rather than int.
Use ssize_t to store getline result.
* src/dd.c (translation_needed, parse_integer, scanargs,
apply_translations, char_is_saved, swab_buffer, skip_via_lseek):
Use bool for booleans.
(translate_buffer): Use to_uchar rather than a cast.
(swab_buffer, copy_simple, copy_with_unblock):
Use size_t for sizes.
* src/seq.c (equal_width, valid_format, main): Use bool for booleans.
* src/sleep.c (apply_suffix): Likewise.
* src/tail.c (struct File_spec, reopen_inaccessible_files, count_lines,
forever, from_start, print_headers, have_read_stdin, valid_file_spec,
write_header, file_lines, pipe_lines, pipe_bytes, recheck,
tail_forever, tail_bytes, tail_lines, tail, tail_file,
parse_obsolescent_option, parse_options, main): Likewise.
* src/sleep.c (apply_suffix): Invert sense of result.
Use int (not unsigned int) for multiplier, as this generates better
code with some compilers. Simplify code a bit.
* src/tail.c (struct File_spec, max_n_unchanged_stats_between_opens,
parse_options): Use uintmax_t, not unsigned int or unsigned long int,
for state counters.
(tail_bytes, tail_lines): Redo test of return value (-1, 0, 1) to
make it a bit clearer.
* src/hostname.c: Include "xgethostname.h".
(xgethostname): Remove decl; xgethostname.h has it.
(sethostname) [!defined(HAVE_SETHOSTNAME) && defined(HAVE_SYSINFO)
&& defined (HAVE_SYS_SYSTEMINFO_H) && defined(HAVE_LIMITS_H)]: Use
prototypes rather than K&R form. Assume any negative value from
sysinfo denotes failure, not just -1.
(main): Simplify use of sethostname.
* src/pinky.c (include_idle, include_heading, include_fullname,
include_project, include_plan, include_home_and_shell, do_short_format,
include_where, main): Use bool for booleans.
(count_ampersands, create_fullname, scan_entries, short_pinky):
Use size_t for sizes.
(create_fullname): Check for overflow in size calculations.
(idle_string): Don't assume that the number of idle days
is less than 10**8 and/or INT_MAX/(24*60*60).
(main): No need to pass a non-NULL last arg to getopt_long.
* src/uptime.c (print_uptime, uptime): Use size_t for sizes.
(print_uptime): Remove unused local variable.
(main): No need to pass a non-NULL last arg to getopt_long.
* src/users.c (list_entries_users, users): Use size_t for sizes.