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.
Jim Meyering [Tue, 18 Sep 2012 06:26:17 +0000 (08:26 +0200)]
factor: 25% speed-up, on output
* src/factor.c (print_factors_single): Use fputs and umaxtostr
rather than printf with "%ju". This reduced the time required
to compute and print the factors of the first 10^7 integers from
over 8 seconds to 5.75s. Run this command:
seq $((10**7)) | env time factor > /dev/null
Jim Meyering [Sun, 16 Sep 2012 20:31:04 +0000 (22:31 +0200)]
factor: merge with preexisting factor; integrate tests; avoid warnings
* src/factor.c: Renamed from factor-ng.c, with the following changes:
Adjust copyright header to be consistent with others.
Use xmalloc and xrealloc, to avoid segv upon OOM.
Switch back to using readtokens to handle input.
Diagnose invalid inputs.
s/fprintf+exit/error/
(print_factors): Add comments.
(strto2uintmax): Return strtol_error, not int.
(read_item): Remove, no longer used.
(main): Use atexit(close_stdout) so that we don't ignore failed write.
* cfg.mk: Exempt src/longlong.h from several tests.
Exempt run.sh from the test-list-consistency test.
Exempt make-prime-list.c from numerous tests, since we won't
be making it conform: it must not link with libcoreutils.a.
Exempt factor-ng.c from the no-upper-case error message test.
* AUTHORS (factor): Add Torbjörn and Niels.
* tests/local.mk (factor_tests): Encode the 37 tests.
($(factor_tests)): Rule to generate a test script for each test.
* tests/factor/run.sh: New script, marked as very expensive.
* .gitignore: Ignore new generated files.
* src/local.mk (src/primes.h): New rule.
(noinst_PROGRAMS): Add make-prime-list.
(noinst_HEADERS): Add longlong.h.
Remove all wheel-related rules and files.
* src/wheel-gen.pl: Remove file.
maint: mark set-but-not-used variables with ATTRIBUTE_UNUSED
* src/factor-ng.c (redcify, prime_p, isqrt2): Mark them, so we
don't have to disable -Wunused-but-set-variable.
maint: use __builtin_expect only if __GNUC__
* src/factor-ng.c (LIKELY, UNLIKELY) [__GNUC__]: Add #ifdef guard.
build: avoid warning about unused macro
* src/factor-ng.c (__GMP_DECLSPEC): Don't define here
* src/longlong.h (__GMP_DECLSPEC): Define if not already defined.
Niels Möller [Wed, 19 Sep 2012 14:20:11 +0000 (16:20 +0200)]
factor: more improvements
* src/factor-ng.c: Import some improvements from
http://gmplib.org:8000/factoring
Co-authored-by: Torbjörn Granlund <tg@gmplib.org>
Torbjörn Granlund [Sun, 16 Sep 2012 20:27:20 +0000 (22:27 +0200)]
factor: new much-improved implementation; not yet integrated
* src/factor-ng.c: New file, from nt-factor.
* src/longlong.h: New file.
* NEWS (Improvements): Mention the upcoming improvements.
Co-authored-by: Niels Möller
Jim Meyering [Thu, 4 Oct 2012 18:27:31 +0000 (20:27 +0200)]
maint: make-prime-list: syntax conventions; be robust for large N
* src/make-prime-list.c: Insert spaces before parens.
(main): Abort if the 8-delta value ever exceeds 255.
Jim Meyering [Sun, 23 Sep 2012 09:33:01 +0000 (11:33 +0200)]
maint: make-prime-list: do not ignore write failure
Even though this is just a helper program that is run solely to create
primes.h, it should not ignore a write failure. Normally we would
simply call atexit (close_stdout), but we cannot do that from this
helper program, since it must be built before the generated header,
primes.h. If we were to make the linking of make-prime-list depend
on libcoreutils.a, that would add all lib/*.o files to the list
of dependents of $(BUILT_HEADERS). Then, since there is currently no
provision to ensure that a file like lib/stdio.h (another built header)
is built before the first lib/*.o file that also includes <stdio.h>,
some lib/*.o files would be built before lib/stdio.h and some after.
The former would provoke link failures due to undefined rpl_* functions.
* src/make-prime-list.c: Include <errno.h>.
(fclose): Undef, so that a definition to rpl_fclose does not
cause a link failure.
(main): Per the above, in this exceptional case, we check for fclose
and ferror failure manually, and don't worry about the ferror-only
failure case in which errno may not be relevant.
Jim Meyering [Wed, 19 Sep 2012 09:07:41 +0000 (11:07 +0200)]
maint: make-prime-list: avoid -Wsuggest-attribute=const warning
* src/make-prime-list.c: Include <config.h>.
(binvert): Add _GL_ATTRIBUTE_CONST.
Torbjörn Granlund [Sun, 16 Sep 2012 19:59:40 +0000 (21:59 +0200)]
factor: prepare for the new factor program
* src/make-prime-list.c: New file, from nt-factor.
Co-authored-by: Niels Möller <nisse@lysator.liu.se>
Jim Meyering [Tue, 18 Sep 2012 19:57:38 +0000 (21:57 +0200)]
build: remove redundant dependency: $(PROGRAMS): lib/libcoreutils.a
* src/local.mk: Remove the above dependency.
A soon-to-be-added new program, make-prime-list, must not depend
on that, since it is used to create a BUILT_SOURCES file.
That dependency is already handled via the ..._LD_ADD variables,
and so that redundant dependency has so far been harmless.
Jim Meyering [Sun, 30 Sep 2012 12:28:47 +0000 (14:28 +0200)]
du: avoid abort on systems for which ->me_type is not malloc'd
On some systems (notably, BSD-based, like at least OpenBSD 4.9),
the me_type member does not come from the heap.
* src/du.c (fill_mount_table): Free the ->me_type member only
when it was malloc'd, i.e., when ->me_type_malloced is nonzero.
Bug introduced via commit v8.19-2-gcf7e1b5.
Reported as http://bugs.gnu.org/12542.
Jim Meyering [Sat, 29 Sep 2012 12:56:13 +0000 (14:56 +0200)]
doc: same correction, but now in texinfo documentation
* doc/coreutils.texi (nice invocation): s/nicenesses/niceness values/
Jim Meyering [Fri, 28 Sep 2012 16:42:05 +0000 (18:42 +0200)]
doc: correct an old bit of ugliness in nice --help output
* src/nice.c (usage): s/Nicenesses/Niceness values/
Pádraig Brady [Fri, 28 Sep 2012 16:13:57 +0000 (17:13 +0100)]
doc: disambiguate the niceness explanation in nice --help
* src/nice.c (usage): Specify the entity (process) that
that relative terms are referring to.
* THANKS: Update.
Reported-by: David Diggles
Ondrej Oprala [Tue, 7 Aug 2012 14:56:52 +0000 (16:56 +0200)]
cp: fix the --no-preserve=mode option
The --no-preserve=mode option did not do what its name implies:
it would mistakenly preserve permission mode bits.
* NEWS: Mention the fix.
* TODO: Remove an entry.
* src/copy.c (copy_reg): Add a condition to properly
handle the --no-preserve=mode option for files
(copy_internal): Add a condition to properly handle the
--no-preserve=mode option for directories.
* src/copy.h (struct cp_options): Add a new boolean.
* src/cp.c (cp_option_init,decode_preserve_arg): Set the
new boolean value according to specified options.
* src/install.c (struct cp_options): Initialize the new boolean.
* src/mv.c (struct cp_options): Initialize the new boolean.
* tests/cp/preserve-mode.sh: Add a new test.
* tests/cp/link-preserve.sh (-a --no-preserve=mode): Adjust the
expected perms: now, --no-preserve=mode overrides the --preserve=mode
that is inherent in -a, as it should.
* tests/local.mk: Add the new test to the list.
Pádraig Brady [Wed, 12 Sep 2012 02:21:11 +0000 (03:21 +0100)]
timeout: handle signals more transparently
This was originally attempted in commit v8.12-117-g5a647a0,
but reverted before release because of the unreliability
of disabling core dumps using setrlimit() on Linux kernels.
This new version instead uses prctl() where available to
more reliably disable core dumps for the timeout process.
* m4/jm-macros.m4: Define HAVE_SETRLIMIT and HAVE_PRCTL.
* src/timeout.c (disable_core_dumps): A new function
that disables coredumps using prctl or setrlimit if available.
(main): If the child exited with a signal and we can
disable core dumps, then raise that signal to the timeout
process itself, so that callers may also see the signal status.
Also print a message indicating when the monitored command
dumped core, as that information is lost in the signal
propagation through timeout.
Pozsár Balázs [Mon, 24 Sep 2012 01:39:09 +0000 (02:39 +0100)]
dd: new option, status=none to suppress output statistics
* src/dd.c (STATUS_NONE): A new bitmask combining all STATUS_
options, thus used to suppress all informational output.
(struct symbol_value statuses): Expose the "none" option,
corresponding to the STATUS_NONE bitmask above.
(print_stats): Return early if STATUS_NONE is specified.
Also move the call to gethrxtime() down so that it's only
called when needed.
(usage): Describe the new options.
* doc/coreutils.texi (dd invocation): Likewise.
* NEWS: Mention the new feature.
* tests/dd/misc.sh: Ensure the new option works.
Jim Meyering [Wed, 19 Sep 2012 19:52:05 +0000 (21:52 +0200)]
tail,stat: improve support for vmhgfs
Teach tail -f that it must use polling on vmhgfs file systems, and
let stat -f --format=%T report the file system type name, "vmhgfs".
* src/stat.c (human_fstype): Add a case: vmhgfs, 0xbacbacbc, remote.
* NEWS (Improvements): Mention it.
* THANKS.in: Update.
Reported by Daniel Tschinder in http://bugs.gnu.org/12461.
Jim Meyering [Thu, 20 Sep 2012 15:47:25 +0000 (17:47 +0200)]
build: move non-recursive-gnulib-prefix-hack to gnulib; update
I've moved the non-recursive-gnulib-prefix-hack module to
gnulib, with two small improvements, so remove it from here
and update gnulib to the latest.
* gl/build-aux/prefix-gnulib-mk: Remove file.
* gl/m4/non-recursive-gnulib-prefix-hack.m4: Remove file.
* gl/modules/non-recursive-gnulib-prefix-hack: Remove file.
* gnulib: Update to latest.
Jim Meyering [Wed, 19 Sep 2012 07:35:12 +0000 (09:35 +0200)]
rm: be even more careful when using a replacement errno value
* src/remove.c (excise): The change in commit v8.19-107-gccbd3f3 made
the "rm -rf D" (for unreadable dir, D) diagnostic worse on Solaris 10:
-rm: cannot remove 'D': Permission denied
+rm: cannot remove 'D': File exists
That happened because unlinkat would fail with EEXIST there, given
an unreadable directory, which made the two tests, tests/rm/unread2
and tests/rm/unreadable fail. Accommodate the EEXIST case, too.
Jim Meyering [Wed, 19 Sep 2012 05:52:25 +0000 (07:52 +0200)]
maint: fix a comment typo
* cfg.mk: Fix comment typo: s/recursive/non-recursive/ make
Jim Meyering [Tue, 18 Sep 2012 21:05:42 +0000 (23:05 +0200)]
tests: cp/link-heap: avoid new failure on rawhide
* tests/cp/link-heap.sh: Increase virtual memory limit by 2000KiB --
from 20,000 to 22,000 KiB -- to avoid a new failure on rawhide.
Jim Meyering [Tue, 18 Sep 2012 14:29:49 +0000 (16:29 +0200)]
maint: make the tight-scope syntax-check rule work again
* cfg.mk: Configure a few variable to make the tight-scope rule work.
* gnulib: Update submodule to latest.
Benno Schulenberg [Tue, 18 Sep 2012 12:58:42 +0000 (14:58 +0200)]
dd: remove references to the word BLOCKS from help and texi docs
The renaming from BLOCKS to N was done in v8.15-38-g140eca1,
and documentation for N was added again in v8.17-26-g4f2e9d5
without noticing that. Now, finally remove the word BLOCKS
from the documentation.
* src/dd.c (usage): Remove the word BLOCKS.
* doc/coreutils.texi (dd invocation): Likewise.
Improved by: Bernhard Voelker <mail@bernhard-voelker.de>
Jim Meyering [Sun, 16 Sep 2012 19:46:17 +0000 (21:46 +0200)]
doc: NEWS: mention the conversion to non-recursive make
* NEWS (Build-related): Mention the non-recursive make improvement.
Improved by: Pádraig Brady
Pádraig Brady [Sun, 16 Sep 2012 03:10:50 +0000 (04:10 +0100)]
ls: fix coloring of dangling symlinks in default listing mode
When listing a directory containing dangling symlinks,
and not outputting a long format listing, and orphaned links
are set to no coloring in LS_COLORS, then the symlinks
would get no color rather than reverting to the standard
symlink color. The issue was introduced in v8.13-19-g84457c4
* src/ls.c (print_color_indicator): Use the standard method
to check if coloring is specified for orphaned symlinks.
The existing method would consider 'or=00' or 'or=0' as significant
in LS_COLORS. Even 'or=' was significant as in that case the
string='or=' and the length=0. Also apply the same change
for missing symlinks for consistency.
(gobble_file): Remove the simulation of linkok, which is only
tested in print_color_indicator() which now handles this directly
by keying on the LS_COLORS values correctly.
* tests/misc/ls-misc.pl: Add a test case.
* THANKS: Add the reporter.
* NEWS: Mention the fix.
Reported-by: David Matei
Jim Meyering [Sat, 15 Sep 2012 06:09:18 +0000 (08:09 +0200)]
doc: update seq description
* doc/coreutils.texi (seq invocation): Update an example and mention
that with the new constraints, seq can print arbitrarily large numbers.
Pádraig Brady [Fri, 14 Sep 2012 13:21:03 +0000 (14:21 +0100)]
seq: enable the fast integer printing code in more cases
* src/seq.c (main): Adjust the initial arbitrary precision
seq_fast enablement checks to be more maintainable, and
a little more general, by allowing single character
separators to use seq_fast.
Also check again after the number arguments are processed,
to see if we can still use seq_fast, which while not
allowing arbitarly large integers, it will handle
integers of the form 10E10 etc.
(seq_fast): Use a specified separator character,
rather than hardcoding '\n'.
Jim Meyering [Fri, 14 Sep 2012 17:38:33 +0000 (19:38 +0200)]
build: do not rely on automake's AM_TESTS_ENVIRONMENT
* tests/local.mk (TESTS_ENVIRONMENT): Rename from AM_TESTS_ENVIRONMENT,
since it is not honored in automake-1.11.3 after all.
This reverts commit v8.19-38-g34c9c8f. For now, I'll leave
the following commit that made bootstrap.conf require 1.11.2.
Prompted by a report of test failure from Pádraig Brady.
Jim Meyering [Fri, 14 Sep 2012 16:19:39 +0000 (18:19 +0200)]
build: don't prefix the RHS of "GPERF = ..." with "lib/"
* gl/build-aux/prefix-gnulib-mk (prefix_assignment): Exempt
the RHS of a "GPERF = ..." assignment from lib/ prefixing.
Jim Meyering [Thu, 13 Sep 2012 16:09:49 +0000 (18:09 +0200)]
seq: 70x faster for non-negative whole numbers and incr==1
Handle non-negative whole numbers robustly and efficiently when
the increment is 1 and when no format-changing option is specified.
On the correctness front, for very large numbers, seq now works fine:
$ b=
1000000000000000000000000000
$ src/seq ${b}09 ${b}11
100000000000000000000000000009
100000000000000000000000000010
100000000000000000000000000011
while the old one would infloop, printing garbage:
$ seq ${b}09 ${b}11 | head -2
99999999999999999997315645440
99999999999999999997315645440
The new code is much more efficient, too:
Old vs new: 55.81s vs 0.82s
$ env time --f=%e seq $((10**8)) > /dev/null
55.81
$ env time --f=%e src/seq $((10**8)) > /dev/null
0.82
* seq.c (incr): New function, inspired by the one in cat.c.
(cmp, seq_fast): New functions, inspired by code in nt-factor
by Torbjörn Granlund and Niels Möller.
(trim_leading_zeros): New function, without which cmp would malfunction.
(all_digits_p): New function.
(main): Hoist the format_str-vs-equal_width check to precede first
treatment of operands, and insert code to call seq_fast when possible.
* NEWS (Bug fixes): Mention the correctness fix.
(Improvements): Mention the speed-up.
* tests/misc/seq.pl: Exercise the new code.
Improved by: Bernhard Voelker.
http://thread.gmane.org/gmane.comp.gnu.coreutils.general/3340
Jim Meyering [Fri, 14 Sep 2012 07:25:33 +0000 (09:25 +0200)]
tests: reenable "make -C tests ..." commands
The README-documented way to run individual tests was invalidated
by the conversion of tests/ to non-recursive make. Add a GNUmakefile
shim to reenable that usage.
* tests/GNUmakefile: New file, so that "make -C tests ..." works
like it did before the conversion of tests/ to non-recursive build.
Reported by Bernhard Voelker.
* Makefile.am (EXTRA_DIST): Add it.
* cfg.mk (sc_prohibit_tab_based_indentation): Also exempt any
GNUmakefile from this syntax-check.
Stefano Lattarini [Tue, 11 Sep 2012 21:35:31 +0000 (23:35 +0200)]
build: fixup: correctly recognize if perl is missing
* configure.ac: Here, by adding a missing '*' to the wildcard in
a 'case' construct over the contents of $PERL. Introduced in
commit v8.19-41-g00f5ba1.
Bernhard Voelker [Tue, 11 Sep 2012 21:57:25 +0000 (23:57 +0200)]
maint: mbsalign.h: fix typo from previous comment edit
* gl/lib/mbsalign.h: Fix comment typo.
Jim Meyering [Sun, 9 Sep 2012 06:21:16 +0000 (08:21 +0200)]
build: build lib/ using non-recursive make
* bootstrap.conf (gnulib_modules): Use the new module.
(bootstrap_post_import_hook): Invoke prefix-gnulib-mk.
* configure.ac (AC_CONFIG_FILES): Remove lib/Makefile.
* lib/Makefile.am: Renamed...
* lib/local.mk: ...to this.
* src/local.mk (CLEANFILES): Append, don't set.
(noinst_LIBRARIES): Likewise.
(AM_CPPFLAGS): Don't set this here.
* Makefile.am (AM_CPPFLAGS): Define here instead.
(noinst_LIBRARIES, CLEANFILES, MOSTLYCLEANDIRS, MOSTLYCLEANFILES):
Initialize here, so we can append to them from each included local.mk
(SUBDIRS): Remove "lib".
Jim Meyering [Sun, 9 Sep 2012 19:49:42 +0000 (21:49 +0200)]
build: handle @ALLOCA@-vs-non-recursive make problems
Here is a good reason to avoid alloca with non-recursive make. These:
$ grep @ALLOCA lib/gnulib.mk
lib_libcoreutils_a_LIBADD += lib/@ALLOCA@
lib_libcoreutils_a_DEPENDENCIES += lib/@ALLOCA@
would lead to this, when @ALLOCA@ expands to the empty string,
which is essentially "always", now:
$ grep ' lib/$' Makefile
lib_libcoreutils_a_LIBADD = $(gl_LIBOBJS) lib/
lib_libcoreutils_a_DEPENDENCIES = $(gl_LIBOBJS) lib/
Tell the prefix-adding script not to add a prefix when the word it's
prefixing is "@ALLOCA@". That is fine for most cases, but what about
when the expansion of @ALLOCA@ is nonempty?
* build-aux/prefix-gnulib-mk (prefix_word): Exclude @ALLOCA@.
* gl/m4/non-recursive-gnulib-prefix-hack.m4: Prefix non-empty
$ALLOCA with "lib/". FIXME: I'm not sure this is required,
now that we...
Use AC_CONFIG_LIBOBJ_DIR([lib]).
Without using AC_CONFIG_LIBOBJ_DIR([lib]), automake (not autoconf)
would complain of failure to find aclocal.c, due to the use of
AC_LIBSOURCES(alloca.c).
Jim Meyering [Mon, 10 Sep 2012 14:38:03 +0000 (16:38 +0200)]
build: new module to convert lib/ to non-recursive make
* gl/modules/non-recursive-gnulib-prefix-hack: New module.
* gl/m4/non-recursive-gnulib-prefix-hack.m4:
(gl_NON_RECURSIVE_GNULIB_PREFIX_HACK): This is the snippet
that this module inserts near the end of configure.
* gl/build-aux/prefix-gnulib-mk: New script, from bison.
Changes from the code in bison:
(prefix_assignment): Split a long line.
(prefix): Add trailing slashes to avoid a single false match.
Prefix imaxtostr.c and the other *tostr.c file names manually.
Also, use $prefix in place of hard-coded "lib/".
Bernhard Voelker [Tue, 11 Sep 2012 06:53:56 +0000 (08:53 +0200)]
maint: gen-lists-of-programs.sh: fix typo from previous comment edit
* build-aux/gen-lists-of-programs.sh: Fix comment typo.
Pádraig Brady [Tue, 4 Sep 2012 12:12:23 +0000 (13:12 +0100)]
maint: add more control flags to mbsalign
* gl/lib/mbsalign.h: Add MBA_UNIBYTE_ONLY (to allow
faster processing). Also add MBA_NO_LEFT_PAD, MBA_NO_RIGHT_PAD
to give greater control of padding, useful with the first
or last fields on a line.
* gl/lib/mbsalign.c (mbsalign): Implement the new flags.
* gl/tests/test-mbsalign.c (main): Test combinations
of the new flags.
Jim Meyering [Sat, 8 Sep 2012 19:17:32 +0000 (21:17 +0200)]
maint: allow per-directory CFLAGS settings with non-recursive make
* src/local.mk (AM_CFLAGS): Don't use $(WARN_CFLAGS) here.
* cfg.mk (src_CFLAGS, lib_CFLAGS, gnulib-tests_CFLAGS): Define here
instead.
(AM_CFLAGS): Augment using the above.
* configure.ac: Note that the configure-time option,
--enable-gcc-warnings now functions only when using GNU make.
Well, currently it does still work in gnulib-tests, but that should
soon be fixed.
Improved-by: Stefano Lattarini
Jim Meyering [Mon, 10 Sep 2012 09:00:35 +0000 (11:00 +0200)]
maint: gen-lists-of-programs.sh: improve comments
* build-aux/gen-lists-of-programs.sh: Improve comments.
Jim Meyering [Sun, 9 Sep 2012 17:27:25 +0000 (19:27 +0200)]
build: do not require help2man at build-from-tarball time
But do retain full dependencies when building from a git clone.
We do this by converting the full dependency (of the .1 file on
the binary we run with --help) into a dependency on the .c file.
* Makefile.am (do-not-require-help2man): New rule.
(dist-hook): depend on it.
Jim Meyering [Sun, 9 Sep 2012 17:23:11 +0000 (19:23 +0200)]
build: fix a minor man-page generation dependency error
* man/local.mk (man/dir.1): Depend on src/dir, not src/ls.
Jim Meyering [Sat, 8 Sep 2012 13:11:20 +0000 (15:11 +0200)]
maint: move the last coreutils-specific files from lib/ to gl/
Convert the few remaining coreutils-specific files in lib/ to
gnulib-style modules under gl/, removing their corresponding .m4
files, since the information recorded in those files is better
stored in module-description file in gl/modules/.
* bootstrap.conf (gnulib_modules): Add new modules:
fd-reopen, buffer-lcm, xfts, strnumcmp.
* gl/lib/buffer-lcm.c: Renamed from the file in lib/.
* gl/lib/buffer-lcm.h: Likewise.
* gl/lib/fd-reopen.c: Likewise.
* gl/lib/fd-reopen.h: Likewise.
* gl/lib/strintcmp.c: Likewise.
* gl/lib/strnumcmp-in.h: Likewise.
* gl/lib/strnumcmp.c: Likewise.
* gl/lib/strnumcmp.h: Likewise.
* gl/lib/xfts.c: Likewise.
* gl/lib/xfts.h: Likewise.
* gl/modules/buffer-lcm: New module-description file.
* gl/modules/fd-reopen: Likewise.
* gl/modules/strnumcmp: Likewise.
* gl/modules/xfts: Likewise.
* m4/fd-reopen.m4: Remove, no longer needed.
* m4/strnumcmp.m4: Likewise.
* m4/xfts.m4: Likewise.
* m4/prereq.m4: Do not AC_REQUIRE the m4 functions from
our just-removed m4/*.m4 files.
Jim Meyering [Sat, 8 Sep 2012 14:01:47 +0000 (16:01 +0200)]
maint: move gl/m4/root-dev-ino.m4 contents into its module definition
We can get the same effect using the modules file.
* gl/m4/root-dev-ino.m4: Remove file.
* gl/modules/root-dev-ino (Depends-on): Add lstat.
(Files): Remove m4/root-dev-ino.m4.
(Makefile.am) [lib_SOURCES]: Add root-dev-ino.c and root-dev-ino.h.
(configure.ac): Remove reference to gl_ROOT_DEV_INO.
Jim Meyering [Fri, 7 Sep 2012 10:08:42 +0000 (12:08 +0200)]
maint: adjust ChangeLog to correct Author
* build-aux/git-log-fix: Add an entry to correct the Author:
of v8.19-111-g51a4b04. It should be Ondrej Oprala, not me.
Jim Meyering [Tue, 4 Sep 2012 16:26:25 +0000 (18:26 +0200)]
factor: NEWS and tests
* NEWS (Bug fixes): Mention it.
* tests/misc/factor.pl: Add five of Torbjörn's tests.
Torbjörn Granlund [Tue, 4 Sep 2012 16:38:29 +0000 (18:38 +0200)]
factor: don't ever declare composites to be prime
The multiple-precision factoring code (with HAVE_GMP) was copied from
a now-obsolete version of GMP that did not pass proper arguments to
the mpz_probab_prime_p function. It makes that code perform no more
than 3 Miller-Rabin tests only, which is not sufficient.
A Miller-Rabin test will detect composites with at least a probability
of 3/4. For a uniform random composite, the probability will actually
be much higher.
Or put another way, of the N-3 possible Miller-Rabin tests for checking
the composite N, there is no number N for which more than (N-3)/4 of the
tests will fail to detect the number as a composite. For most numbers N
the number of "false witnesses" will be much, much lower.
Problem numbers are of the form N=pq, p,q prime and (p-1)/(q-1) = s,
where s is a small integer. (There are other problem forms too,
involving 3 or more prime factors.) When s = 2, we get the 3/4 factor.
It is easy to find numbers of that form that cause coreutils' factor to
fail:
465658903
2242724851
6635692801
17709149503
17754345703
20889169003
42743470771
54890944111
72047131003
85862644003
98275842811
114654168091
117225546301
...
There are 9008992 composites of the form with s=2 below 2^64. With 3
Miller-Rabin tests, one would expect about 9008992/64 = 140766 to be
invalidly recognized as primes in that range.
* src/factor.c (MR_REPS): Define to 25.
(factor_using_pollard_rho): Use MR_REPS, not 3.
(print_factors_multi): Likewise.
* THANKS.in: Remove my name, now that it will be automatically
included in the generated THANKS file.
Jim Meyering [Thu, 6 Sep 2012 10:00:16 +0000 (12:00 +0200)]
tests: improve checks for setuidgid-using root-only tests
* init.cfg (setuidgid_has_perm_): New function.
(require_root_): Use it.
Improved-by: Bernhard Voelker
* NEWS (Build-related): Mention the improvement.
Eric Blake [Thu, 6 Sep 2012 14:20:17 +0000 (08:20 -0600)]
build: default to --enable-gcc-warnings for git tree
Anyone developing on coreutils can be assumed to have a new enough
environment, such that enabling gcc warnings by default will be
useful. Tarballs still default to no warnings, and the defaults
can still be overridden with --disable-gcc-warnings.
* configure.ac (gl_gcc_warnings): Set default based on environment.
Suggested by Bernhard Voelker.
Pádraig Brady [Thu, 6 Sep 2012 09:34:00 +0000 (10:34 +0100)]
nproc: disallow non option command line parameters
* src/nproc.c (main): Error if any non option parameters.
* NEWS: Mention the change in behavior.
Jim Meyering [Wed, 5 Sep 2012 20:33:44 +0000 (22:33 +0200)]
tail,stat: add support for VZFS
* src/stat.c (human_fstype): Add a case: vzfs, 0x565A4653 (local).
Reported by Jens Rosenboom in http://bugs.gnu.org/12356
* NEWS (Improvement): Mention it.
Jim Meyering [Wed, 5 Sep 2012 14:48:50 +0000 (16:48 +0200)]
rm: be more careful when using a replacement errno value
* src/remove.c (excise): Tighten the test for when we defer to an
old errno value: instead of relying solely on an FTS_DNR (unreadable
directory) failure, also test current and replacement errno values.
This change would also have solved the problem addressed by commit
v8.19-106-g57dd067. For more info, see http://bugs.gnu.org/12339#113
Jim Meyering [Tue, 4 Sep 2012 12:40:11 +0000 (14:40 +0200)]
rm: avoid bogus diagnostic for a slash-decorated symlink-to-dir
These commands would evoke an invalid diagnostic:
$ mkdir d && ln -s d s && env rm -r s/
rm: cannot remove 's': Too many levels of symbolic links
remove.c was stripping trailing slashes from "s/" before passing
the name to "rm". But a trailing slash may change the semantics,
and thus should not be stripped.
* src/remove.c (rm_fts): Do not strip trailing slashes.
* tests/rm/v-slash.sh: Adapt to new expected output.
* gnulib: Update to latest, for an improved fts.c that merely
normalizes trailing slashes.
Reported by Paul Eggert in discussion of http://bugs.gnu.org/12339
Jim Meyering [Tue, 4 Sep 2012 10:12:19 +0000 (12:12 +0200)]
tests: depend on the programs we're testing
* tests/local.mk ($(TEST_LOGS)): Depend on $(PROGRAMS), so that
tests are rerun when any program is rebuilt. Technically, we could
specify precisely which few programs are dependents of each test,
but that can come later, if deemed worth the trouble and maintenance
burden. Also, there is the issue of the primary program(s) being
tested (i.e., those itemized via print_ver_) versus those that are
tested incidentally: for example, nearly every test exercises "rm"
when its clean-up code removes files.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:19 +0000 (21:55 +0200)]
maint: fix a spurious syntax-check failure
* cfg.mk (exclude_file_name_regexp--sc_file_system): Exempt
'init.cfg', not 'tests/init.cfg'.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:18 +0000 (21:55 +0200)]
tests: more resilient about tainted absolute srcdir path
* tests/init.cfg (stty_reversible_init_): Quote '$abs_top_srcdir'
properly.
(fiemap_capable_): Quote '$abs_srcdir' properly.
(require_dirent_d_type_): Likewise.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:17 +0000 (21:55 +0200)]
maint: fix syntax checks 'sc_root_tests'
* cfg.mk: Don't work by trying to parse the (now gone) file
'tests/Makefile.am'; rather, use the contents of the make variable,
$(all_root_tests), introduced few commits ago.
Fix a few unrelated cosmetic issues while at it.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:16 +0000 (21:55 +0200)]
maint: avoid a spurious syntax-check error
* cfg.mk (exclude_file_name_regexp--sc_prohibit_test_backticks): Exempt
'tests/local.mk' rather than 'tests/Makefile.am'.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:15 +0000 (21:55 +0200)]
maint: vc_exe_in_TESTS should actually be a syntax check
Because it requires the presence of the '.git' directory, that is,
can be run only for maintainers working from checked-out sources.
* tests/local.mk (vc_exe_in_TESTS): Rename and move ...
* cfg.mk (sc_tests_list_consistency): ... here, with minor adjustments.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:14 +0000 (21:55 +0200)]
build: remove two now-useless convenience targets
* src/local.mk (built_programs.list, all_programs.list): These.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:13 +0000 (21:55 +0200)]
tests: put test-suite.log back in 'tests/'
* tests/local.mk (TEST_SUITE_LOGS): Define to 'tests/test-suite.log'.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:12 +0000 (21:55 +0200)]
build: don't use recursive make for tests/ subdirectory
* Makefile.am (SUBDIRS): Remove 'tests'.
(include): The '$(top_srcdir)/tests/local.mk' file.
(check-root): Remove this convenience target, it's no longer needed
now that the "real" check-root target once in 'tests/Makefile' will
land in the top-level makefile.
* configure.ac (AC_CONFIG_FILES): Remove 'tests/Makefile'.
* tests/Makefile.am: Rename ...
* tests/local.mk: ... like this, with a lot of adjustments.
* tests/init.cfg: Move ...
* init.cfg: ... here. This is necessary, for a limitation of the
gnulib-provided 'tests/init.sh', which unconditionally look for
'init.cfg' in the $(srcdir) directory.
* tests/*/*.sh: Adjust: expect init.sh to be in '$srcdir/tests',
not in '$srcdir', and extend $PATH with './src', not with '../src'.
* tests/Coreutils.pm: Adjust similarly.
* tests/pr/pr-tests.pl ($pfx): Likewise.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:11 +0000 (21:55 +0200)]
maint: list of names of built programs available in the Makefiles
This is just a preparatory refactoring in view of future changes.
* configure.ac (AC_SUBST): New 'built_programs'.
* tests/Makefile.am (AM_TESTS_ENVIRONMENT): Simply define the exported
variable 'built_programs' to the expansion of the '$(built_programs)'
AC_SUBST'd make variable.
(.built-programs): Remove this now-unneeded convenience target.
(CLEANFILES, check_DATA): Delete, no longer needed.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:10 +0000 (21:55 +0200)]
maint: remove anachronistic syntax-check
* cfg.mk (sc_no_exec_perl_coreutils): This. Our new testsuite
layout (perl tests having '.pl' suffix, shell tests having '.sh'
suffix) makes it basically impossible to run into the issue this
check guarded against.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:09 +0000 (21:55 +0200)]
maint: remove duplicated declaration of the 'sc_check-AUTHORS' target
* cfg.mk: Here.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:08 +0000 (21:55 +0200)]
tests: remove the unused 'root-hint' target
* tests/Makefile.am (root-hint): Here. The interested user can see
the reasons why some tests are skipped by looking at the messages
they display on the console; here's an excerpt:
...
PASS: misc/id-groups.sh
id-setgid.sh: skipped test: must be run as root
SKIP: misc/id-setgid.sh
PASS: misc/md5sum.pl
...
PASS: df/total-verify.sh
2g.sh: skipped test: very expensive: disabled by default
SKIP: du/2g.sh
...
Clear enough, and more specific and precise that a generic "some tests
might need to be run as root" message. And if that user is interested
in making those tests run anyway, he'll just take a look to the README
files to look for info. So there's no reason to pollute the stdout
with another "hint" that is subsumed by those messages, and that might
go unnoticed anyway.
Moreover, and possibly more importantly, that hint wasn't being
displayed anyway, even before this change! That's because the
'root-hint' target was listed as prerequisite for the 'check-recursive'
target, which however was not a dependency of the 'check' target in
'tests/Makefile.am', because that file contains no $(SUBDIRS)
definition.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:07 +0000 (21:55 +0200)]
tests: use suffix, not exec-bit, to tell which files are tests
* tests/Makefile.am (vc_exe_in_TESTS): Adjust to look, in the 'tests/'
subdirectory, for files that have one of the extensions listed in
$(TEST_EXTENSIONS), rather than for executable files.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:06 +0000 (21:55 +0200)]
maint: make vc_exe_in_TESTS also work in VPATH builds
* tests/Makefile.am (vc_exe_in_TESTS): It is easy to adjust this
recipe to also work in VPATH setups, also thanks to modifications
done by previous changes.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:05 +0000 (21:55 +0200)]
maint: remove useless dependency for vc_exe_in_TESTS
* tests/Makefile.am (vc_exe_in_TESTS): No need to depend on Makefile:
this target is .PHONY, so it is always run anyway.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:04 +0000 (21:55 +0200)]
maint: avoid parsing of Makefile.am from vc_exe_in_TESTS
* tests/Makefile.am (TESTS): Rename ...
(all_tests): ... like this, so that we'll still be able to know the
complete list of our tests even if the user overrides TESTS from the
command line (which he's allowed to do by the test harness API).
(root_tests): Rename ...
(all_root_tests): ... like this, for similar reasons.
(TESTS, root_tests): Redefine their defaults to to $(all_tests) and
$(all_root_tests) respectively.
(vc_exe_in_TESTS): It can now safely use $(all_tests) to get the
complete list of test cases according to the Makefile, instead of
having to resort to "parsing" of Makefile.am.
(EXTRA_DIST): Use $(all_tests), not $(TESTS).
(v_, w_): Delete, no longer needed.
Stefano Lattarini [Sun, 2 Sep 2012 19:55:03 +0000 (21:55 +0200)]
build: use 'check-local' to extend the 'check' target
* tests/Makefile.am (check-local): Here, by making this depend
on 'vc_exe_in_TESTS' ...
(check): ... rather than making this depend on them. While the old
usage worked, it relied on an implementation detail rather than on
documented behavior.
* src/local.mk (check-local): Similarly, make this depend on
'check-README' and 'check-duplicate-no-install' ...
(check): ... rather than on this.
Stefano Lattarini [Fri, 31 Aug 2012 13:41:38 +0000 (15:41 +0200)]
scripts: autotools-install: allow user-specified make program
* scripts/autotools-install: Honor $MAKE. This might be useful
on systems where the make implementation available in $PATH
by default is limited (Solaris) or broken (HP-UX).
Stefano Lattarini [Fri, 31 Aug 2012 13:41:18 +0000 (15:41 +0200)]
scripts: autotools-install: style and portability fixes
* scripts/autotools-install: Here.
Benno Schulenberg [Sat, 18 Aug 2012 10:18:37 +0000 (12:18 +0200)]
touch: line up long option in --help text
* src/touch.c (usage): Indent --time=... to line up with all of the
other long options.
Jim Meyering [Sun, 2 Sep 2012 11:46:17 +0000 (13:46 +0200)]
maint: disable sc_proper_name_utf8_requires_ICONV test
It would still pass, but would print many diagnostics like this:
Can't open src/Makefile.am: No such file or directory.
* cfg.mk (local-checks-to-skip): Temporarily disable a test.
This test will need to be adapted to work with a non-recursive
build set-up, in which there is no Makefile.am alongside each program.
Reported by Bernhard Voelker.
Jim Meyering [Sun, 2 Sep 2012 11:42:39 +0000 (13:42 +0200)]
maint: accommodate upcoming, expanded list of warnings from gnulib
* configure.ac: Disable a new gcc warning, -Wsuggest-attribute=format,
since it triggers on copy.c (which I'm not inclined to adjust) and
factor.c's use of vfprintf which would appear to require a change
to stdio.h.
Stefano Lattarini [Sat, 1 Sep 2012 10:15:59 +0000 (12:15 +0200)]
maint: fix build_programs definition not to use "make -C src ..."
* dist-check.mk (built_programs): There's no need to issue recursive
make calls in 'src/' to define this (in fact, that works no longer
now that 'src/Makefile.am' is gone). Simply define this to the sorted
contents of $(bin_PROGRAMS), with the 'src/' prefix and the $(EXEEXT)
suffix (if any) removed. Reported by Jim Meyering.
Jim Meyering [Sat, 1 Sep 2012 09:44:39 +0000 (11:44 +0200)]
build: restore handling of space-tainted build directory name
* man/local.mk: With commit v8.19-84-g08cf455, man page creation
would fail when using a build directory name containing e.g.,
spaces.
Jim Meyering [Sat, 1 Sep 2012 08:00:26 +0000 (10:00 +0200)]
build: make each man/prog.1 depend on src/prog, not src/prog.c
* man/local.mk: Creating a prog.1 man page requires running
src/prog --help.
List the exceptions, e.g., install.1 depends on src/ginstall
and arch.1 depends on src/uname.
Jim Meyering [Fri, 31 Aug 2012 18:05:29 +0000 (20:05 +0200)]
maint: check-programs-vs-x: avoid a new syntax-check failure
* cfg.mk (check-programs-vs-x): The new variable,
$(all-progs-but-lbracket) contains libstdbuf.so, and it does
not have a corresponding .x file, so exempt it.
Jim Meyering [Fri, 31 Aug 2012 23:46:59 +0000 (01:46 +0200)]
maint: avoid distcheck failure by properly cleaning $(ALL_MANS)
* man/local.mk (distclean-local): Remove $(ALL_MANS) when doing
a VPATH build. If it's not done, generated manpages can be left
around in the build directory after a "make distclean", causing
failures in "make distcheck".
Stefano Lattarini [Fri, 31 Aug 2012 23:46:58 +0000 (01:46 +0200)]
maint: port manpages generation to VPATH builds
* man/local.mk (.x.1): Use '$(MKDIR_P)' rather than bare 'mkdir'
where appropriate. Reported by Jim Meyering.
Jim Meyering [Fri, 31 Aug 2012 23:46:57 +0000 (01:46 +0200)]
build: fix VPATH issues in C compilation
* src/local.mk (AM_CPPFLAGS): Add 'src' to the directories that
are searched for #include'd files.
Stefano Lattarini [Fri, 31 Aug 2012 23:46:54 +0000 (01:46 +0200)]
maint: simplify declaration of "libexec" programs
* configure.ac: No need to use 'gl_ADD_PROG' and an indirection
variable '$optional_pkglib_progs' to declare the 'libstdbuf.so'
"libexec" program; the decision to whether compile that program
is not up to the user, but it only and simply depends on whether
the 'stdbuf' "bin" program is to be built or not.
Stefano Lattarini [Fri, 31 Aug 2012 23:46:53 +0000 (01:46 +0200)]
build: $(mandeps): new, to factor out man pages dependencies
* man/local.mk (mandpep): Rename ...
(mandeps): ... like this. Make $(ALL_MANS) depend on its
content. List 'src/system.h' in here, instead of making
$(ALL_MANS) depend on it explicitly.
(man/*.1): No need to list $(mandep) among the dependencies
any longer.
Stefano Lattarini [Fri, 31 Aug 2012 23:46:52 +0000 (01:46 +0200)]
build: enhance man pages cleaning and dependencies
* man/local.mk: All of the manpages should depend on 'src/system.h',
and all of them should be cleaned by "make maintainer-clean", that
is, added to MAINTAINERCLEANFILES. Make it be so.
Some minor cosmetic tweakings and reorderings while at it.
Stefano Lattarini [Fri, 31 Aug 2012 23:46:51 +0000 (01:46 +0200)]
build: simplify: get rid of yet some more indirection variables
* configure.ac: Adjust and improve few comments.
(MAN): Rename ...
(man1_MANS): ... to this.
Ensure it isn't initialized in all Makefiles (which would lead
to spurious errors), by calling AM_SUBST_NOTMAKE on it.
Also call AM_SUBST_NOTMAKE on 'EXTRA_MANS', for consistency.
* man/local.mk (man1_MANS): Simply define to '@man1_MANS@'.