platform/upstream/coreutils.git
15 years agomaint: ensure dd's computation of O_FULLBLOCK uses all O_ symbol names
Jim Meyering [Fri, 26 Dec 2008 11:00:18 +0000 (12:00 +0100)]
maint: ensure dd's computation of O_FULLBLOCK uses all O_ symbol names

* src/dd.c (O_FULLBLOCK): Use a more uniform initializer, that makes
it easier to extract all O_ symbol names.
* maint.mk (syntax-check-rules): Also search for sc_ rules in cfg.mk.
(sc_root_tests): Ensure that this rule sets $diff.
* cfg.mk (sc_dd_O_FLAGS): New rule.

15 years agodd: add support for opening files in Concurrent I/O (CIO) mode
Matt Harden [Mon, 22 Dec 2008 04:06:16 +0000 (22:06 -0600)]
dd: add support for opening files in Concurrent I/O (CIO) mode

* src/dd.c (O_CIO): New flag.
* src/dd.c (O_FULLBLOCK): Add O_CIO to the list of flags that
O_FULLBLOCK should be greater than.
* src/dd.c (flags): Give the name "cio" to the new O_CIO flag, mirroring
the treatment of O_DIRECT.
* src/dd.c (usage): Add a description of the new flag when it is available.
* doc/coreutils.text (dd invocation): Describe the new flag.
* NEWS: Mention the new feature.

15 years agobuild: do enable $(WERROR_CFLAGS) for src/ files.
Jim Meyering [Mon, 22 Dec 2008 17:21:59 +0000 (18:21 +0100)]
build: do enable $(WERROR_CFLAGS) for src/ files.

This reverts the more recent commit (of two) entitled "build:
add configure-time --enable-gcc-warnings option; avoid warnings".
Pádraig Brady spotted the contradiction between the log message
and actual change.

This reverts commit 292d68565a34b237cd2bf586ace545b7cd3dbfcf.

15 years agodoc: stty: Clarification of some input and output settings
Pádraig Brady [Tue, 23 Dec 2008 11:55:46 +0000 (11:55 +0000)]
doc: stty: Clarification of some input and output settings

* doc/coreutils.texi (stty invocation): Clarify any
ambiguity in regard to the direction of input and output settings.
Add some notes on the case changing settings.
Most of the text was supplied by Dan Jacobson.

15 years agotimeout: remove problematic casts
Pádraig Brady [Tue, 23 Dec 2008 09:36:22 +0000 (09:36 +0000)]
timeout: remove problematic casts

* src/timeout.c (apply_time_suffix): Change input parameter from
unsigned int to unsigned long, which is the type of the variable it's
actually manipulating.  This removes the need for the cast which was
giving a warning with the gcc options: -fstrict-aliasing
-Wstrict-aliasing.  Also add a check for overflow possible on 16-bit
platforms, and fix indents.
(main): Remove a redundant cast in the alarm() call.

15 years ago* .x-sc_require_config_h: Remove obsolete regexps.
Jim Meyering [Sun, 21 Dec 2008 16:38:08 +0000 (17:38 +0100)]
* .x-sc_require_config_h: Remove obsolete regexps.

15 years agomaint.mk: enforce the "include <config.h> first" rule
Jim Meyering [Sun, 21 Dec 2008 16:37:22 +0000 (17:37 +0100)]
maint.mk: enforce the "include <config.h> first" rule

* maint.mk (sc_require_config_h_first): New rule.
* .x-sc_require_config_h_first: New file.

15 years agobuild: add configure-time --enable-gcc-warnings option; avoid warnings
Jim Meyering [Wed, 12 Nov 2008 10:11:54 +0000 (11:11 +0100)]
build: add configure-time --enable-gcc-warnings option; avoid warnings

* bootstrap.conf (gnulib_modules): Add "warnings" module.
* configure.ac: Add --enable-gcc-warnings, derived from code in bison.
* src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) # $(WERROR_CFLAGS)
* lib/Makefile.am (AM_CFLAGS): Change spelling to $(WARN_CFLAGS)
Don't use $(WERROR_CFLAGS), yet.
* src/system.h (usage): Declare.
* src/base64.c (usage): Declare to be global, for consistency.
* src/timeout.c (usage): Likewise.
* src/truncate.c (usage): Likewise.
* src/getlimits.c (usage): Likewise.
* src/pinky.c (ttyname): Declare with prototype, rather than an
empty argument list.
* src/who.c (ttyname): Likewise.
* src/su.c (crypt, getusershell, setusershell, endusershell): Likewise.

15 years agobuild: turn on $(WERROR_CFLAGS) for src/
Jim Meyering [Sun, 30 Nov 2008 21:41:50 +0000 (22:41 +0100)]
build: turn on $(WERROR_CFLAGS) for src/

15 years agobuild: add configure-time --enable-gcc-warnings option; avoid warnings
Jim Meyering [Wed, 12 Nov 2008 10:11:54 +0000 (11:11 +0100)]
build: add configure-time --enable-gcc-warnings option; avoid warnings

* bootstrap.conf (gnulib_modules): Add "warnings" module.
* configure.ac: Add --enable-gcc-warnings, derived from code in bison.
* src/Makefile.am (AM_CFLAGS): Set to $(WARN_CFLAGS) # $(WERROR_CFLAGS)
* lib/Makefile.am (AM_CFLAGS): Change spelling to $(WARN_CFLAGS)
Don't use $(WERROR_CFLAGS), yet.
* src/system.h (usage): Declare.
* src/base64.c (usage): Declare to be global, for consistency.
* src/timeout.c (usage): Likewise.
* src/truncate.c (usage): Likewise.
* src/getlimits.c (usage): Likewise.
* src/pinky.c (ttyname): Declare with prototype, rather than an
empty argument list.
* src/who.c (ttyname): Likewise.
* src/su.c (crypt, getusershell, setusershell, endusershell): Likewise.

15 years agodoc: Remove curly quotes from shell examples in man pages
Pádraig Brady [Wed, 17 Dec 2008 10:41:34 +0000 (10:41 +0000)]
doc: Remove curly quotes from shell examples in man pages

Use \(aq rather than a literal ' as groff will convert apostrophe
to a right quote (\u2029) in utf8 locales for example.
Stepan Kasal details the issue and fix here:
http://lists.gnu.org/archive/html/bug-coreutils/2008-12/msg00124.html

15 years agoChangeLog-2008: say ChangeLog files are no longer manually maintained
Jim Meyering [Tue, 16 Dec 2008 07:15:18 +0000 (08:15 +0100)]
ChangeLog-2008: say ChangeLog files are no longer manually maintained

and point to HACKING's policy.  Suggestion from Dan Jacobson.

15 years agodu: -H now does what POSIX requires
Jim Meyering [Tue, 9 Dec 2008 07:22:21 +0000 (08:22 +0100)]
du: -H now does what POSIX requires

* src/du.c (usage): Update --help output.
(main): Move -H-handling code from the --si block to
the one for --dereference-args (-D).
* doc/coreutils.texi (du invocation): Update description.
* NEWS (Changes in behavior): Mention this.

15 years agodoc: pr: formatting corrections
Jim Meyering [Sat, 13 Dec 2008 07:32:55 +0000 (08:32 +0100)]
doc: pr: formatting corrections

* doc/coreutils.texi (pr invocation): Fix some overzealous uses of @var.
Reported by Andreas Schwab.

15 years agomore portable bootstrap procedure
Ralf Wildenhues [Sat, 13 Dec 2008 09:24:18 +0000 (10:24 +0100)]
more portable bootstrap procedure

* bootstrap (get_version): Fix portability issues in sed script.
(check_versions): For buildreq apps, honor the corresponding
$APP variable like $AMTAR, $AUTOCONF.
(usage): Document this.
(update_po_files): Honor $SHA1SUM.
(main): Honor $AUTOPOINT, $ACLOCAL, $AUTOCONF, $AUTOHEADER,
$AUTOMAKE, $LIBTOOLIZE.

15 years agotests: ensure that chmod, chgrp and chown honor --silent
Jim Meyering [Sat, 29 Nov 2008 09:47:12 +0000 (10:47 +0100)]
tests: ensure that chmod, chgrp and chown honor --silent

* tests/chmod/silent: New file, to test all three programs.
* tests/Makefile.am (TESTS): Add chmod/silent.
* NEWS (Bug fixes): Mention this.
The bug was introduced in 96a5d2ce6a53d96cb667af78f13e56fadcdb91e6.

15 years agochmod, chown, chgrp: honor --silent (-f) once again
Ondřej Vašík [Thu, 27 Nov 2008 14:04:10 +0000 (15:04 +0100)]
chmod, chown, chgrp: honor --silent (-f) once again

* chmod.c (process_file): Make -f suppress fts-related diagnostics.
* chown-core.c (change_file_owner): Likewise.
Reported via <http://bugzilla.redhat.com/474220>.

15 years agowc: read and process --files0-from= input a name at a time,
Jim Meyering [Tue, 25 Nov 2008 17:38:26 +0000 (18:38 +0100)]
wc: read and process --files0-from= input a name at a time,

when the file name list is not too large.  Before, wc would always read
the entire file name list into memory and *then* process each file name.
wc does read the list into memory when the list is known not to be too
large; this is done in order to be able to align the output numbers,
as it does with arguments specified on the command-line
* src/wc.c: Include "argv-iter.h".
(main): Rewrite to use argv-iter when the input file name list
is known to be too large.
* NEWS (Bug fixes): Mention it.

15 years agodu: read and process --files0-from= input a name at a time,
Jim Meyering [Mon, 24 Nov 2008 08:55:55 +0000 (09:55 +0100)]
du: read and process --files0-from= input a name at a time,

rather than by reading the entire input into memory and *then*
processing each file name.
* src/du.c: Include "argv-iter.h", not "readtokens0.h".
(main): Rewrite to use argv-iter.
Call xfts_open on each argument, rather than on the entire
argv list at once.
Call print_size here, not from du_files.
Diagnose read failure.
* NEWS (Bug fixes): Mention it.
* THANKS: update.
Reported by Barry Kelly.  More details in
http://article.gmane.org/gmane.comp.gnu.core-utils.bugs/15159/

15 years agoseq: plug a leak
Jim Meyering [Mon, 1 Dec 2008 21:39:58 +0000 (22:39 +0100)]
seq: plug a leak

* src/factor.c (emit_ul_factor): Call mpz_clear.

15 years agoavoid warnings about initialization of automatic aggregates
Jim Meyering [Sun, 30 Nov 2008 21:37:42 +0000 (22:37 +0100)]
avoid warnings about initialization of automatic aggregates

* src/system.h (DZA_CONCAT0, DZA_CONCAT): New macros.
(DECLARE_ZEROED_AGGREGATE): New macro.
* src/ls.c (quote_name): Use it.
* src/pathchk.c (portable_chars_only): Use it.
* src/shred.c (main): Use it.
* src/stty.c (main): Use it.
* src/wc.c (SUPPORT_OLD_MBRTOWC): Use it.

15 years ago* bootstrap.conf (gnulib_modules): Add argv-iter.
Jim Meyering [Sun, 30 Nov 2008 19:21:28 +0000 (20:21 +0100)]
* bootstrap.conf (gnulib_modules): Add argv-iter.

15 years agoargv-iter: add tests
Jim Meyering [Wed, 26 Nov 2008 21:51:09 +0000 (22:51 +0100)]
argv-iter: add tests

* gl/modules/argv-iter-tests: New module.
* gl/tests/test-argv-iter.c: New file.

15 years agoargv-iter: new module
Jim Meyering [Mon, 24 Nov 2008 13:11:15 +0000 (14:11 +0100)]
argv-iter: new module

* gl/lib/argv-iter.h: New file.
* gl/lib/argv-iter.c: New file.
* gl/modules/argv-iter: New file.
With a suggestion for improved memory management by Pádraig Brady.

15 years ago* src/hostname.c (sethostname) [!HAVE_SETHOSTNAME]: Remove declaration.
Jim Meyering [Mon, 1 Dec 2008 06:27:55 +0000 (07:27 +0100)]
* src/hostname.c (sethostname) [!HAVE_SETHOSTNAME]: Remove declaration.

15 years agocp, mv: remove 3-year-deprecated+warned-about --reply option
Jim Meyering [Wed, 8 Oct 2008 06:51:38 +0000 (08:51 +0200)]
cp, mv: remove 3-year-deprecated+warned-about --reply option

* src/cp.c (reply_args, reply_vals): Remove globals.
[REPLY_OPTION]: Remove enum.
(long_opts) ["reply"]: Remove initializer.
(main): Remove case stmt.
* src/mv.c: Likewise.
Don't include "argmatch.h".  No longer used.
* NEWS (Changes in behavior): Mention this.
* tests/Makefile.am (TESTS): Remove mv/reply-no.
* tests/mv/reply-no: Remove file.
* tests/mv/i-link-no: Update, now that --reply= is gone.

15 years agodoc: Make descriptions of ASCII NUL and --zero-terminated option consistent
Pádraig Brady [Mon, 1 Dec 2008 10:41:50 +0000 (10:41 +0000)]
doc: Make descriptions of ASCII NUL and --zero-terminated option consistent

doc/coretuils.texi: Refactor shuf, sort and uniq --zero-terminated
option to use the same text. Also refer to NUL characters as
@acronym{ASCII} @sc{nul} consistently.

15 years agodoc: enforce @var{lower} policy
Jim Meyering [Mon, 1 Dec 2008 08:17:51 +0000 (09:17 +0100)]
doc: enforce @var{lower} policy

* doc/coreutils.texi: Fix remaining violations.
* doc/Makefile.am (sc-lower-case-var): New rule.
Add some command-suppressing "@" directives so that a successful
"make check" run is less noisy.

15 years agodoc: Tweak info docs to standarise on lower-case @var{file}
Pádraig Brady [Mon, 1 Dec 2008 02:29:57 +0000 (02:29 +0000)]
doc: Tweak info docs to standarise on lower-case @var{file}

* doc/coreutils.texi: s/@var{FILE}/@var{file}/

15 years agodoc: Improve description of --files0-from option
Pádraig Brady [Mon, 1 Dec 2008 02:09:19 +0000 (02:09 +0000)]
doc: Improve description of --files0-from option

* doc/coreutils.texi: Describe the most common
usage of --files0-from=- to read names from stdin.
* src/du.c: Likewise.
* src/sort.c: Likewise.
* src/wc.c: Likewise.

15 years agotests: dd/reblock: Reduce chance of timing related failures
Pádraig Brady [Mon, 1 Dec 2008 01:08:02 +0000 (01:08 +0000)]
tests: dd/reblock: Reduce chance of timing related failures

* tests/dd/reblock: Change the IPC mechanism to the dd process
under test, from pipes to fifos. Also change the delay
between data writes to 0.2s for both tests.
This should increase the chance that the dd process
will read the data chunks separately.

15 years agom4: avoid a warning from gcc's -Wstrict-prototypes
Jim Meyering [Sun, 30 Nov 2008 16:39:11 +0000 (17:39 +0100)]
m4: avoid a warning from gcc's -Wstrict-prototypes

* m4/jm-macros.m4 (ARGMATCH_DIE_DECL): Use proper prototype for usage.

15 years agotests: df: skip total-verify if df fails
Jim Meyering [Sat, 29 Nov 2008 10:22:00 +0000 (11:22 +0100)]
tests: df: skip total-verify if df fails

* tests/df/total-verify: Skip the test if df fails.

15 years agobuild: don't reject definition of STREQ
Jim Meyering [Fri, 28 Nov 2008 21:08:09 +0000 (22:08 +0100)]
build: don't reject definition of STREQ

* maint.mk (sc_prohibit_strcmp): Tighten rule: exclude
macro definitions like the one in system.h.
* .x-sc_prohibit_strcmp: Don't exempt src/system.h.

15 years agotests: start long-running cp/link-heap earlier
Jim Meyering [Fri, 28 Nov 2008 20:32:39 +0000 (21:32 +0100)]
tests: start long-running cp/link-heap earlier

* tests/Makefile.am (TESTS): Move cp/link-heap nearer the start of the
list, so that its termination doesn't delay a parallel "make check".

15 years agotests: avoid failure of cp/link-heap on some systems
Jim Meyering [Mon, 24 Nov 2008 09:03:25 +0000 (10:03 +0100)]
tests: avoid failure of cp/link-heap on some systems

* tests/cp/link-heap: Raise virtual memory limit from 10,000
to 14,000, to avoid failure on Debian/unstable (libc6 2.7-16).

15 years agoremove explicit declaration of putenv, ...
Jim Meyering [Wed, 12 Nov 2008 10:02:50 +0000 (11:02 +0100)]
remove explicit declaration of putenv, ...

* src/date.c: ... now that gnulib guarantees that it's in <stdlib.h>.
* src/env.c: Likewise.

15 years agotests: dd/reblock: avoid occasional failure
Jim Meyering [Sun, 30 Nov 2008 17:43:55 +0000 (18:43 +0100)]
tests: dd/reblock: avoid occasional failure

* tests/dd/reblock: Sleep longer to avoid a race condition.
Reported by Bob Proulx.

15 years agopwd: add pwd -P, -L to TODO
James Youngman [Thu, 27 Nov 2008 10:20:18 +0000 (10:20 +0000)]
pwd: add pwd -P, -L to TODO

* TODO: Add to-do entry for -P and -L options of pwd.

15 years agodoc: fix typo in units factorization, removed TODO items
Ondřej Vašík [Wed, 26 Nov 2008 15:00:57 +0000 (16:00 +0100)]
doc: fix typo in units factorization, removed TODO items

* doc/coreutils: switch typo (switched gibibytes/gigabytes)
* TODO:          removed missing chcon and runcon documentation from list

15 years agodoc: factor out list of suffix-to-number (e.g., KB->1000B) mappings
Jim Meyering [Wed, 26 Nov 2008 14:02:58 +0000 (15:02 +0100)]
doc: factor out list of suffix-to-number (e.g., KB->1000B) mappings

* coreutils.texi (multiplierSuffixes, multiplierSuffixesNoBlocks):
New macros.
(od invocation, head invocation, tail invocation, split invocation):
(truncate invocation): Use them.

15 years agodoc: tail: one more s/bytes/n/ change
Jim Meyering [Wed, 26 Nov 2008 06:12:50 +0000 (07:12 +0100)]
doc: tail: one more s/bytes/n/ change

* doc/coreutils.texi (tail invocation): Make one more
@var{bytes} -> @var{n} change.

15 years agodoc: tail: fix description of --bytes=N (-c)
Pádraig Brady [Wed, 26 Nov 2008 14:27:09 +0000 (14:27 +0000)]
doc: tail: fix description of --bytes=N (-c)

* doc/coreutils.texi (tail invocation): Use @var{n} consistently,
not a mix of that and @var{bytes}.  Reported by anonymous
in <http://savannah.gnu.org/bugs/?24934>.

15 years agodoc: move @shortcontents and @contents from end to start
Karl Berry [Sun, 23 Nov 2008 11:45:40 +0000 (12:45 +0100)]
doc: move @shortcontents and @contents from end to start

* doc/coreutils.texi: Move @shortcontents and @contents from the
end to the beginning, just after "@end titlepage".

15 years agodoc (stat): clarify: there are two sets of format directives
Jim Meyering [Sun, 23 Nov 2008 11:33:02 +0000 (12:33 +0100)]
doc (stat): clarify: there are two sets of format directives

* doc/coreutils.texi (stat invocation): Clarify description of
--file-system format directives.

15 years agodoc (stat): correct formatting in coreutils.texi
Karl Berry [Sun, 23 Nov 2008 11:29:24 +0000 (12:29 +0100)]
doc (stat): correct formatting in coreutils.texi

* doc/coreutils.texi (stat invocation): Move the list of regular,
non-file-system, format directives from the description of --terse,
out of the enclosing table.

15 years agotests: dd: add a test for the required behavior
Jim Meyering [Fri, 21 Nov 2008 22:12:17 +0000 (23:12 +0100)]
tests: dd: add a test for the required behavior

* tests/dd/reblock: New file.  Test for the required functionality.
Based on an example and discussion from this thread:
http://lists.gnu.org/archive/html/bug-coreutils/2008-11/msg00153.html
* tests/Makefile.am (TESTS): Add dd/reblock.

15 years agoRevert part of "dd: avoid unnecessary memory copies"
Pádraig Brady [Fri, 21 Nov 2008 22:17:44 +0000 (23:17 +0100)]
Revert part of "dd: avoid unnecessary memory copies"

This reverts part of commit fbd87029cfc494a72bb73ade27ef46382c5bc832.
Paul Eggert noticed the problem in
http://lists.gnu.org/archive/html/bug-coreutils/2008-11/msg00153.html
* doc/coreutils.texi (dd invocation): Clarify.

15 years agogetlimits: A new utility for use in coreutils' tests
Pádraig Brady [Thu, 20 Nov 2008 11:02:15 +0000 (11:02 +0000)]
getlimits: A new utility for use in coreutils' tests

* src/getlimits.c: A utility to print platform dependent
limits in a format suitable for use in shell scripts.
* src/Makefile.am: Add getlimits to list of utilities
to build but not install. Also add it to the list linked
with libiconv
* po/POTFILES.in: Add getlimits to translation list.

15 years agodd: avoid unnecessary memory copies
Pádraig Brady [Thu, 20 Nov 2008 22:49:02 +0000 (22:49 +0000)]
dd: avoid unnecessary memory copies

* src/dd.c (scanargs): When not otherwise required (e.g. for
conversion), use two-buffer mode only when the input and output
buffer sizes differ.  Before, some of the most basic invocations of
dd, e.g., dd < in > out, would unnecessarily use separate buffers
and perform memory copies between them.

15 years agocp: use far less memory in some cases
Jim Meyering [Wed, 19 Nov 2008 18:36:45 +0000 (19:36 +0100)]
cp: use far less memory in some cases

cp --link was "remembering" many name,dev,inode triples unnecessarily.
cp was doing the same, even without --link, for every directory in the
source hierarchy, while it can do its job with entries merely for the
command-line arguments.  Prompted by a report from Patrick Shoenfeld.
Details <http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/15081>.
* src/copy.c (copy_internal): Refrain from remembering
name,dev,inode for most files, when invoked via cp --link.
Record an infloop-avoidance triple for each directory specified
on the command line, not for each directory in the source tree.
Don't record a dir-triple when x->hard_link is set.
* NEWS (Buf fixes): Mention it.
* tests/cp/link-heap: New file.  Test for cp's lowered memory usage.
* tests/Makefile.am (TESTS): Add link-heap.

15 years agotests: add a test of cp --preserve=links
Jim Meyering [Wed, 19 Nov 2008 18:16:34 +0000 (19:16 +0100)]
tests: add a test of cp --preserve=links

* tests/cp/link-preserve: Add a case and comments.

15 years agocp: remove unused code
Jim Meyering [Wed, 19 Nov 2008 09:24:52 +0000 (10:24 +0100)]
cp: remove unused code

* src/cp-hash.c (remember_created): Remove unused function.
Remove thus-obviated headers: <stdio.h>, "quote.h", "error.h".
* src/cp-hash.h (remember_created): Remove declaration.

15 years agodoc: HACKING: reference http://www.gnu.org/licenses/why-assign.html
Jim Meyering [Mon, 17 Nov 2008 10:16:19 +0000 (11:16 +0100)]
doc: HACKING: reference gnu.org/licenses/why-assign.html

Suggestion from Patrick Schoenfeld.

15 years agotests: remove debug code that would try to write into /t/k-env
Jim Meyering [Sun, 16 Nov 2008 09:45:18 +0000 (10:45 +0100)]
tests: remove debug code that would try to write into /t/k-env

* tests/ls/no-cap: Remove debugging "tee".

15 years agotests: change misc/printf-surprise so that it doesn't segfault anymore
Jim Meyering [Sun, 16 Nov 2008 08:53:48 +0000 (09:53 +0100)]
tests: change misc/printf-surprise so that it doesn't segfault anymore

* tests/misc/printf-surprise: Disable MALLOC_PERTURB_, so that "make
check" no longer provokes a segfault from printf(1).  Before, that
would be detected as a known problem and cause the test to be skipped.
Adjust the test so that a segfault once again results in test failure.

15 years agotests: remove df/total
Jim Meyering [Wed, 12 Nov 2008 12:29:38 +0000 (13:29 +0100)]
tests: remove df/total

* tests/df/total: Remove file.
* tests/Makefile.am (TESTS): Remove df/total.
It is subsumed by df/total-verify.

15 years ago* tests/df/total-verify [VERBOSE]: Run df --version, not ls --version.
Ondřej Vašík [Wed, 12 Nov 2008 12:27:23 +0000 (13:27 +0100)]
* tests/df/total-verify [VERBOSE]: Run df --version, not ls --version.

15 years agoavoid spurious test failure when df always fails
Jim Meyering [Wed, 12 Nov 2008 11:53:54 +0000 (12:53 +0100)]
avoid spurious test failure when df always fails

* tests/df/total-verify: Skip upon _df_ failure, not tee failure.
Reported by Ondřej Vašík.  Details in
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/15028>.

15 years agojm-macros.m4: avoid syntax issue with newer autoconf
Eric Blake [Tue, 11 Nov 2008 17:44:59 +0000 (10:44 -0700)]
jm-macros.m4: avoid syntax issue with newer autoconf

* jm-macros.m4 (coreutils_MACROS): Make LIB_CAP assignment persistent.

Signed-off-by: Eric Blake <ebb9@byu.net>
15 years agoUpdate references to GFDL: 1.2 -> 1.3
Jim Meyering [Tue, 11 Nov 2008 08:51:30 +0000 (09:51 +0100)]
Update references to GFDL: 1.2 -> 1.3

* doc/coreutils.texi: Likewise.
* doc/perm.texi: Likewise.
* old/fileutils/NEWS: Likewise.
* old/sh-utils/NEWS: Likewise.
* old/textutils/NEWS: Likewise.

15 years agomake --help print "Report PROGRAM translation bugs to <...>."
Jim Meyering [Sun, 9 Nov 2008 16:15:57 +0000 (17:15 +0100)]
make --help print "Report PROGRAM translation bugs to <...>."

for all but the C/POSIX locale.
* src/system.h: Include "hard-locale.h".
(emit_bug_reporting_address): Tell where to report translation bugs.

don't include "hard-locale.h", now that system.h does
* src/comm.c: Likewise.
* src/join.c: Likewise.
* src/ls.c: Likewise.
* src/pinky.c: Likewise.
* src/pr.c: Likewise.
* src/sort.c: Likewise.
* src/uniq.c: Likewise.
* src/who.c: Likewise.

15 years agoavoid warnings about discarding "qualifiers from pointer target type"
Jim Meyering [Tue, 28 Oct 2008 21:06:44 +0000 (22:06 +0100)]
avoid warnings about discarding "qualifiers from pointer target type"

Use the new "bad_cast" function or an actual cast-to-"(char *)"
to avoid warnings.
* src/system.h (bad_cast): Define.
* src/chown.c (main):
* src/chroot.c (main):
* src/date.c (main):
* src/du.c (main):
* src/expand.c (stdin_argv):
* src/ls.c (decode_switches):
* src/md5sum.c (main):
* src/paste.c (main):
* src/pr.c (col_sep_string, column_separator, line_separator, main):
* src/sort.c (main):
* src/split.c (main):
* src/tail.c (main):
* src/unexpand.c (stdin_argv):
* src/yes.c (main):

15 years agoavoid a compiler warning
Jim Meyering [Tue, 28 Oct 2008 21:00:39 +0000 (22:00 +0100)]
avoid a compiler warning

(strip_program): Declare to be const.

15 years agouse xfreopen in place of unchecked freopen
Jim Meyering [Sun, 12 Oct 2008 12:50:02 +0000 (14:50 +0200)]
use xfreopen in place of unchecked freopen

* bootstrap.conf (modules): Add xfreopen.
* src/cat.c (main): Include "xfreopen.h".  Use xfreopen.
* src/cksum.c (cksum): Likewise.
* src/head.c (head_file, main): Likewise.
* src/md5sum.c (digest_file): Likewise.
* src/od.c (open_next_file): Likewise.
* src/split.c (type_undef): Likewise.
* src/sum.c (bsd_sum_file, sysv_sum_file): Likewise.
* src/tac.c (tac_file, main): Likewise.
* src/tail.c (tail_file, main): Likewise.
* src/tee.c (tee_files): Likewise.
* src/tr.c (main): Likewise.
* src/wc.c (wc_file): Likewise.
* po/POTFILES.in: Add lib/xfreopen.c

15 years agoxfreopen: new module
Jim Meyering [Sun, 12 Oct 2008 13:36:28 +0000 (15:36 +0200)]
xfreopen: new module

* gl/lib/xfreopen.c: New file.
* gl/lib/xfreopen.h: New file.
* gl/modules/xfreopen: New file.

15 years agoUpdate URL: s!www.iro.umontreal.ca!translationproject.org/team/...!
Jim Meyering [Sun, 9 Nov 2008 14:35:51 +0000 (15:35 +0100)]
Update URL: s!iro.umontreal.ca!translationproject.org/team/...!

* Makefile.am (THANKS-to-translators): Update URL template.

15 years agoinstall: indicate clearly it's not for installing packages
James Youngman [Sat, 8 Nov 2008 21:55:50 +0000 (21:55 +0000)]
install: indicate clearly it's not for installing packages

* src/install.c (usage): Indicate the program copies files,
as opposed to installing packages.

15 years agoemit more precise bug-reporting instructions
Jim Meyering [Sat, 8 Nov 2008 18:59:52 +0000 (19:59 +0100)]
emit more precise bug-reporting instructions

Hoping that this will decrease the volume of bug reports
mistakenly directed to the coreutils mailing list.
* src/system.h (emit_bug_reporting_address): Specify the program
name in the "Report bugs to <...>." line in each program's --help
output and man page.  Now, it will say "Report PROGRAM_NAME bugs
to <...>."  Suggestion from Ondřej Vašík.

16 years agoinclude gnulib's strdup module explicitly
Jim Meyering [Wed, 5 Nov 2008 18:18:59 +0000 (19:18 +0100)]
include gnulib's strdup module explicitly

* bootstrap.conf (gnulib_modules): Include strdup explicitly, to
keep the latest version of gnulib-tool from omitting this now-marked-
as-obsolete module.

16 years agols: --color now highlights hard linked files, too
Kamil Dudka [Mon, 27 Oct 2008 14:38:23 +0000 (15:38 +0100)]
ls: --color now highlights hard linked files, too

* src/ls.c (print_color_indicator): Colorize hard linked files.
* src/dircolors.c: Add color for hard link.
* src/dircolors.hin: Add color for hard link.
* tests/ls/hardlink: Test for ls - colorize hard linked files.
* tests/Makefile.am (TESTS): Add ls/hardlink.
* NEWS: Mention the change.

16 years agotests: ls/stat-failed: don't discard stderr.
Jim Meyering [Tue, 28 Oct 2008 08:24:01 +0000 (09:24 +0100)]
tests: ls/stat-failed: don't discard stderr.

* tests/ls/stat-failed: Let stderr be recorded, to ease debugging.

16 years agotests: seq: check for today's extended long double fix
Jim Meyering [Sat, 25 Oct 2008 09:34:14 +0000 (11:34 +0200)]
tests: seq: check for today's extended long double fix

* tests/misc/seq-long-double: New file.  Test for today's bug fix.
* tests/check.mk (TESTS_ENVIRONMENT): Export CC definition.
* tests/Makefile.am (TESTS): Add misc/seq-long-double.
* NEWS (Bug fixes): Mention it.

16 years agoseq: improve quality of format-checking code
Paul Eggert [Sun, 26 Oct 2008 07:45:18 +0000 (00:45 -0700)]
seq: improve quality of format-checking code

* src/seq.c (validate_format): Remove. Migrate its checks into...
(long_double_format): Report an error and exit if an error is found,
instead of returning NULL.  All callers changed.
Use a more-consistent format for diagnostics.
* tests/misc/seq: Adjust to the more-consistent format for diagnostics.

16 years agofactor: avoid compilation failure without libgmp
Jim Meyering [Sat, 25 Oct 2008 20:51:54 +0000 (22:51 +0200)]
factor: avoid compilation failure without libgmp

* src/factor.c (debug) [!HAVE_GMP]: Define.
Reported by Bob Proulx.

16 years agofactor: remove --bignum and --no-bignum options
Paul Eggert [Fri, 24 Oct 2008 20:43:40 +0000 (22:43 +0200)]
factor: remove --bignum and --no-bignum options

Here's a patch to remove the --bignum and --no-bignum options from
'factor'.  The case for removing --bignum isn't as strong as that for
'expr', but still, it seems to me that these options are not needed and
complicate the documentation unnecessarily.

* doc/coreutils.texi (factor invocation): Remove --bignum, --no-bignum.
* src/factor.c (algorithm, ALGORITHM_CHOICE, USE_BIGNUM, NO_USE_BIGNUM):
Remove; all uses removed.
(extract_factors_multi): Remove, replacing with....
(print_factors_multi): New function, with signature similar to that
of new signature of print_factors_single.
(print_factors_single): Migrate checking code to caller.
(print_factors): Use GMP if it's available; don't bother asking user.
Improve accuracy of check for "large" numbers.
(long_options, main): Remove support for --bignum.

16 years agotests: df/total: don't fail for an inaccessible mount point
Jim Meyering [Sat, 25 Oct 2008 14:30:54 +0000 (16:30 +0200)]
tests: df/total: don't fail for an inaccessible mount point

* tests/df/total: Ignore nonzero exit status from df.

16 years agoseq: revert Solaris 8 work-around that caused x86 regression
Paul Eggert [Sat, 25 Oct 2008 05:52:22 +0000 (22:52 -0700)]
seq: revert Solaris 8 work-around that caused x86 regression

* src/seq.c: Don't include <math.h>, <float.h>.
(abs_rel_diff): Remove.
(print_numbers): Test for equality, not for an epsilonish value.
This reverts 4827dd27b0c655a685947aaa01426a5ecba179f3, aka
v6.10-185-g4827dd2, which broke 'seq' on the x86; for example, it
causes "seq 9223372036854775807 9223372036854775808" to incorrectly
output 3 numbers instead of 2.  It's better to punish obsolescent
hosts that have incorrectly-working floating-point than to punish
correctly-working hosts.
* tests/misc/seq: Use 0.9000000000000, rather than
0.90000000000000000000, to avoid tickling a bug in Solaris 8 strtold,
which converts "0.9" and "0.9000000000000" correctly, but incorrectly
converts "0.90000000000000000000" to a smaller value.

16 years agogroup-list: avoid compiler warning
Eric Blake [Fri, 24 Oct 2008 17:42:29 +0000 (11:42 -0600)]
group-list: avoid compiler warning

* src/group-list.c (print_group_list) [!HAVE_GETGROUPS]: Always
return value.

16 years agols: use '.' (not +) as SELinux-only alt. access flag in ls -l output
Jim Meyering [Wed, 2 Apr 2008 20:26:45 +0000 (22:26 +0200)]
ls: use '.' (not +) as SELinux-only alt. access flag in ls -l output

* src/ls.c (gobble_file) [long_format]: Map SELinux-only to '.',
any other nonempty combination of MAC and ACL to '+', and all else
to the usual ' '.  Suggested by Michael Stone.
* tests/misc/selinux: Adapt: expect '.', not '+'.
* doc/coreutils.texi (What information is listed): Document this.
* NEWS (Changes in behavior): Mention it.

16 years agoRemove lzma as a specific build requirement
Pádraig Brady [Wed, 22 Oct 2008 21:13:49 +0000 (22:13 +0100)]
Remove lzma as a specific build requirement

* bootstrap.conf: lzma was added as a build requirement
in the recently added build tools requirements check.
Remove that as it's quite new and also only required
for the make dist stage.

16 years ago* src/ls.c (usage): Describe exit statuses more concisely.
Paul Eggert [Wed, 22 Oct 2008 16:40:56 +0000 (18:40 +0200)]
* src/ls.c (usage): Describe exit statuses more concisely.

16 years agoAdd better checks and docs for build tools
Pádraig Brady [Tue, 21 Oct 2008 21:40:12 +0000 (22:40 +0100)]
Add better checks and docs for build tools

Prompted by a report from Ed Avis:
<http://thread.gmane.org/gmane.comp.gnu.coreutils.bugs/14710>

* README-hacking: Organise LZMA and Valgrind as
as optional requirements rather than in their own sections.
Mention bootstrap will now check tool versions.
* README-prereq: Make a start on specific instructions
for optaining build tools. Currently we just have notes
for Fedora linux.
* bootstrap.conf: Add the list of tools and versions required.
* bootstrap: Add the logic to check for the required tools,
and list all required tools and versions if any are missing.

16 years agoclean up gl/modules/selinux-at
Jim Meyering [Wed, 22 Oct 2008 10:44:17 +0000 (12:44 +0200)]
clean up gl/modules/selinux-at

* gl/modules/selinux-at:
Ensure that LIB_SELINUX is cleared, in case it's set in the environment.
m4-quote the first two args to AC_SEARCH_LIBS.
Don't violate autoconf's ac_ namespace: s/ac_save/gl_save/
Drop the useless double quotes around a simple assignment RHS.

16 years agomove selinux-h module from gl/ to gnulib
Jim Meyering [Tue, 21 Oct 2008 14:10:31 +0000 (16:10 +0200)]
move selinux-h module from gl/ to gnulib

* gl/lib/se-context.in.h: Remove file.
* gl/lib/se-selinux.in.h: Likewise.
* gl/m4/selinux-context-h.m4: Likewise.
* gl/m4/selinux-selinux-h.m4: Likewise.
* gl/modules/selinux-h: Likewise.

16 years agoprepare to move selinux-h module to gnulib
Jim Meyering [Tue, 21 Oct 2008 13:38:48 +0000 (15:38 +0200)]
prepare to move selinux-h module to gnulib

* gl/modules/selinux-h (Makefile.am)
[selinux/selinux.h, selinux/context.h]:
Remove temporary file and target, in case they're read-only.
Use $(MKDIR_P), not mkdir -p.
(License): Relax to LGPLv2+.
Remove vestigial comments.

16 years agotests: test today's ls-vs-capability fix
Jim Meyering [Tue, 21 Oct 2008 11:09:13 +0000 (13:09 +0200)]
tests: test today's ls-vs-capability fix

Test for this fix: f3f1ccfd871ee395e7fafc051c1b7dedb39fdfc9.
* tests/Makefile.am (TESTS): Add ls/no-cap.
* tests/ls/no-cap: New file.

16 years agols: make it possible to disable file capabilities checking
Kamil Dudka [Mon, 20 Oct 2008 13:39:07 +0000 (15:39 +0200)]
ls: make it possible to disable file capabilities checking

* ls.c (print_color_indicator): Do not check for file capability
if that attribute is not being colored.
Since 84f6abfe00b4ab533145623638b417a2221f9c75, ls --color would check
each file for "capabilities".  In <http://bugzilla.redhat.com/467508>,
James Antill reported that ls --color seemed slower with capabilities
detection.

16 years agoreflect gnulib's removal of lstat.h
Jim Meyering [Tue, 21 Oct 2008 05:55:09 +0000 (07:55 +0200)]
reflect gnulib's removal of lstat.h

* src/copy.h: Don't include "lstat.h".
* src/ls.c: Likewise.
* src/remove.c: Likewise.
* src/rm.c: Likewise.

16 years agoexpr: Fixup authors
Pádraig Brady [Thu, 16 Oct 2008 18:09:59 +0000 (19:09 +0100)]
expr: Fixup authors

* src/expr.c: Standardise the format of AUTHORS to
that used in other utils with multiple authors.
Also add Paul Eggert since he basically rewrote it
with his bignum fixes.
* AUTHORS (expr): Add Paul Eggert.

16 years agoaccommodate gnulib header removals
Jim Meyering [Sun, 19 Oct 2008 11:35:16 +0000 (13:35 +0200)]
accommodate gnulib header removals

* src/copy.c: Don't include "euidaccess.h" or "lchmod.h".
* src/cp.c: Don't include "lchmod.h".
* src/ls.c: Don't include "dirfd.h".
* src/mkdir.c: Don't include "lchmod.h".
* src/pwd.c: Don't include "dirfd.h".
* src/remove.c: Don't include "dirfd.h" or "euidaccess.h".
* src/test.c: Don't include "euidaccess.h".
* gl/modules/getloadavg.diff: Adjust diff for changed context.
* src/uptime.c (uptime): Remove declaration.

16 years ago* maint.mk (coreutils-path-check): New definition, now run
Jim Meyering [Sat, 18 Oct 2008 10:55:04 +0000 (12:55 +0200)]
* maint.mk (coreutils-path-check): New definition, now run

only if src/true.c exists.  Factored out of...
(my-distcheck):  ...here.

16 years agomaint: avoid warning in ls.c
Jim Meyering [Wed, 8 Oct 2008 12:04:20 +0000 (14:04 +0200)]
maint: avoid warning in ls.c

* src/ls.c (has_capability) [!HAVE_CAP]: Add unused attribute.

16 years agomaint: avoid warnings due to attribute warn_unused_result
Jim Meyering [Wed, 8 Oct 2008 08:44:12 +0000 (10:44 +0200)]
maint: avoid warnings due to attribute warn_unused_result

Now that a (void) cast no longer suffices to ignore warnings from gcc
about uses of functions marked with the warn_unused_result attribute,
we need an alternative.  For the record, here's one of the ignorable
warnings: "copy.c:233: warning: ignoring return value of 'fchown',
declared with attribute warn_unused_result"
* bootstrap.conf (gnulib_modules): Import ignore-value.
* src/copy.c: Include "ignore-value.h".
(set_owner): Use ignore_value in place of "(void)" casts,
to ignore lchown and fchown failures.
* src/cp.c (re_protect): Likewise, to ignore lchown failure.
* src/remove.c (preprocess_dir): Remove unnecessary "(void)" cast.

16 years agomktemp: diagnose freopen failure
Jim Meyering [Sun, 12 Oct 2008 14:09:00 +0000 (16:09 +0200)]
mktemp: diagnose freopen failure

* src/mktemp [--quiet]: Don't ignore freopen failure.

16 years ago* src/mktemp.c (main): Add 'const' twice to avoid GCC warning.
Paul Eggert [Thu, 16 Oct 2008 20:27:08 +0000 (22:27 +0200)]
* src/mktemp.c (main): Add 'const' twice to avoid GCC warning.

16 years agobuild: when po-check fails, say why and suggest a fix
Jim Meyering [Thu, 16 Oct 2008 12:22:46 +0000 (14:22 +0200)]
build: when po-check fails, say why and suggest a fix

* maint.mk (po-check): Before, when this check failed, it just
spat out a diff mentioning two temporary files.  Now, it tells
you what's wrong and suggests a fix with a patch using the name
of the affected file (rather than temporary file names) in the
diff output.

16 years agocsplit: prefer sigaction over signal
Eric Blake [Tue, 14 Oct 2008 04:04:51 +0000 (22:04 -0600)]
csplit: prefer sigaction over signal

* bootstrap.conf (gnulib_modules): Import sigaction.
* src/csplit.c (sigprocmask, siginterrupt) [SA_NOCLDSTOP]: Delete
workarounds.
(interrupt_handler, main): Drop use of signal.  Rely on sigaction
to block fatal signal during cleanup, and to restore it to default
in case of nested signals.

16 years agotests: add option processing tests for 'expr'
Pádraig Brady [Wed, 15 Oct 2008 14:01:43 +0000 (15:01 +0100)]
tests: add option processing tests for 'expr'

* tests/misc/expr: Add tests for various combinations
of options where the first part of the expression
could be confused with an option.

16 years agoexpr: remove --bignum and --no-bignum options
Paul Eggert [Wed, 15 Oct 2008 13:29:38 +0000 (15:29 +0200)]
expr: remove --bignum and --no-bignum options

* doc/coreutils.texi (expr invocation): Remove the --bignum and
--no-bignum options.  They weren't really needed, and they broke
longstanding (albeit nonportable) scripts.
* src/expr.c: Don't include <assert.h>.  Include "inttostr.h",
"long-options.h", "verify.h".  Check at compile-time that
size_t fits in unsigned long int, as the code assumes this in
several places.
(HAVE_GMP): Define to 0 if not defined, for convenience.
(mpz_t, mpz_clear, mpz_init_set_ui, mpz_init_set_str, mpz_add):
(mpz_sub, mpz_mul, mpz_tdiv_q, mpz_tdiv_r, mpz_get_str, mpz_sgn):
(mpz_fits_ulong_p, mpz_get_ui, mpz_out_str):
Supply substitutes when !HAVE_GMP, which work well enough for
expr's purposes.
(mp_integer): Remove.  All integers are gmp, if gmp is available.
(struct valinfo): Remove 'z' member; no longer needed.  The 'i'
member is always of type mpz_t.
(enum arithmetic_mode, MP_NEVER, MP_ALWAYS, MP_AUTO, mode):
Remove; no longer needed.
(usage): Remove documentation of --bignum and --no-bignum.
(integer_overflow): Abort if error misbehaves, to pacify GCC.
Restore old message on arithmetic overflow, to be conservative.
(die): Omit exit_status parameter; not needed (is always EXPR_FAILURE).
(string_too_long, USE_BIGNUM, NO_USE_BIGNUM, long_options):
Remove; no longer needed.
(main): Don't use getopt_long; this breaks old nonportable scripts.
(int_value): Arg is unsigned, in case we have strings whose length
exceeds LONG_MAX (!).
(int_value, freev, printv, null, tostring, toarith):
(eval6, eval4, eval3):
Always use mpz_ functions, to simplify the code.
(substr_value): Remove; no longer needed.
(getsize): Simplify the API: one arg rather than 3.  Don't assume
unsigned long int fits in size_t.
(promote, domult, dodivide, doadd): Remove; no longer needed.
* tests/misc/expr: Don't use --bignum to test for bignum support.
Instead, use big numbers to test this.