summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2014-10-17tests: avoid false failure when comparing /proc filesBernhard Voelker
At least the MHz number in /proc/cpuinfo may change, thus leading to a false positive failure when comparing the expected against the actual output file. Use an invariant file instead: /proc/version. * tests/misc/head-c.sh: s/cpuinfo/version/
2014-10-16tests: fix test hang with unstable inodes in /procPádraig Brady
* cp/proc-zero-len.sh: Search the 'err' file for the error to ignore, not stdin.
2014-10-16chroot: call chroot() unconditionally to handle bind mounted "/"Pádraig Brady
* src/chroot.c (is_root): Adjust to compare canonicalized paths rather than inodes, to handle (return false in) the case where we have a tree that is constructed by first bind mounting "/" (thus having the same inode). (main): Unconditionally call chroot() because it's safer and of minimal performance benefit to avoid in this case. This will cause inconsistency with some platforms not allowing `chroot / true` for non root users. * tests/misc/chroot-fail.sh: Adjust appropriately. * NEWS: Mention the bug fixes. Fixes http://bugs.gnu.org/18736
2014-10-15copy: avoid an extraneous error when reporting errorsPádraig Brady
* src/copy.c (copy_reg): If sparse_copy() failed, then an erroneous error about failing to extend the file would be reported.
2014-10-15cp: read sparse files more efficiently with non regular destinationPádraig Brady
* src.copy.c (copy_reg): Use fiemap to read sparse files, even if the output is not to a regular file. * NEWS: Mention the improvement.
2014-10-15cp: avoid speculative preallocation with --sparse=alwaysPádraig Brady
With --sparse=always use fallocate(...PUNCH_HOLE...) to avoid any permanent allocation due to speculative preallocation employed by file systems such as XFS. * m4/jm-macros.m4: Check for <linux/falloc.h> and fallocate(). * src/copy.c (punch_hole): A new function to try and punch a hole at the specified offset if supported. (create_hole): Call punch_hole() after requesting a hole. (extent_copy): Likewise. * NEWS: Mention the improvement.
2014-10-15copy: detect smaller holes than the copy buffer sizePádraig Brady
Previously cp would not detect runs of NULs that were smaller than the buffer size used for I/O (currently 128KiB). * src/copy.c (copy_reg): Use an independent hole_size, set to st_blksize, to increase the chances of detecting a representable hole, in a run of NULs read from the input. (create_hole): A new function refactored from sparse_copy() and extent_copy() so we have a single place to handle holes. (sparse_copy): Adjust to loop over the larger input buffer in chunks of the passed hole size. Also adjust to only call lseek once per hole, rather than at least once per input buffer. * tests/cp/sparse.sh: Add test cases for various sparse chunk sizes. * NEWS: Mention the improvement.
2014-10-09doc: clarify that timeout limits are not 2038 secondsWieland Hoffmann
* man/timeout.x: The 2038 that the sentence is referring to is the year 2038, not 2038 seconds (the default unit used for timeouts).
2014-10-08maint: avoid new signed overflow warning on 32 bitPádraig Brady
Prompted by http://hydra.nixos.org/build/15682577 with GCC 4.8.3 on i686 src/tac.c:557:6: error: assuming signed overflow does not occur when simplifying conditional to constant [-Werror=strict-overflow] if (bytes_copied < 0) This happens because copy_to_temp() is inlined in tac_nonseekable(), thus reducing the comparison to the bytes_copied variable in copy_to_temp. Now this can't overflow on either 32 or 64 bit due to the protection of the preceding fwrite(). We could use a guard like "if (bytes_copied <= OFF_T_MAX - bytes_read)" to avoid the warning, but rather than a runtime branch, just use an unsigned type to avoid apparent signed overflow on systems where the accumulation is not promoted to unsigned (32 bit size_t, 64 bit off_t). * src/tac.c (copy_to_temp): Increment an unsigned type to avoid the subsequent signed overflow warning.
2014-10-07tests: split/b-chunk.sh: avoid spurious fail on non-LinuxJim Meyering
* tests/split/b-chunk.sh: Skip each file that does not exist. Some systems lack /proc/version or /sys/kernel/profiling
2014-10-08maint: avoid syntax-check failures in previous patchPádraig Brady
* tests/misc/od-j.sh: Non standard comparison order. * tests/split/b-chunk.sh: Confusing input file name. * tests/tail-2/tail-c.sh: Redundant require ulimit.
2014-10-07wc: don't miscount /sys and similar file systemsPaul Eggert
Fix similar problems in head, od, split, tac, and tail. Reported by George Shuklin in: http://bugs.gnu.org/18621 * NEWS: Document this. * src/head.c (elseek): Move up. (elide_tail_bytes_pipe, elide_tail_lines_pipe): New arg CURRENT_POS. All uses changed. (elide_tail_bytes_file, elide_tail_lines_file): New arg ST and remove arg SIZE. All uses changed. * src/head.c (elide_tail_bytes_file): * src/od.c (skip): Avoid optimization for /sys files, where st_size is bogus and st_size == st_blksize. Don't report error at EOF when not optimizing. * src/head.c, src/od.c, src/tail.c: Include "stat-size.h". * src/split.c (input_file_size): New function. (bytes_split, lines_chunk_split, bytes_chunk_extract): New arg INITIAL_READ. All uses changed. Use it to double-check st_size. * src/tac.c (tac_seekable): New arg FILE_POS. All uses changed. (copy_to_temp): Return size of temp file. All uses changed. * src/tac.c (tac_seekable): * src/tail.c (tail_bytes): * src/wc.c (wc): Don't trust st_size; double-check by reading. * src/wc.c (wc): New arg CURRENT_POS. All uses changed. * tests/local.mk (all_tests): Add tests/misc/wc-proc.sh, tests/misc/od-j.sh, tests/tail-2/tail-c.sh. * tests/misc/head-c.sh: * tests/misc/tac-2-nonseekable.sh: * tests/split/b-chunk.sh: Add tests for problems with /proc and /sys files. * tests/misc/od-j.sh, tests/misc/wc-proc.sh, tests/tail-2/tail-c.sh: New files.
2014-10-04doc: document stat's output with the --terse optionBernhard Voelker
* doc/coreutils.texi (stat invocation): Add a paragraph documenting stat's output format when the --terse option is specified, both in normal and in --file-system mode. Reported by Dan Jacobson <jidanni@jidanni.org> in http://bugs.gnu.org/18624
2014-10-02tests: fix false failure for test referencing libdlNick Alcock
* init.cfg (gcc_shared_): -ldl has to be positioned after the object files that may rely upon it. This fixes tests/cp/nfs-removal-race.sh which references dlsym() from libdl.
2014-10-02maint: avoid double semicolon syntax check failureBernhard Voelker
A syntax-check recently added to gnulib would trigger a failure (once gnulib gets updated here) for a statement introduced with commit v8.23-43-gaf2a4ed: src/dd.c:806: char const *time_fmt = _(", %g s, %s/s\n");; maint.mk: Double semicolon detected make: *** [sc_prohibit_double_semicolon] Error 1 * src/dd.c (print_xfer_stats): s/;;/;/
2014-09-30dd: new status=progress level to print stats periodicallyFederico Simoncelli
* src/dd.c: Report the transfer progress every second when the new status=progress level is used. Adjust the handling and description of the status= option so that they're treated as mutually exclusive levels, rather than flags with implicit precedence. * doc/coreutils.texi (dd invocation): Document the new progress status level. Reference the new level in the description of SIGUSR1. * tests/dd/stats.sh: Add new test for status=progress. * tests/dd/misc.sh: Change so status=none only takes precedence if it's the last level specified. * NEWS: Mention the feature.
2014-09-30dd: use more robust SIGUSR1 handlingPádraig Brady
* src/dd.c (ifd_reopen): A new wrapper to ensure we don't exit upon receiving a SIGUSR1 in a blocking open() on a fifo for example. (iftruncate): Likewise for ftruncate(). (iread): Process signals also after a short read. (install_signal_handlers): Install SIGINFO/SIGUSR1 handler even if set to SIG_IGN, as this is what the parent can easily set from a shell script that can send SIGUSR1 without the possiblity of inadvertently killing the dd process. * doc/coreutils.texi (dd invocation): Improve the example to show robust usage wrt signal races and short reads. * tests/dd/stats.sh: A new test for various signal races. * tests/local.mk: Reference the new test. * NEWS: Mention the fix.
2014-09-24test: check for Fedora 20 sort key bugPaul Eggert
Problem reported by Göran Uddeborg in: http://bugs.gnu.org/18540 * tests/misc/sort.pl: New test 23.
2014-09-24mv: use reflink=auto mode by defaultDavid Sterba
On some filesystems (BTRFS), moving a file within the filesystem may cross subvolume boundaries and we can use a lightweight reflink copy, similar to what cp(1) can do, which is faster than a full file copy. This is enabled by default because it's only an optimization for the fall back copy and does not break user expectations or usability. * src/mv.c (cp_option_init): Set the reflink mode to AUTO. * NEWS: Mention the improvement.
2014-09-23stty: only list supported options in --help and man pagesPádraig Brady
* src/stty.c (usage): Exclude unsupported options from --help, which for example impacts the "dsusp" and "cdtrdsr" options on Linux. Fixes http://bugs.gnu.org/18506
2014-09-23doc: fix use of "e.g." in stdbuf help messageMichal Nazarewicz
"E.g." stands for latin "exempli gratia" which is typically read as "for example". "E.g." does not stand for the word "example". As such, "for e.g." might be read as "for for example". Fix this usage by simply replacing "e.g." with "example".
2014-09-23build: pass program name to help2man after other optionsBernhard Voelker
* man/local.mk (.x.1): Move the program name argument down after the last option argument when calling $(run_help2man). While the other way would be accepted for the GNU help2man program, it is not for the 'dummy-man' script (called as a fallback on systems lacking perl). The wrong order was introduced in commit v8.21-119-gb3578fc while adding the --info-page option.
2014-09-23build: fix argument count check in dummy-man againBernhard Voelker
* man/dummy-man: Fix argument count check, now only permitting exactly 1 argument, the program name. Reported by Andreas Schwab <schwab@linux-m68k.org>
2014-09-22build: fix an inverted test breaking dummy-manAlban Bedel
* man/dummy-man: Fix argument count check, allowing dummy-man to run (on systems without perl). Fixes http://bugs.gnu.org/18531
2014-09-19build: fix dependency issues with man page generationPádraig Brady
* .gitignore: Remove reference to no longer generated make file. * configure.ac: Don't bother generating placeholder make file. * man/local.mk: Hardcode the man page deps list for normal builds to be compatible with all make implementations and configure options. Note in SINGLE_BINARY mode, all man pages will be generated on any change to the coreutils binary, but development will generally not be done in this mode, so this shouldn't be an issue. Fixes http://bugs.gnu.org/18055
2014-09-19maint: don't trigger gcc-5's new -Wlogical-not-parentheses warningJim Meyering
* src/dircolors.c (main): Parenthesize !VAR as LHS to "<", to avoid triggering gcc's new -Wlogical-not-parentheses warning.
2014-09-19cp: fix handling of -H with multiply specified source dirsPádraig Brady
Following on from commit v5.92-729-g130dd06, also avoid the erroneous directory hardlink warning with -H. * src/copy.c (copy_internal): Also handle the -H case for command line arguments. * tests/cp/duplicate-sources.sh: Augment the test case. * NEWS: Augment the news entry.
2014-09-19cp: issue correct warning and ignore duplicate source dirsPádraig Brady
* src/copy.c (copy_internal): Handle the case where we have the same destination directory as already encountered, which can only be due to the corresponding source directory being specified multiple times. * tests/cp/duplicate-sources.sh: Add a test for the new multiply specified directory case, and the existing multiply specified file case. * tests/local.mk: Reference the new test. * NEWS: Mention the bug fix.
2014-09-19doc: output correct --help references with --program-prefixPádraig Brady
* src/system.h (emit_ancillary_info): Take the invariant PROGRAM_NAME as a parameter, so that consistent references are made to online docs and texinfo nodes, when a --program-prefix is in place. Note the man pages don't need this fix as they're generated before the program prefix is used. * NEWS: Mention the improvements in references to online documentation.
2014-09-19doc: ensure the correct texinfo nodes are referenced in --helpPádraig Brady
* src/system.h (emit_ancillary_info): For commands that don't have a 1:1 mapping with the texinfo node names, provide a mapping to the correct node. * doc/coreutils.texi: Add some extra cross references noticed while checking this. Fixes http://bugs.debian.org/762092
2014-09-16tests: fix false du failure on newer XFSBernhard Voelker
On XFS, when creating the ~2G test file 'big' in a for-loop by appending 20M each time, the file ends up using ~4G - visible in 'st_blocks'. The unused space would be reclaimed later. This feature is called "speculative preallocation" which aims at avoiding fragmentation. According to the XFS FAQ [1], there are two particular aspects of XFS speculative preallocation that are triggering this: 1. "Applications that repeatedly trigger preallocation and reclaim cycles [after file close] can cause fragmentation. Therefore, this pattern is detected and causes the preallocation to persist beyond the lifecycle of the file descriptor." 2. "Preallocation sizes grow as files grow larger." [1] http://xfs.org/index.php/XFS_FAQ Avoid one of the above by only doing a single close (reclaim cycle). * tests/du/2g.sh: Similar to the fix for a dd test (see commit v8.22-65-g7c03fe2), avoid speculative preallocation by creating the 'big' file in one go instead of appending to it in the loop. Remove debugging statements as the output with 'set -x' is sufficient nowadays.
2014-09-11cat: allow copying empty files to themselvesPaul Eggert
Problem reported by Vincent Lefevre in: http://bugs.gnu.org/18449 * src/cat.c (main): Allow copying an empty file to itself. * tests/misc/cat-self.sh: New test. * tests/local.mk (all_tests): Add it.
2014-09-11doc: reference online info pages directly from man pagesPádraig Brady
* src/system.h (emit_ancillary_info): Add a direct reference to the corresponding online info documentation. Corresponding redirects were put in place on www.gnu.org to allow for concise links. * help2man: Adjust to add the "online help" link (and subsequent translation bugs link) to a "REPORTING BUGS" section. Also add the concise links for further information in --help to the "SEE ALSO" section, and dispense with the more verbose default for that.
2014-09-10doc: adjust reference to info nodes in man pagesPádraig Brady
old form: coreutils '$cmd invocation' new form: '(coreutils) $cmd invocation' The old form erroneously referenced the node for the 'coreutils' multi-call program. Now that problematic node name was renamed in commit v8.23-18-g72e470b, but the newer less ambiguous form also has the advantage of working with the pinfo viewer for example. Full discussion at http://bugs.gnu.org/18428 * man/local.mk: Adjust man page references to texinfo nodes. * src/system.h: Adjust --help references to texinfo nodes.
2014-09-10maint: include libstdbuf.c in extraneous headers checkPádraig Brady
* cfg.mk (sc_system_h_headers): Don't exclude libstdbuf.c. * src/libstdbuf.c: Remove headers already included in system.h.
2014-09-10build: adjust previous transformations on libstdbuf namePádraig Brady
* src/local.mk (transform): commit v8.23-22-g6f9b018 discarded all transformations on the libstdbuf.so name. Be more conservative and only exclude the $(program_transform_name) portion for libstdbuf.
2014-09-10build: avoid name transformations on libstdbufPádraig Brady
* src/local.mk (transform): Skip the transformation for libstdbuf since that should not be subject to name clashes, and we need to reference the name directly in LD_PRELOAD etc. * configure.ac: Add a comment on the coupling of pkglibexec_PROGRAMS to $(transform). Issue reported at https://trac.macports.org/ticket/44922 Improved by Nick Bowler
2014-09-09maint: fix syntax-check issues in recent commitPádraig Brady
Avoid 2 new syntax-check failures introduced in commit v8.23-19-g8defcee * cfg.mk (sc_some_programs_must_avoid_exit_failure): s/exit/return/. * src/whoami.c (main): Reinstate translation marker for diagnostic.
2014-09-08maint: avoid file-scope names of the form _[a-z]*Paul Eggert
The C standard says this isn't portable, if you include standard include files. * build-aux/gen-single-binary.sh: * src/coreutils-arch.c (single_binary_main_arch) (single_binary_main_uname): * src/coreutils-dir.c (single_binary_main_ls) (_single_binary_main_dir): * src/coreutils-vdir.c (single_binary_main_ls) (_single_binary_main_vdir): * src/coreutils.c (SINGLE_BINARY_PROGRAM): Remove leading _ from single_binary prefix. * src/numfmt.c (round_style): Rename from _round. All uses changed. (inval_style): Rename from _invalid. All uses changed.
2014-09-08maint: prefer 'return status;' to 'exit (status);' in 'main'Paul Eggert
* build-aux/gen-single-binary.sh: Don't use ATTRIBUTE_NORETURN for main functions. * src/base64.c, src/basename.c, src/cat.c, src/chcon.c, src/chgrp.c: * src/chmod.c, src/chown.c, src/chroot.c, src/cksum.c, src/comm.c: * src/cp.c, src/csplit.c, src/cut.c, src/date.c, src/dd.c, src/df.c: * src/dircolors.c, src/dirname.c, src/du.c, src/echo.c, src/env.c: * src/expand.c, src/expr.c, src/factor.c, src/fmt.c, src/fold.c: * src/getlimits.c, src/groups.c, src/head.c, src/hostid.c: * src/hostname.c, src/id.c, src/install.c, src/join.c, src/kill.c: * src/link.c, src/ln.c, src/logname.c, src/ls.c, src/make-prime-list.c: * src/md5sum.c, src/mkdir.c, src/mkfifo.c, src/mknod.c, src/mktemp.c: * src/mv.c, src/nice.c, src/nl.c, src/nohup.c, src/nproc.c: * src/numfmt.c, src/od.c, src/paste.c, src/pathchk.c, src/pinky.c: * src/pr.c, src/printenv.c, src/printf.c, src/ptx.c, src/pwd.c: * src/readlink.c, src/realpath.c, src/rm.c, src/rmdir.c, src/runcon.c: * src/seq.c, src/shred.c, src/shuf.c, src/sleep.c, src/sort.c: * src/split.c, src/stat.c, src/stdbuf.c, src/stty.c, src/sum.c: * src/sync.c, src/tac.c, src/tail.c, src/tee.c, src/timeout.c: * src/touch.c, src/tr.c, src/true.c, src/truncate.c, src/tsort.c: * src/tty.c, src/uname.c, src/unexpand.c, src/uniq.c, src/unlink.c: * src/uptime.c, src/users.c, src/wc.c, src/who.c, src/whoami.c: In 'main' functions, Prefer 'return status;' to 'exit (status);'. * src/coreutils-arch.c (_single_binary_main_uname) (_single_binary_main_arch): * src/coreutils-dir.c, src/coreutils-vdir.c (_single_binary_main_ls) (_single_binary_main_dir, _single_binary_main_vdir): Omit ATTRIBUTE_NORETURN. Return a value. * src/coreutils.c (SINGLE_BINARY_PROGRAM): Omit ATTRIBUTE_NORETURN. (launch_program): Now static. * src/dd.c (finish_up): New function. (quit, main): Use it. * src/getlimits.c (main): Return a proper exit status. * src/test.c (test_main_return): New macro. (main): Use it. * src/logname.c, src/nohup.c, src/whoami.c: Use 'error' to simplify exit status in 'main' function. * src/yes.c (main): Use 'return' rather than 'error' to exit, so that GCC doesn't suggest ATTRIBUTE_NORETURN.
2014-09-08doc: rename "coreutils invocation" to "Multi-call invocation"Paul Eggert
This supports longstanding shell commands like 'info coreutils "touch invocation"'. Problem reported by Vincent Lefevre via Bob Proulx in: http://bugs.gnu.org/18428 * doc/coreutils.texi (Multi-call invocation): Rename from "coreutils invocation".
2014-09-08doc: mention which commands are optionalPaul Eggert
* doc/coreutils.texi (coreutils invocation, df invocation) (stty invocation, whoami invocation, nproc invocation) (arch invocation, hostname invocation, hostid invocation) (uptime invocation, chroot invocation, nice invocation) (stdbuf invocation): Document that the command is installed optionally.
2014-09-07doc: fix typosBernhard Voelker
* doc/coreutils.texi: Fix normal typos: s/pseudorandom/pseudo-random/; s/behaviour/behavior/; s/linux-based/Linux-based/; s/nonnegative/non-negative/. Fix IEC's long name: s/Electronical/Electrotechnical/. Wrap 'getopt' into the @code{} macro. Fix a grammatical error (from myself): s/splitted/split/.
2014-09-03doc: spell "indeterminate" correctlyPaul Eggert
* doc/coreutils.texi (timeout invocation): Fix misspelling. Reported by Yureruchihirosan via OKANO Takayoshi in: http://bugs.gnu.org/18394
2014-08-23maint: ensure fiemap extents flags are compared correctlyPádraig Brady
* src/extent-scan.c (extent_scan_read): Following on from the flags size adjustment in commit v8.23-13-g1505b37, verify that the internal representation of the flags is never truncated which could happen in the unlikely case on 32 bit if the kernel flags ever expanded to 64 bits which is theoretically possible given the reserved space.
2014-08-22maint: avoid int64_t and similar types unless they're neededPaul Eggert
C11 doesn't require them, even POSIX doesn't strictly require the 64-bit versions, and it makes the code a bit clearer if they're used only when needed. * src/copy.c (write_zeros, extent_copy): * src/extent-scan.h (struct extent_info.ext_length): Use off_t, not uint64_t, for a value derived from a file offset. * src/extent-scan.h (struct extent_info.ext_flags) Prefer plain unsigned int to uint32_t where either will do. (struct extent_scan.ei_count): Use size_t, not uint32_t, for a value bounded by SIZE_MAX. * src/factor.c (MAGIC64, MAGIC63, MAGIC65): Remove unnecessary casts to uint64_t.
2014-08-21maint: refactor ls QUOTING_STYLE env var handlingYurij Goncharuk
* src/ls.c (main): As per the FIXME comment, move the QUOTING_STYLE handling to a separate function.
2014-08-21doc: clarify that duplicate NFS mounts are skipped by dfFridolin Pokorny
* doc/coreutils.texi (df invocation): Add a sentence that eliding duplicate entries for the same file system is not limited to bind mounts, but also happens for remote file systems like NFS.
2014-08-19df: improve mount point selection with inaccurate mount listPádraig Brady
v8.23 has a test failure on Fedora rawhide build servers in tests/df/skip-duplicate.sh. This was due to no '/' entry being output by df. That was due to an inaccurate /proc/mounts on the build environment as stat(/mnt/point) identified all these /proc/mounts entries as having the same device id: / rootfs / /dev/md1 /dev devtmpfs /run tmpfs /boot /dev/md0 /proc/filesystems /dev/md1 Since the device name on the right changes for a given id, that causes the entries to be continually replaced, thus resulting in no '/' entry. I'm guessing this is due to the mock environment bind mounting unneeded or sensitive items to a dummy file on the host / (/dev/md1) though have not looked into those details. So rather than relying on an accurate /proc/mounts, the attached patch takes a more conservative replacement approach and only swaps a new device entry when the mount point matches. That should handle all practical cases while also avoiding this situation. * src/df.c (filter_mount_list): Only replace entries with different device names when the mount point also matches.
2014-08-11cp: remove redundant possibly expensive heap deallocationRasmus Borup Hansen
If the hash structures grow sufficiently large so that the system is actively swapping, then the deallocation can take a significant amount of time. Details at: http://lists.gnu.org/archive/html/coreutils/2014-08/msg00012.html * src/cp.c (main): Only call hash deallocation routines when in lint checking mode. * THANKS.in: Remove as now in the git author list.