summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2009-09-23maint: Use logical rather than bitwise operators on boolsPádraig Brady
This is because bitwise operators are: - confusing and inconsistent in a boolean context - non short circuiting - brittle in C89 where bool can be an int (so > 1)
2009-09-23maint: expr: avoid compiler warnings without GMPPádraig Brady
* src/expr.c (mpz_clear, mpz_get_str, mpz_out_str) [!HAVE_GMP]: Reference unused arguments.
2009-09-23doc: ls: further improve --help message re --colorJim Meyering
* src/ls.c (usage): Correct grammar, change voice, shorten. Inspired by a report from Bruno Schulenberg.
2009-09-23maint: df.c: adapt to newer gnulibJim Meyering
* src/df.c: Don't include "canonicalize.h". No longer needed, since canonicalize_file_name is now guaranteed to be declared in <stdlib.h>, thanks to gnulib.
2009-09-22maint: uptime: fix a theoretical compile warningPádraig Brady
* src/uptime.c (print_uptime) [!HAVE_UTMPX_H && !HAVE_UTMP_H]: Reference possibly unused arguments.
2009-09-22ls: fix a performance regressionPádraig Brady
* src/ls.c (print_color_indicator): This reinstates commit f3f1ccfd, 21-10-2008, "ls: make it possible to disable file capabilities checking" which was inadvertently reverted with commit 3a169f4c, 14-09-2009, "ls: handle disabling of colors consistently ...".
2009-09-21build: avoid compiler warnings on cygwin 1.5Eric Blake
* src/copy.c (utimens_symlink): Avoid unused variables. * src/su.c (getusershell): Rely on gnulib for prototype.
2009-09-21doc: ls: add an article, "the"Jim Meyering
* src/ls.c (usage): Tweak wording.
2009-09-21ls: handle disabling of colors consistently for all tile typesPádraig Brady
* src/ls.c (print_color_indicator): Use consistent syntax for all file and directory subtypes, and fall back to the color of the base type if there is no enabled color for the subtype. This allows turning off specific colors for o+w dirs for example. * tests/ls/color-dtype-dir: Add a case to test that turning off coloring for o+w directories, falls back to standard dir color. * NEWS: Mention the fix Introduced by commit ac467814, 2005-09-05, "Colorize set-user-ID ... files and sticky ... directories."
2009-09-21doc: ls: make help for --color more concise and accuratePádraig Brady
* src/ls.c (usage): Shorten the --color ancillary info by two lines, while replacing --color=none with --color=never. Mention "always" is the default parameter of the --color option, along with the primary help for that option. Mention the ancillary --color info in the --color primary help.
2009-09-21doc: mention the texinfo documentation in --helpPádraig Brady
* src/system.h: Rename emit_bug_reporting_address() to emit_ancillary_info() and update it to not print the translation project address in en_* locales, and _do_ print it in the 'C' (and other) locales so that it's included in the default man page. Also mention how to invoke the texinfo documentation for each command. Also move the "hard-locale.h" include to the 8 files that now use it. * man/help2man: Strip the newly added texinfo reference from the --help output as a more verbose version is already added by help2man. Suggestion from C de-Avillez
2009-09-19dircolors: arrange to highlight names with the .lz suffixJim Meyering
* src/dircolors.hin: Add .lz, for GNU lzip. Suggested by Matias A. Fonzo.
2009-09-19mktemp: adapt to new, 3-argument gen_tempname_lenJim Meyering
* src/mktemp.c (mkstemp_len, mkdtemp_len): Update callers of gen_tempname_len. * gl/lib/tempname.c, gl/lib/tempname.h: Rebase against recently API-modified copy of tempname module in gnulib. Reported by Lluís Batlle.
2009-09-16rm, rmdir: improve cross-compilation supportEric Blake
* bootstrap.conf (gnulib_modules): Drop rmdir-errno. * src/rmdir.c (errno_rmdir_non_empty): Check both cases allowed by POSIX, rather than relying on configure-time check that might fail during cross-compilation. Reverts commit 9b6eb98d41.
2009-09-15cp: fix a probably redundant chmod when setting xattrsOndřej Vašík
* src/copy.c (copy_reg): Fix initial value of access_changed variable. This was introduced by Pádraig Brady in commit cca83faf, 2009-09-14, "cp,mv: preserve extended attributes even for read-only files"
2009-09-14cp,mv: preserve extended attributes even for read-only filesOndřej Vašík
* src/copy.c (copy_reg): Temporarily set u+rw on the destination file to allow GNU/Linux to set xattrs. * tests/misc/xattr: Test that change. * NEWS (Bug fixes): Mention it. Reported by Ernest N. Mamikonyan.
2009-09-14doc: improve timeout's --help messageJim Meyering
* src/timeout.c (usage): Improve --help description.
2009-09-13maint: use consistent cpp indentation in all .c filesJim Meyering
* src/stty.c: Make cpp indentation reflect nesting. * src/factor.c: Likewise.
2009-09-11id: don't print context=... when POSIXLY_CORRECT is setJim Meyering
* src/id.c (print_full_info) [POSIXLY_CORRECT]: Don't print context. Reported by Ulrich Drepper. * NEWS (Changes in behavior): Mention it. * doc/coreutils.texi (id invocation): Document that id also prints the security context, when possible, and when POSIXLY_CORRECT is not set. * tests/id/no-context: New file. Test for this. * tests/Makefile.am (TESTS): Add it.
2009-09-11rm: avoid compiler warningEric Blake
* src/remove.c (rm_fts): Don't allow fall-through when assertions are disabled.
2009-09-11rm: use gnulib faccessatEric Blake
* bootstrap.conf (gnulib_modules): Add faccessat. Replace strdup with strdup-posix. * m4/jm-macros.m4 (coreutils_MACROS): Revert previous change, now that gnulib does it for us. * src/remove.c (write_protected_non_symlink): Use faccessat in more situations.
2009-09-11rm: improve efficiency of rm -r (without -f) from O(N^2) to O(N)Jim Meyering
where N is the depth of the deepest hierarchy rm is processing. * src/remove.c (write_protected_non_symlink): Use faccessat to avoid O(N)-per-entry cost of calling euidaccess. * m4/jm-macros.m4 (coreutils_MACROS): Check for faccessat. * NEWS (Improvements): Mention it.
2009-09-11build: placate gcc's new -Wskip-jump-initJim Meyering
* remove.c (rm_fts): Put braces around each of the two offending blocks. * configure.ac: Don't turn off -Wjump-misses-init. With the rewrite of remove.c, it is no longer needed.
2009-09-11rm: rewrite to use ftsJim Meyering
* remove.c: Don't include "unlinkdir.h"; no longer used. Do not include <setjmp.h> or "cycle-check.h". Likewise. Include "xfts.h". (dir_name, dir_len): Remove definitions. (CONSECUTIVE_READDIR_UNLINK_THRESHOLD): Likewise. (INODE_SORT_DIR_ENTRIES_THRESHOLD, NEED_REWIND, D_TYPE): Likewise. (struct dirstack_state, Dirstack_state): Likewise. (g_buf, g_n_allocated): Remove declarations. (hash_freer, hash_compare_strings, rm_malloc): Remove functions. (rm_free, push_dir, top_dir, pop_dir, right_justify): Likewise. (full_filename0, xfull_filename, full_filename_): Likewise. (AD_stack_height, AD_stack_top, AD_stack_pop, AD_stack_clear): Likewise. (obstack_init_minimal, ds_init, ds_clear, ds_free): Likewise. (AD_pop_and_chdir, AD_ensure_initialized, AD_mark_helper): Likewise. (AD_mark_as_unremovable, AD_mark_current_as_unremovable): Likewise. (AD_push_initial, AD_push, AD_push, AD_is_removable): Likewise. (write_protected_non_symlink): Change 3rd parameter from dirstack_state "ds" to full_name. (prompt): Adjust parameters. Now, state comes from FTS/FTSENT pair. Those replace fd_cwd and "ds". Remove "filename". Remove pdirent_type in favor of new "is_dir" parameter. Rename is_empty to is_empty_p. (DO_RMDIR, DO_UNLINK): Remove definitions. (remove_entry, fd_to_subdirp, compare_ino): Remove functions. (dirent_count, dirent_inode_sort_may_be_useful): Likewise. (preprocess_dir): Likewise. (fts_skip_tree, mark_ancestor_dirs, excise, rm_fts): New functions. (remove_cwd_entries, remove_dir, rm_1): Remove functions. (rm): Rewrite as a simple loop calling fts_read and dispatching each entry via rm_fts. * src/rm.c (main): Adapt to new signature of rm(). * bootstrap.conf (gnulib_modules): Remove unlinkdir, no longer used. * src/Makefile.am (sc_tight_scope): Also recognize an extern "enum" declaration. * tests/rm/empty-name: Adjust expected output to match new diagnostic. * NEWS (Improvements): Mention it.
2009-09-10doc: improve various BLOCKSIZE and SIZE helpOndřej Vašík
* doc/coreutils.texi (multiplierSuffixes): Mention that the suffix can be specified without a leading number * src/split.c (usage): Refactor SIZE help to within a function * src/truncate.c (usage): Likewise * src/ls.c (usage): Likewise * src/df.c (usage): Likewise. Also add a function with BLOCKSIZE help * src/du.c (usage): Likewise. * src/system.h: Define 2 functions to emit common help text This was prompted by https://bugzilla.redhat.com/show_bug.cgi?id=511188
2009-09-10dd conv=unblock: print final newline consistentlyJim Meyering
* src/dd.c (dd_copy) [C_UNBLOCK]: Always print the final newline for non-empty output, not just when output size is a multiple of cbs. * doc/coreutils.texi (dd invocation) [conv=unblock]: Mention that dd prints a newline after each output record, not just when replacing trailing spaces. Reported by Ulrich Drepper. * tests/dd/unblock: New file. Test for this. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it.
2009-09-08tail: make the new piped-stdin test as portable as the old oneJim Meyering
* src/tail.c (main): Adapt piped-stdin test to use the same isapipe, test as was used in the preceding POSIXLY_CORRECT condition. Remove the now-subsumed POSIXLY_CORRECT test. Reported by Pádraig Brady. * doc/coreutils.texi (tail invocation): Document this change. * NEWS (Changes in behavior): Reclassify, clarify.
2009-09-07tail: syntax-only: use "false", rather than equivalent, 0Jim Meyering
* src/tail.c (record_open_fd): Initialize "->ignore" to false, not 0.
2009-09-07tail: ignore -f for piped-stdin, as POSIX requiresJim Meyering
* src/tail.c (main): Tailing a pipe "forever" is not useful, and POSIX specifies that tail ignore the -f when there is no file argument and stdin is a FIFO or pipe. So we do that. In addition, GNU tail excludes "-" arguments from the list of files to tail forever, when the associated file descriptor is connected to a FIFO or pipe. Before this change, ":|tail -f" would hang. Reported by Ren Yang and Ulrich Drepper. * tests/tail-2/pipe-f: Test for this. * tests/tail-2/pipe-f2: Ensure tail doesn't exit early for a fifo. * tests/Makefile.am (TESTS): Add these tests. * NEWS (POSIX conformance): Mention it.
2009-09-07tail: don't give up on inotify mode for an already-ignored "-"Jim Meyering
* src/tail.c (main): Adjust today's change to honor the F[i].ignore flag that may have been set in tail_file.
2009-09-07tail -f: handle "-"/stdin once againJim Meyering
* src/tail.c (main) [HAVE_INOTIFY]: When stdin (i.e., "-", or no args, but not /dev/stdin) is specified on the command line, don't use inotify. Reported by Bill Brelsford in <http://bugs.debian.org/545422>. * tests/tail-2/follow-stdin: New file. Test for this. * tests/Makefile.am (TESTS): Add the test. * NEWS (Bug fixes): Mention it. This bug was introduced in coreutils-7.5 via commit ae494d4b, 2009-06-02, "tail: use inotify if it is available".
2009-09-06tail: flush initial output before possibly blockingJim Meyering
* src/tail.c (main): Flush any output from tail_file, before calling tail_forever_inotify, which can block. * tests/tail-2/flush-initial: New file. Test for the bug. * tests/Makefile.am (TESTS): Add tail-2/flush-initial. * NEWS (Bug fixes): Mention it. This bug was introduced in coreutils-7.5 via commit ae494d4b, 2009-06-02, "tail: use inotify if it is available".
2009-09-05doc: make the tail --sleep-interval help less confusingPádraig Brady
* src/tail.c (usage): I read "approximately S seconds" as "approximately 5 seconds" for approximately 5 seconds.
2009-09-05maint: remove some tab indentation from copy.cPádraig Brady
* src/copy.c (copy_internal): Remove tabs erroneously added in commit 3346c0af.
2009-09-05tests: test old tail -f method even on systems with inotifyPádraig Brady
* src/tail.c (main): Add an undocumented ---disable-inotify option to allow disabling inotify. * tests/tail-2/pid: Run test in both normal and "disable_inotify" modes. * tests/tail-2/tail-n0f: Likewise. * tests/tail-2/wait: Likewise. * tests/tail-2/append-only: Likewise.
2009-09-05stty: use TAB0, TAB1, and TAB2 only if definedPetr Salinger
* src/stty.c (mode_info) [TAB0, TAB1, TAB2]: Guard each entry with #ifdef. Required for GNU/kFreeBSD. Reported by Petr Salinger in http://bugs.debian.org/520368.
2009-09-04ln: add comments related to POSIX 2008Eric Blake
* src/ln.c (ENABLE_HARD_LINK_TO_SYMLINK_WARNING): Delete. (do_link): Update comments per POSIX; add FIXME for -L, -P.
2009-09-04mv, cp: tweak LINK_FOLLOWS_SYMLINKS logicEric Blake
* gnulib: Update to latest gnulib. * src/copy.c (copy_internal): Adjust comment in light of POSIX 2008, and deal with macro now being tri-state.
2009-09-03df: don't fail due to an unreadable argumentJim Meyering
* src/df.c (main): If open or fstat fails when we're trying to ensure that all arg-partitions are automounted, fall back on using stat. Inspired by the report and patch from Olivier Fourdan in http://bugzilla.redhat.com/520630. * NEWS (Bug fixes): Mention it. * tests/df/unreadable: New test for the above. * tests/Makefile.am (TESTS): Add df/unreadable. The bug was introduced in coreutils-7.3 via commit dbd17157, 2009-04-28, "df: use open(2), not stat, to trigger automounting".
2009-09-03cp: don't leak resources for each xattr preservation failureOndřej Vašík
* src/copy.c (copy_reg): Don't return from the function after an unsuccessful and required preservation of extended attributes. This resulted in leaking the copy buffer and file descriptors. * NEWS (Bug fixes): Mention the fix. The bug was introduced in coreutils-7.1 via commit 0889381c, 2009-01-23, "cp/mv: add xattr support".
2009-09-01chcon, chmod, chgrp, chown, du: report fts_close failurePádraig Brady
* src/du.c (du_files): Don't fail silently upon fts_close failure. * src/chcon.c (process_files): Likewise. * src/chmod.c (process_files): Likewise. * src/chown-core.c (chown_files): Likewise.
2009-09-01chcon, chmod, chgrp, chown, du: do not ignore fts_close failureJim Meyering
This is probably never visible, but who knows... * src/chcon.c (process_files): Don't ignore fts_close failure. * src/chmod.c (process_files): Likewise. * src/chown-core.c (chown_files): Likewise. * src/du.c (du_files): Likewise.
2009-09-01maint: du: remove unnecessary initializationJim Meyering
* src/du.c (main): Don't set "skip_file" unnecessarily.
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.