new upstream release 9.2
This commit is contained in:
parent
f8035e385d
commit
43d181cda7
@ -20,17 +20,17 @@ index b465771..ad42b09 100644
|
|||||||
# Configuration file for dircolors, a utility to help you set the
|
# Configuration file for dircolors, a utility to help you set the
|
||||||
# LS_COLORS environment variable used by GNU ls with the --color option.
|
# LS_COLORS environment variable used by GNU ls with the --color option.
|
||||||
|
|
||||||
@@ -10,6 +14,9 @@
|
@@ -11,6 +15,9 @@
|
||||||
|
|
||||||
# Global config options can be specified before TERM or COLORTERM entries
|
# Global config options can be specified before TERM or COLORTERM entries
|
||||||
|
|
||||||
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
|
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
|
||||||
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
|
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
|
||||||
+
|
+
|
||||||
# Below are TERM or COLORTERM entries, which can be glob patterns, which
|
# ===================================================================
|
||||||
# restrict following config to systems with matching environment variables.
|
# Terminal filters
|
||||||
COLORTERM ?*
|
# ===================================================================
|
||||||
@@ -62,7 +69,7 @@ DOOR 01;35 # door
|
@@ -69,7 +76,7 @@ DOOR 01;35 # door
|
||||||
BLK 40;33;01 # block device driver
|
BLK 40;33;01 # block device driver
|
||||||
CHR 40;33;01 # character device driver
|
CHR 40;33;01 # character device driver
|
||||||
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
|
ORPHAN 40;31;01 # symlink to nonexistent file, or non-stat'able file ...
|
||||||
@ -53,17 +53,17 @@ index eab6258..1627b63 100644
|
|||||||
# Configuration file for dircolors, a utility to help you set the
|
# Configuration file for dircolors, a utility to help you set the
|
||||||
# LS_COLORS environment variable used by GNU ls with the --color option.
|
# LS_COLORS environment variable used by GNU ls with the --color option.
|
||||||
|
|
||||||
@@ -10,6 +16,9 @@
|
@@ -11,6 +17,9 @@
|
||||||
|
|
||||||
# Global config options can be specified before TERM or COLORTERM entries
|
# Global config options can be specified before TERM or COLORTERM entries
|
||||||
|
|
||||||
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
|
+# For compatibility, the pattern "^COLOR.*none" is recognized as a way to
|
||||||
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
|
+# disable colorization. See https://bugzilla.redhat.com/1349579 for details.
|
||||||
+
|
+
|
||||||
# Below are TERM or COLORTERM entries, which can be glob patterns, which
|
# ===================================================================
|
||||||
# restrict following config to systems with matching environment variables.
|
# Terminal filters
|
||||||
COLORTERM ?*
|
# ===================================================================
|
||||||
@@ -52,17 +61,17 @@ TERM xterm*
|
@@ -59,17 +68,17 @@ TERM xterm*
|
||||||
#NORMAL 00 # no color code at all
|
#NORMAL 00 # no color code at all
|
||||||
#FILE 00 # regular file: use no color at all
|
#FILE 00 # regular file: use no color at all
|
||||||
RESET 0 # reset to "normal" color
|
RESET 0 # reset to "normal" color
|
||||||
@ -86,15 +86,15 @@ index eab6258..1627b63 100644
|
|||||||
SETUID 37;41 # file that is setuid (u+s)
|
SETUID 37;41 # file that is setuid (u+s)
|
||||||
SETGID 30;43 # file that is setgid (g+s)
|
SETGID 30;43 # file that is setgid (g+s)
|
||||||
CAPABILITY 00 # file with capability (very expensive to lookup)
|
CAPABILITY 00 # file with capability (very expensive to lookup)
|
||||||
@@ -71,7 +80,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
|
@@ -78,7 +87,7 @@ OTHER_WRITABLE 34;42 # dir that is other-writable (o+w) and not sticky
|
||||||
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
|
STICKY 37;44 # dir with the sticky bit set (+t) and not other-writable
|
||||||
|
|
||||||
# This is for files with execute permission:
|
# This is for files with execute permission:
|
||||||
-EXEC 01;32
|
-EXEC 01;32
|
||||||
+EXEC 00;32
|
+EXEC 00;32
|
||||||
|
|
||||||
# List any file extensions like '.gz' or '.tar' that you would like ls
|
# ===================================================================
|
||||||
# to color below. Put the extension, a space, and the color init string.
|
# File extension attributes
|
||||||
--
|
--
|
||||||
2.34.1
|
2.34.1
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ diff --git a/bootstrap.conf b/bootstrap.conf
|
|||||||
index c1399e3..60b39cf 100644
|
index c1399e3..60b39cf 100644
|
||||||
--- a/bootstrap.conf
|
--- a/bootstrap.conf
|
||||||
+++ b/bootstrap.conf
|
+++ b/bootstrap.conf
|
||||||
@@ -162,6 +162,7 @@ gnulib_modules="
|
@@ -165,6 +165,7 @@ gnulib_modules="
|
||||||
maintainer-makefile
|
maintainer-makefile
|
||||||
malloc-gnu
|
malloc-gnu
|
||||||
manywarnings
|
manywarnings
|
||||||
@ -60,7 +60,7 @@ diff --git a/configure.ac b/configure.ac
|
|||||||
index 7e4afc9..4656a35 100644
|
index 7e4afc9..4656a35 100644
|
||||||
--- a/configure.ac
|
--- a/configure.ac
|
||||||
+++ b/configure.ac
|
+++ b/configure.ac
|
||||||
@@ -476,6 +476,8 @@ fi
|
@@ -477,6 +477,8 @@ fi
|
||||||
# I'm leaving it here for now. This whole thing needs to be modernized...
|
# I'm leaving it here for now. This whole thing needs to be modernized...
|
||||||
gl_WINSIZE_IN_PTEM
|
gl_WINSIZE_IN_PTEM
|
||||||
|
|
||||||
@ -401,7 +401,7 @@ index 6fd8978..faef877 100644
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#include "error.h"
|
#include "error.h"
|
||||||
@@ -37,6 +42,18 @@
|
@@ -36,6 +41,18 @@
|
||||||
|
|
||||||
#include "set-fields.h"
|
#include "set-fields.h"
|
||||||
|
|
||||||
@ -420,7 +420,7 @@ index 6fd8978..faef877 100644
|
|||||||
/* The official name of this program (e.g., no 'g' prefix). */
|
/* The official name of this program (e.g., no 'g' prefix). */
|
||||||
#define PROGRAM_NAME "cut"
|
#define PROGRAM_NAME "cut"
|
||||||
|
|
||||||
@@ -53,6 +70,52 @@
|
@@ -52,6 +69,52 @@
|
||||||
} \
|
} \
|
||||||
while (0)
|
while (0)
|
||||||
|
|
||||||
@ -473,7 +473,7 @@ index 6fd8978..faef877 100644
|
|||||||
|
|
||||||
/* Pointer inside RP. When checking if a byte or field is selected
|
/* Pointer inside RP. When checking if a byte or field is selected
|
||||||
by a finite range, we check if it is between CURRENT_RP.LO
|
by a finite range, we check if it is between CURRENT_RP.LO
|
||||||
@@ -60,6 +123,9 @@
|
@@ -59,6 +122,9 @@
|
||||||
CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */
|
CURRENT_RP.HI then we make CURRENT_RP to point to the next range pair. */
|
||||||
static struct field_range_pair *current_rp;
|
static struct field_range_pair *current_rp;
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ index 6fd8978..faef877 100644
|
|||||||
/* This buffer is used to support the semantics of the -s option
|
/* This buffer is used to support the semantics of the -s option
|
||||||
(or lack of same) when the specified field list includes (does
|
(or lack of same) when the specified field list includes (does
|
||||||
not include) the first field. In both of those cases, the entire
|
not include) the first field. In both of those cases, the entire
|
||||||
@@ -72,6 +138,29 @@ static char *field_1_buffer;
|
@@ -71,6 +137,29 @@ static char *field_1_buffer;
|
||||||
/* The number of bytes allocated for FIELD_1_BUFFER. */
|
/* The number of bytes allocated for FIELD_1_BUFFER. */
|
||||||
static size_t field_1_bufsize;
|
static size_t field_1_bufsize;
|
||||||
|
|
||||||
@ -513,7 +513,7 @@ index 6fd8978..faef877 100644
|
|||||||
/* If true do not output lines containing no delimiter characters.
|
/* If true do not output lines containing no delimiter characters.
|
||||||
Otherwise, all such lines are printed. This option is valid only
|
Otherwise, all such lines are printed. This option is valid only
|
||||||
with field mode. */
|
with field mode. */
|
||||||
@@ -83,10 +172,16 @@ static bool complement;
|
@@ -82,10 +171,16 @@ static bool complement;
|
||||||
|
|
||||||
/* The delimiter character for field mode. */
|
/* The delimiter character for field mode. */
|
||||||
static unsigned char delim;
|
static unsigned char delim;
|
||||||
@ -530,7 +530,7 @@ index 6fd8978..faef877 100644
|
|||||||
/* The length of output_delimiter_string. */
|
/* The length of output_delimiter_string. */
|
||||||
static size_t output_delimiter_length;
|
static size_t output_delimiter_length;
|
||||||
|
|
||||||
@@ -94,9 +189,6 @@ static size_t output_delimiter_length;
|
@@ -93,9 +188,6 @@ static size_t output_delimiter_length;
|
||||||
string consisting of the input delimiter. */
|
string consisting of the input delimiter. */
|
||||||
static char *output_delimiter_string;
|
static char *output_delimiter_string;
|
||||||
|
|
||||||
@ -540,7 +540,7 @@ index 6fd8978..faef877 100644
|
|||||||
/* True if we have ever read standard input. */
|
/* True if we have ever read standard input. */
|
||||||
static bool have_read_stdin;
|
static bool have_read_stdin;
|
||||||
|
|
||||||
@@ -150,7 +242,7 @@ Print selected parts of lines from each FILE to standard output.\n\
|
@@ -149,7 +241,7 @@ Print selected parts of lines from each FILE to standard output.\n\
|
||||||
-f, --fields=LIST select only these fields; also print any line\n\
|
-f, --fields=LIST select only these fields; also print any line\n\
|
||||||
that contains no delimiter character, unless\n\
|
that contains no delimiter character, unless\n\
|
||||||
the -s option is specified\n\
|
the -s option is specified\n\
|
||||||
@ -549,7 +549,7 @@ index 6fd8978..faef877 100644
|
|||||||
"), stdout);
|
"), stdout);
|
||||||
fputs (_("\
|
fputs (_("\
|
||||||
--complement complement the set of selected bytes, characters\n\
|
--complement complement the set of selected bytes, characters\n\
|
||||||
@@ -250,7 +342,7 @@ cut_bytes (FILE *stream)
|
@@ -249,7 +341,7 @@ cut_bytes (FILE *stream)
|
||||||
next_item (&byte_idx);
|
next_item (&byte_idx);
|
||||||
if (print_kth (byte_idx))
|
if (print_kth (byte_idx))
|
||||||
{
|
{
|
||||||
@ -558,7 +558,7 @@ index 6fd8978..faef877 100644
|
|||||||
{
|
{
|
||||||
if (print_delimiter && is_range_start_index (byte_idx))
|
if (print_delimiter && is_range_start_index (byte_idx))
|
||||||
{
|
{
|
||||||
@@ -266,6 +358,82 @@ cut_bytes (FILE *stream)
|
@@ -265,6 +357,82 @@ cut_bytes (FILE *stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ index 6fd8978..faef877 100644
|
|||||||
/* Read from stream STREAM, printing to standard output any selected fields. */
|
/* Read from stream STREAM, printing to standard output any selected fields. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -411,11 +579,218 @@ cut_fields (FILE *stream)
|
@@ -410,11 +578,218 @@ cut_fields (FILE *stream)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -862,7 +862,7 @@ index 6fd8978..faef877 100644
|
|||||||
{
|
{
|
||||||
FILE *stream;
|
FILE *stream;
|
||||||
|
|
||||||
@@ -459,8 +834,8 @@ main (int argc, char **argv)
|
@@ -458,8 +833,8 @@ main (int argc, char **argv)
|
||||||
int optc;
|
int optc;
|
||||||
bool ok;
|
bool ok;
|
||||||
bool delim_specified = false;
|
bool delim_specified = false;
|
||||||
@ -873,7 +873,7 @@ index 6fd8978..faef877 100644
|
|||||||
|
|
||||||
initialize_main (&argc, &argv);
|
initialize_main (&argc, &argv);
|
||||||
set_program_name (argv[0]);
|
set_program_name (argv[0]);
|
||||||
@@ -470,6 +845,8 @@ main (int argc, char **argv)
|
@@ -469,6 +844,8 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
atexit (close_stdout);
|
atexit (close_stdout);
|
||||||
|
|
||||||
@ -882,7 +882,7 @@ index 6fd8978..faef877 100644
|
|||||||
/* By default, all non-delimited lines are printed. */
|
/* By default, all non-delimited lines are printed. */
|
||||||
suppress_non_delimited = false;
|
suppress_non_delimited = false;
|
||||||
|
|
||||||
@@ -481,35 +858,77 @@ main (int argc, char **argv)
|
@@ -480,35 +857,77 @@ main (int argc, char **argv)
|
||||||
switch (optc)
|
switch (optc)
|
||||||
{
|
{
|
||||||
case 'b':
|
case 'b':
|
||||||
@ -970,7 +970,7 @@ index 6fd8978..faef877 100644
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
@@ -533,40 +952,57 @@ main (int argc, char **argv)
|
@@ -532,40 +951,57 @@ main (int argc, char **argv)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2136,7 +2136,7 @@ index f2fd172..6c7d1ed 100644
|
|||||||
+
|
+
|
||||||
if (diff)
|
if (diff)
|
||||||
return diff;
|
return diff;
|
||||||
- return len1 < len2 ? -1 : len1 != len2;
|
- return (len1 > len2) - (len1 < len2);
|
||||||
+ return len[0] - len[1];
|
+ return len[0] - len[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2259,7 +2259,7 @@ diff --git a/src/local.mk b/src/local.mk
|
|||||||
index e1d15ce..1a5ffaa 100644
|
index e1d15ce..1a5ffaa 100644
|
||||||
--- a/src/local.mk
|
--- a/src/local.mk
|
||||||
+++ b/src/local.mk
|
+++ b/src/local.mk
|
||||||
@@ -434,8 +434,8 @@ src_base32_CPPFLAGS = -DBASE_TYPE=32 $(AM_CPPFLAGS)
|
@@ -438,8 +438,8 @@ src_base32_CPPFLAGS = -DBASE_TYPE=32 $(AM_CPPFLAGS)
|
||||||
src_basenc_SOURCES = src/basenc.c
|
src_basenc_SOURCES = src/basenc.c
|
||||||
src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS)
|
src_basenc_CPPFLAGS = -DBASE_TYPE=42 $(AM_CPPFLAGS)
|
||||||
|
|
||||||
@ -2542,7 +2542,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
if (*arg)
|
if (*arg)
|
||||||
{
|
{
|
||||||
long int tmp_long;
|
long int tmp_long;
|
||||||
@@ -1191,6 +1310,11 @@ static void
|
@@ -1198,6 +1317,11 @@ static void
|
||||||
init_parameters (int number_of_files)
|
init_parameters (int number_of_files)
|
||||||
{
|
{
|
||||||
int chars_used_by_number = 0;
|
int chars_used_by_number = 0;
|
||||||
@ -2554,7 +2554,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
|
|
||||||
lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
|
lines_per_body = lines_per_page - lines_per_header - lines_per_footer;
|
||||||
if (lines_per_body <= 0)
|
if (lines_per_body <= 0)
|
||||||
@@ -1228,7 +1352,7 @@ init_parameters (int number_of_files)
|
@@ -1235,7 +1359,7 @@ init_parameters (int number_of_files)
|
||||||
else
|
else
|
||||||
col_sep_string = column_separator;
|
col_sep_string = column_separator;
|
||||||
|
|
||||||
@ -2563,7 +2563,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
use_col_separator = true;
|
use_col_separator = true;
|
||||||
}
|
}
|
||||||
/* It's rather pointless to define a TAB separator with column
|
/* It's rather pointless to define a TAB separator with column
|
||||||
@@ -1260,11 +1384,11 @@ init_parameters (int number_of_files)
|
@@ -1267,11 +1391,11 @@ init_parameters (int number_of_files)
|
||||||
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */
|
+ TAB_WIDTH (chars_per_input_tab, chars_per_number); */
|
||||||
|
|
||||||
/* Estimate chars_per_text without any margin and keep it constant. */
|
/* Estimate chars_per_text without any margin and keep it constant. */
|
||||||
@ -2577,7 +2577,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
|
|
||||||
/* The number is part of the column width unless we are
|
/* The number is part of the column width unless we are
|
||||||
printing files in parallel. */
|
printing files in parallel. */
|
||||||
@@ -1273,7 +1397,7 @@ init_parameters (int number_of_files)
|
@@ -1280,7 +1404,7 @@ init_parameters (int number_of_files)
|
||||||
}
|
}
|
||||||
|
|
||||||
int sep_chars, useful_chars;
|
int sep_chars, useful_chars;
|
||||||
@ -2586,7 +2586,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
sep_chars = INT_MAX;
|
sep_chars = INT_MAX;
|
||||||
if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars,
|
if (INT_SUBTRACT_WRAPV (chars_per_line - chars_used_by_number, sep_chars,
|
||||||
&useful_chars))
|
&useful_chars))
|
||||||
@@ -1296,7 +1420,7 @@ init_parameters (int number_of_files)
|
@@ -1303,7 +1427,7 @@ init_parameters (int number_of_files)
|
||||||
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
|
We've to use 8 as the lower limit, if we use chars_per_default_tab = 8
|
||||||
to expand a tab which is not an input_tab-char. */
|
to expand a tab which is not an input_tab-char. */
|
||||||
free (clump_buff);
|
free (clump_buff);
|
||||||
@ -2595,7 +2595,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Open the necessary files,
|
/* Open the necessary files,
|
||||||
@@ -1402,7 +1526,7 @@ init_funcs (void)
|
@@ -1409,7 +1533,7 @@ init_funcs (void)
|
||||||
|
|
||||||
/* Enlarge p->start_position of first column to use the same form of
|
/* Enlarge p->start_position of first column to use the same form of
|
||||||
padding_not_printed with all columns. */
|
padding_not_printed with all columns. */
|
||||||
@ -2604,7 +2604,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
|
|
||||||
/* This loop takes care of all but the rightmost column. */
|
/* This loop takes care of all but the rightmost column. */
|
||||||
|
|
||||||
@@ -1436,7 +1560,7 @@ init_funcs (void)
|
@@ -1443,7 +1567,7 @@ init_funcs (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2613,7 +2613,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
h_next = h + chars_per_column;
|
h_next = h + chars_per_column;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1733,9 +1857,9 @@ static void
|
@@ -1740,9 +1864,9 @@ static void
|
||||||
align_column (COLUMN *p)
|
align_column (COLUMN *p)
|
||||||
{
|
{
|
||||||
padding_not_printed = p->start_position;
|
padding_not_printed = p->start_position;
|
||||||
@ -2625,7 +2625,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
padding_not_printed = ANYWHERE;
|
padding_not_printed = ANYWHERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2010,13 +2134,13 @@ store_char (char c)
|
@@ -2017,13 +2141,13 @@ store_char (char c)
|
||||||
/* May be too generous. */
|
/* May be too generous. */
|
||||||
buff = X2REALLOC (buff, &buff_allocated);
|
buff = X2REALLOC (buff, &buff_allocated);
|
||||||
}
|
}
|
||||||
@ -2641,7 +2641,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
char *s;
|
char *s;
|
||||||
int num_width;
|
int num_width;
|
||||||
|
|
||||||
@@ -2033,22 +2157,24 @@ add_line_number (COLUMN *p)
|
@@ -2040,22 +2164,24 @@ add_line_number (COLUMN *p)
|
||||||
/* Tabification is assumed for multiple columns, also for n-separators,
|
/* Tabification is assumed for multiple columns, also for n-separators,
|
||||||
but 'default n-separator = TAB' hasn't been given priority over
|
but 'default n-separator = TAB' hasn't been given priority over
|
||||||
equal column_width also specified by POSIX. */
|
equal column_width also specified by POSIX. */
|
||||||
@ -2670,7 +2670,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
output_position = POS_AFTER_TAB (chars_per_output_tab,
|
output_position = POS_AFTER_TAB (chars_per_output_tab,
|
||||||
output_position);
|
output_position);
|
||||||
}
|
}
|
||||||
@@ -2207,7 +2333,7 @@ print_white_space (void)
|
@@ -2214,7 +2340,7 @@ print_white_space (void)
|
||||||
while (goal - h_old > 1
|
while (goal - h_old > 1
|
||||||
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
|
&& (h_new = POS_AFTER_TAB (chars_per_output_tab, h_old)) <= goal)
|
||||||
{
|
{
|
||||||
@ -2679,7 +2679,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
h_old = h_new;
|
h_old = h_new;
|
||||||
}
|
}
|
||||||
while (++h_old <= goal)
|
while (++h_old <= goal)
|
||||||
@@ -2227,6 +2353,7 @@ print_sep_string (void)
|
@@ -2234,6 +2360,7 @@ print_sep_string (void)
|
||||||
{
|
{
|
||||||
char const *s = col_sep_string;
|
char const *s = col_sep_string;
|
||||||
int l = col_sep_length;
|
int l = col_sep_length;
|
||||||
@ -2687,7 +2687,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
|
|
||||||
if (separators_not_printed <= 0)
|
if (separators_not_printed <= 0)
|
||||||
{
|
{
|
||||||
@@ -2238,6 +2365,7 @@ print_sep_string (void)
|
@@ -2245,6 +2372,7 @@ print_sep_string (void)
|
||||||
{
|
{
|
||||||
for (; separators_not_printed > 0; --separators_not_printed)
|
for (; separators_not_printed > 0; --separators_not_printed)
|
||||||
{
|
{
|
||||||
@ -2695,7 +2695,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
while (l-- > 0)
|
while (l-- > 0)
|
||||||
{
|
{
|
||||||
/* 3 types of sep_strings: spaces only, spaces and chars,
|
/* 3 types of sep_strings: spaces only, spaces and chars,
|
||||||
@@ -2251,12 +2379,15 @@ print_sep_string (void)
|
@@ -2258,12 +2386,15 @@ print_sep_string (void)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -2712,7 +2712,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
/* sep_string ends with some spaces */
|
/* sep_string ends with some spaces */
|
||||||
if (spaces_not_printed > 0)
|
if (spaces_not_printed > 0)
|
||||||
print_white_space ();
|
print_white_space ();
|
||||||
@@ -2284,7 +2415,7 @@ print_clump (COLUMN *p, int n, char *clump)
|
@@ -2291,7 +2422,7 @@ print_clump (COLUMN *p, int n, char *clump)
|
||||||
required number of tabs and spaces. */
|
required number of tabs and spaces. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -2721,7 +2721,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
{
|
{
|
||||||
if (tabify_output)
|
if (tabify_output)
|
||||||
{
|
{
|
||||||
@@ -2308,6 +2439,74 @@ print_char (char c)
|
@@ -2315,6 +2446,74 @@ print_char (char c)
|
||||||
putchar (c);
|
putchar (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2796,7 +2796,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
/* Skip to page PAGE before printing.
|
/* Skip to page PAGE before printing.
|
||||||
PAGE may be larger than total number of pages. */
|
PAGE may be larger than total number of pages. */
|
||||||
|
|
||||||
@@ -2485,9 +2684,9 @@ read_line (COLUMN *p)
|
@@ -2492,9 +2691,9 @@ read_line (COLUMN *p)
|
||||||
align_empty_cols = false;
|
align_empty_cols = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2808,7 +2808,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
padding_not_printed = ANYWHERE;
|
padding_not_printed = ANYWHERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2556,7 +2755,7 @@ print_stored (COLUMN *p)
|
@@ -2563,7 +2762,7 @@ print_stored (COLUMN *p)
|
||||||
COLUMN *q;
|
COLUMN *q;
|
||||||
|
|
||||||
int line = p->current_line++;
|
int line = p->current_line++;
|
||||||
@ -2817,7 +2817,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
/* FIXME
|
/* FIXME
|
||||||
UMR: Uninitialized memory read:
|
UMR: Uninitialized memory read:
|
||||||
* This is occurring while in:
|
* This is occurring while in:
|
||||||
@@ -2568,7 +2767,7 @@ print_stored (COLUMN *p)
|
@@ -2575,7 +2774,7 @@ print_stored (COLUMN *p)
|
||||||
xmalloc [xmalloc.c:94]
|
xmalloc [xmalloc.c:94]
|
||||||
init_store_cols [pr.c:1648]
|
init_store_cols [pr.c:1648]
|
||||||
*/
|
*/
|
||||||
@ -2826,7 +2826,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
|
|
||||||
pad_vertically = true;
|
pad_vertically = true;
|
||||||
|
|
||||||
@@ -2588,9 +2787,9 @@ print_stored (COLUMN *p)
|
@@ -2595,9 +2794,9 @@ print_stored (COLUMN *p)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2838,7 +2838,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
padding_not_printed = ANYWHERE;
|
padding_not_printed = ANYWHERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2603,8 +2802,8 @@ print_stored (COLUMN *p)
|
@@ -2610,8 +2809,8 @@ print_stored (COLUMN *p)
|
||||||
if (spaces_not_printed == 0)
|
if (spaces_not_printed == 0)
|
||||||
{
|
{
|
||||||
output_position = p->start_position + end_vector[line];
|
output_position = p->start_position + end_vector[line];
|
||||||
@ -2849,7 +2849,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -2623,7 +2822,7 @@ print_stored (COLUMN *p)
|
@@ -2630,7 +2829,7 @@ print_stored (COLUMN *p)
|
||||||
number of characters is 1.) */
|
number of characters is 1.) */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -2858,7 +2858,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
{
|
{
|
||||||
unsigned char uc = c;
|
unsigned char uc = c;
|
||||||
char *s = clump_buff;
|
char *s = clump_buff;
|
||||||
@@ -2633,10 +2832,10 @@ char_to_clump (char c)
|
@@ -2640,10 +2839,10 @@ char_to_clump (char c)
|
||||||
int chars;
|
int chars;
|
||||||
int chars_per_c = 8;
|
int chars_per_c = 8;
|
||||||
|
|
||||||
@ -2871,7 +2871,7 @@ index 4c17c00..b4fab1c 100644
|
|||||||
{
|
{
|
||||||
width = TAB_WIDTH (chars_per_c, input_position);
|
width = TAB_WIDTH (chars_per_c, input_position);
|
||||||
|
|
||||||
@@ -2717,6 +2916,164 @@ char_to_clump (char c)
|
@@ -2724,6 +2923,164 @@ char_to_clump (char c)
|
||||||
return chars;
|
return chars;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3549,7 +3549,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
line->keybeg = line_start;
|
line->keybeg = line_start;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1976,12 +2322,10 @@ find_unit_order (char const *number)
|
@@ -1978,12 +2324,10 @@ find_unit_order (char const *number)
|
||||||
|
|
||||||
ATTRIBUTE_PURE
|
ATTRIBUTE_PURE
|
||||||
static int
|
static int
|
||||||
@ -3565,7 +3565,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
|
|
||||||
int diff = find_unit_order (a) - find_unit_order (b);
|
int diff = find_unit_order (a) - find_unit_order (b);
|
||||||
return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
|
return (diff ? diff : strnumcmp (a, b, decimal_point, thousands_sep));
|
||||||
@@ -1993,7 +2337,7 @@ human_numcompare (char const *a, char const *b)
|
@@ -1995,7 +2339,7 @@ human_numcompare (char const *a, char const *b)
|
||||||
|
|
||||||
ATTRIBUTE_PURE
|
ATTRIBUTE_PURE
|
||||||
static int
|
static int
|
||||||
@ -3574,7 +3574,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
{
|
{
|
||||||
while (blanks[to_uchar (*a)])
|
while (blanks[to_uchar (*a)])
|
||||||
a++;
|
a++;
|
||||||
@@ -2003,6 +2347,25 @@ numcompare (char const *a, char const *b)
|
@@ -2005,6 +2349,25 @@ numcompare (char const *a, char const *b)
|
||||||
return strnumcmp (a, b, decimal_point, thousands_sep);
|
return strnumcmp (a, b, decimal_point, thousands_sep);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3597,10 +3597,10 @@ index 3b775d6..a0ba243 100644
|
|||||||
+}
|
+}
|
||||||
+#endif /* HAV_EMBRTOWC */
|
+#endif /* HAV_EMBRTOWC */
|
||||||
+
|
+
|
||||||
/* Work around a problem whereby the long double value returned by glibc's
|
static int
|
||||||
strtold ("NaN", ...) contains uninitialized bits: clear all bytes of
|
nan_compare (long double a, long double b)
|
||||||
A and B before calling strtold. FIXME: remove this function if
|
{
|
||||||
@@ -2053,7 +2416,7 @@ general_numcompare (char const *sa, char const *sb)
|
@@ -2046,7 +2409,7 @@ general_numcompare (char const *sa, char const *sb)
|
||||||
Return 0 if the name in S is not recognized. */
|
Return 0 if the name in S is not recognized. */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -3609,7 +3609,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
{
|
{
|
||||||
size_t lo = 0;
|
size_t lo = 0;
|
||||||
size_t hi = MONTHS_PER_YEAR;
|
size_t hi = MONTHS_PER_YEAR;
|
||||||
@@ -2329,15 +2692,14 @@ debug_key (struct line const *line, struct keyfield const *key)
|
@@ -2322,15 +2685,14 @@ debug_key (struct line const *line, struct keyfield const *key)
|
||||||
char saved = *lim;
|
char saved = *lim;
|
||||||
*lim = '\0';
|
*lim = '\0';
|
||||||
|
|
||||||
@ -3627,7 +3627,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
else if (key->general_numeric)
|
else if (key->general_numeric)
|
||||||
ignore_value (strtold (beg, &tighter_lim));
|
ignore_value (strtold (beg, &tighter_lim));
|
||||||
else if (key->numeric || key->human_numeric)
|
else if (key->numeric || key->human_numeric)
|
||||||
@@ -2483,7 +2845,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
@@ -2476,7 +2838,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||||
/* Warn about significant leading blanks. */
|
/* Warn about significant leading blanks. */
|
||||||
bool implicit_skip = key_numeric (key) || key->month;
|
bool implicit_skip = key_numeric (key) || key->month;
|
||||||
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
|
bool line_offset = key->eword == 0 && key->echar != 0; /* -k1.x,1.y */
|
||||||
@ -3636,7 +3636,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
&& ((!key->skipsblanks && !implicit_skip)
|
&& ((!key->skipsblanks && !implicit_skip)
|
||||||
|| (!key->skipsblanks && key->schar)
|
|| (!key->skipsblanks && key->schar)
|
||||||
|| (!key->skipeblanks && key->echar)))
|
|| (!key->skipeblanks && key->echar)))
|
||||||
@@ -2531,9 +2893,9 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
@@ -2524,9 +2886,9 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||||
bool number_locale_warned = false;
|
bool number_locale_warned = false;
|
||||||
if (basic_numeric_field_span)
|
if (basic_numeric_field_span)
|
||||||
{
|
{
|
||||||
@ -3649,7 +3649,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
{
|
{
|
||||||
error (0, 0,
|
error (0, 0,
|
||||||
_("field separator %s is treated as a "
|
_("field separator %s is treated as a "
|
||||||
@@ -2544,9 +2906,9 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
@@ -2537,9 +2899,9 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||||
}
|
}
|
||||||
if (basic_numeric_field_span || general_numeric_field_span)
|
if (basic_numeric_field_span || general_numeric_field_span)
|
||||||
{
|
{
|
||||||
@ -3662,7 +3662,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
{
|
{
|
||||||
error (0, 0,
|
error (0, 0,
|
||||||
_("field separator %s is treated as a "
|
_("field separator %s is treated as a "
|
||||||
@@ -2554,19 +2916,19 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
@@ -2547,19 +2909,19 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||||
quote (((char []) {decimal_point, 0})));
|
quote (((char []) {decimal_point, 0})));
|
||||||
number_locale_warned = true;
|
number_locale_warned = true;
|
||||||
}
|
}
|
||||||
@ -3686,7 +3686,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2577,7 +2939,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
@@ -2570,7 +2932,7 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
||||||
{
|
{
|
||||||
error (0, 0,
|
error (0, 0,
|
||||||
_("%snumbers use %s as a decimal point in this locale"),
|
_("%snumbers use %s as a decimal point in this locale"),
|
||||||
@ -3695,8 +3695,8 @@ index 3b775d6..a0ba243 100644
|
|||||||
quote (((char []) {decimal_point, 0})));
|
quote (((char []) {decimal_point, 0})));
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2610,11 +2972,87 @@ key_warnings (struct keyfield const *gkey, bool gkey_only)
|
@@ -2612,11 +2974,87 @@ diff_reversed (int diff, bool reversed)
|
||||||
error (0, 0, _("option '-r' only applies to last-resort comparison"));
|
return reversed ? (diff < 0) - (diff > 0) : diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
+#if HAVE_MBRTOWC
|
+#if HAVE_MBRTOWC
|
||||||
@ -3784,7 +3784,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
{
|
{
|
||||||
struct keyfield *key = keylist;
|
struct keyfield *key = keylist;
|
||||||
|
|
||||||
@@ -2699,7 +3137,7 @@ keycompare (struct line const *a, struct line const *b)
|
@@ -2697,7 +3135,7 @@ keycompare (struct line const *a, struct line const *b)
|
||||||
else if (key->human_numeric)
|
else if (key->human_numeric)
|
||||||
diff = human_numcompare (ta, tb);
|
diff = human_numcompare (ta, tb);
|
||||||
else if (key->month)
|
else if (key->month)
|
||||||
@ -3793,8 +3793,8 @@ index 3b775d6..a0ba243 100644
|
|||||||
else if (key->random)
|
else if (key->random)
|
||||||
diff = compare_random (ta, tlena, tb, tlenb);
|
diff = compare_random (ta, tlena, tb, tlenb);
|
||||||
else if (key->version)
|
else if (key->version)
|
||||||
@@ -2815,6 +3253,211 @@ keycompare (struct line const *a, struct line const *b)
|
@@ -2807,6 +3245,211 @@ keycompare (struct line const *a, struct line const *b)
|
||||||
return key->reverse ? -diff : diff;
|
return diff_reversed (diff, key->reverse);
|
||||||
}
|
}
|
||||||
|
|
||||||
+#if HAVE_MBRTOWC
|
+#if HAVE_MBRTOWC
|
||||||
@ -4005,7 +4005,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
/* Compare two lines A and B, returning negative, zero, or positive
|
/* Compare two lines A and B, returning negative, zero, or positive
|
||||||
depending on whether A compares less than, equal to, or greater than B. */
|
depending on whether A compares less than, equal to, or greater than B. */
|
||||||
|
|
||||||
@@ -2842,7 +3485,7 @@ compare (struct line const *a, struct line const *b)
|
@@ -2834,7 +3477,7 @@ compare (struct line const *a, struct line const *b)
|
||||||
diff = - NONZERO (blen);
|
diff = - NONZERO (blen);
|
||||||
else if (blen == 0)
|
else if (blen == 0)
|
||||||
diff = 1;
|
diff = 1;
|
||||||
@ -4014,7 +4014,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
{
|
{
|
||||||
/* xmemcoll0 is a performance enhancement as
|
/* xmemcoll0 is a performance enhancement as
|
||||||
it will not unconditionally write '\0' after the
|
it will not unconditionally write '\0' after the
|
||||||
@@ -4226,6 +4869,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
|
@@ -4222,6 +4865,7 @@ set_ordering (char const *s, struct keyfield *key, enum blanktype blanktype)
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
key->translate = fold_toupper;
|
key->translate = fold_toupper;
|
||||||
@ -4022,7 +4022,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
key->general_numeric = true;
|
key->general_numeric = true;
|
||||||
@@ -4305,7 +4949,7 @@ main (int argc, char **argv)
|
@@ -4301,7 +4945,7 @@ main (int argc, char **argv)
|
||||||
initialize_exit_failure (SORT_FAILURE);
|
initialize_exit_failure (SORT_FAILURE);
|
||||||
|
|
||||||
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
hard_LC_COLLATE = hard_locale (LC_COLLATE);
|
||||||
@ -4031,7 +4031,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
hard_LC_TIME = hard_locale (LC_TIME);
|
hard_LC_TIME = hard_locale (LC_TIME);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -4328,6 +4972,29 @@ main (int argc, char **argv)
|
@@ -4324,6 +4968,29 @@ main (int argc, char **argv)
|
||||||
thousands_sep = NON_CHAR;
|
thousands_sep = NON_CHAR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4061,7 +4061,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
have_read_stdin = false;
|
have_read_stdin = false;
|
||||||
inittables ();
|
inittables ();
|
||||||
|
|
||||||
@@ -4602,13 +5269,34 @@ main (int argc, char **argv)
|
@@ -4598,13 +5265,34 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
{
|
{
|
||||||
@ -4100,7 +4100,7 @@ index 3b775d6..a0ba243 100644
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Provoke with 'sort -txx'. Complain about
|
/* Provoke with 'sort -txx'. Complain about
|
||||||
@@ -4619,9 +5307,11 @@ main (int argc, char **argv)
|
@@ -4615,9 +5303,11 @@ main (int argc, char **argv)
|
||||||
quote (optarg));
|
quote (optarg));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4726,7 +4726,7 @@ diff --git a/tests/local.mk b/tests/local.mk
|
|||||||
index 0f77786..dbe1843 100644
|
index 0f77786..dbe1843 100644
|
||||||
--- a/tests/local.mk
|
--- a/tests/local.mk
|
||||||
+++ b/tests/local.mk
|
+++ b/tests/local.mk
|
||||||
@@ -377,6 +377,8 @@ all_tests = \
|
@@ -381,6 +381,8 @@ all_tests = \
|
||||||
tests/misc/sort-discrim.sh \
|
tests/misc/sort-discrim.sh \
|
||||||
tests/misc/sort-files0-from.pl \
|
tests/misc/sort-files0-from.pl \
|
||||||
tests/misc/sort-float.sh \
|
tests/misc/sort-float.sh \
|
||||||
@ -4735,7 +4735,7 @@ index 0f77786..dbe1843 100644
|
|||||||
tests/misc/sort-h-thousands-sep.sh \
|
tests/misc/sort-h-thousands-sep.sh \
|
||||||
tests/misc/sort-merge.pl \
|
tests/misc/sort-merge.pl \
|
||||||
tests/misc/sort-merge-fdlimit.sh \
|
tests/misc/sort-merge-fdlimit.sh \
|
||||||
@@ -576,6 +578,7 @@ all_tests = \
|
@@ -582,6 +584,7 @@ all_tests = \
|
||||||
tests/du/threshold.sh \
|
tests/du/threshold.sh \
|
||||||
tests/du/trailing-slash.sh \
|
tests/du/trailing-slash.sh \
|
||||||
tests/du/two-args.sh \
|
tests/du/two-args.sh \
|
||||||
@ -4743,7 +4743,7 @@ index 0f77786..dbe1843 100644
|
|||||||
tests/id/gnu-zero-uids.sh \
|
tests/id/gnu-zero-uids.sh \
|
||||||
tests/id/no-context.sh \
|
tests/id/no-context.sh \
|
||||||
tests/id/context.sh \
|
tests/id/context.sh \
|
||||||
@@ -727,6 +730,7 @@ all_tests = \
|
@@ -734,6 +737,7 @@ all_tests = \
|
||||||
tests/touch/read-only.sh \
|
tests/touch/read-only.sh \
|
||||||
tests/touch/relative.sh \
|
tests/touch/relative.sh \
|
||||||
tests/touch/trailing-slash.sh \
|
tests/touch/trailing-slash.sh \
|
||||||
|
@ -1,625 +0,0 @@
|
|||||||
From 5a6af47c3db45b6303bac4dcd6da186fd5cd178c Mon Sep 17 00:00:00 2001
|
|
||||||
From: Ondrej Valousek <ondrej.valousek.xm@renesas.com>
|
|
||||||
Date: Fri, 2 Dec 2022 13:40:19 +0100
|
|
||||||
Subject: [PATCH 1/3] file-has-acl: Basic support for checking NFSv4 ACLs in
|
|
||||||
Linux.
|
|
||||||
|
|
||||||
* lib/acl-internal.h (acl_nfs4_nontrivial): New declaration.
|
|
||||||
* lib/acl-internal.c (acl_nfs4_nontrivial): New function.
|
|
||||||
* lib/file-has-acl.c: Include <arpa/inet.h>.
|
|
||||||
(XATTR_NAME_NFSV4_ACL, TRIVIAL_NFS4_ACL_MAX_LENGTH): New macros.
|
|
||||||
(file_has_acl): Test for NFSv4 ACLs.
|
|
||||||
* doc/acl-nfsv4.txt: New file.
|
|
||||||
|
|
||||||
Upstream-commit: b0604a8e134dbcc307c0ffdd5ebd3693e9de7081
|
|
||||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
||||||
---
|
|
||||||
doc/acl-nfsv4.txt | 17 ++++++++
|
|
||||||
lib/acl-internal.c | 100 +++++++++++++++++++++++++++++++++++++++++++++
|
|
||||||
lib/acl-internal.h | 3 ++
|
|
||||||
lib/file-has-acl.c | 21 ++++++++++
|
|
||||||
4 files changed, 141 insertions(+)
|
|
||||||
create mode 100644 doc/acl-nfsv4.txt
|
|
||||||
|
|
||||||
diff --git a/doc/acl-nfsv4.txt b/doc/acl-nfsv4.txt
|
|
||||||
new file mode 100644
|
|
||||||
index 0000000..71352f5
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/doc/acl-nfsv4.txt
|
|
||||||
@@ -0,0 +1,17 @@
|
|
||||||
+General introduction:
|
|
||||||
+ https://linux.die.net/man/5/nfs4_acl
|
|
||||||
+
|
|
||||||
+The NFSv4 acls are defined in RFC7530 and as such, every NFSv4 server supporting ACLs
|
|
||||||
+will support this kind of ACLs (note the difference from POSIX draft ACLs)
|
|
||||||
+
|
|
||||||
+The ACLs can be obtained via the nfsv4-acl-tools, i.e.
|
|
||||||
+
|
|
||||||
+$ nfs4_getfacl <file>
|
|
||||||
+
|
|
||||||
+# file: <file>
|
|
||||||
+A::OWNER@:rwaDxtTnNcCy
|
|
||||||
+A::GROUP@:rwaDxtTnNcy
|
|
||||||
+A::EVERYONE@:rwaDxtTnNcy
|
|
||||||
+
|
|
||||||
+Gnulib is aiming to only provide a basic support of these, i.e. recognize trivial
|
|
||||||
+and non-trivial ACLs
|
|
||||||
diff --git a/lib/acl-internal.c b/lib/acl-internal.c
|
|
||||||
index be244c6..4c65dff 100644
|
|
||||||
--- a/lib/acl-internal.c
|
|
||||||
+++ b/lib/acl-internal.c
|
|
||||||
@@ -25,6 +25,9 @@
|
|
||||||
|
|
||||||
#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
|
|
||||||
|
|
||||||
+# include <string.h>
|
|
||||||
+# include <arpa/inet.h>
|
|
||||||
+
|
|
||||||
# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
|
|
||||||
|
|
||||||
/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
|
|
||||||
@@ -122,6 +125,103 @@ acl_default_nontrivial (acl_t acl)
|
|
||||||
return (acl_entries (acl) > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
+# define ACE4_WHO_OWNER "OWNER@"
|
|
||||||
+# define ACE4_WHO_GROUP "GROUP@"
|
|
||||||
+# define ACE4_WHO_EVERYONE "EVERYONE@"
|
|
||||||
+
|
|
||||||
+# define ACE4_ACCESS_ALLOWED_ACE_TYPE 0
|
|
||||||
+# define ACE4_ACCESS_DENIED_ACE_TYPE 1
|
|
||||||
+
|
|
||||||
+/* ACE flag values */
|
|
||||||
+# define ACE4_IDENTIFIER_GROUP 0x00000040
|
|
||||||
+# define ROUNDUP(x, y) (((x) + (y) - 1) & - (y))
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+acl_nfs4_nontrivial (char *xattr, int len)
|
|
||||||
+{
|
|
||||||
+ int bufs = len;
|
|
||||||
+ uint32_t num_aces = ntohl (*((uint32_t*)(xattr))), /* Grab the number of aces in the acl */
|
|
||||||
+ num_a_aces = 0,
|
|
||||||
+ num_d_aces = 0;
|
|
||||||
+ char *bufp = xattr;
|
|
||||||
+
|
|
||||||
+ bufp += 4; /* sizeof(uint32_t); */
|
|
||||||
+ bufs -= 4;
|
|
||||||
+
|
|
||||||
+ for (uint32_t ace_n = 0; num_aces > ace_n ; ace_n++)
|
|
||||||
+ {
|
|
||||||
+ int d_ptr;
|
|
||||||
+ uint32_t flag,
|
|
||||||
+ wholen,
|
|
||||||
+ type;
|
|
||||||
+
|
|
||||||
+ /* Get the acl type */
|
|
||||||
+ if (bufs <= 0)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ type = ntohl (*((uint32_t*)bufp));
|
|
||||||
+
|
|
||||||
+ bufp += 4;
|
|
||||||
+ bufs -= 4;
|
|
||||||
+ if (bufs <= 0)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ flag = ntohl (*((uint32_t*)bufp));
|
|
||||||
+ /* As per RFC 7530, the flag should be 0, but we are just generous to Netapp
|
|
||||||
+ * and also accept the Group flag
|
|
||||||
+ */
|
|
||||||
+ if (flag & ~ACE4_IDENTIFIER_GROUP)
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ /* we skip mask -
|
|
||||||
+ * it's too risky to test it and it does not seem to be actually needed */
|
|
||||||
+ bufp += 2*4;
|
|
||||||
+ bufs -= 2*4;
|
|
||||||
+
|
|
||||||
+ if (bufs <= 0)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ wholen = ntohl (*((uint32_t*)bufp));
|
|
||||||
+
|
|
||||||
+ bufp += 4;
|
|
||||||
+ bufs -= 4;
|
|
||||||
+
|
|
||||||
+ /* Get the who string */
|
|
||||||
+ if (bufs <= 0)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ /* for trivial ACL, we expect max 5 (typically 3) ACES, 3 Allow, 2 deny */
|
|
||||||
+ if (((strncmp (bufp, ACE4_WHO_OWNER, wholen) == 0)
|
|
||||||
+ || (strncmp (bufp, ACE4_WHO_GROUP, wholen) == 0))
|
|
||||||
+ && wholen == 6)
|
|
||||||
+ {
|
|
||||||
+ if (type == ACE4_ACCESS_ALLOWED_ACE_TYPE)
|
|
||||||
+ num_a_aces++;
|
|
||||||
+ if (type == ACE4_ACCESS_DENIED_ACE_TYPE)
|
|
||||||
+ num_d_aces++;
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ if ((strncmp (bufp, ACE4_WHO_EVERYONE, wholen) == 0)
|
|
||||||
+ && (type == ACE4_ACCESS_ALLOWED_ACE_TYPE)
|
|
||||||
+ && (wholen == 9))
|
|
||||||
+ num_a_aces++;
|
|
||||||
+ else
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
+ d_ptr = ROUNDUP (wholen, 4);
|
|
||||||
+ bufp += d_ptr;
|
|
||||||
+ bufs -= d_ptr;
|
|
||||||
+
|
|
||||||
+ /* Make sure we aren't outside our domain */
|
|
||||||
+ if (bufs < 0)
|
|
||||||
+ return -1;
|
|
||||||
+
|
|
||||||
+ }
|
|
||||||
+ return !((num_a_aces <= 3) && (num_d_aces <= 2)
|
|
||||||
+ && (num_a_aces + num_d_aces == num_aces));
|
|
||||||
+
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin < 2.5, not HP-UX */
|
|
||||||
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
|
|
||||||
index 9353376..2a249ff 100644
|
|
||||||
--- a/lib/acl-internal.h
|
|
||||||
+++ b/lib/acl-internal.h
|
|
||||||
@@ -147,6 +147,9 @@ rpl_acl_set_fd (int fd, acl_t acl)
|
|
||||||
# define acl_entries rpl_acl_entries
|
|
||||||
extern int acl_entries (acl_t);
|
|
||||||
# endif
|
|
||||||
+/* Return 1 if given ACL in XDR format is non-trivial
|
|
||||||
+ * Return 0 if it is trivial */
|
|
||||||
+extern int acl_nfs4_nontrivial (char *, int);
|
|
||||||
|
|
||||||
# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
|
|
||||||
/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
|
|
||||||
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
|
|
||||||
index e02f062..1710234 100644
|
|
||||||
--- a/lib/file-has-acl.c
|
|
||||||
+++ b/lib/file-has-acl.c
|
|
||||||
@@ -32,6 +32,11 @@
|
|
||||||
#if GETXATTR_WITH_POSIX_ACLS
|
|
||||||
# include <sys/xattr.h>
|
|
||||||
# include <linux/xattr.h>
|
|
||||||
+# include <arpa/inet.h>
|
|
||||||
+# ifndef XATTR_NAME_NFSV4_ACL
|
|
||||||
+# define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
|
|
||||||
+# endif
|
|
||||||
+# define TRIVIAL_NFS4_ACL_MAX_LENGTH 128
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Return 1 if NAME has a nontrivial access control list,
|
|
||||||
@@ -67,6 +72,22 @@ file_has_acl (char const *name, struct stat const *sb)
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
+ if (ret < 0)
|
|
||||||
+ { /* we might be on NFS, so try to check NFSv4 ACLs too */
|
|
||||||
+ char xattr[TRIVIAL_NFS4_ACL_MAX_LENGTH];
|
|
||||||
+
|
|
||||||
+ errno = 0; /* we need to reset errno set by the previous getxattr() */
|
|
||||||
+ ret = getxattr (name, XATTR_NAME_NFSV4_ACL, xattr, TRIVIAL_NFS4_ACL_MAX_LENGTH);
|
|
||||||
+ if (ret < 0 && errno == ENODATA)
|
|
||||||
+ ret = 0;
|
|
||||||
+ else
|
|
||||||
+ if (ret < 0 && errno == ERANGE)
|
|
||||||
+ return 1; /* we won't fit into the buffer, so non-trivial ACL is presented */
|
|
||||||
+ else
|
|
||||||
+ if (ret > 0)
|
|
||||||
+ /* looks like trivial ACL, but we need to investigate further */
|
|
||||||
+ return acl_nfs4_nontrivial (xattr, ret);
|
|
||||||
+ }
|
|
||||||
if (ret < 0)
|
|
||||||
return - acl_errno_valid (errno);
|
|
||||||
return ret;
|
|
||||||
--
|
|
||||||
2.38.1
|
|
||||||
|
|
||||||
|
|
||||||
From c5266d204a446bea619fa18da8520dceb0a54192 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
|
||||||
Date: Fri, 23 Dec 2022 15:18:29 -0800
|
|
||||||
Subject: [PATCH 2/3] file-has-acl: improve recent NFSv4 support
|
|
||||||
MIME-Version: 1.0
|
|
||||||
Content-Type: text/plain; charset=UTF-8
|
|
||||||
Content-Transfer-Encoding: 8bit
|
|
||||||
|
|
||||||
This fixes a link failure with emacsclient on GNU/Linux. This
|
|
||||||
program wants file_has_acl but none of the other ACL primitives,
|
|
||||||
so it doesn’t link acl-internal.o; this way it doesn’t need to
|
|
||||||
link with -lacl. While I was at it I reviewed the recent changes,
|
|
||||||
fixed some unlikely overflow bugs, and adjusted to GNU style.
|
|
||||||
* doc/acl-nfsv4.txt: Remove. Its contents are now in a
|
|
||||||
comment in lib/file-has-acl.c.
|
|
||||||
* lib/acl-internal.c, lib/acl-internal.h: Move recent changes
|
|
||||||
relating to acl_nfs4_nontrivial to lib/file-has-acl.c, so that
|
|
||||||
there is no trouble linking programs that need only file_has_acl.
|
|
||||||
* lib/file-has-acl.c (acl_nfs4_nontrivial): Move here from
|
|
||||||
lib/acl-internal.c, so that we needn't link -lacl in
|
|
||||||
programs that want only file_has_acl, such as emacsclient.
|
|
||||||
Do not assume a char buffer is aligned for uint32_t.
|
|
||||||
Check more carefully for buffer read overrun.
|
|
||||||
Allow up to 6 ACEs, since other code does; but check
|
|
||||||
that they’re distinct. Avoid integer overflow.
|
|
||||||
Use memcmp rather than strncmp to compare memory blocks.
|
|
||||||
(file_has_acl): Preserve initial errno instead of setting to 0.
|
|
||||||
Allocate a bit more room for trivial ACL buffer.
|
|
||||||
Use EINVAL for botchedk NFSv4 ACLs (which shouldn’t happen).
|
|
||||||
|
|
||||||
Upstream-commit: 35bd46f0c816948dc1a0430c8ba8b10a01167320
|
|
||||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
||||||
---
|
|
||||||
doc/acl-nfsv4.txt | 17 ------
|
|
||||||
lib/acl-internal.c | 100 -----------------------------------
|
|
||||||
lib/acl-internal.h | 3 --
|
|
||||||
lib/file-has-acl.c | 129 +++++++++++++++++++++++++++++++++++++++------
|
|
||||||
4 files changed, 113 insertions(+), 136 deletions(-)
|
|
||||||
delete mode 100644 doc/acl-nfsv4.txt
|
|
||||||
|
|
||||||
diff --git a/doc/acl-nfsv4.txt b/doc/acl-nfsv4.txt
|
|
||||||
deleted file mode 100644
|
|
||||||
index 71352f5..0000000
|
|
||||||
--- a/doc/acl-nfsv4.txt
|
|
||||||
+++ /dev/null
|
|
||||||
@@ -1,17 +0,0 @@
|
|
||||||
-General introduction:
|
|
||||||
- https://linux.die.net/man/5/nfs4_acl
|
|
||||||
-
|
|
||||||
-The NFSv4 acls are defined in RFC7530 and as such, every NFSv4 server supporting ACLs
|
|
||||||
-will support this kind of ACLs (note the difference from POSIX draft ACLs)
|
|
||||||
-
|
|
||||||
-The ACLs can be obtained via the nfsv4-acl-tools, i.e.
|
|
||||||
-
|
|
||||||
-$ nfs4_getfacl <file>
|
|
||||||
-
|
|
||||||
-# file: <file>
|
|
||||||
-A::OWNER@:rwaDxtTnNcCy
|
|
||||||
-A::GROUP@:rwaDxtTnNcy
|
|
||||||
-A::EVERYONE@:rwaDxtTnNcy
|
|
||||||
-
|
|
||||||
-Gnulib is aiming to only provide a basic support of these, i.e. recognize trivial
|
|
||||||
-and non-trivial ACLs
|
|
||||||
diff --git a/lib/acl-internal.c b/lib/acl-internal.c
|
|
||||||
index 4c65dff..be244c6 100644
|
|
||||||
--- a/lib/acl-internal.c
|
|
||||||
+++ b/lib/acl-internal.c
|
|
||||||
@@ -25,9 +25,6 @@
|
|
||||||
|
|
||||||
#if USE_ACL && HAVE_ACL_GET_FILE /* Linux, FreeBSD, Mac OS X, IRIX, Tru64, Cygwin >= 2.5 */
|
|
||||||
|
|
||||||
-# include <string.h>
|
|
||||||
-# include <arpa/inet.h>
|
|
||||||
-
|
|
||||||
# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
|
|
||||||
|
|
||||||
/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
|
|
||||||
@@ -125,103 +122,6 @@ acl_default_nontrivial (acl_t acl)
|
|
||||||
return (acl_entries (acl) > 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
-# define ACE4_WHO_OWNER "OWNER@"
|
|
||||||
-# define ACE4_WHO_GROUP "GROUP@"
|
|
||||||
-# define ACE4_WHO_EVERYONE "EVERYONE@"
|
|
||||||
-
|
|
||||||
-# define ACE4_ACCESS_ALLOWED_ACE_TYPE 0
|
|
||||||
-# define ACE4_ACCESS_DENIED_ACE_TYPE 1
|
|
||||||
-
|
|
||||||
-/* ACE flag values */
|
|
||||||
-# define ACE4_IDENTIFIER_GROUP 0x00000040
|
|
||||||
-# define ROUNDUP(x, y) (((x) + (y) - 1) & - (y))
|
|
||||||
-
|
|
||||||
-int
|
|
||||||
-acl_nfs4_nontrivial (char *xattr, int len)
|
|
||||||
-{
|
|
||||||
- int bufs = len;
|
|
||||||
- uint32_t num_aces = ntohl (*((uint32_t*)(xattr))), /* Grab the number of aces in the acl */
|
|
||||||
- num_a_aces = 0,
|
|
||||||
- num_d_aces = 0;
|
|
||||||
- char *bufp = xattr;
|
|
||||||
-
|
|
||||||
- bufp += 4; /* sizeof(uint32_t); */
|
|
||||||
- bufs -= 4;
|
|
||||||
-
|
|
||||||
- for (uint32_t ace_n = 0; num_aces > ace_n ; ace_n++)
|
|
||||||
- {
|
|
||||||
- int d_ptr;
|
|
||||||
- uint32_t flag,
|
|
||||||
- wholen,
|
|
||||||
- type;
|
|
||||||
-
|
|
||||||
- /* Get the acl type */
|
|
||||||
- if (bufs <= 0)
|
|
||||||
- return -1;
|
|
||||||
-
|
|
||||||
- type = ntohl (*((uint32_t*)bufp));
|
|
||||||
-
|
|
||||||
- bufp += 4;
|
|
||||||
- bufs -= 4;
|
|
||||||
- if (bufs <= 0)
|
|
||||||
- return -1;
|
|
||||||
-
|
|
||||||
- flag = ntohl (*((uint32_t*)bufp));
|
|
||||||
- /* As per RFC 7530, the flag should be 0, but we are just generous to Netapp
|
|
||||||
- * and also accept the Group flag
|
|
||||||
- */
|
|
||||||
- if (flag & ~ACE4_IDENTIFIER_GROUP)
|
|
||||||
- return 1;
|
|
||||||
-
|
|
||||||
- /* we skip mask -
|
|
||||||
- * it's too risky to test it and it does not seem to be actually needed */
|
|
||||||
- bufp += 2*4;
|
|
||||||
- bufs -= 2*4;
|
|
||||||
-
|
|
||||||
- if (bufs <= 0)
|
|
||||||
- return -1;
|
|
||||||
-
|
|
||||||
- wholen = ntohl (*((uint32_t*)bufp));
|
|
||||||
-
|
|
||||||
- bufp += 4;
|
|
||||||
- bufs -= 4;
|
|
||||||
-
|
|
||||||
- /* Get the who string */
|
|
||||||
- if (bufs <= 0)
|
|
||||||
- return -1;
|
|
||||||
-
|
|
||||||
- /* for trivial ACL, we expect max 5 (typically 3) ACES, 3 Allow, 2 deny */
|
|
||||||
- if (((strncmp (bufp, ACE4_WHO_OWNER, wholen) == 0)
|
|
||||||
- || (strncmp (bufp, ACE4_WHO_GROUP, wholen) == 0))
|
|
||||||
- && wholen == 6)
|
|
||||||
- {
|
|
||||||
- if (type == ACE4_ACCESS_ALLOWED_ACE_TYPE)
|
|
||||||
- num_a_aces++;
|
|
||||||
- if (type == ACE4_ACCESS_DENIED_ACE_TYPE)
|
|
||||||
- num_d_aces++;
|
|
||||||
- }
|
|
||||||
- else
|
|
||||||
- if ((strncmp (bufp, ACE4_WHO_EVERYONE, wholen) == 0)
|
|
||||||
- && (type == ACE4_ACCESS_ALLOWED_ACE_TYPE)
|
|
||||||
- && (wholen == 9))
|
|
||||||
- num_a_aces++;
|
|
||||||
- else
|
|
||||||
- return 1;
|
|
||||||
-
|
|
||||||
- d_ptr = ROUNDUP (wholen, 4);
|
|
||||||
- bufp += d_ptr;
|
|
||||||
- bufs -= d_ptr;
|
|
||||||
-
|
|
||||||
- /* Make sure we aren't outside our domain */
|
|
||||||
- if (bufs < 0)
|
|
||||||
- return -1;
|
|
||||||
-
|
|
||||||
- }
|
|
||||||
- return !((num_a_aces <= 3) && (num_d_aces <= 2)
|
|
||||||
- && (num_a_aces + num_d_aces == num_aces));
|
|
||||||
-
|
|
||||||
-}
|
|
||||||
-
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin < 2.5, not HP-UX */
|
|
||||||
diff --git a/lib/acl-internal.h b/lib/acl-internal.h
|
|
||||||
index 2a249ff..9353376 100644
|
|
||||||
--- a/lib/acl-internal.h
|
|
||||||
+++ b/lib/acl-internal.h
|
|
||||||
@@ -147,9 +147,6 @@ rpl_acl_set_fd (int fd, acl_t acl)
|
|
||||||
# define acl_entries rpl_acl_entries
|
|
||||||
extern int acl_entries (acl_t);
|
|
||||||
# endif
|
|
||||||
-/* Return 1 if given ACL in XDR format is non-trivial
|
|
||||||
- * Return 0 if it is trivial */
|
|
||||||
-extern int acl_nfs4_nontrivial (char *, int);
|
|
||||||
|
|
||||||
# if HAVE_ACL_TYPE_EXTENDED /* Mac OS X */
|
|
||||||
/* ACL is an ACL, from a file, stored as type ACL_TYPE_EXTENDED.
|
|
||||||
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
|
|
||||||
index 1710234..676523b 100644
|
|
||||||
--- a/lib/file-has-acl.c
|
|
||||||
+++ b/lib/file-has-acl.c
|
|
||||||
@@ -29,14 +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>
|
|
||||||
-# include <arpa/inet.h>
|
|
||||||
# ifndef XATTR_NAME_NFSV4_ACL
|
|
||||||
# define XATTR_NAME_NFSV4_ACL "system.nfs4_acl"
|
|
||||||
# endif
|
|
||||||
-# define TRIVIAL_NFS4_ACL_MAX_LENGTH 128
|
|
||||||
+
|
|
||||||
+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,
|
|
||||||
@@ -56,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)
|
|
||||||
@@ -73,20 +157,33 @@ file_has_acl (char const *name, struct stat const *sb)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ret < 0)
|
|
||||||
- { /* we might be on NFS, so try to check NFSv4 ACLs too */
|
|
||||||
- char xattr[TRIVIAL_NFS4_ACL_MAX_LENGTH];
|
|
||||||
-
|
|
||||||
- errno = 0; /* we need to reset errno set by the previous getxattr() */
|
|
||||||
- ret = getxattr (name, XATTR_NAME_NFSV4_ACL, xattr, TRIVIAL_NFS4_ACL_MAX_LENGTH);
|
|
||||||
- if (ret < 0 && errno == ENODATA)
|
|
||||||
- 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
|
|
||||||
- if (ret < 0 && errno == ERANGE)
|
|
||||||
- return 1; /* we won't fit into the buffer, so non-trivial ACL is presented */
|
|
||||||
- else
|
|
||||||
- if (ret > 0)
|
|
||||||
- /* looks like trivial ACL, but we need to investigate further */
|
|
||||||
- return acl_nfs4_nontrivial (xattr, ret);
|
|
||||||
+ {
|
|
||||||
+ /* 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);
|
|
||||||
--
|
|
||||||
2.38.1
|
|
||||||
|
|
||||||
|
|
||||||
From faf965110372c82cd99e9f44f0c64f03cdabb2c1 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Paul Eggert <eggert@cs.ucla.edu>
|
|
||||||
Date: Tue, 27 Dec 2022 20:00:58 -0800
|
|
||||||
Subject: [PATCH 3/3] file-has-acl: fix recently-introduced NFSv4 bug
|
|
||||||
|
|
||||||
* lib/file-has-acl.c (acl_nfs4_nontrivial): Fix off-by-one
|
|
||||||
error when rounding WHOLEN up to next multiple of 4.
|
|
||||||
Pacify GCC 12.2.1 -Wcast-align.
|
|
||||||
|
|
||||||
Upstream-commit: d65e5a8ba77595a598c9ddb8dfa09c4aea732659
|
|
||||||
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
|
|
||||||
---
|
|
||||||
lib/file-has-acl.c | 9 +++++----
|
|
||||||
1 file changed, 5 insertions(+), 4 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
|
|
||||||
index 676523b..7876edc 100644
|
|
||||||
--- a/lib/file-has-acl.c
|
|
||||||
+++ b/lib/file-has-acl.c
|
|
||||||
@@ -81,9 +81,10 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
|
|
||||||
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));
|
|
||||||
+ int whowords = (wholen / BYTES_PER_NETWORK_UINT
|
|
||||||
+ + (wholen % BYTES_PER_NETWORK_UINT != 0));
|
|
||||||
+ int64_t wholen4 = whowords;
|
|
||||||
+ wholen4 *= BYTES_PER_NETWORK_UINT;
|
|
||||||
|
|
||||||
/* Trivial ACLs have only ACE4_ACCESS_ALLOWED_ACE_TYPE or
|
|
||||||
ACE4_ACCESS_DENIED_ACE_TYPE. */
|
|
||||||
@@ -115,7 +116,7 @@ acl_nfs4_nontrivial (uint32_t *xattr, ssize_t nbytes)
|
|
||||||
return 1;
|
|
||||||
ace_found |= ace_found_bit;
|
|
||||||
|
|
||||||
- xattr = (uint32_t *) ((char *) xattr + wholen4);
|
|
||||||
+ xattr += whowords;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
--
|
|
||||||
2.38.1
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
Summary: A set of basic GNU tools commonly used in shell scripts
|
Summary: A set of basic GNU tools commonly used in shell scripts
|
||||||
Name: coreutils
|
Name: coreutils
|
||||||
Version: 9.1
|
Version: 9.2
|
||||||
Release: 11%{?dist}
|
Release: 1%{?dist}
|
||||||
License: GPLv3+
|
License: GPLv3+
|
||||||
Url: https://www.gnu.org/software/coreutils/
|
Url: https://www.gnu.org/software/coreutils/
|
||||||
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
|
Source0: https://ftp.gnu.org/gnu/%{name}/%{name}-%{version}.tar.xz
|
||||||
@ -17,12 +17,6 @@ Source106: coreutils-colorls.csh
|
|||||||
# do not make coreutils-single depend on /usr/bin/coreutils
|
# do not make coreutils-single depend on /usr/bin/coreutils
|
||||||
%global __requires_exclude ^%{_bindir}/coreutils$
|
%global __requires_exclude ^%{_bindir}/coreutils$
|
||||||
|
|
||||||
# Make simple backups in correct dir; broken in 9.1
|
|
||||||
Patch1: gnulib-simple-backup-fix.patch
|
|
||||||
|
|
||||||
# basic support for checking NFSv4 ACLs (#2137866)
|
|
||||||
Patch2: coreutils-nfsv4-acls.patch
|
|
||||||
|
|
||||||
# disable the test-lock gnulib test prone to deadlock
|
# disable the test-lock gnulib test prone to deadlock
|
||||||
Patch100: coreutils-8.26-test-lock.patch
|
Patch100: coreutils-8.26-test-lock.patch
|
||||||
|
|
||||||
@ -261,6 +255,9 @@ rm -f $RPM_BUILD_ROOT%{_infodir}/dir
|
|||||||
%license COPYING
|
%license COPYING
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Mar 22 2023 Kamil Dudka <kdudka@redhat.com> - 9.2-1
|
||||||
|
- new upstream release 9.2
|
||||||
|
|
||||||
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org>
|
* Thu Jan 19 2023 Fedora Release Engineering <releng@fedoraproject.org>
|
||||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
- Rebuilt for https://fedoraproject.org/wiki/Fedora_38_Mass_Rebuild
|
||||||
|
|
||||||
|
@ -1,36 +0,0 @@
|
|||||||
commit 7347caeb9d902d3fca2c11f69a55a3e578d93bfe
|
|
||||||
Author: Paul Eggert <eggert@cs.ucla.edu>
|
|
||||||
Date: Wed Apr 20 19:34:57 2022 -0700
|
|
||||||
|
|
||||||
backupfile: fix bug when renaming simple backups
|
|
||||||
|
|
||||||
* lib/backupfile.c (backupfile_internal): Fix bug when RENAME
|
|
||||||
and when doing simple backups. Problem reported by Steve Ward in:
|
|
||||||
https://bugs.gnu.org/55029
|
|
||||||
|
|
||||||
diff --git a/lib/backupfile.c b/lib/backupfile.c
|
|
||||||
index 1e9290a187..d9f465a3e0 100644
|
|
||||||
--- a/lib/backupfile.c
|
|
||||||
+++ b/lib/backupfile.c
|
|
||||||
@@ -332,7 +332,7 @@ backupfile_internal (int dir_fd, char const *file,
|
|
||||||
return s;
|
|
||||||
|
|
||||||
DIR *dirp = NULL;
|
|
||||||
- int sdir = AT_FDCWD;
|
|
||||||
+ int sdir = dir_fd;
|
|
||||||
idx_t base_max = 0;
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
@@ -371,10 +371,9 @@ backupfile_internal (int dir_fd, char const *file,
|
|
||||||
if (! rename)
|
|
||||||
break;
|
|
||||||
|
|
||||||
- int olddirfd = sdir < 0 ? dir_fd : sdir;
|
|
||||||
- idx_t offset = sdir < 0 ? 0 : base_offset;
|
|
||||||
+ idx_t offset = backup_type == simple_backups ? 0 : base_offset;
|
|
||||||
unsigned flags = backup_type == simple_backups ? 0 : RENAME_NOREPLACE;
|
|
||||||
- if (renameatu (olddirfd, file + offset, sdir, s + offset, flags) == 0)
|
|
||||||
+ if (renameatu (sdir, file + offset, sdir, s + offset, flags) == 0)
|
|
||||||
break;
|
|
||||||
int e = errno;
|
|
||||||
if (! (e == EEXIST && extended))
|
|
4
sources
4
sources
@ -1,2 +1,2 @@
|
|||||||
SHA512 (coreutils-9.1.tar.xz.sig) = 9f0766531afd4faa3e2c337730f61db55605cf06729e9c61f644594883732c2e0b1ddb0005b492be309c53e6f45b8ff875398163a48699d52517ea49e9bdbc91
|
SHA512 (coreutils-9.2.tar.xz) = 7e3108fefba4ef995cc73c64ac5f4e09827a44649a97ddd624eb61d67ce82da5ed6dc8c0f79d3e269f5cdb7d43877a61ef5b93194dd905bec432a7e31f9f479c
|
||||||
SHA512 (coreutils-9.1.tar.xz) = a6ee2c549140b189e8c1b35e119d4289ec27244ec0ed9da0ac55202f365a7e33778b1dc7c4e64d1669599ff81a8297fe4f5adbcc8a3a2f75c919a43cd4b9bdfa
|
SHA512 (coreutils-9.2.tar.xz.sig) = 4219f3103d829841a11bf1fe42ae277a44347e555fbbaf48e5e87cce48deb96753cb6d25f2571b88685a164acb9f016ff7ea02346b799ce954599fa0124ef070
|
||||||
|
Loading…
Reference in New Issue
Block a user