about summary refs log tree commit diff
path: root/posix
Commit message (Collapse)AuthorAgeFilesLines
* Fix hardcoded /tmp paths in testing (bug 13888).Joseph Myers2018-06-262-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As noted in bug 13888, and as I noted previously in <https://sourceware.org/ml/libc-alpha/2000-10/msg00111.html>, various tests used hardcoded paths in /tmp, so posing issues for simultaneous test runs from different build directories. This patch fixes such uses of hardcoded file names to put them in the build directory instead (in the case of stdio-common/bug5 the file names are changed as well, to avoid a conflict with the name bug5.out also used for the automatic test output redirection). It also fixes test-installation.pl likewise (that was using filenames with $$ in them rather than strictly hardcoded names, but that's still not good practice for temporary file naming). Note that my list of files changed is not identical to that in bug 13888. I added tst-spawn3.c and test-installation.pl, and removed some tests that seem to me (now) to create temporary files securely (simply using /tmp is not itself a problem if the temporary files are handled properly with mkstemp; I haven't checked whether those tests used to do things insecurely). conformtest is not changed because the makefiles always pass a --tmpdir option so the /tmp default is irrelevant, and for the same reason there is no actual problem with nptl/tst-umask1.c because again the makefiles always override the default. nptl/sockperf.c is ignored because there is no code to run it; probably that file should actually be removed. Some tests use the mktemp function, but I think they all use it in a way that *is* secure (for generating names for directories / sockets / fifos / symlinks, where the operation using the name will not follow symlinks and so there is no potential for a symlink attack on the account running the testsuite). Some tests use the tmpnam function to generate temporary file names. This is in principle insecure, but not addressed by this patch (I consider it a separate issue from the fully hardcoded paths). Tested for x86_64. [BZ #13888] * posix/Makefile (CFLAGS-tst-spawn3.c): New variable. * posix/tst-spawn3.c (do_test): Put tst-spwan3.pid in OBJPFX, not /tmp. * scripts/test-installation.pl: Put temporary files in build directory, not /tmp. * stdio-common/Makefile (CFLAGS-bug3.c): New variable. (CFLAGS-bug4.c): Likewise. (CFLAGS-bug5.c): Likewise. (CFLAGS-test-fseek.c): Likewise. (CFLAGS-test-popen.c): Likewise. (CFLAGS-test_rdwr.c): Likewise. * stdio-common/bug3.c (main): Put temporary file in OBJPFX, not /tmp. * stdio-common/bug4.c (main): Likewise. * stdio-common/bug5.c (main): Likewise. * stdio-common/test-fseek.c (TESTFILE): Likewise. * stdio-common/test-popen.c (do_test): Likewise. * stdio-common/test_rdwr.c (main): Likewise.
* Avoid cancellable I/O primitives in ld.so.Zack Weinberg2018-06-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Neither the <dlfcn.h> entry points, nor lazy symbol resolution, nor initial shared library load-up, are cancellation points, so ld.so should exclusively use I/O primitives that are not cancellable. We currently achieve this by having the cancellation hooks compile as no-ops when IS_IN(rtld); this patch changes to using exclusively _nocancel primitives in the source code instead, which makes the intent clearer and significantly reduces the amount of code compiled under IS_IN(rtld) as well as IS_IN(libc) -- in particular, elf/Makefile no longer thinks we require a copy of unwind.c in rtld-libc.a. (The older mechanism is preserved as a backstop.) The bulk of the change is splitting up the files that define the _nocancel I/O functions, so they don't also define the variants that *are* cancellation points; after which, the existing logic for picking out the bits of libc that need to be recompiled as part of ld.so Just Works. I did this for all of the _nocancel functions, not just the ones used by ld.so, for consistency. fcntl was a little tricky because it's only a cancellation point for certain opcodes (F_SETLKW(64), which can block), and the existing __fcntl_nocancel wasn't applying the FCNTL_ADJUST_CMD hook, which strikes me as asking for trouble, especially as the only nontrivial definition of FCNTL_ADJUST_CMD (for powerpc64) changes F_*LK* opcodes. To fix this, fcntl_common moves to fcntl_nocancel.c along with __fcntl_nocancel, and changes its name to the extern (but hidden) symbol __fcntl_nocancel_adjusted, so that regular fcntl can continue calling it. __fcntl_nocancel now applies FCNTL_ADJUST_CMD; so that both both fcntl.c and fcntl_nocancel.c can see it, the only nontrivial definition moves from sysdeps/u/s/l/powerpc/powerpc64/fcntl.c to .../powerpc64/sysdep.h and becomes entirely a macro, instead of a macro that calls an inline function. The nptl version of libpthread also changes a little, because its "compat-routines" formerly included files that defined all the _nocancel functions it uses; instead of continuing to duplicate them, I exported the relevant ones from libc.so as GLIBC_PRIVATE. Since the Linux fcntl.c calls a function defined by fcntl_nocancel.c, it can no longer be used from libpthread.so; instead, introduce a custom forwarder, pt-fcntl.c, and export __libc_fcntl from libc.so as GLIBC_PRIVATE. The nios2-linux ABI doesn't include a copy of vfork() in libpthread, and it was handling that by manipulating libpthread-routines in .../linux/nios2/Makefile; it is cleaner to do what other such ports do, and have a pt-vfork.S that defines no symbols. Right now, it appears that Hurd does not implement _nocancel I/O, so sysdeps/generic/not-cancel.h will forward everything back to the regular functions. This changed the names of some of the functions that sysdeps/mach/hurd/dl-sysdep.c needs to interpose. * elf/dl-load.c, elf/dl-misc.c, elf/dl-profile.c, elf/rtld.c * sysdeps/unix/sysv/linux/dl-sysdep.c Include not-cancel.h. Use __close_nocancel instead of __close, __open64_nocancel instead of __open, __read_nocancel instead of __libc_read, and __write_nocancel instead of __libc_write. * csu/check_fds.c (check_one_fd) * sysdeps/posix/fdopendir.c (__fdopendir) * sysdeps/posix/opendir.c (__alloc_dir): Use __fcntl_nocancel instead of __fcntl and/or __libc_fcntl. * sysdeps/unix/sysv/linux/pthread_setname.c (pthread_setname_np) * sysdeps/unix/sysv/linux/pthread_getname.c (pthread_getname_np) * sysdeps/unix/sysv/linux/i386/smp.h (is_smp_system): Use __open64_nocancel instead of __open_nocancel. * sysdeps/unix/sysv/linux/not-cancel.h: Move all of the hidden_proto declarations to the end and issue them if either IS_IN(libc) or IS_IN(rtld). * sysdeps/unix/sysv/linux/Makefile [subdir=io] (sysdep_routines): Add close_nocancel, fcntl_nocancel, nanosleep_nocancel, open_nocancel, open64_nocancel, openat_nocancel, pause_nocancel, read_nocancel, waitpid_nocancel, write_nocancel. * io/Versions [GLIBC_PRIVATE]: Add __libc_fcntl, __fcntl_nocancel, __open64_nocancel, __write_nocancel. * posix/Versions: Add __nanosleep_nocancel, __pause_nocancel. * nptl/pt-fcntl.c: New file. * nptl/Makefile (pthread-compat-wrappers): Remove fcntl. (libpthread-routines): Add pt-fcntl. * include/fcntl.h (__fcntl_nocancel_adjusted): New function. (__libc_fcntl): Remove attribute_hidden. * sysdeps/unix/sysv/linux/fcntl.c (__libc_fcntl): Call __fcntl_nocancel_adjusted, not fcntl_common. (__fcntl_nocancel): Move to new file fcntl_nocancel.c. (fcntl_common): Rename to __fcntl_nocancel_adjusted; also move to fcntl_nocancel.c. * sysdeps/unix/sysv/linux/fcntl_nocancel.c: New file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/fcntl.c: Remove file. * sysdeps/unix/sysv/linux/powerpc/powerpc64/sysdep.h: Define FCNTL_ADJUST_CMD here, as a self-contained macro. * sysdeps/unix/sysv/linux/close.c: Move __close_nocancel to... * sysdeps/unix/sysv/linux/close_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/nanosleep.c: Move __nanosleep_nocancel to... * sysdeps/unix/sysv/linux/nanosleep_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/open.c: Move __open_nocancel to... * sysdeps/unix/sysv/linux/open_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/open64.c: Move __open64_nocancel to... * sysdeps/unix/sysv/linux/open64_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/openat.c: Move __openat_nocancel to... * sysdeps/unix/sysv/linux/openat_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/openat64.c: Move __openat64_nocancel to... * sysdeps/unix/sysv/linux/openat64_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/pause.c: Move __pause_nocancel to... * sysdeps/unix/sysv/linux/pause_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/read.c: Move __read_nocancel to... * sysdeps/unix/sysv/linux/read_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/waitpid.c: Move __waitpid_nocancel to... * sysdeps/unix/sysv/linux/waitpid_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/write.c: Move __write_nocancel to... * sysdeps/unix/sysv/linux/write_nocancel.c: ...this new file. * sysdeps/unix/sysv/linux/nios2/Makefile: Don't override libpthread-routines. * sysdeps/unix/sysv/linux/nios2/pt-vfork.S: New file which defines nothing. * sysdeps/mach/hurd/dl-sysdep.c: Define __read instead of __libc_read, and __write instead of __libc_write. Define __open64 in addition to __open.
* posix: Fix posix_spawnp to not execute invalid binaries in non compat mode ↵Adhemerval Zanella2018-06-084-9/+154
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (BZ#23264) Current posix_spawnp implementation wrongly tries to execute invalid binaries (for instance script without shebang) as a shell script in non compat mode. It was a regression introduced by 9ff72da471a509a8c19791efe469f47fa6977410 when __spawni started to use __execvpe instead of __execve (glibc __execvpe try to execute ENOEXEC as shell script regardless). This patch fixes it by using an internal symbol (__execvpex) with the faulty semantic (since compat mode is handled by spawni.c itself). It was reported by Daniel Drake on libc-help [1]. Checked on x86_64-linux-gnu and i686-linux-gnu. [BZ #23264] * include/unistd.h (__execvpex): New prototype. * posix/Makefile (tests): Add tst-spawn4. (tests-internal): Add tst-spawn4-compat. * posix/execvpe.c (__execvpe_common, __execvpex): New functions. * posix/tst-spawn4-compat.c: New file. * posix/tst-spawn4.c: Likewise. * sysdeps/unix/sysv/linux/spawni.c (__spawni): Do not interpret invalid binaries as shell scripts. * sysdeps/posix/spawni.c (__spawni): Likewise. [1] https://sourceware.org/ml/libc-help/2018-06/msg00012.html
* hurd: Avoid exposing all <sched.h> symbols from sys/types.hSamuel Thibault2018-04-191-1/+1
| | | | | | | | | | * bits/sched.h: Include <bits/types/struct_sched_param.h> and move struct sched_param definition to it. * sysdeps/unix/sysv/linux/bits/sched.h: Likewise. * bits/types/struct_sched_param.h: New file. * sysdeps/htl/bits/types/struct___pthread_attr.h: Include <bits/types/struct_sched_param.h> instead of <sched.h>. * posix/Makefile (headers): Add bits/types/struct_sched_param.h.
* Revert "Fix sched_param"Samuel Thibault2018-04-192-3/+2
| | | | | This reverts commit 783c4820303fb6b031d401564f8089ecaf154b62 which accidentaly flew out.
* Fix sched_paramSamuel Thibault2018-04-182-2/+3
|
* Fix multiple definitions of __nss_*_database (bug 22918)Andreas Schwab2018-03-033-0/+3
|
* Fix test cases tst-fnmatch and tst-regexloc for the new iso14651_t1_common file.Mike FABIAN2018-02-272-18/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | See: http://pubs.opengroup.org/onlinepubs/7908799/xbd/re.html > A range expression represents the set of collating elements that fall > between two elements in the current collation sequence, > inclusively. It is expressed as the starting point and the ending > point separated by a hyphen (-). > > Range expressions must not be used in portable applications because > their behaviour is dependent on the collating sequence. Ranges will be > treated according to the current collating sequence, and include such > characters that fall within the range based on that collating > sequence, regardless of character values. This, however, means that > the interpretation will differ depending on collating sequence. If, > for instance, one collating sequence defines ä as a variant of a, > while another defines it as a letter following z, then the expression > [ä-z] is valid in the first language and invalid in the second. Therefore, using [a-z] does not make much sense except in the C/POSIX locale. The new iso14651_t1_common lists upper case and lower case Latin characters in a different order than the old one which causes surprising results for example in the de_DE locale: [a-z] now includes A because A comes after a in iso14651_t1_common but does not include Z because that comes after z in iso14651_t1_common. * posix/tst-fnmatch.input: Fix results for range expressions for non C locales. * posix/tst-regexloc.c: Do not use a range expression for de_DE.ISO-8859-1 locale.
* Fix posix/bug-regex5.c test case, adapt to iso14651_t1_common upateMike FABIAN2018-02-271-2/+2
| | | | | | | | | | | | | | | | | | | | | | | This test case tests how many collating elements are defined in da_DK.ISO-8859-1 locale. The da_DK locale source defines 4: collating-element <A-A> from "<U0041><U0041>" collating-element <A-a> from "<U0041><U0061>" collating-element <a-A> from "<U0061><U0041>" collating-element <a-a> from "<U0061><U0061>" The new iso14651_t1_common file defines more collating elements, two of them are in the ISO-8859-1 range: collating-element <U004C_00B7> from "<U004C><U00B7>" % decomposition of LATIN CAPITAL LETTER L WITH MIDDLE DOT collating-element <U006C_00B7> from "<U006C><U00B7>" % decomposition of LATIN SMALL LETTER L WITH MIDDLE DOT So the total count is now 6 instead of 4. * posix/bug-regex5.c: Fix test case because with the new iso14651_t1_common file, the da_DK locale now has 6 collating elements in the ISO-8859-1 range instead of 4 with the old iso14651_t1_common file.
* Fix posix/tst-glob_lstat_compat on alpha [BZ #22818]Aurelien Jarno2018-02-181-0/+7
| | | | | | | | | | | | | The tst-glob_lstat_compat test needs to run tests on the previous version of glob. On alpha, there are three versions of glob, GLIBC_2.0, GLIBC_2.1 and GLIBC_2.27, while on other architectures there are only the GLIBC_2.0 and GLIBC_2.27 version. Therefore on alpha the previous version is GLIBC_2.1 and not GLIBC_2.0. Changelog: [BZ #22818] * posix/tst-glob_lstat_compat.c [__alpha__] (glob): Access the GLIBC_2.1 version.
* [BZ #19239] Don't include sys/sysmacros.h from sys/types.h.Zack Weinberg2018-02-121-9/+0
| | | | | | | | | This completes the deprecation and removal of this inclusion, which was begun in the 2.25 release. * posix/sys/types.h: Don't include sys/sysmacros.h. * misc/sys/sysmacros.h: Remove the conditional deprecation warnings for the macros defined by this header.
* Define char16_t, char32_t consistently with uint_least16_t, uint_least32_t ↵Joseph Myers2018-02-071-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (bug 17979). As noted in bug 17979 (and as I noted earlier in <https://sourceware.org/ml/libc-alpha/2012-02/msg00647.html>), uchar.h has gratuitously complicated code to determine the types for char16_t and char32_t, and to reject including that header for pre-C11 compilers not defining __CHAR16_TYPE__ and __CHAR32_TYPE__. Since those types are always required to match uint_least16_t and uint_least32_t, which glibc knows how to define without reference to such predefined macros, it's safe just to define those types the same as the *least* types are defined in stdint.h, so allowing the header to work with (for example) GCC 4.3. This patch implements that. bits/types.h is made to define __int_leastN_t and __uint_leastN_t so the logic for those types can stay in a single place, and stdint.h is made to use those __*_t to define the public *_t types. uchar.h is then made to use __uint_least16_t and __uint_least32_t to define char16_t and char32_t, so simplifying the logic there. A new test is added that verifies the types chosen for char16_t and char32_t do indeed match the types the compiler uses for u"" and U"" string literals. Tested for x86_64. (I have not tested with any of the older compilers for which this would actually make a difference to whether you can include uchar.h.) [BZ #17979] * posix/bits/types.h (__int_least8_t): New typedef. (__uint_least8_t): Likewise. (__int_least16_t): Likewise. (__uint_least16_t): Likewise. (__int_least32_t): Likewise. (__uint_least32_t): Likewise. (__int_least64_t): Likewise. (__uint_least64_t): Likewise. * sysdeps/generic/stdint.h (int_least8_t): Define using __int_least8_t. (int_least16_t): Define using __int_least16_t. (int_least32_t): Define using __int_least32_t. (int_least64_t): Define using __int_least64_t. (uint_least8_t): Define using __uint_least8_t. (uint_least16_t): Define using __uint_least16_t. (uint_least32_t): Define using __uint_least32_t. (uint_least64_t): Define using __uint_least64_t. * wcsmbs/uchar.h: Include <bits/types.h>. (char16_t): Define using __uint_least16_t conditional only on [!__USE_ISOCXX11]. (char32_t): Define using __uint_least32_t conditional only on [!__USE_ISOCXX11]. * wcsmbs/test-char-types.c: New file. * wcsmbs/Makefile (tests): Add test-char-types.
* Fix -Os gnu_dev_* linknamespace, localplt issues (bug 15105, bug 19463).Joseph Myers2018-02-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Building with -Os produces linknamespace and localplt failures for, among other functions, gnu_dev_major, gnu_dev_minor and gnu_dev_makedev. The issue is that those functions are not inlined when building with -Os. While one could force them to be inlined in that case, it seems more natural to fix this issue similarly to other namespace issues. Thus, this patch makes gnu_dev_* into weak aliases for hidden symbols __gnu_dev_*; __gnu_dev_* are then defined as inlines in the internal include/sys/sysmacros.h, and uses of gnu_dev_* (often via the macros major, minor and makedev) for which there are namespace issues are changed to use __gnu_dev_*; where there are no namespace issues, use of libc_hidden_proto serves to avoid unnecessary local PLT entry use. Tested for x86_64, (a) without -Os, to verify the testsuite continues to pass without problems and that the functions called under their new names continue to be inlined as expected in that case; (b) with -Os, to verify that the linknamespace and localplt failures in question go away (but because of other such failures present, neither of the relevant bugs can yet be closed). [BZ #15105] [BZ #19463] * include/sys/sysmacros.h [!_ISOMAC] (__SYSMACROS_NEED_IMPLEMENTATION): Define macro. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (_SYS_SYSMACROS_H_WRAPPER): Likewise. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (gnu_dev_major): Use libc_hidden_proto. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (gnu_dev_minor): Likewise. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (gnu_dev_makedev): Likewise. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (__SYSMACROS_DECL_TEMPL): Undefine and redefine to add use __gnu_dev_ prefix. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (__SYSMACROS_IMPL_TEMPL): Likewise. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (__gnu_dev_major): Declare and define as hidden inline function. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (__gnu_dev_minor): Likewise. [!_SYS_SYSMACROS_H_WRAPPER && !_ISOMAC] (__gnu_dev_makedev): Likewise. * misc/makedev.c (OUT_OF_LINE_IMPL_TEMPL): Use __gnu_dev_ prefix. (gnu_dev_major): Use weak_alias and libc_hidden_weak. (gnu_dev_minor): Likewise. (gnu_dev_makedev): Likewise. * csu/check_fds.c (check_one_fd): Use __gnu_dev_makedev instead of makedev. * posix/wordexp.c (exec_comm_child): Likewise. * sysdeps/mach/hurd/xmknodat.c (__xmknodat): Use __gnu_dev_minor instead of minor and __gnu_dev_major instead of major. * sysdeps/unix/sysv/linux/device-nrs.h (DEV_TTY_P): Use __gnu_dev_major instead of major. * sysdeps/unix/sysv/linux/pathconf.c (distinguish_extX): Use __gnu_dev_major instead of gnu_dev_major and __gnu_dev_minor instead of gnu_dev_minor. * sysdeps/unix/sysv/linux/ptsname.c (MASTER_P): Likewise. (SLAVE_P): Likewise. (__ptsname_internal): Use __gnu_dev_minor instead of minor. * sysdeps/unix/sysv/linux/ttyname.h (is_pty): Use __gnu_dev_major instead of major.
* Correct type of SSIZE_MAX for 32-bit (bug 13575).Joseph Myers2018-02-063-2/+49
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug 13575 reports that SSIZE_MAX is wrongly defined as LONG_MAX on 32-bit systems where ssize_t is defined as int (which is most 32-bit systems supported by glibc). This patch fixes the definition, using a conditional on __WORDSIZE32_SIZE_ULONG to determine the appropriate type in the 32-bit case. Formally ssize_t need not be the signed type corresponding to size_t, but as it is for all current glibc configurations, there is no need for a new macro different from the one used for defining SIZE_MAX. A testcase is added for both the type and the value of SSIZE_MAX. There is a relevant peculiarity in sysdeps/unix/sysv/linux/s390/bits/typesizes.h: /* Compatibility with g++ 2.95.x. */ /* size_t is unsigned long int on s390 -m31. */ This has the effect that for GCC 2 for s390, ssize_t does not match __WORDSIZE32_SIZE_ULONG. I don't think such a conditional on the GCC version makes sense - to have a well-defined ABI, the choices of standard types should not depend on the GCC version. It's also the case that upstream GCC 2.95 did not support s390, and glibc headers don't in general try to support past development GCC versions - only actual releases and current mainline development. But whether or not that GCC 2 case should be removed (with or without a NEWS entry for such a change), this patch does not result in any changes for s390; the value is always still LONG_MAX in the s390 case because __WORDSIZE32_SIZE_ULONG is always defined for 32-bit s390. I don't think any such oddity in code only active for unofficial or unreleased old compiler versions should block closing the present bug as fixed once this patch is in. Tested for x86_64 and x86, and with build-many-glibcs.py. [BZ #13575] * posix/bits/posix1_lim.h: Include <bits/wordsize.h>. [!SSIZE_MAX && !(__WORDSIZE == 64 || __WORDSIZE32_SIZE_ULONG)] (SSIZE_MAX): Define to INT_MAX. * posix/test-ssize-max.c: New file. * posix/Makefile (tests): Add test-ssize-max.
* Only define loff_t for __USE_MISC (bug 14553).Joseph Myers2018-02-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | Bug 14553 reports that sys/types.h defines loff_t unconditionally, despite it not being part of any supported standard. This is permitted by the POSIX *_t reservation, but as a quality-of-implementation issue it's still best not to define it except for __USE_MISC. This patch conditions the definition accordingly, updating a macro in sysdeps/unix/sysv/linux/sys/quota.h to use __loff_t so it still works even if __USE_MISC is not defined. codesearch.debian.net suggests there are quite a lot of loff_t uses outside glibc, but it might well make sense to change all (few) uses of loff_t or __loff_t inside glibc to use off64_t or __off64_t instead, leaving only the definitions, treating this name as obsolescent. Tested for x86_64. [BZ #14553] * posix/sys/types.h (loff_t): Only define for [__USE_MISC]. * sysdeps/unix/sysv/linux/sys/quota.h (dqoff): Use __loff_t instead of loff_t.
* hurd: Fix posix glob testSamuel Thibault2018-01-061-0/+3
| | | | * posix/tst-glob_symlinks.c [!PATH_MAX]: Define PATH_MAX macro.
* Increase some test timeouts.Joseph Myers2018-01-041-0/+1
| | | | | | | | | This patch increases timeouts on three tests I observed timing out on slow systems. * malloc/tst-malloc-tcache-leak.c (TIMEOUT): Define to 50. * posix/tst-glob-tilde.c (TIMEOUT): Define to 200. * resolv/tst-resolv-res_ninit.c (TIMEOUT): Define to 50.
* Update copyright dates not handled by scripts/update-copyrights.Joseph Myers2018-01-011-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I've updated copyright dates in glibc for 2018. This is the patch for the changes not generated by scripts/update-copyrights and subsequent build / regeneration of generated files. Please remember to include 2018 in the dates for any new files added in future (which means updating any existing uncommitted patches you have that add new files to use the new copyright dates in them). * NEWS: Update copyright dates. * catgets/gencat.c (print_version): Likewise. * csu/version.c (banner): Likewise. * debug/catchsegv.sh: Likewise. * debug/pcprofiledump.c (print_version): Likewise. * debug/xtrace.sh (do_version): Likewise. * elf/ldconfig.c (print_version): Likewise. * elf/ldd.bash.in: Likewise. * elf/pldd.c (print_version): Likewise. * elf/sotruss.sh: Likewise. * elf/sprof.c (print_version): Likewise. * iconv/iconv_prog.c (print_version): Likewise. * iconv/iconvconfig.c (print_version): Likewise. * locale/programs/locale.c (print_version): Likewise. * locale/programs/localedef.c (print_version): Likewise. * login/programs/pt_chown.c (print_version): Likewise. * malloc/memusage.sh (do_version): Likewise. * malloc/memusagestat.c (print_version): Likewise. * malloc/mtrace.pl: Likewise. * manual/libc.texinfo: Likewise. * nptl/version.c (banner): Likewise. * nscd/nscd.c (print_version): Likewise. * nss/getent.c (print_version): Likewise. * nss/makedb.c (print_version): Likewise. * posix/getconf.c (main): Likewise. * scripts/test-installation.pl: Likewise. * sysdeps/unix/sysv/linux/lddlibc4.c (main): Likewise.
* Update copyright dates with scripts/update-copyrights.Joseph Myers2018-01-01230-230/+230
| | | | | | | * All files with FSF copyright notices: Update copyright dates using scripts/update-copyrights. * locale/programs/charmap-kw.h: Regenerated. * locale/programs/locfile-kw.h: Likewise.
* Avoid gcc warnings on cygwinEric Blake2017-12-222-1/+3
| | | | | | * posix/regex_internal.c (re_string_reconstruct) [!RE_ENABLE_I18N]: * posix/regexec.c (check_arrival_add_next_nodes) [!RE_ENABLE_I18N]: Avoid unused variable.
* copy_file_range: New function to copy file dataFlorian Weimer2017-12-221-1/+6
| | | | | The semantics are based on the Linux system call, but a very close emulation in user space is provided.
* regex: Fix spelling in comments.Arnold Robbins2017-12-194-7/+7
| | | | | | | Fix the spelling in various comments throughout the regex implementation. These changes are also present in gnulib and will be integrated there also, see: https://sourceware.org/ml/libc-alpha/2017-12/msg00688.html
* glob: Silence warning about void pointer arithmeticAdhemerval Zanella2017-12-191-1/+2
| | | | | | | | | | | Sync with gnulib 0e14f025d2. Checked on x86_64-linux-gnu. * lib/glob.c (glob): Use a 'char *', not a 'void *', in pointer arithmetic. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* glob: pacify fuzzer for mempcpyAdhemerval Zanella2017-12-191-2/+5
| | | | | | | | | | | | Problem reported by Tim Rühsen [1]. Sync with gnulib 0e14f025d2. [1] https://lists.gnu.org/archive/html/bug-gnulib/2017-10/msg00054.html Checked on x86_64-linux-gnu. * lib/glob.c (glob): Do not pass NULL to mempcpy. Signed-off-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* Fix truncation warnings in posix/tst-glob_symlinks.c.Joseph Myers2017-12-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | The test posix/tst-glob_symlinks.c fails to build with GCC mainline: tst-glob_symlinks.c: In function 'do_test': tst-glob_symlinks.c:124:30: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=] snprintf (buf, sizeof buf, "%s?", dangling_link); ^~~~~ tst-glob_symlinks.c:124:3: note: 'snprintf' output between 2 and 4097 bytes into a destination of size 4096 snprintf (buf, sizeof buf, "%s?", dangling_link); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ tst-glob_symlinks.c:128:30: error: 'snprintf' output may be truncated before the last format character [-Werror=format-truncation=] snprintf (buf, sizeof buf, "%s*", dangling_link); ^~~~~ tst-glob_symlinks.c:128:3: note: 'snprintf' output between 2 and 4097 bytes into a destination of size 4096 snprintf (buf, sizeof buf, "%s*", dangling_link); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This patch fixes the test to avoid such truncation warnings by increasing the buffer in question by one byte, to ensure it can hold any possible result of %s? or %s* formats where %s comes from a buffer of size PATH_MAX. Tested compilation with build-many-glibcs.py for aarch64-linux-gnu. * posix/tst-glob_symlinks.c (do_test): Increase size of buf.
* Fix testing with read-only source directory.Joseph Myers2017-12-151-1/+1
| | | | | | | | | | | | | | | | | | | | | Three tests fail with a read-only source directory because they try to write into the source directory. None of these write into it in a way that should actually be problematic for concurrent builds sharing the same writable source directory, but avoiding any writing into the source directory (from testing, or from building glibc if the source timestamps are properly ordered) is still a good idea, as being able to build with read-only sources helps make sure there isn't anything that could cause problems for concurrent builds. This patch changes the tests in question to use either /tmp or the build directory to write their temporary files (or to test O_TMPFILE, as applicable). Tested for x86_64. * io/Makefile (tst-open-tmpfile-ARGS): New variable. * posix/tst-mmap-offset.c (fname): Use /tmp. * stdlib/tst-setcontext3.sh (tempfile): Use ${objpfx}.
* Replace = with += in CFLAGS-xxx.c/CPPFLAGS-xxx.cH.J. Lu2017-12-111-22/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replace = with += in CFLAGS-xxx.c and CPPFLAGS-xxx.c to allow Makefile under sysdeps to define CFLAGS-xx.c and CPPFLAGS-xxx.c. * argp/Makefile (CFLAGS-argp-help.c): Replace = with +=. (CFLAGS-argp-parse.c): Likewise. (CFLAGS-argp-fmtstream.c): Likewise. * crypt/Makefile (CPPFLAGS-sha256-crypt.c): Likewise. (CPPFLAGS-sha512-crypt.c): Likewise. (CPPFLAGS-md5-crypt.c): Likewise. * debug/Makefile (CFLAGS-stack_chk_fail.c): Likewise. (CFLAGS-stack_chk_fail_local.c): Likewise. (CFLAGS-backtrace.c): Likewise. (CFLAGS-sprintf_chk.c): Likewise. (CFLAGS-snprintf_chk.c): Likewise. (CFLAGS-vsprintf_chk.c): Likewise. (CFLAGS-vsnprintf_chk.c): Likewise. (CFLAGS-asprintf_chk.c): Likewise. (CFLAGS-vasprintf_chk.c): Likewise. (CFLAGS-obprintf_chk.c): Likewise. (CFLAGS-dprintf_chk.c): Likewise. (CFLAGS-vdprintf_chk.c): Likewise. (CFLAGS-printf_chk.c): Likewise. (CFLAGS-fprintf_chk.c): Likewise. (CFLAGS-vprintf_chk.c): Likewise. (CFLAGS-vfprintf_chk.c): Likewise. (CFLAGS-gets_chk.c): Likewise. (CFLAGS-fgets_chk.c): Likewise. (CFLAGS-fgets_u_chk.c): Likewise. (CFLAGS-fread_chk.c): Likewise. (CFLAGS-fread_u_chk.c): Likewise. (CFLAGS-swprintf_chk.c): Likewise. (CFLAGS-vswprintf_chk.c): Likewise. (CFLAGS-wprintf_chk.c): Likewise. (CFLAGS-fwprintf_chk.c): Likewise. (CFLAGS-vwprintf_chk.c): Likewise. (CFLAGS-vfwprintf_chk.c): Likewise. (CFLAGS-fgetws_chk.c): Likewise. (CFLAGS-fgetws_u_chk.c): Likewise. (CFLAGS-read_chk.c): Likewise. (CFLAGS-pread_chk.c): Likewise. (CFLAGS-pread64_chk.c): Likewise. (CFLAGS-recv_chk.c): Likewise. (CFLAGS-recvfrom_chk.c): Likewise. (CFLAGS-tst-longjmp_chk.c): Likewise. (CPPFLAGS-tst-longjmp_chk.c): Likewise. (CFLAGS-tst-longjmp_chk2.c): Likewise. (CPPFLAGS-tst-longjmp_chk2.c): Likewise. (CFLAGS-tst-longjmp_chk3.c): Likewise. (CPPFLAGS-tst-longjmp_chk3.c): Likewise. (CFLAGS-tst-chk1.c): Likewise. (CFLAGS-tst-chk2.c): Likewise. (CFLAGS-tst-chk3.c): Likewise. (CFLAGS-tst-chk4.cc): Likewise. (CFLAGS-tst-chk5.cc): Likewise. (CFLAGS-tst-chk6.cc): Likewise. (CFLAGS-tst-lfschk1.c): Likewise. (CFLAGS-tst-lfschk2.c): Likewise. (CFLAGS-tst-lfschk3.c): Likewise. (CFLAGS-tst-lfschk4.cc): Likewise. (CFLAGS-tst-lfschk5.cc): Likewise. (CFLAGS-tst-lfschk6.cc): Likewise. (CFLAGS-tst-ssp-1.c): Likewise. * dirent/Makefile (CFLAGS-scandir.c): Likewise. (CFLAGS-scandir64.c): Likewise. (CFLAGS-scandir-tail.c): Likewise. (CFLAGS-scandir64-tail.c): Likewise. * elf/Makefile (CPPFLAGS-dl-tunables.c): Likewise. (CFLAGS-dl-tunables.c): Likewise. (CFLAGS-dl-runtime.c): Likewise. (CFLAGS-dl-lookup.c): Likewise. (CFLAGS-dl-iterate-phdr.c): Likewise. (CFLAGS-vismain.c): Likewise. (CFLAGS-tst-linkall-static.c): Likewise. (CFLAGS-tst-linkall-static.c): Likewise. (CPPFLAGS-dl-load.c): Likewise. (CFLAGS-ldconfig.c): Likewise. (CFLAGS-dl-cache.c): Likewise. (CFLAGS-cache.c): Likewise. (CFLAGS-rtld.c): Likewise. (CFLAGS-multiload.c): Likewise. (CFLAGS-filtmod1.c): Likewise. (CFLAGS-tst-align.c): Likewise. (CFLAGS-tst-align2.c): Likewise. (CFLAGS-tst-alignmod.c): Likewise. (CFLAGS-tst-alignmod2.c): Likewise. (CPPFLAGS-tst-execstack.c): Likewise. (CFLAGS-tst-ptrguard1-static.c): Likewise. (CFLAGS-tst-latepthreadmod.c): Likewise. * grp/Makefile (CFLAGS-getgrgid_r.c): Likewise. (CFLAGS-getgrnam_r.c): Likewise. (CFLAGS-getgrent_r.c): Likewise. (CFLAGS-getgrent.c): Likewise. (CFLAGS-fgetgrent.c): Likewise. (CFLAGS-fgetgrent_r.c): Likewise. (CFLAGS-putgrent.c): Likewise. (CFLAGS-initgroups.c): Likewise. (CFLAGS-getgrgid.c): Likewise. * gshadow/Makefile (CFLAGS-getsgent_r.c): Likewise. (CFLAGS-getsgent.c): Likewise. (CFLAGS-fgetsgent.c): Likewise. (CFLAGS-fgetsgent_r.c): Likewise. (CFLAGS-putsgent.c): Likewise. (CFLAGS-getsgnam.c): Likewise. (CFLAGS-getsgnam_r.c): Likewise. * iconv/Makefile (CFLAGS-iconv_prog.c): Likewise. (CFLAGS-iconv_charmap.c): Likewise. (CFLAGS-dummy-repertoire.c): Likewise. (CFLAGS-charmap.c): Likewise. (CFLAGS-linereader.c): Likewise. (CFLAGS-simple-hash.c): Likewise. (CFLAGS-gconv_conf.c): Likewise. (CFLAGS-iconvconfig.c): Likewise. * inet/Makefile (CFLAGS-gethstbyad_r.c): Likewise. (CFLAGS-gethstbyad.c): Likewise. (CFLAGS-gethstbynm_r.c): Likewise. (CFLAGS-gethstbynm.c): Likewise. (CFLAGS-gethstbynm2_r.c): Likewise. (CFLAGS-gethstbynm2.c): Likewise. (CFLAGS-gethstent_r.c): Likewise. (CFLAGS-gethstent.c): Likewise. (CFLAGS-rcmd.c): Likewise. (CFLAGS-getnetbynm_r.c): Likewise. (CFLAGS-getnetbynm.c): Likewise. (CFLAGS-getnetbyad_r.c): Likewise. (CFLAGS-getnetbyad.c): Likewise. (CFLAGS-getnetent_r.c): Likewise. (CFLAGS-getnetent.c): Likewise. (CFLAGS-getaliasent_r.c): Likewise. (CFLAGS-getaliasent.c): Likewise. (CFLAGS-getrpcent_r.c): Likewise. (CFLAGS-getrpcent.c): Likewise. (CFLAGS-getservent_r.c): Likewise. (CFLAGS-getservent.c): Likewise. (CFLAGS-getprtent_r.c): Likewise. (CFLAGS-getprtent.c): Likewise. (CFLAGS-either_ntoh.c): Likewise. (CFLAGS-either_hton.c): Likewise. (CFLAGS-getnetgrent.c): Likewise. (CFLAGS-getnetgrent_r.c): Likewise. (CFLAGS-tst-checks-posix.c): Likewise. (CFLAGS-tst-sockaddr.c): Likewise. * intl/Makefile (CFLAGS-tst-gettext.c): Likewise. (CFLAGS-tst-translit.c): Likewise. (CFLAGS-tst-gettext2.c): Likewise. (CFLAGS-tst-codeset.c): Likewise. (CFLAGS-tst-gettext3.c): Likewise. (CFLAGS-tst-gettext4.c): Likewise. (CFLAGS-tst-gettext5.c): Likewise. (CFLAGS-tst-gettext6.c): Likewise. * io/Makefile (CFLAGS-open.c): Likewise. (CFLAGS-open64.c): Likewise. (CFLAGS-creat.c): Likewise. (CFLAGS-creat64.c): Likewise. (CFLAGS-fcntl.c): Likewise. (CFLAGS-poll.c): Likewise. (CFLAGS-ppoll.c): Likewise. (CFLAGS-lockf.c): Likewise. (CFLAGS-statfs.c): Likewise. (CFLAGS-fstatfs.c): Likewise. (CFLAGS-statvfs.c): Likewise. (CFLAGS-fstatvfs.c): Likewise. (CFLAGS-fts.c): Likewise. (CFLAGS-fts64.c): Likewise. (CFLAGS-ftw.c): Likewise. (CFLAGS-ftw64.c): Likewise. (CFLAGS-lockf.c): Likewise. (CFLAGS-posix_fallocate.c): Likewise. (CFLAGS-posix_fallocate64.c): Likewise. (CFLAGS-fallocate.c): Likewise. (CFLAGS-fallocate64.c): Likewise. (CFLAGS-read.c): Likewise. (CFLAGS-write.c): Likewise. (CFLAGS-test-stat.c): Likewise. (CFLAGS-test-lfs.c): Likewise. * libio/Makefile (CFLAGS-fileops.c): Likewise. (CFLAGS-fputc.c): Likewise. (CFLAGS-fputwc.c): Likewise. (CFLAGS-freopen64.c): Likewise. (CFLAGS-freopen.c): Likewise. (CFLAGS-fseek.c): Likewise. (CFLAGS-fseeko64.c): Likewise. (CFLAGS-fseeko.c): Likewise. (CFLAGS-ftello64.c): Likewise. (CFLAGS-ftello.c): Likewise. (CFLAGS-fwide.c): Likewise. (CFLAGS-genops.c): Likewise. (CFLAGS-getc.c): Likewise. (CFLAGS-getchar.c): Likewise. (CFLAGS-getwc.c): Likewise. (CFLAGS-getwchar.c): Likewise. (CFLAGS-iofclose.c): Likewise. (CFLAGS-iofflush.c): Likewise. (CFLAGS-iofgetpos64.c): Likewise. (CFLAGS-iofgetpos.c): Likewise. (CFLAGS-iofgets.c): Likewise. (CFLAGS-iofgetws.c): Likewise. (CFLAGS-iofputs.c): Likewise. (CFLAGS-iofputws.c): Likewise. (CFLAGS-iofread.c): Likewise. (CFLAGS-iofsetpos64.c): Likewise. (CFLAGS-iofsetpos.c): Likewise. (CFLAGS-ioftell.c): Likewise. (CFLAGS-iofwrite.c): Likewise. (CFLAGS-iogetdelim.c): Likewise. (CFLAGS-iogetline.c): Likewise. (CFLAGS-iogets.c): Likewise. (CFLAGS-iogetwline.c): Likewise. (CFLAGS-ioputs.c): Likewise. (CFLAGS-ioseekoff.c): Likewise. (CFLAGS-ioseekpos.c): Likewise. (CFLAGS-iosetbuffer.c): Likewise. (CFLAGS-iosetvbuf.c): Likewise. (CFLAGS-ioungetc.c): Likewise. (CFLAGS-ioungetwc.c): Likewise. (CFLAGS-oldfileops.c): Likewise. (CFLAGS-oldiofclose.c): Likewise. (CFLAGS-oldiofgetpos64.c): Likewise. (CFLAGS-oldiofgetpos.c): Likewise. (CFLAGS-oldiofsetpos64.c): Likewise. (CFLAGS-oldiofsetpos.c): Likewise. (CFLAGS-peekc.c): Likewise. (CFLAGS-putc.c): Likewise. (CFLAGS-putchar.c): Likewise. (CFLAGS-putwc.c): Likewise. (CFLAGS-putwchar.c): Likewise. (CFLAGS-rewind.c): Likewise. (CFLAGS-wfileops.c): Likewise. (CFLAGS-wgenops.c): Likewise. (CFLAGS-oldiofopen.c): Likewise. (CFLAGS-iofopen.c): Likewise. (CFLAGS-iofopen64.c): Likewise. (CFLAGS-oldtmpfile.c): Likewise. (CFLAGS-tst_putwc.c): Likewise. * locale/Makefile (CFLAGS-md5.c): Likewise. (CFLAGS-charmap.c): Likewise. (CFLAGS-locfile.c): Likewise. (CFLAGS-charmap-dir.c): Likewise. * login/Makefile (CFLAGS-grantpt.c): Likewise. (CFLAGS-getpt.c): Likewise. (CFLAGS-pt_chown.c): Likewise. * malloc/Makefile (CFLAGS-mcheck-init.c): Likewise. (CFLAGS-obstack.c): Likewise. * math/Makefile (CFLAGS-test-tgmath3.c): Likewise. (CFLAGS-test-double-vlen4-wrappers.c): Likewise. (CFLAGS-test-double-vlen8-wrappers.c): Likewise. (CFLAGS-test-float-vlen8-wrappers.c): Likewise. (CFLAGS-test-float-vlen16-wrappers.c): Likewise. (CFLAGS-test-tgmath.c): Likewise. (CFLAGS-test-tgmath2.c): Likewise. (CFLAGS-test-tgmath-ret.c): Likewise. (CFLAGS-test-powl.c): Likewise. (CFLAGS-test-snan.c): Likewise. (CFLAGS-test-signgam-finite.c): Likewise. (CFLAGS-test-signgam-finite-c99.c): Likewise. (CFLAGS-test-signgam-finite-c11.c): Likewise. (CFLAGS-test-signgam-uchar.c): Likewise. (CFLAGS-test-signgam-uchar-init.c): Likewise. (CFLAGS-test-signgam-uchar-static.c): Likewise. (CFLAGS-test-signgam-uchar-init-static.c): Likewise. (CFLAGS-test-signgam-uint.c): Likewise. (CFLAGS-test-signgam-uint-init.c): Likewise. (CFLAGS-test-signgam-uint-static.c): Likewise. (CFLAGS-test-signgam-uint-init-static.c): Likewise. (CFLAGS-test-signgam-ullong.c): Likewise. (CFLAGS-test-signgam-ullong-init.c): Likewise. (CFLAGS-test-signgam-ullong-static.c): Likewise. (CFLAGS-test-signgam-ullong-init-static.c): Likewise. (CFLAGS-test-math-cxx11.cc): Likewise. (CFLAGS-test-math-isinff.cc): Likewise. (CFLAGS-test-math-iszero.cc): Likewise. (CFLAGS-test-math-issignaling.cc): Likewise. (CFLAGS-test-math-iscanonical.cc): Likewise. (CFLAGS-test-iszero-excess-precision.c): Likewise. (CFLAGS-test-iseqsig-excess-precision.c): Likewise. (CFLAGS-test-flt-eval-method.c): Likewise. (CFLAGS-test-fe-snans-always-signal.c): Likewise. (CFLAGS-test-finite-macros.c): Likewise. * misc/Makefile (CFLAGS-select.c): Likewise. (CFLAGS-tsearch.c): Likewise. (CFLAGS-lsearch.c): Likewise. (CFLAGS-pselect.c): Likewise. (CFLAGS-readv.c): Likewise. (CFLAGS-writev.c): Likewise. (CFLAGS-preadv.c): Likewise. (CFLAGS-preadv64.c): Likewise. (CFLAGS-pwritev.c): Likewise. (CFLAGS-pwritev64.c): Likewise. (CFLAGS-preadv2.c): Likewise. (CFLAGS-preadv64v2.c): Likewise. (CFLAGS-pwritev2.c): Likewise. (CFLAGS-pwritev64v2.c): Likewise. (CFLAGS-usleep.c): Likewise. (CFLAGS-syslog.c): Likewise. (CFLAGS-error.c): Likewise. (CFLAGS-getpass.c): Likewise. (CFLAGS-mkstemp.c): Likewise. (CFLAGS-mkstemp64.c): Likewise. (CFLAGS-getsysstats.c): Likewise. (CFLAGS-getusershell.c): Likewise. (CFLAGS-err.c): Likewise. (CFLAGS-tst-tsearch.c): Likewise. (CFLAGS-msync.c): Likewise. (CFLAGS-fdatasync.c): Likewise. (CFLAGS-fsync.c): Likewise. * nptl/Makefile (CFLAGS-nptl-init.c): Likewise. (CFLAGS-unwind.c): Likewise. (CFLAGS-unwind-forcedunwind.c): Likewise. (CFLAGS-pthread_cancel.c): Likewise. (CFLAGS-pthread_setcancelstate.c): Likewise. (CFLAGS-pthread_setcanceltype.c): Likewise. (CFLAGS-cancellation.c): Likewise. (CFLAGS-libc-cancellation.c): Likewise. (CFLAGS-pthread_exit.c): Likewise. (CFLAGS-forward.c): Likewise. (CFLAGS-pthread_testcancel.c): Likewise. (CFLAGS-pthread_join.c): Likewise. (CFLAGS-pthread_timedjoin.c): Likewise. (CFLAGS-pthread_once.c): Likewise. (CFLAGS-pthread_cond_wait.c): Likewise. (CFLAGS-sem_wait.c): Likewise. (CFLAGS-sem_timedwait.c): Likewise. (CFLAGS-fcntl.c): Likewise. (CFLAGS-lockf.c): Likewise. (CFLAGS-pread.c): Likewise. (CFLAGS-pread64.c): Likewise. (CFLAGS-pwrite.c): Likewise. (CFLAGS-pwrite64.c): Likewise. (CFLAGS-wait.c): Likewise. (CFLAGS-waitpid.c): Likewise. (CFLAGS-sigwait.c): Likewise. (CFLAGS-msgrcv.c): Likewise. (CFLAGS-msgsnd.c): Likewise. (CFLAGS-tcdrain.c): Likewise. (CFLAGS-open.c): Likewise. (CFLAGS-open64.c): Likewise. (CFLAGS-pause.c): Likewise. (CFLAGS-recv.c): Likewise. (CFLAGS-send.c): Likewise. (CFLAGS-accept.c): Likewise. (CFLAGS-sendto.c): Likewise. (CFLAGS-connect.c): Likewise. (CFLAGS-recvfrom.c): Likewise. (CFLAGS-recvmsg.c): Likewise. (CFLAGS-sendmsg.c): Likewise. (CFLAGS-close.c): Likewise. (CFLAGS-read.c): Likewise. (CFLAGS-write.c): Likewise. (CFLAGS-nanosleep.c): Likewise. (CFLAGS-sigsuspend.c): Likewise. (CFLAGS-msync.c): Likewise. (CFLAGS-fdatasync.c): Likewise. (CFLAGS-fsync.c): Likewise. (CFLAGS-pt-system.c): Likewise. (CFLAGS-tst-cleanup2.c): Likewise. (CFLAGS-tst-cleanupx2.c): Likewise. (CFLAGS-flockfile.c): Likewise. (CFLAGS-ftrylockfile.c): Likewise. (CFLAGS-funlockfile.c): Likewise. (CFLAGS-tst-initializers1.c): Likewise. (CFLAGS-tst-initializers1-c89.c): Likewise. (CFLAGS-tst-initializers1-c99.c): Likewise. (CFLAGS-tst-initializers1-c11.c): Likewise. (CFLAGS-tst-initializers1-gnu89.c): Likewise. (CFLAGS-tst-initializers1-gnu99.c): Likewise. (CFLAGS-tst-initializers1-gnu11.c): Likewise. * nscd/Makefile (CFLAGS-nscd_getpw_r.c): Likewise. (CFLAGS-nscd_getgr_r.c): Likewise. (CFLAGS-nscd_gethst_r.c): Likewise. (CFLAGS-nscd_getai.c): Likewise. (CFLAGS-nscd_initgroups.c): Likewise. * posix/Makefile (CFLAGS-getaddrinfo.c): Likewise. (CFLAGS-pause.c): Likewise. (CFLAGS-pread.c): Likewise. (CFLAGS-pread64.c): Likewise. (CFLAGS-pwrite.c): Likewise. (CFLAGS-pwrite64.c): Likewise. (CFLAGS-sleep.c): Likewise. (CFLAGS-wait.c): Likewise. (CFLAGS-waitid.c): Likewise. (CFLAGS-waitpid.c): Likewise. (CFLAGS-getopt.c): Likewise. (CFLAGS-wordexp.c): Likewise. (CFLAGS-sysconf.c): Likewise. (CFLAGS-pathconf.c): Likewise. (CFLAGS-fpathconf.c): Likewise. (CFLAGS-spawn.c): Likewise. (CFLAGS-spawnp.c): Likewise. (CFLAGS-spawni.c): Likewise. (CFLAGS-glob.c): Likewise. (CFLAGS-glob64.c): Likewise. (CFLAGS-getconf.c): Likewise. (CFLAGS-nanosleep.c): Likewise. * pwd/Makefile (CFLAGS-getpwent_r.c): Likewise. (CFLAGS-getpwent.c): Likewise. (CFLAGS-getpw.c): Likewise. (CFLAGS-fgetpwent_r.c): Likewise. * resolv/Makefile (CFLAGS-res_hconf.c): Likewise. * rt/Makefile (CFLAGS-aio_suspend.c): Likewise. (CFLAGS-mq_timedreceive.c): Likewise. (CFLAGS-mq_timedsend.c): Likewise. (CFLAGS-clock_nanosleep.c): Likewise. (CFLAGS-librt-cancellation.c): Likewise. * shadow/Makefile (CFLAGS-getspent_r.c): Likewise. (CFLAGS-getspent.c): Likewise. (CFLAGS-fgetspent.c): Likewise. (CFLAGS-fgetspent_r.c): Likewise. (CFLAGS-putspent.c): Likewise. (CFLAGS-getspnam.c): Likewise. (CFLAGS-getspnam_r.c): Likewise. * signal/Makefile (CFLAGS-sigpause.c): Likewise. (CFLAGS-sigsuspend.c): Likewise. (CFLAGS-sigtimedwait.c): Likewise. (CFLAGS-sigwait.c): Likewise. (CFLAGS-sigwaitinfo.c): Likewise. (CFLAGS-sigreturn.c): Likewise. * stdio-common/Makefile (CFLAGS-vfprintf.c): Likewise. (CFLAGS-vfwprintf.c): Likewise. (CFLAGS-tmpfile.c): Likewise. (CFLAGS-tmpfile64.c): Likewise. (CFLAGS-tempname.c): Likewise. (CFLAGS-psignal.c): Likewise. (CFLAGS-vprintf.c): Likewise. (CFLAGS-cuserid.c): Likewise. (CFLAGS-errlist.c): Likewise. (CFLAGS-siglist.c): Likewise. (CFLAGS-scanf15.c): Likewise. (CFLAGS-scanf17.c): Likewise. * stdlib/Makefile (CFLAGS-bsearch.c): Likewise. (CFLAGS-msort.c): Likewise. (CFLAGS-qsort.c): Likewise. (CFLAGS-system.c): Likewise. (CFLAGS-fmtmsg.c): Likewise. (CFLAGS-strfmon.c): Likewise. (CFLAGS-strfmon_l.c): Likewise. (CFLAGS-strfromd.c): Likewise. (CFLAGS-strfromf.c): Likewise. (CFLAGS-strfroml.c): Likewise. (CFLAGS-tst-bsearch.c): Likewise. (CFLAGS-tst-qsort.c): Likewise. (CFLAGS-tst-makecontext2.c): Likewise. * sunrpc/Makefile (CFLAGS-xbootparam_prot.c): Likewise. (CFLAGS-xnlm_prot.c): Likewise. (CFLAGS-xrstat.c): Likewise. (CFLAGS-xyppasswd.c): Likewise. (CFLAGS-xklm_prot.c): Likewise. (CFLAGS-xrex.c): Likewise. (CFLAGS-xsm_inter.c): Likewise. (CFLAGS-xmount.c): Likewise. (CFLAGS-xrusers.c): Likewise. (CFLAGS-xspray.c): Likewise. (CFLAGS-xnfs_prot.c): Likewise. (CFLAGS-xrquota.c): Likewise. (CFLAGS-xkey_prot.c): Likewise. (CFLAGS-auth_unix.c): Likewise. (CFLAGS-key_call.c): Likewise. (CFLAGS-pmap_rmt.c): Likewise. (CFLAGS-clnt_perr.c): Likewise. (CFLAGS-openchild.c): Likewise. * sysvipc/Makefile (CFLAGS-msgrcv.c): Likewise. (CFLAGS-msgsnd.c): Likewise. * termios/Makefile (CFLAGS-tcdrain.c): Likewise. * time/Makefile (CFLAGS-tzfile.c): Likewise. (CFLAGS-tzset.c): Likewise. (CFLAGS-getdate.c): Likewise. (CFLAGS-test_time.c): Likewise. (CPPFLAGS-tst-tzname.c): Likewise. * timezone/Makefile (CFLAGS-zdump.c): Likewise. (CFLAGS-zic.c): Likewise. * wcsmbs/Makefile (CFLAGS-wcwidth.c): Likewise. (CFLAGS-wcswidth.c): Likewise. (CFLAGS-wcstol.c): Likewise. (CFLAGS-wcstoul.c): Likewise. (CFLAGS-wcstoll.c): Likewise. (CFLAGS-wcstoull.c): Likewise. (CFLAGS-wcstod.c): Likewise. (CFLAGS-wcstold.c): Likewise. (CFLAGS-wcstof128.c): Likewise. (CFLAGS-wcstof.c): Likewise. (CFLAGS-wcstol_l.c): Likewise. (CFLAGS-wcstoul_l.c): Likewise. (CFLAGS-wcstoll_l.c): Likewise. (CFLAGS-wcstoull_l.c): Likewise. (CFLAGS-wcstod_l.c): Likewise. (CFLAGS-wcstold_l.c): Likewise. (CFLAGS-wcstof128_l.c): Likewise. (CFLAGS-wcstof_l.c): Likewise. (CPPFLAGS-tst-wchar-h.c): Likewise. (CPPFLAGS-wcstold_l.c): Likewise. Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
* posix: Make tst-getaddrinfo[45] xtests due to DNS dependency [BZ #20826]Florian Weimer2017-11-281-3/+3
| | | | | | | These tests need a working Internet connection with DNS. We have additional coverage of getaddrinfo through the resolv tests, so the loss of default test coverage seems acceptable.
* * posix/regcomp.c (init_word_char): Add comments.Paul Eggert2017-11-221-0/+3
|
* regex: don't assume uint64_t or uint32_tPaul Eggert2017-11-201-14/+15
| | | | | | | | | | | | | | | This avoids -Werror=overflow errors for 32-bit systems in the 64-bit case. Problem reported by Joseph Myers in: https://sourceware.org/ml/libc-alpha/2017-11/msg00694.html Also, when this code is used in Gnulib it ports to platforms that lack uint64_t and uint32_t. The C standard doesn't guarantee them, and on some 32-bit compilers there is no uint64_t. Problem reported by Gianluigi Tiesi in: http://lists.gnu.org/archive/html/bug-gnulib/2012-03/msg00154.html * posix/regcomp.c (init_word_char): Don't assume that the types uint64_t and uint32_t exist. Adapted from Gnulib patch 2012-05-27T06:40:00!eggert@cs.ucla.edu. See: https://git.savannah.gnu.org/cgit/gnulib.git/commit/?id=252b52457da7887667c036d18cc5169777615bb0
* posix/tst-glob-tilde.c: Add test for bug 22332Florian Weimer2017-11-021-23/+30
|
* Assume that _DIRENT_HAVE_D_TYPE is always defined.Florian Weimer2017-10-304-31/+0
| | | | | | References remain in io/fts.c, io/ftw.c, posix/glob.c, sysdeps/posix/getcwd.c. These files are (potentially) externally shared.
* tst-gnuglob64: New test for glob64 based on tst-gnuglobFlorian Weimer2017-10-304-486/+553
| | | | Reviewed-by: Adhemerval Zanella <adhemerval.zanella@linaro.org>
* glob: Fix buffer overflow during GLOB_TILDE unescaping [BZ #22332]Paul Eggert2017-10-221-2/+2
|
* glob: Add new test tst-glob-tildeFlorian Weimer2017-10-212-2/+146
| | | | | The new test checks for memory leaks (see bug 22325) and attempts to trigger the buffer overflow in bug 22320.
* CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320]Paul Eggert2017-10-201-1/+1
|
* fix posix/tst-spawn testSzabolcs Nagy2017-10-121-8/+12
| | | | | | | The test spawns two children but only waited for one. The fix avoids printing to stderr. * posix/tst-spawn.c (do_test): Wait for both children.
* posix: remove glob internal bogus extern declAdhemerval Zanella2017-10-091-3/+0
| | | | | | | Sync with gnulib f586d709f07. Checked on x86_64-linux-gnu. * lib/glob.c (__glob_pattern_type): Remove now-spurious extern declaration.
* Hide internal __sched_setparam function [BZ #18822]H.J. Lu2017-10-011-0/+1
| | | | | | | | | | | | | Hide internal __sched_setparam function to allow direct access within libc.so and libc.a without using GOT nor PLT. __GI___sched_setparam is defined when sysdeps/unix/syscalls.list is used to generate sched_setparam. Otherwise libc_hidden_def is needed explicitly. [BZ #18822] * include/sched.h (__sched_setparam): Add libc_hidden_proto. * posix/sched_setp.c (__sched_setparam): Add libc_hidden_def.
* Hide __posix_spawn_file_actions_realloc/__spawni [BZ #18822]H.J. Lu2017-10-011-2/+3
| | | | | | | | | | | Hide internal __posix_spawn_file_actions_realloc and /__spawni functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * posix/spawn_int.h (__posix_spawn_file_actions_realloc): Add attribute_hidden. (__spawni): Likewise.
* Hide internal regex functions [BZ #18822]H.J. Lu2017-10-012-0/+4
| | | | | | | | | | | | | | Hide internal regex functions to allow direct access within libc.so and libc.a without using GOT nor PLT. [BZ #18822] * include/regex.h (__re_compile_fastmap): Add attribute_hidden. (__regcomp): Add libc_hidden_proto. (__regexec): Likewise. (__regfree): Likewise. * posix/regcomp.c (__regcomp): Add libc_hidden_def. (__regfree): Likewise. * posix/regexec.c (__regexec): Likewise.
* Mark __dso_handle as hidden [BZ #18822]H.J. Lu2017-09-261-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since __dso_handle is always defined by either crtbegin.o from GCC or dso_handle.c, it should be marked as hidden and be passed directly. [BZ #18822] * dlfcn/modatexit.c (foo): Remove __dso_handle check. * dlfcn/modcxaatexit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. * dlfcn/tstatexit.c (__dso_handle): Removed. (main): Don't check __dso_handle. * dlfcn/tstcxaatexit.c (__dso_handle): Removed. (main): Don't check __dso_handle. * include/dso_handle.h: New file. * malloc/mtrace.c: Include <dso_handle.h>. (mtrace): Pass __dso_handle directly. * nptl/pthread_atfork.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (__pthread_atfork): Pass __dso_handle directly. * nptl/tst-atfork2mod.c: Include <dso_handle.h>. (__dso_handle): Removed. * posix/wordexp-test.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (__app_register_atfork): Pass __dso_handle directly. * stdlib/at_quick_exit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (at_quick_exit): Pass __dso_handle directly. * stdlib/atexit.c: Include <dso_handle.h>. (__dso_handle): Remove declaration. (atexit): Pass __dso_handle directly. * stdlib/tst-tls-atexit-lib.c: Include <dso_handle.h>. (__dso_handle): Removed.
* posix: Add compat glob symbol to not follow dangling symbolsAdhemerval Zanella2017-09-257-25/+389
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch follows commit 5554304f0 (posix: Allow glob to match dangling symlinks [BZ #866]) by adding a compat symbol that follow previous semantic of not following dangling symlinks and thus avoiding call gl_lstat with GLOB_ALTDIRFUNC. It avoids failure with old binaries that not set the alternate function pointer for lstat (GNUmake for instance). The following scenario, for instance, fails with current GNUmake because glibc will access unitialized memory when calling gl_lstat: $ cat src/t/t.c int main () { return 0; } $ cat Makefile SRC = $(wildcard src/*/t.c) OBJ = $(patsubst src/%.c, obj/%.o, $(SRC)) prog: $(OBJ) $(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o prog obj/%.o: src/%.c $(CC) $(CFLAGS) -c $< -o $@ $ make This works as expected with the patch applied. Since it is for generic ABI, default compat symbols are added with override for Linux due LFS. Now we have two compat symbols for glob on Linux: 1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with the old dirent layout. For this implementation I also set it to not follow dangling symlinks (which is the safest path). 2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements the compat symbol for dangling symlinks. As for generic glob, the implementation uses XSTAT_IS_XSTAT64 to define whether both __glob_lstat_compat and __glob64_lstat_compat should be different implementations. For archictures that define XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to __glob64_lstat_compat. 3. sysdeps/unix/sysv/linux/alpha/oldglob.c with a different glob_t layout. As for 1. this patch changes it to not follow dangling symlinks. The patch also bumps _GNU_GLOB_INTERFACE_VERSION to 2 to advertise the new semantic. On GNUmake, for instance, it will force to it use its internal glob implementation instead and avoiding triggering the same failure on builds against newer GLIBCs. Checked on x86_64-linux-gnu and i686-linux-gnu. I also checked with a build against the major ABIs required to check for the abilist. The changes should also work on gnulib (I run gnulib-tool.py check glob and it shown no regressions). [BZ #22183] * include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase version to 2. * posix/Makefile (routines): Add glob-lstat-compat and glob64-lstat-compat. * posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version. * posix/glob-lstat-compat.c: New file. * posix/glob64-lstat-compat.c: Likewise. * posix/tst-glob_lstat_compat.c: Likewise. * sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise. * sysdeps/unix/sysv/linux/alpha/glob.c: Remove file. * posix/glob.c (glob_lstat): New function. (glob): Rename to __glob and add versioned symbol to 2.27. (glob_in_dir): Use glob_lstat. * posix/glob64.c (glob64): Add GLOB_ATTRIBUTE. * sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for 2.27. * sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise. * sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define. * sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use gl_lstat on glob call. * sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob and glob64 symbols. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
* Use execveat syscall in fexecve (bug 22134)Andreas Schwab2017-09-192-1/+89
| | | | | By using execveat we no longer depend on /proc. The execveat syscall was introduced in 3.19, except for a few late comers.
* Add missing libc_hidden_weak/def callsSamuel Thibault2017-09-171-0/+1
| | | | | | | | | | * io/read.c (read): Add libc_hidden_weak. * sysdeps/mach/hurd/read.c (read): Likewise. * io/write.c (write): Likewise. * sysdeps/mach/hurd/write.c (write): Likewise. * io/pread64.c (__pread64): Likewise. * sysdeps/mach/hurd/pread64.c (__pread64): Likewise. * posix/pread64.c (__pread64): Add libc_hidden_def.
* hurd: Fix build without NO_HIDDENSamuel Thibault2017-09-122-0/+2
| | | | | | | | | | | | | | * posix/sched_primax.c (__sched_get_priority_max): Add libc_hidden_def. * posix/sched_primin.c (__sched_get_priority_min): Likewise. * sysdeps/mach/hurd/mmap.c (__mmap): Likewise. * sysdeps/mach/hurd/mmap64.c (__mmap64): Likewise. * sysdeps/mach/hurd/mprotect.c (__mprotect): Likewise. * sysdeps/mach/hurd/munmap.c (__munmap): Likewise. * sysdeps/mach/hurd/dl-sysdep.c (__GI___getpid, __GI___strtoul_internal, __GI_____strtoul_internal, __GI___chk_fail, __GI___fortify_fail, __GI___assert_fail, __GI___assert_perror_fail): Add aliases.
* posix: Use enum for __glob_pattern_type resultAdhemerval Zanella2017-09-083-10/+18
| | | | | | | | | | | | | | This patch replaces the internal integer constant from __glob_pattern_type return with a proper enum. Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. * posix/glob_internal.h (glob_pattern_type_t): New enumeration. (__glob_pattern_type): Use __glob_pat_types. * posix/glob_pattern_p.c (__glob_pattern_p): Likewise. * posix/glob.c (glob): Likewise. (glob_in_dir): Likewise.
* posix: fix glob bugs with long login namesAdhemerval Zanella2017-09-081-58/+30
| | | | | | | | | | | | | | | | | | | | | | Current glob implementation allows unlimited user name for home directory construction on GLOB_TILDE case. To accomplish it glob either construct a name on stack if size are small enough (based on current alloca_used) or in heap otherwise. This patch simplifies storage allocation by using the same scratch buffer for both get_rlogin_r and getpwnam_r. This also syncs with gnulib commit 064df0b (glob: fix bugs with long login names). Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. * posix/glob.c (GET_LOGIN_NAME_MAX): Remove. (glob): Use the same scratch buffer for both getlogin_r and getpwnam_r. Don’t require preallocation of the login name. This simplifies storage allocation, and corrects the handling of long login names.
* posix: Fix getpwnam_r usage (BZ #1062)Adhemerval Zanella2017-09-081-140/+24
| | | | | | | | | | | | | | | This patch fixes longstanding misuse of errno after getpwnam_r, which returns an error number rather than setting errno. This is sync with gnulib commit 5db9301. Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. [BZ #1062] * posix/glob.c (glob): Port recent patches to platforms lacking getpwnam_r. (glob): Fix longstanding misuse of errno after getpwnam_r, which returns an error number rather than setting errno.
* posix: Allow glob to match dangling symlinks [BZ #866]Adhemerval Zanella2017-09-084-243/+223
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch makes glob match dangling symlinks. Compared to other glob implementation (*BSD, bash, musl, and other shells as well), GLIBC seems the be the only one that does not match dangling symlinks. As for comment #5 in BZ #866, POSIX does not have any strict specification for dangling symlinks match and it is reasonable that trying to glob everything in a path should return all types of files (such as for a 'rm *'). Also, comment #7 shows even more example where GLIBC current behavior is unexepected. I avoided adding another GNU specific flag to set this behavior and instead make it the default. Although this change the semanthic from previous implementation, I think adding another compat symbol to be really unecessary as from aforementioned reasons (current behavior not defined in any standard, general idea of different implementation is to list dangling symbols). This also sync glob with gnulib commit fd1daf4 (glob: match dangling symlinks). Checked on x86_64-linux-gnu and on a build using build-many-glibcs.py for all major architectures. [BZ #866] [BZ #1062] * posix/Makefile (tests): Remove bug-glob1 and tst-glob_symlinks. * posix/bug-glob1.c: Remove file. * posix/tst-glob_symlinks.c: New file. * posix/glob.c (__lstat64): New macro. (is_dir): New function. (glob, glob_in_dir): Match symlinks even if they are dangling. (link_stat, link_exists_p): Remove. All uses removed.