summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2011-12-30build: avoid spurious test.c warning with -Wsuggest-attribute=pureJim Meyering
* src/test.c: Add pragma to suppress gcc-4.6.2's warning that "advance" might be candidate for attribute 'pure'.
2011-12-28tail: avoid theoretically undefined behaviorJim Meyering
* src/tail.c (start_lines): Do not form potentially-invalid address. Use safe_read's return value as a pointer offset only after ensuring that it is not SAFE_READ_ERROR (size_t)(-1). Spotted by coverity. Also, move declaration of "p" to be closer to first use.
2011-12-26doc: homologize ch{con,grp,mod,own} option descriptionsPádraig Brady
* src/chgrp.c (usage): Group associated options together, to aid users. Also minimize the differences between individual messages across these four commands, to aid translators. * src/chmod.c: Likewise. * src/chown.c: Likewise. * src/chcon.c (usage): Likewise. Document the --dereference option. Suggested by Paul Eggert and Jari Aalto
2011-12-26stat,tail: recognize new FS type: pipefsJim Meyering
* src/stat.c (human_fstype) [S_MAGIC_PIPEFS]: New case. * NEWS (Bug fixes): Mention this.
2011-12-24doc: stat: clarify that %t and %T expand to the file system typeJim Meyering
* src/stat.c (usage): Mention "file system type", not just "type" for %t and %T. Do not capitalize the first letter of each description.
2011-12-23tail: with -f, use polling when a file is on an FS of unknown typeJim Meyering
Before, we would use inotify in that case, which would work as long as updates were taking place locally, but not at all when remote. Move hard-coded list of known remote FS types into a more maintainable table in stat.c, alongside the list of FS names and magic numbers. Generate a new is_local_fs_type function. * src/Makefile.am (fs-is-local.h): New rule, generated file. * src/extract-magic: Revamp to parse local/remote keyword after each magic number in src/stat.c's case statements. Accept new --local option. * src/.gitignore: Ignore the generated fs-is-local.h. * src/tail.c [HAVE_INOTIFY]: Include fs-is-local.h. (fremote) [HAVE_INOTIFY]: Use the new function in place of the switch stmt with hard-coded list of FS types. Emit a warning when processing a file on a file system of unknown type. * NEWS (Changes in behavior): Mention it. Suggested by Sven Breuner.
2011-12-22tail,stat: add support for FhGFSJim Meyering
* src/stat.c (human_fstype): Add a case: fhgfs, 0x19830326. * src/tail.c (fremote): Add S_MAGIC_FHGFS. * NEWS (Bug fixes): Update the entry for GPFS to mention FhGFS, too. Reported by Sven Breuner.
2011-12-14du: -x should not count files in other file systemsPaul Eggert
This fixes Bug#10293, which I guess was introduced in commit 95c948b06a dated 2003-10-02. * NEWS: Document fix. * src/du.c (process_file): Don't count files in different file systems if -x is given. * tests/du/one-file-system: Test for this bug.
2011-12-12ls: give a more useful diagnostic for a bogus --time-style argJim Meyering
* src/ls.c (decode_switches): Replace our use of XARGMATCH with open-coded version so that we can give a better diagnostic. * tests/ls/time-style-diag: New file. * tests/Makefile.am (TESTS): Add it. Reported by Dan Jacobson in http://bugs.gnu.org/10253 with suggestions from Eric Blake and Paul Eggert.
2011-12-09maint: remove a misleading comment from shred.cJim Meyering
* src/shred.c: Remove obsolete TODO comment. The first two and the last item were done, adding --recursive (-r) is neither necessary nor appropriate, and I don't want to add --interactive. I don't see a need for the others. Prompted by comments from Amr Ali.
2011-12-08ls: be responsive to interrupts when color-listing large directoriesJim Meyering
Starting with commit adc30a83, when using --color, ls inhibited interrupts to avoid corrupting the state of an output terminal. However, for very large directories, that inhibition rendered ls uninterruptible for too long, including a potentially long period even before any output is generated. * src/ls.c: Two phases of processing are time-consuming enough that they can provoke this: the readdir loop and the printing loop. The printing was supposed to be covered by a call to process_signals in (print_name_with_quoting): ... but that call was mistakenly guarded by a condition that might be false for many or even all files being processed. Call process_signals unconditionally. (print_dir): Also call process_signals in the readdir loop. * NEWS (Bug fixes): Mention it. Reported by Arkadiusz Miśkiewicz in http://bugs.gnu.org/10243 Co-authored-by: Eric Blake <eblake@redhat.com>
2011-12-05ln: clarify usage of -L, -n, -TPaul Eggert
* src/ln.c (usage): Use clearer wording to describe the -L, -n, and -T options (Bug#9896).
2011-12-05maint: don't assume GNU make \# syntax (fix previous)Paul Eggert
* src/Makefile.am (fs_normalize_perl_subst, fs-magic, fs-kernel-magic): Undo previous patch; it missed a \#. (fs_normalize_perl_subst): Use \043 rather than \#. \043 is portable to all ASCIIish platforms, whereas \# is portable only to platforms that are compatible with GNU make (and are incompatible with POSIX make). Porting this to EBCDIC is left as an exercise for the reader....
2011-12-05maint: sort, stat: remove unused parametersJim Meyering
* src/sort.c (struct thread_args) [is_lo_child]: Remove member. (sortlines): Remove unused parameter, "is_lo_child". Update callers. * src/stat.c (out_epoch_sec): Mark unused parameter. (do_statfs, do_stat): Remove unused parameter, "terse". Update callers.
2011-12-05maint: don't assume GNU make \# syntaxPaul Eggert
* src/Makefile.am (fs_normalize_perl_subst): Don't make unportable assumption about \# in the right hand side of a macro definition. This works with GNU make, but not with POSIX make. Problem reported by Basavaraj B (Bug#10220). (fs-magic, fs-kernel-magic): Do the #-substitution here instead.
2011-12-04od,test: address warnings from gcc's -Wjump-misses-initJim Meyering
* src/test.c (unary_operator): gcc reported that initializations in two case statements were skipped. Enclose in braces. * src/od.c (decode_one_format): Likewise.
2011-12-04maint: remove redundant usage declarations (-Wredundant-decls)Jim Meyering
* src/csplit.c (usage): Remove declaration. * src/ls.c (usage): Likewise. * src/pr.c (usage): Likewise.
2011-11-20doc: clarify ln's --help outputJim Meyering
* src/ln.c (usage): Use TARGET, not "source" in description. Reported by Michael J Daniel in http://bugs.gnu.org/9896.
2011-11-20port to GNU hosts, where getuid and friends can failPaul Eggert
* src/groups.c (main): * src/install.c (need_copy): * src/su.c (log_su): * src/test.c (unary_operator): * src/whoami.c (main): Don't assume that getuid and friends always succeed. This fixes the same problem that we recently fixed with 'id'.
2011-11-20ln: fix position of --backup values descriptionErik Auerswald
* src/ln.c (usage): A paragraph describing interactions of -s with -L and -P somehow snuck in between the description of the --backup option and the values used to control it. Fix this by moving the value description up.
2011-11-16sort: clarify wording on -k syntaxEric Blake
* src/sort.c (usage): Use KEYDEF instead of POS, and call out the specific OPTS that can occur in KEYDEF. Based on a report by Lars Noodén, http://bugs.gnu.org/10019
2011-11-15id: fix bug when euid != ruidPaul Eggert
* src/id.c (main): Report an error if no args are given and getuid fails, because print_full_info needs ruid. Redo code so that getuid and friends are invoked only when needed; this makes the code easier to follow, and is how I found the above bug.
2011-11-15ls: another reword of generic size noteRuediger Meier
* src/system.h (emit_size_note): Use "unit" rather than "suffix", and move multiplication to example instead of in suffix list. See additional discussion in Bug#9939.
2011-11-15id: tweak commentEric Blake
* src/id.c (main): Replace confusing use of "etc.".
2011-11-15id: handle (uid_t) -1 more portablyPaul Eggert
* src/id.c (GETID_MAY_FAIL): Remove. (main): Check for nonzero errno, rather than having a compile-time GETID_MAY_FAIL guess. Suggested by Roland McGrath in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10021#47>. Also, the old code was incorrect if uid_t was narrower than int. (print_full_info): Remove unnecessary cast to -1.
2011-11-15id: undo previous commit, which was done by mistakePaul Eggert
* src/id.c (GETID_MAY_FAIL, main, print_full_info): Undo previous change.
2011-11-15doc: update for ISO/IEC 80000-13Paul Eggert
* doc/coreutils.texi (Block size): IEC 60027-2 has been superseded by ISO/IEC 80000-13, so prefer the newer standard but also mention the old. The new standard specifies Zi and Yi, so they are no longer GNU extensions. Fix stale URL to BIPM. 2011-11-14 Paul Eggert <eggert@cs.ucla.edu> id: handle (uid_t) -1 more portably * src/id.c (GETID_MAY_FAIL): Remove. (main): Check for negative return values, not for -1. The old code was incorrect if uid_t was narrower than int, regardless of whether we were on a GNU or a POSIX platform. The new code is simpler and doesn't need GETID_MAY_FAIL. (print_full_info): Remove unnecessary cast to -1.
2011-11-14id: fail when getuid, getgid, etc. fail, e.g., on GNU/HurdLudovic Courtès
POSIX-conforming getuid, geteuid, etc. functions cannot fail, but on GNU/Hurd systems and some others, they may. * src/id.c (main) [__GNU__]: Detect and diagnose any such failure. * tests/id/gnu-zero-uids: New file. * tests/Makefile.am (TESTS): Add it to the list. * tests/init.cfg (require_gnu_): New function.
2011-11-13maint: id, groups: use conforming diagnosticsJim Meyering
* src/groups.c (main): Don't capitalize the first word of diagnostic. * src/id.c (main): Likewise. Reported by Ludovic Courtès.
2011-11-12ls: plug a per-argument leakJim Meyering
Using ls -l on an SELinux-enabled system would leak one SELinux context string per non-empty-directory command-line argument. * src/ls.c (free_ent): New function, factored out of... (clear_files): ...here. Use it. (extract_dirs_from_files): Call free_ent (f), rather than simply free (f->name). The latter failed to free the possibly-malloc'd linkname and scontext members, and thus could leak one of those strings per command-line argument. * THANKS.in: Update. * NEWS (Bug fixes): Mention it. Reported by Juraj Marko in http://bugzilla.redhat.com/751974.
2011-11-11* src/system.h (emit_size_note): Reword for clarity.Paul Eggert
See discussion in Bug#9939.
2011-11-11ls: -k no longer affects -l's file sizesPaul Eggert
This fixes an incompatibility with POSIX 2008 and with BSD. Problem reported by Abdallah Clark (Bug#9939) via Alan Curry (Bug#10016). * NEWS: Document this. * doc/coreutils.texi (General output formatting): Document the new -k behavior, and --kibibytes. * src/ls.c (file_human_output_opts): New static var. (long_options, usage): Add --kibibytes. (decode_switches, gobble_file, print_long_format): Implement the new -k behavior. * tests/ls/block-size: New file. * tests/Makefile.am (TESTS): Add it.
2011-11-02stat: avoid compilation failure with gnulib's new alignofJim Meyering
* src/stat.c: Include <stdalign.h>, not "alignof.h" for alignof use.
2011-10-27date: reinstate the --iso-8601 (-I) optionJim Meyering
We deprecated and undocumented the --iso-8601 (-I) option mostly because date could not parse that particular format. Now that it can, it's time to restore the documentation. * src/date.c (usage): Document it. * doc/coreutils.texi (Options for date): Reinstate documentation. Reported by Hubert Depesz Lubaczewski in http://bugs.gnu.org/7444.
2011-10-25build: do not remove definition of ENODATA, after allJim Meyering
* src/system.h (ENODATA): Restore definition. gnulib defines it only on native Windows systems, so removing our definition would have provoked build failure on systems that use it, like FreeBSD. Reported by Bruno Haible in http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28739/focus=28795 * gnulib: Update to latest, to get new ENODATA-exempting maint.mk rule.
2011-10-24rm: update gnulib to get an fts fix for Cygwin+NWFS/NcFsd file systemsJim Meyering
* NEWS (Bug fixes): Mention it. As far as we know, this fix affects only Cygwin with NWFS or NcFsd file systems. See these: http://git.sv.gnu.org/cgit/gnulib.git/commit/?id=71f13422f3e634 http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/28739 http://cygwin.com/ml/cygwin/2011-10/msg00365.html * src/system.h (ENODATA): Remove fall-back definition, now that gnulib provides one. Caught by the sc_prohibit_always-defined_macros syntax-check rule. Also remove now-irrelevant "Don't use bcopy..." comment.
2011-10-21tail: with -f, use nanosleep (not inotify) on a GPFS file systemMartial Bornet
Because tail's fremote function did not designate GPFS as a remote file system type, tail -f would mistakenly attempt to use inotify, which cannot work with a remote file system. * src/tail.c (fremote): List GPFS as a remote file system type. * NEWS (Bug fixes): Mention it. Reported in http://bugs.debian.org/646022.
2011-10-19maint: tac: prefer "failed to" diagnostic over "cannot"Jim Meyering
* src/tac.c: Change wording in diagnostic: "failed to open" seems clearer than "cannot open".
2011-10-19tac: do not let failed allocation cause immediate exitJim Meyering
* src/tac.c (temp_stream): Don't exit immediately upon failed heap allocation, here. That would inhibit processing of any additional command-line arguments.
2011-10-19tac: use only one temporary file, with multiple nonseekable inputsJim Meyering
* src/tac.c (temp_stream): New function, factored out of... (copy_to_temp): ...here. (tac_nonseekable): Don't free or fclose, now that we reuse the file. Suggested by Ambrose Feinstein. * THANKS.in: Update.
2011-10-18maint: make tac.c slightly cleanerPaul Eggert
* src/tac.c (copy_to_temp): Now that the template string tacXXXXXX is used in only one place, don't bother using a separate variable. Also, using three unconditional assignments seems slightly clearer.
2011-10-17tac: don't leak a file descriptor for each non-seekable inputJim Meyering
* src/tac.c (tac_nonseekable): Call fclose and free tmp_file after each successful call to copy_to_temp.
2011-10-17tac: don't misbehave with multiple non-seekable inputsJim Meyering
* src/tac.c (copy_to_temp): Do not reuse the template buffer. Instead, scribble only on a freshly-xstrdup'd copy each time. Free that buffer both here, upon failure, and ... (tac_nonseekable): ...free the buffer in caller, upon success. * tests/misc/tac-2-nonseekable: New file. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it. Reported by Ambrose Feinstein in http://debbugs.gnu.org/9762.
2011-10-17maint: tac: remove sole use of sprintf in favor of filenamecatJim Meyering
* src/tac.c: Include filenamecat.h. (copy_to_temp): Use filenamecat rather than xmalloc and sprintf. Move some declarations "down" to point of initialization.
2011-10-09rm: do not resort to stat'ing very long names even on deficient systemsJim Meyering
This change affects only systems that have neither *at function support nor the /proc/self/fd support required to emulate those *at functions. * src/remove.c (write_protected_non_symlink): Call faccessat unconditionally. Thus we no longer need euidaccess_stat, which was the sole function used here to operate on a full relative file name. Remove full_name parameter and update caller. * lib/euidaccess-stat.h: Remove file. * lib/euidaccess-stat.c: Likewise. * m4/euidaccess-stat.m4: Likewise. * po/POTFILES.in: Remove lib/euidaccess-stat.c. * m4/prereq.m4 (gl_PREREQ): Don't require gl_EUIDACCESS_STAT. Prompted by a report from Bruno Haible that the rm/deep-2 test was failing on HP-UX 11.31. See http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1748
2011-10-01build: use getgr*_nomembers functions on InterixMarkus Duft
Interix provides faster replacements for getgr{gid,nam,ent} where group member information is not fetched from domain controllers. This makes 'id' usable on domain controlled interix boxes. * m4/jm-macros.m4: Check for _nomembers functions. * src/system.h: Redefine function to _nomembers when available.
2011-10-01build: accommodate missing setgroups on InterixMarkus Duft
Add a dummy, non-functional, always-successful replacement setgroups function, to keep the original code untouched and simple. * src/chroot.c (setgroups) [! HAVE_SETGROUPS]: Define.
2011-10-01ls: fix output of dangling symlinks colored as targetPádraig Brady
This is related to commit b7f2b51c, 2010-01-01, "ls: fix color of broken symlinks colored as target" which didn't handle the --dereference case. The simplest way to reproduce the resultant erroneous "argetm" is as follows: $ ln -s /no-such dangle $ env LS_COLORS=ln=target ls --dereference --color ls: cannot access dangle: No such file or directory argetmdangle This is also an issue with the `tree` utility, reported here: http://bugs.debian.org/586765 * src/ls.c (print_color_indicator): Move the handling of 'ln=target' in $LS_COLORS (color_symlink_as_referent == true) to a higher scope, to handle all cases where type == C_LINK. * tests/misc/ls-misc: Add a test case for the specific issue, and 2 further test cases to verify other code paths in this area. Reported by Jason Glassey.
2011-09-30ls: avoid reading beyond end of color indicatorJim Meyering
At first this looked like a buffer overrun, since there was no test to ensure that the buffer length was 6. However, since the LS_COLORS string is NUL-terminated and since settings within it are separated by ":" there was neither the risk of reading beyond end of buffer nor risk of a false-positive match. * src/ls.c (print_color_indicator): Use color_symlink_as_referent rather than manually comparing against "target" again. * src/system.h (STRNCMP_LIT): Correct description in comment.
2011-09-27sort: avoid a NaN-induced infloopJim Meyering
These commands would fail to terminate: yes -- -nan | head -156903 | sort -g > /dev/null echo nan > F; sort -m -g F F That can happen with any strtold implementation that includes uninitialized data in its return value. The problem arises in the mergefps function when bubble-sorting the two or more lines, each from one of the input streams being merged: compare(a,b) returns 64, yet compare(b,a) also returns a positive value. With a broken comparison function like that, the bubble sort never terminates. Why do the long-double bit strings corresponding to two identical "nan" strings not compare equal? Because some parts of the result are uninitialized and thus depend on the state of the stack. For more details, see http://bugs.gnu.org/9612. * src/sort.c (nan_compare): New function. (general_numcompare): Use it rather than bare memcmp. Reported by Aaron Denney in http://bugs.debian.org/642557. * NEWS (Bug fixes): Mention it. * tests/misc/sort-NaN-infloop: New file. * tests/Makefile.am (TESTS): Add it.