Benoît Knecht [Wed, 13 Jul 2011 11:57:59 +0000 (13:57 +0200)]
doc: describe the file permissions set by mktemp
* src/mktemp.c (usage): As above, for --help.
Reported by Jordi Pujol in http://bugs.debian.org/551093.
Wording improvments from Eric Blake.
Benoît Knecht [Mon, 11 Jul 2011 21:10:33 +0000 (23:10 +0200)]
doc: note the order in which wc counts are printed
This information has already been added to the Texinfo manual, but was
missing from the --help output.
* src/wc.c (usage): As above, for --help.
Reported by Vincent Lefevre in http://bugs.debian.org/395430.
Jim Meyering [Tue, 12 Jul 2011 13:40:53 +0000 (15:40 +0200)]
build: update gnulib submodule to latest
Eric Blake [Tue, 12 Jul 2011 10:05:47 +0000 (12:05 +0200)]
build: list makeinfo 4.13 as a build-from-git requirement
* bootstrap.conf (buildreq): List 4.13 as minimum makeinfo version.
Prompted by Joachim Schmitz's report in http://debbugs.gnu.org/9050.
Benoît Knecht [Sun, 10 Jul 2011 22:38:34 +0000 (00:38 +0200)]
dircolors: highlight .webm multimedia files
* src/dircolors.hin: Add .webm multimedia files.
Suggested by Josh Triplett in http://bugs.debian.org/582403.
Jim Meyering [Fri, 8 Jul 2011 15:10:17 +0000 (17:10 +0200)]
maint: add syntax-check rule to prohibit "."-terminated "SEE ALSO"
* cfg.mk (sc_prohibit_man_see_also_period): Prohibit a period at
the end of the first line after a "SEE ALSO" marker in man/*.x.
With this, we shouldn't have to make any more changes like those
in today's commit,
f2dabd68.
Pádraig Brady [Fri, 8 Jul 2011 14:53:09 +0000 (15:53 +0100)]
doc: list all new file system types recognized by stat -f
NEWS (Improvements): Mention the MQUEUE and PSTOREFS
file systems, recognized as of commit
171e1b98.
Benoît Knecht [Fri, 8 Jul 2011 12:52:41 +0000 (14:52 +0200)]
doc: don't terminate SEE ALSO sections with a period
man-pages(7) explicitly says about SEE ALSO sections: "Do not terminate
this with a period." This is also in line with all the other man pages
in coreutils.
* man/cat.x: Remove period at the end of the SEE ALSO section.
* man/tac.x: Likewise.
Pádraig Brady [Fri, 8 Jul 2011 13:49:05 +0000 (14:49 +0100)]
timeout: handle signals more transparently
* m4/jm-macros.m4: Define HAVE_SETRLIMIT.
* src/timeout.c: If the child exited with a signal,
raise that signal to the timeout process itself,
so that callers may also see the signal status.
Use setrlimit to disable core dumps for the timeout
process, which would be generated by some signals.
Pádraig Brady [Fri, 8 Jul 2011 12:31:05 +0000 (13:31 +0100)]
timeout: support cascaded timeouts
* src/timeout.c (cleanup): Send signals directly to the child
in case it has started its own process group (like a cascaded
timeout command would for example).
* test/misc/timeout-group: Add a test case.
* NEWS: Mention the fix.
Pádraig Brady [Wed, 6 Jul 2011 22:17:10 +0000 (23:17 +0100)]
timeout: add --foreground to support interactive commands
Or more accurately, commands not started from the shell prompt,
that are interactive, or need to receive Ctrl-C etc. from the terminal.
* doc/coreutils.texi (timeout invocation): Document --foreground.
* src/timeout.c (main): Set the foreground flag and don't create
a separate group.
(cleanup): Only send a signal directly to the monitored command
when the foreground flag is set.
(usage): Describe --foreground.
* tests/misc/timeout-group: Add a new test.
* tests/Makefile.am: Reference new test.
NEWS: Mention the new option.
Reported by Shay Shimony
Analysis by Alan Curry
Fix suggested by Paul Eggert
Benoît Knecht [Fri, 8 Jul 2011 08:17:20 +0000 (10:17 +0200)]
doc: note that cp -l creates _hard_ links
This fact was already noted in the Texinfo manual, but not in the
output of --help.
* src/cp.c (usage): As above, for --help.
Reported by Jari Aalto in http://bugs.debian.org/294327.
Jim Meyering [Thu, 7 Jul 2011 10:12:40 +0000 (12:12 +0200)]
tests: exercise md5sum's new --strict option
* tests/misc/md5sum: Exercise new --strict option.
Patrick Schoenfeld [Thu, 7 Jul 2011 06:57:39 +0000 (08:57 +0200)]
md5sum, sha1sum, etc: accept new option: --strict
Use this new option with --check when the input is expected to
consist solely of checksum lines. With only --check, an invalid
line evokes a warning, but the program can still exit successfully.
With --strict, any invalid line makes the program exit non-zero.
* src/md5sum.c (strict, STRICT_OPTION): Declare/define.
(long_options): Add "strict".
(usage): Describe --strict.
(digest_check): Count improperly_formatted lines, too, and use
that number and the global "strict" to determine the return value.
(main): Handle STRICT_OPTION.
Reject --strict without --check.
* doc/coreutils.texi: Describe it.
* NEWS (New features): Mention it.
Benoît Knecht [Thu, 7 Jul 2011 08:55:47 +0000 (10:55 +0200)]
doc: note date's %k, %l are space-padded and equivalent to %_H and %_I
* src/date.c (usage): As above, for --help.
* doc/coreutils.texi (Time conversion specifiers): Likewise.
Reported by Britton Leo Kerin in http://bugs.debian.org/115833.
Jim Meyering [Tue, 5 Jul 2011 20:49:56 +0000 (22:49 +0200)]
stat: recognize GPFS as a file system type
* src/stat.c (human_fstype) [S_MAGIC_GPFS]: Add a case,
to handle GPFS_SUPER_MAGIC/0x47504653. Prompted by this discussion:
http://thread.gmane.org/gmane.comp.sysutils.autoconf.general/14007
* NEWS (Improvements): Mention it.
Jim Meyering [Sun, 24 Apr 2011 17:06:39 +0000 (19:06 +0200)]
maint: use "const" and "pure" function attributes where possible
* configure.ac (WARN_CFLAGS): Add -Wsuggest-attribute=const,
-Wsuggest-attribute=pure and -Wsuggest-attribute=noreturn.
(GNULIB_WARN_CFLAGS): But do not add them here... yet.
* src/chown-core.h (chopt_free, uid_to_name): Add function attribute(s).
* src/copy.c (is_ancestor, valid_options): Likewise.
* src/copy.h (chown_failure_ok): Likewise.
* src/dd.c (operand_matches, operand_is): Likewise.
* src/df.c (selected_fstype, excluded_fstype): Likewise.
* src/expr.c (null looks_like_integer): Likewise.
* src/md5sum.c (hex_digits): Likewise.
* src/od.c (get_lcm): Likewise.
* src/pathchk.c (component_start, component_len): Likewise.
* src/pinky.c (count_ampersands): Likewise.
* src/pr.c (cols_ready_to_print): Likewise.
* src/ptx.c (search_table): Likewise.
* src/sort.c (find_unit_order): Likewise.
* src/stty.c (mode_type_flag, string_to_baud, baud_to_value): Likewise.
* src/system.h (gcd, lcm): Likewise.
* src/tr.c (is_char_class_member, look_up_char_class): Likewise.
(star_digits_closebracket): Likewise.
* src/uniq.c (find_field): Likewise.
* src/wc.c (compute_number_width): Likewise.
* lib/xfts.h (cycle_warning_required): Likewise.
* gl/lib/randint.h (randint_get_source): Likewise.
* gl/lib/randperm.c (ceil_lg): Likewise.
* gl/lib/randperm.h (randperm_bound): Likewise.
* lib/strnumcmp.h (strintcmp): Likewise.
Jim Meyering [Sat, 4 Jun 2011 08:41:08 +0000 (10:41 +0200)]
buffer_lcm: declare with _GL_ATTRIBUTE_CONST
* lib/buffer-lcm.h (buffer_lcm): Use _GL_ATTRIBUTE_CONST.
* lib/buffer-lcm.c: Include <config.h>.
Pádraig Brady [Fri, 1 Jul 2011 08:42:17 +0000 (09:42 +0100)]
doc: detail the effect of disabling input buffering with stdbuf
* docs/coreutils.texi (stdbuf invocation): Expand on the different
reasons for disabling buffering on input and output.
Bruno Haible [Thu, 30 Jun 2011 17:02:36 +0000 (18:02 +0100)]
doc: mention the restrictions for stdbuf more prominently
* doc/coreutils.texi (stdbuf invocation): List the contraints
on the command being controlled, up front.
Jim Meyering [Sat, 25 Jun 2011 12:54:45 +0000 (14:54 +0200)]
doc: improve ls --help grammar
* src/ls.c (usage): Improve grammar.
Reported by Peng Yu.
Jim Meyering [Sat, 25 Jun 2011 05:57:59 +0000 (07:57 +0200)]
doc: clarify an improvement from coreutils-7.0
* NEWS (7.0 Improvements): Mention the command: "ls -1U".
* cfg.mk (old_NEWS_hash): Update.
Jim Meyering [Fri, 24 Jun 2011 07:12:59 +0000 (09:12 +0200)]
maint: don't use gnulib's pathmax module; define PATH_MAX if needed
* bootstrap.conf (gnulib_modules): Remove pathmax.
* src/system.h: Don't include "pathmax.h".
(PATH_MAX) [!PATH_MAX]: Define to 8192. Defining it to a constant
is preferable to using a definition from pathmax.h that might expand
to pathconf ("/", _PC_PATH_MAX). Prompted by discussion leading to:
http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/27183/focus=27269
Jim Meyering [Wed, 22 Jun 2011 15:34:08 +0000 (17:34 +0200)]
build: bootstrap: remove obsolete gettext-related file exclusions
* bootstrap.conf: Don't bother to exclude gettext/intl-related
.m4 files. That exclusion is no longer necessary.
Pádraig Brady [Fri, 24 Jun 2011 07:22:06 +0000 (08:22 +0100)]
stat: recognize MQUEUE and PSTOREFS file systems
* src/stat.c (human_fstype): Add magic numbers for
PSTOREFS and MQUEUE.
Bernhard Voelker [Tue, 21 Jun 2011 14:26:50 +0000 (16:26 +0200)]
tests: stat-free-color: do not count stat calls before main
* tests/ls/stat-free-color: The system may perform additional stat
calls upon loading (seen on OpenSuSE-11.4). Count only the number
of stat calls compared to --help.
This also reduces back to "1" the number of expected calls,
effectively reverting part of 2011-06-01 commit,
ccf2d9a4.
Bernhard Voelker [Tue, 21 Jun 2011 08:10:39 +0000 (10:10 +0200)]
tests: cp/sparse-fiemap: use "head -n99" in place of "head -99"
* tests/cp/sparse-fiemap: Use "head -n99" in place of "head -99".
The latter is officially obsolete.
Jim Meyering [Mon, 20 Jun 2011 08:01:43 +0000 (10:01 +0200)]
tests: init.sh: use "sed 1q" in place of "head -1"
* tests/init.sh (warn_): Use "sed 1q" in place of "head -1".
The latter is officially obsolete but more portable than "head -n1".
Reported by Bernhard Voelker.
Jim Meyering [Mon, 20 Jun 2011 07:47:46 +0000 (09:47 +0200)]
maint: update THANKS.in
* THANKS.in: Remove Stefano's name.
Bernhard Voelker [Mon, 20 Jun 2011 07:46:06 +0000 (09:46 +0200)]
tests: improve init.sh by removing w2_
* tests/init.sh (w2_): Remove, moving contents into...
(warn_): ...here. Call self from subshell when IFS must be changed.
Stefano Lattarini [Sat, 18 Jun 2011 15:57:53 +0000 (17:57 +0200)]
tests: avoid extra forks in the testsuite
* tests/shell-or-perl: Prefer the `read' builtin over `grep' to
look at the shebang line of test scripts. Since `read' is a
special builtin, it might abort the whole program upon failures,
so add extra sanity checks, verifying that the test script exists
and is readable, before trying to read from it.
Stefano Lattarini [Sat, 18 Jun 2011 08:26:15 +0000 (10:26 +0200)]
tests: make test runner a script, not a shell function
This change implements a more correct and idiomatic use of the
features of the Automake-provided 'parallel-tests' harness.
Moreover, this change is required in order for the testsuite to
continue to work with the new testsuite harness that is planned
to be introduced in Automake 1.12 (which, as of the writing date,
is still under development and in alpha state).
* tests/shell-or-perl: New auxiliary script.
* tests/Makefile.am (EXTRA_DIST): Distribute it.
* tests/check.mk (TESTS_ENVIRONMENT): Remove definition of the
`shell_or_perl_' shell function, whose code has been moved in
the new script above (with a few improvements and extensions).
Do not use it to run the test scripts.
(LOG_COMPILER): New, properly invoking `shell-or-perl'.
Jim Meyering [Sun, 19 Jun 2011 09:41:24 +0000 (11:41 +0200)]
stdbuf: fix automake variable name to work with cutting edge automake
* src/Makefile.am (pkglibexec_PROGRAMS): Rename from pkglib_PROGRAMS.
The latter is invalid. Without this change, automake
v1.11-373-g9ca6326 and newer (on master) would fail with this:
`pkglibdir' is not a legitimate directory for `PROGRAMS'
This changes the default installation directory of libstdbuf.so from
$prefix/lib/coreutils/ to
$prefix/libexec/coreutils/
* src/stdbuf.c (set_LD_PRELOAD): Search in PKGLIBEXECDIR, not PKGLIBDIR,
since that's where we install libstdbuf.so.
Do not search in "", the system default search path.
Pádraig Brady [Sat, 18 Jun 2011 17:58:44 +0000 (18:58 +0100)]
maint: avoid a false positive syntax check
* cfg.mk (sc_strftime_check): Skip the check when there
is no info to compare against.
Reported by Stefano Lattarini
James Youngman [Sun, 19 Jun 2011 07:15:06 +0000 (09:15 +0200)]
maint: typo: insert omitted word in test comment
* tests/misc/sort-spinlock-abuse: Fix typo:
s/"very expensive" are/"very expensive" tests are/
Stefano Lattarini [Sat, 18 Jun 2011 11:03:54 +0000 (13:03 +0200)]
maint: fix typo in comment in configure.ac
* configure.ac ($MAN): Fix typo in explanatory comment.
Jim Meyering [Fri, 17 Jun 2011 18:30:10 +0000 (20:30 +0200)]
tests: sort-debug-keys: fix a bug with translated diagnostics
Ensure that English diagnostics are emitted even when using
French sorting rules.
* tests/misc/sort-debug-keys: Unset LC_ALL and set LC_COLLATE,
LC_CTYPE and LC_NUMERIC to the fr_FR.UTF-8 locale, while setting
LC_MESSAGES=C. Reported by Stefano Lattarini.
Pádraig Brady [Fri, 17 Jun 2011 21:48:22 +0000 (22:48 +0100)]
maint: remove duplicate names from THANKS
* .mailmap: Merge email addresses
* THANKS.in: Remove a duplicate name
Reported by Stefano Lattarini
Jim Meyering [Fri, 17 Jun 2011 08:02:58 +0000 (10:02 +0200)]
maint: use modules/tempname.diff file, not a replacement; update gnulib
Using a .diff is much more maintainable. Otherwise, changes in
the gnulib module description file may not be noticed and merged
promptly and may even result in subtle errors. Luckily, this time,
the failure to propagate gnulib's changes to modules/tempname resulted
only in an obvious link failure.
* gl/modules/tempname: Remove file.
* gl/modules/tempname.diff: Use a .diff file instead.
* gnulib: Update submodule to latest.
Jim Meyering [Fri, 17 Jun 2011 10:01:10 +0000 (12:01 +0200)]
tests: avoid sort-spinlock-abuse false positive under heavy load
* tests/misc/sort-spinlock-abuse: Classify as "very expensive" to
avoid unwarranted failure once and for all.
Jim Meyering [Tue, 14 Jun 2011 14:22:41 +0000 (16:22 +0200)]
tests: remove skip_test_ function; use new skip_ instead
* tests/init.cfg (skip_test_): Remove function.
Use skip_ in place of skip_test_ everywhere else.
* cfg.mk (sc_prohibit_skip_): Remove rule.
* tests/**: Use skip_, not skip_test_, everywhere.
Jim Meyering [Fri, 17 Jun 2011 07:02:09 +0000 (09:02 +0200)]
tests: make init.sh's warn_ emit to both the tty and the log file
* tests/init.sh (warn_): When $stderr_fileno_ != 2,
emit the diagnostic to both the tty and the log file.
Jim Meyering [Tue, 14 Jun 2011 13:37:48 +0000 (15:37 +0200)]
tests: use printf, not echo in init.sh's warn_ function
* tests/init.sh (warn_): Use printf, not echo. The latter would
misbehave when given strings containing a backslash or starting
with e.g., -n. James Youngman suggested setting IFS.
Jim Meyering [Tue, 14 Jun 2011 07:59:14 +0000 (09:59 +0200)]
tests: accommodate HP-UX and ksh-derived shells
Running "make check" normally prints a diagnostic to the outermost
stderr (usually a tty) to explain why a test is skipped. It did this
by redirecting FD 9 to stderr (via "exec 9>&2") before invoking the
shell script. Shell scripts write skip-explanation to FD 9 via
init.sh's skip_ function. However, with ksh and HP-UX's /bin/sh,
the effects of "exec 9>&2" are canceled upon fork-and-exec, so we
would get a "Bad file number" diagnostic and no skip explanation on
those systems.
* tests/check.mk (TESTS_ENVIRONMENT): Redirect more portably, via
"$(SHELL) 9>&2", rather than the prior "exec 9>&2; $(SHELL) ..."
Actually, we use "shell_or_perl_ 9>&2", to make this effective
also for the perl-based tests.
* tests/init.sh (stderr_fileno_): Update the advice in comments.
See http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/22488
for lots of discussion. Stefano Lattarini suggested the solution
of putting "9>&2" after the command. Reported by Bruno Haible.
Jim Meyering [Mon, 13 Jun 2011 10:49:10 +0000 (12:49 +0200)]
init.sh: sync from gnulib
* tests/init.sh: Sync recent changes from gnulib.
Jim Meyering [Mon, 13 Jun 2011 16:20:14 +0000 (18:20 +0200)]
maint: revert previous commit
Revert "init.sh: accommodate shells for which 1>&$stderr_fileno_ fails"
This reverts commit
6fb9aeedd1b858a61d5cbf7f15782adf29ff733a.
That change did not solve the problem. For details, see
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8846#74
Jim Meyering [Mon, 13 Jun 2011 10:07:14 +0000 (12:07 +0200)]
init.sh: accommodate shells for which 1>&$stderr_fileno_ fails
* tests/init.sh (warn_): Use eval to work around a bug in some shells,
like those of Solaris 10 and HP-UX 11.11.
Improved by Stefano Lattarini.
Jim Meyering [Mon, 13 Jun 2011 09:32:41 +0000 (11:32 +0200)]
doc: add NEWS items for recent gnulib fixes
* NEWS (Improvements): Mention the new HP-UX 11.11 ACL support.
(Build-related): Mention the cc/HP-UX 11.11 build fix.
Jim Meyering [Mon, 13 Jun 2011 09:05:49 +0000 (11:05 +0200)]
tests: avoid sort-spinlock-abuse false positive under heavy load
* tests/misc/sort-spinlock-abuse: This test would frequently fail
when run on a system under heavy load. Increase duration and limit.
James Youngman [Sat, 11 Jun 2011 15:28:34 +0000 (16:28 +0100)]
maint: use stat-size module from gnulib
* gnulib: Update to latest.
* src/system.h: Definitions of ST_* macros have moved into the
gnulib module stat-size (specifically, the header file
stat-size.h), so remove them from here.
* src/truncate.c: Include stat-size.h.
* src/stat.c: Likewise.
* src/shred.c: Likewise.
* src/ls.c: Likewise.
* src/du.c: Likewise.
* src/ioblksize.h: New file. Move definition of io_blksize out of
system.h so that system.h does not have to include stat-size.h.
* src/cat.c: Include ioblksize.h.
* src/split.c: Likewise.
* src/copy.c: Include both stat-size.h and ioblksize.h.
* src/Makefile.am (noinst_HEADERS): Add ioblksize.h.
Pádraig Brady [Mon, 13 Jun 2011 10:33:10 +0000 (11:33 +0100)]
tests: avoid a false failure on HPUX systems
* tests/dd/nocache: Relax the test, as the system
may return various errors from posix_fadvise().
HPUX 11.31 returns ENOTTY for example.
Reported by Bruno Haible
Jim Meyering [Sat, 11 Jun 2011 11:53:58 +0000 (13:53 +0200)]
tests: inotify-rotate: avoid false positive under heavy load
* tests/tail-2/inotify-rotate: Increase timeout from 10s to 40s
to avoid load-induced false positive.
Pádraig Brady [Fri, 3 Jun 2011 09:27:16 +0000 (10:27 +0100)]
maint: remove unneeded includes
Remove unneeded includes as reported by:
http://code.google.com/p/include-what-you-use/
* src/cp-hash.c: Remove unused include.
* src/dd.c: Likewise.
* src/du.c: Likewise.
* src/head.c: Likewise.
* src/kill.c: Likewise.
* src/ls.c: Likewise.
* src/stdbuf.c: Likewise.
* src/timeout.c: Likewise.
* src/truncate.c: Likewise.
Pádraig Brady [Thu, 2 Jun 2011 12:00:18 +0000 (13:00 +0100)]
doc: add examples to date --help
* src/date.c (usage): Add examples for TZ handling,
and "seconds since epoch" parsing, neither of which
was mentioned in the man page until now.
* THANKS.in: Add Rick.
Suggested by Rick Stanley.
Jim Meyering [Fri, 3 Jun 2011 11:28:15 +0000 (13:28 +0200)]
build: require at least 2-year old autoconf-2.64 (was 2.62)
* configure.ac: Require autoconf-2.64, which is nearly two years old.
* src/system.h (emit_ancillary_info): Use PACKAGE_URL, now that we
require autoconf-2.64.
Jim Meyering [Fri, 3 Jun 2011 11:29:15 +0000 (13:29 +0200)]
maint: remove now-spurious curly braces
* src/chown-core.c (restricted_chown): Remove FIXME comment and
superfluous curly braces.
Jim Meyering [Wed, 1 Jun 2011 14:08:21 +0000 (16:08 +0200)]
tests: stat-free-color: accommodate stat of /selinux on rawhide
* tests/ls/stat-free-color: This test recently began to fail on
rawhide because dynamic library start-up code now stats "/selinux",
making the total number of calls 2 rather than the prior 1.
Create two more dangling symlinks, so that any erroneous stat-
or lstat-calling code will get at least those three.
Marek Polacek [Fri, 27 May 2011 07:25:11 +0000 (09:25 +0200)]
yes.c: do not use exit after error
I think it would be better to exit through the error() and not
to call the exit() after the error(). This way we can get rid of
one function call (and curly brackets).
* src/yes.c (main): Exit through the error(), remove exit() call
after error().
Jim Meyering [Wed, 1 Jun 2011 11:48:12 +0000 (13:48 +0200)]
tail: fix an inconsequential bug spotted by coverity
* src/tail.c (start_bytes): Increase *READ_POS (not READ_POS)
by the number of bytes read. This is a real bug that happens
to have no consequence in practice. First, this code is exercised
only when tailing-forever a non-regular file by bytes, and with a
start-relative offset, e.g., "mkfifo f; tail -f -c +3 f", but even
then, the invalid READ_POS value does not influence how tail works.
It is stored in the File_spec.size member, but that member is not
used at all in tail_forever_inotify, and in tail_forever, it is
used only when the File_spec refers to a regular file.
Paul Eggert [Tue, 31 May 2011 16:58:59 +0000 (09:58 -0700)]
* doc/coreutils.texi (sort invocation): I/0 -> I/O (sr#107504)
Jim Meyering [Sun, 29 May 2011 12:29:13 +0000 (14:29 +0200)]
maint: remove unnecessary gnulib .diff file
* gl/modules/getloadavg.diff: Remove file. It stopped being
useful back in February.
* Makefile.am (EXTRA_DIST): Remove it.
Jim Meyering [Sun, 29 May 2011 09:28:29 +0000 (11:28 +0200)]
maint: placate -Wsign-compare when it's non-invasive
* src/stdbuf.c: Declare loop index to be unsigned.
Jim Meyering [Sat, 28 May 2011 20:10:00 +0000 (22:10 +0200)]
ls: placate gcc-4.7.0's -Wstrict-overflow
* src/ls.c (enum parse_state): Define.
(parse_ls_color): Use enum names in place of constants,
thus avoiding the offending -1.
Jim Meyering [Sat, 28 May 2011 11:52:13 +0000 (13:52 +0200)]
maint: remove useless (off_t) cast of lseek arg
* src/wc.c (wc): Remove unnecessary cast.
* src/head.c (elide_tail_bytes_file, elide_tail_lines_file): Likewise.
* src/tac.c (tac_seekable, tac_file): Likewise.
Jim Meyering [Thu, 26 May 2011 22:54:53 +0000 (00:54 +0200)]
tests: move tests/misc/split-* into tests/split/...
* tests/split/suffix-length: Rename from tests/misc/split-a.
* tests/split/b-chunk: Rename from misc/split-bchunk.
* tests/split/fail: Rename from tests/misc/split-fail.
* tests/split/lines: Rename from tests/misc/split-l.
* tests/split/l-chunk: Rename from tests/misc/split-lchunk.
* tests/split/r-chunk: Rename from tests/misc/split-rchunk.
* tests/Makefile.am (TESTS): Reflect renaming.
Pádraig Brady [Fri, 27 May 2011 22:07:08 +0000 (23:07 +0100)]
chown,chgrp: output the original ownership in -v messages
* src/chown-core.c (describe_change): Output the
original owner if possible.
(user_group_str): Handle the case when neither
owner or group are passed.
* NEWS: Mention the change in behavior.
Pádraig Brady [Thu, 26 May 2011 10:15:11 +0000 (11:15 +0100)]
chown,chgrp: output the correct ownership in -v messages
* src/chown_core.c (describe_change): Accept the ownership of
the original file and output that when not changing.
This is significant when --from is specified as then
the original and specified ownership may be different.
(user_group_str): A new helper function refactored from
describe_change().
(change_file_owner): Pass the original user and group
strings to describe_change().
* test/chown/basic: Add a test case.
* NEWS: Mention the fix.
Pádraig Brady [Thu, 26 May 2011 23:39:55 +0000 (00:39 +0100)]
maint: fix a -Wstrict-overflow build failure with gcc 4.5
* src/ls.c (print_color_indicator): Avoid the warning by
not decrementing the integer.
Jim Meyering [Wed, 25 May 2011 12:34:13 +0000 (14:34 +0200)]
build: --enable-gcc-warnings: enable -Wstrict-overflow in src/
* configure.ac (WARN_CFLAGS): Don't turn off -Wstrict-overflow.
(GNULIB_WARN_CFLAGS): Remove -Wstrict-overflow from the list of
warning options used in lib/.
Normally I find that -Wstrict-overflow produces too many false
positives, but considering that it warns of the bug reported in
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33498, I now think
it is worthwhile. The lesser of two evils.
Thanks to Daniel Veillard for showing me the gcc bug report.
Jim Meyering [Wed, 25 May 2011 10:29:18 +0000 (12:29 +0200)]
maint: accommodate gcc's -Wstrict-overflow option
* src/factor.c (factor_using_pollard_rho): Change type of "i"
to unsigned to avoid warning from gcc's -Wstrict-overflow.
* src/expr.c: Use an unsigned intermediate.
* src/dircolors.c (main): Reorder operations to avoid the risk of
pointer overflow.
* src/tr.c (squeeze_filter): Change NOT_A_CHAR from an anonymous
"enum" to an "int", to avoid this warning:
tr.c:1624:10: error: assuming signed overflow does not occur when
simplifying conditional to constant [-Werror=strict-overflow]
* src/pr.c (main): Make index "i" unsigned.
Jim Meyering [Wed, 25 May 2011 10:31:15 +0000 (12:31 +0200)]
maint: enforce cpp indentation policy
* cfg.mk (sc_preprocessor_indentation): New test, from libvirt.
Exempt 3 files from new cppi test.
* gl/lib/randread.c: Adjust cpp indentation to comply.
* src/extent-scan.c (extent_need_sync): Likewise.
Jim Meyering [Wed, 25 May 2011 20:27:53 +0000 (22:27 +0200)]
maint: env.c: remove unnecessary use of strchr
* src/env.c (main): Remove excess (and confusing to static analyzers)
use of strchr.
Jim Meyering [Wed, 25 May 2011 19:35:50 +0000 (21:35 +0200)]
shred: placate coverity and fix a comment
* src/shred.c (incname): Add an assertion to tell static analyzers
that we know this particular use of strchr never returns NULL.
Finish incomplete sentence in function-describing comment.
Pádraig Brady [Fri, 20 May 2011 00:10:58 +0000 (01:10 +0100)]
maint: split: remove --filter specific code from other paths
* src/split.c (lines_chunk_split): Don't use ignore_error() which
is redundant and confusing when not running with --filter.
(lines_rr): Likewise.
(ofile_open): Likewise. Add a comment to clarify that
filters aren't restarted under file descriptor pressure.
Pádraig Brady [Fri, 20 May 2011 00:18:28 +0000 (01:18 +0100)]
split: diagnose when --filter is used with a chunk number
* src/split.c (main): Exit with a diagnostic if --filter
is specified along with a specific chunk number.
* test/split/filter: Ensure this combination fails.
Pádraig Brady [Fri, 20 May 2011 00:26:41 +0000 (01:26 +0100)]
split: exit when we can no longer write to a --filter
* src/split.c (bytes_split): Stop reading when we
can no longer write to a child process.
(lines_rr): Likewise.
(lines_bytes_split): No change is made here since
input is bounded by the original file size.
* test/split/filter: Add test cases.
Pádraig Brady [Thu, 19 May 2011 22:23:23 +0000 (23:23 +0100)]
split: return success even if a --filter exits
src/split.c (main): Don't unblock SIGPIPE before cleanup,
as then any pending signals will be sent and cause
the main split process to exit with a non zero status (141).
* test/split/filter: Add a test for this case.
Pádraig Brady [Wed, 25 May 2011 12:05:37 +0000 (13:05 +0100)]
split: fix an edge case where -n l/... creates an extra file
* src/split.c (lines_bytes_chunk): Handle the edge case
where the file is truncated as we read.
* tests/misc/split-lchunk: Cleanup; no functional change.
Bernhard Voelker [Wed, 25 May 2011 21:11:08 +0000 (22:11 +0100)]
chmod: output the original mode in verbose mode
* src/chmod.c (describe_change): Pass in the original mode,
and output this in the messages.
* tests/chmod/c-option: Adjust as per the new message.
* THANKS.in: Remove the now auto-generated name.
* NEWS: Mention the change in behavior.
Signed-off-by: Pádraig Brady <P@draigBrady.com>
Jim Meyering [Wed, 25 May 2011 05:35:59 +0000 (07:35 +0200)]
tests: ls/stat-free-color: fix unwarranted failure on a 32-bit system
* tests/ls/stat-free-color: Also check for stat64 and lstat64 syscalls.
This fixes a test failure reported by Stefano Lattarini.
Jim Meyering [Tue, 24 May 2011 18:40:16 +0000 (20:40 +0200)]
maint: accommodate gnulib's newer tight_scope rule
* cfg.mk: Include via "-include", to accommodate new tight-scope rule.
(sc_check-AUTHORS): Change the name of the rule in src/Makefile.am
to _sc_check-AUTHORS, so it doesn't conflict with this one when
this file is included into the sub-make's context.
* src/Makefile.am (_sc_check-AUTHORS): Rename from sc_check-AUTHORS.
* gnulib: Update to latest.
Jim Meyering [Tue, 24 May 2011 18:35:52 +0000 (20:35 +0200)]
doc: make README-hacking slightly more generic
* README-hacking: Remove a reference to "coreutils".
Jim Meyering [Tue, 24 May 2011 18:33:27 +0000 (20:33 +0200)]
touch: placate static analyzers: no NULL-deref is possible
* src/touch.c (main): Avoid even the hint of possibility that
we'd dereference NULL upon localtime failure. Coverity reported
the potential, but it appears not to be possible, since posixtime
rejects any time for which the subsequent localtime would return NULL.
See http://thread.gmane.org/gmane.comp.gnu.coreutils.general/1253
Pádraig Brady [Tue, 24 May 2011 08:59:08 +0000 (09:59 +0100)]
split: fix cases where -n l/... creates extraneous files
* src/split.c (lines_chunk_split): Ensure that data is only
written to stdout when k specified. Also ensure that
extra files are not created when there is more data available
than reported in the file size.
* tests/misc/split-lchunk: Verify that split -n l/k/n doesn't
generate any files, and that -n l/n always generates n files.
* NEWS: Mention the fix.
Stéphane Raimbault [Tue, 24 May 2011 15:17:02 +0000 (16:17 +0100)]
doc: add a missing space in timeout --help
* src/timeout.c (usage): Add a space to be consistent
with other uses of "(the default)" in the documentation.
Signed-off-by: Pádraig Brady <P@draigBrady.com>
Pádraig Brady [Tue, 24 May 2011 04:44:24 +0000 (06:44 +0200)]
doc: improve tail -f vs. inotify description and advice
* doc/coreutils.texi (tail invocation): Adjust, and add an example.
Jim Meyering [Mon, 23 May 2011 18:03:58 +0000 (20:03 +0200)]
maint: avoid trivial syntax-check failure
* doc/coreutils.texi (tail invocation): Use @var{n}, not @var{N}.
Karl Berry [Mon, 23 May 2011 16:45:39 +0000 (09:45 -0700)]
maint: README-hacking clarifications
* README-hacking: Small getting-started clarifications.
Jim Meyering [Mon, 23 May 2011 14:09:42 +0000 (16:09 +0200)]
doc: describe how kernel inotify support affects tail -f
* doc/coreutils.texi (tail invocation) [-f]: Mention how inotify
kernel support makes a difference.
Prompted by http://bugzilla.redhat.com/662900
Jim Meyering [Sun, 22 May 2011 15:09:04 +0000 (17:09 +0200)]
tests: fix typo in tac-continue
* tests/misc/tac-continue: Fix typo in usually-skipped test:
s/mkfifo_or_skip/mkfifo_or_skip_/ (i.e., append "_").
This test is usually skipped, because I'm probably the only
one to set the FULL_PARTITION_TMPDIR envvar, and recently the
one I'd been using ceased to exist, so this test was skipped
even for me. Good argument for making this a root-only test
and creating a full partition just for this test case.
Jim Meyering [Sun, 22 May 2011 07:11:19 +0000 (09:11 +0200)]
doc: fix a formatting nit in od's texinfo documentation
* doc/coreutils.texi (od invocation): Typesetting of "bytes" was wrong.
Fix it via s/@code/@var/ so it's consistent.
Ivan Sichmann Freitas [Sat, 21 May 2011 08:39:48 +0000 (10:39 +0200)]
maint: fix comment typos in df.c
* src/df.c: s/Optain/Obtain/
Jim Meyering [Thu, 19 May 2011 19:36:33 +0000 (21:36 +0200)]
maint: correct typos involving misuse of "a" and "an"
* NEWS: "an misleading"
* src/expr.c: "a integer
* src/ptx.c (find_occurs_in_text): "a end"
* src/shred.c (do_wipefd): "a infinite"
* src/sort.c (SUBTHREAD_LINES_HEURISTIC): "an dual-core"
(compare_random): "an checksum"
* cfg.mk (old_NEWS_hash): Update, since the typo was in old news.
Pádraig Brady [Tue, 17 May 2011 23:01:55 +0000 (00:01 +0100)]
printf: fix an out-of-bounds memory access
* src/printf.c (STRTOX): Don't access memory after a
string containing a single quote character.
* tests/misc/printf: Add tests for various combinations
of single quote characters combined with a numeric format.
* THANKS.in: Add bug reporter.
* NEWS: Mention the fix.
Reported-by: Paul Marinescu <paul.marinescu@imperial.ac.uk>
Pádraig Brady [Tue, 17 May 2011 06:51:44 +0000 (07:51 +0100)]
doc: mention that ls time ordering is newest first
* src/ls.c (usage): Add the "newest first" info to
the -t and -c options
Pádraig Brady [Tue, 10 May 2011 07:14:16 +0000 (08:14 +0100)]
tests: refactor more tests to use mkfifo_or_skip_
* tests/cp/existing-perm-race: s/mkfifo/mkfifo_or_skip_/
* tests/cp/file-perm-race: Likewise.
* tests/cp/parent-perm-race: Likewise.
* tests/cp/special-f: Likewise.
* tests/dd/reblock: Likewise.
* tests/ls/file-type: Likewise.
* tests/misc/cat-buf: Likewise.
* tests/misc/mknod: Likewise.
* tests/misc/printf-surprise: Likewise.
* tests/misc/selinux: Likewise.
* tests/misc/sort-spinlock-abuse: Likewise.
* tests/misc/stdbuf: Likewise.
* tests/misc/tac-continue: Likewise.
* tests/init.cfg: Improve the error message when skipping.
Pádraig Brady [Fri, 13 May 2011 17:41:42 +0000 (18:41 +0100)]
shuf: use memory more efficiently when returning a subset
* gl/lib/randperm.c (randperm_new): When the number of items
to return H, is much smaller than the total number of items N,
use a hash to represent the sparse permutations of the set N.
This is currently enabled for N > 128K and N/H > 32.
* tests/misc/shuf: Ensure shuf can quickly return 2 numbers
from a large range.
* gl/modules/randperm: Depend on hash.
* NEWS: Mention the change.
Jim Meyering [Fri, 13 May 2011 21:37:23 +0000 (23:37 +0200)]
maint: avoid syntax-check failure due to long line
* tests/du/bigtime (future_time): Split long line.
Jim Meyering [Fri, 13 May 2011 16:57:31 +0000 (18:57 +0200)]
maint: add new syntax-check rule to prohibit use of skip_
* cfg.mk (sc_prohibit_skip_): New rule.
* tests/init.cfg (skip_test_): Add a comment.
Jim Meyering [Fri, 13 May 2011 16:36:29 +0000 (18:36 +0200)]
tests: use skip_test_, not skip_
skip_test_ emits its diagnostic both to FD 9 (tty), and to
FD 2 (usually the log file), whereas init.sh's skip_ emits
only to FD 9. Without that, the log is slightly less useful.
* tests/cp/fiemap-2: Use skip_test_, not skip_.
* tests/cp/fiemap-perf: Likewise.
* tests/du/bigtime: Likewise.
* tests/du/files0-from-dir: Likewise.
* tests/du/move-dir-while-traversing: Likewise.
* tests/init.sh: Likewise.
* tests/misc/sort-stale-thread-mem: Likewise.
* tests/misc/stat-nanoseconds: Likewise.
* tests/mv/i-3: Likewise.
* tests/mv/sticky-to-xpart: Likewise.
* tests/split/filter: Likewise.
Prompted by a report from Pádraig Brady.