Karl Berry [Fri, 4 Jan 2013 18:17:55 +0000 (18:17 +0000)]
doc: remove stale pr news in the manual
* coreutils.texi (pr invocation): remove list of ancient news
items; the main documentation already covers what is needed.
Jim Meyering [Tue, 1 Jan 2013 02:54:51 +0000 (03:54 +0100)]
maint: update all copyright year number ranges
Run "make update-copyright", but then also run this,
perl -pi -e 's/2\d\d\d-//' tests/sample-test
to make that one script use the single most recent year number.
Jim Meyering [Tue, 1 Jan 2013 02:54:41 +0000 (03:54 +0100)]
build: update gnulib submodule to latest
Jim Meyering [Sat, 29 Dec 2012 14:30:48 +0000 (15:30 +0100)]
maint: adjust NEWS entry wording
* NEWS: Adjust wording in a few entries.
Pádraig Brady [Thu, 27 Dec 2012 04:14:14 +0000 (04:14 +0000)]
doc: improve od --help and man page
* src/od.c: Redorder the information output by --help
to ease interpretation and so that appropriate sections
are generated by help2man.
* doc/coreutils.texi (od invocation): Fix an incorrect
reference to @var{n}, which should be @var{bytes}.
* man/od.x: Add an "Examples" section, and move the
default od format to there, and add a commonly required
format to generate hexdumps.
Reported by Akim Demaille in http://bugs.gnu.org/13280.
Mike Frysinger [Fri, 7 Dec 2012 20:44:18 +0000 (15:44 -0500)]
factor: disable x86_64 assembly code for x32 builds
The current x86_64 asm code does not work for x32 (__ILP32__) ABIs,
so disable it. Note simply deleting the q suffix is not enough.
* src/longlong.h: Restrict x86_64 assembly to _LP64 targets,
which is consistent with other checks in longlong.h and
avoids this code on x32.
* NEWS: Mention the build fix.
Pádraig Brady [Thu, 20 Dec 2012 00:09:15 +0000 (00:09 +0000)]
tests: avoid false positive valgrind failures
* init.cfg (require_valgrind_): Check the `true` program,
which will check more valgrind failure cases as now
detailed in the function comments.
Pádraig Brady [Wed, 19 Dec 2012 23:58:10 +0000 (23:58 +0000)]
dd: fix a printf format mismatch in an error message
* src/dd.c (dd_copy): To print an off_t portably we need
to use PRIdMAX and cast to intmax_t, otherwise there
could be a mismatch between say a 32 bit off_t
and uintmax_t. This was flagged by -Wformat on
a 64 bit host when compiling with CFLAGS=-m32.
Pádraig Brady [Wed, 19 Dec 2012 19:27:10 +0000 (19:27 +0000)]
seq: fix newline output when -s specified
This regression was introduced in commit v8.19-132-g3786fb6.
* src/seq.c (seq_fast): Don't use puts() to output the first number,
and instead insert it into the buffer as for other numbers.
Also output the terminator unconditionally.
* tests/misc/seq.pl: Add some basic tests for the -s option.
* NEWS: Mention the fix.
* THANKS.in: Reported by Philipp Gortan.
Bernhard Voelker [Thu, 20 Dec 2012 15:38:56 +0000 (16:38 +0100)]
tests: add tests for basename's --zero option
The -z option has been introduced in commit v8.15-60-ga3eb71a,
i.e. in coreutils-8.16. Time to add some tests for it.
* tests/misc/basename.pl: Add tests exercising the -z option.
In the foreach loop to append a newline to the end of each
expected 'OUT' string, skip the -z tests.
Assaf Gordon [Thu, 20 Dec 2012 10:42:22 +0000 (11:42 +0100)]
doc: tweak 'lcov' in HACKING
* HACKING: In the paragraph about creating coverage statistics,
use the correct -b (--base-directory) parameter.
Pádraig Brady [Wed, 19 Dec 2012 11:44:28 +0000 (11:44 +0000)]
maint: rewrap a long line noticed by make syntax-check
* configure.ac: Wrap the recently introduced long line.
Pádraig Brady [Sat, 15 Dec 2012 03:15:38 +0000 (03:15 +0000)]
doc: clarify when dd iflag=fullblock is useful
* doc/coreutils.texi (dd invocation): Explain that iflag=fullblock
ensures that count= will count blocks rather than reads, and
reference that in both the count= and iflag=fullblock descriptions.
Suggested by John Reiser.
Pádraig Brady [Tue, 18 Dec 2012 13:06:15 +0000 (13:06 +0000)]
tests: avoid a race in timeout-group.sh
* tests/misc/timeout-group.sh: The kernel might possibly delay
signal propagation to timeout.cmd long enough, that it exits
normally without running the signal handler (as sleep will
be in the same process group and so get the signal too).
So avoid this by explicitly checking that the signal handler
is called, which should always happen under normal circumstances.
Reported by Stefano Lattarini on linux-2.6.30-2-686 and bash-4.2.36.
Pádraig Brady [Wed, 19 Dec 2012 09:13:21 +0000 (09:13 +0000)]
build: avoid --enable-gcc-warnings on GCC <= 4.5
* configure.ac: Only enable warnings automatically when
on GCC >= 4.6 (and when building from a git checkout)
as that was the first GCC version to support fine-grained
control of warnings, allowing them to be adjusted around
certain code sections. gnulib relies on this for certain
warnings, so avoid auto enabling this option lest we trigger
build failures on now over two year old compilers.
Reported by Zartaj Majeed with GCC 4.5.3 on cygwin.
Zartaj Majeed [Tue, 18 Dec 2012 09:50:50 +0000 (09:50 +0000)]
build: fix cygwin build issues
* doc/local.mk (doc/constants.texi): Ensure the doc directory
is present which is needed when doing a non source dir build,
when the doc/constants.texi target is built before other doc targets.
* src/local.mk: Add $(EXEEXT) to the make-prime-list calls.
Pádraig Brady [Sat, 15 Dec 2012 03:23:06 +0000 (03:23 +0000)]
maint: consistently use @dots{} in coreutils.texi
* doc/coreutils.texi: s/\.\.\./@dots{}/ except in code and examples.
Pádraig Brady [Wed, 12 Dec 2012 19:54:12 +0000 (19:54 +0000)]
readlink: support multiple command line arguments
This allows efficient processing of multiple files,
while also increasing compatibility with BSD's readlink(1).
We also add the -z, --zero option to delimit output items
with the NUL character which disambiguates output in the
presence of '\n' characters.
* src/readlink.c (usage): Add the --zero description,
and also adjust the description of --no-newline accordingly.
(main): Handle the -z option and iterate over multiple arguments.
Also as in commit v8.15-24-g9d46b25 we use fputs() and putchar()
rather than printf() for performance reasons.
* doc/coreutils.texi (readlink invocation): Document the
new --zero option, adjust the --no-newline description, and
tweak the general info to indicate multiple files are supported.
* tests/readlink/multi.sh: A new test for the new functionality.
* tests/local.mk: Reference the new test.
* man/readlink.x: Adjust the summary and also reference realpath.
* NEWS: Mention the improvement.
* THANKS.in: Suggested by Aaron Davies.
Assaf Gordon [Fri, 14 Dec 2012 18:27:26 +0000 (13:27 -0500)]
maint: update gitignore entries
* .gitignore: ignore GCC coverage data files.
Assaf Gordon [Fri, 14 Dec 2012 07:47:17 +0000 (08:47 +0100)]
doc: mention "git stash" in HACKING
* HACKING: In the paragraph about switching branches, mention
"git stash" as a way to continue while preserving uncommitted
changes.
Bernhard Voelker [Fri, 14 Dec 2012 23:13:55 +0000 (00:13 +0100)]
tail,stat: improve support for the ceph file system
Teach tail -f that it must use polling on ceph file systems, and
let stat -f --format=%T report the file system type name, "ceph".
Website: http://ceph.com/
* src/stat.c (human_fstype): Add a case: ceph, 0x00C36400, remote.
* NEWS (Improvements): Mention it.
* THANKS.in: Update.
Reported by Konrad Wróblewski in http://bugs.gnu.org/13172.
Bernhard Voelker [Fri, 14 Dec 2012 09:45:21 +0000 (10:45 +0100)]
maint: fix typos found by misspellings
* doc/coreutils.texi (df invocation): s/occurence/occurrence/.
* tests/df/skip-rootfs.sh: s/supressed/suppressed/
Jim Meyering [Sat, 8 Dec 2012 20:04:14 +0000 (12:04 -0800)]
tests: add test case and note that last week's cut change is a bug fix
* tests/misc/cut-huge-to-eol-range.sh: New test, showing that
the change in v8.20-51-g7d03466 is a bug fix after all.
* tests/local.mk (all_tests): Add it.
* NEWS (Bug fixes): Mention it.
Bernhard Voelker [Sat, 8 Dec 2012 18:09:19 +0000 (19:09 +0100)]
cp: fix --no-preserve=mode to not exit 1
cp --no-preserve=mode exited 1 unconditionally. Furthermore,
the tests which would have detected this error - namely
link-preserve.sh and reserve-mode.sh - failed to test
cp's exit code.
* src/copy.c (copy_reg): In the case x->explicit_no_preserve_mode,
do only set return_val to false iff the previous set_acl ()
failed.
* tests/cp/link-preserve.sh: Check cp's exit code.
* tests/cp/link-symlink.sh: Likewise.
* tests/cp/preserve-mode.sh: Likewise.
* NEWS: Mention the fix.
Bug introduced in commit v8.19-145-g24ebca6.
Reported by Florian Pritz in http://bugs.gnu.org/13119.
Ondrej Oprala [Fri, 7 Dec 2012 20:10:40 +0000 (21:10 +0100)]
df: do not print duplicate entries and rootfs by default
* src/df.c (struct devlist): Add new struct for storing already-
examined device numbers.
(devlist_head): Add new store of the above type.
(show_rootfs): Add new global boolean to not skip rootfs.
(dev_examined): Add new function to check if the device has
already been traversed.
(get_dev): Filter out rootfs unless "-t rootfs" or the -a
option is specified. Filter out duplicate entries by calling
the above new dev_examined unless the -a option is specified.
(main): Set the show_rootfs variable appropriately when the -t
option is specified for rootfs. Free device list (guarded by
IF_LINT).
* tests/df/skip-duplicates.sh: Add test to exercise the skipping
of duplicate entries.
* tests/df/skip-rootfs.sh: Add test to exercise the skipping
of the rootfs pseudo file system.
* tests/local.mk: Add the above new tests.
* NEWS (Changes in behavior): Mention the changes.
* doc/coreutils.texi (df invocation): Document df's behavior about
skipping rootfs and duplicate entries.
Co-authored-by: Bernhard Voelker.
Cojocaru Alexandru [Thu, 6 Dec 2012 02:03:41 +0000 (03:03 +0100)]
cut: avoid a redundant heap allocation
* src/cut.c (set_fields): Don't allocate memory for
`printable_field' if there are no finite ranges.
This is achieved by keeping max_range_endpoint as 0 when
there are no finite ranges. max_range_endpoint is then
used throughout the code to guard against allocation of,
and access to the bit array.
The extra allocation was introduced via commit v8.10-3-g2e636af.
Pádraig Brady [Thu, 6 Dec 2012 16:51:41 +0000 (16:51 +0000)]
maint: fix a referenced coreutils version in a test comment
* tests/misc/cut.pl: This particular bug existed up to v8.10.
Bernhard Voelker [Thu, 6 Dec 2012 09:11:42 +0000 (10:11 +0100)]
tests: fix regex to match "-" in ipcent field in df/total-verify.sh
The regular expression failed to match for file systems that
do not provide inode statistics, e.g. VFAT or CIFS (depending
on the underlying peer file system).
* tests/df/total-verify.sh: Fix the regular expression to match
a dash in the ipcent field again.
Reported by Assaf Gordon in http://bugs.gnu.org/13099.
Bug introduced in commit v8.20-18-gdae8d22.
Assaf Gordon [Thu, 6 Dec 2012 09:58:10 +0000 (09:58 +0000)]
maint: adjust HACKING instructions to run a single test
* HACKING: Adjust as per the recent changes introduced
when switching to non recursive make.
Pádraig Brady [Wed, 5 Dec 2012 13:51:01 +0000 (13:51 +0000)]
tests: cut.pl: adjust for changed diagnostic
* tests/misc/cut.pl: Since we now output the more
complete error message irrespective of running
in a multi-byte locale or not, adjust the test accordingly.
Cojocaru Alexandru [Wed, 5 Dec 2012 13:13:51 +0000 (13:13 +0000)]
cut: improve error reporting
* src/cut.c (main): Treat a NUL delimiter (-d '') consistently
with non NUL delimiters, and disallow such a delimiter option,
unless a field is also specified.
(set_fields): Provide a more accurate error message when
a given list is invalid.
* tests/misc/cut.pl: Add a test case.
Pádraig Brady [Thu, 6 Dec 2012 09:29:34 +0000 (09:29 +0000)]
maint: adjust instructions to run a single test
* README: Adjust as per the recent changes introduced
when switching to non recursive make.
Bernhard Voelker [Wed, 5 Dec 2012 10:47:18 +0000 (11:47 +0100)]
maint: remove now auto-added entry from THANKS.in
The syntax-check sc_THANKS_in_duplicates complained about
that excess entry.
* THANKS.in (Colin Watson): Remove entry, now that it will be
automatically included in the generated THANKS file.
Pádraig Brady [Fri, 30 Nov 2012 15:08:31 +0000 (15:08 +0000)]
maint: remove a redundant odd sized alloc from factor.c
* src/factor.c (mp_factor_init): Init the pointers with NULL,
which xrealloc (or realloc) handles fine.
Colin Watson [Thu, 29 Nov 2012 19:37:30 +0000 (19:37 +0000)]
factor: fix infinite loop on 32 bit powerpc
Both Debian and Ubuntu builds of coreutils 8.20 hang while running the
test suite on powerpc, which is reproducible using 'factor 122'.
This turns out to be somewhat related to http://bugs.gnu.org/12754,
but not quite the same. uintmax_t is 64 bits, but the cntlzw
instruction takes 32-bit operands, and the cntlzd option is only
available on 64-bit hardware.
* src/longlong.h: Add an _LP64 check around the PPC64 code,
so that this falls back to the C implementations.
* NEWS: Mention the fix.
Jim Meyering [Sat, 24 Nov 2012 19:36:15 +0000 (11:36 -0800)]
cut: do not print extraneous delimiters in some unusual cases
When printing output delimiters, and when a to-EOL range subsumes
at least one other range, cut would mistakenly print delimiters for
the subsumed range. This bug was probably introduced via commit
v5.2.1-639-g847e066.
* src/cut.c (set_fields): Ignore any range that is subsumed by a
to-EOL range. Also, move two declarations down.
* tests/misc/cut.pl: Add tests to exercise this.
* NEWS (Bug fixes): Mention it.
Reported by Marcel Böhme in http://bugs.gnu.org/12966
Jim Meyering [Sat, 24 Nov 2012 07:09:10 +0000 (23:09 -0800)]
cut: treat -b2-,3- like -b2-, not like -b3-
* src/cut.c (set_fields): When two right-open-ended ranges are
specified, don't blindly let the latter one take precedence over
the former. Instead, use the union of the ranges.
* tests/misc/cut.pl: Add tests to exercise this.
* NEWS (Bug fixes): Mention it.
Reported by Marcel Böhme in http://bugs.gnu.org/12966
Thanks to Berhard Voelker for catching log and NEWS typos.
Bernhard Voelker [Sat, 24 Nov 2012 15:04:44 +0000 (16:04 +0100)]
doc: cp: clarify behavior of the --preserve=xattr option
* doc/coreutils.texi (cp invocation): Enhance documentation
of the --preserve=xattr option regarding the preservation
of ACLs, SELinux contexts and capabilities: the user may
notice this only when not specifying --preserve=mode
and --preserve=context, too, i.e., otherwise, these attributes
are preserved anyway.
Pádraig Brady [Fri, 26 Oct 2012 14:46:04 +0000 (15:46 +0100)]
doc: update info cross reference to bash
* doc/coreutils.texi (tee invocation): Reference
the bash manual rather than bashref, as the latter
is more likely to work on newer systems.
Pádraig Brady [Mon, 29 Oct 2012 00:46:04 +0000 (00:46 +0000)]
tests: use sub-second timeouts to speed up a timeout test
* tests/misc/timeout.sh: Take advantage of recent support for
sub-second timeouts to decrease runtime from about 6s to 2s.
Pádraig Brady [Thu, 22 Nov 2012 14:25:46 +0000 (14:25 +0000)]
doc: clarify that renice is needed to adjust niceness
* doc/coreutils.texi (nice invocation): Ensure there is no
ambiguity in the summary in relation to nice being able
to adjust the niceness of an existing process.
Reference the renice command.
* man/nice.x: Reference renice (1)
Pádraig Brady [Thu, 22 Nov 2012 10:36:31 +0000 (10:36 +0000)]
tests: accept EEXIST from rm -d
* tests/rm/d-2.sh: EEXIST is a valid error on some systems.
Reported by Michael Felt on AIX 6.1
Pádraig Brady [Thu, 22 Nov 2012 10:07:25 +0000 (10:07 +0000)]
tests: don't rely on sed -i being available
* tests/df/df-output.sh: sed --in-place is not generally available.
Also add a couple of simplifications from Bernhard Voelker.
Removing all spaces, rather than just leading spaces, suffices.
Searching for ' --output' in unadjusted df --help, suffices.
Pádraig Brady [Fri, 23 Nov 2012 03:06:07 +0000 (03:06 +0000)]
seq: ensure correct output width for scientific notation input
* src/seq.c (scan_arg): Calculate the width more accurately
for numbers specified using scientific notation.
* tests/misc/seq.pl: Add tests for cases that were mishandled.
* NEWS: Mention the fix.
* THANKS.in: Reported by Marcel Böhme.
Fixes http://bugs.gnu.org/12959
Bernhard Voelker [Thu, 22 Nov 2012 14:40:54 +0000 (15:40 +0100)]
df: reorder default field list of --output option
As the inodes information is usually not so much of interest,
and some file systems including btrfs do not even provide it,
reading of the full df --output is easier when the block
statistic fields come just left of the last field, the mount
point.
* src/df.c (all_args_string): Move the inodes fields before
the block fields.
(usage): Likewise.
* tests/df/df-output.sh: Likewise.
* doc/coreutils.texi (df invocation): Likewise. Additionally,
explicitly mention the default order of the --output option.
Paul Eggert [Wed, 21 Nov 2012 02:10:21 +0000 (18:10 -0800)]
install: fix security race
* NEWS: Document this.
Paul Eggert [Tue, 20 Nov 2012 21:15:34 +0000 (13:15 -0800)]
install: fix security race
* src/copy.c (copy_internal): Use DST_MODE_BITS, not SRC_MODE.
See Bernhard R. Link in <http://bugs.gnu.org/12947> and in
<http://bugs.debian.org/598018>.
Bernhard Voelker [Tue, 20 Nov 2012 10:06:46 +0000 (11:06 +0100)]
nl: remove deprecated --page-increment option
The above option has been deprecated since coreutils-7.5
by commit v7.4-129-g718b279.
* src/nl.c (PAGE_INCREMENT_OPTION_DEPRECATED): Remove enum.
(longopts): Remove "page-increment" entry.
(main): Remove PAGE_INCREMENT_OPTION_DEPRECATED case.
* NEWS (Changes in behavior): Mention the change.
Reported by Marcel Böhme in <http://bugs.gnu.org/12940>.
Bernhard Voelker [Sun, 11 Nov 2012 11:07:47 +0000 (12:07 +0100)]
doc: remove already implemented items from TODO
* TODO (renice): The renice program is part of util-linux for
years now. Remove entry.
(dd): The option status=none has been implemented in commit
v8.19-143-g7331ab5. Remove entry.
Bernhard Voelker [Sun, 18 Nov 2012 21:20:16 +0000 (22:20 +0100)]
cut: do not accept the invalid range 0-
The command "echo 12345 | cut -b 0-" prints an empty line while
it should fail with "fields and positions are numbered from 1".
* src/cut.c (set_fields): Add a diagnostic for the invalid open
range which starts with Zero, i.e., the range 0-.
* tests/misc/cut.pl: Add tests to ensure the range 0- fails for
fields (-f) and for positions (-b, -c).
* NEWS: Mention the fix.
Reported by Marcel Böhme in <http://bugs.gnu.org/12903>.
Daniel Schepler [Sun, 18 Nov 2012 18:04:54 +0000 (10:04 -0800)]
build: fix compilation failure on x32
* src/factor.c [HAVE_ATTRIBUTE_MODE]: Fix typo in #if test:
s/HAVE_LONG_LONG/HAVE_LONG_LONG_INT/. Otherwise, factor.c would
elicit assembler errors on x32: it was incorrectly defining DItype
to long instead of long long. Patch and report in
http://bugs.debian.org/693337; Mike Stone notified upstream.
Jim Meyering [Sun, 18 Nov 2012 17:51:48 +0000 (09:51 -0800)]
maint: reenable accidentally-disabled cppi-check syntax-check rule
* cfg.mk (exclude_file_name_regexp--sc_preprocessor_indentation): Fix
typo that disabled the sc_preprocessor_indentation syntax-check rule
by exempting all files. s/__ll/_ll/ The typo was introduced in
commit v8.19-157-g759ebcb.
Jim Meyering [Sun, 18 Nov 2012 17:45:14 +0000 (09:45 -0800)]
maint: correct indentation of W_TYPE_SIZE-defining cpp directives
* src/factor.c: Indent cpp directives to reflect their nesting.
Jim Meyering [Sun, 18 Nov 2012 17:16:17 +0000 (09:16 -0800)]
maint: avoid i686-specific syntax-check failure
* cfg.mk (_gl_TS_unmarked_extern_vars): Define.
Paul Eggert [Sat, 17 Nov 2012 16:23:47 +0000 (08:23 -0800)]
doc: explain why dd is called "dd"
* doc/coreutils.texi (dd invocation): Mention JCL.
Paul Eggert [Sat, 17 Nov 2012 00:51:50 +0000 (16:51 -0800)]
factor: tidy up primes.h again
See Stefano Lattarini in <http://bugs.gnu.org/12899>.
* src/local.mk (BUILT_SOURCES): Put $(top_srcdir)/src/primes.h here
(MAINTAINERCLEANFILES): ... instead of here.
Paul Eggert [Tue, 13 Nov 2012 15:43:08 +0000 (07:43 -0800)]
factor: cleanup for primes.h
* .gitignore: Add src/primes.h back, since it's no longer
in the repository.
Jim Meyering [Tue, 13 Nov 2012 06:03:01 +0000 (07:03 +0100)]
maint: avoid unnecessary #include to fix syntax-check failure
* src/factor.c: Remove unneeded #inclusion of"verify.h".
It's already included via system.h.
Paul Eggert [Tue, 13 Nov 2012 05:10:17 +0000 (21:10 -0800)]
factor: improve primes.h change
This follows suggestions by Jim Meyering in
<http://bugs.gnu.org/12841#34>.
* src/make-prime-list.c (print_wide_uint): Change "nested" argument
to "nesting", and use it to avoid outputting lines that are too long.
* src/primes.h: Remove from git. This can be generated by a
maintainer. It's nicer to do so on a host with at least 128-bit
arithmetic.
Paul Eggert [Mon, 12 Nov 2012 16:32:04 +0000 (08:32 -0800)]
factor: maintainer builds primes.h, not builder
With this change, the maintainer builds primes.h and it is part of
the tarball. primes.h's contents are not architecture-specific.
* .gitignore: Remove /src/primes.h.
* src/factor.c: Include verify.h.
(W): New constant. Verify that uintmax_t lacks holes
and that W is no wider than the integers used to generate primes.h.
* src/local.mk (EXTRA_DIST): Add src/primes.h.
(BUILT_SOURCES, CLEANFILES): Remove src/primes.h.
($(top_srcdir)/src/primes.h): Rename from src/primes.h.
Do not depend on src/make-prime-list. Instead, use sub-make to
build, so that we build primes.h only if it does not exist.
* src/make-prime-list.c: Include <limits.h>, for ULONG_MAX.
(wide_uint): Define to uintmax_t or unsigned __int128 if not #defined.
(struct prime, binvert, process_prime): Use it instead of uintmax_t.
(print_wide_uint): New function. This generates the proper pinv
value regardless of the width of uintmax_t on the target, so long
as the width doesn't exceed that of the width of wide_uint on the
maintainer host that generated src/primes.h.
(output_primes): Use it. Output WIDE_UINT_BITS, too. Let the
target compute its own lim, since its uintmax_t may be narrower
than ours.
(SZ): Remove.
* src/primes.h: New file, generated with 128-bit integers and usable
on any host where uintmax_t's width is no greater than 128 bits.
Paul Eggert [Mon, 12 Nov 2012 16:16:30 +0000 (08:16 -0800)]
factor: port to systems with rpl_malloc
* src/make-prime-list.c (malloc): Undef. This fixes a problem on
AIX 8.20 reported by Michael Felt in <http://bugs.gnu.org/12841>.
Bernhard Voelker [Fri, 9 Nov 2012 14:09:05 +0000 (15:09 +0100)]
tests: fix factor's tests to use coreutil's own sha1sum
The test used the shasum utility which seems to belong to the
perl package. On SLES-10.4, perl doesn't include this yet:
+ seq 0
10000000
+ factor
+ shasum -c --status exp
./tests/factor/t00.sh: line 30: shasum: command not found
+ Exit 1
It is better to use our own stuff anyway.
* tests/factor/run.sh: s/shasum/sha1sum/. Additionally, add
sha1sum to the print_ver_ call.
Benno Schulenberg [Mon, 15 Oct 2012 17:37:34 +0000 (19:37 +0200)]
doc: chcon: add descriptions for three undocumented options
These were missed in this related change v8.14-104-g44e20cd
* src/chcon.c (usage): Mention the two --preserve-root options.
* doc/coreutils.texi (chcon invocation): Plus the --dereferece option.
Benno Schulenberg [Mon, 15 Oct 2012 11:06:37 +0000 (13:06 +0200)]
doc: with cp -n, option -f is not redundant but ignored
* src/cp.c (usage): Replace "redundant" with "ignored".
* doc/coreutils.texi (cp invocation): Likewise.
Paul Eggert [Fri, 9 Nov 2012 09:11:18 +0000 (01:11 -0800)]
df: port the new df test to POSIX sed, larger file systems
* tests/df/df-output.sh: For the test "df -B1K --output=size",
do not assume that the file system size fits in 9 bytes; it
might be larger than that, so omit leading space. Also, use
portable 'sed' commands: POSIX says sed commands inside { } should
all end in newline.
Bernhard Voelker [Sun, 23 Sep 2012 20:29:25 +0000 (22:29 +0200)]
df: add a test for the --output option
* tests/df/df-output.sh: Add a test case.
* tests/local.mk (all_tests): Mention the test.
* cfg.mk (sc_file_system): Exempt the test from this syntax-check.
Bernhard Voelker [Sat, 29 Sep 2012 16:44:18 +0000 (18:44 +0200)]
df: document the new --output option
* src/df.c (usage): Add a short description of --output and its
available field names for use in the optional argument.
* doc/coreutils.texi (df invocation): Add the new option with more
details and a few examples.
* NEWS (New features): Mention the new option.
(Changes in behvaior): Mention the new placeholder for fields
in the "total" line.
Bernhard Voelker [Thu, 30 Aug 2012 12:58:22 +0000 (14:58 +0200)]
df: add --output to select which fields to display
This supports changing the order of the fields displayed,
and also allows the simultaneous display of inode and block fields.
src/df.c (get_dev): Factor out calling get_header to ...
(main): ... here. Call print_table only if file_systems_processed.
src/df.c (Displayable fields): Rename DEV_FIELD to SOURCE_FIELD.
Rename TYPE_FIELD to FSTYPE_FIELD. Rename FREE_FIELD to AVAIL_FIELD.
Rename MNT_FIELD to TARGET_FIELD.
* src/df.c (display_field_t): Turn loose enum definition of the
displayable fields into a typedef. Add the inode fields ITOTAL_FIELD,
IUSED_FIELD, IAVAIL_FIELD, IPCENT_FIELD.
(field_data_t): Define structure to hold the display field, the
caption, the width and the alignment for each field of the above
type.
(field_data): Add array the values of field data for each display
field.
(headers, alignments, widths): Remove arrays.
(columns): Add a pointer to the storage for the array of the actual
output columns, i.e., fields.
(ncolumns): Add counter for the current output columns.
(alloc_table_row): Allocate the dynamic ncolumns value of strings.
(print_table): Loop over ncolumns instead of constant NFIELDS. Rename
loop variable 'field' to 'col' to avoid ambiguity with the 'field'
element in the columns structure. Adjust the condition for printing
the last column by comparing with the column number instead of the
field name (TARGET_FIELD). Use the width and the alignment stored in
the columns data.
(alloc_field): Add new function to allocate a field in the columns
array.
(get_field_list): Add new function to fill the array of output columns
for each mode.
(get_header): Loop over ncolumns instead of constant NFIELDS. Rename
the loop variable 'field' to 'col' to avoid ambiguity with the 'field'
element in the columns structure. Remove the code for continuing the
loop if the current column is the file system type and print_type is not
active (which is now impossible). Store the cell in the columns store
along with the new width.
(get_dev): Loop over ncolumns instead of the constant NFIELDS. Rename
the loop variable 'field' to 'col' to avoid ambiguity with the 'field'
element in the columns structure; move the definition down to where it
is used first. Add cases for the inode fields ITOTAL_FIELD,
IUSED_FIELD, IAVAIL_FIELD and IPCENT_FIELD. Store the cell in the
columns store along with the new width.
(main): Use new get_field_list function to fill the list of output
columns.
* src/df.c (print_table): Instead of fputs()ing directly, apply
ambsalign on the last field, too. Use the new MBA_NO_RIGHT_PAD flag
for this.
* src/df.c (TOTAL_OPTION): Add new enum value.
(long_options): Use it for the "total" option instead of 'c'.
(main): Likewise.
* src/df.c (get_dev): Remove condition to copy the fstype into the
FSTYPE_FIELD - based on whether print_type is non-Null. Since the
introduction of get_field_list(), there are only fields added to
the columns array which have to be added.
* src/df.c (get_dev): Guard the summing up of the values for the
grand total: only do it if we have to print the total and if the
current invocation is not for processing it.
* src/df.c (main): Pass a hyphen "-" for the mount point name
to get_dev.
(get_dev): As the mount_point is now always there,
remove the condition and the else case for the TARGET_FIELD.
Instead, simply copy the mount_point.
All cells are now always present. Therefore, add an assertion
statement if one was not. Furthermore, hide the problematic
characters unconditionally.
(print_table): Remove the skipping of empty cells.
* tests/df/total-verify.sh: Accommodate to the new "-" in the
target field of the summary line.
* NEWS: Mention the change in behavior.
* src/df.c (field_type_t): Add new typedef of 3 enums to distinguish
between block, inode and other fields.
(field_data_t): Add field_type member of the above new type.
(field_data): Add default values for the above field_type,
indicating whether a field contains block values, inode values
or other, generic values.
(field_values_t): Add this struct to store the field values, used
by and factored out from get_dev to be able to define such a struct
for both the inode and the block values.
(get_field_values): Add this function to obtain the block values
and the inode values from the file system usage, used by and
factored out from get_dev.
(add_to_grand_total): Add this function to sum the values of the
current mount point up for the grand total, used by and factored
out from get_dev.
(get_dev): Move the definition of the variables fsu, buf, pct and
cell down to where they are used first to give them a better scope.
Factor out input_units, output_units, total, available,
negate_available, available_to_root, used and negate_used into the
above struct field_values_t.
Factor out the mapping of the fsu values to the above variables
into above function get_field_values.
Factor out the summing up of the grand total values into the
above function add_to_grand_total.
Define block_values and inode_values of the new type and call the
new get_field_values to fill them from the fsu values.
Call the above function add_to_grand_total for summing up the
values for the grand total.
Inside the loop over all fields, define a variable 'v' to point
to either the block_values or the inode_values, depending on the
current field's field_type. Change the code in the cases
TOTAL_FIELD/ITOTAL_FIELD, USED_FIELD/IUSED_FIELD, AVAIL_FIELD/
IAVAIL_FIELD and PCENT_FIELD/IPCENT_FIELD to use the field values
where 'v' is pointing to, i.e., either the block_values or the
inode_values.
* src/df.c (main): Remove setting of grand_fsu.fsu_blocks in the
inode_format case as this is no longer needed and would lead to
wrong results once when mixed block/inode fields will be used.
* src/df.c (main): Cleanup the code at the end regarding
file_systems_processed to make the code clearer.
* src/df.c (inode_format): Remove variable.
(main): Remove initialization of the above variable.
In getopts loop, directly set the header_mode to INODES_MODE
instead of using the above variable. Afterwards, remove the
mapping to INODES_MODE as it is already set.
* src/df.c (posix_format): Move variable ...
(main): ... to here.
* src/df.c (print_table): Enhance the comment about 2-line format
in cases where the SOURCE_FIELD exceeds 20 chars, as such
behavior has been removed long ago by commit v8.10-40-g99679ff.
* src/df.c (Display modes): Add OUTPUT_MODE, remove unused NMODES.
(display_field_t): Remove unnecessary NFIELDS.
(field_data_t): Add member 'arg' for the field name in the --output
argument. Add member 'used' to remember if a field is already used
in the columns array.
(field_data): Add values for the above new members arg and used.
(all_args_string): Add variable which represents the argument for
the --output option which includes all fields.
(OUTPUT_OPTION): Add enum to identify the long --output option.
(long_options): Add optional-argument --output option.
(alloc_field): Assert that the field is not already used.
Mark the field as used.
(decode_output_arg): Add function to parse the comma-separated
field list passed to the --output option in order to add the
appropriate fields to the columns array.
(get_field_list): Add case for the new OUTPUT_MODE to add all
available fields to columns in the case the --output option
has been passed without any values. Use the comma-separated
field list form to pass to decode_output_arg to keep the field
header mapping for the OUTPUT_MODE only on one place.
(main): Define format string msg_mut_excl to be used in the
following checks whether the use of --output and the other
option is mutually exclusive.
In the getopt_long loop, add a check to the case for the -i option
to issue an error message when it is used together with --output;
Likewise for -T and -P.
Add a new case for OUTPUT_OPTION, together with similar checks as
above and eventually passing the optarg to decode_output_arg.
After the getopt_long loop, consider the OUTPUT_MODE case in order
not to run into -h or -P mode.
* src/df.c (get_dev): Also xstrdup the dev_name, and free it
afterwards to silence a valgrind warning about definitely lost
memory.
(main): Free the columns store to silence valgrind, guarded by
the IF_LINT macro.
* src/df.c (main): Pass "total" as the mount point to get_dev if
the SOURCE_FIELD is not among the columns to output.
* tests/df/df-output.sh: Change the test to ensure the content of
the target field of the grand total line: if the source field is
present, then the target should be "-", else the target field should
be "target".
* NEWS (Changes in behavior): Enhance the exiting NEWS entry.
* doc/coreutils.texi (df invocation): Document the content of the
source and target field in the grand total line.
* src/df.c (main): Add another condition to the need_fs_type
parameter of read_file_system_list whether the FSTYPE_FIELD is
used or not.
* src/df.c (get_header): Indicate the block size used,
in the "size" header, when using --output without -h.
* tests/df/df-output.sh: Adjust for, and add an extra test for,
the new behavior.
Bernhard Voelker [Mon, 5 Nov 2012 19:35:13 +0000 (20:35 +0100)]
maint: fix factor's test file name pattern in .gitignore
* .gitignore: Adapt the entry for the files generated during
the factor tests (see v8.20-9-g1cace4a).
Ángel González [Mon, 29 Oct 2012 00:36:08 +0000 (00:36 +0000)]
timeout: add --preserve-status to always propagate the exit status
It's useful for commands that support running for an indeterminite
amount of time, to not return a specific timeout exit status (124),
and instead let the command handle the timeout signal and return
a status for the work done so far.
* doc/coreutils.texi (timeout invocation): Describe the new option.
* src/timeout.c (preserve_status): A new global boolean to
enable the --preserve-status behavior.
(usage): Describe the new option.
(main): Don't return EXIT_TIMEOUT of preserve_status is set.
* tests/misc/timeout.sh: Add a test for the new option.
Pádraig Brady [Sun, 4 Nov 2012 00:55:57 +0000 (00:55 +0000)]
maint: fix the error message from sc_check-I18N-AUTHORS
* cfk.mk (sc_check-I18N-AUTHORS): Fix the quoting so
you don't get a 'command not found' error.
Pádraig Brady [Tue, 30 Oct 2012 02:02:05 +0000 (02:02 +0000)]
build: avoid build failure on some HPPA systems
* src/longlong.h: Restrict some HPPA assembly variants to PA RISC V2.0.
Note we also avoid this assembly for ilp32 runtimes, since even though
the assembly is accepted there, it's not safe as the context can get
clobbered between the 'add' and 'add,dc'.
This fixes a compile failure with newer HPPA systems with default
GCC CPU options.
Reported by John David Anglin
Pádraig Brady [Tue, 30 Oct 2012 02:15:36 +0000 (02:15 +0000)]
build: don't assume uintmax_t is 64 bits
This was not seen to be an issue in practise,
but to make the code more robust, don't assume
uintmax_t is 64 bits.
* src/factor.c (W_TYPE_SIZE): Define based on integer limits.
* src/make-prime-list.c (output_primes): Define format width
based on integer limits.
Pádraig Brady [Tue, 30 Oct 2012 02:12:23 +0000 (02:12 +0000)]
build: don't rely on support for '%j' printf format
* src/factor.c (print_uintmaxes): Replace with PRIuMAX.
* src/join.c (check_order): Likewise.
* cfg.mk (sc_check-j-printf-format): Add a syntax-check rule
to flag new cases of this.
Pádraig Brady [Mon, 29 Oct 2012 02:27:24 +0000 (02:27 +0000)]
build: don't rely on support for '%*j' printf format
* src/make-prime-list.c: Hardcode the uintmax_t width
to 16 hex digits (64 bit), to avoid this compile issue
on HPUS systems at least.
Bernhard Voelker [Thu, 1 Nov 2012 15:50:51 +0000 (16:50 +0100)]
tests: fix syntax error in setuidgid_has_perm_
An invalid sed expression lead to the following error:
+ sed -n 'ls/.* //p'
sed: -e expression #1, char 2: extra characters after command
Use "one" instead of "el".
Bug introduced in v8.19-111-g51a4b04.
* init.cfg (setuidgid_has_perm_): s/ls/1s/.
* NEWS (Build-related): Mention the fix.
Bernhard Voelker [Sat, 27 Oct 2012 11:24:18 +0000 (13:24 +0200)]
tests: shorten factor's inordinately-long test file names
Besides what the subject says, this commit moves the test data
for the factor tests from tests/local.mk into the directory
tests/factor/ where it belongs.
* tests/local.mk (EXTRA_DIST): Add new tests/factor/create-test.sh.
(p,q,t1,t2) Factor out the factor-related magic numbers.
(factor_tests): Rename the test names to t{00..36}.sh. Factor out
the triples of test data.
($(factor_tests)): Add dependency to new
tests/factor/create-factor.sh.
Call that script to generate the test scripts.
* tests/factor/run.sh: Turn this script into a template, and
therefore remove it's executable permission bit.
Add template variables START, END and CKSUM, replacing the code
to split the test data from the test script's file name.
Use the new template variables in the call to seq and for
creating the exp file.
* tests/factor/create-test.sh: Add new script to create the
test scripts from the template tests/factor/run.sh.
Use test data and magic numbers factored out from the above
files. Let the script also change the __TEMPLATE__ line in
run.sh to make clear that the test scripts are generated.
* cfg.mk (sc_tests_list_consistency): Exempt the new test.
(exclude_file_name_regexp--sc_prohibit_test_backticks):
Likewise.
Improved-by: Stefano Lattarini
Improved by: Jim Meyering
Stefano Lattarini [Tue, 11 Sep 2012 18:54:30 +0000 (20:54 +0200)]
build: man page generation: degrade gracefully when perl is lacking
Since commit v8.19-118-g57da212, our 'dist-hook' rule tweaked the
distributed Makefile.in to make each man page 'man/foo.1' depend
on the corresponding source 'src/foo.c' rather than the corresponding
program 'src/foo'. That was done to accommodate systems without
perl, which cannot run help2man to regenerate the manpage after
its corresponding program has been built.
This seems a right and proper graceful degradation, in that the
man pages dependencies are still 100% correct in a git checkout,
while being more lax but "more portable" in a distribution tarball.
Alas, that is not the case in practice, as it turns out the tweaked
Makefile makes the building of man pages unreliable and potentially
incorrect!
In fact, assume that instead of the correct a dependency:
man/ls.1: src/ls
we have the laxer one:
man/ls.1: src/ls.c
and think of what happens if a user modifies, say, 'src/ls.c', and then
runs "make -j4" to rebuild everything. The make process will see that
it has to rebuild the man page 'man/ls.1' (because its prerequisite
'src/ls.c' has changed), but won't see that it has to rebuild 'src/ls'
*before* re-running 'help2man' to generate that man page; so, if
'man/ls.1' is rebuilt before 'src/ls' (which can happen with concurrent
make), our user will get either a build error (if 'src/ls' did non
exist) or, worse, a man page with an up-to-date timestamp but an
out-of-date content. And what's even worse in all of this is that
this problem will be present also for users who have perl installed:
this is not a "graceful degradation" at all!
In our situation, the best and simplest way to implement a graceful
degradation it to keep the correct dependencies for man pages (that
is, "man/ls.1: src/ls"), and if perl is not present, just generate
dummy man pages reporting that built-time issue and redirecting the
user back to either the info documentation or the '--help' output.
As a consequence of this change, we also stop distributing man pages,
since they will now be generated unconditionally.
* Makefile.am (do-not-require-help2man): Remove.
(dist-hook): Don't depend on it.
* man/local.mk: Remove an obsolete comment.
(EXTRA_DIST): Stop distributing generated man pages.
($(EXTRA_MANS)): This no longer needs to depend on $(all_programs).
(MAINTAINERCLEANFILES): $(ALL_MANS) Do not list it here, and ...
(CLEANFILES): ... list it here, instead.
(.x.1): Instead of warning if perl is missing, but then trying to run
'help2man' unconditionally, simply run ...
(run_help2man): ... the command referenced by this new variable, that
expands to a proper invocation of 'help2man' if perl is present, and
to an invocation of a shell script generating a dummy manpage if it
is not.
(EXTRA_DIST): Distribute that shell script.
* man/dummy-man: New shell script.
* NEWS (Build-related): Mention this.
Fixes coreutils http://bugs.gnu.org/12715.
Jim Meyering [Thu, 25 Oct 2012 16:35:34 +0000 (18:35 +0200)]
maint: tweak sc_check-I18N-AUTHORS
* cfg.mk (sc_check-I18N-AUTHORS): Remove unnecessary subshell;
add a self-explanatory diagnostic.
Jim Meyering [Thu, 25 Oct 2012 11:41:45 +0000 (13:41 +0200)]
maint: remove an obsolete test comment
* tests/du/bind-mount-dir-cycle.sh: Remove obsolete comment
spotted by Gilles Espinasse.
Pádraig Brady [Wed, 24 Oct 2012 09:55:13 +0000 (10:55 +0100)]
pr: fix -n to pad consistently and not crash
* src/pr.c: Replace the code to truncate the most significant
digits of line numbers, with much simpler string manipulation
that supports arbitrary widths. Before this, specifying a
width >= 32 to -n would result in a divide by zero error.
Also remove the inconsistent padding with zeros and spaces, which
would result in zero padding for widths 12 and 15.
* tests/pr/pr-tests.pl: Added a test to ensure no zero padding,
and also a test for the divide by zero case.
* NEWS: Mentioned the fix
Reported by Ondrej Oprala
Pádraig Brady [Thu, 25 Oct 2012 09:59:23 +0000 (10:59 +0100)]
build: ensure factor links the iconv library
* src/local.mk (src_factor_LDADD): Append $(LIBICONV).
* crg.mk (sc_check-I18N-AUTHORS): A new syntax check rule
to ensure we add LIBICONV where appropriate.
* THANKS.in: Add the reporter.
Reported by Christian Jullien
Syntax check suggested by Jim Meyering
Pádraig Brady [Wed, 24 Oct 2012 22:18:23 +0000 (23:18 +0100)]
maint: refactor tests/misc/pr.pl into tests/pr/pr-tests.pl
* tests/misc/pr.pl: Refactor this test into ...
* tests/pr/pr-tests.pl: ... here.
* tests/local.mk: Remove the reference to the removed test
Improved by Jim Meyering
Mike Frysinger [Tue, 23 Oct 2012 19:20:07 +0000 (15:20 -0400)]
build: do not redefine _FORTIFY_SOURCE
When _FORTIFY_SOURCE is defined by the compiler or via flags, as
it is on Gentoo, do not override it. Otherwise we get many
redefinition warnings.
* configure.ac (FORTIFY_SOURCE): Check if _FORTIFY_SOURCE is defined.
This addresses http://bugs.gnu.org/12714
Pádraig Brady [Tue, 23 Oct 2012 16:27:19 +0000 (17:27 +0100)]
maint: post-release administrivia
* NEWS: Add header line for next release.
* .prev-version: Record previous version.
* cfg.mk (old_NEWS_hash): Auto-update.
Pádraig Brady [Tue, 23 Oct 2012 15:48:48 +0000 (16:48 +0100)]
version 8.20
* NEWS: Record release date.
Jim Meyering [Tue, 23 Oct 2012 10:08:58 +0000 (12:08 +0200)]
factor: add comments
* src/factor.c (is_square): Use active voice in comment, not passive.
(factor): Add function-describing comment.
(mp_factor): Likewise.
Pádraig Brady [Tue, 23 Oct 2012 10:59:04 +0000 (11:59 +0100)]
build: avoid warnings about unused variables and macros
src/factor.c (__GMP_DECLSPEC): Move back from longlong.h
to treat consistently with other stub macros.
(__GMP_GNUC_PREREQ): Reference to avoid -Wunused-macros warning.
(__GMP_DECLSPEC): Likewise.
(ASSERT): Likewise.
(__clz_tab): Likewise.
(factor_using_division): Mark a variable as unused.
(mulredc): Likewise.
(mulredc2): Likewise.
(divexact_21): Likewise.
Pádraig Brady [Tue, 23 Oct 2012 10:03:32 +0000 (11:03 +0100)]
build: avoid compile warnings in factor.c on some systems
* src/factor.c (factor_using_pollard_rho2): On some systems
(like sparc) we need to promote all addmod2() parameters
to uintmax_t to avoid warnings.
Pádraig Brady [Tue, 23 Oct 2012 10:00:24 +0000 (11:00 +0100)]
build: avoid build failure on some sparc systems
* src/longlong.h: Restrict some sparc assembly variants
to sparc V9. This was seen to be an issue with newer
sparc systems with default gcc CPU options.
Pádraig Brady [Mon, 22 Oct 2012 12:03:27 +0000 (13:03 +0100)]
tests: correctly restrict factor test without GMP
* tests/misc/factor.pl: Correct the precedence and
regular expression in the command to check for GMP.
Jim Meyering [Sun, 21 Oct 2012 09:56:44 +0000 (11:56 +0200)]
doc: NEWS: the cp bug affects mv and install, too
* NEWS (Bug fixes): Note that the copy-induced corruption but affects
mv (sometimes) and install, too. Pointed out by Bernhard Voelker.
Benno Schulenberg [Mon, 15 Oct 2012 11:12:46 +0000 (13:12 +0200)]
doc: remove a stray parenthesis from 'cp --force' description
* doc/coreutils.texi (cp invocation): Remove Cheshire Cat.
Jim Meyering [Wed, 17 Oct 2012 09:21:12 +0000 (11:21 +0200)]
build: update gnulib submodule to latest
Jim Meyering [Tue, 16 Oct 2012 15:43:49 +0000 (17:43 +0200)]
cp: avoid data-corrupting free-memory-read
* src/extent-scan.c (extent_scan_read): Reset our last_ei
pointer whenever the parent buffer might have just been freed.
* tests/cp/fiemap-extent-FMR.sh: New test.
* tests/local.mk (all_tests): Add it.
* NEWS (Bug fixes): Mention it.
Reported by Mike Gerth in http://bugs.gnu.org/12656, and with
help from Alan Curry. Bug introduced in commit v8.10-60-g18f5a85.
Nikolas Kallis [Sat, 13 Oct 2012 17:52:33 +0000 (19:52 +0200)]
doc: improve HACKING guidelines
* HACKING: Add "cd coreutils" after the git clone command.
Copyright-paperwork-exempt: Yes
Pádraig Brady [Mon, 8 Oct 2012 14:48:43 +0000 (15:48 +0100)]
factor: fix integer validation and GMP fallback
In the recent factor rewrite, the GMP code
wasn't actually used; just an error was printed
on integer overflow. While fixing that it was noticed
that correct input validation wasn't done in all cases
when falling back to the GMP code.
* src/factor.c (print_factors) Fallback to GMP on overflow.
(strto2uintmax): Scan the string for invalid characters,
so that case can be detected independently of overflow.
Return an error when an empty string is passed.
Also allow leading spaces and '+' in input numbers.
* tests/misc/factor.pl: Ensure the GMP code is exercised
when compiled in. Also add a test to verify leading
spaces and '+' are allowed.
Pádraig Brady [Mon, 8 Oct 2012 10:38:41 +0000 (11:38 +0100)]
build: support older GMP versions
The new factor code introduced usage of mpz_inits() and
mpz_clears(), which are only available since GMP >= 5,
and will result in a compile error when missing.
* m4/gmp.m4 (cu_GMP): Define HAVE_DECL_MPZ_INITS appropriately.
* src/factor (mpz_inits): New function, defined where missing.
(mpz_clears): Likewise.
Jim Meyering [Sun, 7 Oct 2012 08:37:25 +0000 (10:37 +0200)]
maint: avoid warning from gcc's -Wunused-macros
On some systems, -Wunused-macros would warn about two macros:
src/factor.c:148:0: warning: macro "__clz_tab" is not used
src/factor.c:126:0: warning: macro "UHWtype" is not used
* src/factor.c: Add a use to placate gcc.
Jim Meyering [Fri, 5 Oct 2012 20:35:27 +0000 (22:35 +0200)]
build: avoid link failure when strerror is replaced
When building the new make-prime-list program on a system for which
strerror is defined to rpl_strerror, we'd get a link failure.
The problem is that we're including <config.h> for some definitions,
but do not want the rpl_ ones, since this particular program must
not be linked against gnulib (aka libcoreutils.a). This did not
arise on Fedora 17 or 18, but did on Debian wheezy/sid.
* src/make-prime-list.c (strerror): #undef.
Build failure introduced by commit v8.19-152-gcf67e4c.