| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
|
| |
* lib/physmem.c (physmem_total): Some systems like musl libc do not
(yet) support _SC_PHYS_PAGES. Use the linux syscall sysinfo as fallback
if _SC_PHYS_PAGES or _SC_PAGESIZE fails.
(physmem_available): Likewise for _SC_AVPHYS_PAGES.
Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
|
|
|
|
|
|
|
|
| |
Strict C does not allow converting a function pointer to void *
and vice versa. Pass a pointer to a function pointer instead.
* lib/exclude.c (add_exclude_file):
Pass the address of the function pointer.
(call_addfn): And deference the address here, to match.
|
|
|
|
|
|
|
| |
* lib/xalloc.h (x2nrealloc): Extend slightly, to allow the current
size to be zero even when the pointer is nonnull. This
accommodates the use case where P is malloc (0) and *PN is 0 on a
host where malloc (0) yields nonnull.
|
|
|
|
|
|
|
|
| |
Not all platforms have _D_EXACT_NAMLEN.
* lib/fts.c (_D_EXACT_NAMLEN): Restore definition when needed.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
| |
* lib/fts.c (fts_build): Go back to using _D_EXECT_NAMLEN
when that can be faster than strlen.
|
|
|
|
|
|
|
|
|
| |
* lib/fts.c (_D_EXACT_NAMLEN): Remove macro.
(fts_build): Store the length of the dp->d_name entry in a local variable
instead of calling strlen() several times via the above, removed macro.
For 'rm -rf some-dir' with e.g. 1M directory entries, this speeds up the
run by ~4%, and reduces the execution time by about a third if run
via "ltrace -c rm -rf some-dir".
|
|
|
|
|
|
|
|
|
|
| |
This change will ease merging with glibc. The "#if ... __NEXT__"
causes a warning with -Wundef which glibc now enables by default.
Problem reported by Will Newton in
<http://lists.gnu.org/archive/html/bug-gnulib/2014-03/msg00032.html>.
glibc <sys/cdefs.h> now uses __extension__ for GCC 2.8 or later,
so go with that.
* lib/obstack.h (__extension__):
|
|
|
|
|
|
| |
* lib/obstack.c, lib/obstack.h: Merge from glibc.
This is mostly indenting and commentary changes.
Instances of 'register' have been removed.
|
|
|
|
|
|
|
|
|
|
| |
* lib/strftime.c (DO_NUMBER): Wrap multi-statement code block of
this macro in "do {...} while(0)" to prevent false use as a
single statement, e.g., in an un-braced "{}" else-block.
(DO_SIGNED_NUMBER, DO_TZ_OFFSET, DO_NUMBER_SPACEPAD): Likewise.
(strftime_case_): Remove 'else' after 'goto' - which was the
only non-fatal, un-braced use of one of the above macros.
Spotted by coverity (NESTING_INDENT_MISMATCH).
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/modechange.c (mode_compile): During the parsing of
notations like +40, free the 'mc' buffer for invalid mode
strings like +17777 (greater than the maximum octal mode),
=18 (bad octal mode characters) or u=1 ('affected' with
octal modes).
Reproducer, e.g.:
$ valgrind --leak-check=full chmod +17777 file
Introduced via the 2012-03-09 commit, 4730c3e3, "modechange:
add notations +40, 00440, etc.".
Spotted by coverity (RESOURCE_LEAK).
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a bug when ignoring case and when comparing the
titlecase letter 'Lj' (U+01C8 LATIN CAPITAL LETTER L WITH SMALL
LETTER J) to the corresponding uppercase letter 'LJ' (U+01C7 LATIN
CAPITAL LETTER LJ). In the OS X 10.8.5 en_US.UTF-8 locale, the
titlecase letter is neither lowercase nor uppercase, but
uppercasing the titlecase letter (via towupper) yields the
uppercase letter, so the two letters should match when ignoring case.
Problem reported by Jim Meyering in <http://debbugs.gnu.org/16911#16>.
* lib/regex_internal.c (build_wcs_upper_buffer, build_upper_buffer):
Don't test whether a character is lowercase before uppercasing it.
|
|
|
|
|
|
|
|
| |
This is basically one of the options Bruno Haible proposed in:
http://lists.gnu.org/archive/html/bug-gnulib/2012-01/msg00282.html
* lib/sys_types.in.h (_GL_INCLUDING_UNISTD_H): New macro.
* lib/stdint.in.h: Use it.
* modules/stdint (Depends-on): Add sys_types.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This was reported in http://bugs.gnu.org/16872
from the coreutils command: date -d 'TZ="""'
The infinite loop for this case was present since the
initial TZ="" parsing support in commit de95bdc2 29-10-2004.
This was changed to a crash or heap corruption depending
on the platform with commit 2e3e4195 18-01-2010.
* lib/parse-datetime.y (parse_datetime): Break out of the
TZ="" parsing loop once the second significant " is found.
Also skip over any subsequent whitespace to be consistent
with the non TZ= case.
* tests/test-parse-datetime.c: Add test cases for TZ="" parsing.
|
|
|
|
|
|
|
| |
* lib/savedir.h (SAVEDIR_SORT_FASTREAD): New symbol, for programs
like GNU cp that want to use SAVEDIR_SORT_INODE if available,
SAVEDIR_SORT_NONE otherwise. Problem reported by Bernhard Voelker in:
http://lists.gnu.org/archive/html/coreutils/2014-02/msg00037.html
|
|
|
|
|
|
|
| |
* lib/unistd.in.h (_GL_INCLUDING_UNISTD_H): New macro, to work
around self-include problem in Mac OS X 10.3.9 when combined with
readlink module. Problem reported by Klaus Zietler in
<http://bugs.gnu.org/16825>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem with diffutils reported by Vincent Lefevre in
<http://bugs.gnu.org/16848>. The simplest solution is to remove
the TOO_EXPENSIVE heuristic that I added to GNU diff in 1993.
Although appropriate for circa-1993 hardware, these days the heuristic
seems to be more trouble than it's worth.
* lib/diffseq.h: Modernize citations.
(struct context): Remove member too_expensive.
All uses changed.
(struct partition): Remove members lo_minimal, hi_minimal.
All uses changed.
(diag, compareseq): Remove arg find_minimal. All uses changed.
(diag): Remove the TOO_EXPENSIVE heuristic that I added back in
1993 to make 'diff' run faster (but not as well) on large inputs.
These days, computers are fast enough that it's typically better
to run slower but more accurately.
* lib/fstrcmp.c: Remove duplicate comment.
* lib/fstrcmp.c (strcmp_bounded):
* lib/git-merge-changelog.c (compute_differences):
Adjust to diffseq.h changes.
|
|
|
|
|
|
| |
* lib/savedir.c (direntry_t): Remove size member. All uses removed.
(streamsavedir): Use stpcpy instead.
* modules/savedir (Depends-on): Add stpcpy.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds support for POSIX extended regular expressions
and fixes a long-standing memory leak (pattern buffer was never
freed). It also implements a new interface function to read
exclude patterns from a FILE, which passes an additional parameter
to its callback function, thereby allowing to preserve its state
between invocations.
* lib/exclude.c (struct patopts): Pack regex and pattern into union.
(pattern_buffer): New struct.
(exclude): New member patbuf.
(exclude_add_pattern_buffer): New function.
(free_exclude_segment): Free regexps.
(free_exclude): Free allocated pattern buffers.
(exclude_patopts): New function.
(file_pattern_matches): Use exclude_patopts.
(add_exclude): support regexps.
(add_exclude_fp): New function.
(add_exclude_file): Rewrite using add_exclude_fp.
(fnmatch_pattern_has_wildcards): Support posix extended regexps.
* lib/exclude.h (EXCLUDE_REGEX, EXCLUDE_ALLOC): New flags.
(add_exclude_fp)
(exclude_add_pattern_buffer): New prototypes.
* modules/exclude: Depends on regex and filename.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Patch based on an idea by Dick Streefland in
<https://savannah.gnu.org/patch/?7892>.
* NEWS: Document this.
* lib/savedir.c (NAME_SIZE_DEFAULT): Remove.
(direntry_t, comparison_function): New types.
(direntry_cmp_name): New function.
(direntry_cmp_inode) [D_INO_IN_DIRENT]: New function.
(streamsavedir, savedir): New arg OPTION.
(streamsavedir): Simplify memory allocation.
(fdsavedir): Remove.
* lib/savedir.h (enum savedir_option): New type.
(streamsavedir, savedir): New arg OPTION.
(fdsavedir): Remove.
|
|
|
|
|
|
|
| |
Problem with S_ISDOOR reported by Rich Burridge.
* lib/file-type.c (file_type): Do S_ISLNK early too. Do S_TYPEIS*
macros before the rest. Add S_ISCTG, S_ISDOOR, S_ISMPB, S_ISMPC,
S_ISMPX, S_ISNAM, S_ISNWK, S_ISOFD, S_ISOFL, S_ISPORT, S_ISWHT.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Dan Berrange reported compilation failure of libvirt on Fedora 20
when cross-compiling to mingw; the problem was traced to bogus
macros in the winpthreads <pthread.h> header shipped as part of
mingw-headers 3.0.
CC util/libvirt_util_la-virerror.lo
In file included from /usr/i686-w64-mingw32/sys-root/mingw/include/sys/time.h:10:0,
from ../gnulib/lib/sys/time.h:39,
from ../gnulib/lib/sys/select.h:117,
from util/virutil.h:31,
from util/virerror.c:35:
../gnulib/lib/time.h:468:21: error: expected identifier or '(' before '{' token
_GL_FUNCDECL_SYS (localtime_r, struct tm *, (time_t const *restrict __timer,
^
Gnulib's time.h was already working around the pthread.h pollution,
but now that newer mingw has started providing struct timespec,
the workaround was no longer being hit. Moving the pollution
workaround to the wrapper around the broken header solves the problem.
* lib/time.in.h: Move pthread workarounds...
* lib/pthread.in.h: ...here.
* m4/pthread.m4 (gl_PTHREAD_CHECK): Also build pthread.h when we
detect macro pollution on mingw.
* doc/posix-headers/pthread.texi (pthread.h): Document the problems.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
| |
* lib/stdalign.in.h (_Alignas): Use __attribute__ (__aligned__ (x))
if __HP_cc or __HP_aCC are nonzero.
|
|
|
|
|
|
|
|
|
|
| |
VMS's pre-C99 compiler lacks 'long long', so 'configure' doesn't
check whether strtoll is declared, which causes the C file to
wrongly report an error. Problem reported by Steven M. Schweda in:
http://lists.gnu.org/archive/html/bug-diffutils/2014-01/msg00003.html
* lib/strtoimax.c (strtoull):
Declare only if HAVE_UNSIGNED_LONG_LONG_INT.
(strtoll): Declare only if HAVE_LONG_LONG_INT.
|
|
|
|
|
|
|
| |
* lib/freadable.h (freadable): Declare with the "pure" attribute.
* lib/fwritable.h (fwritable): Likewise.
* lib/fwriting.h (fwriting): Likewise.
Suggested by Bruno Haible.
|
|
|
|
| |
* lib/freading.h (freading): Declare with the "pure" attribute.
|
|
|
|
|
|
| |
I ran 'make update-copyright'.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
|
| |
* lib/version-etc.c (COPYRIGHT_YEAR): Bump to 2014.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
I noticed that recvfd() fails with errno set to EACCES if the
other end of the socket has closed (such as if it calls _exit());
but "Permission denied" as the strerror() message doesn't read
very well. This improves things to give the nicer message:
"Transport endpoint is not connected".
* lib/passfd.c (recvfd): Fake ENOTCONN if other end closes early.
* tests/test-passfd.c (main): Enhance test to cover this.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Without this further patch, Emacs won't build due to
the portcheck failing. Also, this simplifies the patch a bit.
* lib/time.in.h (localtime, gmtime): Don't replace unless
GNULIB_GETTIMEOFDAY. Treat them more like mktime.
* lib/time.in.h (localtime, gmtime):
* m4/gettimeofday.m4 (gl_GETTIMEOFDAY_REPLACE_LOCALTIME):
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS):
* modules/time (time.h):
Don't worry about about the possibility of localtime and gmtime
being absent; they're present in all C libraries we know about.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS):
Don't assume sys_time is present and has been initialized.
Instead, use a hack that should work even if it hasn't been.
Don't use a portcheck for gmtime or localtime; this supports
the hack.
* modules/time (time.h): Substitute GNULIB_GETTIMEOFDAY.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Never replace gmtime and localtime by macros when compiling with
C++, this prevents <ctime> from being included.
* m4/gettimeofday.m4 (gl_GETTIMEOFDAY_REPLACE_LOCALTIME): Do not
define gmtime and localtime as preprocessor macros. Instead
define some HAVE_GMTIME, HAVE_LOCALTIME, REPLACE_GMTIME, and
REPLACE_LOCALTIME substitutions.
* lib/time.in.h: Declare gmtime and localtime when needed.
* m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): AC_SUBST HAVE_GMTIME,
HAVE_LOCALTIME, REPLACE_GMTIME, and REPLACE_LOCALTIME.
* modules/time: Depend on gettimeofday, and substitute the above
variables in time.h.
|
|
|
|
|
|
|
|
| |
See Eli Zaretskii in
<http://lists.gnu.org/archive/html/emacs-devel/2013-12/msg00593.html>.
* lib/file-has-acl.c (acl_access_nontrivial):
Return -1 and set errno if !HAVE_ACL_FIRST_ENTRY &&
!HAVE_ACL_TO_SHORT_TEXT && !HAVE_ACL_FREE_TEXT.
|
|
|
|
| |
* lib/gl_openssl.h: Cast void pointers to a specific type.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
--with-openssl the libcrypto md5, sha1, sha224, sha256, sha384, sha256
routines will be used if available, requiring apps to link @LIB_CRYPTO@
* lib/gl_openssl.h: Provide wrappers for specified openssl hash.
* m4/gl-openssl.m4 (gl_CRYPTO_CHECK): New function to lookup libcrypto
in the standard system location.
* m4/sha1.m4: Call gl_CRYPTO_CHECK() for SHA1.
* m4/sha256.m4: Likewise with SHA256.
* m4/sha512.m4: Likewise with SHA512.
* m4/md5.m4: Likewise with MD5.
* m4/gc.m4: Ensure @LIB_CRYPTO@ set for tests.
* lib/sha1.h: Include wrappers if HAVE_OPENSSL_SHA1.
* lib/sha256.h: Likewise with SHA256.
* lib/sha512.h: Likewise with SHA512.
* lib/md5.h: Likewise with MD5.
* lib/sha1.c: Exlude functionality if HAVE_OPENSSL_SHA1.
* lib/sha256.c: Likewise with SHA256.
* lib/sha512.c: Likewise with SHA512.
* lib/md5.c: Likewise with MD5.
* modules/crypto/sha1 (Link:): Add the new optional lib.
(Depends-on:): Add dependency on extern-inline.
* modules/crypto/sha256: Likewise.
* modules/crypto/sha512: Likewise.
* modules/crypto/md5: Likewise.
* modules/crypto/sha1-tests: Reference the lib here too.
* modules/crypto/md5-tests: Likewise.
* modules/crypto/gc-des-tests: Likewise.
* modules/crypto/gc-hmac-md5-tests: Likewise.
* modules/crypto/gc-hmac-sha1-tests: Likewise.
* modules/crypto/gc-hmac-sha256-tests: Likewise.
* modules/crypto/gc-hmac-sha512-tests: Likewise.
* modules/crypto/gc-md5-tests: Likewise.
* modules/crypto/gc-pbkdf2-sha1-tests: Likewise.
* modules/crypto/gc-sha1-tests: Likewise.
* modules/crypto/gc-tests: Likewise.
* modules/crypto/hmac-md5-tests: Likewise.
* modules/crypto/hmac-sha1-tests: Likewise.
* modules/crypto/hmac-sha256-tests: Likewise.
* modules/crypto/hmac-sha512-tests: Likewise.
|
|
|
|
|
|
|
|
|
|
| |
This fixes a compile failure with
"Sun C 5.8 Patch 121015-05 2007/08/01"
which returns:
"base64.c", line 99: void function cannot return value
* lib/base64.c: Don't return the void function,
instead split to a separate return statement.
|
|
|
|
|
|
|
| |
* lib/ignore-value.h (ignore_value): Use __extension__ and
__typeof__ only for GCC 3.4 and later. Reported by Eric Blake in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-11/msg00102.html>.
Change the comment to try to explain this better.
|
|
|
|
|
|
|
|
|
| |
* lib/se-selinux.in.h: Change security_context_t to a typedef
rather than a define, as it's a pointer type and so is better
as a typedef to avoid issues declaring multiple variables
with the comma operator. Also add stub for string_to_security_class().
* lib/se-context.in.h: Add stub functions for
context_{type,range,role,user}_get().
|
|
|
|
|
|
|
|
| |
The code didn't match the comments, so I did a bit of software
archaeology. GCC 2.0 seems to support __extension__ and
__typeof__, so fix both code and comments to use 2.0.
* lib/ignore-value.h (ignore_value): Use __extension__ and
__typeof__ for GCC 2.0 through 3.3, too.
|
|
|
|
|
|
|
|
|
|
|
| |
* lib/quotearg.c (quotearg_buffer_restyled): Building coreutils with
gcc's new -fsanitize=undefined and running its tests triggered some
new test failures due to undefined behavior, all with this diagnostic:
lib/quotearg.c:629:62: runtime error: left shift of 1 by 31 places \
cannot be represented in type int
Rather than shifting "1" left to form a mask, shift the bits right and
simply use "1" as the mask.
Co-authored-by: Paul Eggert <eggert@cs.ucla.edu>
|
| |
|
|
|
|
|
| |
New function and macro, to work around _DARWIN_C_SOURCE problem.
Reported by Jack Howarth in <http://bugs.gnu.org/14463>.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Avoid conditionals in the base64 encoding loop,
which was seen to give a 60% throughput improvement
with the base64 utility from coreutils:
$ truncate -s100MiB file.in
$ time base64-old -w0 < file.in >/dev/null
real 0m0.302s
$ time base64-new -w0 < file.in >/dev/null
real 0m0.182s
* lib/base64.c (base64_encode_fast): A new function to be called
when we don't want to NUL terminate, and we have enough space
in the output to encode the given input.
(base64_encode): Call the _fast() version when appropriate.
Also remove a redundant mask with 0x3F on the first encoded byte.
|
|
|
|
|
|
|
|
| |
Use correct witness macro name (reported by Paul Eggert).
* lib/fpending.h (__fpending): s/DECL_FPENDING/DECL___FPENDING/.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 3f5bf99e claimed that it is safe to declare __fpending twice,
but in reality this caused a regression on Dragonfly BSD. Reported by
GW in <https://lists.gnu.org/archive/html/bug-m4/2013-11/msg00000.html>,
<https://lists.gnu.org/archive/html/bug-gnulib/2013-11/msg00022.html>.
* m4/fpending.m4 (gl_FUNC_FPENDING): Check for declaration.
* lib/fpending.h (__fpending): Don't declare twice.
Signed-off-by: Eric Blake <eblake@redhat.com>
|
|
|
|
|
| |
* lib/intprops.h (_GL_HAVE___TYPEOF__) [__SUNPRO_C && __STDC__]:
Define to 0, to avoid diagnostics when Oracle Studio is pedantic.
|
|
|
|
|
|
|
|
|
| |
* lib/obstack.h (obstack_free) [!__GNUC__]: Rewrite to avoid
warning "conversion from pointer to smaller integer" from HP
C-ANSI-C - cc version B9007AA/B3910B A.06.26. It's safe to assume
C89 or later nowadays, so cast to void instead of int. Privately
reported by H.Merijn Brand. Also, change header to match glibc's,
to make checking against glibc easier.
|
|
|
|
|
|
|
| |
Reported by John Klos for NetBSD-5/VAX in
<http://lists.gnu.org/archive/html/bug-gnulib/2013-10/msg00133.html>.
* lib/isnan.c (IEEE_FLOATING_POINT): New macro, stolen from Emacs.
(FUNC): Use it.
|
|
|
|
| |
* lib/regex_internal.h: Remove final vestige of the wcscoll dependency.
|
|
|
|
|
| |
* lib/xfreopen.c: Fix description.
* modules/xfreopen: Likewise.
|
|
|
|
|
| |
* lib/error.c (error_tail): Add the printf attribute, to placate
gcc's -Werror=suggest-attribute=format option.
|
|
|
|
|
|
|
|
|
| |
* lib/fpending.h (__fpending): Declare with the "pure" attribute.
* lib/obstack.c (_obstack_allocated_p): Likewise.
* lib/obstack.h (_obstack_memory_used): Likewise.
(_obstack_memory_used): Likewise.
* lib/strerror-override.h (strerror_override): Declare with
the "const" attribute.
|