summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2015-12-31dd: append spaces to shorter status=progress linePaul Eggert
Problem noted by Pádraig Brady in: http://bugs.gnu.org/22277#8 Also, make the output a bit more precise while we're at it. * NEWS: Document this. * src/dd.c (previous_time): Remove, replacing with ... (next_time): New var. All uses changed. This avoids some rounding errors, and should be a bit faster. (newline_pending): Remove, replacing with ... (progress_len): New var. All uses changed. This lets us keep track of how many trailing spaces to append. (print_xfer_stats): Get the time first thing, so that it's closer to being correct. Count the bytes output, and append trailing spaces if needed. Add remarks to translators about translation lengths.
2015-12-31dd: summarize in --human-readable format tooPaul Eggert
Problem reported by Linda Walsh in: http://bugs.gnu.org/17505 * NEWS: Document this. * doc/coreutils.texi (dd invocation): Use a simpler script. Adjust output example to match new behavior. * src/dd.c (human_size): Remove. All uses changed to use human_readable and ... (human_opts): ... this new constant. (abbreviation_lacks_prefix): New function. (print_xfer_stats): Use it. Output both --si and --human-readable summaries, but only if they have prefixes. * tests/dd/reblock.sh, tests/dd/stats.sh: Test new behavior.
2015-12-14sort: fix --debug marking for -b -k1.xPádraig Brady
We were erroneously skipping blanks in the marked comparison _after_ the key start offset was applied. * src/sort.c (debug_keys): Don't skip starting blanks if already handled by begfield(). * tests/misc/sort-debug-keys.sh: Add a test case. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/22155
2015-12-14stat: report file system type for "overlayfs"Pádraig Brady
* src/stat.c (human_fstype): Add "overlayfs", and tag it as "remote" to ensure that tail continues to use the more conservative polling mode. * README-release: Remove a stale comment about updating fremote() in tail.c. Also give a link to *_SUPER_MAGIC definitions not in the standard linux/magic.h location. * NEWS: Mention that this file system is recognized.
2015-12-14kill: add undocumented -L for compatibilityPádraig Brady
procps, bash >= 4.4, and util-linux >= 2.23 all have the -L option to output a table. * src/kill.c (main): Have -L synonymous with -t. Luckily there is no signal that begins with 'L'. * tests/misc/kill.sh: Update the test.
2015-12-14maint: fix incorrect spellings etcPádraig Brady
* NEWS: Use a standard version specification. * doc/coreutils.texi: Fix incorrect grammar. * src/df.c: Update a stale comment. * src/copy.c: Fix incorrect spellings. * src/factor.c: Likewise. * src/ls.c: Likewise. * src/pr.c: Likewise. * src/relpath.c: Likewise. * src/shred.c: Likewise. * src/sort.c: Likewise. * src/split.c: Likewise. * src/stdbuf.c: Likewise. * tests/misc/seq-precision.sh: Likewise.
2015-12-14maint: remove form feed characters from sourcesPádraig Brady
These are no longer useful and can impact viewing patches in some mail programs for example. * src/cksum.c: Remove ^L characters. * src/comm.c: Likewise. * src/kill.c Likewise. * src/ln.c Likewise. * src/nl.c Likewise. * src/pr.c Likewise. * src/ptx.c Likewise. * src/split.c Likewise. * src/tr.c Likewise. * src/tsort.c Likewise. * src/uniq.c Likewise. * src/wc.c Likewise. * cfg.mk (sc_prohibit-form-feed): A new syntax check.
2015-12-07sort: promote '--debug'Eric Blake
* src/sort.c (usage): Mention --debug in KEYDEF paragraph.
2015-12-04doc: improve the description of sort --random-sortPádraig Brady
* src/sort.c (usage): Avoid mentioning the implementation, rather focusing on the result of the operation.
2015-11-30doc: avoid confusing K argument in the man pages of head and tailBernhard Voelker
The character 'K' representing numeric user input can be confusing, especially in the context where it can be suffixed by the multipliers K, M, G, etc. Use NUM instead. * doc/coreutils.texi (head invocation): Replace @var{k} by @var{num}. Also change @var{count} in the paragraph about the obsolete option syntax. (tail invocation): Likewise. Furthermore, adjust the option order to alphabetical sorting. * src/head.c (usage): s/K/NUM/ in as placeholder in the -c and -n options. Furthermore, print the actual DEFAULT_NUMBER instead of the hard-coded 10. * src/tail.c (usage): s/K/NUM/ in as placeholder in the -c and -n options. Add "[+]" to clarify that NUM may optionally be preceded by this sign. Remove the redundant explanation of the optional '+' prefix for NUM, as that is now clear from the option description above. Suggested by Dan Jacobson in http://bugs.gnu.org/22042
2015-11-25doc: clarify descriptions for tr --squeeze-repeatsPádraig Brady
* doc/coreutils.texi (uniq invocation): Fix the description of problematic input to say "blank lines" rather than "two or more blank lines". (tr invocation): Clarify that -s only works with SET1 when not translating (when SET2 not specified). Also explicitly state in examples where blank lines are deleted. Also add "deleting" to the menu item. * src/tr.c (usage): Improve the -s summary to say it always operates on the last specified SET.
2015-11-24copy: fix copying of extents beyond the apparent file sizeDmitry Monakhov
fallocate can allocate extents beyond EOF via FALLOC_FL_KEEP_SIZE. Where there is a gap (hole) between the extents, and EOF is within that gap, the final hole wasn't reproduced, resulting in silent data corruption in the copied file (size too small). * src/copy.c (extent_copy): Ensure we don't process extents beyond the apparent file size, since processing and allocating those is not currently supported. * tests/cp/fiemap-extents.sh: Renamed from tests/cp/fiemap-empty.sh and re-enable parts checking the extents at and beyond EOF. * tests/local.mk: Reference the renamed test. * NEWS: Mention the bug fix. Fixes http://bugs.gnu.org/21790
2015-11-23md5sum,sha*sum: ensure --ignore-missing fails when no file verifiedPádraig Brady
* src/md5sum.c (digest_check): Update a matched_checksums bool upon matched checksum, and fail (loudly unless --status is specified) if there were no matches. Also change properly_formatted_lines to a bool while at it since we don't need to track the plurality. * tests/misc/md5sum.pl: Add a test case. Suggested by Jim Meyering.
2015-11-23md5sum,sha*sum: add --ignore-missing for checking a subset of filesLuther Thompson
* doc/coreutils.texi (md5sum invocation): Document the new option. * src/md5sum.c (digest_file): Return an empty digest to indicate a missing file. (digest_check): Don't fail or output status given an empty checksum. (usage): Document the new option. (main): Process and validate the new option. * tests/misc/md5sum.pl: Add new test cases. * NEWS: Mention the new feature. Fixes http://bugs.gnu.org/15604
2015-11-19build: fix VPATH build with --disable-dependency-trackingPádraig Brady
* src/local.mk: Run `mkdir -p src` in all our explicit rules, as in a VPATH build the src/ dir is only created at configure time as a side effect of dependency tracking generation.
2015-11-17maint: remove unmaintained file, c99-to-c89.diffJim Meyering
* src/c99-to-c89.diff: Remove file. * src/local.mk (EXTRA_DIST): Remove it from this list. * README (Pre-C99 build failure): Update section.
2015-11-12csplit: check and report fwrite errors with errnoAssaf Gordon
discussed in: http://lists.gnu.org/archive/html/coreutils/2015-10/msg00091.html * src/csplit.c: (save_line_to_file): check fwrite failures, report and exit immediately instead of deferring to 'close_output'. * tests/misc/csplit-io-err.sh: test fwrite failure using LD_PRELOAD. * tests/local.mk: add new test.
2015-11-11stat: improve support for new Linux pseudo FS and ACFSPádraig Brady
* src/stat.c (human_fstype): Add new file system ID definitions. * NEWS: Mention the improvement.
2015-11-04maint: add a syntax check to avoid unstyled quotingPádraig Brady
* src/paste.c (main): Use our styled wrapper for quotearg_colon(). * cfg.mk (sc_prohibit-quotearg): A new syntax check to avoid future uses of unstyled quotearg to one of the internal slots, and thus destined for diagnostic output.
2015-11-04paste: avoid confusing backslash quoting in diagnosticPádraig Brady
* src/paste.c (main): Setting the quoting style to "escape" went against the intent of the comment about presenting doubled backslashes to the user. Instead use "c-maybe" which is the only mode which avoids doubled backslashes, and provides protection against arbitrary control characters. * tests/misc/paste.pl: Adjust accordingly.
2015-11-04ls: default to --quoting=shell-escape for output to terminalPádraig Brady
* src/ls.c (decode_switches): Set "shell-escape" if isatty(). * doc/coreutils.texi (ls invocation): Update the defaults description. * NEWS: Mention the change in behavior. It should not have backwards compat issues, but mentioning here just in case.
2015-11-04printf: support the %q format to quote for shellPádraig Brady
* src/printf.c (usage): Mention the new format. (print_formatted): Handle the quoting by calling out to the quotearg module with "shell-escape" mode. * doc/coreutils.texi (printf invocation): Document %q. * tests/misc/printf-quote.sh: New test. * tests/local.mk: Reference new test. * NEWS: Mention the new feature.
2015-11-04ls: avoid redundant processing when already escapingPádraig Brady
This is mainly noticeable when the multi-byte code within ls.c is triggered by multi-byte quotes. $ seq 200000 | xargs touch $ time ls-old -U --quoting=locale --hide-control-chars >/dev/null real 0m0.483s $ time ls-new -U --quoting=locale --hide-control-chars >/dev/null real 0m0.430s * src/ls.c (quote_name): Avoid rescanning the output looking for unprintable chars when we know the quoting mode already escapes them. * tests/misc/ls-misc.pl: Add tests for all quoting modes, with and without -q, to verify this assumption.
2015-11-04ls: document and test new shell-escape quotingPádraig Brady
* doc/coreutils.texi (ls invocation): Describe the new 'shell-escape' and 'shell-escape-always' quoting options. * src/ls.c (usage): Mention the new quoting options. * tests/misc/ls-misc.pl: Add a test for 'shell-escape'
2015-11-04test: use consistent quotingPádraig Brady
* src/test.c (test_syntax_error): Reuse verror() rather than open coding the error output format. (term): Don't hardcode '' quoting. (main): Likewise.
2015-11-04all: avoid quoting file names when possiblePádraig Brady
Quote file names using the "shell-escape" or "shell-escape-always" methods, which quote as appropriate for most shells, and better support copy and paste of presented names. The "always" variant is used when the file name is embedded in an error message with surrounding spaces. * cfg.mk (sc_error_shell_quotes): A new syntax check rule to suggest quotef() where appropriate. (sc_error_shell_always_quotes): Likewise for quoteaf(). * src/system.h (quotef): A new define to apply shell quoting when needed. I.E. when shell character or ':' is present. (quoteaf): Likewise, but always quote. * src/*.c: Use quotef() and quoteaf() rather than quote() where appropriate. * tests/: Adjust accordingly.
2015-11-04md5sum: ensure a single status line per filePádraig Brady
* src/md5sum.c: Use the same file name escaping method used when generating and checking checksums. I.E. ensure a single line per file by starting the line with '\' for any file name containing '\n' and replacing those with "\\n". * NEWS: Move the item from changes in behavior to improvements, since this is no longer a backwards incompat change when processing stdout status messages. * tests/misc/md5sum.pl: Remove quotes from expected status output. * tests/misc/sha1sum.pl: Likewise.
2015-11-04all: replace most uses of quotearg_colon() with quote()Pádraig Brady
Related to commit v8.24-61-g6796698 this provides more consistent quoting, as quotearg_colon() defaults to "literal" quoting by default, while quote() provides appropriate quoting for diagnostics by default. * gl/modules/randread: Depend on quote module rather than quotearg. * gl/lib/randread.c: Used quote() not quotearg_colon(). * src/: Likewise. * src/shred.c: Likewise. Also avoid unnecessary quoting introducing overhead when wiping names. * cfg.mk: Relax the matching expression to allow "qname" variables as used in shred.c to satisfy the check. * tests/: Adjust accordingly.
2015-10-27date: use extended format timezone for --iso-8601Pádraig Brady
* src/date.c (main): Use %:z rather than %z with --iso-8601 as the standard states to consistently use extended format. Note either format can be parsed by date. * tests/misc/date.pl: Adjust accordingly. * doc/coreutils.texi (du invocation): Clarify that "iso" time styles are only similar to ISO-8601. (ls invocation): Likewise. (date invocation): Adjust the comment stating that only --rfc-3339 output can be parsed by date(1). * NEWS: Mention the change in behavior. Reported at http://bugs.debian.org/799479
2015-10-27copy,dd: simplify and optimize NUL bytes detectionPádraig Brady
* src/factor.c: Move LIKELY() definition to... * src/system.h: ...here. (is_nul): Reimplement with a version that doesn't require a sentinel after the buffer, and which calls down to (the system optimized) memcmp. Performance analyzed at http://rusty.ozlabs.org/?p=560 * src/dd.c (alloc_obuf): Simplify the is_nul() call by not needing to write the sentinel. * src/copy.c (sparse_copy): Likewise. (copy_reg): Simplify the buffer allocation by avoiding consideration of the sentinel in the buffer size calculation.
2015-10-27all: quote string arguments in error messagesPádraig Brady
These strings are often file names or other user specified parameters, which can give confusing errors in the presence of unexpected characters for example. * cfg.mk (sc_error_quotes): A new syntax check rule. * src/*.c: Wrap error() string arguments with quote(). * tests/: Adjust accordingly. * NEWS: Mention the improvement.
2015-10-27md5sum: quote all printed file namesPádraig Brady
This is especially significant when using --check with files generated on a windows system, where the \r characters produce corrupted and confusing error messages. This also ensures status messages are output on a single line. * src/md5sum.c: Use quote() for printed file names. * tests/misc/md5sum.pl: Adjust accordingly. * NEWS: Mention the change in behavior. Fixes http://bugs.gnu.org/21757
2015-10-21ls: fix off by one error when determining max display columnsPádraig Brady
* src/ls.c (main): Account for the first column not including a separator when calculating max_idx. * tests/ls/w-option.sh: Add a test case. * NEWS: Mention the bug fix.
2015-10-21ls: allow -w0 to mean no limit on line lengthPádraig Brady
* src/ls.c (print_with_separator): Renamed from print_with_commas, and parameterized to accept the separator to print. Also fix an edge case where '\n' not printed when the POS variable overflows SIZE_MAX. (print_current_files): Degenerate -x and -C to using the cheaper print_with_separator() in the -w0 case. * doc/coreutils.texi (ls invocation): Document the new feature. * tests/ls/w-option.sh: A new test. * tests/local.mk: Reference the new test. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/21325
2015-10-19ls: detect terminal color support using glob patternsPádraig Brady
* src/ls.c (know_term_type): Corresponding to commit v8.24-48-gc249a5a, use fnmatch to inspect the dircolors database. Noticed due to failing tests/ls/color-{dtype-dir,term}.sh tests.
2015-10-19maint: fixes to support improved sc_tight_scopePádraig Brady
The gnulib provided sc_tight_scope target was ineffective, as it was checking against an invalid blank regular expression, and thus ignoring any extern function issues. This is now fixed up in gnulib, and so we need to fix our scoping issues before the next gnulib update. * cfg.mk: Setup and document the tight_scope config variables appropriately. * src/selinux.h: Since declared in *_SOURCES, use the two line form for the extern function declarations. * src/set-fields.h: Add the extern declarations, and since declared in noinst_HEADERS use the single line form.
2015-10-19factor: remove unreachable SQUFOF code at compile timePádraig Brady
It was a little confusing as to whether the SQUFOF algorithm was enabled, and in fact there were no options available to enable it. Therefore clarify the 3 configurable behaviors for the code to 3 defines at the top of the program, and only include the SQUFOF code if enabled at compile time. $ size src/factor-before text data bss 93997 1412 2504 $ size src/factor-after text data bss 87885 1404 2504 * src/factor.c: Only include the SQUFOF factor code when enabled via the USE_SQUFOF define. * doc/coreutils.texi (factor invocation): Update note about factor limits, as we can factor 128 bit numbers without GMP.
2015-10-19doc: reference shuf(1) from the sort (-R) man pagePádraig Brady
* man/sort.x: Cross reference with shuf(1). * src/sort.c (usage): Mention shuf(1) with -R option. Suggested in http://bugs.debian.org/641166
2015-10-16maint: avoid uniq.c warning from bleeding-edge gcc's -Wstrict-overflowJim Meyering
* src/uniq.c (main): Make the type of "nfiles" unsigned, to avoid a brand new warning from a gcc I built from today's sources (gcc version 6.0.0 20151015 (experimental) (GCC)): src/uniq.c:523:14: error: assuming signed overflow does not occur \ when simplifying conditional to constant [-Werror=strict-overflow] if (nfiles == 2) ^
2015-10-16dircolors: support globbing of TERM entriesPádraig Brady
* src/dircolors.c (dc_parse_stream): Support globbing of TERM entries, to allow entries like "TERM *256color*" for example. * src/dircolors.hin: Reduce the internal list with globbing. * tests/misc/dircolors.pl: New test cases. * NEWS: Mention the improvement.
2015-10-12tail: no longer warn about unrecognized file systemsPádraig Brady
* src/tail.c (fremote): No longer prompt the user to email with the unrecognized file system constant, since we have process in place to sync periodically with the latest Linux constants, and the fall back polling mode is still fully functional.
2015-10-06csplit: remove erroneous mention of -m in --helpPádraig Brady
* src/csplit.c (usage): -m is not accepted, only --suppress-matched. * tests/misc/csplit-suppress-matched.pl: Spelling fix. Reported by Ondrej Oprala
2015-10-03tee: simplify argv handlingPaul Eggert
* src/tee.c (tee_files): Last arg is now char ** instead of char const **, as that is a bit simpler. All callers changed. Modify files[-1], not files[nfiles], as that is a bit faster and simpler. Latter problem pointed out by Rainer Deyke in: http://bugs.gnu.org/21611
2015-10-03build: Pacify GCC 5 on 32-bit hostsPaul Eggert
This pacifies GCC 5 in a better way, without disabling diagnostics. * src/df.c (main): Tell compiler that optind is positive. * src/shred.c (known): New function. (dopass): Go back to off_t for file sizes. Avoid integer overflow if we run off the end of the file. Tell compiler that a write cannot write more bytes than requested.
2015-10-03tail: handle kernel dentry unlink racePádraig Brady
Avoid the intermittent loss of "... has become inaccessible" messages. That would cause tests/tail-2/assert.sh to fail sometimes, mainly on uniprocessor systems. * src/tail.c (tail_forever_inotify): Also monitor IN_DELETE events on the directory, to avoid a dentry unlink()..open() race, where the open() on the deleted file was seen to succeed after an, unlink() and a subsequent IN_ATTRIB, was sent to tail. Note an IN_ATTRIB is sent on the monitored file to indicate the change in number of links, and we can't just use a decrease in the number of links to determine the file being unlinked, due to the possibility of the file having multiple links. Reported by Assaf Gordon and Ludovic Courtès. Fixes http://bugs.gnu.org/21460
2015-10-03build: avoid -Wstrict-overflow warnings with GCC 5.1 on 32 bitPádraig Brady
* src/shred.c (dopass): With -O2, GCC 5.1 gives "assuming signed overflow does not occur when simplifying conditional to constant" warnings, in regard to the signed (off_t) variables. Therefore use unsigned (uintmax_t) instead, and a separate boolean to cater for the special meaning of the negative part of the integer range. Noticed at http://hydra.nixos.org/build/24983447
2015-10-02dircolors: add xterm-termite entryDario Giovannetti
* src/dircolors.hin: Add "xterm-termite" as this VTE based terminal emulator is quite different from xterm, despite the name. For example "Termite supports italic text and it won't work if TERM is set to xterm. Even the backspace key won't work properly anymore for applications relying on terminfo". Reported also by Lukas Sabota and Sven-Hendrik Haase.
2015-09-23df: prioritize mounts nearer the device rootDave Chiluk
In the presence of bind mounts of a device, the 4th "mount root" field from /proc/self/mountinfo is now considered, so as to prefer mount points closer to the root of the device. Note on older systems with an /etc/mtab file, the source device was listed as the originating directory, and so this was not an issue. Details at http://pad.lv/1432871 * src/df.c (filter_mount_list): When deduplicating mount entries, only prefer sources nearer or at the root of the device, when the target is nearer the root of the device. * NEWS: Mention the change in behavior.
2015-09-22maint: avoid deprecation warning with <selinux/flask.h>Pádraig Brady
* src/runcon.c (main): As per the compile time warning from libselinux-2.4-3, lookup the class with string_to_security_class(), rather than using defines from flask.h.
2015-09-22sort,numfmt: with --debug, diagnose failure to set localePádraig Brady
* src/sort.c (main): With --debug, warn upon setlocale() failure, which can happen due to incorrectly specified environment variables, or due to memory exhaustion (simulated with ulimit -v), etc. * tests/misc/sort-debug-warn.sh: Add a test case. See also http://savannah.gnu.org/bugs/11004