don't set xattrs when --skip-old-files is used
* src/extract.c (set_xattr): Properly handle maybe_recoverable() output. Throw warnings to not complicate caller. (extract_file): Don't handle set_xattr's error. * tests/xattr07.at: New testcase. * tests/Makefile.am: Mention new testcase. * tests/testsuite.at: Likewise. * THANKS: Dawid.
This commit is contained in:
committed by
Sergey Poznyakoff
parent
21c1c29592
commit
597b0ae509
1
THANKS
1
THANKS
@@ -138,6 +138,7 @@ David Nugent davidn@blaze.net.au
|
||||
David Shaw david.shaw@alcatel.com.au
|
||||
David Steiner dsteiner@ispa.uni-osnabrueck.de
|
||||
David Taylor taylor@think.com
|
||||
Dawid dpc@dpc.pw
|
||||
Dean Gaudet dgaudet@watdragon.uwaterloo.ca
|
||||
Demizu Noritoshi nori-d@is.aist-nara.ac.jp
|
||||
Denis Excoffier denis.excoffier@free.fr
|
||||
|
||||
@@ -795,13 +795,13 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
|
||||
in advance dramatically improves the following performance of reading and
|
||||
writing a file). If not restoring permissions, invert the INVERT_PERMISSIONS
|
||||
bits from the file's current permissions. TYPEFLAG specifies the type of the
|
||||
file. FILE_CREATED indicates set_xattr has created the file */
|
||||
file. Returns non-zero when error occurs (while un-available xattrs is not
|
||||
an error, rather no-op). Non-zero FILE_CREATED indicates set_xattr has
|
||||
created the file. */
|
||||
static int
|
||||
set_xattr (char const *file_name, struct tar_stat_info const *st,
|
||||
mode_t invert_permissions, char typeflag, int *file_created)
|
||||
{
|
||||
int status = 0;
|
||||
|
||||
#ifdef HAVE_XATTRS
|
||||
bool interdir_made = false;
|
||||
|
||||
@@ -809,17 +809,32 @@ set_xattr (char const *file_name, struct tar_stat_info const *st,
|
||||
{
|
||||
mode_t mode = current_stat_info.stat.st_mode & MODE_RWX & ~ current_umask;
|
||||
|
||||
do
|
||||
status = mknodat (chdir_fd, file_name, mode ^ invert_permissions, 0);
|
||||
while (status && maybe_recoverable ((char *)file_name, false,
|
||||
&interdir_made));
|
||||
for (;;)
|
||||
{
|
||||
if (!mknodat (chdir_fd, file_name, mode ^ invert_permissions, 0))
|
||||
{
|
||||
/* Successfully created file */
|
||||
xattrs_xattrs_set (st, file_name, typeflag, 0);
|
||||
*file_created = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
xattrs_xattrs_set (st, file_name, typeflag, 0);
|
||||
*file_created = 1;
|
||||
switch (maybe_recoverable ((char *)file_name, false, &interdir_made))
|
||||
{
|
||||
case RECOVER_OK:
|
||||
continue;
|
||||
case RECOVER_NO:
|
||||
skip_member ();
|
||||
open_error (file_name);
|
||||
return 1;
|
||||
case RECOVER_SKIP:
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return(status);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Fix the statuses of all directories whose statuses need fixing, and
|
||||
@@ -1136,11 +1151,7 @@ extract_file (char *file_name, int typeflag)
|
||||
int file_created = 0;
|
||||
if (set_xattr (file_name, ¤t_stat_info, invert_permissions,
|
||||
typeflag, &file_created))
|
||||
{
|
||||
skip_member ();
|
||||
open_error (file_name);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
|
||||
while ((fd = open_output_file (file_name, typeflag, mode,
|
||||
file_created, ¤t_mode,
|
||||
|
||||
@@ -248,6 +248,7 @@ TESTSUITE_AT = \
|
||||
xattr04.at\
|
||||
xattr05.at\
|
||||
xattr06.at\
|
||||
xattr07.at\
|
||||
acls01.at\
|
||||
acls02.at\
|
||||
acls03.at\
|
||||
|
||||
@@ -447,6 +447,7 @@ m4_include([xattr03.at])
|
||||
m4_include([xattr04.at])
|
||||
m4_include([xattr05.at])
|
||||
m4_include([xattr06.at])
|
||||
m4_include([xattr07.at])
|
||||
|
||||
m4_include([acls01.at])
|
||||
m4_include([acls02.at])
|
||||
|
||||
Reference in New Issue
Block a user