[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 325bf19: Merge from gnulib
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] master 325bf19: Merge from gnulib |
Date: |
Sun, 07 Jun 2015 01:38:35 +0000 |
branch: master
commit 325bf192ae281046834884b12705d6c522871b24
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>
Merge from gnulib
This incorporates:
2015-06-06 acl-permissions: pacify -Wsuggest-attribute=const
2015-06-05 stdio: Don't redefine gets when using C++
2015-06-05 acl-permissions: port to AIX, C89 HP-UX
2015-06-02 file-has-acl: fix build on Mac OS X 10
2015-06-01 gnulib-tool: concatenate lib_SOURCES to a single line
2015-06-01 pthread_sigmask: discount system version if a simple macro
2015-05-31 readlinkat: avoid OS X 10.10 trailing slash bug
* doc/misc/texinfo.tex, lib/acl-internal.h, lib/get-permissions.c:
* lib/readlinkat.c, lib/set-permissions.c, lib/stdio.in.h:
* m4/acl.m4, m4/pthread_sigmask.m4, m4/readlinkat.m4: Copy from gnulib.
* lib/gnulib.mk: Regenerate.
---
doc/misc/texinfo.tex | 5 ++-
lib/acl-internal.h | 6 +++-
lib/get-permissions.c | 93 ++++++++++++++++++++++++++-----------------------
lib/gnulib.mk | 3 +-
lib/readlinkat.c | 18 +++++++++
lib/set-permissions.c | 2 +-
lib/stdio.in.h | 3 +-
m4/acl.m4 | 24 ++++++++++---
m4/pthread_sigmask.m4 | 26 +++++++++++++-
m4/readlinkat.m4 | 18 +++++++--
10 files changed, 136 insertions(+), 62 deletions(-)
diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex
index 4b48564..1a4741d 100644
--- a/doc/misc/texinfo.tex
+++ b/doc/misc/texinfo.tex
@@ -3,7 +3,7 @@
% Load plain if necessary, i.e., if running under initex.
\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
%
-\def\texinfoversion{2015-05-26.15}
+\def\texinfoversion{2015-06-01.15}
%
% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -304,6 +304,7 @@
% Avoid "undefined control sequence" errors.
\def\lastchapterdefs{}
\def\lastsectiondefs{}
+\def\lastsection{}
\def\prevchapterdefs{}
\def\prevsectiondefs{}
\def\lastcolordefs{}
@@ -7607,7 +7608,7 @@ end
address@hidden@}%
% This macro is expanded during the Texinfo macro expansion, not during its
-% definition. It gets all the arguments values and assigns them to macros
+% definition. It gets all the arguments' values and assigns them to macros
% macarg.ARGNAME
%
% #1 is the macro name
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
index 11fdea1..d592a75 100644
--- a/lib/acl-internal.h
+++ b/lib/acl-internal.h
@@ -289,6 +289,10 @@ struct permission_context {
int get_permissions (const char *, int, mode_t, struct permission_context *);
int set_permissions (struct permission_context *, const char *, int);
-void free_permission_context (struct permission_context *);
+void free_permission_context (struct permission_context *)
+#if ! (defined USE_ACL && (HAVE_ACL_GET_FILE || defined GETACL))
+ _GL_ATTRIBUTE_CONST
+#endif
+ ;
_GL_INLINE_HEADER_END
diff --git a/lib/get-permissions.c b/lib/get-permissions.c
index ccee1f1..6c6618d 100644
--- a/lib/get-permissions.c
+++ b/lib/get-permissions.c
@@ -33,7 +33,7 @@ int
get_permissions (const char *name, int desc, mode_t mode,
struct permission_context *ctx)
{
- memset (ctx, 0, sizeof(*ctx));
+ memset (ctx, 0, sizeof *ctx);
ctx->mode = mode;
#if USE_ACL && HAVE_ACL_GET_FILE
@@ -215,38 +215,40 @@ get_permissions (const char *name, int desc, mode_t mode,
#elif USE_ACL && HAVE_GETACL /* HP-UX */
- int ret;
-
- if (desc != -1)
- ret = fgetacl (desc, NACLENTRIES, ctx->entries);
- else
- ret = getacl (name, NACLENTRIES, ctx->entries);
- if (ret < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
- ret = 0;
- else
- return -1;
- }
- else if (ret > NACLENTRIES)
- /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- ctx->count = ret;
+ {
+ int ret;
+
+ if (desc != -1)
+ ret = fgetacl (desc, NACLENTRIES, ctx->entries);
+ else
+ ret = getacl (name, NACLENTRIES, ctx->entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP)
+ ret = 0;
+ else
+ return -1;
+ }
+ else if (ret > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ ctx->count = ret;
# if HAVE_ACLV_H
- ret = acl ((char *) name, ACL_GET, NACLVENTRIES, ctx->aclv_entries);
- if (ret < 0)
- {
- if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
- ret = 0;
- else
- return -2;
- }
- else if (ret > NACLVENTRIES)
- /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation. */
+ ret = acl ((char *) name, ACL_GET, NACLVENTRIES, ctx->aclv_entries);
+ if (ret < 0)
+ {
+ if (errno == ENOSYS || errno == EOPNOTSUPP || errno == EINVAL)
+ ret = 0;
+ else
+ return -2;
+ }
+ else if (ret > NACLVENTRIES)
+ /* If NACLVENTRIES cannot be trusted, use dynamic memory allocation. */
abort ();
- ctx->aclv_count = ret;
+ ctx->aclv_count = ret;
# endif
+ }
#elif USE_ACL && HAVE_ACLX_GET && ACL_AIX_WIP /* AIX */
@@ -254,24 +256,27 @@ get_permissions (const char *name, int desc, mode_t mode,
#elif USE_ACL && HAVE_STATACL /* older AIX */
- if (desc != -1)
- ret = fstatacl (desc, STX_NORMAL, &ctx->u.a, sizeof (ctx->u));
- else
- ret = statacl (name, STX_NORMAL, &ctx->u.a, sizeof (ctx->u));
- if (ret == 0)
- ctx->have_u = true;
+ {
+ int ret;
+ if (desc != -1)
+ ret = fstatacl (desc, STX_NORMAL, &ctx->u.a, sizeof ctx->u);
+ else
+ ret = statacl ((char *) name, STX_NORMAL, &ctx->u.a, sizeof ctx->u);
+ if (ret == 0)
+ ctx->have_u = true;
+ }
#elif USE_ACL && HAVE_ACLSORT /* NonStop Kernel */
- int ret;
-
- ret = acl ((char *) name, ACL_GET, NACLENTRIES, ctx->entries);
- if (ret < 0)
- return -1;
- else if (ret > NACLENTRIES)
- /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
- abort ();
- ctx->count = ret;
+ {
+ int ret = acl ((char *) name, ACL_GET, NACLENTRIES, ctx->entries);
+ if (ret < 0)
+ return -1;
+ else if (ret > NACLENTRIES)
+ /* If NACLENTRIES cannot be trusted, use dynamic memory allocation. */
+ abort ();
+ ctx->count = ret;
+ }
#endif
diff --git a/lib/gnulib.mk b/lib/gnulib.mk
index 95f2f8b..2dd0ef8 100644
--- a/lib/gnulib.mk
+++ b/lib/gnulib.mk
@@ -44,8 +44,7 @@ HAVE_INCLUDE_NEXT = (__GNUC__ || 60000000 <= __DECC_VER)
## begin gnulib module acl-permissions
-libgnu_a_SOURCES += acl-errno-valid.c acl-internal.c \
- get-permissions.c set-permissions.c
+libgnu_a_SOURCES += acl-errno-valid.c acl-internal.c get-permissions.c
set-permissions.c
EXTRA_DIST += acl-internal.h acl.h acl_entries.c
diff --git a/lib/readlinkat.c b/lib/readlinkat.c
index f4826f9..c91cf0e 100644
--- a/lib/readlinkat.c
+++ b/lib/readlinkat.c
@@ -18,7 +18,10 @@
#include <config.h>
+#include <errno.h>
#include <unistd.h>
+#include <string.h>
+#include <sys/stat.h>
#if HAVE_READLINKAT
@@ -27,6 +30,21 @@
ssize_t
rpl_readlinkat (int fd, char const *file, char *buf, size_t len)
{
+# if READLINK_TRAILING_SLASH_BUG
+ size_t file_len = strlen (file);
+ if (file_len && file[file_len - 1] == '/')
+ {
+ /* Even if FILE without the slash is a symlink to a directory,
+ both lstat() and stat() must resolve the trailing slash to
+ the directory rather than the symlink. We can therefore
+ safely use stat() to distinguish between EINVAL and
+ ENOTDIR/ENOENT, avoiding extra overhead of rpl_lstat(). */
+ struct stat st;
+ if (stat (file, &st) == 0)
+ errno = EINVAL;
+ return -1;
+ }
+# endif /* READLINK_TRAILING_SLASH_BUG */
return readlinkat (fd, file, buf, len);
}
diff --git a/lib/set-permissions.c b/lib/set-permissions.c
index ba291f3..2236879 100644
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -699,7 +699,7 @@ set_acls (struct permission_context *ctx, const char *name,
int desc,
if (desc != -1)
ret = fchacl (desc, &ctx->u.a, ctx->u.a.acl_len);
else
- ret = chacl (name, &ctx->u.a, ctx->u.a.acl_len);
+ ret = chacl ((char *) name, &ctx->u.a, ctx->u.a.acl_len);
if (ret < 0)
{
if (errno == ENOSYS && from_mode)
diff --git a/lib/stdio.in.h b/lib/stdio.in.h
index 759c94d..ec43874 100644
--- a/lib/stdio.in.h
+++ b/lib/stdio.in.h
@@ -723,11 +723,10 @@ _GL_WARN_ON_USE (getline, "getline is unportable - "
so any use of gets warrants an unconditional warning; besides, C11
removed it. */
#undef gets
-#if HAVE_RAW_DECL_GETS
+#if HAVE_RAW_DECL_GETS && !defined __cplusplus
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
#endif
-
#if @GNULIB_OBSTACK_PRINTF@ || @GNULIB_OBSTACK_PRINTF_POSIX@
struct obstack;
/* Grow an obstack with formatted output. Return the number of
diff --git a/m4/acl.m4 b/m4/acl.m4
index 5da6a43..75fc9ce 100644
--- a/m4/acl.m4
+++ b/m4/acl.m4
@@ -1,5 +1,5 @@
# acl.m4 - check for access control list (ACL) primitives
-# serial 20
+# serial 21
# Copyright (C) 2002, 2004-2015 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -181,12 +181,26 @@ AC_DEFUN([gl_FILE_HAS_ACL],
[
AC_REQUIRE([gl_FUNC_ACL_ARG])
if test "$enable_acl" != no; then
- AC_CHECK_HEADERS([linux/xattr.h])
- AC_CHECK_HEADERS([sys/xattr.h],
- [AC_CHECK_FUNCS([getxattr])])
+ AC_CACHE_CHECK([for getxattr with XATTR_NAME_POSIX_ACL macros],
+ [gl_cv_getxattr_with_posix_acls],
+ [gl_cv_getxattr_with_posix_acls=no
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <sys/types.h>
+ #include <sys/xattr.h>
+ #include <linux/xattr.h>
+ ]],
+ [[ssize_t a = getxattr (".", XATTR_NAME_POSIX_ACL_ACCESS, 0, 0);
+ ssize_t b = getxattr (".", XATTR_NAME_POSIX_ACL_DEFAULT, 0, 0);
+ return a < 0 || b < 0;
+ ]])],
+ [gl_cv_getxattr_with_posix_acls=yes])])
fi
- if test "$ac_cv_header_sys_xattr_h,$ac_cv_func_getxattr" = yes,yes; then
+ if test "$gl_cv_getxattr_with_posix_acls" = yes; then
LIB_HAS_ACL=
+ AC_DEFINE([GETXATTR_WITH_POSIX_ACLS], 1,
+ [Define to 1 if getxattr works with XATTR_NAME_POSIX_ACL_ACCESS
+ and XATTR_NAME_POSIX_ACL_DEFAULT.])
else
dnl Set gl_need_lib_has_acl to a nonempty value, so that any
dnl later gl_FUNC_ACL call will set LIB_HAS_ACL=$LIB_ACL.
diff --git a/m4/pthread_sigmask.m4 b/m4/pthread_sigmask.m4
index 5c17dfc..2598856 100644
--- a/m4/pthread_sigmask.m4
+++ b/m4/pthread_sigmask.m4
@@ -1,4 +1,4 @@
-# pthread_sigmask.m4 serial 15
+# pthread_sigmask.m4 serial 16
dnl Copyright (C) 2011-2015 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
@@ -40,6 +40,30 @@ AC_DEFUN([gl_FUNC_PTHREAD_SIGMASK],
LIBS="$gl_save_LIBS"
])
if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
+ AC_CACHE_CHECK([whether pthread_sigmask is only a macro],
+ [gl_cv_func_pthread_sigmask_is_macro],
+ [gl_save_LIBS="$LIBS"
+ LIBS="$LIBS $LIBMULTITHREAD"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [[#include <pthread.h>
+ #include <signal.h>
+ #undef pthread_sigmask
+ ]],
+ [[return pthread_sigmask (0, (sigset_t *) 0, (sigset_t *)
0);]])
+ ],
+ [gl_cv_func_pthread_sigmask_is_macro=no],
+ [gl_cv_func_pthread_sigmask_is_macro=yes])
+ LIBS="$gl_save_LIBS"
+ ])
+ if test $gl_cv_func_pthread_sigmask_is_macro = yes; then
+ dnl On MinGW pthread_sigmask is just a macro which always
returns 0.
+ dnl It does not exist as a real function, which is required by
POSIX.
+ REPLACE_PTHREAD_SIGMASK=1
+ gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD=no
+ fi
+ fi
+ if test $gl_cv_func_pthread_sigmask_in_LIBMULTITHREAD = yes; then
dnl pthread_sigmask is available with -pthread or -lpthread.
LIB_PTHREAD_SIGMASK="$LIBMULTITHREAD"
else
diff --git a/m4/readlinkat.m4 b/m4/readlinkat.m4
index d0f5e69..3477602 100644
--- a/m4/readlinkat.m4
+++ b/m4/readlinkat.m4
@@ -1,4 +1,4 @@
-# serial 4
+# serial 5
# See if we need to provide readlinkat replacement.
dnl Copyright (C) 2009-2015 Free Software Foundation, Inc.
@@ -13,6 +13,7 @@ AC_DEFUN([gl_FUNC_READLINKAT],
AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
AC_CHECK_FUNCS_ONCE([readlinkat])
+ AC_REQUIRE([gl_FUNC_READLINK])
if test $ac_cv_func_readlinkat = no; then
HAVE_READLINKAT=0
else
@@ -25,8 +26,17 @@ AC_DEFUN([gl_FUNC_READLINKAT],
ssize_t readlinkat (int, char const *, char *, size_t);]])],
[gl_cv_decl_readlinkat_works=yes],
[gl_cv_decl_readlinkat_works=no])])
- if test "$gl_cv_decl_readlink_works" != yes; then
- REPLACE_READLINKAT=1
- fi
+ # Assume readinkat has the same trailing slash bug as readlink,
+ # as is the case on Mac Os X 10.10
+ case "$gl_cv_func_readlink_works" in
+ *yes)
+ if test "$gl_cv_decl_readlinkat_works" != yes; then
+ REPLACE_READLINKAT=1
+ fi
+ ;;
+ *)
+ REPLACE_READLINKAT=1
+ ;;
+ esac
fi
])
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 325bf19: Merge from gnulib,
Paul Eggert <=