summaryrefslogtreecommitdiff
path: root/src
AgeCommit message (Collapse)Author
2013-04-10csplit: add the --suppress-matched optionAssaf Gordon
With --suppress-matched, the lines that match the pattern will not be printed in the output files. I.E. the first line from the second and subsequent splits will be suppressed. * src/csplit.c: process_regexp(),process_line_count(): Don't output the matched lines. Since csplit includes "up to but not including" matched lines in each split, the first line (in the next group) is the matched line - so just skip it. main(): Handle new option. usage(): Mention new option. * doc/coreutils.texi (csplit invocation): Mention new option, examples. * tests/misc/csplit-suppress-matched.pl: New test script. * tests/local.mk: Reference the new test. * NEWS: Mention new feature.
2013-04-04tail: exit without reading input if would never outputPádraig Brady
* src/tail.c (main): If -n0 or -c0 were specified without -f, then no data would ever be output, so exit without reading input. * tests/tail-2/tail-n0f.sh: Augment the related test with this case.
2013-04-04shuf: exit without reading if would never outputPádraig Brady
* src/shuf.c (main): If -n0 specified then no data would ever be output, so exit without reading input. * tests/misc/shuf.sh: Augment the related test with this case.
2013-04-04ln: --relative: fix updating of existing symlinksRémy Lefevre
Don't dereference an existing symlink being replaced. I.E. generate the symlink relative to the symlink's containing dir, rather than to some arbitrary place it points to. * src/ln.c (convert_abs_rel): Don't consider the final component of the symlink name when canonicalizing, as we want to avoid dereferencing the final component. * tests/ln/relative.sh: Add a test case. * NEWS: Mention the fix. Resolves http://bugs.gnu.org/14116
2013-03-25shuf: use reservoir-sampling for large or unknown sized inputsAssaf Gordon
Reservoir sampling optimizes selecting K random lines from large or unknown-sized input: http://en.wikipedia.org/wiki/Reservoir_sampling Note this also avoids reading any input when -n0 is specified. * src/shuf.c (main): Use reservoir-sampling when the number of output lines is known, and the input size is large or unknown. (input_size): A new function to get the input size for regular files. (read_input_reservoir_sampling): New function to read lines from input, keeping only K lines in memory, replacing lines with decreasing prob. (write_permuted_output_reservoir): New function to output reservoir. * tests/misc/shuf-reservoir.sh: An expensive_ test using valgrind to exercise the reservoir-sampling code. * tests/local.mk: Reference new test. * NEWS: Mention the improvement.
2013-03-24stat,tail: improve support for efivarfs, exofs, f2fs and ubifsPádraig Brady
* src/stat.c (human_fstype): Add new file system ID definitions. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/14020
2013-03-24maint: improve make src/fs-magic-comparePádraig Brady
* README-release: fix the `make` command, and mention how to get the latest results without requring running a system with the latest kernel. * src/local.mk (src/fs-latest-magic.h): A new target to document how/where to place the latest magic header. (src/fs-kernel-magic): Adjust to include separately downloaded header if available. (src/fs-magic): Undefine MANPAGER as it may impact the ability to pipe the output of man(1). (fs-magic-compare): Don't echo the commands run as they're distracting from the output which needs to be examined.
2013-03-22doc: clarify the printable characters output by odPádraig Brady
* src/od.c (usage): Mention any printable character is output, Not just ASCII. * doc/coreutils.texi (od invocation): Further clarify that only single byte characters are output (due to the alignment requirement). Also mention the fact that 3 digit octal sequences are output for non printable characters without a corresponding C escape. Reported in http://bugs.gnu.org/13947
2013-03-22doc: clarify stat the meaning of --format="%t %T"Pádraig Brady
* src/stat.c (usage): Mention that the values are only defined for character and block special files. * doc/coreutils.texi (stat invocation): Likewise. Also mention st_rdev. Reported in http://bugs.gnu.org/13927
2013-03-04build: fix factor build failure on aarch64Torbjörn Granlund
* src/longlong.h (__aarch64__): Make add_ssaaaa and sub_ddmmss work. * NEWS: Mention the build fix. Reported at https://bugzilla.redhat.com/917735
2013-02-28uniq: add the --group optionAssaf Gordon
* src/uniq.c (usage): Summarize the new option, and adjust the --all-repeated option to be more consistent. (check_file): Merge the --group functionality into the core loop for the default uniq operation since it's very similar and can output lines immediately upon reading. (main): Handle the new --group option and make it mutually exclusive with other selection options. * tests/misc/uniq.pl: Add tests. * NEWS: Mention the new feature. * doc/coreutils.texi (uniq invocation): Describe --group.
2013-02-28doc: move some info from all --help messages, onlinePádraig Brady
* src/system.h (emit_ancillary_info): Link to the bug report email addresses and general help URLs online rather than specifying directly. This give us greater scope to present better info like describing the difference between bug-coreutils@gnu.org and coreutils@gnu.org etc. * tests/misc/help-version.sh: Remove the check for bug-coreutils@gnu.org * tests/local.mk: Remove the no longer needed PACKAGE_BUGREPORT.
2013-02-28dircolors: add a new entry to colorize 'arc' filesJavier López
* src/dircolors.hin: Add an entry for arc. Suggested in: https://bugs.launchpad.net/ubuntu/+source/coreutils/+bug/1088131
2013-02-28join: Add the -z, --zero-terminated optionAssaf Gordon
* NEWS: Mention join's new option: --zero-terminated (-z). * src/join.c: Add new option, --zero-terminated (-z), to make join use the NUL byte as separator/delimiter rather than newline. (get_line): Use readlinebuffer_delim in place of readlinebuffer. (main): Handle the new option. (usage): Describe new option the same way sort does. * doc/coreutils.texi (join invocation): Describe the new option. * tests/misc/join.pl: add tests for -z option.
2013-02-28dircolors: add new entries to colorized archive formatsOndřej Vašík
* src/dircolors.hin: Add .cab, .alz, .lzo, .lrz, .t7z, .tzo, .lha to colorized archives. Suggested by Ville Skyttä in https://bugzilla.redhat.com/868510
2013-02-22install: cleanup properly if the strip program failed for any reasonOndrej Oprala
* src/install.c (strip): Indicate failure with a return code instead of terminating the program. (install_file_in_file): Handle strip's return code and unlink the created file if necessary. * tests/install/strip-program.sh: Add a test to cover the changes. * NEWS (Bug fixes): Mention the fix. Reported by John Reiser in http://bugzilla.redhat.com/632444.
2013-02-20copy: ensure the correct root ID is checked on all platformsJoachim Schmitz
* src/copy.c (copy_reg): Check ROOT_UID rather than 0, which is significant on HP-NonStop.
2013-02-20maint: cleanup up various uses of __attribute__Pádraig Brady
* src/cfg.mk (sc_prohibit-gl-attributes): Disallow the __attribute() form without trailing underscores as that is not elided where required. Also ensure we use gnulib macros rather than defining our own. * src/system.h: Remove gnulib provided macros. * src/chown-core.c: Likewise. * src/chroot.c: Likewise. * src/copy.c: Likewise. * src/csplit.c: Likewise. * src/dd.c: Likewise. * src/expr.c: Likewise. * src/extent-scan.c: Likewise. * src/factor.c: Likewise. * src/ls.c: Likewise. * src/od.c: Likewise. * src/paste.c: Likewise. * src/ptx.c: Likewise. * src/sort.c: Likewise. * src/stat.c: Likewise. * src/stty.c: Likewise. * src/system.h: Likewise. * src/tac.c: Likewise. * src/test.c: Likewise. * src/tsort.c: Likewise.
2013-02-20build: fix numfmt build error on compilers without __attributeJoachim Schmitz
* src/numfmt.c (): Use the more standard _GL_ATTRIBUTE_PURE which is elided where required. Reported in http://bugs.gnu.org/10305
2013-02-14build: avoid link failure in devmsg() on older linkersPádraig Brady
On linkers that don't remove unused functions, there will be a reference to a missing dev_debug symbol in the devmsg() function. So for now ... * src/system.h: ... move devmsg() from here ... * src/numfmt.c: ... to here, and document future cleanup. * src/factor.c: Likewise.
2013-02-13numfmt: fix strtol() return code handlingAssaf Gordon
src/numfmt.c (parse_format_string): On some systems, strtol() returns EINVAL if no conversion was performed. So only handle ERANGE here, and handle other format errors directly.
2013-02-11doc: improve the numfmt man page formatPádraig Brady
* src/numfmt.c (usage): Keep a single space between the "K = 1000", so that it's not displayed on a separate line. Also place ',' between each unit entry to improve readability.
2013-02-10doc: standardize helptext of numfmt and slice into single optionsBenno Schulenberg
* src/numfmt.c (usage): Correct synopsis and make command description clearer. Start option descriptions with lowercase letter; use semicolon instead of period where needed; indent continuation lines; gettextize single options for ease of translation and maintenance; sort options alphabetically. * doc/coreutils.texi (numfmt invocation): Sort numfmt options alphabetically. Enforce double-blank-after-period style. This addresses http://bugs.gnu.org/13681. Improved-by: Bernhard Voelker
2013-02-10maint: consolidate developer debug messagesPádraig Brady
Both factor and numfmt recently introduced debug messages for developers, enabled by --verbose and ---devdebug respectively. There were a few issues though: 1. They used different mechanisms to enable these messages. 2. factor used --verbose which might be needed for something else 3. They used different methods to output the messages, and numfmt used error() which added an unwanted newline 4. numfmt marked all these messages for translation and factor marked a couple. We really don't need these translated. So we fix the above issues here while renaming the enabling option for both commands to ---debug (still undocumented). * src/factor.c (verbose): Rename to dev_debug and change from int to bool as it's just a toggle flag. (long_options): Rename --verbose to ---debug. * src/system.h (devmsg): A new inline function to output a message if enabled by a global dev_debug variable in the compilation unit. * src/numfmt.c: Use devmsg() rather than error(). Also remove the translation tags from these messages. Also change debug flag to bool from int. * tests/misc/numfmt.pl: Adjust for the ---devdebug to ---debug change. * cfg.mk (sc_marked_devdiagnostics): Add a syntax check to ensure translations are not added to devmsg calls. Reported by Göran Uddeborg in http://bugs.gnu.org/13665
2013-02-06maint: improve error messages upon failed read, write, access, closeBenno Schulenberg
Note we use "failed to {access,close}" for those single operations, and "error {read,writ}ing" for those partial operation failures. * src/copy.c: Improve error messages for failing read, write and close. * src/cp.c: Improve error messages for failing access. * src/dd.c: Improve error messages for failing read, write and open. * src/head.c: Improve error message for failing close. * src/install.c: Improve error messages for failing access. * src/ln.c: Likewise. * src/mv.c: Likewise. * src/touch.c: Improve error message for failing close. * src/truncate.c: Likewise.
2013-02-05doc: fix a numfmt help section typoAssaf Gordon
* src/numfmt.c (usage): Change erroneous "G" to "M".
2013-02-05stty: add support for DTR/DSR hardware control flowOndřej Vašík
Originally requested in Red Hat bugzilla #445213. * src/stty.c (mode_info): Add support for DTR/DSR hardware flow control, if available. * doc/coreutils.texi: Document it. * tests/misc/stty.sh: Add it to the list of serial options to avoid. * NEWS: Mention the improvement.
2013-02-05numfmt: correct a printf formatPádraig Brady
Prompted by the continuous integration build failure at: http://hydra.nixos.org/build/4010493 * src/numfmt.c (parse_format_string): Correct both sign and size of a printf format, which only gives a warning on 32 bit builds.
2013-02-04numfmt: a new command to format numbersAssaf Gordon
* AUTHORS: Add my name. * NEWS: Mention the new program. * README: Reference the new program. * src/numfmt.c: New file. * src/.gitignore: Ignore the new binary. * build-aux/gen-lists-of-programs.sh: Update. * scripts/git-hooks/commit-msg: Allow numfmt: commit prefix. * po/POTFILES.in: Add new c file. * tests/misc/numfmt.pl: A new test file giving >93% coverage. * tests/local.mk: Reference the new test. * man/.gitignore: Ignore the new man page. * man/local.mk: Reference the new man page. * man/numfmt.x: A new template. * doc/coreutils.texi: Document the new command.
2013-02-04cut: fix a segfault with disjoint open ended rangesPádraig Brady
Fixes the issue introduced in unreleased commit v8.20-60-gec48bea. * src/cut.c (set_fields): Don't access the bit array if we've an open ended range that's outside any finite range. * tests/misc/cut.pl: Add tests for this case. Reported by Marcel Böhme in http://bugs.gnu.org/13627
2013-01-28df: do not treat rootfs speciallyBernhard Voelker
Like any other pseudo file system, df should show rootfs only when the -a option is specified, i.e. specifying -trootfs alone is not sufficient. As the rootfs entry is now elided by the general deduplication in filter_mount_list (commit v8.20-103-gbb116d3), all other references to rootfs can be removed again. * src/df.c (show_rootfs): Remove global variable. (ROOTFS): Remove constant. (filter_mount_list): Remove case to handle rootfs specially. (main): In the case for handling the -t option, remove setting of the show_rootfs variable. * tests/df/skip-rootfs.sh: Adapt the test case "df -t rootfs": the rootfs file system must not be printed (because no -a). * doc/coreutils.texi (df invocation): Correct the documentation about eliding mount entries: it is not the first occurrence of the the device which wins, but now rather the entry with the shortest mount point name. Also adapt the description about eliding pseudo file system types like rootfs. * NEWS (Changes in behavior): Adapt entry.
2013-01-27df: prefer fullpath entries when deduplicatingOndrej Oprala
* src/df.c (struct devlist): Add a new element for storing pointers to mount_entry structures. (devlist_head, dev_examined): Remove. (filter_mount_list): Add new function to filter out the rootfs entry (unless -trootfs is specified), and duplicities. The function favors entries with a '/' character in me_devname or those with the shortest me_mountdir string, if multiple entries fulfill the first condition. Use struct devlist to build up a list of entries already known, and finally rebuild the global mount_list. (get_all_entries): Call the above new function unless the -a option is specified. (get_dev): Remove the code for skipping rootfs and duplicities. * tests/df/skip-duplicates.sh: Add test cases. Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
2013-01-26timeout: ensure a blocked SIGALRM from the parent is unblockedStephan Krempel
* src/timeout.c (unblock_signal): A new function to unblock a specified signal, or warn if not possible. (set_timeout): Ensure SIGALRM is unblocked before we setup the timer. * tests/misc/timeout-blocked.pl: A new test for the issue. * tests/local.mk: Reference the new test. * NEWS: Mention the fix. Fixes: http://bugs.gnu.org/13535
2013-01-26seq: fix to always honor the step valuePádraig Brady
* src/seq.c (main): With 3 positive integer args we were checking the end value was == "1", rather than the step value. * tests/misc/seq.pl: Add tests for this case. Reported by Marcel Böhme in http://bugs.gnu.org/13525
2013-01-26seq: fix misaligment with -w when no precision for start valuePádraig Brady
* src/seq.c (get_default_format): Also account for the case where '.' is auto added to the start value, which is significant when the number sequence narrows. * tests/misc/seq.pl: Add two new tests for the failing cases. * NEWS: Mention the fix. Fixes http://bugs.gnu.org/13394
2013-01-26cut: fix -f to work with the -d$'\n' edge casePádraig Brady
* src/cut.c (cut_fields): Handle the edge case where '\n' is the delimiter, which could be used for example to suppress the last line if it doesn't contain a '\n'. * test/misc/cut.pl: Add tests for this edge case.
2013-01-26cut: with -f, process each line independentlyPádraig Brady
Previously line N+1 was inspected before line N was fully output, which causes output ordering issues at the terminal or delays from intermittent sources like tail -f. * src/cut.c (cut_fields): Adjust so that we record the previous output character so we can use that info to determine wether to output a '\n' or not. * tests/misc/cut.pl: Add tests to ensure existing functionality isn't broken. * NEWS: Mention the fix. Fixes bug http://bugs.gnu.org/13498
2013-01-23doc: fix order of du options in usage and texinfo manualBernhard Voelker
* src/du.c (usage): Bring options into alphabetical order. * doc/coreutils.texi (du invocation): Likewise. Furthermore, use the @itemx macro for the long options --max-depth and --threshold instead of @item.
2013-01-23maint: define usage note about mandatory args centrallyBernhard Voelker
Each program with at least one long option which is marked as 'required_argument' and which has also a short option for that option, should print a note about mandatory arguments. Define that well-known note centrally and use it rather than literal printf/fputs, and add it where it was missing. * src/system.h (emit_mandatory_arg_note): Add new function. * src/cp.c (usage): Use it rather than literal printf/fputs. * src/csplit.c, src/cut.c, src/date.c, src/df.c, src/du.c: * src/expand.c, src/fmt.c, src/fold.c, src/head.c, src/install.c: * src/kill.c, src/ln.c, src/ls.c, src/mkdir.c, src/mkfifo.c: * src/mknod.c, src/mv.c, src/nl.c, src/od.c, src/paste.c: * src/pr.c, src/ptx.c, src/shred.c, src/shuf.c, src/sort.c: * src/split.c, src/stdbuf.c, src/tac.c, src/tail.c, src/timeout.c: * src/touch.c, src/truncate.c, src/unexpand.c, src/uniq.c: Likewise. * src/base64.c (usage): Add call of the above new function because at least one long option has a required argument. * src/basename.c, src/chcon.c, src/date.c, src/env.c: * src/nice.c, src/runcon.c, src/seq.c, src/stat.c, src/stty.c: Likewise.
2013-01-21du: add -t SIZE, --threshold=SIZE optionJakob Truelsen
* src/du.c (opt_threshold): Add variable to hold the value of the --threshold option specified by the user. (long_options): Add a required_argument entry for the new --threshold option. (usage): Add --threshold option. (process_file): Elide printing the entry if its size does not meet the value specified by the --threshold option. (main): In the argument parsing loop, add a case for the new -t option. Convert the given argument by permitting the well-known suffixes for megabyte, gigabytes, etc. Handle the special case "-0": give an error as this value is not permitted. * doc/coreutils.texi (du invocation): Add documentation for the above new option. * tests/du/threshold.sh: Add new test to exercise the new option. * tests/local.mk (all_tests): Mention the above test. Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
2013-01-12uptime: gettextize an overlooked string, and normalize anotherBenno Schulenberg
* src/uptime.c: Add calls to gettext() and select_plural().
2013-01-10doc: make a --help text fragment identical to three othersBenno Schulenberg
* src/ln.c (usage): Move a newline to the next text fragment, so the preceding fragment about backup methods becomes the same as the ones for cp, mv, and install. A bit easier for translators.
2013-01-07factor: apply a more general fix to enable correct assemblyPádraig Brady
In addition to the previous 64 bit guards we've placed in longlong.h there are additional _LP64 guards required for mips with -mcpu >= 3, to avoid a build failure (http://bugs.gnu.org/13353) and on sparc with -mcpu >= v9 in 32 bit mode where for example, `factor 2123123123123123123123` would go into an infinite loop. Since factor.c currently operates on uintmax_t, we restrict the use of the assembly in longlong.h to when 'long' has the same width, to provide a more general guard for this code. * src/factor.c: Restrict the use of longlong.h assembly code, to when the width of intmax_t == long. * src/longlong.h: Remove the previous _LP64 guards to avoid divergence from GMP's longlong.h * NEWS: Adjust the info on build and runtime fixes.
2013-01-01maint: update all copyright year number rangesJim Meyering
Run "make update-copyright", but then also run this, perl -pi -e 's/2\d\d\d-//' tests/sample-test to make that one script use the single most recent year number.
2012-12-27doc: improve od --help and man pagePádraig Brady
* src/od.c: Redorder the information output by --help to ease interpretation and so that appropriate sections are generated by help2man. * doc/coreutils.texi (od invocation): Fix an incorrect reference to @var{n}, which should be @var{bytes}. * man/od.x: Add an "Examples" section, and move the default od format to there, and add a commonly required format to generate hexdumps. Reported by Akim Demaille in http://bugs.gnu.org/13280.
2012-12-21factor: disable x86_64 assembly code for x32 buildsMike Frysinger
The current x86_64 asm code does not work for x32 (__ILP32__) ABIs, so disable it. Note simply deleting the q suffix is not enough. * src/longlong.h: Restrict x86_64 assembly to _LP64 targets, which is consistent with other checks in longlong.h and avoids this code on x32. * NEWS: Mention the build fix.
2012-12-21dd: fix a printf format mismatch in an error messagePádraig Brady
* src/dd.c (dd_copy): To print an off_t portably we need to use PRIdMAX and cast to intmax_t, otherwise there could be a mismatch between say a 32 bit off_t and uintmax_t. This was flagged by -Wformat on a 64 bit host when compiling with CFLAGS=-m32.
2012-12-21seq: fix newline output when -s specifiedPádraig Brady
This regression was introduced in commit v8.19-132-g3786fb6. * src/seq.c (seq_fast): Don't use puts() to output the first number, and instead insert it into the buffer as for other numbers. Also output the terminator unconditionally. * tests/misc/seq.pl: Add some basic tests for the -s option. * NEWS: Mention the fix. * THANKS.in: Reported by Philipp Gortan.
2012-12-19build: fix cygwin build issuesZartaj Majeed
* doc/local.mk (doc/constants.texi): Ensure the doc directory is present which is needed when doing a non source dir build, when the doc/constants.texi target is built before other doc targets. * src/local.mk: Add $(EXEEXT) to the make-prime-list calls.
2012-12-17readlink: support multiple command line argumentsPádraig Brady
This allows efficient processing of multiple files, while also increasing compatibility with BSD's readlink(1). We also add the -z, --zero option to delimit output items with the NUL character which disambiguates output in the presence of '\n' characters. * src/readlink.c (usage): Add the --zero description, and also adjust the description of --no-newline accordingly. (main): Handle the -z option and iterate over multiple arguments. Also as in commit v8.15-24-g9d46b25 we use fputs() and putchar() rather than printf() for performance reasons. * doc/coreutils.texi (readlink invocation): Document the new --zero option, adjust the --no-newline description, and tweak the general info to indicate multiple files are supported. * tests/readlink/multi.sh: A new test for the new functionality. * tests/local.mk: Reference the new test. * man/readlink.x: Adjust the summary and also reference realpath. * NEWS: Mention the improvement. * THANKS.in: Suggested by Aaron Davies.