summaryrefslogtreecommitdiff
path: root/modules/fts
Commit message (Collapse)AuthorAgeFilesLines
* fts: pacify GCC 13 -Wuse-after-freePaul Eggert2023-02-041-0/+1
| | | | | | | | | | | Problem reported by Peter Frazier in: https://lists.gnu.org/r/bug-gnulib/2023-02/msg00000.html * lib/fts.c: Include stdint.h. (fts_build): Do not access freed pointer directly; instead, save its bit-pattern into a uintptr_t, and use that to compare. (ADJUST): Likewise, but more trickily since this hack puns pointer types and relies on undefined behavior. * modules/fts (Depends-on): Add stdint.
* alignasof: new modulePaul Eggert2023-01-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | This splits off support for the C23 keywords alignas and alignof, from the now-deprecated stdalign module. The latter now merely provides C11 support. * MODULES.html.sh, NEWS, doc/gnulib.texi: * doc/posix-headers/stdalign.texi: Document the change. * lib/stdalign.in.h: Remove most of the definitions (which are now supplied by the alignasof module), leaving only __alignas_is_defined and __alignof_is_defined. * modules/alignasof, modules/alignasof-tests: New files. * m4/stdalign.m4 (gl_ALIGNASOF): New macro, with most of the contents of the old gl_STDALIGN_H. Do not define __alignas_is_defined or __alignof_is_defined. (gl_STDALIGN_H): Rely on gl_ALIGNASOF for most of the work. * modules/alignalloc, modules/alignof, modules/argp: * modules/crypto/md4-buffer, modules/crypto/md5-buffer: * modules/crypto/sha1-buffer, modules/crypto/sha256-buffer: * modules/crypto/sha512-buffer, modules/crypto/sm3-buffer: * modules/fts, modules/rawmemchr, modules/relocatable-prog-wrapper: * modules/stddef-tests, modules/sys_socket: Depend on alignasof, not stdalign. * modules/stdalign: Deprecate. Depend on alignasof. * modules/stdalign-tests: Move most contents to the new module alignasof-tests, and depend on that.
* Use the GL_CFLAG_GNULIB_WARNINGS for most AC_LIBOBJ compilation units.Bruno Haible2022-01-091-1/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * modules/_Exit (configure.ac): Define an Automake conditional. Remove the AC_LIBOBJ invocation. (Makefile.am): Augment lib_SOURCES, guarded by that Automake conditional. * modules/accept: Likewise. * modules/access: Likewise. * modules/acosf: Likewise. * modules/acosl: Likewise. * modules/aligned_alloc: Likewise. * modules/alphasort: Likewise. * modules/argz: Likewise. * modules/asinf: Likewise. * modules/asinl: Likewise. * modules/atan2f: Likewise. * modules/atanf: Likewise. * modules/atanl: Likewise. * modules/atexit: Likewise. * modules/atoll: Likewise. * modules/bind: Likewise. * modules/btowc: Likewise. * modules/c32rtomb: Likewise. * modules/canonicalize-lgpl: Likewise. * modules/cbrt: Likewise. * modules/cbrtf: Likewise. * modules/cbrtl: Likewise. * modules/ceil: Likewise. * modules/ceilf: Likewise. * modules/ceill: Likewise. * modules/chdir-long: Likewise. * modules/chown: Likewise. * modules/close: Likewise. * modules/closedir: Likewise. * modules/cnd: Likewise. * modules/connect: Likewise. * modules/copy-file-range: Likewise. * modules/copysign: Likewise. * modules/copysignf: Likewise. * modules/copysignl: Likewise. * modules/cosf: Likewise. * modules/coshf: Likewise. * modules/cosl: Likewise. * modules/creat: Likewise. * modules/crypto/gc: Likewise. * modules/ctime: Likewise. * modules/dirfd: Likewise. * modules/dup: Likewise. * modules/dup2: Likewise. * modules/duplocale: Likewise. * modules/error: Likewise. * modules/euidaccess: Likewise. * modules/execinfo: Likewise. * modules/execl: Likewise. * modules/execle: Likewise. * modules/execlp: Likewise. * modules/execv: Likewise. * modules/execve: Likewise. * modules/execvp: Likewise. * modules/execvpe: Likewise. * modules/exp2: Likewise. * modules/exp2f: Likewise. * modules/exp2l: Likewise. * modules/expf: Likewise. * modules/expl: Likewise. * modules/explicit_bzero: Likewise. * modules/expm1: Likewise. * modules/expm1f: Likewise. * modules/expm1l: Likewise. * modules/fabsf: Likewise. * modules/fabsl: Likewise. * modules/faccessat: Likewise. * modules/fchdir: Likewise. * modules/fchmodat: Likewise. * modules/fchownat: Likewise. * modules/fclose: Likewise. * modules/fcntl: Likewise. * modules/fdatasync: Likewise. * modules/fdopen: Likewise. * modules/fdopendir: Likewise. * modules/fflush: Likewise. * modules/ffs: Likewise. * modules/ffsl: Likewise. * modules/ffsll: Likewise. * modules/fileblocks: Likewise. * modules/float: Likewise. * modules/flock: Likewise. * modules/floor: Likewise. * modules/floorf: Likewise. * modules/floorl: Likewise. * modules/fma: Likewise. * modules/fmaf: Likewise. * modules/fmal: Likewise. * modules/fmod: Likewise. * modules/fmodf: Likewise. * modules/fmodl: Likewise. * modules/forkpty: Likewise. * modules/fpending: Likewise. * modules/fpurge: Likewise. * modules/freadable: Likewise. * modules/freadahead: Likewise. * modules/freadptr: Likewise. * modules/free-posix: Likewise. * modules/freopen: Likewise. * modules/frexpf: Likewise. * modules/fseek: Likewise. * modules/fseeko: Likewise. * modules/fseterr: Likewise. * modules/fstat: Likewise. * modules/fstatat: Likewise. * modules/fsusage: Likewise. * modules/fsync: Likewise. * modules/ftell: Likewise. * modules/ftello: Likewise. * modules/ftruncate: Likewise. * modules/fts: Likewise. * modules/futimens: Likewise. * modules/fwritable: Likewise. * modules/fwriting: Likewise. * modules/getaddrinfo: Likewise. * modules/getcwd: Likewise. * modules/getcwd-lgpl: Likewise. * modules/getdelim: Likewise. * modules/getdomainname: Likewise. * modules/getdtablesize: Likewise. * modules/getentropy: Likewise. * modules/getgroups: Likewise. * modules/gethostname: Likewise. * modules/getline: Likewise. * modules/getloadavg: Likewise. * modules/getlogin: Likewise. * modules/getlogin_r: Likewise. * modules/getopt-posix: Likewise. * modules/getpagesize: Likewise. * modules/getpeername: Likewise. * modules/getrandom: Likewise. * modules/getrusage: Likewise. * modules/getsockname: Likewise. * modules/getsockopt: Likewise. * modules/getsubopt: Likewise. * modules/gettimeofday: Likewise. * modules/getumask: Likewise. * modules/getusershell: Likewise. * modules/glob: Likewise. * modules/grantpt: Likewise. * modules/group-member: Likewise. * modules/hypot: Likewise. * modules/hypotf: Likewise. * modules/hypotl: Likewise. * modules/iconv_open: Likewise. * modules/ilogb: Likewise. * modules/ilogbf: Likewise. * modules/ilogbl: Likewise. * modules/imaxabs: Likewise. * modules/imaxdiv: Likewise. * modules/inet_ntop: Likewise. * modules/inet_pton: Likewise. * modules/ioctl: Likewise. * modules/isapipe: Likewise. * modules/isatty: Likewise. * modules/isblank: Likewise. * modules/isfinite: Likewise. * modules/isinf: Likewise. * modules/iswblank: Likewise. * modules/iswctype: Likewise. * modules/iswdigit: Likewise. * modules/iswxdigit: Likewise. * modules/lchmod: Likewise. * modules/lchown: Likewise. * modules/ldexpf: Likewise. * modules/ldexpl: Likewise. * modules/libgmp: Likewise. * modules/link: Likewise. * modules/linkat: Likewise. * modules/listen: Likewise. * modules/localeconv: Likewise. * modules/localtime: Likewise. * modules/log: Likewise. * modules/log10: Likewise. * modules/log10f: Likewise. * modules/log10l: Likewise. * modules/log1p: Likewise. * modules/log1pf: Likewise. * modules/log1pl: Likewise. * modules/log2: Likewise. * modules/log2f: Likewise. * modules/log2l: Likewise. * modules/logb: Likewise. * modules/logbf: Likewise. * modules/logbl: Likewise. * modules/logf: Likewise. * modules/login_tty: Likewise. * modules/logl: Likewise. * modules/lseek: Likewise. * modules/lstat: Likewise. * modules/mbrlen: Likewise. * modules/mbrtoc32: Likewise. * modules/mbrtowc: Likewise. * modules/mbsinit: Likewise. * modules/mbsnrtowcs: Likewise. * modules/mbsrtowcs: Likewise. * modules/mbtowc: Likewise. * modules/memalign: Likewise. * modules/memchr: Likewise. * modules/memcmp: Likewise. * modules/memcpy: Likewise. * modules/memmove: Likewise. * modules/mempcpy: Likewise. * modules/memrchr: Likewise. * modules/memset: Likewise. * modules/mkdir: Likewise. * modules/mkdirat: Likewise. * modules/mkdtemp: Likewise. * modules/mkfifo: Likewise. * modules/mkfifoat: Likewise. * modules/mknod: Likewise. * modules/mkostemp: Likewise. * modules/mkostemps: Likewise. * modules/mkstemp: Likewise. * modules/mkstemps: Likewise. * modules/modf: Likewise. * modules/modff: Likewise. * modules/modfl: Likewise. * modules/mountlist: Likewise. * modules/msvc-inval: Likewise. * modules/msvc-nothrow: Likewise. * modules/mtx: Likewise. * modules/nanosleep: Likewise. * modules/nl_langinfo: Likewise. * modules/obstack: Likewise. * modules/open: Likewise. * modules/openat: Likewise. * modules/opendir: Likewise. * modules/openpty: Likewise. * modules/pclose: Likewise. * modules/perror: Likewise. * modules/pipe-posix: Likewise. * modules/poll: Likewise. * modules/popen: Likewise. * modules/posix_memalign: Likewise. * modules/posix_openpt: Likewise. * modules/posix_spawn: Likewise. * modules/posix_spawn-internal: Likewise. * modules/posix_spawn_file_actions_addchdir: Likewise. * modules/posix_spawn_file_actions_addclose: Likewise. * modules/posix_spawn_file_actions_adddup2: Likewise. * modules/posix_spawn_file_actions_addfchdir: Likewise. * modules/posix_spawn_file_actions_addopen: Likewise. * modules/posix_spawn_file_actions_destroy: Likewise. * modules/posix_spawn_file_actions_init: Likewise. * modules/posix_spawnattr_destroy: Likewise. * modules/posix_spawnattr_getflags: Likewise. * modules/posix_spawnattr_getpgroup: Likewise. * modules/posix_spawnattr_getschedparam: Likewise. * modules/posix_spawnattr_getschedpolicy: Likewise. * modules/posix_spawnattr_getsigdefault: Likewise. * modules/posix_spawnattr_getsigmask: Likewise. * modules/posix_spawnattr_init: Likewise. * modules/posix_spawnattr_setflags: Likewise. * modules/posix_spawnattr_setpgroup: Likewise. * modules/posix_spawnattr_setschedparam: Likewise. * modules/posix_spawnattr_setschedpolicy: Likewise. * modules/posix_spawnattr_setsigdefault: Likewise. * modules/posix_spawnattr_setsigmask: Likewise. * modules/posix_spawnp: Likewise. * modules/powf: Likewise. * modules/pread: Likewise. * modules/pselect: Likewise. * modules/pthread-cond: Likewise. * modules/pthread-mutex: Likewise. * modules/pthread-once: Likewise. * modules/pthread-rwlock: Likewise. * modules/pthread-spin: Likewise. * modules/pthread-thread: Likewise. * modules/pthread-tss: Likewise. * modules/pthread_mutex_timedlock: Likewise. * modules/pthread_sigmask: Likewise. * modules/ptsname: Likewise. * modules/ptsname_r: Likewise. * modules/putenv: Likewise. * modules/pwrite: Likewise. * modules/qsort_r: Likewise. * modules/raise: Likewise. * modules/random: Likewise. * modules/random_r: Likewise. * modules/rawmemchr: Likewise. * modules/read: Likewise. * modules/readdir: Likewise. * modules/readline: Likewise. * modules/readlink: Likewise. * modules/readlinkat: Likewise. * modules/readutmp: Likewise. * modules/reallocarray: Likewise. * modules/recv: Likewise. * modules/recvfrom: Likewise. * modules/regex: Likewise. * modules/relocatable-prog: Likewise. * modules/remainder: Likewise. * modules/remainderf: Likewise. * modules/remainderl: Likewise. * modules/remove: Likewise. * modules/rename: Likewise. * modules/renameat: Likewise. * modules/rewinddir: Likewise. * modules/rint: Likewise. * modules/rintf: Likewise. * modules/rintl: Likewise. * modules/rmdir: Likewise. * modules/round: Likewise. * modules/roundf: Likewise. * modules/roundl: Likewise. * modules/rpmatch: Likewise. * modules/scandir: Likewise. * modules/sched_yield: Likewise. * modules/secure_getenv: Likewise. * modules/select: Likewise. * modules/selinux-h: Likewise. * modules/send: Likewise. * modules/sendto: Likewise. * modules/setenv: Likewise. * modules/sethostname: Likewise. * modules/setlocale: Likewise. * modules/setlocale-null: Likewise. * modules/setsockopt: Likewise. * modules/shutdown: Likewise. * modules/sig2str: Likewise. * modules/sigabbrev_np: Likewise. * modules/sigaction: Likewise. * modules/sigdescr_np: Likewise. * modules/signbit: Likewise. * modules/sigprocmask: Likewise. * modules/sinf: Likewise. * modules/sinhf: Likewise. * modules/sinl: Likewise. * modules/sleep: Likewise. * modules/socket: Likewise. * modules/spawn-pipe: Likewise. * modules/sqrtf: Likewise. * modules/sqrtl: Likewise. * modules/stat: Likewise. * modules/stdio: Likewise. * modules/stpcpy: Likewise. * modules/stpncpy: Likewise. * modules/strcase: Likewise. * modules/strchrnul: Likewise. * modules/strcspn: Likewise. * modules/strdup-posix: Likewise. * modules/strerror: Likewise. * modules/strerror-override: Likewise. * modules/strerrorname_np: Likewise. * modules/strfmon_l: Likewise. * modules/strftime-fixes: Likewise. * modules/strncat: Likewise. * modules/strndup: Likewise. * modules/strnlen: Likewise. * modules/strpbrk: Likewise. * modules/strptime: Likewise. * modules/strsep: Likewise. * modules/strsignal: Likewise. * modules/strtod: Likewise. * modules/strtoimax: Likewise. * modules/strtok_r: Likewise. * modules/strtol: Likewise. * modules/strtold: Likewise. * modules/strtoll: Likewise. * modules/strtoul: Likewise. * modules/strtoull: Likewise. * modules/strtoumax: Likewise. * modules/strverscmp: Likewise. * modules/symlink: Likewise. * modules/symlinkat: Likewise. * modules/tanf: Likewise. * modules/tanhf: Likewise. * modules/tanl: Likewise. * modules/tcgetsid: Likewise. * modules/thrd: Likewise. * modules/time_r: Likewise. * modules/time_rz: Likewise. * modules/timegm: Likewise. * modules/times: Likewise. * modules/timespec_get: Likewise. * modules/timespec_getres: Likewise. * modules/tmpfile: Likewise. * modules/towctrans: Likewise. * modules/trunc: Likewise. * modules/truncate: Likewise. * modules/truncf: Likewise. * modules/truncl: Likewise. * modules/tsearch: Likewise. * modules/tss: Likewise. * modules/ttyname_r: Likewise. * modules/tzset: Likewise. * modules/uname: Likewise. * modules/unlink: Likewise. * modules/unlinkat: Likewise. * modules/unlockpt: Likewise. * modules/unsetenv: Likewise. * modules/usleep: Likewise. * modules/utime: Likewise. * modules/utimensat: Likewise. * modules/waitpid: Likewise. * modules/wcpcpy: Likewise. * modules/wcpncpy: Likewise. * modules/wcrtomb: Likewise. * modules/wcscasecmp: Likewise. * modules/wcscat: Likewise. * modules/wcschr: Likewise. * modules/wcscmp: Likewise. * modules/wcscoll: Likewise. * modules/wcscpy: Likewise. * modules/wcscspn: Likewise. * modules/wcsdup: Likewise. * modules/wcsftime: Likewise. * modules/wcslen: Likewise. * modules/wcsncasecmp: Likewise. * modules/wcsncat: Likewise. * modules/wcsncmp: Likewise. * modules/wcsncpy: Likewise. * modules/wcsnlen: Likewise. * modules/wcsnrtombs: Likewise. * modules/wcspbrk: Likewise. * modules/wcsrchr: Likewise. * modules/wcsrtombs: Likewise. * modules/wcsspn: Likewise. * modules/wcsstr: Likewise. * modules/wcstok: Likewise. * modules/wcswidth: Likewise. * modules/wcsxfrm: Likewise. * modules/wctob: Likewise. * modules/wctomb: Likewise. * modules/wctrans: Likewise. * modules/wctype: Likewise. * modules/wcwidth: Likewise. * modules/windows-cond: Likewise. * modules/windows-mutex: Likewise. * modules/windows-once: Likewise. * modules/windows-recmutex: Likewise. * modules/windows-rwlock: Likewise. * modules/windows-spawn: Likewise. * modules/windows-spin: Likewise. * modules/windows-thread: Likewise. * modules/windows-timedmutex: Likewise. * modules/windows-timedrecmutex: Likewise. * modules/windows-timedrwlock: Likewise. * modules/windows-tls: Likewise. * modules/wmemchr: Likewise. * modules/wmemcmp: Likewise. * modules/wmemcpy: Likewise. * modules/wmemmove: Likewise. * modules/wmempcpy: Likewise. * modules/wmemset: Likewise. * modules/write: Likewise.
* Use module 'c99' when needed for declaration-after-statement syntax.Bruno Haible2020-09-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * modules/backup-rename (Depends-on): Add c99. * modules/backupfile (Depends-on): Likewise. * modules/bitset-tests (Depends-on): Likewise. * modules/bitsetv (Depends-on): Likewise. * modules/c-strtod (Depends-on): Likewise. * modules/c-strtold (Depends-on): Likewise. * modules/clean-temp (Depends-on): Likewise. * modules/copy-file (Depends-on): Likewise. * modules/crypto/hmac-md5-tests (Depends-on): Likewise. * modules/crypto/hmac-sha1-tests (Depends-on): Likewise. * modules/crypto/hmac-sha256-tests (Depends-on): Likewise. * modules/crypto/hmac-sha512-tests (Depends-on): Likewise. * modules/crypto/md5-buffer (Depends-on): Likewise. * modules/crypto/md5-tests (Depends-on): Likewise. * modules/crypto/sha1-buffer (Depends-on): Likewise. * modules/crypto/sha1-tests (Depends-on): Likewise. * modules/crypto/sha256-buffer (Depends-on): Likewise. * modules/crypto/sha256-tests (Depends-on): Likewise. * modules/crypto/sha512-buffer (Depends-on): Likewise. * modules/crypto/sha512-tests (Depends-on): Likewise. * modules/diffseq (Depends-on): Likewise. * modules/fatal-signal (Depends-on): Likewise. * modules/fchmodat (Depends-on): Likewise. * modules/fstrcmp (Depends-on): Likewise. * modules/fsusage (Depends-on): Likewise. * modules/fts (Depends-on): Likewise. * modules/fts-tests (Depends-on): Likewise. * modules/getumask (Depends-on): Likewise. * modules/git-merge-changelog (Depends-on): Likewise. * modules/hash-map (Depends-on): Likewise. * modules/hash-set (Depends-on): Likewise. * modules/lchmod (Depends-on): Likewise. * modules/libgmp-tests (Depends-on): Likewise. * modules/libtextstyle-optional-tests (Depends-on): Likewise. * modules/linkedhash-map (Depends-on): Likewise. * modules/linkedhash-set (Depends-on): Likewise. * modules/long-options (Depends-on): Likewise. * modules/mbrtoc32 (Depends-on): Likewise. * modules/memchr2-tests (Depends-on): Likewise. * modules/memmem-tests (Depends-on): Likewise. * modules/memrchr-tests (Depends-on): Likewise. * modules/mktime-internal (Depends-on): Likewise. * modules/nstrftime (Depends-on): Likewise. * modules/opendirat (Depends-on): Likewise. * modules/parse-datetime (Depends-on): Likewise. * modules/quotearg-simple-tests (Depends-on): Likewise. * modules/same (Depends-on): Likewise. * modules/supersede (Depends-on): Likewise. * modules/supersede-tests (Depends-on): Likewise. * modules/time_rz (Depends-on): Likewise. * modules/unistr/u16-chr-tests (Depends-on): Likewise. * modules/unistr/u32-chr-tests (Depends-on): Likewise. * modules/unistr/u8-chr-tests (Depends-on): Likewise. * modules/xalloc (Depends-on): Likewise. * modules/xnanosleep (Depends-on): Likewise.
* fts: Make more robust in multithreaded applications.Bruno Haible2020-05-281-0/+1
| | | | | * lib/fts.c (fts_open): Pass an O_CLOEXEC flag to open(). * modules/fts (Depends-on): Add 'open'.
* attribute: new modulePaul Eggert2020-05-031-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This simplifies use of GCC and C2X attributes like ‘deprecated’. * MODULES.html.sh: Add attribute. * doc/attribute.texi, lib/attribute.h, modules/attribute: New files. * doc/gnulib.texi (Particular Modules): Add Attributes. * lib/backupfile.c, lib/fnmatch.c, lib/freopen-safer.c: * lib/mbrtoc32.c, lib/mbrtowc.c, lib/nstrftime.c, lib/quotearg.c: * lib/savewd.c, lib/unistr/u8-uctomb-aux.c, lib/unistr/u8-uctomb.c: * lib/vasnprintf.c: Include attribute.h, and let it define FALLTHROUGH. * lib/bitset/base.h, lib/c-stack.c (__attribute__): Remove macro. * lib/bitset/base.h (ATTRIBUTE_UNUSED): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED, for forwards compatibility to C2X. * lib/dfa.c (FALLTHROUGH): Define consistently with gl_COMMON_BODY. This is a copy since Gawk doesn’t use Gnulib. * lib/di-set.h (_GL_ATTRIBUTE_NONNULL): Remove definition that is incompatible with gl_COMMON_BODY’s. All uses changed. * lib/fts.c: Include attribte.h, for FALLTHROUGH. Keep the existing FALLTHROUGH definition since Glibc might use it, and it does no harm to Gnulib’s FALLTHROUGH. * lib/fts_.h, lib/inttostr.h: (__GNUC_PREREQ): Remove; no longer needed. (__attribute_warn_unused_result__): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/gl_list.h, lib/gl_map.h, lib/gl_omap.h, lib/gl_oset.h: * lib/gl_set.h: Prefer _GL_ATTRIBUTE_NODISCARD to an ifdeffed __attribute__ ((__warn_unused_result__)), for forward compatibility to C2X. * lib/hash.h (_GL_ATTRIBUTE_WUR): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. (_GL_ATTRIBUTE_DEPRECATED): Remove, since gl_COMMON_BODY defines it. * lib/ino-map.h (_GL_ATTRIBUTE_NONNULL): Remove. All uses replaced by gl_COMMON_BODY’s implementation, which has a slightly different signature. * lib/safe-alloc.h (_GL_ATTRIBUTE_RETURN_CHECK): Remove. All uses replaced by _GL_ATTRIBUTE_NODISCARD. * lib/unused-parameter.h (_GL_UNUSED_PARAMETER): Define in terms of _GL_ATTRIBUTE_MAYBE_UNUSED. No doubt all uses should be replaced, at some point. * m4/gnulib-common.m4 (_GL_GNUC_PREREQ): New macro. (_Noreturn): Use it. (_GL_HAS_ATTRIBUTE, _GL_ATTRIBUTE_ALLOC_SIZE) (_GL_ATTRIBUTE_ALWAYS_INLINE, _GL_ATTRIBUTE_ARTIFICIAL) (_GL_ATTRIBUTE_COLD) (_GL_ATTRIBUTE_DEPRECATED, _GL_ATTRIBUTE_ERROR) (_GL_ATTRIBUTE_WARNING, _GL_ATTRIBUTE_EXTERNALLY_VISIBLE) (_GL_ATTRIBUTE_FALLTHROUGH, _GL_ATTRIBUTE_FORMAT) (_GL_ATTRIBUTE_LEAF, _GL_ATTRIBUTE_MAY_ALIAS) (_GL_ATTRIBUTE_MAYBE_UNUSED) (_GL_ATTRIBUTE_NODISCARD, _GL_ATTRIBUTE_NOINLINE) (_GL_ATTRIBUTE_NONNULL, _GL_ATTRIBUTE_NONSTRING) (_GL_ATTRIBUTE_NOTHROW, _GL_ATTRIBUTE_PACKED, _GL_ATTRIBUTE_PURE) (_GL_ATTRIBUTE_SENTINEL): New macros. * modules/backup-rename, modules/backupfile, modules/c-vasnprintf: * modules/fnmatch, modules/freopen-safer, modules/fts: * modules/mbrtoc32, modules/mbrtowc, modules/nstrftime: * modules/quotearg, modules/savewd: * modules/unistdio/u16-u16-vasnprintf: * modules/unistdio/u16-vasnprintf: * modules/unistdio/u32-u32-vasnprintf: * modules/unistdio/u32-vasnprintf: * modules/unistdio/u8-u8-vasnprintf: * modules/unistdio/u8-vasnprintf: * modules/unistdio/ulc-vasnprintf: * modules/unistr/u8-uctomb, modules/vasnprintf: (Depends-on:): Add attribute module.
* backupfile: new dir_fd argsPaul Eggert2018-10-231-2/+1
| | | | | | | | | | | | | | | | | | | | | | New module opendirat with code taken from fts. Use this module to let backupfile use a directory file descriptor. * NEWS: Document the incompatible change. * lib/backup-find.c (find_backup_file_name): * lib/backup-rename.c (backup_file_rename): New arg DIR_FD. * lib/backupfile.c: Include stdint.h, for SIZE_MAX. (SIZE_MAX): Remove. Include opendirat.h rather than dirent--.h. (check_extension): New args DIR_FD and BASE_MAX. All callers changed. (numbered_backup): New args DIR_FD and PNEW_FD. All callers changed. (backupfile_internal): New arg DIR_FD. All callers changed. * lib/fts.c: Include opendirat.h. (opendirat): Move to opendirat.c. * lib/opendirat.c, lib/opendirat.h, modules/opendirat: New files. * modules/backupfile (Depends-on): Remove dirfd, opendir. Add opendirat. * modules/fts (Depends-on): Remove fdopendir, openat-safer. Add opendirat.
* fts: fix cloexec racesPaul Eggert2017-08-121-5/+1
| | | | | | | | | | | * lib/fts.c [!_LIBC]: Do not include dirent--.h, unistd--.h, cloexec.h. (opendirat, diropen): Use O_CLOEXEC instead of set_cloexec_flag. (fts_build): Use F_DUPD_CLOEXEC rinstad of set_cloexec_flag. (fd_ring_check): Set cloexec flag on new file descriptors. (fts_build, fd_ring_check): While we’re at it, make sure the resulting file descriptor is not 0, 1, or 2, since that is easy. * modules/fts (Depends-on): Remove cloexec, dirent-safer, dup, fcntl-safer, unistd-safer. Add fcntl.
* fts: port to C11 alignofPaul Eggert2015-10-181-0/+1
| | | | | | | | * doc/posix-headers/stdalign.texi (stdalign.h): Document the C11 restriction. * lib/fts.c: Include stddef.h, for max_align_t. (fts_alloc): Align using max_align_t, not FTSENT. * modules/fts (Depends-on): Add stddef.
* fts: avoid reading beyond the heap allocationPádraig Brady2015-06-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | GCC 5.1.1 with -O2 and -fsanitize=address reports the following from `chmod a+rx ..` for example: ERROR: AddressSanitizer: heap-buffer-overflow on address 0x61200000be48 READ of size 4 at 0x61200000be48 thread T0 #0 0x40f0a1 in fts_stat lib/fts.c:1821 #1 0x4141ec in fts_open lib/fts.c:514 #2 0x40ca6e in xfts_open lib/xfts.c:36 #3 0x402c35 in process_files src/chmod.c:336 #4 0x402c35 in main src/chmod.c:566 #5 0x7f8fdc38678f in __libc_start_main (/lib64/libc.so.6+0x2078f) #6 0x404608 in _start (/home/padraig/git/coreutils/src/chmod+0x404608) 0x61200000be4b is located 0 bytes to the right of 267-byte region [0x61200000bd40,0x61200000be4b) allocated by thread T0 here: #0 0x7f8fdd4cfa0a in malloc (/lib64/libasan.so.2+0x98a0a) #1 0x40f22c in fts_alloc lib/fts.c:1916 The read of size 4 from a heap object of size 3 is indeed invalid, though this may be due to incorrect padding assumptions by GCC, see: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66661 The read is coming from the a[2] access in ISDOT() which GCC seems to assume can access according to the alignment of the main structure, since the flexible array members are being accessed directly. One could cast the parameter to ISDOT() to (char const*) to restrict to byte at a time access, however it seems more correct and maintainable to increase the buffer size to the appropriate alignment to avoid this issue. For reference some notes on alignment and flexible array members are at: https://sites.google.com/site/embeddedmonologue/home/c-programming/data-alignment-structure-padding-and-flexible-array-member * lib/fts.c (fts_alloc): Increase allocation to alignof(FTSENT). * modules/fts: Depend on stdalign.
* fts: port to GCC 5.1 with --enable-gcc-warningsPaul Eggert2015-04-271-0/+1
| | | | | | | | | | | Without this fix, GCC 5.1 (correctly) warns about a subscript error on the fts_name component of FTSENT. It's actually a flexible member, so define it that way on C99 or later hosts. * lib/fts.c (fts_alloc): Use offsetof, not sizeof, for a structure that now has a flexible array member. * lib/fts_.h (__FLEXIBLE_ARRAY_MEMBER): New macro. (FTSENT): fts_name is now flexible on C99-or-later platforms. * modules/fts (Depends-on): Add flexmember.
* fts: depend on fdopendirPaul Eggert2012-03-101-0/+1
| | | | | | * modules/fts (Depends-on): Depend on fdopendir. This is needed on Solaris 8, at least, since it lacks fdopendir. Evidently the problem was introduced when fdopendir was split out.
* New modules 'at-internal', 'openat-h', split off from module 'openat'.Bruno Haible2011-11-051-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * m4/openat.m4 (gl_FUNC_OPENAT): Don't set GNULIB_OPENAT. Don't invoke gl_PREREQ_OPENAT and gl_MODULE_INDICATOR. * modules/openat (Description): Add reference to POSIX function. (Files): Remove lib/openat.h, lib/openat-proc.c. (Depends-on): Add at-internal, openat-h. Remove fdopendir, gettext-h, intprops, unistd. (configure.ac): Remove AC_LIBOBJ of openat-proc. Invoke gl_PREREQ_OPENAT, gl_MODULE_INDICATOR here. Invoke gl_FCNTL_MODULE_INDICATOR. (Include): Remove unistd.h, openat.h. * modules/areadlinkat (Files): Add lib/at-func.c. (Depends-on): Add at-internal, dosname, errno, extensions, fchdir, openat-die, openat-h, save-cwd. * modules/areadlinkat-with-size (Files): Add lib/at-func.c. (Depends-on): Add at-internal, dosname, errno, extensions, fchdir, openat-die, openat-h, save-cwd, unistd. * modules/faccessat (Files): Add lib/at-func.c, lib/openat-priv.h. (Depends-on): Add at-internal, dosname, errno, fchdir, openat-die, openat-h, save-cwd. Remove fcntl-h, openat. * modules/fchmodat (Files): Remove lib/openat.h. (Depends-on): Add at-internal, openat-h. Remove dirent, fcntl-h, openat, stdbool, unistd. * modules/fchownat (Files): Remove lib/openat.h. (Depends-on): Add at-internal, openat-h. Remove dirent, fcntl-h, openat, stdbool, sys_stat. * modules/fdopendir (Files): Remove lib/openat-priv.h, lib/openat-proc.c. (Depends-on): Add at-internal. (condigure.ac): Remove AC_LIBOBJ of openat-proc. * modules/fstatat (Files): Remove lib/openat.h. (Depends-on): Add at-internal, openat-h. Remove dirent, openat, stdbool, unistd. * modules/fts (Depends-on): Add openat-h. * modules/linkat (Depends-on): Add at-internal, openat-h. Remove openat. * modules/mkdirat (Files): Remove lib/openat.h. (Depends-on): Add at-internal, openat-h. Remove dirent, fcntl-h, openat, stdbool, sys_stat. * modules/mkfifoat (Files): Add lib/at-func.c. (Depends-on): Add at-internal, dosname, errno, fchdir, openat-die, openat-h, save-cwd. Remove fcntl-h, openat. * modules/openat-die (Depends-on): Add openat-h. Remove openat. * modules/readlinkat (Files): Add lib/at-func.c. (Depends-on): Add at-internal, dosname, errno, fchdir, openat-die, openat-h, save-cwd. Remove fcntl-h, openat. * modules/renameat (Depends-on): Add at-internal, openat-h. Remove openat. * modules/selinux-at (Files): Add lib/at-func.c. (Depends-on): Add at-internal, dosname, errno, extensions, fchdir, fcntl-h, openat-die, openat-h, save-cwd, unistd. Remove openat. * modules/symlinkat (Files): Add lib/at-func.c. (Depends-on): Add at-internal, dosname, errno, fchdir, openat-die, openat-h, save-cwd. Remove fcntl-h, openat. * modules/unlinkat (Files): Remove lib/openat.h. (Depends-on): Add at-internal, openat-h. Remove dirent, openat, stdbool. * modules/utimensat (Files): Add lib/at-func.c. (Depends-on): Add at-internal, dosname, errno, fchdir, fcntl-h, openat-die, openat-h, save-cwd. * modules/fchownat-tests (Depends-on): Add openat-h. Remove openat. * modules/fdutimensat-tests (Depends-on): Add openat. * modules/fstatat-tests (Depends-on): Add openat-h. * modules/readlinkat-tests (Depends-on): Add openat. * modules/symlinkat-tests (Depends-on): Add openat.
* New module 'fstat'.Bruno Haible2011-09-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/sys_stat.in.h (fstat): Declare only if GNULIB_FSTAT is set. * lib/fstat.c: New file, based on a piece of lib/fchdir.c. * lib/fchdir.c (rpl_fstat): Remove function. * m4/fstat.m4: New file. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't set REPLACE_FSTAT. * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Test whether fstat is declared. (gl_SYS_STAT_H_DEFAULTS): Initialize GNULIB_FSTAT. * modules/sys_stat (Makefile.am): Substitute GNULIB_FSTAT. * modules/fstat: New file. * modules/sys_stat-tests (Depends-on): Remove fstat-tests. * tests/test-sys_stat-c++.cc (fstat): Check only if GNULIB_TEST_FSTAT is set. * doc/posix-functions/fstat.texi: Mention the new module and the problem on MSVC. * NEWS: Mention the change. * modules/acl (Depends-on): Add fstat. * modules/chdir-safer (Depends-on): Likewise. * modules/chown (Depends-on): Likewise. * modules/copy-file (Depends-on): Likewise. * modules/fchdir (Depends-on): Likewise. * modules/fdopendir (Depends-on): Likewise. * modules/fopen (Depends-on): Likewise. * modules/fts (Depends-on): Likewise. * modules/getcwd (Depends-on): Likewise. * modules/isapipe (Depends-on): Likewise. * modules/linkat (Depends-on): Likewise. * modules/lseek (Depends-on): Likewise. * modules/mkdir-p (Depends-on): Likewise. * modules/open (Depends-on): Likewise. * modules/openat (Depends-on): Likewise. * modules/read-file (Depends-on): Likewise. * modules/renameat (Depends-on): Likewise. * modules/utimens (Depends-on): Likewise.
* New module 'dup'.Bruno Haible2011-09-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | * lib/unistd.in.h (dup): Declare only if the 'dup' module is in use. Allow replacement. * lib/dup.c: New file. * lib/fchdir.c (rpl_dup): Remove function. * m4/dup.m4: New file. * m4/fchdir.m4 (gl_FUNC_FCHDIR): Don't set REPLACE_DUP here. * m4/unistd_h.m4 (gl_UNISTD_H): Test whether 'dup' is declared. (gl_UNISTD_H_DEFAULTS): Initialize GNULIB_DUP. * modules/unistd (Makefile.am): Substitute GNULIB_DUP. * modules/dup: New file. * tests/test-unistd-c++.cc: Check the signature of 'dup' only if the 'dup' module is in use. * modules/fdopendir (Depends-on): Add dup. * modules/fdutimensat-tests (Depends-on): Likewise. * modules/fts (Depends-on): Likewise. * modules/futimens-tests (Depends-on): Likewise. * modules/posix_spawnp-tests (Depends-on): Likewise. * modules/unistd-safer-tests (Depends-on): Likewise. * modules/utimens-tests (Depends-on): Likewise. * doc/posix-functions/dup.texi: Mention the new module and the problem on MSVC.
* Add dependencies to new dirent related modules.Bruno Haible2011-09-171-0/+3
| | | | | | | | | | * modules/backupfile (Depends-on): Add opendir, readdir, closedir. * modules/fts (Depends-on): Likewise. * modules/glob (Depends-on): Likewise. * modules/savedir (Depends-on): Likewise. * modules/scandir (Depends-on): Likewise. * modules/dirent-safer (Depends-on): Add opendir, closedir. * modules/fdopendir (Depends-on): Add opendir.
* fts: Move AC_LIBOBJ invocations to module description.Bruno Haible2011-06-161-0/+3
| | | | | * m4/fts.m4 (gl_FUNC_FTS_CORE): Move AC_LIBOBJ invocation from here... * modules/fts (configure.ac): ... to here.
* fts, getcwd, glob: audit for dirfd returning -1Paul Eggert2010-09-141-1/+0
| | | | | | | | | | | | | | * lib/fts.c (opendir): Remove #define; no longer used. (opendirat): New arg PDIR_FD. All callers changed. (fts_build, _opendir2): Use new opendirat to avoid the need for dirfd, or for checking whether dirfd returns a negative value. Don't use opendir; always use openat followed by fdopendir. * lib/getcwd.c (__getcwd): Don't reset fd; fdopendir no longer clobbers it. * lib/glob.c (link_exists_p): Add comment explaining why dirfd never returns -1 here. * modules/fts (Depends-on): Remove dirfd. * modules/getcwd (Depends-on): Likewise.
* Remove vestiges of fts-lgpl module.Bruno Haible2010-03-291-1/+0
|
* fts: avoid leaking fdsEric Blake2009-09-021-0/+1
| | | | | | | | * modules/fts (Depends-on): Add cloexec. * lib/fts.c (opendirat, diropen, fts_build): Set close-on-exec flag. Signed-off-by: Eric Blake <ebb9@byu.net>
* backupfile, chdir-long, fts, savedir: make saferEric Blake2009-09-021-1/+2
| | | | | | | | | | | | | | | | | | | * lib/backupfile.c (includes): Use "dirent--.h", since numbered_backup can write to stderr during readdir. * lib/savedir.c (includes): Likewise. * lib/chdir-long.c (includes): Use "fcntl--.h", since openat emulation can write to stderr on failure. * lib/fts.c (includes) [!_LIBC]: Likewise for opendir and openat. * lib/getcwd.c: Document why opendir_safer is unused. * lib/glob.c: Likewise. * lib/scandir.c: Likewise. * lib/openat-proc.c: Likewise, for open_safer. * modules/backupfile (Depends-on): Add dirent-safer. * modules/savedir (Depends-on): Likewise. * modules/fts (Depends-on): Add dirent-safer and openat-safer. * modules/chdir-long (Depends-on): Add openat-safer. Signed-off-by: Eric Blake <ebb9@byu.net>
* fcntl-h: rename from fcntl, in preparation for fcntl(2)Eric Blake2009-08-221-1/+1
| | | | | | | | | | | | | | | | | | | | | | * modules/fcntl: Move <fcntl.h> header replacement... * modules/fcntl-h: ...to new name, so as not to collide with like-named function. * tests/test-fcntl.c: Rename... * tests/test-fcntl-h.c: ...to this. Test FD_CLOEXEC. * modules/fcntl-tests: Rename... * modules/fcntl-h-tests: ...to this. Update test file name. * modules/chdir-long (Depends-on): Update clients. * modules/chdir-safer (Depends-on): Likewise. * modules/fcntl-safer (Depends-on): Likewise. * modules/fts (Depends-on): Likewise. * modules/mkancesdirs (Depends-on): Likewise. * modules/mkdir-p (Depends-on): Likewise. * modules/open (Depends-on): Likewise. * modules/savewd (Depends-on): Likewise. * MODULES.html.sh (systems lacking POSIX:2008): Update name. * doc/posix-headers/fcntl.texi (fcntl.h): Update documentation. Signed-off-by: Eric Blake <ebb9@byu.net>
* Mark 'memmove' obsolete.Bruno Haible2008-11-021-0/+1
|
* fts: sort dirent entries on inode number before traversingJim Meyering2008-09-261-0/+1
| | | | | | | | | | | | | | | | | This avoids a quadratic, seek-related performance penalty when operating on a directory containing many entries (measurable at 10k; 3.5 hours at 2 million entries with a cold cache) on certain types of file systems, including ext3 and ext4, but not tmpfs. * lib/fts.c (DT_MUST_BE, NOT_AN_INODE_NUMBER, D_INO): Define. (FTS_INODE_SORT_DIR_ENTRIES_THRESHOLD): Define if not defined. (S_MAGIC_TMPFS, S_MAGIC_NFS): Define. (fs_handles_readdir_ordered_dirents_efficiently): New function. (dirent_inode_sort_may_be_useful, fts_compare_ino): Likewise. (fts_build): Set the stat.st_ino member from D_INO. If it is likely to be useful, sort dirent entries on inode number. * m4/fts.m4 (gl_FUNC_FTS_CORE): Check for fstatfs, sys/vfs.h, and the struct statfs.f_type member. * modules/fts (Depends-on): Add d-ino.
* 2007-05-26 Bruno Haible <bruno@clisp.org>Bruno Haible2007-05-261-0/+1
| | | | | | | | | * modules/chdir-long (Depends-on): Add fchdir. * modules/chdir-safer (Depends-on): Likewise. * modules/fts (Depends-on): Likewise. * modules/fts-lgpl (Depends-on): Likewise. * modules/openat (Depends-on): Likewise. * modules/savewd (Depends-on): Likewise.
* 2007-01-08 Bruno Haible <bruno@clisp.org>Bruno Haible2007-01-081-0/+1
| | | | | | | | * m4/fts.m4 (gl_FUNC_FTS_LGPL): Remove _LGPL_PACKAGE macro definition. * lib/fts_.h (_LGPL_PACKAGE): Remove macro. Use !GNULIB_FTS instead of _LGPL_PACKAGE. * lib/fts.c: Likewise. * modules/fts (configure.ac): Use gl_MODULE_INDICATOR.
* Make fts (in FTS_CWDFD mode) more efficient by caching a few openJim Meyering2006-11-121-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | file descriptors. This also averts a failure on systems with native openat support when a traversed directory lacks "x" access. * lib/fts_.h: Include "i-ring.h" (struct FTS) [fts_fd_ring]: New member. * lib/fts.c (RESTORE_INITIAL_CWD): Also call fd_ring_clear. (FCHDIR): Add parentheses. (fd_ring_check, fd_ring_print) [!FTS_DEBUG]: Define away. (cwd_advance_fd): Add a 3rd parameter. Adjust all callers. When descending, rather than simply closing the previous fts_cwd_fd value, push that file descriptor onto the ring. (same_fd, fd_ring_print, fd_ring_check) [FTS_DEBUG]: New functions. (fts_open): Initialize the new fd_ring member. (fts_close): Clear the ring. (fts_safe_changedir): When possible, use our new fd_ring to skip the diropen and fstat and dev/ino comparison that would normally accompany a virtual `chdir ("..")'. * modules/fts (Depends-on): Add i-ring. * modules/i-ring: New module. * lib/i-ring.c, lib/i-ring.h, lib/i-ring-test.c: New files. * m4/i-ring.m4: New file.
* gnulib-tool now synthesizes the EXTRA_DIST line.Bruno Haible2006-10-131-1/+0
|
* Distribute all lib/* source files through EXTRA_DIST.Bruno Haible2006-10-121-1/+1
|
* Big performance improvement for fts-based tools that use FTS_NOSTAT.Jim Meyering2006-10-121-1/+2
| | | | | | | | | | | | | | | | | | | | | | | Avoid spurious inode-mismatch problems on non-POSIX file systems. Details: http://article.gmane.org/gmane.comp.lib.gnulib.bugs/7416 * lib/fts_.h (FTS_DEFER_STAT): Define new flag. (FTS_OPTIONMASK): Extend the mask to reflect this addition. * lib/fts.c (DT_IS_KNOWN, DT_MUST_BE): Define. (FTS_NO_STAT_REQUIRED, FTS_STAT_REQUIRED): Define. (fts_set_stat_required): New function. (fts_open): Defer the calls to fts_stat, if possible or requested. Move the code that maps a command-line fts_info value FTS_DOT to FTS_D into fts_stat itself. (fts_read): Perform any required (deferred) fts_stat call. (fts_build): Likewise, for the directory we're about to open and read. In the readdir loop, carefully decide whether each entry will require an eventual call to fts_stat, using dirent.d_type info if available. (fts_stat): Move the test for whether to honor FTS_COMFOLLOW on a command line argument into this function. Update all callers. Map a return value of FTS_DOT to FTS_D for a command line argument. * modules/fts (Depends-on): Add d-type. Alphabetize. Thanks to Miklos Szeredi for his tenacity and for the initial bug report about "find" failing on a FUSE-based file system.
* * lib/fcntl_.h: New file.Paul Eggert2006-08-281-0/+1
| | | | | | | | | | | | * lib/chdir-safer.c (O_DIRECTORY, O_NOFOLLOW): Remove, now that we have the fcntl module. * lib/dirchownmod.c: Likewise. * lib/fts.c: Likewise. * m4/fcntl_h.m4: New file. * modules/fcntl: New file. * modules/chdir-safer (Depends-on): Add fcntl. * modules/fts: Likewise. * modules/mkdir-p: Likewise.
* Avoid the need for AC_LIBSOURCES in m4 macros.Paul Eggert2006-08-211-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * modules/acl (EXTRA_DIST): Add acl.h. * modules/argmatch (Files): Add m4/argmatch.m4. (configure.ac): Add gl_ARGMATCH. (EXTRA_DIST): Renamed from lib_SOURCES, for consistency with the other modules. Remove argmatch.c. * modules/backupfile (EXTRA_DIST): Add backupfile.h. * modules/c-strtod (EXTRA_DIST): Add c-strtod.h. * modules/c-strtold (EXTRA_DIST): Add c-strtod.c, c-strtod.h. * modules/canonhost (EXTRA_DIST): Add c-canonhost.h. * modules/canonicalize (EXTRA_DIST): Add canonicalize.h. * modules/chdir-long (EXTRA_DIST): Add chdir-long.h. * modules/chdir-safer (EXTRA_DIST): Add chdir-safer.h. * modules/cloexec (EXTRA_DIST): Add cloexec.h. * modules/close-stream (EXTRA_DIST): Add close-stream.h. * modules/closeout (EXTRA_DIST): Add closeout.h. * modules/cycle-check (EXTRA_DIST): Add cycle-check.h. * modules/dev-ino (EXTRA_DIST): Add dev-ino.h. * modules/dirfd (EXTRA_DIST): Add dirfd.h. * modules/dirname (EXTRA_DIST): Renamed from lib_SOURCES. Add dirname.h; remove basename.c and stripslash.c. * modules/exclude (EXTRA_DIST): Add exclude.h. * modules/exitfail (EXTRA_DIST): Add exitfail.h. * modules/fcntl-safer (EXTRA_DIST): Add fcntl-safer.h fcntl--.h. * modules/file-type (EXTRA_DIST): Add file-type.h. * modules/filemode (EXTRA_DIST): Add filemode.h. * modules/filenamecat (EXTRA_DIST): Add filenamecat.h. * modules/fopen-safer (EXTRA_DIST): Add stdio-safer.h stdio--.h. * modules/fpending (EXTRA_DIST): Add __fpending.h. * modules/fprintftime (EXTRA_DIST): Add fprintftime.h. * modules/fsusage (EXTRA_DIST): Add fsusage.h. * modules/fts (EXTRA_DIST): Add fts_.h fts-cycle.c. * modules/getcwd (EXTRA_DIST): Add getcwd.h. * modules/getdate (EXTRA_DIST): Add getdate.c. * modules/gethrxtime (EXTRA_DIST): Add gethrxtime.h xtime.h. * modules/getpagesize (EXTRA_DIST): Add getpagesize.h. * modules/getpass (EXTRA_DIST): Add getpass.h. * modules/glob (EXTRA_DIST): Add glob_.h glob-libc.h. * modules/group-member (EXTRA_DIST): Add group-member.h. * modules/hard-locale (EXTRA_DIST): Add hard-locale.h. * modules/hash (EXTRA_DIST): Add hash.h. * modules/human (EXTRA_DIST): Add human.h. * modules/inttypes (EXTRA_DIST): Add inttypes.h. * modules/lchmod (EXTRA_DIST): Add lchmod.h. * modules/lchown (EXTRA_DIST): Add lchown.h. * modules/long-options (EXTRA_DIST): Add long-options.h. * modules/lstat (EXTRA_DIST): Add lstat.h. * modules/md5 (EXTRA_DIST): Add memcasecmp.h. * modules/memcoll (EXTRA_DIST): Add memcoll.h. * modules/mempcpy (EXTRA_DIST): Add mempcpy.h. * modules/memrchr (EXTRA_DIST): Add memrchr.h. * modules/memxor (EXTRA_DIST): Add memxor.h. * modules/mkancesdirs (EXTRA_DIST): Add mkancesdirs.h. * modules/mkdir-p (EXTRA_DIST): Add modechange.h. * modules/mountlist (EXTRA_DIST): Add mountlist.h. * modules/openat (EXTRA_DIST): Add at-func.c openat.h openat-priv.h. * modules/pathmax (EXTRA_DIST): Add pathmax.h. * modules/physmem (EXTRA_DIST): Add physmem.h. * modules/posixtm (EXTRA_DIST): Add posixtm.h. * modules/posixver (EXTRA_DIST): Add posixver.h. * modules/quote (EXTRA_DIST): Add quote.h. * modules/quotearg (EXTRA_DIST): Add quotearg.h. * modules/readtokens (EXTRA_DIST): Add readtokens.h. * modules/readutmp (EXTRA_DIST): Add readutmp.h. * modules/regex (EXTRA_DIST): Add regcomp.c regex.h regex_internal.c regex_internal.h regexec.c. * modules/safe-read (EXTRA_DIST): Add safe-read.h. * modules/safe-write (EXTRA_DIST): Add safe-write.h. * modules/same (EXTRA_DIST): Add same.h. * modules/same-inode (EXTRA_DIST): Add same-inode.h. * modules/save-cwd (EXTRA_DIST): Add save-cwd.h. * modules/savedir (EXTRA_DIST): Add savedir.h. * modules/sha1 (EXTRA_DIST): Add sha1.h. * modules/sig2str (EXTRA_DIST): Add sig2str.h. * modules/stat-macros (EXTRA_DIST): Add stat-macros.h. * modules/stat-time (EXTRA_DIST): Add stat-time.h. * modules/stdlib-safer (EXTRA_DIST): Add stdlib-safer.h stdlib--.h. * modules/strdup (EXTRA_DIST): Add strdup.h. * modules/strftime (EXTRA_DIST): Add strftime.h. * modules/strndup (EXTRA_DIST): Add strndup.h. * modules/strnlen (EXTRA_DIST): Add strnlen.h. * modules/strverscmp (EXTRA_DIST): Add strverscmp.h. * modules/time_r (EXTRA_DIST): Add time_r.h. * modules/timespec (EXTRA_DIST): Add timespec.h. * modules/tmpfile-safer (EXTRA_DIST): Add stdio-safer.h stdio--.h. * modules/unistd-safer (EXTRA_DIST): Add unistd-safer.h unistd--.h. * modules/unlinkdir (EXTRA_DIST): Add unlinkdir.h. * modules/unlocked-io (EXTRA_DIST): Add unlocked-io.h. * modules/userspec (EXTRA_DIST): Add userspec.h. * modules/utimecmp (EXTRA_DIST): Add utimecmp.h. * modules/utimens (EXTRA_DIST): Add utimens.h. * modules/xalloc (EXTRA_DIST): Add xalloc.h. * modules/xgetcwd (EXTRA_DIST): Add xgetcwd.h. * modules/xnanosleep (EXTRA_DIST): Add xnanosleep.h. * modules/xreadlink (EXTRA_DIST): Add xreadlink.h. * modules/xstrtod (EXTRA_DIST): Add xstrtod.h. * modules/xstrtol (EXTRA_DIST): Add xstrtol.h. * modules/xstrtold (EXTRA_DIST): Add xstrtod.c xstrtod.h. * modules/yesno (EXTRA_DIST): Add yesno.h. + * m4/argmatch.m4: New file, from coreutils with AC_LIBSOURCES removed. * m4/dev-ino.m4, same-inode.m4: Remove. + * m4/_inttypes_h.m4 (gl_INTTYPES_H): * m4/acl.m4 (AC_FUNC_ACL): * m4/backupfile.m4 (gl_BACKUPFILE): * m4/c-strtod.m4 (gl_C99_STRTOLD): * m4/canon-host.m4 (gl_CANON_HOST): * m4/canonicalize.m4 (AC_FUNC_CANONICALIZE_FILE_NAME): * m4/chdir-long.m4 (gl_FUNC_CHDIR_LONG): * m4/chdir-safer.m4 (gl_CHDIR_SAFER): * m4/cloexec.m4 (gl_CLOEXEC): * m4/close-stream.m4 (gl_CLOSE_STREAM): * m4/closeout.m4 (gl_CLOSEOUT): * m4/dirfd.m4 (gl_FUNC_DIRFD): * m4/dirname.m4 (gl_DIRNAME): * m4/exclude.m4 (gl_EXCLUDE): * m4/exitfail.m4 (gl_EXITFAIL): * m4/fcntl-safer.m4 (gl_FCNTL_SAFER): * m4/file-type.m4 (gl_FILE_TYPE): * m4/filemode.m4 (gl_FILEMODE): * m4/filenamecat.m4 (gl_FILE_NAME_CONCAT): * m4/fpending.m4 (gl_FUNC_FPENDING): * m4/fprintftime.m4 (gl_FPRINTFTIME): * m4/fts.m4 (gl_FUNC_FTS): * m4/getcwd.m4 (gl_FUNC_GETCWD_NULL): * m4/getdate.m4 (gl_GETDATE): * m4/gethrxtime.m4 (gl_GETHRXTIME): * m4/getpagesize.m4 (gl_GETPAGESIZE): * m4/getpass.m4 (gl_FUNC_GETPASS): * m4/gettime.m4 (gl_GETTIME): * m4/getugroups.m4 (gl_GETUGROUPS): * m4/glob.m4 (gl_GLOB_SUBSTITUTE): * m4/group-member.m4 (gl_FUNC_GROUP_MEMBER): * m4/hard-locale.m4 (gl_HARD_LOCALE): * m4/hash.m4 (gl_HASH): * m4/idcache.m4 (gl_IDCACHE): * m4/lchmod.m4 (gl_FUNC_LCHMOD): * m4/lchown.m4 (gl_FUNC_LCHOWN): * m4/long-options.m4 (gl_LONG_OPTIONS): * m4/lstat.m4 (gl_FUNC_LSTAT): * m4/md5.m4 (gl_MD5): * m4/memcasecmp.m4 (gl_MEMCASECMP): * m4/memcoll.m4 (gl_MEMCOLL): * m4/mempcpy.m4 (gl_FUNC_MEMPCPY): * m4/memrchr.m4 (gl_FUNC_MEMRCHR): * m4/memxor.m4 (gl_MEMXOR): * m4/mkancesdirs.m4 (gl_MKANCESDIRS): * m4/mkdir-p.m4 (gl_MKDIR_PARENTS): * m4/modechange.m4 (gl_MODECHANGE): * m4/mountlist.m4 (gl_MOUNTLIST): * m4/nanosleep.m4 (gl_FUNC_NANOSLEEP): * m4/openat.m4 (gl_FUNC_OPENAT): * m4/pathmax.m4 (gl_PATHMAX): * m4/physmem.m4 (gl_PHYSMEM): * m4/posixtm.m4 (gl_POSIXTM): * m4/posixver.m4 (gl_POSIXVER): * m4/quote.m4 (gl_QUOTE): * m4/quotearg.m4 (gl_QUOTEARG): * m4/readtokens.m4 (gl_READTOKENS): * m4/readutmp.m4 (gl_READUTMP): * m4/regex.m4 (gl_REGEX): * m4/safe-read.m4 (gl_SAFE_READ): * m4/safe-write.m4 (gl_SAFE_WRITE): * m4/same.m4 (gl_SAME): * m4/save-cwd.m4 (gl_SAVE_CWD): * m4/savedir.m4 (gl_SAVEDIR): * m4/settime.m4 (gl_SETTIME): * m4/sha1.m4 (gl_SHA1): * m4/sig2str.m4 (gl_FUNC_SIG2STR): * m4/stat-macros.m4 (gl_STAT_MACROS): * m4/stat-time.m4 (gl_STAT_TIME): * m4/stdio-safer.m4 (gl_FOPEN_SAFER): * m4/stdlib-safer.m4 (gl_STDLIB_SAFER): * m4/strdup.m4 (gl_FUNC_STRDUP): * m4/strftime.m4 (gl_FUNC_GNU_STRFTIME): * m4/strndup.m4 (gl_FUNC_STRNDUP): * m4/strnlen.m4 (gl_FUNC_STRNLEN): * m4/strverscmp.m4 (gl_FUNC_STRVERSCMP): * m4/time_r.m4 (gl_TIME_R): * m4/timespec.m4 (gl_TIMESPEC): * m4/unistd-safer.m4 (gl_UNISTD_SAFER): * m4/unlinkdir.m4 (gl_UNLINKDIR): * m4/unlocked-io.m4 (gl_FUNC_GLIBC_UNLOCKED_IO): * m4/userspec.m4 (gl_USERSPEC): * m4/utimecmp.m4 (gl_UTIMECMP): * m4/utimens.m4 (gl_UTIMENS): * m4/xalloc.m4 (gl_XALLOC): * m4/xgetcwd.m4 (gl_XGETCWD): * m4/xnanosleep.m4 (gl_XNANOSLEEP): * m4/xreadlink.m4 (gl_XREADLINK): * m4/xstrtod.m4 (gl_XSTRTOD): * m2/yesno.m4 (gl_YESNO): Don't use AC_LIBSOURCES; instead, rely on the files in ../modules/ to get the necessary .h files and whatnot.
* Update from coreutils.Paul Eggert2006-08-171-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * lib/__fpending.h: Add copyright notice. * lib/fprintftime.h: Likewise. * lib/savedir.c: Use (C) in copyright notice. * lib/savedir.h: Likewise. 2006-08-15 Jim Meyering <jim@meyering.net> * lib/at-func.c: New file, with the logic of all emulated at-functions. * lib/openat-priv.h: Include <errno.h> and define ENOSYS, in support of the EXPECTED_ERRNO macro. * lib/openat.c (fstatat, unlinkat, fchownat): Remove function definitions. Instead, define the appropriate symbols and include "at-func.c". * lib/mkdirat.c (mkdirat): Likewise. * lib/fchmodat.c (fchmodat): Likewise. (ENOSYS): Remove definition. * lib/openat.c: Don't include <errno.h>, now that "openat-priv.h" does it. Don't include "unistd--.h" -- it wasn't ever used. 2006-01-17 Jim Meyering <jim@meyering.net> Rewrite fts.c not to change the current working directory, by using openat, fstatat, fdopendir, etc.. * lib/fts.c [! _LIBC]: Include "openat.h" and "unistd--.h". (HAVE_OPENAT_SUPPORT): Define. [_LIBC] (fchdir): Don't undef or define; no longer used. (FCHDIR): Define in terms of cwd_advance_fd rather than fchdir. Now, this `function' always succeeds, and consumes its file descriptor parameter -- so callers must not close such FDs. Update callers. (diropen_fd, opendirat, cwd_advance_fd): New functions. (diropen): Add parameter, SP. Adjust all callers. Implement using diropen_fd, rather than open. (fts_open): Initialize new member, fts_cwd_fd. Remove fts_rft-setting code. (fts_close): Close fts_cwd_fd, if necessary. (__opendir2): Define in terms of opendir or opendirat, depending on whether the FST_NOCHDIR flag is set. (fts_build): Since fts_safe_changedir consumes its FD, and since this code must do `closedir(dirp)', dup the dirfd(dirp) argument, and close the dup'd file descriptor upon failure. (fts_stat): Use fstatat(...AT_SYMLINK_NOFOLLOW) in place of lstat. (fts_safe_changedir): Tweak semantics to reflect that this function now calls cwd_advance_fd and hence consumes its FD argument. * lib/fts_.h [struct FTS] (fts_cwd_fd): New member. [struct FTS] (fts_rft): Remove now-unused member. [struct FTS] (fts_cycle.state): Improve comment. * lib/openat.c (openat_needs_fchdir): New function. * lib/openat.h (openat_needs_fchdir): Declare it. 2006-08-15 Jim Meyering <jim@meyering.net> * m4/openat.m4 (gl_FUNC_OPENAT): Add at-func.c via AC_LIBSOURCES. 2006-01-17 Jim Meyering <jim@meyering.net> * m4/fts.m4 (gl_FUNC_FTS_CORE): Depend on gl_FUNC_OPENAT. 2006-01-11 Jim Meyering <jim@meyering.net> * m4/openat.m4 (gl_FUNC_OPENAT): Require and compile fchmodat.c. Check for the lchmod function.
* (Depends-on): Add fcntl-safer.Jim Meyering2005-08-241-1/+1
|
* * modules/fts (Files): Remove m4/inttypes-pri.m4.Paul Eggert2005-05-271-1/+0
| | | | | | | | | | * modules/fts-lgpl (Depends-on): Remove gettext. * lib/fts.c: Don't worry about debugging on pre-C99-comopatible hosts; the configuration hassle isn't worth it. Include inttypes.h and stdint.h unconditionally if FTS_DEBUG. (LONGEST_MODIFIER, PRIuMAX): Remove. * m4/fts.m4 (gl_FUNC_FTS_CORE): Don't check for inttypes.h or stdint.h, and don't require gt_INTTYPES_PRI.
* (Files): Add m4/inttypes-pri.m4.Jim Meyering2005-05-211-3/+4
| | | | (Depends-on): Add lstat and remove gettext. Alphabetize.
* New fts module.Paul Eggert2005-05-201-0/+30
* MODULES.html.sh (File system functions): Add fts, fts-lgpl. * lib/fts.c: Don't include "cycle-check.h" or "hash.h". (setup_dir, free_dir): New functions. (enter_dir, leave_dir): Define trivial alternatives of _LGPL_PACKAGE. Move to fts-cycle.c if !_LGPL_PACKAGE. (HT_INITIAL_SIZE, ENTER_DIR): Remove. All uses removed. (LEAVE_DIR): Fix typo: pass Fts and Ent to leave_dir. (struct Active_dir, AD_compare, AD_hash, enter_dir, leave_dir): Move to fts-cycle.c. (fts_open): Use setup_dir. (fts_close): Use free_dir. (fts_read): Have just one copy of the ENTER_DIR code rather than three. This adds a label and some gotos, but the alternatives were messier. Check for memory allocation failure when entering a dir. (fts_stat) [_LGPL_PACKAGE]: Bring back glibc cycle detection code. * lib/fts_.h (_LGPL_PACKAGE) [defined _LIBC]: New macro. (FTS): New member fts_cycle, that is a union that contains the old active_dir_ht and cycle_state. All uses changed to mention fts_cycle.ht and fts_cycle.state. * lib/fts-cycle.c: New file, containing GPL'ed code migrated out of fts.c, with the following changes: (setup_dir, free_dir): New functions. (enter_dir): Now returns bool. Return true if successful, false if memory exhausted. All callers changed. Do not bother partly cleaning up on memory allocation failure; that is free_dir's job. However, free ad if hash_insert fails, to avoid memory leak. (enter_dir, leave_dir): Accommodate change to FTS by inspecting fts->fts_options to see which union member to use. * m4/fts.m4 (gl_FUNC_FTS_CORE): Renamed from gl_FUNC_FTS. (gl_FUNC_FTS, gl_FUNC_FTS_LGPL): New macros. * lib/unlinkdir.h (cannot_unlink_dir) [UNLINK_CANNOT_UNLINK_DIR]: Now a macro, to pacify GCC.