summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2013-07-07maint: avoid a valgrind memory leak warning from uptimeAnton Ovchinnikov
* src/uptime.c (uptime): Free utmp_buf returned from read_utmp, to avoid a "definitely lost" warning from valgrind.
2013-07-06build: update gnulib submodule to latestPaul Eggert
2013-07-05tests: fix "shuf unreadable" test to work when run as rootPádraig Brady
* tests/misc/shuf.sh: Restrict the test to the significant case where we can't in fact read the "unreadable" file.
2013-07-02stat: ensure --context emits an "unrecognized option" diagnosticPádraig Brady
* src/stat.c (long_options): Remove the "context" option as it's no longer referenced since commit v8.5-65-g13f3237
2013-07-02mkdir,mkfifo,mknod: give scontext-related variable a better scopeBernhard Voelker
* src/mkdir.c (main): Move the variable ret and issuing the error message into the body of the scontext-related if-block. * src/mkfifo.c (main): Likewise. * src/mknod.c (main): Likewise.
2013-07-02maint: refactor SMACK interface to a separate modulePádraig Brady
Consolidate all smack routines and checks in a module. We replace and wrap the most commonly used smack routines, which allows removing ifdefs throughout the code. * gl/lib/smack.h: A new header containing the implementation of the wrapped and replacement routines. Note the is_smack_enabled() routine should be optimized out at compile time when compiled on a system without libsmack. * gl/modules/smack: Describe the new module and move the configure time code here from ... * m4/jm-macros.m4: ... here. * bootstrap.conf: Reference the new module. * src/id.c: Use the routines without ifdefs where possible. * src/ls.c: Likewise. * src/mkdir.c: Likewise. * src/mkfifo.c: Likewise. * src/mknod.c: Likewise.
2013-07-02id: don't show SMACK errors unless -Z is specifiedPádraig Brady
* src/id.c (main): Be consistent with the SELinux case, and only show errors in getting the security context when -Z is specified.
2013-07-01mkdir,mkfifo,mknod: with -Z, create SMACK security contextJarkko Sakkinen
Enable creation of SMACK security context with -Z command-line switch if SMACK is enabled. * mkdir.c (main): Set process security context to given SMACK label. * mkfifo.c (main): Likewise. * mknod.c (main): Likewise. * src/local.mk: link mk{dir, fifo, nod} with libsmack. * NEWS: Mention the new feature.
2013-06-27doc: fix details on the interaction of df with device nodesD. Hugh Redelmeier
* man/df.x: Don't say that a dev node is always on the root file system. * doc/coreutils.texi (df invocation): Likewise. Also state that the device node to mounted file system interpretation is only done when passed absolute paths to device nodes.
2013-06-24ls: with -Z, show SMACK security contextJarkko Sakkinen
Enable showing of file SMACK security with '-Z' command-line switch if SMACK is enabled. Showing SMACK context of a file does not strictly require SMACK to be enabled but this required to make choice whether to show SELinux or SMACK security context. * src/ls.c (getfilecon_cache): Retrieve SMACK context if available. (gobble_file): Handle SMACK context similarly to SELinux context. * src/local.mk: Link lsl with libsmack. * NEWS: Mention the new feature. * .mailmap: Merge the Author's 2 email addresses.
2013-06-22stdbuf: make it mandatory to specify a buffering optionPádraig Brady
This is consistent with the documented interface and avoids any ambiguity in a user thinking that stdbuf without options might reset to a "standard" buffering setup. * src/stdbuf.c (set_libstdbuf_options): Indicate with the return value whether any env variables were actually set. (main): Fail unless some env variables were set. * tests/misc/stdbuf.sh: Ensure this constraint is enforced. * NEWS: Mention the small change in behavior.
2013-06-22doc: clarify that truncate --size represents bytes by defaultPádraig Brady
* src/truncate.c (usage): Mention that --size is in bytes which is by far the most common usage. * doc/coreutils.texi (truncate invocation): Likewise. Also cross reference the --io-blocks option. Reported in http://bugs.gnu.org/14686
2013-06-20id: adjust/restrict smack support to newer versions of libsmackJarkko Sakkinen
There was slight change to libsmack such that positive values are reserved for returning length of the label for smack_new_label_from_* functions. * m4/jm-macros.m4: Set HAVE_SMACK when both smack_new_label_from_self() and recently added smack_new_label_from_path() are present. The latter's presence indicates the newer API of the former. * src/id.c (main): Check that smack_new_label_from_self() < 0, and not just non-zero.
2013-06-18tests: use appropriate precision when printing float limitsPádraig Brady
* src/getlimits.c (print_float): Adjust to use the ftoastr module, which uses the appropriate precision so that no info is lost. * cfg.mk (sc_prohibit_continued_string_alpha_in_column_1): Exclude od.c fixes http://bugs.gnu.org/14650
2013-06-13maint: update gitignore entriesPádraig Brady
* .gitignore: Exclude the generated doc/manual directory, and also the src/fs-latest-magic.h file referenced in README-release.
2013-06-12doc: clarify the description of du --separate-dirsPádraig Brady
* src/du.c (usage): Clarify that --separate-dirs doesn't exclude all directories. * doc/coreutils.texi (du invocation): Avoid implying that -S excludes the size of any non directory entries for a directory. Also don't mention st_size as it's dependent on --apparent-size. Reported by C de-Avillez in <https://launchpad.net/bugs/1187044>
2013-06-05doc: mention prior stat changeEric Blake
For a file of size 1234 bytes, commit ca9aa759 had the side effect of changing 'stat -c "%'s" file' from outputting "?s" to the nicer "1,234", depending on locale. This is worth mentioning in the NEWS. Resolves part of http://bugs.gnu.org/14556. * NEWS: Mention 8.7 improvement in stat. * cfg.mk (old_NEWS_hash): Adjust accordingly.
2013-06-05build: update gnulib submodule; also bootstrap to latestBernhard Voelker
Notes tests/init.sh is still in sync with gnulib. * bootstrap: Update to latest. * gnulib: Update avoiding gnulib-test failures.
2013-06-03tests: avoid a race in tail --retry testingPádraig Brady
Prompted by the continuous integration build failure at: http://hydra.nixos.org/build/5221053 * tests/tail-2/retry.sh: Ensure the 'out' file is truncated, as it's used to arbitrate the run order of commands. Relying on the truncation in the background tail command is racy because the truncation can occur after the fork of the background shell and thus wait4lines would not wait for output to occur in 'out', which would mean that the 'missing' file could be populated by the time tail(1) gets to process it.
2013-06-03doc: mention 'UTC' in date --utc helpAndreas Mohr
src/date.c (usage): Make -u apparent in searches for UTC.
2013-06-02od: -wN, N>64K, avoid misbehavior on systems with 32-bit size_tJim Meyering
* src/od.c (PRINT_FIELDS): Declare "i" to be of type uintmax_t, so that the numerator in the expression for "next_pad" does not overflow. (print_named_ascii): Likewise. (print_ascii): Likewise. Bug introduced via commit v6.12-42-g20c0b87. * tests/misc/od.pl: Exercise each of the three affected code paths. * NEWS (Bug fixes): Mention it. Reported by Rich Burridge.
2013-06-01tests: head-c: avoid spurious failure with a 32-bit size_tJim Meyering
* tests/misc/head-c.sh: Don't try to elide 1 exabytes, since on 32-bit systems, that number is not representable as a size_t. This command would fail on 32-bit systems, where SIZE_MAX < 1E: head --bytes=-E < /dev/null Instead of "E", use $SSIZE_MAX. For discussion, see http://bugs.gnu.org/13530
2013-05-27tests: avoid spurious failure when SIZE_MAX is 2^32-1Jim Meyering
* tests/split/line-bytes.sh: Since we've limited virtual memory to 20MB, choose a smaller size, 1GiB (which is <= SIZE_MAX) rather than 1EiB, which is larger than SIZE_MAX on 32-bit systems. I confirmed that this test still fails when the split.c-modifying part of v8.21-58-gfec363c is backed out.
2013-05-26tests: fix an ls test not to fail when user or group name contains SPJim Meyering
* tests/ls/block-size.sh (size_etc): The sed expression through which we filtered the output of "ls -l ..." assumed that the user and group name components of each line would not contain spaces. Avoid the problem by using -og instead of -l, thus not printing either of those fields. Adjust the sed expression accordingly.
2013-05-27tests: numfmt: use the printf program, not the shell builtinStefano Lattarini
* tests/misc/numfmt.pl: Avoid a spurious failure when /bin/sh is dash (as can happen on Debian systems).
2013-05-24stat: tune for large-LDAP casePaul Eggert
* src/stat.c (print_stat): Omit unnecessary calls to setpwent, setgrent. Problem reported by Fridolín Pokorný in <http://bugs.gnu.org/14462>.
2013-05-23split: with --line-bytes only allocate memory as neededPádraig Brady
* src/split.c (line_bytes_split): Rewrite to only buffer when necessary. I.E. only increase the buffer when we've already lines output in a split and we encounter a line larger than the input buffer size, in which case a hold buffer will be increased in increments of the input buffer size. (lines_rr): Use the more abstract xalloc_die() just like we did in line_bytes_split(), rather than explicitly printing the "memory exhausted" message and exiting. * tests/split/line-bytes.sh: Add a new test for this function which previously had no test coverage. * tests/local.mk: Reference the new test. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/13537
2013-05-18maint: port --enable-gcc-warnings to clangPaul Eggert
* configure.ac: If clang, add -Wno-format-extra-args and -Wno-tautological-constant-out-of-range-compare. * gl/lib/rand-isaac.c (ind): * gl/lib/randread.c (readisaac): * src/ls.c (dev_ino_push, dev_ino_pop): * src/sort.c (buffer_linelim): * src/system.h (is_nul): * src/tail.c (tail_forever_inotify): Rewrite to avoid casts that clang dislikes. It's good to avoid casts anyway. * src/expr.c (integer_overflow): Declare only if it exists. (die): Remove; unused. * src/ls.c (dev_ino_push): New function, replacing ... (DEV_INO_PUSH): ... this removed macro. All uses changed. (decode_switches): Rewrite "str"+i to &str[i].
2013-05-18build: update gnulib submodule to latestPaul Eggert
2013-05-18tests: don't assume expr was built with GMPPaul Eggert
* tests/misc/cut-huge-range.sh (subtract_one): New string. (CUT_MAX): Don't pass a too-large integer to 'expr'.
2013-05-12doc: link to the list of rejected feature requestsPádraig Brady
* README: Update the email address best suited to discussing feature requests, and also link to the list of previously discussed and rejected requests.
2013-05-12build: avoid new syntax-check failureJim Meyering
* po/POTFILES.in: Reflect renaming.
2013-05-11maint: add FIXME commentPaul Eggert
2013-05-11mkdir: don't assume umask equals POSIX default ACL maskPaul Eggert
This fixes Bug#14371, reported by Killer Bassist. * NEWS: Document this. * src/mkdir.c (struct mkdir_options): Remove member ancestor_mode. New member umask_value. All uses changed. * src/mkdir.c (make_ancestor): Fix umask assumption. * src/mkdir.c, src/mkfifo.c, src/mknod.c (main): Leave umask alone. This requires invoking lchmod after creating the file, which introduces a race condition, but this can't be avoided on hosts with "POSIX" default ACLs, and there's no easy way with network file systems to tell what kind of host the directory is on. * tests/local.mk (all_tests): Add tests/mkdir/p-acl.sh. * tests/mkdir/p-acl.sh: New file.
2013-05-11build: update gnulib submodule to latestPaul Eggert
2013-05-08id: with -Z, show SMACK security contextJarkko Sakkinen
Adds an optional dependency on libsmack. * m4/jm-macros.m4: Look for the smack library/header. * src/id.c (main): Output the smack context if available. * src/local.mk: Link with libsmack if available. * NEWS: Mention the new feature.
2013-05-08cut: improve performance, especially with --output-delimiterCojocaru Alexandru
Use a sentinel value that's checked implicitly, rather than a bit array, to determine if an item should be output. Benchmark results for this change are: $ yes abcdfeg | head -n1MB > big-file $ for c in orig sentinel; do src/cut-$c 2>/dev/null echo -ne "\n== $c ==" time src/cut-$c -b1,3 big-file > /dev/null done == orig == real 0m0.049s user 0m0.044s sys 0m0.005s == sentinel == real 0m0.035s user 0m0.032s sys 0m0.002s ## Again with --output-delimiter ## $ for c in orig sentinel; do src/cut-$c 2>/dev/null echo -ne "\n== $c ==" time src/cut-$c -b1,3 --output-delimiter=: big-file > /dev/null done == orig == real 0m0.106s user 0m0.103s sys 0m0.002s == sentinel == real 0m0.055s user 0m0.052s sys 0m0.003s eol_range_start: Removed. 'n-' is no longer treated specially, and instead SIZE_MAX is set for the 'hi' limit, and tested implicitly. complement_rp: Used to complement 'rp' when '--complement' is specified. ADD_RANGE_PAIR: Macro renamed to 'add_range_pair' function. * tests/misc/cut-huge-range.sh: Adjust to the SENTINEL value. Also remove the overlapping range test as this is no longer dependent on large ranges and also is already handled with the EOL-subsumed-3 test in cut.pl.
2013-05-07cut: fix handling of overlapping rangesCojocaru Alexandru
This issue was introduced in commit v8.21-43-g3e466ad * src/cut.c (set_fields): Process all range pairs when merging. * tests/misc/cut-huge-range.sh: Add a test for this edge case. Also fix an issue where we could miss reported errors due to truncation of the 'err' file.
2013-04-30doc: correct a URL to older textutils sourcePádraig Brady
* doc/coreutils.texi (Putting the tools together): Adjust the textutils-1.22 URL, and add a URL for newer sources.
2013-04-29cut: reduce CPU usage for the the common casePádraig Brady
Ensure appropriate functions are inlined. This was seen to be required with gcc 4.6.0 with -O2 on x86_64 at least. It was reported that gcc 4.8.0 did inline these functions though. Also reinstate the bit vector for the common case, to further improve performance. Benchmark results for both aspects of this change are: $ yes abcdfeg | head -n1MB > big-file $ for c in orig inline inline-array; do src/cut-$c 2>/dev/null echo -ne "\n== $c ==" time src/cut-$c -b1,3 big-file > /dev/null done == orig == real 0m0.088s user 0m0.081s sys 0m0.007s == inline == real 0m0.070s user 0m0.060s sys 0m0.009s == inline-array == real 0m0.049s user 0m0.044s sys 0m0.005s * src/cut.c (set_fields): Set up the printable_field bit vector for performance, but only when it's appropriate. I.E. not when either --output-delimeter or huge ranges are specified. (next_item): Ensure it's inlined and avoid unnecessary processing. (print_kth): Ensure it's inlined and add a branch for the fast path. Related to http://bugs.gnu.org/13127
2013-04-29cut: reduce CPU overhead in determining item to outputCojocaru Alexandru
print_kth() is the central function of cut used to determine if an item is to be output or not, so simplify it by moving some logic outside. Benchmark results for this change are: $ yes abcdfeg | head -n1MB > big-file $ for c in orig split; do src/cut-$c 2>/dev/null echo -ne "\n== $c ==" time src/cut-$c -b1,3 big-file > /dev/null done == orig == real 0m0.111s user 0m0.108s sys 0m0.002s == split == real 0m0.088s user 0m0.081s sys 0m0.007s * src/cut.c (print_kth): Refactor a branch to outside the function. Related to http://bugs.gnu.org/13127
2013-04-29cut: make memory allocation independent of range widthCojocaru Alexandru
The current implementation of cut, uses a bit array, an array of `struct range_pair's, and (when --output-delimiter is specified) a hash_table. The new implementation will use only an array of `struct range_pair's. The old implementation is memory inefficient because: 1. When -b with a big num is specified, it allocates a lot of memory for `printable_field'. 2. When --output-delimiter is specified, it will allocate 31 buckets. Even if only a few ranges are specified. Note CPU overhead is increased to determine if an item is to be printed, as shown by: $ yes abcdfeg | head -n1MB > big-file $ for c in with-bitarray without-bitarray; do src/cut-$c 2>/dev/null echo -ne "\n== $c ==" time src/cut-$c -b1,3 big-file > /dev/null done == with-bitarray == real 0m0.084s user 0m0.078s sys 0m0.006s == without-bitarray == real 0m0.111s user 0m0.108s sys 0m0.002s Subsequent patches will reduce this overhead. * src/cut.c (set_fields): Set and initialize RP instead of printable_field. * src/cut.c (is_range_start_index): Use CURRENT_RP rather than a hash. * tests/misc/cut.pl: Check if `eol_range_start' is set correctly. * tests/misc/cut-huge-range.sh: Rename from cut-huge-to-eol-range.sh, and add a test to verify large amounts of mem aren't allocated. Fixes http://bugs.gnu.org/13127
2013-04-28stat,tail: improve support for snfsPádraig Brady
The StorNext distributed file system was previously known as CVFS. * src/stat.c (human_fstype): Add new file system ID definition. * NEWS: Mention the improvement. Fixes http://bugs.gnu.org/14251
2013-04-25tests: fix usage of require_ulimit_Pádraig Brady
* init.cfg (require_ulimit_v_): Renamed from require_ulimit_ as this only checks for ulimit -v support. Other uses of ulimit -t and ulimit -n in tests shouldn't cause false failures if not supported. * cfg.mk (sc_prohibit_test_ulimit_without_require_): A new syntax check to ensure that require_ulimit_v_() is used iff required. * tests/misc/head-c.sh: Add missing call to require_ulimit_v_. * tests/rm/many-dir-entries-vs-OOM.sh: Likewise. * tests/split/r-chunk.sh: Remove non mandatory require_ulimit_ call. * tests/misc/sort-merge-fdlimit.sh: Likewise. * tests/cp/link-heap.sh: Adjust to renamed require_ulimit_v_. * tests/dd/no-allocate.sh: Likewise. * tests/misc/csplit-heap.sh: Likewise. * tests/misc/cut-huge-to-eol-range.sh: Likewise. * tests/misc/printf-surprise.sh: Likewise.
2013-04-22scripts: tweak URLs in autotools-installJim Meyering
* scripts/autotools-install (tarballs): Use http:// URLs rather than ftp:// ones. The former are more likely to work, these days. Update URLs to point to the latest versions.
2013-04-20tail: exit following by descriptor when no tailable file leftBernhard Voelker
As a side effect of the previous commit which fixes 'tail -f --retry' to wait for a file to appear, tail would not exit when the last file appears untailable and gives up on this file. This can happen, for example, when the argument file name appears as directory. Tail sets the 'ignore' flag of this file to true, but instead of exiting the program, tail would continue the loop. * src/tail.c (any_live_files): Change the function to return true if any of the files is still tailable or if tail should continue to try to check again. (tail_forever): Change the condition to break the loop in the "no files remaining" case, because now any_live_files() will care about it, as mentioned above. (parse_options): When --retry is used without any follow mode, then reset reopen_inaccessible_files to false. * tests/tail-2/retry.sh: Add test case.
2013-04-20tail: let -f --retry wait for inaccessible filesBernhard Voelker
The --retry option is indeed useful for both following modes by name and by file descriptor. The difference is that in the latter case, it is effective only during the initial open. As a regression of the implementation of the inotify support, tail -f --retry would immediately exit if the given file is inaccessible. * src/tail.c (usage): Change the description of the --retry option: remove the note that this option would mainly be useful when following by name. (main): Change diagnosing dubios uses of --retry option: when the --retry option is used without following, then issue a warning that this option is ignored; when it is used together with --follow=descriptor, then issue a warning that it is only effective for the initial open. Disable inotify also in the case when the initial open in tail_file() failed (which is the actual bug fix). * init.cfg (retry_delay_): Pass excess arguments to the test function. * tests/tail-2/retry.sh: Add new tests. * tests/local.mk (all_tests): Mention it. * doc/coreutils.texi (tail invocation): Enhance the documentation of the --retry option. Clarify the difference in tail's behavior regarding the --retry option when combined with the following modes name versus descriptor. * NEWS (Bug fixes): Mention the fix. Reported by Noel Morrison in: http://lists.gnu.org/archive/html/coreutils/2013-04/msg00003.html
2013-04-14tests: avoid false failures with non default groupsPádraig Brady
On OS X it was seen that the group ID used for new files, are set to a that of the directory rather than the current user. It's not currently understood when this happens, but it was confirmed that ACLs, extended attributes and setgid bits are _not_ involved. * init.cfg (skip_if_nondefault_group_): A new function to detect and avoid this situation. Document with links to the discussions for hopefully future clarification. * tests/install/install-C-root.sh: Use the new function. * tests/install/install-C-selinux.sh: Likewise. * tests/install/install-C.sh: Likewise.
2013-04-14doc: mention caveats with using install --comparePádraig Brady
* doc/coreutils.texi (install invocation): Mention that install(1) may not correctly determine the default user or permissions for installed files, and so is best used with options specifying these attributes.
2013-04-14head: with --bytes=-N only allocate memory as neededPádraig Brady
* src/head.c (elide_tail_bytes_pipe): Don't use calloc as that bypasses memory overcommit due to the zeroing requirement. Also realloc rather than malloc the pointer array to avoid dependence on overcommit entirely. * tests/misc/head-c.sh: Add a test case. Fixes http://bugs.gnu.org/13530