summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
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
2011-03-28maint: correct formatting style in a headerJim Meyering
* src/find-mount-point.h: Move "*" to where it belongs. Move "const", too. * src/find-mount-point.c: Move "const" to conform. * src/Makefile.am (sc_tight_scope): Allow `*'s before the function name. Use perl's -l option and drop the \n after (and quotes around) $1.
2011-03-23df: fix alignment of columnsPádraig Brady
* src/df.c (alloc_table_row): A new function to allocate storage for a row of strings. (print_table): A new function to interate over all stored strings in the table, and apply alignment honoring the max width of each column. (get_header): Renamed from print_header, and adjusted accordingly. (get_dev): Renamed from show_dev. Also we no longer wrap longer device names over two lines, which can be an unexpected issue for scripts parsing the output from df. (get_disk): s/show_/get_/ (get_point): Likewise. (get_entry): Likewise. (get_all_entries): Likewise. * NEWS: Mention the change.
2011-03-22test: accept "==" as a synonym for "="David A. Wheeler
Make GNU coreutils' test recognize "==" as a synonym for "=". This is already the case in GNU coreutils' expr, bash, ksh, busybox ash, FreeBSD-current /bin/sh and /bin/test, and OpenBSD's /bin/sh. Before, env test a '==' a would fail with this diagnostic: "test: ==: binary operator expected". Now, it succeeds. * src/test.c: Accept "==" as a synonym for "=". * doc/coreutils.texi (String tests): Document it. Reported as http://debbugs.gnu.org/8263 Also see http://austingroupbugs.net/view.php?id=375
2011-03-16sort: avoid memory pressure of 130MB/thread when reading from pipeJim Meyering
* src/sort.c (INPUT_FILE_SIZE_GUESS): Decrease initial allocation factor used to size buffer used when reading a non-regular file. For motivation, see discussion here: http://thread.gmane.org/gmane.comp.gnu.coreutils.general/878/focus=887
2011-03-13sort: spawn fewer threads for small inputsJim Meyering
* src/sort.c (SUBTHREAD_LINES_HEURISTIC): Do not spawn a new thread for every 4 lines. Increase this from 4 to 128K. 128K lines seems appropriate for a 5-year-old dual-core laptop, but it is too low for some common combinations of short lines and/or newer systems. * NEWS (Bug fixes): Mention it.
2011-03-11copy: merge similar extents before processingPádraig Brady
* src/extent-scan.c (extent_scan_read): Merge adjacent extents that vary only in size, so that we may process them more efficiently. This will be especially useful when we introduce fallocate() so that we don't reproduce fragmentation in the destination.
2011-03-05dd: avoid or diagnose some problems with short readsPaul Eggert
* src/dd.c (warn_partial_read): New static var. (iread): Diagnose partial reads if needed. (iwrite): Don't diagnose them here; not needed any more. (scanargs): Determine whether partial reads should be diagnosted.
2011-03-05dd: add a flag to discard cached dataPádraig Brady
* src/dd.c (FFS_MASK): A new macro (Find First Set) refactored from the following enum as it's now used twice. (usage): Mention the new 'nocache' flag. (cache_round): A new function to help ignore requests to drop cache, that are less than page_size. (invalidate_cache): A new function to call posix_fadvise() with the appropriate offset and length. Note we don't use fdadvise() so we can detect errors when count=0. (dd_copy): Call invalidate_cache() for the portions read. (iwrite): Likewise for the portions written. (main): Call invalidate_cache for page_size slop or for full file when count=0. * cfg.mk (sc_dd_O_FLAGS): Adjust to pass. * doc/coreutils.texi (dd invocation): Describe the 'nocache' flag, and give some examples of how it can be used. * tests/dd/nocache: A new test. * tests/Makefile.am: Reference the new test. * NEWS: Mention the new feature.
2011-03-05doc: clarify that `dd bs=` can immediately output short readsPádraig Brady
* doc/coreutils.texi (dd invocation): Clarify that bs= can cause parital reads to be immediately written to output. * src/dd.c (usage): Hint that bs= can cause partial writes. See http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8171
2011-03-05doc: group dd conv= options that are actually flagsPádraig Brady
* src/dd.c (usage): Move 'sync' up with other data transformation options. Having it alongside 'fsync' and 'fdatasync' is particularly confusing. Also the double line description of the 'sync' option, serves as a visual break from the "flag" type options that follow. * doc/coreutils.texi (dd invocation): Apply the same grouping as above, by splitting the "conv=" table in two.
2011-03-05dd: warn when we disable oflag=direct not at EOFPádraig Brady
An alternative to this is to auto enable iflag=fullblock when oflag=direct and bs= is specified. It was thought better though, to warn about the specific issue, and give full control of dd's options to the user. * src/dd.c (iwrite): Warn, when we write after having disabled O_DIRECT. See https://bugzilla.redhat.com/show_bug.cgi?id=614605
2011-03-03du: don't infloop for --files0-from=DIRJim Meyering
* src/du.c (main): Fail on AI_ERR_READ error, rather than merely diagnosing and continuing. Based on a patch by Stefan Vargyas. Also move the handling of AI_ERR_EOF into the case stmt. Do not report ferror/fclose(stdin) failure when we've already diagnosed e.g., failure to read the DIR, above. Bug introduced by 2008-11-24 commit 031e2fb5, "du: read and process --files0-from= input a name at a time,". * src/wc.c: Handle read failure as with du: do not exit immediately, but rather go on to print any total and to clean-up. As above, move the handling of AI_ERR_EOF into the case stmt. * tests/du/files0-from-dir: New file, to test both du and wc. * tests/Makefile.am (TESTS): Add it. * NEWS (Bug fixes): Mention it.
2011-03-03wc: avoid NULL dereference on out-of-memory errorJim Meyering
* src/wc.c (main): Diagnose failed argv_iter_init_* failure, rather than falling through and dereferencing NULL. Bug introduced by 2008-11-25 commit c2e56e0d, "wc: read and process --files0-from= input a name at a time,". * NEWS (Bug fixes): Mention it.
2011-02-18stdbuf: avoid even the appearance of a possible use-after-freeJim Meyering
There was an execution path by which "libstdbuf" could be used after being freed, but that would happen only if there were no libstdbuf.so alongside the stdbuf program and there had been an installation error leading to absence of the file, PKGLIBDIR/libstdbuf.so. * src/stdbuf.c (set_LD_PRELOAD): Rearrange loop to make it perfectly clear that there is no possibility of use-after-free. Steve Grubb reported this possible use-after-free of "libstdbuf".
2011-02-14uptime: omit unnecessary #ifPaul Eggert
* src/uptime.c (print_uptime): Omit unnecessary "#if defined HAVE_GETLOADAVG || defined C_GETLOADAVG". This #if is always true, and removing it will help us simplify the gnulib getloadavg module.
2011-02-11copy: adjust fiemap handling of sparse filesPádraig Brady
Don't depend on heuristics to detect sparse files if fiemap is available. Also don't scan for new holes unless --sparse=always has been specified. * src/copy.c (extent_copy): Pass the user specified sparse mode, and handle as described above.
2011-02-11copy: suppress redundant lseeks when using fiemapPádraig Brady
* src/copy.c (extent_copy): Suppress redundant lseek()s in both the source and dest files, when there is no hole between extents.