Update from Gnulib by running admin/merge-gnulib
This commit is contained in:
parent
785095c416
commit
489563a166
4 changed files with 256 additions and 99 deletions
|
@ -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{2022-11-12.22}
|
||||
\def\texinfoversion{2022-12-19.22}
|
||||
%
|
||||
% Copyright 1985, 1986, 1988, 1990-2022 Free Software Foundation, Inc.
|
||||
%
|
||||
|
@ -591,6 +591,9 @@
|
|||
% @/ allows a line break.
|
||||
\let\/=\allowbreak
|
||||
|
||||
% @- allows explicit insertion of hyphenation points
|
||||
\def\-{\discretionary{\normaldash}{}{}}%
|
||||
|
||||
% @. is an end-of-sentence period.
|
||||
\def\.{.\spacefactor=\endofsentencespacefactor\space}
|
||||
|
||||
|
@ -1537,9 +1540,10 @@
|
|||
\next}
|
||||
\def\makelink{\addtokens{\toksB}%
|
||||
{\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
|
||||
\def\pdflink#1{%
|
||||
\def\pdflink#1{\pdflinkpage{#1}{#1}}%
|
||||
\def\pdflinkpage#1#2{%
|
||||
\startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}}
|
||||
\setcolor{\linkcolor}#1\endlink}
|
||||
\setcolor{\linkcolor}#2\endlink}
|
||||
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
|
||||
\else
|
||||
% non-pdf mode
|
||||
|
@ -1786,10 +1790,11 @@
|
|||
\next}
|
||||
\def\makelink{\addtokens{\toksB}%
|
||||
{\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0}
|
||||
\def\pdflink#1{%
|
||||
\def\pdflink#1{\pdflinkpage{#1}{#1}}%
|
||||
\def\pdflinkpage#1#2{%
|
||||
\special{pdf:bann << /Border [0 0 0]
|
||||
/Type /Annot /Subtype /Link /A << /S /GoTo /D (#1) >> >>}%
|
||||
\setcolor{\linkcolor}#1\endlink}
|
||||
\setcolor{\linkcolor}#2\endlink}
|
||||
\def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st}
|
||||
%
|
||||
%
|
||||
|
@ -2134,6 +2139,11 @@
|
|||
\pdffontattr#1{/ToUnicode \the\pdflastobj\space 0 R}%
|
||||
}%
|
||||
\fi\fi
|
||||
%
|
||||
% This is what gets called when #5 of \setfont is empty.
|
||||
\let\cmap\gobble
|
||||
%
|
||||
% (end of cmaps)
|
||||
|
||||
|
||||
% Set the font macro #1 to the font named \fontprefix#2.
|
||||
|
@ -2149,11 +2159,10 @@
|
|||
\def\setfont#1#2#3#4#5{%
|
||||
\font#1=\fontprefix#2#3 scaled #4
|
||||
\csname cmap#5\endcsname#1%
|
||||
\ifx#2\ttshape\hyphenchar#1=-1 \fi
|
||||
\ifx#2\ttbshape\hyphenchar#1=-1 \fi
|
||||
\ifx#2\ttslshape\hyphenchar#1=-1 \fi
|
||||
}
|
||||
% This is what gets called when #5 of \setfont is empty.
|
||||
\let\cmap\gobble
|
||||
%
|
||||
% (end of cmaps)
|
||||
|
||||
% Use cm as the default font prefix.
|
||||
% To specify the font prefix, you must define \fontprefix
|
||||
|
@ -2815,13 +2824,6 @@
|
|||
% @sansserif, explicit sans.
|
||||
\def\sansserif#1{{\sf #1}}
|
||||
|
||||
% We can't just use \exhyphenpenalty, because that only has effect at
|
||||
% the end of a paragraph. Restore normal hyphenation at the end of the
|
||||
% group within which \nohyphenation is presumably called.
|
||||
%
|
||||
\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation}
|
||||
\def\restorehyphenation{\hyphenchar\font = `- }
|
||||
|
||||
\newif\iffrenchspacing
|
||||
\frenchspacingfalse
|
||||
|
||||
|
@ -2890,27 +2892,29 @@
|
|||
% Switch to typewriter.
|
||||
\tt
|
||||
%
|
||||
% But `\ ' produces the large typewriter interword space.
|
||||
% `\ ' produces the large typewriter interword space.
|
||||
\def\ {{\spaceskip = 0pt{} }}%
|
||||
%
|
||||
% Turn off hyphenation.
|
||||
\nohyphenation
|
||||
%
|
||||
\plainfrenchspacing
|
||||
#1%
|
||||
}%
|
||||
\null % reset spacefactor to 1000
|
||||
}
|
||||
|
||||
% We *must* turn on hyphenation at `-' and `_' in @code.
|
||||
% (But see \codedashfinish below.)
|
||||
% This is for LuaTeX: It is not sufficient to disable hyphenation at
|
||||
% explicit dashes by setting `\hyphenchar` to -1.
|
||||
\def\dashnobreak{%
|
||||
\normaldash
|
||||
\penalty 10000 }
|
||||
|
||||
% We must turn on hyphenation at `-' and `_' in @code.
|
||||
% Otherwise, it is too hard to avoid overfull hboxes
|
||||
% in the Emacs manual, the Library manual, etc.
|
||||
% We explicitly allow hyphenation at these characters
|
||||
% using \discretionary.
|
||||
%
|
||||
% Unfortunately, TeX uses one parameter (\hyphenchar) to control
|
||||
% both hyphenation at - and hyphenation within words.
|
||||
% We must therefore turn them both off (\tclose does that)
|
||||
% and arrange explicitly to hyphenate at a dash. -- rms.
|
||||
% Hyphenation at - and hyphenation within words was turned off
|
||||
% by default for the tt fonts using the \hyphenchar parameter of TeX.
|
||||
{
|
||||
\catcode`\-=\active \catcode`\_=\active
|
||||
\catcode`\'=\active \catcode`\`=\active
|
||||
|
@ -2923,7 +2927,7 @@
|
|||
\let-\codedash
|
||||
\let_\codeunder
|
||||
\else
|
||||
\let-\normaldash
|
||||
\let-\dashnobreak
|
||||
\let_\realunder
|
||||
\fi
|
||||
% Given -foo (with a single dash), we do not want to allow a break
|
||||
|
@ -3200,7 +3204,7 @@
|
|||
|
||||
% definition of @key with no lozenge.
|
||||
%
|
||||
\def\key#1{{\setregularquotes \nohyphenation \tt #1}\null}
|
||||
\def\key#1{{\setregularquotes \tt #1}\null}
|
||||
|
||||
% @clicksequence{File @click{} Open ...}
|
||||
\def\clicksequence#1{\begingroup #1\endgroup}
|
||||
|
@ -3747,6 +3751,7 @@
|
|||
% Open one extra group, as we want to close it in the middle of \Etitlepage.
|
||||
\begingroup
|
||||
\parindent=0pt \textfonts
|
||||
\headingsoff
|
||||
% Leave some space at the very top of the page.
|
||||
\vglue\titlepagetopglue
|
||||
% No rule at page bottom unless we print one at the top with @title.
|
||||
|
@ -3774,11 +3779,9 @@
|
|||
% If we use the new definition of \page, we always get a blank page
|
||||
% after the title page, which we certainly don't want.
|
||||
\oldpage
|
||||
\pageone
|
||||
\endgroup
|
||||
%
|
||||
% Need this before the \...aftertitlepage checks so that if they are
|
||||
% in effect the toc pages will come out with page numbers.
|
||||
\HEADINGSon
|
||||
}
|
||||
|
||||
\def\finishtitlepage{%
|
||||
|
@ -3947,7 +3950,6 @@
|
|||
}
|
||||
|
||||
\def\HEADINGSoff{{\globaldefs=1 \headingsoff}} % global setting
|
||||
\HEADINGSoff % it's the default
|
||||
|
||||
% When we turn headings on, set the page number to 1.
|
||||
\def\pageone{
|
||||
|
@ -3971,7 +3973,7 @@
|
|||
\pageone
|
||||
\HEADINGSsinglex
|
||||
}
|
||||
\def\HEADINGSon{\HEADINGSdouble}
|
||||
% \def\HEADINGSon{\HEADINGSdouble} % defined by \CHAPPAGon
|
||||
|
||||
\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex}
|
||||
\let\HEADINGSdoubleafter=\HEADINGSafter
|
||||
|
@ -5616,6 +5618,11 @@
|
|||
\newdimen\entryrightmargin
|
||||
\entryrightmargin=0pt
|
||||
|
||||
% for PDF output, whether to make the text of the entry a link to the page
|
||||
% number. set for @contents and @shortcontents where there is only one
|
||||
% page number.
|
||||
\newif\iflinkentrytext
|
||||
|
||||
% \entry typesets a paragraph consisting of the text (#1), dot leaders, and
|
||||
% then page number (#2) flushed to the right margin. It is used for index
|
||||
% and table of contents entries. The paragraph is indented by \leftskip.
|
||||
|
@ -5642,7 +5649,7 @@
|
|||
}
|
||||
\def\entrybreak{\unskip\space\ignorespaces}%
|
||||
\def\doentry{%
|
||||
% Save the text of the entry
|
||||
% Save the text of the entry in \boxA
|
||||
\global\setbox\boxA=\hbox\bgroup
|
||||
\bgroup % Instead of the swallowed brace.
|
||||
\noindent
|
||||
|
@ -5652,12 +5659,21 @@
|
|||
% with catcodes occurring.
|
||||
}
|
||||
{\catcode`\@=11
|
||||
% #1 is the page number
|
||||
\gdef\finishentry#1{%
|
||||
\egroup % end box A
|
||||
\egroup % end \boxA
|
||||
\dimen@ = \wd\boxA % Length of text of entry
|
||||
% add any leaders and page number to \boxA.
|
||||
\global\setbox\boxA=\hbox\bgroup
|
||||
\unhbox\boxA
|
||||
% #1 is the page number.
|
||||
\ifpdforxetex
|
||||
\iflinkentrytext
|
||||
\pdflinkpage{#1}{\unhbox\boxA}%
|
||||
\else
|
||||
\unhbox\boxA
|
||||
\fi
|
||||
\else
|
||||
\unhbox\boxA
|
||||
\fi
|
||||
%
|
||||
% Get the width of the page numbers, and only use
|
||||
% leaders if they are present.
|
||||
|
@ -5676,6 +5692,8 @@
|
|||
\fi
|
||||
\fi
|
||||
\egroup % end \boxA
|
||||
%
|
||||
% now output
|
||||
\ifdim\wd\boxB = 0pt
|
||||
\noindent\unhbox\boxA\par
|
||||
\nobreak
|
||||
|
@ -6375,7 +6393,7 @@
|
|||
\fi
|
||||
}
|
||||
|
||||
\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname}
|
||||
\parseargdef\setchapternewpage{\csname CHAPPAG#1\endcsname\HEADINGSon}
|
||||
|
||||
\def\CHAPPAGoff{%
|
||||
\global\let\contentsalignmacro = \chappager
|
||||
|
@ -6392,7 +6410,7 @@
|
|||
\global\let\pchapsepmacro=\chapoddpage
|
||||
\global\def\HEADINGSon{\HEADINGSdouble}}
|
||||
|
||||
\CHAPPAGon
|
||||
\setchapternewpage on
|
||||
|
||||
% \chapmacro - Chapter opening.
|
||||
%
|
||||
|
@ -6772,6 +6790,7 @@
|
|||
\def\thistitle{}% no title in double-sided headings
|
||||
% Record where the Roman numerals started.
|
||||
\ifnum\romancount=0 \global\romancount=\pagecount \fi
|
||||
\linkentrytexttrue
|
||||
}
|
||||
|
||||
% \raggedbottom in plain.tex hardcodes \topskip so override it
|
||||
|
@ -6899,7 +6918,7 @@
|
|||
% Chapters, in the short toc.
|
||||
% See comments in \dochapentry re vbox and related settings.
|
||||
\def\shortchapentry#1#2#3#4{%
|
||||
\tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}%
|
||||
\tocentry{\shortchaplabel{#2}\labelspace #1}{#4}%
|
||||
}
|
||||
|
||||
% Appendices, in the main contents.
|
||||
|
@ -6914,7 +6933,7 @@
|
|||
|
||||
% Unnumbered chapters.
|
||||
\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}}
|
||||
\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}}
|
||||
\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{#4}}
|
||||
|
||||
% Sections.
|
||||
\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}}
|
||||
|
@ -6946,24 +6965,24 @@
|
|||
% Move the page numbers slightly to the right
|
||||
\advance\entryrightmargin by -0.05em
|
||||
\chapentryfonts
|
||||
\tocentry{#1}{\dopageno\bgroup#2\egroup}%
|
||||
\tocentry{#1}{#2}%
|
||||
\endgroup
|
||||
\nobreak\vskip .25\baselineskip plus.1\baselineskip
|
||||
}
|
||||
|
||||
\def\dosecentry#1#2{\begingroup
|
||||
\secentryfonts \leftskip=\tocindent
|
||||
\tocentry{#1}{\dopageno\bgroup#2\egroup}%
|
||||
\tocentry{#1}{#2}%
|
||||
\endgroup}
|
||||
|
||||
\def\dosubsecentry#1#2{\begingroup
|
||||
\subsecentryfonts \leftskip=2\tocindent
|
||||
\tocentry{#1}{\dopageno\bgroup#2\egroup}%
|
||||
\tocentry{#1}{#2}%
|
||||
\endgroup}
|
||||
|
||||
\def\dosubsubsecentry#1#2{\begingroup
|
||||
\subsubsecentryfonts \leftskip=3\tocindent
|
||||
\tocentry{#1}{\dopageno\bgroup#2\egroup}%
|
||||
\tocentry{#1}{#2}%
|
||||
\endgroup}
|
||||
|
||||
% We use the same \entry macro as for the index entries.
|
||||
|
@ -6972,9 +6991,6 @@
|
|||
% Space between chapter (or whatever) number and the title.
|
||||
\def\labelspace{\hskip1em \relax}
|
||||
|
||||
\def\dopageno#1{{\rm #1}}
|
||||
\def\doshortpageno#1{{\rm #1}}
|
||||
|
||||
\def\chapentryfonts{\secfonts \rm}
|
||||
\def\secentryfonts{\textfonts}
|
||||
\def\subsecentryfonts{\textfonts}
|
||||
|
@ -7410,7 +7426,7 @@
|
|||
\endgroup
|
||||
%
|
||||
\def\setupverb{%
|
||||
\tt % easiest (and conventionally used) font for verbatim
|
||||
\tt
|
||||
\def\par{\leavevmode\endgraf}%
|
||||
\setcodequotes
|
||||
\tabeightspaces
|
||||
|
@ -7587,32 +7603,28 @@
|
|||
\exdentamount=\defbodyindent
|
||||
}
|
||||
|
||||
\def\dodefunx#1{%
|
||||
% First, check whether we are in the right environment:
|
||||
\checkenv#1%
|
||||
%
|
||||
% As above, allow line break if we have multiple x headers in a row.
|
||||
% It's not a great place, though.
|
||||
\ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
|
||||
%
|
||||
% And now, it's time to reuse the body of the original defun:
|
||||
\expandafter\gobbledefun#1%
|
||||
}
|
||||
\def\gobbledefun#1\startdefun{}
|
||||
\newtoks\defidx
|
||||
\newtoks\deftext
|
||||
|
||||
% \printdefunline \deffnheader{text}
|
||||
\def\useindex#1{\defidx={#1}\ignorespaces}
|
||||
|
||||
% Called as \printdefunline \deffooheader{text}
|
||||
%
|
||||
\def\printdefunline#1#2{%
|
||||
\begingroup
|
||||
\plainfrenchspacing
|
||||
% call \deffnheader:
|
||||
% call \deffooheader:
|
||||
#1#2 \endheader
|
||||
% create the index entry
|
||||
\defcharsdefault
|
||||
\edef\temp{\noexpand\doind{\the\defidx}{\the\deftext}}%
|
||||
\temp
|
||||
% common ending:
|
||||
\interlinepenalty = 10000
|
||||
\advance\rightskip by 0pt plus 1fil\relax
|
||||
\endgraf
|
||||
\nobreak\vskip -\parskip
|
||||
\penalty\defunpenalty % signal to \startdefun and \dodefunx
|
||||
\penalty\defunpenalty % signal to \startdefun and \deffoox
|
||||
% Some of the @defun-type tags do not enable magic parentheses,
|
||||
% rendering the following check redundant. But we don't optimize.
|
||||
\checkparencounts
|
||||
|
@ -7621,7 +7633,7 @@
|
|||
|
||||
\def\Edefun{\endgraf\medbreak}
|
||||
|
||||
% \makedefun{deffoo}{ (definition of \deffooheader) }
|
||||
% \makedefun{deffoo} (\deffooheader parameters) { (\deffooheader expansion) }
|
||||
%
|
||||
% Define \deffoo, \deffoox \Edeffoo and \deffooheader.
|
||||
\def\makedefun#1{%
|
||||
|
@ -7636,8 +7648,18 @@
|
|||
\doingtypefnfalse % distinguish typed functions from all else
|
||||
\parseargusing\activeparens{\printdefunline#3}%
|
||||
}%
|
||||
\def#2{\dodefunx#1}%
|
||||
\def#3%
|
||||
\def#2{%
|
||||
% First, check whether we are in the right environment:
|
||||
\checkenv#1%
|
||||
%
|
||||
% As in \startdefun, allow line break if we have multiple x headers
|
||||
% in a row. It's not a great place, though.
|
||||
\ifnum\lastpenalty=10002 \penalty3000 \else \defunpenalty=10002 \fi
|
||||
%
|
||||
\doingtypefnfalse % distinguish typed functions from all else
|
||||
\parseargusing\activeparens{\printdefunline#3}%
|
||||
}%
|
||||
\def#3% definition of \deffooheader follows
|
||||
}
|
||||
|
||||
\newif\ifdoingtypefn % doing typed function?
|
||||
|
@ -7662,18 +7684,23 @@
|
|||
\fi\fi
|
||||
}
|
||||
|
||||
\def\defind#1#2{
|
||||
\defidx={#1}%
|
||||
\deftext={#2}%
|
||||
}
|
||||
|
||||
% Untyped functions:
|
||||
|
||||
% @deffn category name args
|
||||
\makedefun{deffn}#1 #2 #3\endheader{%
|
||||
\doind{fn}{\code{#2}}%
|
||||
\defind{fn}{\code{#2}}%
|
||||
\defname{#1}{}{#2}\magicamp\defunargs{#3\unskip}%
|
||||
}
|
||||
|
||||
% @defop category class name args
|
||||
\makedefun{defop}#1 {\defopheaderx{#1\ \putwordon}}
|
||||
\def\defopheaderx#1#2 #3 #4\endheader{%
|
||||
\doind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
|
||||
\defind{fn}{\code{#3}\space\putwordon\ \code{#2}}%
|
||||
\defname{#1\ \code{#2}}{}{#3}\magicamp\defunargs{#4\unskip}%
|
||||
}
|
||||
|
||||
|
@ -7681,7 +7708,7 @@
|
|||
|
||||
% @deftypefn category type name args
|
||||
\makedefun{deftypefn}#1 #2 #3 #4\endheader{%
|
||||
\doind{fn}{\code{#3}}%
|
||||
\defind{fn}{\code{#3}}%
|
||||
\doingtypefntrue
|
||||
\defname{#1}{#2}{#3}\defunargs{#4\unskip}%
|
||||
}
|
||||
|
@ -7689,7 +7716,7 @@
|
|||
% @deftypeop category class type name args
|
||||
\makedefun{deftypeop}#1 {\deftypeopheaderx{#1\ \putwordon}}
|
||||
\def\deftypeopheaderx#1#2 #3 #4 #5\endheader{%
|
||||
\doind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
|
||||
\defind{fn}{\code{#4}\space\putwordon\ \code{#1\ \code{#2}}}%
|
||||
\doingtypefntrue
|
||||
\defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
|
||||
}
|
||||
|
@ -7698,14 +7725,14 @@
|
|||
|
||||
% @deftypevr category type var args
|
||||
\makedefun{deftypevr}#1 #2 #3 #4\endheader{%
|
||||
\doind{vr}{\code{#3}}%
|
||||
\defind{vr}{\code{#3}}%
|
||||
\defname{#1}{#2}{#3}\defunargs{#4\unskip}%
|
||||
}
|
||||
|
||||
% @deftypecv category class type var args
|
||||
\makedefun{deftypecv}#1 {\deftypecvheaderx{#1\ \putwordof}}
|
||||
\def\deftypecvheaderx#1#2 #3 #4 #5\endheader{%
|
||||
\doind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
|
||||
\defind{vr}{\code{#4}\space\putwordof\ \code{#2}}%
|
||||
\defname{#1\ \code{#2}}{#3}{#4}\defunargs{#5\unskip}%
|
||||
}
|
||||
|
||||
|
@ -7722,7 +7749,7 @@
|
|||
|
||||
% @deftp category name args
|
||||
\makedefun{deftp}#1 #2 #3\endheader{%
|
||||
\doind{tp}{\code{#2}}%
|
||||
\defind{tp}{\code{#2}}%
|
||||
\defname{#1}{}{#2}\defunargs{#3\unskip}%
|
||||
}
|
||||
|
||||
|
@ -10489,7 +10516,7 @@
|
|||
\DeclareUnicodeCharacter{00AE}{\registeredsymbol{}}%
|
||||
\DeclareUnicodeCharacter{00AF}{\={ }}%
|
||||
%
|
||||
\DeclareUnicodeCharacter{00B0}{\textdegree}
|
||||
\DeclareUnicodeCharacter{00B0}{\textdegree}%
|
||||
\DeclareUnicodeCharacter{00B1}{\ensuremath\pm}%
|
||||
\DeclareUnicodeCharacter{00B2}{$^2$}%
|
||||
\DeclareUnicodeCharacter{00B3}{$^3$}%
|
||||
|
|
|
@ -29,9 +29,97 @@
|
|||
|
||||
#include "acl-internal.h"
|
||||
|
||||
#if GETXATTR_WITH_POSIX_ACLS
|
||||
#if USE_ACL && GETXATTR_WITH_POSIX_ACLS
|
||||
# include <string.h>
|
||||
# include <arpa/inet.h>
|
||||
# include <sys/xattr.h>
|
||||
# include <linux/xattr.h>
|
||||
# ifndef XATTR_NAME_NFSV4_ACL
|
||||
# define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
|
||||
# endif
|
||||
|
||||
enum {
|
||||
/* ACE4_ACCESS_ALLOWED_ACE_TYPE = 0x00000000, */
|
||||
ACE4_ACCESS_DENIED_ACE_TYPE = 0x00000001,
|
||||
ACE4_IDENTIFIER_GROUP = 0x00000040
|
||||
};
|
||||
|
||||
/* Return 1 if given ACL in XDR format is non-trivial, 0 if it is trivial.
|
||||
-1 upon failure to determine it. Possibly change errno. Assume that
|
||||
the ACL is valid, except avoid undefined behavior even if invalid.
|
||||
|
||||
See <https://linux.die.net/man/5/nfs4_acl>. The NFSv4 acls are
|
||||
defined in Internet RFC 7530 and as such, every NFSv4 server
|
||||
supporting ACLs should support NFSv4 ACLs (they differ from from
|
||||
POSIX draft ACLs). The ACLs can be obtained via the
|
||||
nfsv4-acl-tools, e.g., the nfs4_getfacl command. Gnulib provides
|
||||
only basic support of NFSv4 ACLs, i.e., recognize trivial vs
|
||||
nontrivial ACLs. */
|
||||
|
||||
static int
|
||||
acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
|
||||
{
|
||||
enum { BYTES_PER_NETWORK_UINT = 4};
|
||||
|
||||
/* Grab the number of aces in the acl. */
|
||||
nbytes -= BYTES_PER_NETWORK_UINT;
|
||||
if (nbytes < 0)
|
||||
return -1;
|
||||
uint32_t num_aces = ntohl (*xattr++);
|
||||
if (6 < num_aces)
|
||||
return 1;
|
||||
int ace_found = 0;
|
||||
|
||||
for (int ace_n = 0; ace_n < num_aces; ace_n++)
|
||||
{
|
||||
/* Get the acl type and flag. Skip the mask; it's too risky to
|
||||
test it and it does not seem to be needed. Get the wholen. */
|
||||
nbytes -= 4 * BYTES_PER_NETWORK_UINT;
|
||||
if (nbytes < 0)
|
||||
return -1;
|
||||
uint32_t type = ntohl (xattr[0]);
|
||||
uint32_t flag = ntohl (xattr[1]);
|
||||
uint32_t wholen = ntohl (xattr[3]);
|
||||
xattr += 4;
|
||||
int64_t wholen4 = wholen;
|
||||
wholen4 = ((wholen4 + (BYTES_PER_NETWORK_UINT))
|
||||
& ~ (BYTES_PER_NETWORK_UINT - 1));
|
||||
|
||||
/* Trivial ACLs have only ACE4_ACCESS_ALLOWED_ACE_TYPE or
|
||||
ACE4_ACCESS_DENIED_ACE_TYPE. */
|
||||
if (ACE4_ACCESS_DENIED_ACE_TYPE < type)
|
||||
return 1;
|
||||
|
||||
/* RFC 7530 says FLAG should be 0, but be generous to NetApp and
|
||||
also accept the group flag. */
|
||||
if (flag & ~ACE4_IDENTIFIER_GROUP)
|
||||
return 1;
|
||||
|
||||
/* Get the who string. Check NBYTES - WHOLEN4 before storing
|
||||
into NBYTES, to avoid truncation on conversion. */
|
||||
if (nbytes - wholen4 < 0)
|
||||
return -1;
|
||||
nbytes -= wholen4;
|
||||
|
||||
/* For a trivial ACL, max 6 (typically 3) ACEs, 3 allow, 3 deny.
|
||||
Check that there is at most one ACE of each TYPE and WHO. */
|
||||
int who2
|
||||
= (wholen == 6 && memcmp (xattr, "OWNER@", 6) == 0 ? 0
|
||||
: wholen == 6 && memcmp (xattr, "GROUP@", 6) == 0 ? 2
|
||||
: wholen == 9 && memcmp (xattr, "EVERYONE@", 9) == 0 ? 4
|
||||
: -1);
|
||||
if (who2 < 0)
|
||||
return 1;
|
||||
int ace_found_bit = 1 << (who2 | type);
|
||||
if (ace_found & ace_found_bit)
|
||||
return 1;
|
||||
ace_found |= ace_found_bit;
|
||||
|
||||
xattr = (uint32_t *) ((char *) xattr + wholen4);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Return 1 if NAME has a nontrivial access control list,
|
||||
|
@ -51,6 +139,7 @@ file_has_acl (char const *name, struct stat const *sb)
|
|||
# if GETXATTR_WITH_POSIX_ACLS
|
||||
|
||||
ssize_t ret;
|
||||
int initial_errno = errno;
|
||||
|
||||
ret = getxattr (name, XATTR_NAME_POSIX_ACL_ACCESS, NULL, 0);
|
||||
if (ret < 0 && errno == ENODATA)
|
||||
|
@ -67,6 +156,35 @@ file_has_acl (char const *name, struct stat const *sb)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
{
|
||||
/* Check for NFSv4 ACLs. The max length of a trivial
|
||||
ACL is 6 words for owner, 6 for group, 7 for everyone,
|
||||
all times 2 because there are both allow and deny ACEs.
|
||||
There are 6 words for owner because of type, flag, mask,
|
||||
wholen, "OWNER@"+pad and similarly for group; everyone is
|
||||
another word to hold "EVERYONE@". */
|
||||
uint32_t xattr[2 * (6 + 6 + 7)];
|
||||
|
||||
ret = getxattr (name, XATTR_NAME_NFSV4_ACL, xattr, sizeof xattr);
|
||||
if (ret < 0)
|
||||
switch (errno)
|
||||
{
|
||||
case ENODATA: return 0;
|
||||
case ERANGE : return 1; /* ACL must be nontrivial. */
|
||||
}
|
||||
else
|
||||
{
|
||||
/* It looks like a trivial ACL, but investigate further. */
|
||||
ret = acl_nfs4_nontrivial (xattr, ret);
|
||||
if (ret < 0)
|
||||
{
|
||||
errno = EINVAL;
|
||||
return ret;
|
||||
}
|
||||
errno = initial_errno;
|
||||
}
|
||||
}
|
||||
if (ret < 0)
|
||||
return - acl_errno_valid (errno);
|
||||
return ret;
|
||||
|
|
|
@ -315,6 +315,7 @@ _GL_CXXALIASWARN (strptime);
|
|||
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||
# define ctime rpl_ctime
|
||||
# endif
|
||||
_GL_ATTRIBUTE_DEPRECATED
|
||||
_GL_FUNCDECL_RPL (ctime, char *, (time_t const *__tp)
|
||||
_GL_ARG_NONNULL ((1)));
|
||||
_GL_CXXALIAS_RPL (ctime, char *, (time_t const *__tp));
|
||||
|
|
|
@ -105,14 +105,10 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
# define _GL_ATTR_warn_unused_result _GL_GNUC_PREREQ (3, 4)
|
||||
#endif
|
||||
|
||||
#ifdef __has_c_attribute
|
||||
# if ((defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710 \
|
||||
&& _GL_GNUC_PREREQ (4, 6))
|
||||
# pragma GCC diagnostic ignored "-Wpedantic"
|
||||
# endif
|
||||
# define _GL_HAS_C_ATTRIBUTE(attr) __has_c_attribute (__##attr##__)
|
||||
#else
|
||||
# define _GL_HAS_C_ATTRIBUTE(attr) 0
|
||||
/* Disable GCC -Wpedantic if using __has_c_attribute and this is not C23+. */
|
||||
#if (defined __has_c_attribute && _GL_GNUC_PREREQ (4, 6) \
|
||||
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) <= 201710)
|
||||
# pragma GCC diagnostic ignored "-Wpedantic"
|
||||
#endif
|
||||
|
||||
]dnl There is no _GL_ATTRIBUTE_ALIGNED; use stdalign's alignas instead.
|
||||
|
@ -202,11 +198,15 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
- enumeration, enumeration item,
|
||||
- typedef,
|
||||
in C++ also: namespace, class, template specialization. */
|
||||
#if _GL_HAS_C_ATTRIBUTE (deprecated)
|
||||
# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
|
||||
#elif _GL_HAS_ATTRIBUTE (deprecated)
|
||||
#ifdef __has_c_attribute
|
||||
# if __has_c_attribute (__deprecated__)
|
||||
# define _GL_ATTRIBUTE_DEPRECATED [[__deprecated__]]
|
||||
# endif
|
||||
#endif
|
||||
#if !defined _GL_ATTRIBUTE_DEPRECATED && _GL_HAS_ATTRIBUTE (deprecated)
|
||||
# define _GL_ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
|
||||
#else
|
||||
#endif
|
||||
#ifndef _GL_ATTRIBUTE_DEPRECATED
|
||||
# define _GL_ATTRIBUTE_DEPRECATED
|
||||
#endif
|
||||
|
||||
|
@ -240,11 +240,15 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
'default' label. The compiler should not warn in this case. */
|
||||
/* Applies to: Empty statement (;), inside a 'switch' statement. */
|
||||
/* Always expands to something. */
|
||||
#if _GL_HAS_C_ATTRIBUTE (fallthrough)
|
||||
# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
|
||||
#elif _GL_HAS_ATTRIBUTE (fallthrough)
|
||||
#ifdef __has_c_attribute
|
||||
# if __has_c_attribute (__fallthrough__)
|
||||
# define _GL_ATTRIBUTE_FALLTHROUGH [[__fallthrough__]]
|
||||
# endif
|
||||
#endif
|
||||
#if !defined _GL_ATTRIBUTE_FALLTHROUGH && _GL_HAS_ATTRIBUTE (fallthrough)
|
||||
# define _GL_ATTRIBUTE_FALLTHROUGH __attribute__ ((__fallthrough__))
|
||||
#else
|
||||
#endif
|
||||
#ifndef _GL_ATTRIBUTE_FALLTHROUGH
|
||||
# define _GL_ATTRIBUTE_FALLTHROUGH ((void) 0)
|
||||
#endif
|
||||
|
||||
|
@ -308,9 +312,12 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
/* In C++ and C2x, this is spelled [[__maybe_unused__]].
|
||||
GCC's syntax is __attribute__ ((__unused__)).
|
||||
clang supports both syntaxes. */
|
||||
#if _GL_HAS_C_ATTRIBUTE (maybe_unused)
|
||||
# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
|
||||
#else
|
||||
#ifdef __has_c_attribute
|
||||
# if __has_c_attribute (__maybe_unused__)
|
||||
# define _GL_ATTRIBUTE_MAYBE_UNUSED [[__maybe_unused__]]
|
||||
# endif
|
||||
#endif
|
||||
#ifndef _GL_ATTRIBUTE_MAYBE_UNUSED
|
||||
# define _GL_ATTRIBUTE_MAYBE_UNUSED _GL_ATTRIBUTE_UNUSED
|
||||
#endif
|
||||
/* Alternative spelling of this macro, for convenience and for
|
||||
|
@ -323,11 +330,15 @@ AC_DEFUN([gl_COMMON_BODY], [
|
|||
discard the return value. The compiler may warn if the caller does not use
|
||||
the return value, unless the caller uses something like ignore_value. */
|
||||
/* Applies to: function, enumeration, class. */
|
||||
#if _GL_HAS_C_ATTRIBUTE (nodiscard)
|
||||
# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
|
||||
#elif _GL_HAS_ATTRIBUTE (warn_unused_result)
|
||||
#ifdef __has_c_attribute
|
||||
# if __has_c_attribute (__nodiscard__)
|
||||
# define _GL_ATTRIBUTE_NODISCARD [[__nodiscard__]]
|
||||
# endif
|
||||
#endif
|
||||
#if !defined _GL_ATTRIBUTE_NODISCARD && _GL_HAS_ATTRIBUTE (warn_unused_result)
|
||||
# define _GL_ATTRIBUTE_NODISCARD __attribute__ ((__warn_unused_result__))
|
||||
#else
|
||||
#endif
|
||||
#ifndef _GL_ATTRIBUTE_NODISCARD
|
||||
# define _GL_ATTRIBUTE_NODISCARD
|
||||
#endif
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue