Eric Blake [Sat, 18 Jul 2009 12:18:21 +0000 (06:18 -0600)]
error: avoid undefined use of stdout
* lib/error.c (error, error_at_line): Check that fd 1 is open
before flushing stdout. Avoids a crash on cygwin when libsigsegv
is handling faults and the close_stdout module wants to report the
detection of closed stdout as an error.
Eric Blake [Fri, 17 Jul 2009 18:00:07 +0000 (12:00 -0600)]
pipe: be robust in face of closed fds
* lib/pipe.c (create_pipe): Closed standard descriptors in parent
should cause child to misbehave.
* modules/pipe-tests: New module.
* tests/test-pipe.c: New file.
* tests/test-pipe.sh: New file.
Reported by Akim Demaille.
Jim Meyering [Sat, 4 Jul 2009 14:44:19 +0000 (16:44 +0200)]
argv-iter: new module
* MODULES.html.sh: Add argv-iter.
* lib/argv-iter.c, lib/argv-iter.h: New files.
* modules/argv-iter: New file.
* modules/argv-iter-tests: New file.
* tests/test-argv-iter.c: Test it.
Jim Meyering [Fri, 17 Apr 2009 20:03:48 +0000 (22:03 +0200)]
bootstrap: sync from coreutils
* build-aux/bootstrap: Honor variables like $ACLOCAL, etc.,
just as autoreconf does. Verify a list of prerequisite
package-name,version-number pairs if defined in bootstrap.conf.
Refer to README-prereq, if prerequisites are not satisfied.
Paolo Bonzini [Sat, 27 Jun 2009 11:00:37 +0000 (13:00 +0200)]
add warnings to selinux-h module's configure macros
2009-06-27 Paolo Bonzini <bonzini@gnu.org>
* m4/selinux-context-h (gl_HEADERS_SELINUX_CONTEXT_H): Remove
self-explaining comment.
* m4/selinux-selinux-h: Update serial.
(gl_LIBSELINUX): Warn if SELinux is found but libselinux is absent;
extracted from...
(gl_HEADERS_SELINUX_SELINUX_H): ... this one. Require gl_LIBSELINUX.
Add warning for missing development packages here, too.
* lib/argp-version-etc.c: New file.
* lib/argp-version-etc.h: New file.
* modules/argp-version-etc: New file.
* modules/argp-version-etc-tests: New file.
* tests/test-argp-version-etc.c: New test.
* tests/test-argp-version-etc-1.sh: New test.
Jim Meyering [Fri, 19 Jun 2009 12:25:37 +0000 (14:25 +0200)]
tests: maint.mk: make sc_require_test_exit_idiom more generic
* top/maint.mk (Exit_witness_file): New overridable variable.
(sc_require_test_exit_idiom): Don't hard-code tests/test-lib.sh.
Relax test for /^Exit \$fail$$/ to just /^Exit ./.
Eric Blake [Fri, 19 Jun 2009 12:35:11 +0000 (06:35 -0600)]
hash: reduce memory pressure in hash_rehash no-op case
* lib/hash.c (next_prime): Avoid overflow.
(hash_initialize): Factor bucket size computation...
(compute_bucket_size): ...into new helper function.
(hash_rehash): Use new function and open coding to reduce memory
pressure, and avoid a memory leak in USE_OBSTACK code.
Reported by Jim Meyering.
Eric Blake [Thu, 18 Jun 2009 19:31:11 +0000 (13:31 -0600)]
hash: make rotation more obvious
* modules/hash (Depends-on): Add bitrotate and stdint.
* lib/bitrotate.h (rotl_sz, rotr_sz): New functions.
* lib/hash.c (headers): Drop limits.h. Add stdint.h.
(SIZE_MAX): Rely on headers for definition.
(hash_string) [USE_DIFF_HASH]: Use rotl_sz.
(raw_hasher): Use rotr_sz.
Suggested by Jim Meyering.
Eric Blake [Thu, 18 Jun 2009 12:56:13 +0000 (06:56 -0600)]
hash: minor optimization
* lib/hash.c (hash_lookup, hash_find_entry): Avoid function call
when possible.
(hash_initialize): Document this promise.
(hash_do_for_each, hash_clear, hash_free): Use C89 syntax.
* tests/test-hash.c (hash_compare_strings): Test this.
Eric Blake [Wed, 17 Jun 2009 19:01:41 +0000 (13:01 -0600)]
hash: check for resize before insertion
* lib/hash.c (hash_insert): Check whether bucket usage exceeds
threshold before insertion, so that a pathological hash_rehash
that fills every bucket can still trigger another rehash.
Eric Blake [Thu, 18 Jun 2009 03:04:55 +0000 (21:04 -0600)]
hash: minor cleanups
* lib/hash.h (hash_entry): Make opaque, by moving...
* lib/hash.c (hash_entry): ...here.
(hash_insert): Clarify restrictions on what can be inserted.
(hash_get_next): Clarify when it is safe to remove an element
during traversal.
(check_tuning): Skip verification when tuning is known safe.
(hash_initialize): Clarify restrictions on tuning.
Eric Blake [Tue, 16 Jun 2009 12:14:05 +0000 (06:14 -0600)]
strstr, strcasestr: replace on platforms with broken memchr
* modules/strstr: Split into...
* modules/strstr-simple: ...new module that does not care about
performance, but does care about glibc bug.
* m4/strstr.m4 (gl_FUNC_STRSTR): Split...
(gl_FUNC_STRSTR_SIMPLE): ...into new macro, which replaces strstr
if platform memchr is broken, per Debian bug 521737.
* m4/strcasestr.m4 (gl_FUNC_STRCASESTR_SIMPLE): React to broken
memchr.
* m4/memchr.m4 (gl_FUNC_MEMCHR): Only expand once.
* doc/posix-functions/strstr.texi (strstr): Document the fix.
* doc/glibc-functions/strcasestr.texi (strcasestr): Likewise.
* modules/mountlist (Depends-on): Add strstr-simple.
* modules/gen-uni-tables (Depends-on): Likewise.
* modules/argz (Depends-on): Add strstr.