summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2009-09-01maint: chown, chgrp, chmod, chcon: remove unnecessary initializationJim Meyering
* src/chown-core.c: Include "ignore-value.h". (change_file_owner): Don't set "ent" only to ignore it. * src/chcon.c (process_file): Likewise. * src/chmod.c: Include "ignore-value.h". (process_file): Don't set "ent" only to ignore it. After diagnosing root-dev/ino failure, return false immediately: Now that we don't set "ent" we must be sure not to use it uninitialized, and there's no point in issuing --verbose-related output in this case.
2009-09-01maint: shred: remove unnecessary initializationJim Meyering
* src/shred.c (genpattern): Value stored to "n" is never used.
2009-09-01maint: dd: remove unnecessary initializationJim Meyering
* src/dd.c (skip): Remove set-but-never-used variable, soffset.
2009-09-01maint: tail: remove unnecessary initializationJim Meyering
* src/tail.c (tail_bytes): Don't compute "diff" twice.
2009-09-01timeout: remove a redundant assignmentPádraig Brady
* src/timeout.c (main): While keeping argc and argv in sync may be marginally useful, it is redundant to update argc, so just remove that to suppress the clang warning.
2009-09-01timeout: defensive handling of all wait() errorsPádraig Brady
* src/timeout.c (main): Handle all possible cases of unexpected failures from wait(). This was prompted by the clang tool reporting the possible non-initialization of the status variable.
2009-09-01ls -i: print consistent inode numbers also for mount pointsJim Meyering
On most unix- and linux-based kernels, ls -i DIR_CONTAINING_MOUNT_POINT would print the wrong inode number for any entry that is a mount point. It would do that by relying on readdir's dirent.d_ino values, while most readdir implementations return the inode number of the underlying, inaccessible directory. Thus, it is not consistent with what you'd get when applying stat to the same entry. This bug led to surprising results like "ls -i" and "ls -i --color" printing different numbers (ls must usually "stat" a file to colorize its name). This change makes it so that on offending systems, ls must stat non-command-line-arguments for which otherwise it would be able to use "for free" dirent.d_ino values. Regardless of this change, ls is already required to stat every command-line argument. Note: versions of GNU ls prior to coreutils-6.0 did not perform the invalid optimization, and hence always printed correct inode numbers. Thus, for the sake of correctness, ls -i is forgoing the readdir optimization, for any kernel (including linux!) with POSIX-nonconforming readdir. Note that currently, only Cygwin has been agile enough to conform. * src/ls.c (RELIABLE_D_INO): Define. (print_dir): Use it. For plenty of discussion, see this long thread: http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14020 This bug was introduced by the 2006-02-26 commit, 33eb3efe: "In ls, avoid calling stat for --inode (-i), when possible." * tests/ls/readdir-mountpoint-inode: New test. * tests/Makefile.am (TESTS): Add it. * tests/ls/stat-vs-dirent: Don't suppress failure of this test, now that ls -i is fixed. Though note that it doesn't test well, since it compares only the always-stat'd command-line arguments. * NEWS (Bug fixes): Mention it.
2009-08-31maint: revert my stdbuf change: the result didn't even compileJim Meyering
This reverts commit c1e158489d88bad418d52ceadf37af0b6f5b2112.
2009-08-30maint: stdbuf: move a declaration; no-semantic-changeJim Meyering
* src/stdbuf.c (set_program_path): Move a declaration down into the scope where it's used.
2009-08-30build: quiet "make check" in src/Jim Meyering
* src/Makefile.am (check-duplicate-no-install): Use $(AM_V_GEN). (check-README): Likewise. And $(AM_V_at).
2009-08-29cp --reflink: preserve attributes on cloned files if askedPádraig Brady
* src/copy.c (copy_reg): When cloning only skip the data copying * tests/cp/reflink-perm: New test to check times and modes copied * tests/Makefile.am: Reference the new test * NEWS: Mention the fix
2009-08-29cp --reflink: add an "auto" parameter to fall back to a normal copyPádraig Brady
* doc/coreutils.texi (cp invocation): Document the new "auto" and "always" options to --reflink. * src/copy.c (copy_reg): Fall back to a standard copy when reflink() is not supported and --reflink=auto specified. * src/copy.h [struct cp_options] (reflink): Change type s/bool/enum/. * src/cp.c (usage): Describe the --reflink={always,auto} options and expand a little on what --reflink does. (main): parse the new parameters to --reflink and allow all --sparse options with --reflink=auto. * src/install.c (cp_option_init): Init the enum instead of bool. * src/mv.c (cp_option_init): Likewise. * tests/cp/reflink-auto: A new test for falling back to normal copy. * tests/Makefile.am: Reference the new test. * NEWS: Mention the new feature.
2009-08-28stdbuf: fix a small typo in --help outputPádraig Brady
* src/stdbuf.c (usage): s/then/the/
2009-08-28build: avoid unused variable warnings on cygwinEric Blake
* src/copy.c (clone_file, copy_attr_by_fd, copy_attr_by_name): Mark up unused variables. * src/remove.c (dirent_inode_sort_may_be_useful): Likewise.
2009-08-28dd: detect closed stderrEric Blake
* src/dd.c (maybe_close_stdout): Always flush stderr; regression introduced in commit 381e69ea. * tests/misc/close-stdout (p): Use consistent style. * tests/dd/stderr: New test, borrowing from misc/close-stdout. * tests/Makefile.am (TESTS): Run it. * NEWS: Mention this.
2009-08-25maint: remove Local Variables: indent-tabs-mode: nil from all sourcesJim Meyering
* src/getlimits.c: Likewise. * src/group-list.c: Likewise. * src/groups.c: Likewise. * src/mktemp.c: Likewise. * src/setuidgid.c: Likewise. * src/stdbuf.c: Likewise. * src/timeout.c: Likewise. * src/truncate.c: Likewise. * gl/lib/mbsalign.c: Likewise. * tests/test-lib.sh: Likewise. * bootstrap: Likewise. * README-hacking: Likewise.
2009-08-25global: convert indentation-TABs to spacesJim Meyering
Transformed via this shell code: t=$'\t' git ls-files \ | grep -vE '(^|/)((GNU)?[Mm]akefile|ChangeLog)|\.(am|mk)$' \ | grep -vE 'tests/pr/|help2man' \ | xargs grep -lE "^ *$t" \ | xargs perl -MText::Tabs -ni -le \ '$m=/^( *\t[ \t]*)(.*)/; print $m ? expand($1) . $2 : $_'
2009-08-24cp: ignore obscure failure to preserve symlink time stamps,Jim Meyering
...when run on a kernel older than what was implied by headers and libraries tested at configure time. * src/copy.c (utimens_symlink): Ignore failure when errno == ENOSYS. * NEWS (Bug fixes): Mention it. Reported by Todd Zullinger and Kamil Dudka. Details in this thread: http://thread.gmane.org/gmane.linux.redhat.fedora.devel/119834
2009-08-20install: avoid a portability bug when compiling with non-gccJim Meyering
* src/install.c (extra_mode): Be careful to return only a 0 or 1 value, since this is a "bool" function, and there are still some compilers for which this is necessary. Without this change, Bernhard Voelker reported that the Forte Developer 7 C 5.4 2002/03/09 compiler would produce a malfunctioning "install" binary. Details in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17710/focus=17760
2009-08-19build: avoid "make dist" failure in man/Jim Meyering
Now that "make check" no longer builds programs like arch, ... * src/Makefile.am (dist-hook): Depend on $(all_programs), so that the subsequent build in man/ doesn't fail due to lack of a program like arch that is not going to be installed.
2009-08-18nl: deprecate --page-increment in favor of --line-incrementGiuseppe Scrivano
* NEWS: Mention the change. * doc/coreutils.texi: Document the new --line-increment option. * src/nl.c (struct option): Add --line-increment, (usage): Describe it, (main): Use it.
2009-08-18build: perform check-AUTHORS via syntax-check, not via "make check"Jim Meyering
* src/Makefile.am (check): Don't depend on check-AUTHORS. That check fails on systems for which a program like stdbuf is not built. Instead, move this check to "make syntax-check". (sc_check-AUTHORS): Rename rule from check-AUTHORS. * cfg.mk (sc_check-AUTHORS): New rule. Reported by Berhnard Voelker.
2009-08-18sort: use more portable initialization syntaxJim Meyering
* src/sort.c (find_unit_order): Spell out 256-element static initializer, rather than relying on C99 syntax. Required for Forte Developer 7 C 5.4 2002/03/09 on Solaris 10. Reported by Bernhard Voelker.
2009-08-14cp,mv: fix issues with preserving timestamps of copied symlinksPádraig Brady
* src/copy.c (copy_internal): On systems without utimensat don't use utimens on a symlink, as that would dereference the symlink. * tests/cp/abuse: To work around possible attribute preservation failures breaking the test, use cp -dR rather than cp -a.
2009-08-13tail: fix tail -f failure when inotify usedPádraig Brady
* src/tail.c (tail_forever_inotify): Remove the redundant and incorrect error check of the return from inotify_add_watch(). Also initialize the wd member of each File_spec to an invalid value. Reported by C de-Avillez.
2009-08-13dd: fix a signal handling racePádraig Brady
* src/dd.c (main): Install the signal handlers at startup rather than just before the copy starts. In this way signals received before the copy (like during a slow truncate for e.g.) will be deferred and handled consistently. * THANKS: Add Bernhard's email address. * NEWS: Mention the fix. Reported by Bernhard Voelker.
2009-08-10nl, pinky: replace uses of strcatJim Meyering
* src/nl.c (main): Avoid strcat, on principle. Use stpcpy instead. * src/pinky.c (print_long_entry): Likewise.
2009-08-07cp: accept the --reflink optionGiuseppe Scrivano
* NEWS: Mention it. * doc/coreutils.texi (cp invocation): Describe it. * src/copy.h (struct cp_options) [reflink]: New member. * src/copy.c (usage): Describe it. (copy_reg): If reflink is true try to clone the file. (main): Check for --reflink. (cp_option_init): Initialize the new member. * src/install.c (cp_option_init): Initialize the new member. * src/mv.c (cp_option_init): Likewise. * tests/cp/sparse: Add a new test case.
2009-08-07dd: preserve semantics of O_DIRECT even for final blockJim Meyering
* src/dd.c: Include "ignore-value.h" (iwrite): When disabling O_DIRECT, try to compensate via POSIX_FADV_DONTNEED and fsync. Suggested by Eric Sandeen.
2009-08-06dd: work around buffer length restrictions with oflag=direct (O_DIRECT)Jim Meyering
dd oflag=direct would fail to copy a file with size that is not a multiple of 512 (destination file system specific) * NEWS (Bug fixes): Mention it. * src/dd.c (iwrite): Turn off O_DIRECT for any smaller-than-obs-sized write. Don't bother to restore it. * tests/dd/direct: New test for the above. * tests/Makefile.am (TESTS): Add dd/direct. * doc/coreutils.texi (dd invocation): Mention oflag=direct buffer size restriction. Details in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/17586 Reported by Eric Sandeen.
2009-08-04dd: remove unnecessary #if HAVE_FTRUNCATEJim Meyering
* src/dd.c (main): Remove unnecessary cpp directives. Gnulib guarantees that ftruncate is usable.
2009-08-04cp -pP (and e.g., -a): preserve time stamps on symlinks, tooJim Meyering
* src/copy.c (utimensat_if_possible): New function. (copy_internal): Remove variable, "preserve_metadata". Replace with "dest_is_symlink". That covers all cases but one: the one in which cp --link has created hard links to non-directories. In that case, there is no need to update attributes of the links. Use utimensat_if_possible, to preserve timestamps of symlinks. * NEWS (New features): Mention this. * tests/Makefile.am (TESTS): Add cp/preserve-slink-time. * tests/cp/preserve-slink-time: New file. * m4/jm-macros.m4 (coreutils_MACROS): Test for utimensat. Reported in http://bugzilla.redhat.com/230866
2009-07-30tail: tweak indentationJim Meyering
* src/tail.c (tail_forever_inotify): Adjust indentation of continued line.
2009-07-30tail: properly parse fractional seconds when monitoring a pidPádraig Brady
* src/tail.c (tail_forever_inotify): The fractional part of the delay was 1000 times too large. * tests/tail-2/pid: Add a test to ensure the timeout happens for this case.
2009-07-30tail: exit successfully upon watched process deathGiuseppe Scrivano
* src/tail.c (tail_forever_inotify): If a PID is specified and the watched process dies, exit with status EXIT_SUCCESS, rather than falling through to an EXIT_FAILURE.
2009-07-29cp: support btrfs' copy-on-write file clone operationGiuseppe Scrivano
* src/copy.c [HAVE_SYS_IOCTL_H]: Include <sys/ioctl.h>. (BTRFS_IOCTL_MAGIC, BTRFS_IOC_CLONE): Define. (clone_file): New function. (copy_reg): Use the btrfs clone operation if possible.
2009-07-29maint: update sleep.c's copyright year listJim Meyering
* src/sleep.c: Update copyright year list to include 2009. * tests/sort-time/rand-gen: Remove long-unused file. * tests/sort-time/README: Likewise.
2009-07-28tail: use the inotify backend also with --pid=PIDGiuseppe Scrivano
* src/tail.c (tail_forever_inotify): When a PID is specified, use select to block for no more than sleep_interval seconds at a time, and check for process death upon timeout. (main): Adapt to new tail_forever_inotify interface.
2009-07-27ls -1U dir arg ... now works againKamil Dudka
* src/ls.c (print_dir): Emit "$dir_name:\n" *before* accumulating (and possibly printing) directory entry names. The bug was introduced in coreutils-7.0 via commit 8d974b00, 2008-07-30, "ls -U1 now uses constant memory". Reported by Julian Bradfield. * NEWS (Bug fixes): Mention it.
2009-07-27tr: improve --help's description of --complement (-c)Heikki Orsila
2009-07-24readlink: improve one-line summary: prints canonical file names, tooJim Meyering
* src/readlink.c (usage): Adjust one-line summary. * man/readlink.x: Likewise. Suggested by Kamil Dudka.
2009-07-11tail: adjust type of a local variableJim Meyering
* src/tail.c (tail_forever_inotify): Declare "len" to be of type size_t, not ssize_t, since the former is what safe_read returns.
2009-07-08copy.c: remove a duplicate expressionOndřej Vašík
* src/copy.c (copy_attr_error): remove a redundant expression added in commit e0cf592f, 2009-04-27, "factor out test for errno ...".
2009-07-08tail: use size_t for counter and index variables, ...Jim Meyering
* src/tail.c (any_live_files): ... not "int" or even unsigned int (tail_forever, tail_forever_inotify, main): Likewise.
2009-07-08tail: declare "file descriptor" variable to be "int", not size_tJim Meyering
* src/tail.c (tail_forever_inotify): Use "int", not size_t as the type of a file descriptor variable.
2009-07-03sort: allow SI and IEC units on separate human sort fieldsPádraig Brady
* src/sort.c: Store the si_present state per key rather than globally * tests/misc/sort: Add a check that would have previously failed. Also add a test to demonstrate that invalid IEC/SI mixtures are not always noticed when they're not significant to the sort.
2009-07-03tail: avoid an inotify portability problem in kernels prior to 2.6.21Giuseppe Scrivano
* src/tail.c (tail_forever_inotify): Handle the special case in which an old inotify watcher returns 0. Affects kernels in [2.6.13, 2.6.21).
2009-06-29tail: add comments noting potential inotify-related problemsJim Meyering
* src/tail.c (tail_forever_inotify): Add two FIXME comments.
2009-06-27stdbuf: fix to stop -i option causing an assertionPádraig Brady
* src/stdbuf.c (main): Fix the array bounds check in the assert * tests/misc/stdbuf: Add a test for all standard streams
2009-06-23maint: update all Copyright year lists to include 2009Jim Meyering