summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-08-09maint: refactor common expand(1) and unexpand(1) codeAssaf Gordon
* src/expand.c, src/unexpand.c: Move global variables from here... * src/expand-common.h, src/expand-common.c: ... to here. * src/expand.c, src/unexpand.c: (parse_tab_stops, validate_tab_stops, next_file): Move identical functions to new module. (add_tab_stop): Move to new module, including additional code from 'unexpand' (keeping max_column_width) which will have no effect in when used in 'expand'. Refactor common next-column calculation code into a new function 'get_next_tab_column'. * src/local.mk: (src_expand_SOURCES, src_unexpand_SOURCES): Add 'expand-common.c'; (noinst_HEADERS): Add 'expand-common.h'. * po/POTFILES.in: Add 'expand-common.c'. * tests/misc/expand.pl: Add more tests. * tests/misc/unexpand.pl: Likewise. * TODO: Move conclusions to above test after investigation.
2016-08-03df: improve performance with many mount pointsPhilipp Thomas
Use hash table for seaching in filter_mount_list() and get_dev() This improves performance for 20K mount entries from: real 0m1.731s user 0m0.532s sys 0m1.188s to: real 0m1.066s user 0m0.028s sys 0m1.032s * src/df.c (devlist_table): Define hash table. (devlist_hash): Add hash function. (devlist_compare): Add hash comparison function. (devlist_for_dev): Add lookup function. (devlist_free): Add cleanup function. (filter_mount_list): Use the above hash table. While at it, rename the variable 'devlist' to 'seen_dev' for better readability. (me_for_dev): Use the above lookup function. NEWS: Mention the improvement. THANKS.in: Remove the committer; add original submitter Josef Cejka.
2016-07-28doc: revert recent date(1) synopsis changePádraig Brady
* src/date.c (usage): This was thought to introduce other ambiguities, and was inconsistent with the format presented in the touch(1) docs. * doc/coreutils.texi (date invocation): Likewise. See http://bugs.gnu.org/24077
2016-07-27maint: pacify GCC 6 with -Wnull-dereferenceBernhard Voelker
src/id.c:249:29: error: potential null pointer dereference \ [-Werror=null-dereference] pw_name = xstrdup (pwd->pw_name); ~~~^~~~~~~~~ src/whoami.c:89:11: error: potential null pointer dereference \ [-Werror=null-dereference] puts (pw->pw_name); ~~^~~~~~~~~ * src/id.c (main): Explicitly exit with EXIT_FAILURE after an eror to help gcc-6 to detect that the dereferenced pointer is valid. * src/whoami.c (main): Likewise.
2016-07-27build: update gnulib submodule to latestBernhard Voelker
Mainly for * 77d36b5 obstack: pacify GCC 6 with -Wnull-dereference
2016-07-27maint: skip a check when en_US.UTF-8 collation rules are brokenJim Meyering
* cfg.mk (sc_THANKS_in_sorted): This check would fail on systems for which "." is not ignored. Add a quick sort-based check for that error, and skip the check on any broken system.
2016-07-27doc: make date(1) synopsis consistent with output +FORMATPádraig Brady
* src/date.c (usage): Make the characters used to summarize the input format, match the output +FORMAT characters. * doc/coreutils.texi (date invocation): Likewise. Fixes http://bugs.gnu.org/24077
2016-07-27maint: fix dependency of man/arch.1Bernhard Voelker
The following is a reproducer for the wrong dependency: $ ./configure --enable-install-program=arch $ make $ rm -f src/arch man/arch.1 $ make man/arch.1 GEN man/arch.1 help2man: can't get `--help' info from man/arch.td/arch Try `--no-discard-stderr' if option outputs to stderr Makefile:14378: recipe for target 'man/arch.1' failed make: *** [man/arch.1] Error 127 * man/local.mk (man/arch.1): Change to depend on src/arch rather than src/uname: while the arch binary depends on uname.c and uname-arch.c, its man page depends on the arch binary. Reported downstream by Rodrigues Goldwyn <rgoldwyn@suse.com> in https://build.opensuse.org/request/show/415172
2016-07-18sort: with -h, disallow thousands separator between number and unitKamil Dudka
* src/sort.c (traverse_raw_number): Accept thousands separator only if it is immediately followed by a digit. * tests/misc/sort-h-thousands-sep.sh: Cover the fix for this bug. Suggested by Pádraig Brady in http://bugs.gnu.org/24015
2016-07-18sort: make -h work with -k and blank used as thousands separatorKamil Dudka
* src/sort.c (traverse_raw_number): Allow to skip only one occurrence of thousands_sep to avoid finding the unit in the next column in case thousands_sep matches as blank and is used as column delimiter. * tests/misc/sort-h-thousands-sep.sh: Add regression test for this bug. * tests/local.mk: Reference the test. * NEWS: Mention the bug fix. Reported at https://bugzilla.redhat.com/1355780 Fixes http://bugs.gnu.org/24015
2016-07-18maint: sort.c: deduplicate code for traversing numbersKamil Dudka
* src/sort.c (traverse_raw_number): New function for traversing numbers. (find_unit_order): Use traverse_raw_number() instead of open-coding it. (debug_key): Likewise.
2016-07-08install: with -Z, set default SELinux context for created directoriesKamil Dudka
* doc/coreutils.texi (install invocation): Update -Z documentation. * src/install.c (make_ancestor): Set default security context before calling mkdir() if the -Z option is given. (process_dir): Call restorecon() on the destination directory if the -Z option is given. (usage): Update -Z documentation. * tests/install/install-Z-selinux.sh: A new test for 'install -Z -D' and 'install -Z -d' based on tests/mkdir/restorecon.sh. * tests/local.mk: Reference the test. * NEWS: Mention the improvement. Reported at https://bugzilla.redhat.com/1339135 Fixes http://bugs.gnu.org/23868
2016-07-06tests: avoid false failure on 32 bit in readdir() testPádraig Brady
* tests/rm/rm-readdir-fail.sh: Since we use the returned dirent from the readdir wrapper it must be the correct type and not just cast. Therefore setup so that we only have to define a wrapper for readdir(), which works appropriately on 32 and 64 bit. Issue reported by Bernhard Voelker, where rm was seen to invoke rmdir() on invalid file names.
2016-07-02tests: improve recent seq EPIPE testAssaf Gordon
Follow-up to commit c92585b1: improve epipe test script, with suggestions from Bernhard Voelker and Pádraig Brady. see: http://lists.gnu.org/archive/html/coreutils/2016-04/msg00067.html . * tests/misc/seq-epipe.sh: Avoid too many subshells, stricter validation of errors and output from seq, skip if trapping SIGPIPE is not supported.
2016-06-29stty: fix sane setting of susp to ^z on SolarisPádraig Brady
* src/stty.c: Disable setting of "swtch" to ^z as that conflicts with and disables using ^z as "susp". * NEWS: Mention the bug fix. Reported and tested by Rich Burridge at: http://bugs.gnu.org/23866
2016-06-26tests: verify that fts diagnoses readdir() failuresPeter Benie
* tests/rm/rm-readdir-fail.sh: A new test to simulate readdir() failing immediately or after returning a few entries, and verifying that rm does the appropriate thing. This was initially reported at: http://bugzilla.opensuse.org/show_bug.cgi?id=984910 where it was mentioned that readdir() may fail when an NFS server has a poor readdir cookie implementation.
2016-06-26all: update gnulib submodule and tests/init.sh to latestPádraig Brady
* gnulib: Update to latest. * NEWS: Specifically mention the fts readdir() fix and reindent to standard indentation. * tests/init.sh: Update from gnulib.
2016-06-25maint: simplify partial writes etc. in 'yes'Paul Eggert
* src/yes.c: Include full-write.h. (main): Use full_write, not write, to simplify handling of partial writes. Don't bother using stdio to output data; just use full_write with a buffer as large as needed. Reuse operand strings if possible, and if the buffer would otherwise be large.
2016-06-24yes: handle short writesPádraig Brady
* src/yes.c (main): Loop over the write buffer to handle the case where write may write less than requested. * NEWS: Mention the bug fix. Reported by Paul Eggert.
2016-06-24yes: fix copy and paste issue with previous commitPádraig Brady
* src/yes.c (main): Output 'y' not '-'. * tests/misc/yes.sh: Add a test for default output.
2016-06-23maint: work even if argc == INT_MAXPaul Eggert
GCC 7 warned about undefined behavior in this unlikely case. Problem reported by Jim Meyering in: http://bugs.gnu.org/23825 * src/md5sum.c (main): * src/paste.c (main): * src/yes.c (main): Avoid undefined behavior when argc == INT_MAX.
2016-06-01doc: clarify sort --key handling of default field separatorsPádraig Brady
* doc/coreutils.texi (sort invocation): Mention in the summary dicussion that --key is used to specify fields. Give a summary in the --key description, of the most common use case of specifying a field, and that by default those fields include the blank separators at the start of each field in the comparisons.
2016-05-31sort: modify 'leading spaces' debug warning scenariosAssaf Gordon
Print warning regardless of locale, avoid warning if key is zero width. Problem reported by Karl Berry in http://bugs.gnu.org/23665 . * src/sort.c: (key_warnings): change conditions for 'leading spaces' warning. * tests/misc/sort-debug-warn.sh: adjust tests accordingly.
2016-05-31tests: sort-debug-warn: add progress information linesAssaf Gordon
Easier troubleshooting of individual 'sort --debug' messages. Discussed in http://bugs.gnu.org/23665 . * tests/misc/sort-debug-warn.sh: add progress number before each sort invocation.
2016-05-15dircolors: output colors for any $TERM matching *color*Pádraig Brady
* src/dircolors.hin: Reduce the list by replacing all specific mentions of "color" with the pattern "*color*". This will also cater for other entries like "konsole-256color". Fixes http://bugs.gnu.org/23542
2016-05-14nl: reset numbering for each sectionKOBAYASHI Takashi
* NEWS: Mention the bug fix. * src/nl.c (proc_body, proc_footer): Reset numbering here too. * doc/coreutils.texi (nl invocation): Adjust for behavior change. * tests/misc/nl.sh: Add a test case.
2016-05-12stat,tail: add support for the SMB2 remote file systemPádraig Brady
* stc/stat.c (human_fstype): Add file system ID definition, and use "smb2" as the name. * NEWS (Improvements): Mention the change. Fixes http://bugs.gnu.org/23516
2016-05-04maint: avoid new warning from gcc (GCC) 7.0.0 20160503 (experimental)Jim Meyering
* src/id.c (main): When configured with --enable-gcc-warnings and using the very latest gcc built from git, building would fail with this: src/id.c:200:8: error: assuming signed overflow does not occur when \ simplifying conditional to constant [-Werror=strict-overflow] bool default_format = (just_user + just_group + just_group_list ^~~~~~~~~~~~~~ Rewrite to use bool-appropriate operators.
2016-04-26tests: avoid false failure when df lists no root file systemPádraig Brady
* tests/df/skip-duplicates.sh: Skip the test when there is no '/' entry listed by df, which was seen in certain chroot setups.
2016-04-24seq: detect and report I/O errors immediatelyAssaf Gordon
Ensure I/O errors are detected (and terminate seq), preventing seq from infloop (or running for long time with a large range) upon write errors or ignored SIGPIPE. Examples: seq 1 inf > /dev/full (seq_fast) seq 1.1 0.1 inf >/dev/full (print_numbers) * src/seq.c (io_error): A new function to diagnose appropriate stdio errors and exit the program with failure status. (seq_fast, print_numbers): Explicitly check for write errors and terminate the program with diagnostic. * tests/misc/seq-io-errors.sh: Test error detection with /dev/full. * tests/misc/seq-epipe.sh: Test error detection with broken pipes. * tests/local.mk: Add new tests. * NEWS: Mention the fix.
2016-04-22stat,tail: add support for Windows Subsystem for LinuxPádraig Brady
* src/stat.c (human_fstype): Add file system ID definition, and use "wslfs" as the name. * NEWS (Improvements): Mention the change. Fixes http://bugs.gnu.org/23273
2016-04-21yes: avoid redundant diagnostics on write errorPádraig Brady
* src/yes.c (main): For large inputs only write a single diagnostic for write errors. * tests/misc/yes.sh: Test when /dev/full is available.
2016-04-21sleep,timeout: support overflowing floating point valuesPádraig Brady
* src/sleep.c (main): Allow ERANGE since we allow "inf" values. * src/timeout.c (parse_duration): Likewise. * tests/misc/sleep.sh: New file. Tests for sleep(1). * tests/misc/timeout-parameters.sh: Add case for newly allowed $LDBL_MAX. Also use returns_ throughout the file. Also avoid small timeout values which might give false failures under load.
2016-04-21tests: avoid potential overflows with `expr`Pádraig Brady
* cfg.mk (sc_prohibit_expr_unsigned): expr uses intmax_t internally when GMP is not available, so flag any uses of unsigned limits. * tests/misc/timeout-parameters.sh: Remove the overflow related to UINT_MAX as it's handled by the following case. Change the following case from 99... to $TIME_T_OFLOW to be more expressive in what it's actually testing. Directly check that commands succeed, rather than inspecting $? afterwards. * tests/dd/skip-seek-past-dev.sh: Guard against large device sizes. * tests/id/setgid.sh: Protect: Guard against large group IDs. * tests/misc/cut-huge-range.sh: Tweak comment to avoid syntax check. It's tempting to simplify to just skip the test if expr fails, but SIZE_MAX > INTMAX_MAX is the common case.
2016-04-20tests: fix recent false failure due to a racePádraig Brady
* tests/cp/parent-perm-race.sh: This new race introduced in commit v8.25-5-g632eda5 is quite hard to hit, but is due to `ls > fifo` doing write()/close()/exit() once `cp` has open() the source fifo. Then the subsequent comparison of the destination file may fail due to the file being missing or empty. Previously `ls` generated output that was independent of `cp`. Now we must wait for `cp` to finish before inspecting the destination file that it wrote.
2016-04-18tests: let mkdir/p-v.sh fail when compare failsBernhard Voelker
* tests/mkdir/p-v.sh: Set fail=1 when compare fails: the latter only sets a non-Zero return code; evaluating that is up to the caller.
2016-04-14seq: do not allow NaN argumentsBernhard Voelker
* src/seq.c (isnan): Define macro. (scan_arg): Add check if the given argument is NaN, and exit with a proper error diagnostic in such a case. (usage): Document it. * tests/misc/seq.pl: Add tests. * doc/coreutils.texi (seq invocation): Document the change. * NEWS (Changes in behavior): Mention the change.
2016-04-14seq: do not allow 0 as increment valueBernhard Voelker
* src/seq.c (main): Exit with an error diagnostic when the given step value is Zero. (usage): Document it. * doc/coreutils.texi (seq invocation): Likewise. * tests/misc/seq.pl: Add tests. * NEWS (Changes in behavior): Mention the change. Reported by Маренков Евгений in: http://bugs.gnu.org/23110
2016-04-14stat,tail: add support for M1FSYigal Korman
* src/stat.c (human_fstype): Add file system ID definition. * NEWS (Improvements): Mention the change, moving the previously added "prl_fs" change note from "Changes in behavior" to here. Fixes http://bugs.gnu.org/23283
2016-03-31stat: report type for "prl_fs" file systemsPádraig Brady
* src/stat.c (human_fstype): Identify the parallels file system. Also tag as remote so that tail(1) doesn't use inotify, which fails to detect changes made outside a VM. Fixes http://bugs.gnu.org/23143
2016-03-17date ls pr: fix time zone abbrs on SysV platformsPaul Eggert
The problematic code computed a struct tm in one time zone, and then printed it or converted it to a string in another. To be portable the same time zone needs to be used for both operations. On GNU platforms this is not an issue, but incorrect output can be generated on System V style platforms like AIX where time zone abbreviations are available only in the 'tzname' global variable. Problem reported by Assaf Gordon in: http://bugs.gnu.org/23035 * NEWS: Document the bug. * src/date.c (show_date): * src/ls.c (long_time_expected_width, print_long_format): * src/pr.c (init_header): * src/stat.c (human_time): Use localtime_rz instead of localtime, so that the time zone information is consistent for both localtime and time-formatting functions like fprintftime and nstrftime. For 'stat' this change is mostly just a code cleanup but it also causes stat to also print nanoseconds when printing time stamps that are out of localtime range, as this is more consistent with what other programs do. For programs other than 'stat' this fixes bugs with time zone formats that use %Z. * src/du.c, src/pr.c (localtz): New static var. (main): Initialize it. * src/du.c (show_date): New time zone argument, so that localtime and fprintftime use the same time zone information. All callers changed. * tests/misc/time-style.sh: New file. * tests/local.mk (all_tests): Add it. * tests/misc/date.pl: Test alphabetic time zone abbreviations.
2016-03-15maint: remove gl/lib/reg*.c.diff; no longer neededJim Meyering
* gl/lib/regcomp.c.diff: Remove file, now that gnulib's regcomp.c compiles regex.c with -Wno-unused-parameter. * gl/lib/regex_internal.h.diff: Likewise. * gl/lib/regex_internal.c.diff: This file induced a change to ensure that the "Idx" type was unsigned and to remove a few "VAR < 0" comparisons. These days, it is probably fine to stay in sync with gnulib/glibc's copies of these files, so remove these patches, too. * gl/lib/regexec.c.diff: Likewise. Prompted by a report by Assaf Gordon and a suggestion from Paul Eggert.
2016-03-09build: update gnulib submodule to latestEric Blake
Mainly for: *bdb72bc6 set-permissions: fix compilation on Cygwin * bootstrap: Sync with gnulib. * gl/lib/regcomp.c.diff: Regenerate against latest gnulib.
2016-03-06tests: avoid false-failure of split/filter.sh on XFSJim Meyering
* tests/split/filter.sh: Use OFF_T_MAX-1 rather than OFF_T_MAX as the size of a test file, to avoid false failure on an XFS file system (or any file system permitting a file of size OFF_T_MAX). Reported as http://bugs.gnu.org/22931
2016-03-04test: Document that -a and -o are undesirableEric Blake
POSIX recommends avoiding -a and -o, for good reason. src/test.c (usage): Mention that inherent ambiguities exist with binary -a and -o. Problem reported by Martin Gebert in: http://bugs.gnu.org/22909
2016-02-23all: be less strict about usage if POSIX 2008Paul Eggert
sort, tail, and uniq now support traditional usage like 'sort +2' and 'tail +10' on systems conforming to POSIX 1003.1-2008 and later. * NEWS: Document this. * doc/coreutils.texi (Standards conformance, tail invocation) (sort invocation, uniq invocation, touch invocation): Document new behavior, or behavior's dependence on POSIX 1003.1-2001. * src/sort.c (struct keyfield.traditional_used): Rename from obsolete_used, since implementations are now allowed to support it. All uses changed. (main): Allow traditional usage if _POSIX2_VERSION is 200809. * src/tail.c (parse_obsolete_option): Distinguish between traditional usage (which POSIX 2008 and later allows) and obsolete (which it still does not). * src/uniq.c (strict_posix2): New function. (main): Allow traditional usage if _POSIX2_VERSION is 200809. * tests/misc/tail.pl: Test for new behavior.
2016-02-22doc: document sort -o F F dangerPaul Eggert
Problem reported by Yanyan Jiang 蒋炎岩 in: http://bugs.gnu.org/22769 * doc/coreutils.texi (sort invocation): Mention possibility of 'sort -o F F' data loss during crashes.
2016-02-16date: free timezone variable to avoid valgrind warningDaniel Lockyer
* src/date.c (main): Free TZ variable to pacify valgrind, guarded by IF_LINT.
2016-02-15split: adjust recent --number changesPádraig Brady
* src/split.c (lines_rr): Reinstate the conditional setting of the WROTE boolean, as otherwise split -n r/1 would consume all input when all --filter commands are stopped. There was a test in place to check for this, but it was incorrect as detailed below. (input_file_size): Immediately disallow --number with non seekable inputs, as such an invocation is not currently generally supported and will fail as the data overflows the internal buffer. * tests/split/l-chunk.sh: Adjust to again disallow -n /dev/zero. Also change all '&& fail=1' checks to use the 'returns_ 1' form. * tests/split/filter.sh: Change the no longer supported /dev/zero case to a regular $OFF_T_MAX file (supported on XFS for example). Also fix the timeout(1) commands so they're not subject to pipefail issues.
2016-02-15stty: fix translated --help so the gettext header is not printedGöran Uddeborg
* src/stty.c (usage): Remove an erroneous call to translate an empty string, added in commit v8.23-112-g564f84a, which results in the gettext header being printed for translated languages. * THANKS.in: Remove the now committer. * NEWS: Mention the bug fix.