mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-09-01 22:06:55 +00:00
Bugfix - fix xattr exclude/include for archive create
This makes archive create behavior consistent with the documentation. Without this change xattr include/exclude options are accepted when creating an archive but are silently ignored. * src/xattrs.c (xattrs_xattrs_get): Apply exclude/include mask when fetching extended attributes * tests/Makefile.am: Add new test case. * tests/testsuite.at: Likewise.
This commit is contained in:
committed by
Sergey Poznyakoff
parent
7340f67b98
commit
bb6ddd8e04
+10
-5
@@ -434,8 +434,12 @@ xattrs_clear_setup (void)
|
||||
clear_mask_map (&xattrs_setup.excl);
|
||||
}
|
||||
|
||||
/* get all xattrs from file given by FILE_NAME or FD (when non-zero). This
|
||||
includes all the user.*, security.*, system.*, etc. available domains */
|
||||
static bool xattrs_masked_out (const char *kw, bool archiving);
|
||||
|
||||
/* get xattrs from file given by FILE_NAME or FD (when non-zero)
|
||||
xattrs are checked against the user supplied include/exclude mask
|
||||
if no mask is given this includes all the user.*, security.*, system.*,
|
||||
etc. available domains */
|
||||
void
|
||||
xattrs_xattrs_get (int parentfd, char const *file_name,
|
||||
struct tar_stat_info *st, int fd)
|
||||
@@ -480,8 +484,6 @@ xattrs_xattrs_get (int parentfd, char const *file_name,
|
||||
size_t len = strlen (attr);
|
||||
ssize_t aret = 0;
|
||||
|
||||
/* Archive all xattrs during creation, decide at extraction time
|
||||
* which ones are of interest/use for the target filesystem. */
|
||||
while (((fd == 0)
|
||||
? ((aret = lgetxattrat (parentfd, file_name, attr,
|
||||
val, asz)) == -1)
|
||||
@@ -492,7 +494,10 @@ xattrs_xattrs_get (int parentfd, char const *file_name,
|
||||
}
|
||||
|
||||
if (aret != -1)
|
||||
xheader_xattr_add (st, attr, val, aret);
|
||||
{
|
||||
if (!xattrs_masked_out(attr, true))
|
||||
xheader_xattr_add (st, attr, val, aret);
|
||||
}
|
||||
else if (errno != ENOATTR)
|
||||
call_arg_warn ((fd == 0) ? "lgetxattrat"
|
||||
: "fgetxattr", file_name);
|
||||
|
||||
Reference in New Issue
Block a user