summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-04-30 00:38:28 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-04-30 00:40:33 -0700
commit7e4dae99d619315179a90461b42ae8d734c5bb45 (patch)
tree98a34f046bd50c1a38bf19cb96e5e0fb77ecf441 /lib
parenta3f3fea14abbc59a2b47cae5bec6252ec3a1f8cf (diff)
downloademacs-7e4dae99d619315179a90461b42ae8d734c5bb45.tar.gz
Merge from gnulib
This avoids incorporating the following, which I suspect are more trouble for Emacs than they’re worth: 2017-04-29 stat, fstat: fix time_t etc. on native Windows platforms * admin/merge-gnulib (AVOIDED_MODULES): Avoid stat, too. * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate. * lib/pathmax.h, lib/stat.c, m4/pathmax.m4, m4/stat.m4: Remove.
Diffstat (limited to 'lib')
-rw-r--r--lib/gnulib.mk.in28
-rw-r--r--lib/pathmax.h83
-rw-r--r--lib/stat.c138
3 files changed, 1 insertions, 248 deletions
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 4a76f0a5aed..af26648c0e0 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -21,7 +21,7 @@
# the same distribution terms as the rest of that program.
#
# Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings
+# Reproduce by: gnulib-tool --import --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=close --avoid=dup --avoid=fchdir --avoid=fstat --avoid=malloc-posix --avoid=msvc-inval --avoid=msvc-nothrow --avoid=open --avoid=openat-die --avoid=opendir --avoid=raise --avoid=save-cwd --avoid=select --avoid=setenv --avoid=sigprocmask --avoid=stat --avoid=stdarg --avoid=stdbool --avoid=threadlib --avoid=unsetenv --gnu-make --makefile-name=gnulib.mk.in --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt binary-io byteswap c-ctype c-strcase careadlinkat close-stream count-leading-zeros count-one-bits count-trailing-zeros crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo faccessat fcntl fcntl-h fdatasync fdopendir filemode filevercmp flexmember fstatat fsync getloadavg getopt-gnu gettime gettimeofday gitlog-to-changelog ignore-value intprops largefile lstat manywarnings memrchr mkostemp mktime pipe2 pselect pthread_sigmask putenv qcopy-acl readlink readlinkat sig2str socklen stat-time std-gnu11 stdalign stddef stdio stpcpy strftime strtoimax strtoumax symlink sys_stat sys_time time time_r time_rz timegm timer-time timespec-add timespec-sub update-copyright utimens vla warnings
MOSTLYCLEANFILES += core *.stackdump
@@ -885,9 +885,7 @@ gl_GNULIB_ENABLED_dosname = @gl_GNULIB_ENABLED_dosname@
gl_GNULIB_ENABLED_euidaccess = @gl_GNULIB_ENABLED_euidaccess@
gl_GNULIB_ENABLED_getdtablesize = @gl_GNULIB_ENABLED_getdtablesize@
gl_GNULIB_ENABLED_getgroups = @gl_GNULIB_ENABLED_getgroups@
-gl_GNULIB_ENABLED_pathmax = @gl_GNULIB_ENABLED_pathmax@
gl_GNULIB_ENABLED_secure_getenv = @gl_GNULIB_ENABLED_secure_getenv@
-gl_GNULIB_ENABLED_stat = @gl_GNULIB_ENABLED_stat@
gl_GNULIB_ENABLED_strtoll = @gl_GNULIB_ENABLED_strtoll@
gl_GNULIB_ENABLED_strtoull = @gl_GNULIB_ENABLED_strtoull@
gl_GNULIB_ENABLED_tempname = @gl_GNULIB_ENABLED_tempname@
@@ -1765,17 +1763,6 @@ EXTRA_DIST += openat.h
endif
## end gnulib module openat-h
-## begin gnulib module pathmax
-ifeq (,$(OMIT_GNULIB_MODULE_pathmax))
-
-ifneq (,$(gl_GNULIB_ENABLED_pathmax))
-
-endif
-EXTRA_DIST += pathmax.h
-
-endif
-## end gnulib module pathmax
-
## begin gnulib module pipe2
ifeq (,$(OMIT_GNULIB_MODULE_pipe2))
@@ -1982,19 +1969,6 @@ EXTRA_DIST += warn-on-use.h
endif
## end gnulib module snippet/warn-on-use
-## begin gnulib module stat
-ifeq (,$(OMIT_GNULIB_MODULE_stat))
-
-ifneq (,$(gl_GNULIB_ENABLED_stat))
-
-endif
-EXTRA_DIST += stat.c
-
-EXTRA_libgnu_a_SOURCES += stat.c
-
-endif
-## end gnulib module stat
-
## begin gnulib module stat-time
ifeq (,$(OMIT_GNULIB_MODULE_stat-time))
diff --git a/lib/pathmax.h b/lib/pathmax.h
deleted file mode 100644
index aa0730e27a8..00000000000
--- a/lib/pathmax.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Define PATH_MAX somehow. Requires sys/types.h.
- Copyright (C) 1992, 1999, 2001, 2003, 2005, 2009-2017 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, see <http://www.gnu.org/licenses/>. */
-
-#ifndef _PATHMAX_H
-# define _PATHMAX_H
-
-/* POSIX:2008 defines PATH_MAX to be the maximum number of bytes in a filename,
- including the terminating NUL byte.
- <http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html>
- PATH_MAX is not defined on systems which have no limit on filename length,
- such as GNU/Hurd.
-
- This file does *not* define PATH_MAX always. Programs that use this file
- can handle the GNU/Hurd case in several ways:
- - Either with a package-wide handling, or with a per-file handling,
- - Either through a
- #ifdef PATH_MAX
- or through a fallback like
- #ifndef PATH_MAX
- # define PATH_MAX 8192
- #endif
- or through a fallback like
- #ifndef PATH_MAX
- # define PATH_MAX pathconf ("/", _PC_PATH_MAX)
- #endif
- */
-
-# include <unistd.h>
-
-# include <limits.h>
-
-# ifndef _POSIX_PATH_MAX
-# define _POSIX_PATH_MAX 256
-# endif
-
-/* Don't include sys/param.h if it already has been. */
-# if defined HAVE_SYS_PARAM_H && !defined PATH_MAX && !defined MAXPATHLEN
-# include <sys/param.h>
-# endif
-
-# if !defined PATH_MAX && defined MAXPATHLEN
-# define PATH_MAX MAXPATHLEN
-# endif
-
-# ifdef __hpux
-/* On HP-UX, PATH_MAX designates the maximum number of bytes in a filename,
- *not* including the terminating NUL byte, and is set to 1023.
- Additionally, when _XOPEN_SOURCE is defined to 500 or more, PATH_MAX is
- not defined at all any more. */
-# undef PATH_MAX
-# define PATH_MAX 1024
-# endif
-
-# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-/* The page "Naming Files, Paths, and Namespaces" on msdn.microsoft.com,
- section "Maximum Path Length Limitation",
- <http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#maxpath>
- explains that the maximum size of a filename, including the terminating
- NUL byte, is 260 = 3 + 256 + 1.
- This is the same value as
- - FILENAME_MAX in <stdio.h>,
- - _MAX_PATH in <stdlib.h>,
- - MAX_PATH in <windef.h>.
- Undefine the original value, because mingw's <limits.h> gets it wrong. */
-# undef PATH_MAX
-# define PATH_MAX 260
-# endif
-
-#endif /* _PATHMAX_H */
diff --git a/lib/stat.c b/lib/stat.c
deleted file mode 100644
index 7e7c2f6f887..00000000000
--- a/lib/stat.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/* Work around platform bugs in stat.
- Copyright (C) 2009-2017 Free Software Foundation, Inc.
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 3 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>. */
-
-/* written by Eric Blake */
-
-/* If the user's config.h happens to include <sys/stat.h>, let it include only
- the system's <sys/stat.h> here, so that orig_stat doesn't recurse to
- rpl_stat. */
-#define __need_system_sys_stat_h
-#include <config.h>
-
-/* Get the original definition of stat. It might be defined as a macro. */
-#include <sys/types.h>
-#include <sys/stat.h>
-#undef __need_system_sys_stat_h
-
-#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
-# if _GL_WINDOWS_64_BIT_ST_SIZE
-# undef stat /* avoid warning on mingw64 with _FILE_OFFSET_BITS=64 */
-# define stat _stati64
-# define REPLACE_FUNC_STAT_DIR 1
-# undef REPLACE_FUNC_STAT_FILE
-# elif REPLACE_FUNC_STAT_FILE
-/* mingw64 has a broken stat() function, based on _stat(), in libmingwex.a.
- Bypass it. */
-# define stat _stat
-# define REPLACE_FUNC_STAT_DIR 1
-# undef REPLACE_FUNC_STAT_FILE
-# endif
-#endif
-
-static int
-orig_stat (const char *filename, struct stat *buf)
-{
- return stat (filename, buf);
-}
-
-/* Specification. */
-/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
- eliminates this include because of the preliminary #include <sys/stat.h>
- above. */
-#include "sys/stat.h"
-
-#include <errno.h>
-#include <limits.h>
-#include <stdbool.h>
-#include <string.h>
-#include "dosname.h"
-#include "verify.h"
-
-#if REPLACE_FUNC_STAT_DIR
-# include "pathmax.h"
- /* The only known systems where REPLACE_FUNC_STAT_DIR is needed also
- have a constant PATH_MAX. */
-# ifndef PATH_MAX
-# error "Please port this replacement to your platform"
-# endif
-#endif
-
-/* Store information about NAME into ST. Work around bugs with
- trailing slashes. Mingw has other bugs (such as st_ino always
- being 0 on success) which this wrapper does not work around. But
- at least this implementation provides the ability to emulate fchdir
- correctly. */
-
-int
-rpl_stat (char const *name, struct stat *st)
-{
- int result = orig_stat (name, st);
-#if REPLACE_FUNC_STAT_FILE
- /* Solaris 9 mistakenly succeeds when given a non-directory with a
- trailing slash. */
- if (result == 0 && !S_ISDIR (st->st_mode))
- {
- size_t len = strlen (name);
- if (ISSLASH (name[len - 1]))
- {
- errno = ENOTDIR;
- return -1;
- }
- }
-#endif /* REPLACE_FUNC_STAT_FILE */
-#if REPLACE_FUNC_STAT_DIR
-
- if (result == -1 && errno == ENOENT)
- {
- /* Due to mingw's oddities, there are some directories (like
- c:\) where stat() only succeeds with a trailing slash, and
- other directories (like c:\windows) where stat() only
- succeeds without a trailing slash. But we want the two to be
- synonymous, since chdir() manages either style. Likewise, Mingw also
- reports ENOENT for names longer than PATH_MAX, when we want
- ENAMETOOLONG, and for stat("file/"), when we want ENOTDIR.
- Fortunately, mingw PATH_MAX is small enough for stack
- allocation. */
- char fixed_name[PATH_MAX + 1] = {0};
- size_t len = strlen (name);
- bool check_dir = false;
- verify (PATH_MAX <= 4096);
- if (PATH_MAX <= len)
- errno = ENAMETOOLONG;
- else if (len)
- {
- strcpy (fixed_name, name);
- if (ISSLASH (fixed_name[len - 1]))
- {
- check_dir = true;
- while (len && ISSLASH (fixed_name[len - 1]))
- fixed_name[--len] = '\0';
- if (!len)
- fixed_name[0] = '/';
- }
- else
- fixed_name[len++] = '/';
- result = orig_stat (fixed_name, st);
- if (result == 0 && check_dir && !S_ISDIR (st->st_mode))
- {
- result = -1;
- errno = ENOTDIR;
- }
- }
- }
-#endif /* REPLACE_FUNC_STAT_DIR */
- return result;
-}