summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-11-07maint: refactor printing of backup suffix --helpPádraig Brady
* src/system.h (emit_backup_suffix_note): A new function to output the backup suffix info. The strings are unchanged, so translations are not impacted. * src/cp.c (usage): Use the new function. * src/ln.c (usage): Likewise. * src/mv.c (usage): Likewise. * src/install.c (usage): Likewise.
2016-11-07maint: simplify handling of backup --suffix in various toolsRishabh Dave
* src/cp.c (main): Avoid the getenv("SIMPLE_BACKUP_SUFFIX") call, which is now done if needed in the gnulib backupfile module. Also avoid the redundant strdup, as we don't modify this suffix. * src/install.c (main): Likewise. * src/ln.c (main): Likewise. * src/mv.c (main): Likewise. Fixes http://bugs.gnu.org/23153
2016-11-07date: add %q to output the quarter of the yearPádraig Brady
* doc/coreutils.texi (date invocation): Document %q. * src/date.c (usage): Likewise. * tests/misc/date.pl: Add a test case. * cfg.mk (sc_strftime_check): Adjust to allow %q. * NEWS: Mention the new feature.
2016-11-07all: update gnulib submodule to latestPádraig Brady
Incorporating these coreutils specific changes: backupfile: initialize default suffix within the implementation strftime,strptime: support %q to represent the quarter Also sync these copies with gnulib: * bootstrap: Now supports AIX. * gnulib: Update to the latest. * tests/init.sh: dash(1) is now disabled.
2016-11-05doc: clarify in texinfo that cut doesn't reorder fieldsPádraig Brady
* doc/coreutils.texi (cut invocation): Clarify the more sophisticated field processing supported by awk(1). Fixes http://bugs.gnu.org/24881
2016-11-05stat: make --format=%N honor the QUOTING_STYLE env varPádraig Brady
* doc/coreutils.texi (stat invocation): Describe the QUOTING_STYLE values now supported. * src/stat.c (getenv_quoting_style): A new function called from main, that sets the default quoting style for quotearg. (main): Call getenv_quoting_style() when %N specified. * tests/misc/stat-fmt.sh: Add a test case. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/23422
2016-11-05doc: improve the --help description of ls -NPádraig Brady
* src/ls.c (usage): The existing description was inaccurate as -N does not directly impact whether control characters are displayed or not.
2016-11-04dd: warn about counts specified with confusing 0x prefixPádraig Brady
* src/dd.c (parse_integer): Suggest to use "00x" instead of "0x", which is significant for the "count", "seek", and "skip" operands. * tests/dd/misc.sh: Add a test case. Fixes http://bugs.gnu.org/24874
2016-10-26md5sum,sha*sum: fix --ignore-missing with checksums starting with 00Pádraig Brady
* NEWS: Mention the fix. * src/md5sum.c (digest_file): Add a new MISSING parameter to return whether the file was missing, separately from the digest. * tests/misc/md5sum.pl: Add a test case. Fixes http://bugs.gnu.org/24795
2016-10-21doc: fix typo in stdbuf man pageBishop Bettini
* man/stdbuf.x: Correct spelling of immediately. Fixes http://bugs.gnu.org/24763
2016-10-16maint: we use die; remove now-unnecessary uses of abortJim Meyering
* src/expr.c (integer_overflow): Remove an abort-after-die. * src/paste.c (write_error): Likewise. * src/sort.c (badfieldspec): Likewise. * src/tr.c (string2_extend): Likewise. Also remove a few break statements, each after an abort.
2016-10-16all: use die() rather than error(EXIT_FAILURE)Pádraig Brady
die() has the advantage of being apparent to the compiler that it doesn't return, which will avoid warnings in some cases, and possibly generate better code. * cfg.mk (sc_die_EXIT_FAILURE): A new syntax check rule to catch any new uses of error (CONSTANT, ...);
2016-10-15build: also distribute new file, src/die.hJim Meyering
* src/local.mk (noinst_HEADERS): Add die.h.
2016-10-15build: add die.h; avoid new warnings from GCC 7Jim Meyering
* src/die.h (die): New file/function from grep. Note: we expect this file to migrate to gnulib. * src/csplit.c: Include die.h. (check_format_conv_type): Use die in place of error-nonzero;break; * src/install.c (strip): Likewise. * src/nl.c (proc_text): Likewise. This also suppresses a new warning from GCC 7's -Werror=strict-overflow. * src/tail.c (parse_options): Likewise. * src/basename.c (main): Adjust "fall through" comment so that GCC 7's -Wimplicit-fallthrough honors it. * src/cp.c (main): Add a "fall through" comment. * src/ls.c (gobble_file): Likewise. (get_funky_string): Adjust a "fall through" comment so it is recognized. * cfg.mk (exclude_file_name_regexp--sc_system_h_headers): Add die.h to this list of exempt src/*.h files.
2016-10-15maint: pr: avoid new GCC 7 warningJim Meyering
* src/pr.c (main): Avoid this warning from GCC 7: src/pr.c:1119:6: error: assuming signed overflow does not occur when \ simplifying conditional to constant [-Werror=strict-overflow] if (n_files == 0)
2016-10-15gnulib: update to latest and adapt printf-quote.sh testJim Meyering
* .gitignore: Add /lib/limits.h. * tests/misc/printf-quote.sh: Reflect that a single quote is now rendered as "'", rather than as ''\'''.
2016-10-04rm: disallow --n alias for --no-preserve-rootPádraig Brady
* src/rm.c (main): Ensure the full --no-preserve-root option is specified, rather than allowing --n etc. * tests/rm/r-root.sh: Add a test case. * NEWS: Mention the change in behavior. Improved by Jim Meyering. Fixes http://bugs.gnu.org/24604
2016-09-28tail: -F now always processes initially untailable filesPádraig Brady
which was not the case when inotify was not available. * src/tail.c (any_live_files): Simplify, since the IGNORE flag is now only set when a file should be ignored indefinitely. (recheck): Only output the "giving up on name" message when that's actually the case. Only set the IGNORE flag when ignoring a file indefinitely. (tail_file): Likewise. * tests/tail-2/retry.sh: Add a test case. Also run all existing test cases with and without inotify. NEWS: Mention the fix. THANKS.in: Add the reporter. Fixes http://bugs.gnu.org/24495 which was detected using Symbolic Execution techniques developed in the course of the SYMBIOSYS research project at COMSYS, RWTH Aachen University.
2016-09-22who: avoid new warning from upcoming gcc-7Jim Meyering
* src/who.c (idle_string): This function would fail to compile with -Werror and today's built-from-git gcc due to this warning: src/who.c: In function 'print_user': src/who.c:201:36: error: may write format character ':' at offset 4 \ past the end of the destination [-Werror=format-length=] sprintf (idle_hhmm, "%02d:%02d", ^~~~~ The fix is to use an assertion to inform gcc of the existing invariant that guarantees the number of hours is less than 24.
2016-09-19ls: fix %%b format and precompute morePaul Eggert
The old code mishandled --time-spec='+%%b', as it misinterpreted the '%b' as being the month abbreviation. Also, it mishandled the extremely unlikely case of a month abbreviation containing '%'. The performance part of this patch sped up 'ls' by about 1% on my little benchmark of 'ls -lR' on the source directory in the en_US.UTF-8 locale (Fedora 24 x86-64). * NEWS: Document the bug fix. * src/ls.c (first_percent_b, abformat_init): New static functions. (ABFORMAT_SIZE): New constant. (use_abformat): New static var. (abmon, required_mon_width): Remove these static vars. (abmon_init): Now accepts a pointer to abmon, and returns a boolean. All callers changed. Reject month abbrs containing '%', as these would mess up strftime. Simplify mbsalign result checking, since (size_t) -1 exceeds ABFORMAT_SIZE. (abformat_init, align_nstrftime): Precompute all 24 formats at startup, rather than computing a format for each time stamp. (decode_switches): Call abformat_init instead of abmon_init. (align_nstrftime): Accept recentness bool instead of format. All callers changed. * tests/misc/time-style.sh: Test for format with '%%b'.
2016-09-11pinky,who: remove redeclarations of ttynameGeorge Burgess IV
Given that `ttyname` is already conditionally declared in src/system.h, other declarations are redundant and problematic for example in ChromeOS which has a new FORTIFY implementation that, as an artifact of how it's implemented, causes the compiler to complain if certain standard library functions are redeclared without special compiler-specific attributes. * src/pinky.c: Remove declaration (which was unused anyway). * src/who.c: Remove declaration. * src/system.h (getlogin, getuid, geteuid, getgrgid, getpwuid, ttyname): Add the parameter type to the declarations to avoid warnings when these backup declarations are used.
2016-09-09gnulib: update to latest, for getprogname fixesJim Meyering
Compiling in gnulib-tests/ would fail on some platforms due to a missing lib/assert.h. Reported by Assaf Gordon in https://lists.gnu.org/archive/html/coreutils/2016-09/msg00016.html
2016-09-09cp: use FICLONE instead of BTRFS_IOC_CLONEPaul Eggert
This doesn't affect the generated code on my system; it's merely a cleaner way to use the recently-introduced Linux-specific API. * m4/jm-macros.m4 (gl_CHECK_ALL_HEADERS): Check for linux/fs.h. * src/copy.c: Include <linux.fs.h> if available. (FICLONE) [__linux__]: Define if not already defined. (clone_file): Use FICLONE instead of the older BTRFS_IOC_CLONE, as this ioctl is no longer btrfs-specific.
2016-09-08date: add '--debug' optionAssaf Gordon
Usage example: date --debug -d 'now + 3 days' Print parsing and debugging information to stderr when using date's -d/--date option. See: http://lists.gnu.org/archive/html/coreutils/2016-01/msg00076.html * src/date.c (main): Add '--debug' option, enable debugging in gnulib's parse-datetime.y module. * tests/misc/date.pl: Repeat tests with '--debug' enable, ensure no regression. * tests/misc/date-debug.sh: Test output of '--debug' option. * tests/local.mk: Add above test. * NEWS: Mention new option. * doc/coreutils.texi: Likewise.
2016-09-07sort: port to strict C + valgrindPaul Eggert
* bootstrap.conf (gnulib_modules): Add flexmember. * src/sort.c: Include flexmember.h. (struct tempnode): Make the last member flexible. (create_temp_file): Port to strict C11/C99 rules for allocation alignment with flexible array members.
2016-09-07build: update gnulib submodule to latestPaul Eggert
2016-09-07factor: reinstate immediate output with interactive usePádraig Brady
* src/factor.c (lbuf_putc): Only buffer more than a line when not using the tool interactively. * NEWS: Mention the bug fix. Fixes http://pad.lv/1620139
2016-09-07ls: allow interruption when reading slow directoriesKamil Dudka
Postpone installation of signal handlers until they're needed. That is right before the first escape sequence is printed. * src/ls.c (signal_setup): A new function refactored from main() to set and restore signal handlers. (main): Move signal handler setup to put_indicator() so that the default signal handling is untouched as long as possible. Adjusted condition for restoring signal handlers to reflect the change. (put_indicator): Install signal handlers if called for the very first time. It uses the same code that was in main() prior to this commit. * NEWS: Mention the improvement. See https://bugzilla.redhat.com/1365933 Fixes http://bugs.gnu.org/24232
2016-09-01doc: fix typo in date examplePádraig Brady
* doc/coreutils.texi (date invocation): Add a missing quotation mark. Fixes http://bugs.gnu.org/24349
2016-08-31dircolors: recognize .zst and .tzst suffixesJim Meyering
* src/dircolors.hin: Add .zst and .tzst suffixes for the Zstandard/zstd compression tools. See http://zStd.net and https://code.facebook.com/posts/1658392934479273/
2016-08-30maint: tr: tweak/make-consistent a pair of loop indicesJim Meyering
* src/tr.c (unquote): Use indices of type "unsigned int", rather than a mix or "size_t" and "int", presuming that no command-line- specified string will have length longer than UINT_MAX.
2016-08-30tr: move decls "down"Jim Meyering
2016-08-29ptx: avoid new warning/error from upcoming gcc-7.xJim Meyering
* src/ptx.c (fix_output_parameters): Switch to an unsigned type that matches the OCCURS.file_index type. This avoids the following error from gcc-7.0.0 20160829 (experimental): src/ptx.c:1220:14: error: assuming signed overflow does not occur \ when simplifying conditional to constant [-Werror=strict-overflow] if (file_index > 0)
2016-08-18cp: with --parents --no-preserve=mode don't copy dir permsPádraig Brady
* src/cp.c (make_dir_parents_private): Use default permissions for created directories when --no-preserve=mode is specified. * tests/cp/cp-parents.sh: Add a test case. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/24251
2016-08-18doc: fix ambiguous multiplier info in dd man pagePádraig Brady
* src/dd.c (usage): Add a comma which is significant for the rewrapping done in man pages.
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