summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2011-05-25split: fix an edge case where -n l/... creates an extra filePádraig Brady
* src/split.c (lines_bytes_chunk): Handle the edge case where the file is truncated as we read. * tests/misc/split-lchunk: Cleanup; no functional change.
2011-05-25chmod: output the original mode in verbose modeBernhard Voelker
* src/chmod.c (describe_change): Pass in the original mode, and output this in the messages. * tests/chmod/c-option: Adjust as per the new message. * THANKS.in: Remove the now auto-generated name. * NEWS: Mention the change in behavior. Signed-off-by: Pádraig Brady <P@draigBrady.com>
2011-05-25maint: accommodate gnulib's newer tight_scope ruleJim Meyering
* cfg.mk: Include via "-include", to accommodate new tight-scope rule. (sc_check-AUTHORS): Change the name of the rule in src/Makefile.am to _sc_check-AUTHORS, so it doesn't conflict with this one when this file is included into the sub-make's context. * src/Makefile.am (_sc_check-AUTHORS): Rename from sc_check-AUTHORS. * gnulib: Update to latest.
2011-05-25touch: placate static analyzers: no NULL-deref is possibleJim Meyering
* src/touch.c (main): Avoid even the hint of possibility that we'd dereference NULL upon localtime failure. Coverity reported the potential, but it appears not to be possible, since posixtime rejects any time for which the subsequent localtime would return NULL. See http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1253
2011-05-24split: fix cases where -n l/... creates extraneous filesPádraig Brady
* src/split.c (lines_chunk_split): Ensure that data is only written to stdout when k specified. Also ensure that extra files are not created when there is more data available than reported in the file size. * tests/misc/split-lchunk: Verify that split -n l/k/n doesn't generate any files, and that -n l/n always generates n files. * NEWS: Mention the fix.
2011-05-24doc: add a missing space in timeout --helpStéphane Raimbault
* src/timeout.c (usage): Add a space to be consistent with other uses of "(the default)" in the documentation. Signed-off-by: Pádraig Brady <P@draigBrady.com>
2011-05-21maint: fix comment typos in df.cIvan Sichmann Freitas
* src/df.c: s/Optain/Obtain/
2011-05-19maint: correct typos involving misuse of "a" and "an"Jim Meyering
* NEWS: "an misleading" * src/expr.c: "a integer * src/ptx.c (find_occurs_in_text): "a end" * src/shred.c (do_wipefd): "a infinite" * src/sort.c (SUBTHREAD_LINES_HEURISTIC): "an dual-core" (compare_random): "an checksum" * cfg.mk (old_NEWS_hash): Update, since the typo was in old news.
2011-05-18printf: fix an out-of-bounds memory accessPádraig Brady
* src/printf.c (STRTOX): Don't access memory after a string containing a single quote character. * tests/misc/printf: Add tests for various combinations of single quote characters combined with a numeric format. * THANKS.in: Add bug reporter. * NEWS: Mention the fix. Reported-by: Paul Marinescu <paul.marinescu@imperial.ac.uk>
2011-05-17doc: mention that ls time ordering is newest firstPádraig Brady
* src/ls.c (usage): Add the "newest first" info to the -t and -c options
2011-05-13ls: allow stat-free use of --colorJim Meyering
Even on a system with d_type support, the default use of --color makes ls stat every file in order to be able to honor settings like EXEC, STICKY, ORPHAN, SETUID, etc., because those settings require information that is not provided by dirent.d_type. However, if for a potentially large performance gain, you are willing to disable those settings, you can now make ls --color give type-related coloring and perform no stat calls at all (other than the unavoidable call-per- command-line argument). Before this change, even with all of those attributes disabled, ls --color would still stat every directory. Now, we're down to the minimum of one stat call per command-line arg. * src/ls.c (gobble_file): With --color, don't stat a non-command-line-specified directory when no directory-coloring attribute is enabled. * tests/init.cfg (require_dirent_d_type_): New function. * tests/d_type-check: New script, mostly from Pádraig Brady. * tests/Makefile.am (EXTRA_DIST): Add it. * tests/ls/stat-free-color: New test. * tests/Makefile.am (TESTS): Add it. * doc/coreutils.texi (General output formatting): Describe how to use dircolors to make ls --color refrain from calling stat on a d_type-enabled file system. Prompted by a query from Josef Bacik.
2011-05-12maint: use <unistd.h>, not "group-member.h"Jim Meyering
gnulib's group-member module now ensures that the group_member function is declared in <unistd.h>, just like it is glibc. * lib/euidaccess-stat.c: Remove inclusion of "group-member.h". * src/chgrp.c: Likewise.
2011-05-11maint: remove syntax-checking sc_tight_scope ruleJim Meyering
* src/Makefile.am (sc_tight_scope): Remove rule. Now it's provided via gnulib's maint.mk. * cfg.mk (sc_tight_scope): Likewise.
2011-05-11maint: tail: mark a global variable as staticJim Meyering
* src/tail.c [HAVE_INOTIFY] (inotify_wd_mask): Declare static.
2011-05-08maint: remove -Wmissing-field-initializers workaroundsPádraig Brady
* configure.ac: Rather than disabling -Wmissing-field-initializers, use the fact that gnulib now disables it automatically when required (on versions of GCC older than 4.7). * src/system.h: Remove the no longer needed DECLARE_ZEROED_AGGREGATE. * src/ls.c: Likewise. * src/pathchk.c: Likewise. * src/shred.c: Likewise. * src/stty.c: Likewise. * src/wc.c: Likewise.
2011-05-06split: accept new output --filter=CMD optionKarl Heuer
* src/split.c: Include <signal.h>, <sys/wait.h> and "sig2str.h". (FILTER_OPTION): New anonymous enum member. (filter_command, filter_pid): New globals. (open_pipes, open_pipes_alloc, n_open_pipes): Likewise. (oldblocked, newblocked): Likewise. (longopts): Add "filter". (usage): Document --filter. (create): Extend to create a pipe and fork "sh -c CMD". (closeout): Adapt to close a pipe and wait for child process. (cwrite): Call closeout, not just close. (lines_chunk_split): FIXME (bytes_chunk_extract): FIXME (opid, ofile_open, lines_rr, main): FIXME (ignorable): New function, to encapsulate EPIPE test.
2011-05-06sort: fix a contradictory --debug warningPádraig Brady
* src/sort.c (key_warn): `sort -k2,1n --debug` would output warnings about being both "zero width" and "spanning multiple fields". Suppress the latter one. * tests/misc/sort-debug-warn: Add a couple of test cases.
2011-05-05df: fix crash in mem exhaustion edge casePádraig Brady
* src/df.c (print_table): Don't try to output NULL if ambsalign() can't allocate memory. Instead just output the unaligned text.
2011-05-03copy: fix my typoJim Meyering
* src/copy.c (copy_reg): Fix my typo (mis-applied patch). The patch by Jeff Liu was fine, but I mis-applied it and introduced a compilation error in commit efa479c1. 2011-05-03 Jim Meyering <meyering@redhat.com>
2011-05-03copy: correct misuse of quote in diagnosticJeff Liu
* src/copy.c (copy_reg): Multiple uses of quote (s) in an argument list is erroneous. Use quote_n, instead.
2011-04-30maint: adjust split.c formatting to conformJim Meyering
* src/split.c (usage): Correct indentation. (ofile_open): Likewise. (create): "char *name", not "char* name". (struct of_info) [ofile]: Similar. (parse_chunk): Add spaces around "+".
2011-04-26maint: tweak sc_tight_scope ruleJim Meyering
* src/Makefile.am (sc_tight_scope): Remove useless quotes, change 1>&2 to >&2, and combine a few short lines.
2011-04-26dd: work around compilation failure on AIX 5.1 and 5.2Jim Meyering
* src/dd.c (O_NOCACHE): Undefine. This symbol is defined via AIX's <fcntl.h>, yet used as an enum name in dd.c. Reported by Gary V. Vaughan in http://debbugs.gnu.org/8555 * NEWS (Portability): Mention this.
2011-04-26maint: move two small functions, so we can remove a fwd declJim Meyering
* src/dd.c (cleanup, quit): Move the definition of quit to follow the definition of process_signals, so we can remove the declaration of the latter.
2011-04-25maint: change some leading 8-space sequences to TABs in a Makefile.amJim Meyering
src/Makefile.am (fs-magic, fs-kernel-magic): Change some leading 8-space sequences to TABs.
2011-04-25stat: recognize V9FS and ECRYPTFS file systemsJim Meyering
* src/stat.c (human_fstype): Add magic numbers for V9FS and ECRYPTFS.
2011-04-25tail --follow=name no longer implies --retryJim Meyering
* src/tail.c (tail_forever_inotify): Just as without inotify, tail --follow=name now terminates when the last tailed-by-name file is unlinked or moved aside. This bug was introduced on 2009-06-15 via commit ae494d4b, "tail: use inotify if it is available". Reported by Tim Underwood in http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22286 * NEWS (Bug fixes): Mention this. * tests/tail-2/follow-name: Test for this. * tests/Makefile.am (TESTS): Add it.
2011-04-25copy: include both src and dest names in clone failure diagnosticJeff Liu
* src/copy.c (copy_reg): Upon btrfs clone failure, print not just the destination file name, but also the source file name. That may be useful upon failure of a cross-device clone attempt.
2011-04-25doc: tail/inotify does use --sleep-interval=S, with --pid=PJim Meyering
* doc/coreutils.texi (tail invocation): Mention it. * src/tail.c (usage): Likewise. (tail_forever_inotify): Clarify comment.
2011-04-20copy: use FIEMAP (extent_copy) only for apparently-sparse files,Jim Meyering
to avoid the expense of extent_copy's unconditional use of FIEMAP_FLAG_SYNC. * src/copy.c (copy_reg): Do not attempt extent_copy on a file that appears to have no holes. * NEWS (Changes in behavior): Document this. At first I labeled this as a bug fix, but that would be inaccurate, considering there is no documentation of FIEMAP semantics, nor even consensus among kernel FS developers. Here's hoping SEEK_HOLE/SEEK_DATA support will soon make it into the linux kernel.
2011-04-20copy: factor out a tiny sparse-testing functionJim Meyering
* src/copy.c (HAVE_STRUCT_STAT_ST_BLOCKS): Define to 0 if undefined, so we can use it in the return expression, here: (is_probably_sparse): New function, factored out of... (copy_reg): ...here. Use the new function.
2011-04-20copy: do not treat unwritten extents specially: avoid XFS/ext4 data lossJim Meyering
* src/copy.c (extent_copy): Do not treat "unwritten extents" specially. Otherwise, with a release-candidate 2.6.39-rc3 kernel, XFS or ext4, when using gold as your linker, and if you forget to run "make check", you could end up installing files full of zeros instead of the expected binaries. For a lot of discussion, see http://thread.gmane.org/gmane.comp.file-systems.xfs.general/37895 * tests/cp/fiemap-empty: Disable this test.
2011-04-20copy: always use FIEMAP_FLAG_SYNC, for nowJim Meyering
* src/extent-scan.c (extent_need_sync): Always return true, to make the sole caller always use FIEMAP_FLAG_SYNC. This will doubtless have an undesirable performance impact, but we'll mitigate that shortly, by using extent_copy only on files with holes.
2011-04-17dircolors: add .ear, .war, .sar, for Java jar-like archivesOndřej Vašík
* src/dircolors.hin: Add .ear, .war, .sar, for Java jar-like archives Suggested by Ville Skyttä in https://bugzilla.redhat.com/616497.
2011-04-12maint: remove unnecessary inclusion of <stdio.h>Jim Meyering
* src/extent-scan.c: Don't include <stdio.h>. It was not used.
2011-04-11maint: install: remove support for --preserve_context ("_", not "-")Jim Meyering
* src/install.c: Its use has elicited a warning for two years. Use --preserve-context instead. * NEWS (changes in behavior): Mention this.
2011-04-11maint: reorder install.c to eliminate declarations of static functionsJim Meyering
* src/install.c: Remove static function declarations.
2011-04-11maint: rename variables for clarity...Jim Meyering
and to avoid a false-positive "TO to" in new doubled word check. * src/install.c (change_timestamps): Rename parameters for readability. Make the comment match the code.
2011-04-11maint: remove doubled words in comments, e.g., s/to to/to/Jim Meyering
* tests/ls/color-norm: s/to to/to/ * gl/lib/mbsalign.h (mbs_align_t): s/or or/or/ * src/extent-scan.c (extent_scan_read): s/the the/the/ * src/libstdbuf.c: s/the the/the/ * tests/misc/stdbuf: s/on on/on/ * ChangeLog-2005: s/for\n\tfor /for\n\t/
2011-04-11maint: misc typo fixesPádraig Brady
* src/fiemap.h: s/can not/cannot/ * NEWS: s/in/is/ * doc/coreutils.texi: Remove spurious "and". s/effect/affect/ Use matched ``...'' quotes.
2011-04-06copy: handle mergeable extents across fiemap scansPádraig Brady
* extent-scan.h (extent_scan_free): Init the pointer to NULL, and reset the count to 0, so that we can realloc the buffer. * src/extent-scan.c (extent_scan_init): Likewise. (extent_scan_read): Loop over multiple fiemap scans, so we handle mergeable extents that span across fiemap scan boundaries. Once we have enough unique extents, return so as to minimize memory use.
2011-04-06copy: fix an unlikely memory leak when a fiemap copy failsPádraig Brady
* src/copy.c (extent_copy): Free the extents array when sparse_copy() fails.
2011-04-04tests: minor improvement of sc_tight_scope ruleJim Meyering
* src/Makefile.am (sc_tight_scope): Adjust rule to use an eval-based trap-setting for-loop rather than 4x hard-coded 128+N constants. Also catch SIGQUIT (3). Tweak comments.
2011-04-03maint: prohibit direct use of strncmp: prefer STREQ_LEN, STRNCMP_LITJim Meyering
* cfg.mk (sc_prohibit_strncmp): New rule, mostly from libvirt. * src/system.h (STREQ_LEN, STRPREFIX, STRNCMP_LIT): Define. * src/df.c (get_dev, get_point): Convert. * src/extent-scan.c (extent_need_sync): Likewise. * src/ls.c (is_colored, decode_switches): Likewise. (parse_ls_color, (print_color_indicator): Likewise. * src/md5sum.c (split_3): Likewise. * src/split.c (main, emit_ancillary_info): Likewise. * src/tr.c (look_up_char_class): Likewise. * src/uname.c (main): Likewise. * src/who.c (scan_entries): Likewise.
2011-04-03copy: require fiemap sync also for 2.6.38 kernelsJim Meyering
* src/extent-scan.c (extent_need_sync): Require sync also for 2.6.38. Without this, part of the cp/fiemap-empty test would fail both on F15-to-be (2.6.38.1-6.fc15.x86_64) and rawhide. For details, see http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22190
2011-04-02cp: always detect copy-into-self: avoid infloop w/large PATH_MAXJim Meyering
When running the erroneous command, cp -rl A D D, and depending on the structure of directories A and D and the file system type (because that changes order of dir. entry traversal), cp would sometimes fail to detect that D was being copied into D, and would create D/D/D/D/D/... until it hit PATH_MAX or exhausted some resource. I noticed this via the occasional failure of the cp/into-self test when run using a ZFS file system. It is occasional because the bug is dependent on the order in which directory entries are traversed, and that is apparently indeterminate with ZFS. Technically, with the current recursive implementation, there is no risk of an infinite loop, due to stack limitations, but with an eventual fts-based implementation, it might have iterated until disk space or inodes are exhausted. * src/copy.c (copy_dir): Avoid copy-into-self interminable loop on systems with large PATH_MAX. On other systems, diagnose the copy-into- self error consistently. Handle the parameter, first_dir_created_per_command_line_arg, correctly when there are two or more sub-directories.
2011-04-01copy: process empty extents more efficientlyPádraig Brady
* src/copy.c (extent_copy): Treat an allocated but empty extent much like a hole. I.E. don't read data we know is going to be NUL. Also we convert the empty extent to a hole only when SPARSE_ALWAYS so that the source and dest have the same allocation. This will be improved soon, when we use fallocate() to do the allocation. * tests/cp/fiemap-empty: A new test for efficiency and correctness of copying empty extents. * tests/Makefile.am: Reference the new test. * NEWS: Mention the change in behavior.
2011-04-01copy: protect against overlapping extentsPádraig Brady
* src/extent-scan.c (extent_scan_read): Add a more stringent check for OFF_T overflow, to ensure subsequent code is immune. Detect overlapping extents and adjust, so as files always copied. Detection using a single scan with fallback to a standard copy was thought too expensive in memory or time. * NEWS: Mention the fix
2011-04-01copy: link rather than copy symlinks, when --link usedPádraig Brady
This bug was introduced in commit ca9e212c, 2009-09-24, "cp, mv: use linkat to guarantee semantics", which inadvertently disabled the creation of hardlinks to symlinks. However rather than implementing the intention of that commit and relying on gnulib linkat emulation, we'll revert to the previous emulation as that maintains ownership and timestamps. * src/copy.c (copy_internal): Use our existing hardlink to symlink emulation when link() might dereference the symlink. Also ensure that we copy the timestamps of the original symlink when we use the emulation. * tests/cp/link-symlink: Add a test to ensure timestamps copied. * tests/Makefile.am: Reference the new test. * NEWS: Mention the fix. Reported by Ruediger Meier
2011-03-31copy: with fiemap copy, only sync when neededPádraig Brady
* src/extent-scan.h (struct extent_scan): Add the fm_flags member to pass to the fiemap scan. * src/extent-scan.c (extent_need_sync): A new function used to detect Linux kernels before 2.6.38. (extent_scan_init): Add FIEMAP_FLAG_SYNC when needed. * tests/cp/sparse-fiemap: Adjust comment. * NEWS: Mention the change in behavior. Indirectly suggested by Mike Frysinger