From 1323c13978b7280ddf034e8f527f48d17487b5a2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Sun, 5 Jul 2015 08:22:26 -0700 Subject: [PATCH] Merge from gnulib This incorporates: 2015-07-04 file-has-acl, acl-permissions: fix HP-UX typos 2015-07-03 set-permissions.c: adjust acl_from_mode's cpp guard 2015-07-02 update-copyright: fix test failure with perl >= 5.22 2015-07-01 gnulib-common.m4: change the ARFLAGS default to 'cr' 2015-07-01 acl: fix definition of acl_from_mode on FreeBSD * build-aux/update-copyright, doc/misc/texinfo.tex, lib/acl-internal.h: * lib/set-permissions.c, m4/gnulib-common.m4: Copy from gnulib. --- build-aux/update-copyright | 2 +- doc/misc/texinfo.tex | 58 ++++++++++++++++++++++++-------------- lib/acl-internal.h | 6 ++-- lib/set-permissions.c | 58 ++++++++++++++++++++------------------ m4/gnulib-common.m4 | 4 +-- 5 files changed, 72 insertions(+), 56 deletions(-) diff --git a/build-aux/update-copyright b/build-aux/update-copyright index 4eb4b93ea6..8cc36e22d5 100755 --- a/build-aux/update-copyright +++ b/build-aux/update-copyright @@ -124,7 +124,7 @@ use strict; use warnings; my $copyright_re = 'Copyright'; -my $circle_c_re = '(?:\([cC]\)|@copyright{}|\\\\\(co|©)'; +my $circle_c_re = '(?:\([cC]\)|@copyright\{}|\\\\\(co|©)'; my $holder = $ENV{UPDATE_COPYRIGHT_HOLDER}; $holder ||= 'Free Software Foundation, Inc.'; my $prefix_max = 5; diff --git a/doc/misc/texinfo.tex b/doc/misc/texinfo.tex index 60951102f3..f773c90b8d 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-06-14.15} +\def\texinfoversion{2015-07-01.07} % % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, @@ -277,6 +277,7 @@ % described on page 260 of The TeXbook. It involves outputting two % marks for the sectioning macros, one before the section break, and % one after. I won't pretend I can describe this better than DEK... +% \def\domark{% \toks0=\expandafter{\lastchapterdefs}% \toks2=\expandafter{\lastsectiondefs}% @@ -6881,7 +6882,7 @@ end % typesetting commands (@smallbook, font changes, etc.) have to be done % beforehand -- and a) we want @copying to be done first in the source % file; b) letting users define the frontmatter in as flexible order as -% possible is very desirable. +% possible is desirable. % \def\copying{\checkenv{}\begingroup\scanargctxt\docopying} \def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} @@ -7449,6 +7450,12 @@ end % % \anythingelse will almost certainly be an error of some kind. +\def\macrolineargctxt{% used for whole-line arguments without braces + \scanctxt + \catcode`\{=\other + \catcode`\}=\other +} + % \mbodybackslash is the definition of \ in @macro bodies. % It maps \foo\ => \csname macarg.foo\endcsname => #N % where N is the macro parameter number. @@ -7522,12 +7529,14 @@ end % This makes use of the obscure feature that if the last token of a % is #, then the preceding argument is delimited by % an opening brace, and that opening brace is not consumed. +% \def\getargs#1{\getargsxxx#1{}} \def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} \def\getmacname#1 #2\relax{\macname={#1}} \def\getmacargs#1{\def\argl{#1}} -% For macro processing make @ a letter so that we can make Texinfo private macro names. +% For macro processing make @ a letter so that we can make +% private-to-Texinfo macro names. \edef\texiatcatcode{\the\catcode`\@} \catcode `@=11\relax @@ -7558,6 +7567,7 @@ end % % If you compile with TeX (not eTeX), and you have macros with 10 or more % arguments, no macro can have more than 256 arguments (else error). +% \def\parsemargdef#1;{% \paramno=0\def\paramlist{}% \let\hash\relax @@ -7601,7 +7611,6 @@ end % These two commands read recursive and nonrecursive macro bodies. % (They're different since rec and nonrec macros end differently.) % - \catcode `\@\texiatcatcode \long\def\parsemacbody#1@end macro% {\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% @@ -7637,7 +7646,8 @@ end \fi } -% +% Internal for \getargsval@. +% \def\getargvals@@{% \ifx\paramlist\nilm@ % Some sanity check needed here that \argvaluelist is also empty. @@ -7681,7 +7691,8 @@ end } % Replace arguments by their values in the macro body, and place the result -% in macro \@tempa +% in macro \@tempa. +% \def\macvalstoargs@{% % To do this we use the property that token registers that are \the'ed % within an \edef expand only once. So we are going to place all argument @@ -7705,8 +7716,9 @@ end \expandafter\def\expandafter\@tempa\expandafter{\@tempc}% } +% Define the named-macro outside of this group and then close this group. +% \def\macargexpandinbody@{% - %% Define the named-macro outside of this group and then close this group. \expandafter \endgroup \macargdeflist@ @@ -7743,14 +7755,17 @@ end \next } -% Save the token stack pointer into macro #1 +% Save the token stack pointer into macro #1: \def\texisavetoksstackpoint#1{\edef#1{\the\@cclvi}} -% Restore the token stack pointer from number in macro #1 -\def\texirestoretoksstackpoint#1{\expandafter\mathchardef\expandafter\@cclvi#1\relax} -% newtoks that can be used non \outer . +% +% Restore the token stack pointer from number in macro #1: +\def\texirestoretoksstackpoint#1{\expandafter\mathchardef + \expandafter\@cclvi#1\relax} +% Variant \newtoks that can be used non-\outer: \def\texinonouternewtoks{\alloc@ 5\toks \toksdef \@cclvi} -% Tailing missing arguments are set to empty +% Tailing missing arguments are set to empty. +% \def\setemptyargvalues@{% \ifx\paramlist\nilm@ \let\next\macargexpandinbody@ @@ -7795,7 +7810,7 @@ end \noexpand\scanmacro{\temp}}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt + \bgroup \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% @@ -7828,7 +7843,7 @@ end \noexpand\scanmacro{\temp}\egroup}% \or % 1 \expandafter\xdef\csname\the\macname\endcsname{% - \bgroup\noexpand\macroargctxt + \bgroup \noexpand\braceorline \expandafter\noexpand\csname\the\macname xxx\endcsname}% \expandafter\xdef\csname\the\macname xxx\endcsname##1{% @@ -7860,19 +7875,20 @@ end \fi \fi} -\catcode `\@\texiatcatcode\relax +\catcode `\@\texiatcatcode\relax % end private-to-Texinfo catcodes \def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} -% \braceorline decides whether the next nonwhitespace character is a -% {. If so it reads up to the closing }, if not, it reads the whole -% line. Whatever was read is then fed to the next control sequence -% as an argument (by \parsebrace or \parsearg). +% \braceorline MAC is used for a one-argument macro MAC. It checks +% whether the next non-whitespace character is a {. It sets the context +% for reading the argument (slightly different in the two cases). Then, +% to read the argument, in the whole-line case, it then calls the +% regular \parsearg MAC; in the lbrace case, it just calls MAC itself. % \def\braceorline#1{\let\macnamexxx=#1\futurelet\nchar\braceorlinexxx} \def\braceorlinexxx{% - \ifx\nchar\bgroup\else - \expandafter\parsearg + \ifx\nchar\bgroup\macroargctxt + \else\macrolineargctxt\expandafter\parsearg \fi \macnamexxx} diff --git a/lib/acl-internal.h b/lib/acl-internal.h index d592a7559f..4f042adc96 100644 --- a/lib/acl-internal.h +++ b/lib/acl-internal.h @@ -127,10 +127,8 @@ rpl_acl_set_fd (int fd, acl_t acl) # define acl_extended_file(name) (-1) # endif -/* Linux-specific */ -# ifndef HAVE_ACL_FROM_MODE -# define HAVE_ACL_FROM_MODE false -# define acl_from_mode(mode) (NULL) +# if ! defined HAVE_ACL_FROM_MODE && ! defined HAVE_ACL_FROM_TEXT +# define acl_from_mode (NULL) # endif /* Set to 0 if a file's mode is stored independently from the ACL. */ diff --git a/lib/set-permissions.c b/lib/set-permissions.c index 3bcfd31530..25c463d966 100644 --- a/lib/set-permissions.c +++ b/lib/set-permissions.c @@ -25,6 +25,8 @@ #if USE_ACL # if ! defined HAVE_ACL_FROM_MODE && defined HAVE_ACL_FROM_TEXT /* FreeBSD, IRIX, Tru64 */ +# if HAVE_ACL_GET_FILE && !HAVE_ACL_TYPE_EXTENDED + static acl_t acl_from_mode (mode_t mode) { @@ -46,6 +48,7 @@ acl_from_mode (mode_t mode) return acl_from_text (acl_text); } +# endif # endif # if HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */ @@ -269,7 +272,7 @@ set_acls_from_mode (const char *name, int desc, mode_t mode, bool *must_chmod) } } -#elif HAVE_GETACL /* HP-UX */ +# elif HAVE_GETACL /* HP-UX */ static int context_acl_from_mode (struct permission_context *ctx, const char *name, int desc) { @@ -285,13 +288,13 @@ context_acl_from_mode (struct permission_context *ctx, const char *name, int des ctx->entries[0].uid = statbuf.st_uid; ctx->entries[0].gid = ACL_NSGROUP; - ctx->entries[0].mode = (mode >> 6) & 7; + ctx->entries[0].mode = (ctx->mode >> 6) & 7; ctx->entries[1].uid = ACL_NSUSER; ctx->entries[1].gid = statbuf.st_gid; - ctx->entries[1].mode = (mode >> 3) & 7; + ctx->entries[1].mode = (ctx->mode >> 3) & 7; ctx->entries[2].uid = ACL_NSUSER; ctx->entries[2].gid = ACL_NSGROUP; - ctx->entries[2].mode = mode & 7; + ctx->entries[2].mode = ctx->mode & 7; ctx->count = 3; return 0; } @@ -304,24 +307,24 @@ context_aclv_from_mode (struct permission_context *ctx) ctx->aclv_entries[0].a_type = USER_OBJ; ctx->aclv_entries[0].a_id = 0; /* irrelevant */ - ctx->aclv_entries[0].a_perm = (mode >> 6) & 7; + ctx->aclv_entries[0].a_perm = (ctx->mode >> 6) & 7; ctx->aclv_entries[1].a_type = GROUP_OBJ; ctx->aclv_entries[1].a_id = 0; /* irrelevant */ - ctx->aclv_entries[1].a_perm = (mode >> 3) & 7; + ctx->aclv_entries[1].a_perm = (ctx->mode >> 3) & 7; ctx->aclv_entries[2].a_type = CLASS_OBJ; ctx->aclv_entries[2].a_id = 0; - ctx->aclv_entries[2].a_perm = (mode >> 3) & 7; + ctx->aclv_entries[2].a_perm = (ctx->mode >> 3) & 7; ctx->aclv_entries[3].a_type = OTHER_OBJ; ctx->aclv_entries[3].a_id = 0; - ctx->aclv_entries[3].a_perm = mode & 7; + ctx->aclv_entries[3].a_perm = ctx->mode & 7; ctx->aclv_count = 4; - ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries); + ret = aclsort (ctx->aclv_count, 1, ctx->aclv_entries); if (ret > 0) abort (); return ret; } -#endif +# endif # elif HAVE_ACLX_GET && defined ACL_AIX_WIP /* AIX */ static int @@ -458,19 +461,19 @@ context_acl_from_mode (struct permission_context *ctx) ctx->entries[0].a_type = USER_OBJ; ctx->entries[0].a_id = 0; /* irrelevant */ - ctx->entries[0].a_perm = (mode >> 6) & 7; + ctx->entries[0].a_perm = (ctx->mode >> 6) & 7; ctx->entries[1].a_type = GROUP_OBJ; ctx->entries[1].a_id = 0; /* irrelevant */ - ctx->entries[1].a_perm = (mode >> 3) & 7; + ctx->entries[1].a_perm = (ctx->mode >> 3) & 7; ctx->entries[2].a_type = CLASS_OBJ; ctx->entries[2].a_id = 0; - ctx->entries[2].a_perm = (mode >> 3) & 7; + ctx->entries[2].a_perm = (ctx->mode >> 3) & 7; ctx->entries[3].a_type = OTHER_OBJ; ctx->entries[3].a_id = 0; - ctx->entries[3].a_perm = mode & 7; + ctx->entries[3].a_perm = ctx->mode & 7; ctx->count = 4; - ret = aclsort (sizeof (entries) / sizeof (struct acl), 1, entries); + ret = aclsort (ctx->count, 1, entries); if (ret > 0) abort (); return ret; @@ -483,18 +486,18 @@ set_acls (struct permission_context *ctx, const char *name, int desc, { int ret = 0; -#if HAVE_ACL_GET_FILE +# if HAVE_ACL_GET_FILE /* POSIX 1003.1e (draft 17 -- abandoned) specific version. */ /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */ # if !HAVE_ACL_TYPE_EXTENDED /* Linux, FreeBSD, IRIX, Tru64 */ -# ifndef HAVE_ACL_FROM_TEXT -# error Must have acl_from_text (see POSIX 1003.1e draft 17). -# endif -# ifndef HAVE_ACL_DELETE_DEF_FILE -# error Must have acl_delete_def_file (see POSIX 1003.1e draft 17). -# endif +# ifndef HAVE_ACL_FROM_TEXT +# error Must have acl_from_text (see POSIX 1003.1e draft 17). +# endif +# ifndef HAVE_ACL_DELETE_DEF_FILE +# error Must have acl_delete_def_file (see POSIX 1003.1e draft 17). +# endif if (! ctx->acls_not_supported) { @@ -641,9 +644,9 @@ set_acls (struct permission_context *ctx, const char *name, int desc, else *acls_set = true; } -# endif +# endif -#elif HAVE_GETACL /* HP-UX */ +# elif HAVE_GETACL /* HP-UX */ if (from_mode) ret = context_acl_from_mode (ctx, name, desc); @@ -657,7 +660,7 @@ set_acls (struct permission_context *ctx, const char *name, int desc, if (ret < 0) { if ((errno == ENOSYS || errno == EOPNOTSUPP || errno == ENOTSUP) - && (from_mode || !acl_nontrivial (ctx->count, ctx->entries, &source_statbuf))) + && (from_mode || !acl_nontrivial (ctx->count, ctx->entries))) ret = 0; } else @@ -730,7 +733,7 @@ set_acls (struct permission_context *ctx, const char *name, int desc, /* Nothing to do. */ -#endif +# endif return ret; } @@ -801,10 +804,9 @@ set_permissions (struct permission_context *ctx, const char *name, int desc) int saved_errno = ret ? errno : 0; /* If we can't set an acl which we expect to be able to set, try setting - the permissions to ctx->mode. Doe to possible inherited permissions, + the permissions to ctx->mode. Due to possible inherited permissions, we cannot simply chmod. */ - acls_set = false; ret = set_acls (ctx, name, desc, true, &must_chmod, &acls_set); if (! acls_set) must_chmod = true; diff --git a/m4/gnulib-common.m4 b/m4/gnulib-common.m4 index b301abeda0..40e82f6e27 100644 --- a/m4/gnulib-common.m4 +++ b/m4/gnulib-common.m4 @@ -278,12 +278,12 @@ Amsterdam dnl but prefer ${host}-ar over ar (useful for cross-compiling). AC_CHECK_TOOL([AR], [ar], [ar]) if test -z "$ARFLAGS"; then - ARFLAGS='cru' + ARFLAGS='cr' fi fi else if test -z "$ARFLAGS"; then - ARFLAGS='cru' + ARFLAGS='cr' fi fi AC_SUBST([AR]) -- 2.39.2