maint: switch from ERROR to paxerror etc
Prefer functions like ‘paxerror’ to macros like ‘ERROR’. The functions have cleaner semantics, and calls are easier to read.
This commit is contained in:
131
src/buffer.c
131
src/buffer.c
@@ -456,12 +456,12 @@ open_compressed_archive (void)
|
|||||||
{
|
{
|
||||||
case ct_tar:
|
case ct_tar:
|
||||||
if (shortfile)
|
if (shortfile)
|
||||||
ERROR ((0, 0, _("This does not look like a tar archive")));
|
paxerror (0, _("This does not look like a tar archive"));
|
||||||
return archive;
|
return archive;
|
||||||
|
|
||||||
case ct_none:
|
case ct_none:
|
||||||
if (shortfile)
|
if (shortfile)
|
||||||
ERROR ((0, 0, _("This does not look like a tar archive")));
|
paxerror (0, _("This does not look like a tar archive"));
|
||||||
set_compression_program_by_suffix (archive_name_array[0], NULL,
|
set_compression_program_by_suffix (archive_name_array[0], NULL,
|
||||||
false);
|
false);
|
||||||
if (!use_compress_program_option)
|
if (!use_compress_program_option)
|
||||||
@@ -680,8 +680,7 @@ check_tty (enum access_mode mode)
|
|||||||
if (strcmp (archive_name_array[0], "-") == 0
|
if (strcmp (archive_name_array[0], "-") == 0
|
||||||
&& isatty (mode == ACCESS_READ ? STDIN_FILENO : STDOUT_FILENO))
|
&& isatty (mode == ACCESS_READ ? STDIN_FILENO : STDOUT_FILENO))
|
||||||
{
|
{
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0, (mode == ACCESS_READ
|
||||||
mode == ACCESS_READ
|
|
||||||
? _("Refusing to read archive contents from terminal "
|
? _("Refusing to read archive contents from terminal "
|
||||||
"(missing -f option?)")
|
"(missing -f option?)")
|
||||||
: _("Refusing to write archive contents to terminal "
|
: _("Refusing to write archive contents to terminal "
|
||||||
@@ -726,10 +725,10 @@ _open_archive (enum access_mode wanted_access)
|
|||||||
bool backed_up_flag = false;
|
bool backed_up_flag = false;
|
||||||
|
|
||||||
if (record_size == 0)
|
if (record_size == 0)
|
||||||
FATAL_ERROR ((0, 0, _("Invalid value for record_size")));
|
paxfatal (0, 0, _("Invalid value for record_size"));
|
||||||
|
|
||||||
if (archive_names == 0)
|
if (archive_names == 0)
|
||||||
FATAL_ERROR ((0, 0, _("No archive name given")));
|
paxfatal (0, _("No archive name given"));
|
||||||
|
|
||||||
tar_stat_destroy (¤t_stat_info);
|
tar_stat_destroy (¤t_stat_info);
|
||||||
|
|
||||||
@@ -772,7 +771,7 @@ _open_archive (enum access_mode wanted_access)
|
|||||||
{
|
{
|
||||||
read_full_records = true; /* could be a pipe, be safe */
|
read_full_records = true; /* could be a pipe, be safe */
|
||||||
if (verify_option)
|
if (verify_option)
|
||||||
FATAL_ERROR ((0, 0, _("Cannot verify stdin/stdout archive")));
|
paxfatal (0, _("Cannot verify stdin/stdout archive"));
|
||||||
|
|
||||||
switch (wanted_access)
|
switch (wanted_access)
|
||||||
{
|
{
|
||||||
@@ -784,11 +783,10 @@ _open_archive (enum access_mode wanted_access)
|
|||||||
archive = STDIN_FILENO;
|
archive = STDIN_FILENO;
|
||||||
type = check_compressed_archive (&shortfile);
|
type = check_compressed_archive (&shortfile);
|
||||||
if (type != ct_tar && type != ct_none)
|
if (type != ct_tar && type != ct_none)
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0, _("Archive is compressed. Use %s option"),
|
||||||
_("Archive is compressed. Use %s option"),
|
compress_option (type));
|
||||||
compress_option (type)));
|
|
||||||
if (shortfile)
|
if (shortfile)
|
||||||
ERROR ((0, 0, _("This does not look like a tar archive")));
|
paxerror (0, _("This does not look like a tar archive"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -840,8 +838,7 @@ _open_archive (enum access_mode wanted_access)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0, _("Cannot update compressed archives"));
|
||||||
_("Cannot update compressed archives")));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -928,13 +925,13 @@ archive_read_error (void)
|
|||||||
read_error (*archive_name_cursor);
|
read_error (*archive_name_cursor);
|
||||||
|
|
||||||
if (record_start_block == 0)
|
if (record_start_block == 0)
|
||||||
FATAL_ERROR ((0, 0, _("At beginning of tape, quitting now")));
|
paxfatal (0, _("At beginning of tape, quitting now"));
|
||||||
|
|
||||||
/* Read error in mid archive. We retry up to READ_ERROR_MAX times and
|
/* Read error in mid archive. We retry up to READ_ERROR_MAX times and
|
||||||
then give up on reading the archive. */
|
then give up on reading the archive. */
|
||||||
|
|
||||||
if (read_error_count++ > READ_ERROR_MAX)
|
if (read_error_count++ > READ_ERROR_MAX)
|
||||||
FATAL_ERROR ((0, 0, _("Too many errors, quitting")));
|
paxfatal (0, _("Too many errors, quitting"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -966,11 +963,11 @@ short_read (size_t status)
|
|||||||
&& archive_is_dev ())
|
&& archive_is_dev ())
|
||||||
{
|
{
|
||||||
idx_t rsize = status / BLOCKSIZE;
|
idx_t rsize = status / BLOCKSIZE;
|
||||||
WARN ((0, 0,
|
paxwarn (0,
|
||||||
ngettext ("Record size = %td block",
|
ngettext ("Record size = %td block",
|
||||||
"Record size = %td blocks",
|
"Record size = %td blocks",
|
||||||
rsize),
|
rsize),
|
||||||
rsize));
|
rsize);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (left % BLOCKSIZE != 0
|
while (left % BLOCKSIZE != 0
|
||||||
@@ -987,11 +984,10 @@ short_read (size_t status)
|
|||||||
{
|
{
|
||||||
idx_t rest = record_size - left;
|
idx_t rest = record_size - left;
|
||||||
|
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0, ngettext ("Unaligned block (%td byte) in archive",
|
||||||
ngettext ("Unaligned block (%td byte) in archive",
|
"Unaligned block (%td bytes) in archive",
|
||||||
"Unaligned block (%td bytes) in archive",
|
|
||||||
rest),
|
rest),
|
||||||
rest));
|
rest);
|
||||||
}
|
}
|
||||||
|
|
||||||
left -= status;
|
left -= status;
|
||||||
@@ -1064,8 +1060,8 @@ backspace_output (void)
|
|||||||
{
|
{
|
||||||
/* Lseek failed. Try a different method. */
|
/* Lseek failed. Try a different method. */
|
||||||
|
|
||||||
WARN ((0, 0,
|
paxwarn (0, _("Cannot backspace archive file;"
|
||||||
_("Cannot backspace archive file; it may be unreadable without -i")));
|
" it may be unreadable without -i"));
|
||||||
|
|
||||||
/* Replace the first part of the record with NULs. */
|
/* Replace the first part of the record with NULs. */
|
||||||
|
|
||||||
@@ -1102,7 +1098,7 @@ seek_archive (off_t size)
|
|||||||
return offset;
|
return offset;
|
||||||
|
|
||||||
if (offset % record_size)
|
if (offset % record_size)
|
||||||
FATAL_ERROR ((0, 0, _("rmtlseek not stopped at a record boundary")));
|
paxfatal (0, _("rmtlseek not stopped at a record boundary"));
|
||||||
|
|
||||||
/* Convert to number of records */
|
/* Convert to number of records */
|
||||||
offset /= BLOCKSIZE;
|
offset /= BLOCKSIZE;
|
||||||
@@ -1163,8 +1159,8 @@ init_volume_number (void)
|
|||||||
{
|
{
|
||||||
if (fscanf (file, "%d", &global_volno) != 1
|
if (fscanf (file, "%d", &global_volno) != 1
|
||||||
|| global_volno < 0)
|
|| global_volno < 0)
|
||||||
FATAL_ERROR ((0, 0, _("%s: contains invalid volume number"),
|
paxfatal (0, _("%s: contains invalid volume number"),
|
||||||
quotearg_colon (volno_file_option)));
|
quotearg_colon (volno_file_option));
|
||||||
if (ferror (file))
|
if (ferror (file))
|
||||||
read_error (volno_file_option);
|
read_error (volno_file_option);
|
||||||
if (fclose (file) != 0)
|
if (fclose (file) != 0)
|
||||||
@@ -1198,7 +1194,7 @@ increase_volume_number (void)
|
|||||||
{
|
{
|
||||||
global_volno++;
|
global_volno++;
|
||||||
if (global_volno < 0)
|
if (global_volno < 0)
|
||||||
FATAL_ERROR ((0, 0, _("Volume number overflow")));
|
paxfatal (0, _("Volume number overflow"));
|
||||||
volno++;
|
volno++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1219,12 +1215,12 @@ change_tape_menu (FILE *read_file)
|
|||||||
|
|
||||||
if (getline (&input_buffer, &size, read_file) <= 0)
|
if (getline (&input_buffer, &size, read_file) <= 0)
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("EOF where user reply was expected")));
|
paxwarn (0, _("EOF where user reply was expected"));
|
||||||
|
|
||||||
if (subcommand_option != EXTRACT_SUBCOMMAND
|
if (subcommand_option != EXTRACT_SUBCOMMAND
|
||||||
&& subcommand_option != LIST_SUBCOMMAND
|
&& subcommand_option != LIST_SUBCOMMAND
|
||||||
&& subcommand_option != DIFF_SUBCOMMAND)
|
&& subcommand_option != DIFF_SUBCOMMAND)
|
||||||
WARN ((0, 0, _("WARNING: Archive is incomplete")));
|
paxwarn (0, _("WARNING: Archive is incomplete"));
|
||||||
|
|
||||||
fatal_exit ();
|
fatal_exit ();
|
||||||
}
|
}
|
||||||
@@ -1251,12 +1247,12 @@ change_tape_menu (FILE *read_file)
|
|||||||
case 'q':
|
case 'q':
|
||||||
/* Quit. */
|
/* Quit. */
|
||||||
|
|
||||||
WARN ((0, 0, _("No new volume; exiting.\n")));
|
paxwarn (0, _("No new volume; exiting.\n"));
|
||||||
|
|
||||||
if (subcommand_option != EXTRACT_SUBCOMMAND
|
if (subcommand_option != EXTRACT_SUBCOMMAND
|
||||||
&& subcommand_option != LIST_SUBCOMMAND
|
&& subcommand_option != LIST_SUBCOMMAND
|
||||||
&& subcommand_option != DIFF_SUBCOMMAND)
|
&& subcommand_option != DIFF_SUBCOMMAND)
|
||||||
WARN ((0, 0, _("WARNING: Archive is incomplete")));
|
paxwarn (0, _("WARNING: Archive is incomplete"));
|
||||||
|
|
||||||
fatal_exit ();
|
fatal_exit ();
|
||||||
|
|
||||||
@@ -1347,8 +1343,7 @@ new_volume (enum access_mode mode)
|
|||||||
if (volno_file_option)
|
if (volno_file_option)
|
||||||
closeout_volume_number ();
|
closeout_volume_number ();
|
||||||
if (sys_exec_info_script (archive_name_cursor, global_volno+1))
|
if (sys_exec_info_script (archive_name_cursor, global_volno+1))
|
||||||
FATAL_ERROR ((0, 0, _("%s command failed"),
|
paxfatal (0, _("%s command failed"), quote (info_script_option));
|
||||||
quote (info_script_option)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
change_tape_menu (read_file);
|
change_tape_menu (read_file);
|
||||||
@@ -1409,7 +1404,7 @@ read_header0 (struct tar_stat_info *info)
|
|||||||
set_next_block_after (current_header);
|
set_next_block_after (current_header);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
ERROR ((0, 0, _("This does not look like a tar archive")));
|
paxerror (0, _("This does not look like a tar archive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1446,7 +1441,7 @@ try_new_volume (void)
|
|||||||
header = find_next_block ();
|
header = find_next_block ();
|
||||||
if (!header)
|
if (!header)
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("This does not look like a tar archive")));
|
paxwarn (0, _("This does not look like a tar archive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1458,7 +1453,7 @@ try_new_volume (void)
|
|||||||
if (read_header (&header, &dummy, read_header_x_global)
|
if (read_header (&header, &dummy, read_header_x_global)
|
||||||
!= HEADER_SUCCESS_EXTENDED)
|
!= HEADER_SUCCESS_EXTENDED)
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("This does not look like a tar archive")));
|
paxwarn (0, _("This does not look like a tar archive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1487,7 +1482,7 @@ try_new_volume (void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WARN ((0, 0, _("This does not look like a tar archive")));
|
paxwarn (0, _("This does not look like a tar archive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1522,8 +1517,8 @@ try_new_volume (void)
|
|||||||
{
|
{
|
||||||
if (!continued_file_name)
|
if (!continued_file_name)
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("%s is not continued on this volume"),
|
paxwarn (0, _("%s is not continued on this volume"),
|
||||||
quote (bufmap_head->file_name)));
|
quote (bufmap_head->file_name));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1533,13 +1528,14 @@ try_new_volume (void)
|
|||||||
&& strlen (bufmap_head->file_name) >= NAME_FIELD_SIZE
|
&& strlen (bufmap_head->file_name) >= NAME_FIELD_SIZE
|
||||||
&& strncmp (continued_file_name, bufmap_head->file_name,
|
&& strncmp (continued_file_name, bufmap_head->file_name,
|
||||||
NAME_FIELD_SIZE) == 0)
|
NAME_FIELD_SIZE) == 0)
|
||||||
WARN ((0, 0,
|
paxwarn (0,
|
||||||
_("%s is possibly continued on this volume: header contains truncated name"),
|
_("%s is possibly continued on this volume:"
|
||||||
quote (bufmap_head->file_name)));
|
" header contains truncated name"),
|
||||||
|
quote (bufmap_head->file_name));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("%s is not continued on this volume"),
|
paxwarn (0, _("%s is not continued on this volume"),
|
||||||
quote (bufmap_head->file_name)));
|
quote (bufmap_head->file_name));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1548,21 +1544,21 @@ try_new_volume (void)
|
|||||||
if (ckd_add (&s, continued_file_size, continued_file_offset)
|
if (ckd_add (&s, continued_file_size, continued_file_offset)
|
||||||
|| s != bufmap_head->sizetotal)
|
|| s != bufmap_head->sizetotal)
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("%s is the wrong size (%jd != %ju + %ju)"),
|
paxwarn (0, _("%s is the wrong size (%jd != %ju + %ju)"),
|
||||||
quote (continued_file_name),
|
quote (continued_file_name),
|
||||||
intmax (bufmap_head->sizetotal),
|
intmax (bufmap_head->sizetotal),
|
||||||
uintmax (continued_file_size),
|
uintmax (continued_file_size),
|
||||||
uintmax (continued_file_offset)));
|
uintmax (continued_file_offset));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bufmap_head->sizetotal - bufmap_head->sizeleft
|
if (bufmap_head->sizetotal - bufmap_head->sizeleft
|
||||||
!= continued_file_offset)
|
!= continued_file_offset)
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("This volume is out of sequence (%jd - %jd != %ju)"),
|
paxwarn (0, _("This volume is out of sequence (%jd - %jd != %ju)"),
|
||||||
intmax (bufmap_head->sizetotal),
|
intmax (bufmap_head->sizetotal),
|
||||||
intmax (bufmap_head->sizeleft),
|
intmax (bufmap_head->sizeleft),
|
||||||
uintmax (continued_file_offset)));
|
uintmax (continued_file_offset));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1624,8 +1620,8 @@ match_volume_label (void)
|
|||||||
union block *label = find_next_block ();
|
union block *label = find_next_block ();
|
||||||
|
|
||||||
if (!label)
|
if (!label)
|
||||||
FATAL_ERROR ((0, 0, _("Archive not labeled to match %s"),
|
paxfatal (0, _("Archive not labeled to match %s"),
|
||||||
quote (volume_label_option)));
|
quote (volume_label_option));
|
||||||
if (label->header.typeflag == GNUTYPE_VOLHDR)
|
if (label->header.typeflag == GNUTYPE_VOLHDR)
|
||||||
{
|
{
|
||||||
ASSIGN_STRING_N (&volume_label, label->header.name);
|
ASSIGN_STRING_N (&volume_label, label->header.name);
|
||||||
@@ -1642,13 +1638,13 @@ match_volume_label (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!volume_label)
|
if (!volume_label)
|
||||||
FATAL_ERROR ((0, 0, _("Archive not labeled to match %s"),
|
paxfatal (0, _("Archive not labeled to match %s"),
|
||||||
quote (volume_label_option)));
|
quote (volume_label_option));
|
||||||
|
|
||||||
if (!check_label_pattern (volume_label))
|
if (!check_label_pattern (volume_label))
|
||||||
FATAL_ERROR ((0, 0, _("Volume %s does not match %s"),
|
paxfatal (0, _("Volume %s does not match %s"),
|
||||||
quote_n (0, volume_label),
|
quote_n (0, volume_label),
|
||||||
quote_n (1, volume_label_option)));
|
quote_n (1, volume_label_option));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mark the archive with volume label STR. */
|
/* Mark the archive with volume label STR. */
|
||||||
@@ -1737,9 +1733,10 @@ gnu_add_multi_volume_header (struct bufmap *map)
|
|||||||
|
|
||||||
if (len > NAME_FIELD_SIZE)
|
if (len > NAME_FIELD_SIZE)
|
||||||
{
|
{
|
||||||
WARN ((0, 0,
|
paxwarn (0,
|
||||||
_("%s: file name too long to be stored in a GNU multivolume header, truncated"),
|
_("%s: file name too long to be stored"
|
||||||
quotearg_colon (map->file_name)));
|
" in a GNU multivolume header, truncated"),
|
||||||
|
quotearg_colon (map->file_name));
|
||||||
len = NAME_FIELD_SIZE;
|
len = NAME_FIELD_SIZE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1931,7 +1928,7 @@ _gnu_flush_write (size_t buffer_level)
|
|||||||
|
|
||||||
if (status % BLOCKSIZE)
|
if (status % BLOCKSIZE)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("write did not end on a block boundary")));
|
paxerror (0, _("write did not end on a block boundary"));
|
||||||
archive_write_error (status);
|
archive_write_error (status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ checkpoint_compile_action (const char *str)
|
|||||||
act = alloc_action (cop_sleep);
|
act = alloc_action (cop_sleep);
|
||||||
act->v.time = stoint (arg, &p, NULL, 0, TYPE_MAXIMUM (time_t));
|
act->v.time = stoint (arg, &p, NULL, 0, TYPE_MAXIMUM (time_t));
|
||||||
if ((p == arg) | *p)
|
if ((p == arg) | *p)
|
||||||
FATAL_ERROR ((0, 0, _("%s: not a valid timeout"), str));
|
paxfatal (0, _("%s: not a valid timeout"), str);
|
||||||
}
|
}
|
||||||
else if (strcmp (str, "totals") == 0)
|
else if (strcmp (str, "totals") == 0)
|
||||||
alloc_action (cop_totals);
|
alloc_action (cop_totals);
|
||||||
@@ -143,7 +143,7 @@ checkpoint_compile_action (const char *str)
|
|||||||
sigaddset (&sigs, act->v.signal);
|
sigaddset (&sigs, act->v.signal);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
FATAL_ERROR ((0, 0, _("%s: unknown checkpoint action"), str));
|
paxfatal (0, _("%s: unknown checkpoint action"), str);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -304,10 +304,10 @@ format_checkpoint_string (FILE *fp, size_t len,
|
|||||||
if (wordsplit (arg, &ws,
|
if (wordsplit (arg, &ws,
|
||||||
(WRDSF_NOVAR | WRDSF_NOCMD
|
(WRDSF_NOVAR | WRDSF_NOCMD
|
||||||
| WRDSF_QUOTE | WRDSF_DELIM)))
|
| WRDSF_QUOTE | WRDSF_DELIM)))
|
||||||
ERROR ((0, 0, _("cannot split string '%s': %s"),
|
paxerror (0, _("cannot split string '%s': %s"),
|
||||||
arg, wordsplit_strerror (&ws)));
|
arg, wordsplit_strerror (&ws));
|
||||||
else if (3 < ws.ws_wordc)
|
else if (3 < ws.ws_wordc)
|
||||||
ERROR ((0, 0, _("too many words in '%s'"), arg));
|
paxerror (0, _("too many words in '%s'"), arg);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|||||||
@@ -1027,12 +1027,8 @@ extern int warning_option;
|
|||||||
|
|
||||||
#define WARNING_ENABLED(opt) (warning_option & (opt))
|
#define WARNING_ENABLED(opt) (warning_option & (opt))
|
||||||
|
|
||||||
#define WARNOPT(opt,args) \
|
extern void warnopt (int, int, char const *, ...)
|
||||||
do \
|
ATTRIBUTE_COLD ATTRIBUTE_FORMAT ((printf, 3, 4));
|
||||||
{ \
|
|
||||||
if (WARNING_ENABLED (opt)) WARN (args); \
|
|
||||||
} \
|
|
||||||
while (0)
|
|
||||||
|
|
||||||
/* Module unlink.c */
|
/* Module unlink.c */
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ read_and_process (struct tar_stat_info *st, bool (*processor) (idx_t, char *))
|
|||||||
data_block = find_next_block ();
|
data_block = find_next_block ();
|
||||||
if (! data_block)
|
if (! data_block)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxerror (0, _("Unexpected EOF in archive"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -477,9 +477,9 @@ diff_archive (void)
|
|||||||
switch (current_header->header.typeflag)
|
switch (current_header->header.typeflag)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
ERROR ((0, 0, _("%s: Unknown file type '%c', diffed as normal file"),
|
paxerror (0, _("%s: Unknown file type '%c', diffed as normal file"),
|
||||||
quotearg_colon (current_stat_info.file_name),
|
quotearg_colon (current_stat_info.file_name),
|
||||||
current_header->header.typeflag));
|
current_header->header.typeflag);
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case AREGTYPE:
|
case AREGTYPE:
|
||||||
case REGTYPE:
|
case REGTYPE:
|
||||||
@@ -529,19 +529,17 @@ verify_volume (void)
|
|||||||
int may_fail = 0;
|
int may_fail = 0;
|
||||||
if (removed_prefixes_p ())
|
if (removed_prefixes_p ())
|
||||||
{
|
{
|
||||||
WARN((0, 0,
|
paxwarn (0,
|
||||||
_("Archive contains file names with leading prefixes removed.")));
|
_("Archive contains file names with leading prefixes removed."));
|
||||||
may_fail = 1;
|
may_fail = 1;
|
||||||
}
|
}
|
||||||
if (transform_program_p ())
|
if (transform_program_p ())
|
||||||
{
|
{
|
||||||
WARN((0, 0,
|
paxwarn (0, _("Archive contains transformed file names."));
|
||||||
_("Archive contains transformed file names.")));
|
|
||||||
may_fail = 1;
|
may_fail = 1;
|
||||||
}
|
}
|
||||||
if (may_fail)
|
if (may_fail)
|
||||||
WARN((0, 0,
|
paxwarn (0, _("Verification may fail to locate original files."));
|
||||||
_("Verification may fail to locate original files.")));
|
|
||||||
|
|
||||||
clear_directory_table ();
|
clear_directory_table ();
|
||||||
|
|
||||||
@@ -595,10 +593,11 @@ verify_volume (void)
|
|||||||
}
|
}
|
||||||
while (status == HEADER_FAILURE);
|
while (status == HEADER_FAILURE);
|
||||||
|
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
ngettext ("VERIFY FAILURE: %d invalid header detected",
|
ngettext ("VERIFY FAILURE: %d invalid header detected",
|
||||||
"VERIFY FAILURE: %d invalid headers detected",
|
"VERIFY FAILURE: %d invalid headers detected",
|
||||||
counter), counter));
|
counter),
|
||||||
|
counter);
|
||||||
}
|
}
|
||||||
if (status == HEADER_END_OF_FILE)
|
if (status == HEADER_END_OF_FILE)
|
||||||
break;
|
break;
|
||||||
@@ -611,9 +610,9 @@ verify_volume (void)
|
|||||||
read_header_auto);
|
read_header_auto);
|
||||||
if (status == HEADER_ZERO_BLOCK)
|
if (status == HEADER_ZERO_BLOCK)
|
||||||
break;
|
break;
|
||||||
WARNOPT (WARN_ALONE_ZERO_BLOCK,
|
warnopt (WARN_ALONE_ZERO_BLOCK,
|
||||||
(0, 0, _("A lone zero block at %jd"),
|
0, _("A lone zero block at %jd"),
|
||||||
intmax (current_block_ordinal ())));
|
intmax (current_block_ordinal ()));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
106
src/create.c
106
src/create.c
@@ -69,12 +69,11 @@ exclusion_tag_warning (const char *dirname, const char *tagname,
|
|||||||
const char *message)
|
const char *message)
|
||||||
{
|
{
|
||||||
if (verbose_option)
|
if (verbose_option)
|
||||||
WARNOPT (WARN_CACHEDIR,
|
warnopt (WARN_CACHEDIR, 0,
|
||||||
(0, 0,
|
_("%s: contains a cache directory tag %s; %s"),
|
||||||
_("%s: contains a cache directory tag %s; %s"),
|
quotearg_colon (dirname),
|
||||||
quotearg_colon (dirname),
|
quotearg_n (1, tagname),
|
||||||
quotearg_n (1, tagname),
|
message);
|
||||||
message));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
enum exclusion_tag_type
|
enum exclusion_tag_type
|
||||||
@@ -238,14 +237,14 @@ to_chars_subst (bool negative, bool gnu_format, uintmax_t value, size_t valsize,
|
|||||||
Apart from this they are completely identical. */
|
Apart from this they are completely identical. */
|
||||||
uintmax_t s = (negsub &= archive_format == GNU_FORMAT) ? - sub : sub;
|
uintmax_t s = (negsub &= archive_format == GNU_FORMAT) ? - sub : sub;
|
||||||
char const *ssign = &"-"[!negsub];
|
char const *ssign = &"-"[!negsub];
|
||||||
WARN ((0, 0, _("value %s%ju out of %s range %jd..%ju;"
|
paxwarn (0, _("value %s%ju out of %s range %jd..%ju;"
|
||||||
" substituting %s%ju"),
|
" substituting %s%ju"),
|
||||||
valuesign, value, type, minval, maxval, ssign, s));
|
valuesign, value, type, minval, maxval, ssign, s);
|
||||||
return to_chars (negsub, s, valsize, 0, where, size, type);
|
return to_chars (negsub, s, valsize, 0, where, size, type);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ERROR ((0, 0, _("value %s%ju out of %s range %jd..%ju"),
|
paxerror (0, _("value %s%ju out of %s range %jd..%ju"),
|
||||||
valuesign, value, type, minval, maxval));
|
valuesign, value, type, minval, maxval);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -304,7 +303,7 @@ to_chars (bool negative, uintmax_t value, size_t valsize,
|
|||||||
if (! warned_once)
|
if (! warned_once)
|
||||||
{
|
{
|
||||||
warned_once = true;
|
warned_once = true;
|
||||||
WARN ((0, 0, _("Generating negative octal headers")));
|
paxwarn (0, _("Generating negative octal headers"));
|
||||||
}
|
}
|
||||||
where[size - 1] = '\0';
|
where[size - 1] = '\0';
|
||||||
to_octal (value & MAX_VAL_WITH_DIGITS (valsize * CHAR_BIT, 1),
|
to_octal (value & MAX_VAL_WITH_DIGITS (valsize * CHAR_BIT, 1),
|
||||||
@@ -581,18 +580,17 @@ write_ustar_long_name (const char *name)
|
|||||||
|
|
||||||
if (length > PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1)
|
if (length > PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("%s: file name is too long (max %d); not dumped"),
|
paxerror (0, _("%s: file name is too long (max %d); not dumped"),
|
||||||
quotearg_colon (name),
|
quotearg_colon (name),
|
||||||
PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1));
|
PREFIX_FIELD_SIZE + NAME_FIELD_SIZE + 1);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
i = split_long_name (name, length);
|
i = split_long_name (name, length);
|
||||||
if (i == 0 || (nlen = length - i - 1) > NAME_FIELD_SIZE || nlen == 0)
|
if (i == 0 || (nlen = length - i - 1) > NAME_FIELD_SIZE || nlen == 0)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("%s: file name is too long (cannot be split); not dumped"),
|
||||||
_("%s: file name is too long (cannot be split); not dumped"),
|
quotearg_colon (name));
|
||||||
quotearg_colon (name)));
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -617,9 +615,8 @@ write_long_link (struct tar_stat_info *st)
|
|||||||
case V7_FORMAT: /* old V7 tar format */
|
case V7_FORMAT: /* old V7 tar format */
|
||||||
case USTAR_FORMAT:
|
case USTAR_FORMAT:
|
||||||
case STAR_FORMAT:
|
case STAR_FORMAT:
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("%s: link name is too long; not dumped"),
|
||||||
_("%s: link name is too long; not dumped"),
|
quotearg_colon (st->link_name));
|
||||||
quotearg_colon (st->link_name)));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OLDGNU_FORMAT:
|
case OLDGNU_FORMAT:
|
||||||
@@ -644,9 +641,8 @@ write_long_name (struct tar_stat_info *st)
|
|||||||
case V7_FORMAT:
|
case V7_FORMAT:
|
||||||
if (strlen (st->file_name) > NAME_FIELD_SIZE-1)
|
if (strlen (st->file_name) > NAME_FIELD_SIZE-1)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("%s: file name is too long (max %d); not dumped"),
|
paxerror (0, _("%s: file name is too long (max %d); not dumped"),
|
||||||
quotearg_colon (st->file_name),
|
quotearg_colon (st->file_name), NAME_FIELD_SIZE - 1);
|
||||||
NAME_FIELD_SIZE - 1));
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1080,15 +1076,14 @@ dump_regular_file (int fd, struct tar_stat_info *st)
|
|||||||
if (count != bufsize)
|
if (count != bufsize)
|
||||||
{
|
{
|
||||||
memset (blk->buffer + count, 0, bufsize - count);
|
memset (blk->buffer + count, 0, bufsize - count);
|
||||||
WARNOPT (WARN_FILE_SHRANK,
|
warnopt (WARN_FILE_SHRANK, 0,
|
||||||
(0, 0,
|
ngettext (("%s: File shrank by %jd byte;"
|
||||||
ngettext (("%s: File shrank by %jd byte;"
|
" padding with zeros"),
|
||||||
" padding with zeros"),
|
("%s: File shrank by %jd bytes;"
|
||||||
("%s: File shrank by %jd bytes;"
|
" padding with zeros"),
|
||||||
" padding with zeros"),
|
size_left),
|
||||||
size_left),
|
quotearg_colon (st->orig_file_name),
|
||||||
quotearg_colon (st->orig_file_name),
|
intmax (size_left));
|
||||||
intmax (size_left)));
|
|
||||||
if (! ignore_failed_read_option)
|
if (! ignore_failed_read_option)
|
||||||
set_exit_status (TAREXIT_DIFFERS);
|
set_exit_status (TAREXIT_DIFFERS);
|
||||||
pad_archive (size_left - (bufsize - count));
|
pad_archive (size_left - (bufsize - count));
|
||||||
@@ -1180,10 +1175,9 @@ dump_dir0 (struct tar_stat_info *st, char const *directory)
|
|||||||
&& st->parent->stat.st_dev != st->stat.st_dev)
|
&& st->parent->stat.st_dev != st->stat.st_dev)
|
||||||
{
|
{
|
||||||
if (verbose_option)
|
if (verbose_option)
|
||||||
WARNOPT (WARN_XDEV,
|
warnopt (WARN_XDEV, 0,
|
||||||
(0, 0,
|
_("%s: file is on a different filesystem; not dumped"),
|
||||||
_("%s: file is on a different filesystem; not dumped"),
|
quotearg_colon (st->orig_file_name));
|
||||||
quotearg_colon (st->orig_file_name)));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1433,9 +1427,8 @@ compare_links (void const *entry1, void const *entry2)
|
|||||||
static void
|
static void
|
||||||
unknown_file_error (char const *p)
|
unknown_file_error (char const *p)
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_FILE_IGNORED,
|
warnopt (WARN_FILE_IGNORED, 0,
|
||||||
(0, 0, _("%s: Unknown file type; file ignored"),
|
_("%s: Unknown file type; file ignored"), quotearg_colon (p));
|
||||||
quotearg_colon (p)));
|
|
||||||
if (!ignore_failed_read_option)
|
if (!ignore_failed_read_option)
|
||||||
set_exit_status (TAREXIT_FAILURE);
|
set_exit_status (TAREXIT_FAILURE);
|
||||||
}
|
}
|
||||||
@@ -1535,19 +1528,13 @@ file_count_links (struct tar_stat_info *st)
|
|||||||
void
|
void
|
||||||
check_links (void)
|
check_links (void)
|
||||||
{
|
{
|
||||||
struct link *lp;
|
|
||||||
|
|
||||||
if (!link_table)
|
if (!link_table)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (lp = hash_get_first (link_table); lp;
|
for (struct link *lp = hash_get_first (link_table); lp;
|
||||||
lp = hash_get_next (link_table, lp))
|
lp = hash_get_next (link_table, lp))
|
||||||
{
|
if (lp->nlink)
|
||||||
if (lp->nlink)
|
paxwarn (0, _("Missing links to %s."), quote (lp->name));
|
||||||
{
|
|
||||||
WARN ((0, 0, _("Missing links to %s."), quote (lp->name)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming DIR is the working directory, open FILE, using FLAGS to
|
/* Assuming DIR is the working directory, open FILE, using FLAGS to
|
||||||
@@ -1704,18 +1691,16 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
|
|||||||
&& (!after_date_option || OLDER_TAR_STAT_TIME (*st, c)))
|
&& (!after_date_option || OLDER_TAR_STAT_TIME (*st, c)))
|
||||||
{
|
{
|
||||||
if (!incremental_option && verbose_option)
|
if (!incremental_option && verbose_option)
|
||||||
WARNOPT (WARN_FILE_UNCHANGED,
|
warnopt (WARN_FILE_UNCHANGED, 0, _("%s: file is unchanged; not dumped"),
|
||||||
(0, 0, _("%s: file is unchanged; not dumped"),
|
quotearg_colon (p));
|
||||||
quotearg_colon (p)));
|
|
||||||
return allocated;
|
return allocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* See if we are trying to dump the archive. */
|
/* See if we are trying to dump the archive. */
|
||||||
if (sys_file_is_archive (st))
|
if (sys_file_is_archive (st))
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_IGNORE_ARCHIVE,
|
warnopt (WARN_IGNORE_ARCHIVE, 0,
|
||||||
(0, 0, _("%s: archive cannot contain itself; not dumped"),
|
_("%s: archive cannot contain itself; not dumped"), quotearg_colon (p));
|
||||||
quotearg_colon (p)));
|
|
||||||
return allocated;
|
return allocated;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1835,9 +1820,8 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
|
|||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_FILE_CHANGED,
|
warnopt (WARN_FILE_CHANGED, 0, _("%s: file changed as we read it"),
|
||||||
(0, 0, _("%s: file changed as we read it"),
|
quotearg_colon (p));
|
||||||
quotearg_colon (p)));
|
|
||||||
if (! ignore_failed_read_option)
|
if (! ignore_failed_read_option)
|
||||||
set_exit_status (TAREXIT_DIFFERS);
|
set_exit_status (TAREXIT_DIFFERS);
|
||||||
}
|
}
|
||||||
@@ -1910,14 +1894,12 @@ dump_file0 (struct tar_stat_info *st, char const *name, char const *p)
|
|||||||
}
|
}
|
||||||
else if (S_ISSOCK (st->stat.st_mode))
|
else if (S_ISSOCK (st->stat.st_mode))
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_FILE_IGNORED,
|
warnopt (WARN_FILE_IGNORED, 0, _("%s: socket ignored"), quotearg_colon (p));
|
||||||
(0, 0, _("%s: socket ignored"), quotearg_colon (p)));
|
|
||||||
return allocated;
|
return allocated;
|
||||||
}
|
}
|
||||||
else if (S_ISDOOR (st->stat.st_mode))
|
else if (S_ISDOOR (st->stat.st_mode))
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_FILE_IGNORED,
|
warnopt (WARN_FILE_IGNORED, 0, _("%s: door ignored"), quotearg_colon (p));
|
||||||
(0, 0, _("%s: door ignored"), quotearg_colon (p)));
|
|
||||||
return allocated;
|
return allocated;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -57,7 +57,7 @@ move_archive (off_t count)
|
|||||||
|| ckd_add (&position, move_start, increment)
|
|| ckd_add (&position, move_start, increment)
|
||||||
|| position < 0)
|
|| position < 0)
|
||||||
{
|
{
|
||||||
ERROR ((0, EOVERFLOW, "lseek: %s", archive_name_array[0]));
|
paxerror (EOVERFLOW, "lseek: %s", archive_name_array[0]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (rmtlseek (archive, position, SEEK_SET) == position)
|
else if (rmtlseek (archive, position, SEEK_SET) == position)
|
||||||
@@ -205,12 +205,12 @@ delete_archive_members (void)
|
|||||||
switch (previous_status)
|
switch (previous_status)
|
||||||
{
|
{
|
||||||
case HEADER_STILL_UNREAD:
|
case HEADER_STILL_UNREAD:
|
||||||
WARN ((0, 0, _("This does not look like a tar archive")));
|
paxwarn (0, _("This does not look like a tar archive"));
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case HEADER_SUCCESS:
|
case HEADER_SUCCESS:
|
||||||
case HEADER_SUCCESS_EXTENDED:
|
case HEADER_SUCCESS_EXTENDED:
|
||||||
case HEADER_ZERO_BLOCK:
|
case HEADER_ZERO_BLOCK:
|
||||||
ERROR ((0, 0, _("Skipping to next header")));
|
paxerror (0, _("Skipping to next header"));
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case HEADER_FAILURE:
|
case HEADER_FAILURE:
|
||||||
break;
|
break;
|
||||||
@@ -348,7 +348,7 @@ delete_archive_members (void)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_FAILURE:
|
case HEADER_FAILURE:
|
||||||
ERROR ((0, 0, _("Deleting non-header from archive")));
|
paxerror (0, _("Deleting non-header from archive"));
|
||||||
set_next_block_after (current_header);
|
set_next_block_after (current_header);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -93,7 +93,7 @@ info_attach_exclist (struct tar_stat_info *dir)
|
|||||||
fp = fdopen (fd, "r");
|
fp = fdopen (fd, "r");
|
||||||
if (!fp)
|
if (!fp)
|
||||||
{
|
{
|
||||||
ERROR ((0, errno, _("%s: fdopen failed"), file->name));
|
paxerror (errno, _("%s: fdopen failed"), file->name);
|
||||||
close (fd);
|
close (fd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -110,10 +110,7 @@ info_attach_exclist (struct tar_stat_info *dir)
|
|||||||
FNM_FILE_NAME|EXCLUDE_WILDCARDS|EXCLUDE_ANCHORED,
|
FNM_FILE_NAME|EXCLUDE_WILDCARDS|EXCLUDE_ANCHORED,
|
||||||
'\n',
|
'\n',
|
||||||
vcsfile->data))
|
vcsfile->data))
|
||||||
{
|
paxfatal (errno, "%s", quotearg_colon (file->name));
|
||||||
int e = errno;
|
|
||||||
FATAL_ERROR ((0, e, "%s", quotearg_colon (file->name)));
|
|
||||||
}
|
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
|
|
||||||
ent = xmalloc (sizeof (*ent));
|
ent = xmalloc (sizeof (*ent));
|
||||||
|
|||||||
@@ -369,9 +369,8 @@ static void
|
|||||||
check_time (char const *file_name, struct timespec t)
|
check_time (char const *file_name, struct timespec t)
|
||||||
{
|
{
|
||||||
if (t.tv_sec < 0)
|
if (t.tv_sec < 0)
|
||||||
WARNOPT (WARN_TIMESTAMP,
|
warnopt (WARN_TIMESTAMP, 0, _("%s: implausibly old time stamp %s"),
|
||||||
(0, 0, _("%s: implausibly old time stamp %s"),
|
file_name, tartime (t, true));
|
||||||
file_name, tartime (t, true)));
|
|
||||||
else if (timespec_cmp (volume_start_time, t) < 0)
|
else if (timespec_cmp (volume_start_time, t) < 0)
|
||||||
{
|
{
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
@@ -387,9 +386,8 @@ check_time (char const *file_name, struct timespec t)
|
|||||||
diff.tv_nsec += BILLION;
|
diff.tv_nsec += BILLION;
|
||||||
diff.tv_sec--;
|
diff.tv_sec--;
|
||||||
}
|
}
|
||||||
WARNOPT (WARN_TIMESTAMP,
|
warnopt (WARN_TIMESTAMP, 0, _("%s: time stamp %s is %s s in the future"),
|
||||||
(0, 0, _("%s: time stamp %s is %s s in the future"),
|
file_name, tartime (t, true), code_timespec (diff, buf));
|
||||||
file_name, tartime (t, true), code_timespec (diff, buf)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -653,8 +651,8 @@ repair_delayed_set_stat (char const *dir,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR ((0, 0, _("%s: Unexpected inconsistency when making directory"),
|
paxerror (0, _("%s: Unexpected inconsistency when making directory"),
|
||||||
quotearg_colon (dir)));
|
quotearg_colon (dir));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -891,8 +889,7 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
|
|||||||
switch (old_files_option)
|
switch (old_files_option)
|
||||||
{
|
{
|
||||||
case SKIP_OLD_FILES:
|
case SKIP_OLD_FILES:
|
||||||
WARNOPT (WARN_EXISTING_FILE,
|
warnopt (WARN_EXISTING_FILE, 0, _("%s: skipping existing file"), file_name);
|
||||||
(0, 0, _("%s: skipping existing file"), file_name));
|
|
||||||
return RECOVER_SKIP;
|
return RECOVER_SKIP;
|
||||||
|
|
||||||
case KEEP_OLD_FILES:
|
case KEEP_OLD_FILES:
|
||||||
@@ -1000,9 +997,10 @@ apply_nonancestor_delayed_set_stat (char const *file_name, bool after_links)
|
|||||||
current_mode_mask = ALL_MODE_BITS;
|
current_mode_mask = ALL_MODE_BITS;
|
||||||
if (! (st.st_dev == data->dev && st.st_ino == data->ino))
|
if (! (st.st_dev == data->dev && st.st_ino == data->ino))
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
_("%s: Directory renamed before its status could be extracted"),
|
_("%s: Directory renamed before its status"
|
||||||
quotearg_colon (data->file_name)));
|
" could be extracted"),
|
||||||
|
quotearg_colon (data->file_name));
|
||||||
skip_this_one = 1;
|
skip_this_one = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1223,8 +1221,8 @@ open_output_file (char const *file_name, int typeflag, mode_t mode,
|
|||||||
if (!conttype_diagnosed)
|
if (!conttype_diagnosed)
|
||||||
{
|
{
|
||||||
conttype_diagnosed = 1;
|
conttype_diagnosed = 1;
|
||||||
WARNOPT (WARN_CONTIGUOUS_CAST,
|
warnopt (WARN_CONTIGUOUS_CAST, 0,
|
||||||
(0, 0, _("Extracting contiguous files as regular files")));
|
_("Extracting contiguous files as regular files"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1341,7 +1339,7 @@ extract_file (char *file_name, int typeflag)
|
|||||||
data_block = find_next_block ();
|
data_block = find_next_block ();
|
||||||
if (! data_block)
|
if (! data_block)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxerror (0, _("Unexpected EOF in archive"));
|
||||||
break; /* FIXME: What happens, then? */
|
break; /* FIXME: What happens, then? */
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1611,10 +1609,9 @@ extract_symlink (char *file_name, MAYBE_UNUSED int typeflag)
|
|||||||
if (!warned)
|
if (!warned)
|
||||||
{
|
{
|
||||||
warned = true;
|
warned = true;
|
||||||
WARNOPT (WARN_SYMLINK_CAST,
|
warnopt (WARN_SYMLINK_CAST, 0,
|
||||||
(0, 0,
|
_("Attempting extraction of symbolic links"
|
||||||
_("Attempting extraction of symbolic links"
|
" as hard links"));
|
||||||
" as hard links")));
|
|
||||||
}
|
}
|
||||||
return extract_link (file_name, typeflag);
|
return extract_link (file_name, typeflag);
|
||||||
}
|
}
|
||||||
@@ -1755,21 +1752,19 @@ prepare_to_extract (char const *file_name, int typeflag, tar_extractor_t *fun)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
case GNUTYPE_MULTIVOL:
|
case GNUTYPE_MULTIVOL:
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("%s: Cannot extract -- file is continued from another volume"),
|
||||||
_("%s: Cannot extract -- file is continued from another volume"),
|
quotearg_colon (current_stat_info.file_name));
|
||||||
quotearg_colon (current_stat_info.file_name)));
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
case GNUTYPE_LONGNAME:
|
case GNUTYPE_LONGNAME:
|
||||||
case GNUTYPE_LONGLINK:
|
case GNUTYPE_LONGLINK:
|
||||||
ERROR ((0, 0, _("Unexpected long name header")));
|
paxerror (0, _("Unexpected long name header"));
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
WARNOPT (WARN_UNKNOWN_CAST,
|
warnopt (WARN_UNKNOWN_CAST, 0,
|
||||||
(0, 0,
|
_("%s: Unknown file type '%c', extracted as normal file"),
|
||||||
_("%s: Unknown file type '%c', extracted as normal file"),
|
quotearg_colon (file_name), typeflag);
|
||||||
quotearg_colon (file_name), typeflag));
|
|
||||||
extractor = extract_file;
|
extractor = extract_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1797,9 +1792,8 @@ prepare_to_extract (char const *file_name, int typeflag, tar_extractor_t *fun)
|
|||||||
case KEEP_NEWER_FILES:
|
case KEEP_NEWER_FILES:
|
||||||
if (file_newer_p (file_name, 0, ¤t_stat_info))
|
if (file_newer_p (file_name, 0, ¤t_stat_info))
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_IGNORE_NEWER,
|
warnopt (WARN_IGNORE_NEWER, 0, _("Current %s is newer or same age"),
|
||||||
(0, 0, _("Current %s is newer or same age"),
|
quote (file_name));
|
||||||
quote (file_name)));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1828,8 +1822,8 @@ extract_archive (void)
|
|||||||
skip_dotdot_name = (!absolute_names_option
|
skip_dotdot_name = (!absolute_names_option
|
||||||
&& contains_dot_dot (current_stat_info.orig_file_name));
|
&& contains_dot_dot (current_stat_info.orig_file_name));
|
||||||
if (skip_dotdot_name)
|
if (skip_dotdot_name)
|
||||||
ERROR ((0, 0, _("%s: Member name contains '..'"),
|
paxerror (0, _("%s: Member name contains '..'"),
|
||||||
quotearg_colon (current_stat_info.orig_file_name)));
|
quotearg_colon (current_stat_info.orig_file_name));
|
||||||
|
|
||||||
if (!current_stat_info.file_name[0]
|
if (!current_stat_info.file_name[0]
|
||||||
|| skip_dotdot_name
|
|| skip_dotdot_name
|
||||||
@@ -1859,9 +1853,8 @@ extract_archive (void)
|
|||||||
if (backup_option)
|
if (backup_option)
|
||||||
if (!maybe_backup_file (current_stat_info.file_name, 0))
|
if (!maybe_backup_file (current_stat_info.file_name, 0))
|
||||||
{
|
{
|
||||||
int e = errno;
|
paxerror (errno, _("%s: Was unable to backup this file"),
|
||||||
ERROR ((0, e, _("%s: Was unable to backup this file"),
|
quotearg_colon (current_stat_info.file_name));
|
||||||
quotearg_colon (current_stat_info.file_name)));
|
|
||||||
skip_member ();
|
skip_member ();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -2027,9 +2020,9 @@ rename_directory (char *src, char *dst)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ERROR ((0, e, _("Cannot rename %s to %s"),
|
paxerror (e, _("Cannot rename %s to %s"),
|
||||||
quote_n (0, src),
|
quote_n (0, src),
|
||||||
quote_n (1, dst)));
|
quote_n (1, dst));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
181
src/incremen.c
181
src/incremen.c
@@ -492,11 +492,10 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
|
|||||||
{
|
{
|
||||||
if (strcmp (d->name, name_buffer))
|
if (strcmp (d->name, name_buffer))
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_RENAME_DIRECTORY,
|
warnopt (WARN_RENAME_DIRECTORY, 0,
|
||||||
(0, 0,
|
_("%s: Directory has been renamed from %s"),
|
||||||
_("%s: Directory has been renamed from %s"),
|
quotearg_colon (name_buffer),
|
||||||
quotearg_colon (name_buffer),
|
quote_n (1, d->name));
|
||||||
quote_n (1, d->name)));
|
|
||||||
directory->orig = d;
|
directory->orig = d;
|
||||||
DIR_SET_FLAG (directory, DIRF_RENAMED);
|
DIR_SET_FLAG (directory, DIRF_RENAMED);
|
||||||
DIR_CLEAR_FLAG (d, DIRF_RENAMED);
|
DIR_CLEAR_FLAG (d, DIRF_RENAMED);
|
||||||
@@ -536,10 +535,10 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
|
|||||||
{
|
{
|
||||||
if (strcmp (d->name, name_buffer))
|
if (strcmp (d->name, name_buffer))
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_RENAME_DIRECTORY,
|
warnopt (WARN_RENAME_DIRECTORY, 0,
|
||||||
(0, 0, _("%s: Directory has been renamed from %s"),
|
_("%s: Directory has been renamed from %s"),
|
||||||
quotearg_colon (name_buffer),
|
quotearg_colon (name_buffer),
|
||||||
quote_n (1, d->name)));
|
quote_n (1, d->name));
|
||||||
directory->orig = d;
|
directory->orig = d;
|
||||||
DIR_SET_FLAG (directory, DIRF_RENAMED);
|
DIR_SET_FLAG (directory, DIRF_RENAMED);
|
||||||
DIR_CLEAR_FLAG (d, DIRF_RENAMED);
|
DIR_CLEAR_FLAG (d, DIRF_RENAMED);
|
||||||
@@ -550,9 +549,8 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
DIR_SET_FLAG (directory, DIRF_NEW);
|
DIR_SET_FLAG (directory, DIRF_NEW);
|
||||||
WARNOPT (WARN_NEW_DIRECTORY,
|
warnopt (WARN_NEW_DIRECTORY, 0, _("%s: Directory is new"),
|
||||||
(0, 0, _("%s: Directory is new"),
|
quotearg_colon (name_buffer));
|
||||||
quotearg_colon (name_buffer)));
|
|
||||||
directory->children =
|
directory->children =
|
||||||
(listed_incremental_option
|
(listed_incremental_option
|
||||||
|| (OLDER_STAT_TIME (*stat_data, m)
|
|| (OLDER_STAT_TIME (*stat_data, m)
|
||||||
@@ -566,10 +564,9 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
|
|||||||
if (one_file_system_option && st->parent
|
if (one_file_system_option && st->parent
|
||||||
&& stat_data->st_dev != st->parent->stat.st_dev)
|
&& stat_data->st_dev != st->parent->stat.st_dev)
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_XDEV,
|
warnopt (WARN_XDEV, 0,
|
||||||
(0, 0,
|
_("%s: directory is on a different filesystem; not dumped"),
|
||||||
_("%s: directory is on a different filesystem; not dumped"),
|
quotearg_colon (directory->name));
|
||||||
quotearg_colon (directory->name)));
|
|
||||||
directory->children = NO_CHILDREN;
|
directory->children = NO_CHILDREN;
|
||||||
/* If there is any dumpdir info in that directory, remove it */
|
/* If there is any dumpdir info in that directory, remove it */
|
||||||
if (directory->dump)
|
if (directory->dump)
|
||||||
@@ -588,9 +585,8 @@ procdir (const char *name_buffer, struct tar_stat_info *st,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (perhaps_renamed)
|
if (perhaps_renamed)
|
||||||
WARNOPT (WARN_RENAME_DIRECTORY,
|
warnopt (WARN_RENAME_DIRECTORY, 0, _("%s: Directory has been renamed"),
|
||||||
(0, 0, _("%s: Directory has been renamed"),
|
quotearg_colon (name_buffer));
|
||||||
quotearg_colon (name_buffer)));
|
|
||||||
|
|
||||||
DIR_SET_FLAG (directory, DIRF_INIT);
|
DIR_SET_FLAG (directory, DIRF_INIT);
|
||||||
|
|
||||||
@@ -995,10 +991,9 @@ read_incr_db_01 (int version, const char *initbuf)
|
|||||||
newer_mtime_option = decode_timespec (buf, &ebuf, false);
|
newer_mtime_option = decode_timespec (buf, &ebuf, false);
|
||||||
|
|
||||||
if (! valid_timespec (newer_mtime_option))
|
if (! valid_timespec (newer_mtime_option))
|
||||||
FATAL_ERROR ((0, errno, "%s:%jd: %s",
|
paxfatal (errno, "%s:%jd: %s",
|
||||||
quotearg_colon (listed_incremental_option),
|
quotearg_colon (listed_incremental_option),
|
||||||
lineno,
|
lineno, _("Invalid time stamp"));
|
||||||
_("Invalid time stamp")));
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (version == 1 && *ebuf)
|
if (version == 1 && *ebuf)
|
||||||
@@ -1009,10 +1004,9 @@ read_incr_db_01 (int version, const char *initbuf)
|
|||||||
= stoint (buf_ns, &ebuf, &overflow, 0, BILLION - 1);
|
= stoint (buf_ns, &ebuf, &overflow, 0, BILLION - 1);
|
||||||
if ((ebuf == buf_ns) | *ebuf | overflow)
|
if ((ebuf == buf_ns) | *ebuf | overflow)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, "%s:%jd: %s",
|
paxerror (0, "%s:%jd: %s",
|
||||||
quotearg_colon (listed_incremental_option),
|
quotearg_colon (listed_incremental_option), lineno,
|
||||||
lineno,
|
_("Invalid time stamp"));
|
||||||
_("Invalid time stamp")));
|
|
||||||
newer_mtime_option.tv_sec = TYPE_MINIMUM (time_t);
|
newer_mtime_option.tv_sec = TYPE_MINIMUM (time_t);
|
||||||
newer_mtime_option.tv_nsec = -1;
|
newer_mtime_option.tv_nsec = -1;
|
||||||
}
|
}
|
||||||
@@ -1037,17 +1031,17 @@ read_incr_db_01 (int version, const char *initbuf)
|
|||||||
mtime = decode_timespec (strp, &ebuf, false);
|
mtime = decode_timespec (strp, &ebuf, false);
|
||||||
strp = ebuf;
|
strp = ebuf;
|
||||||
if (!valid_timespec (mtime) || *strp != ' ')
|
if (!valid_timespec (mtime) || *strp != ' ')
|
||||||
FATAL_ERROR ((0, errno, "%s:%jd: %s",
|
paxfatal (errno, "%s:%jd: %s",
|
||||||
quotearg_colon (listed_incremental_option), lineno,
|
quotearg_colon (listed_incremental_option), lineno,
|
||||||
_("Invalid modification time")));
|
_("Invalid modification time"));
|
||||||
|
|
||||||
bool overflow;
|
bool overflow;
|
||||||
mtime.tv_nsec = stoint (strp, &ebuf, &overflow, 0, BILLION - 1);
|
mtime.tv_nsec = stoint (strp, &ebuf, &overflow, 0, BILLION - 1);
|
||||||
if ((ebuf == strp) | (*ebuf != ' ') | overflow)
|
if ((ebuf == strp) | (*ebuf != ' ') | overflow)
|
||||||
{
|
{
|
||||||
FATAL_ERROR ((0, 0, "%s:%jd: %s",
|
paxfatal (0, "%s:%jd: %s",
|
||||||
quotearg_colon (listed_incremental_option), lineno,
|
quotearg_colon (listed_incremental_option), lineno,
|
||||||
_("Invalid modification time (nanoseconds)")));
|
_("Invalid modification time (nanoseconds)"));
|
||||||
mtime.tv_nsec = -1;
|
mtime.tv_nsec = -1;
|
||||||
}
|
}
|
||||||
strp = ebuf;
|
strp = ebuf;
|
||||||
@@ -1059,17 +1053,17 @@ read_incr_db_01 (int version, const char *initbuf)
|
|||||||
dev = stoint (strp, &ebuf, &overflow,
|
dev = stoint (strp, &ebuf, &overflow,
|
||||||
TYPE_MINIMUM (dev_t), TYPE_MAXIMUM (dev_t));
|
TYPE_MINIMUM (dev_t), TYPE_MAXIMUM (dev_t));
|
||||||
if ((ebuf == strp) | (*ebuf != ' ') | overflow)
|
if ((ebuf == strp) | (*ebuf != ' ') | overflow)
|
||||||
FATAL_ERROR ((0, 0, "%s:%jd: %s",
|
paxfatal (0, "%s:%jd: %s",
|
||||||
quotearg_colon (listed_incremental_option), lineno,
|
quotearg_colon (listed_incremental_option), lineno,
|
||||||
_("Invalid device number")));
|
_("Invalid device number"));
|
||||||
strp = ebuf + 1;
|
strp = ebuf + 1;
|
||||||
|
|
||||||
ino = stoint (strp, &ebuf, &overflow,
|
ino = stoint (strp, &ebuf, &overflow,
|
||||||
TYPE_MINIMUM (ino_t), TYPE_MAXIMUM (ino_t));
|
TYPE_MINIMUM (ino_t), TYPE_MAXIMUM (ino_t));
|
||||||
if ((ebuf == strp) | (*ebuf != ' ') | overflow)
|
if ((ebuf == strp) | (*ebuf != ' ') | overflow)
|
||||||
FATAL_ERROR ((0, 0, "%s:%jd: %s",
|
paxfatal (0, "%s:%jd: %s",
|
||||||
quotearg_colon (listed_incremental_option), lineno,
|
quotearg_colon (listed_incremental_option), lineno,
|
||||||
_("Invalid inode number")));
|
_("Invalid inode number"));
|
||||||
strp = ebuf + 1;
|
strp = ebuf + 1;
|
||||||
|
|
||||||
unquote_string (strp);
|
unquote_string (strp);
|
||||||
@@ -1120,11 +1114,11 @@ read_num (FILE *fp, char const *fieldname,
|
|||||||
{
|
{
|
||||||
buf[i] = c;
|
buf[i] = c;
|
||||||
if (i == sizeof buf - 1)
|
if (i == sizeof buf - 1)
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0,
|
||||||
_("%s: byte %jd: %s %.*s... too long"),
|
_("%s: byte %jd: %s %.*s... too long"),
|
||||||
quotearg_colon (listed_incremental_option),
|
quotearg_colon (listed_incremental_option),
|
||||||
intmax (ftello (fp)),
|
intmax (ftello (fp)),
|
||||||
fieldname, i + 1, buf));
|
fieldname, i + 1, buf);
|
||||||
c = getc (fp);
|
c = getc (fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1135,20 +1129,18 @@ read_num (FILE *fp, char const *fieldname,
|
|||||||
if (ferror (fp))
|
if (ferror (fp))
|
||||||
read_fatal (listed_incremental_option);
|
read_fatal (listed_incremental_option);
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
FATAL_ERROR ((0, 0, "%s: %s",
|
paxfatal (0, "%s: %s",
|
||||||
quotearg_colon (listed_incremental_option),
|
quotearg_colon (listed_incremental_option),
|
||||||
_("Unexpected EOF in snapshot file")));
|
_("Unexpected EOF in snapshot file"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c)
|
if (c)
|
||||||
{
|
{
|
||||||
unsigned uc = c;
|
unsigned uc = c;
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0, _("%s: byte %jd: %s %s followed by invalid byte 0x%02x"),
|
||||||
_("%s: byte %jd: %s %s followed by invalid byte 0x%02x"),
|
quotearg_colon (listed_incremental_option),
|
||||||
quotearg_colon (listed_incremental_option),
|
intmax (ftello (fp)), fieldname, buf, uc);
|
||||||
intmax (ftello (fp)),
|
|
||||||
fieldname, buf, uc));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *bufend;
|
char *bufend;
|
||||||
@@ -1156,15 +1148,13 @@ read_num (FILE *fp, char const *fieldname,
|
|||||||
*pval = stoint (buf, &bufend, &overflow, min_val, max_val);
|
*pval = stoint (buf, &bufend, &overflow, min_val, max_val);
|
||||||
|
|
||||||
if (buf == bufend)
|
if (buf == bufend)
|
||||||
FATAL_ERROR ((0, EINVAL,
|
paxfatal (EINVAL, _("%s: byte %jd: %s %s"),
|
||||||
_("%s: byte %jd: %s %s"),
|
quotearg_colon (listed_incremental_option),
|
||||||
quotearg_colon (listed_incremental_option),
|
intmax (ftello (fp)), fieldname, buf);
|
||||||
intmax (ftello (fp)), fieldname, buf));
|
|
||||||
if (overflow)
|
if (overflow)
|
||||||
FATAL_ERROR ((0, ERANGE,
|
paxfatal (ERANGE, _("%s: byte %jd: (valid range %jd..%ju)\n\t%s %s"),
|
||||||
_("%s: byte %jd: (valid range %jd..%ju)\n\t%s %s"),
|
quotearg_colon (listed_incremental_option),
|
||||||
quotearg_colon (listed_incremental_option),
|
intmax (ftello (fp)), min_val, max_val, fieldname, buf);
|
||||||
intmax (ftello (fp)), min_val, max_val, fieldname, buf));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1187,9 +1177,8 @@ read_timespec (FILE *fp, struct timespec *pval)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FATAL_ERROR ((0, 0, "%s: %s",
|
paxfatal (0, "%s: %s", quotearg_colon (listed_incremental_option),
|
||||||
quotearg_colon (listed_incremental_option),
|
_("Unexpected EOF in snapshot file"));
|
||||||
_("Unexpected EOF in snapshot file")));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1240,18 +1229,17 @@ read_incr_db_2 (void)
|
|||||||
while (read_obstack (listed_incremental_stream, &stk, &s) == 0 && s > 1)
|
while (read_obstack (listed_incremental_stream, &stk, &s) == 0 && s > 1)
|
||||||
;
|
;
|
||||||
if (getc (listed_incremental_stream) != 0)
|
if (getc (listed_incremental_stream) != 0)
|
||||||
FATAL_ERROR ((0, 0, _("%s: byte %s: %s"),
|
paxfatal (0, _("%s: byte %s: %s"),
|
||||||
quotearg_colon (listed_incremental_option),
|
quotearg_colon (listed_incremental_option),
|
||||||
offtostr (ftello (listed_incremental_stream), offbuf),
|
offtostr (ftello (listed_incremental_stream), offbuf),
|
||||||
_("Missing record terminator")));
|
_("Missing record terminator"));
|
||||||
|
|
||||||
content = obstack_finish (&stk);
|
content = obstack_finish (&stk);
|
||||||
note_directory (name, mtime, dev, ino, nfs, false, content);
|
note_directory (name, mtime, dev, ino, nfs, false, content);
|
||||||
obstack_free (&stk, content);
|
obstack_free (&stk, content);
|
||||||
}
|
}
|
||||||
FATAL_ERROR ((0, 0, "%s: %s",
|
paxfatal (0, "%s: %s", quotearg_colon (listed_incremental_option),
|
||||||
quotearg_colon (listed_incremental_option),
|
_("Unexpected EOF in snapshot file"));
|
||||||
_("Unexpected EOF in snapshot file")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display (to stdout) the range of allowed values for each field
|
/* Display (to stdout) the range of allowed values for each field
|
||||||
@@ -1349,17 +1337,15 @@ read_directory_file (void)
|
|||||||
{
|
{
|
||||||
ebuf = buf + sizeof PACKAGE_NAME - 1;
|
ebuf = buf + sizeof PACKAGE_NAME - 1;
|
||||||
if (*ebuf++ != '-')
|
if (*ebuf++ != '-')
|
||||||
FATAL_ERROR ((0, 0, _("Bad incremental file format")));
|
paxfatal (0, _("Bad incremental file format"));
|
||||||
for (; *ebuf != '-'; ebuf++)
|
for (; *ebuf != '-'; ebuf++)
|
||||||
if (!*ebuf)
|
if (!*ebuf)
|
||||||
FATAL_ERROR ((0, 0, _("Bad incremental file format")));
|
paxfatal (0, _("Bad incremental file format"));
|
||||||
|
|
||||||
ebuf++;
|
ebuf++;
|
||||||
if (! ('0' <= *ebuf && *ebuf <= '0' + TAR_INCREMENTAL_VERSION
|
if (! ('0' <= *ebuf && *ebuf <= '0' + TAR_INCREMENTAL_VERSION
|
||||||
&& !c_isdigit (ebuf[1])))
|
&& !c_isdigit (ebuf[1])))
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0, _("Unsupported incremental format version: %s"), ebuf);
|
||||||
_("Unsupported incremental format version: %s"),
|
|
||||||
ebuf));
|
|
||||||
incremental_version = *ebuf - '0';
|
incremental_version = *ebuf - '0';
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1483,7 +1469,7 @@ get_gnu_dumpdir (struct tar_stat_info *stat_info)
|
|||||||
mv_size_left (size);
|
mv_size_left (size);
|
||||||
data_block = find_next_block ();
|
data_block = find_next_block ();
|
||||||
if (!data_block)
|
if (!data_block)
|
||||||
FATAL_ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxfatal (0, _("Unexpected EOF in archive"));
|
||||||
copied = available_space_after (data_block);
|
copied = available_space_after (data_block);
|
||||||
if (copied > size)
|
if (copied > size)
|
||||||
copied = size;
|
copied = size;
|
||||||
@@ -1523,9 +1509,8 @@ dumpdir_ok (char *dumpdir)
|
|||||||
if (expect && *p != expect)
|
if (expect && *p != expect)
|
||||||
{
|
{
|
||||||
unsigned char uc = *p;
|
unsigned char uc = *p;
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Malformed dumpdir: expected '%c' but found %#3o"),
|
||||||
_("Malformed dumpdir: expected '%c' but found %#3o"),
|
expect, uc);
|
||||||
expect, uc));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
switch (*p)
|
switch (*p)
|
||||||
@@ -1533,8 +1518,7 @@ dumpdir_ok (char *dumpdir)
|
|||||||
case 'X':
|
case 'X':
|
||||||
if (has_tempdir)
|
if (has_tempdir)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Malformed dumpdir: 'X' duplicated"));
|
||||||
_("Malformed dumpdir: 'X' duplicated")));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1546,8 +1530,7 @@ dumpdir_ok (char *dumpdir)
|
|||||||
{
|
{
|
||||||
if (!has_tempdir)
|
if (!has_tempdir)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Malformed dumpdir: empty name in 'R'"));
|
||||||
_("Malformed dumpdir: empty name in 'R'")));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1559,14 +1542,12 @@ dumpdir_ok (char *dumpdir)
|
|||||||
case 'T':
|
case 'T':
|
||||||
if (expect != 'T')
|
if (expect != 'T')
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Malformed dumpdir: 'T' not preceded by 'R'"));
|
||||||
_("Malformed dumpdir: 'T' not preceded by 'R'")));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (p[1] == 0 && !has_tempdir)
|
if (p[1] == 0 && !has_tempdir)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Malformed dumpdir: empty name in 'T'"));
|
||||||
_("Malformed dumpdir: empty name in 'T'")));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
expect = 0;
|
expect = 0;
|
||||||
@@ -1585,15 +1566,12 @@ dumpdir_ok (char *dumpdir)
|
|||||||
|
|
||||||
if (expect)
|
if (expect)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Malformed dumpdir: expected '%c' but found end of data"), expect);
|
||||||
_("Malformed dumpdir: expected '%c' but found end of data"),
|
|
||||||
expect));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (has_tempdir)
|
if (has_tempdir)
|
||||||
WARNOPT (WARN_BAD_DUMPDIR,
|
warnopt (WARN_BAD_DUMPDIR, 0, _("Malformed dumpdir: 'X' never used"));
|
||||||
(0, 0, _("Malformed dumpdir: 'X' never used")));
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1636,9 +1614,8 @@ try_purge_directory (char const *directory_name)
|
|||||||
sizeof TEMP_DIR_TEMPLATE);
|
sizeof TEMP_DIR_TEMPLATE);
|
||||||
if (!mkdtemp (temp_stub))
|
if (!mkdtemp (temp_stub))
|
||||||
{
|
{
|
||||||
ERROR ((0, errno,
|
paxerror (errno, _("Cannot create temporary directory using template %s"),
|
||||||
_("Cannot create temporary directory using template %s"),
|
quote (temp_stub));
|
||||||
quote (temp_stub)));
|
|
||||||
free (temp_stub);
|
free (temp_stub);
|
||||||
free (current_dir);
|
free (current_dir);
|
||||||
return false;
|
return false;
|
||||||
@@ -1698,8 +1675,8 @@ try_purge_directory (char const *directory_name)
|
|||||||
dirs and check it here? */
|
dirs and check it here? */
|
||||||
{
|
{
|
||||||
stat_diag (p);
|
stat_diag (p);
|
||||||
WARN ((0, 0, _("%s: Not purging directory: unable to stat"),
|
paxwarn (0, _("%s: Not purging directory: unable to stat"),
|
||||||
quotearg_colon (p)));
|
quotearg_colon (p));
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1710,9 +1687,8 @@ try_purge_directory (char const *directory_name)
|
|||||||
{
|
{
|
||||||
if (one_file_system_option && st.st_dev != root_device)
|
if (one_file_system_option && st.st_dev != root_device)
|
||||||
{
|
{
|
||||||
WARN ((0, 0,
|
paxwarn (0, _("%s: directory is on a different device: not purging"),
|
||||||
_("%s: directory is on a different device: not purging"),
|
quotearg_colon (p));
|
||||||
quotearg_colon (p)));
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1722,10 +1698,7 @@ try_purge_directory (char const *directory_name)
|
|||||||
fprintf (stdlis, _("%s: Deleting %s\n"),
|
fprintf (stdlis, _("%s: Deleting %s\n"),
|
||||||
program_name, quote (p));
|
program_name, quote (p));
|
||||||
if (! remove_any_file (p, RECURSIVE_REMOVE_OPTION))
|
if (! remove_any_file (p, RECURSIVE_REMOVE_OPTION))
|
||||||
{
|
paxerror (errno, _("%s: Cannot remove"), quotearg_colon (p));
|
||||||
int e = errno;
|
|
||||||
ERROR ((0, e, _("%s: Cannot remove"), quotearg_colon (p)));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
75
src/list.c
75
src/list.c
@@ -216,8 +216,8 @@ read_and (void (*do_something) (void))
|
|||||||
|
|
||||||
case DIRTYPE:
|
case DIRTYPE:
|
||||||
if (show_omitted_dirs_option)
|
if (show_omitted_dirs_option)
|
||||||
WARN ((0, 0, _("%s: Omitting"),
|
paxwarn (0, _("%s: Omitting"),
|
||||||
quotearg_colon (current_stat_info.file_name)));
|
quotearg_colon (current_stat_info.file_name));
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
default:
|
default:
|
||||||
skip_member ();
|
skip_member ();
|
||||||
@@ -243,9 +243,8 @@ read_and (void (*do_something) (void))
|
|||||||
read_header_auto);
|
read_header_auto);
|
||||||
if (status == HEADER_ZERO_BLOCK)
|
if (status == HEADER_ZERO_BLOCK)
|
||||||
break;
|
break;
|
||||||
WARNOPT (WARN_ALONE_ZERO_BLOCK,
|
warnopt (WARN_ALONE_ZERO_BLOCK, 0, _("A lone zero block at %jd"),
|
||||||
(0, 0, _("A lone zero block at %jd"),
|
intmax (current_block_ordinal ()));
|
||||||
intmax (current_block_ordinal ())));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
status = prev_status;
|
status = prev_status;
|
||||||
@@ -253,9 +252,9 @@ read_and (void (*do_something) (void))
|
|||||||
|
|
||||||
case HEADER_END_OF_FILE:
|
case HEADER_END_OF_FILE:
|
||||||
if (!ignore_zeros_option)
|
if (!ignore_zeros_option)
|
||||||
WARNOPT (WARN_MISSING_ZERO_BLOCKS,
|
warnopt (WARN_MISSING_ZERO_BLOCKS, 0,
|
||||||
(0, 0, _("Terminating zero blocks missing at %jd"),
|
_("Terminating zero blocks missing at %jd"),
|
||||||
intmax (current_block_ordinal ())));
|
intmax (current_block_ordinal ()));
|
||||||
if (block_number_option)
|
if (block_number_option)
|
||||||
fprintf (stdlis, _("block %jd: ** End of File **\n"),
|
fprintf (stdlis, _("block %jd: ** End of File **\n"),
|
||||||
intmax (current_block_ordinal ()));
|
intmax (current_block_ordinal ()));
|
||||||
@@ -268,7 +267,7 @@ read_and (void (*do_something) (void))
|
|||||||
switch (prev_status)
|
switch (prev_status)
|
||||||
{
|
{
|
||||||
case HEADER_STILL_UNREAD:
|
case HEADER_STILL_UNREAD:
|
||||||
ERROR ((0, 0, _("This does not look like a tar archive")));
|
paxerror (0, _("This does not look like a tar archive"));
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case HEADER_ZERO_BLOCK:
|
case HEADER_ZERO_BLOCK:
|
||||||
case HEADER_SUCCESS:
|
case HEADER_SUCCESS:
|
||||||
@@ -280,7 +279,7 @@ read_and (void (*do_something) (void))
|
|||||||
fprintf (stdlis, _("block %jd: "),
|
fprintf (stdlis, _("block %jd: "),
|
||||||
intmax (block_ordinal));
|
intmax (block_ordinal));
|
||||||
}
|
}
|
||||||
ERROR ((0, 0, _("Skipping to next header")));
|
paxerror (0, _("Skipping to next header"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case HEADER_END_OF_FILE:
|
case HEADER_END_OF_FILE:
|
||||||
@@ -476,7 +475,7 @@ read_header (union block **return_block, struct tar_stat_info *info,
|
|||||||
data_block = find_next_block ();
|
data_block = find_next_block ();
|
||||||
if (! data_block)
|
if (! data_block)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxerror (0, _("Unexpected EOF in archive"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
written = available_space_after (data_block);
|
written = available_space_after (data_block);
|
||||||
@@ -750,11 +749,11 @@ from_header (char const *where0, size_t digs, char const *type,
|
|||||||
if (where == lim)
|
if (where == lim)
|
||||||
{
|
{
|
||||||
if (type && !silent)
|
if (type && !silent)
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
/* TRANSLATORS: %s is type of the value (gid_t, uid_t,
|
/* TRANSLATORS: %s is type of the value (gid_t, uid_t,
|
||||||
etc.) */
|
etc.) */
|
||||||
_("Blanks in header where numeric %s value expected"),
|
_("Blanks in header where numeric %s value expected"),
|
||||||
type));
|
type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
if (!c_isspace (*where))
|
if (!c_isspace (*where))
|
||||||
@@ -803,10 +802,11 @@ from_header (char const *where0, size_t digs, char const *type,
|
|||||||
if (!overflow && value <= minus_minval)
|
if (!overflow && value <= minus_minval)
|
||||||
{
|
{
|
||||||
if (!silent)
|
if (!silent)
|
||||||
WARN ((0, 0,
|
paxwarn (0,
|
||||||
/* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
|
/* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
|
||||||
_("Archive octal value %.*s is out of %s range; assuming two's complement"),
|
_("Archive octal value %.*s is out of %s range;"
|
||||||
(int) (where - where1), where1, type));
|
" assuming two's complement"),
|
||||||
|
(int) (where - where1), where1, type);
|
||||||
negative = true;
|
negative = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -814,10 +814,10 @@ from_header (char const *where0, size_t digs, char const *type,
|
|||||||
if (overflow)
|
if (overflow)
|
||||||
{
|
{
|
||||||
if (type && !silent)
|
if (type && !silent)
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
/* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
|
/* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
|
||||||
_("Archive octal value %.*s is out of %s range"),
|
_("Archive octal value %.*s is out of %s range"),
|
||||||
(int) (where - where1), where1, type));
|
(int) (where - where1), where1, type);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -836,7 +836,7 @@ from_header (char const *where0, size_t digs, char const *type,
|
|||||||
if (! warned_once)
|
if (! warned_once)
|
||||||
{
|
{
|
||||||
warned_once = true;
|
warned_once = true;
|
||||||
WARN ((0, 0, _("Archive contains obsolescent base-64 headers")));
|
paxwarn (0, _("Archive contains obsolescent base-64 headers"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
negative = *where++ == '-';
|
negative = *where++ == '-';
|
||||||
@@ -849,9 +849,8 @@ from_header (char const *where0, size_t digs, char const *type,
|
|||||||
if (ckd_mul (&value, value, 64))
|
if (ckd_mul (&value, value, 64))
|
||||||
{
|
{
|
||||||
if (type && !silent)
|
if (type && !silent)
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Archive signed base-64 string %s is out of %s range"),
|
||||||
_("Archive signed base-64 string %s is out of %s range"),
|
quote_mem (where0, digs), type);
|
||||||
quote_mem (where0, digs), type));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
value |= dig - 1;
|
value |= dig - 1;
|
||||||
@@ -881,9 +880,7 @@ from_header (char const *where0, size_t digs, char const *type,
|
|||||||
if (((value << LG_256 >> LG_256) | topbits) != value)
|
if (((value << LG_256 >> LG_256) | topbits) != value)
|
||||||
{
|
{
|
||||||
if (type && !silent)
|
if (type && !silent)
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Archive base-256 value is out of %s range"), type);
|
||||||
_("Archive base-256 value is out of %s range"),
|
|
||||||
type));
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -909,10 +906,10 @@ from_header (char const *where0, size_t digs, char const *type,
|
|||||||
lim--;
|
lim--;
|
||||||
quotearg_buffer (buf, sizeof buf, where0, lim - where0, o);
|
quotearg_buffer (buf, sizeof buf, where0, lim - where0, o);
|
||||||
if (!silent)
|
if (!silent)
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
/* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
|
/* TRANSLATORS: Second %s is a type name (gid_t,uid_t,etc.) */
|
||||||
_("Archive contains %.*s where numeric %s value expected"),
|
_("Archive contains %.*s where numeric %s value expected"),
|
||||||
(int) sizeof buf, buf, type));
|
(int) sizeof buf, buf, type);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -925,8 +922,8 @@ from_header (char const *where0, size_t digs, char const *type,
|
|||||||
{
|
{
|
||||||
char const *value_sign = &"-"[!negative];
|
char const *value_sign = &"-"[!negative];
|
||||||
/* TRANSLATORS: Second %s is type name (gid_t,uid_t,etc.) */
|
/* TRANSLATORS: Second %s is type name (gid_t,uid_t,etc.) */
|
||||||
ERROR ((0, 0, _("Archive value %s%ju is out of %s range %jd..%ju"),
|
paxerror (0, _("Archive value %s%ju is out of %s range %jd..%ju"),
|
||||||
value_sign, value, type, minval, maxval));
|
value_sign, value, type, minval, maxval);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@@ -1150,7 +1147,7 @@ simple_print_header (struct tar_stat_info *st, union block *blk,
|
|||||||
case GNUTYPE_LONGNAME:
|
case GNUTYPE_LONGNAME:
|
||||||
case GNUTYPE_LONGLINK:
|
case GNUTYPE_LONGLINK:
|
||||||
modes[0] = 'L';
|
modes[0] = 'L';
|
||||||
ERROR ((0, 0, _("Unexpected long name header")));
|
paxerror (0, _("Unexpected long name header"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case GNUTYPE_SPARSE:
|
case GNUTYPE_SPARSE:
|
||||||
@@ -1387,7 +1384,7 @@ skim_file (off_t size, bool must_copy)
|
|||||||
{
|
{
|
||||||
x = find_next_block ();
|
x = find_next_block ();
|
||||||
if (! x)
|
if (! x)
|
||||||
FATAL_ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxfatal (0, _("Unexpected EOF in archive"));
|
||||||
|
|
||||||
set_next_block_after (x);
|
set_next_block_after (x);
|
||||||
size -= BLOCKSIZE;
|
size -= BLOCKSIZE;
|
||||||
|
|||||||
@@ -98,8 +98,8 @@ map_read (Hash_table **ptab, char const *file,
|
|||||||
|
|
||||||
++line;
|
++line;
|
||||||
if (wordsplit (buf, &ws, wsopt))
|
if (wordsplit (buf, &ws, wsopt))
|
||||||
FATAL_ERROR ((0, 0, _("%s:%jd: cannot split line: %s"),
|
paxfatal (0, _("%s:%jd: cannot split line: %s"),
|
||||||
file, line, wordsplit_strerror (&ws)));
|
file, line, wordsplit_strerror (&ws));
|
||||||
wsopt |= WRDSF_REUSE;
|
wsopt |= WRDSF_REUSE;
|
||||||
if (ws.ws_wordc == 0)
|
if (ws.ws_wordc == 0)
|
||||||
continue;
|
continue;
|
||||||
@@ -177,7 +177,7 @@ map_read (Hash_table **ptab, char const *file,
|
|||||||
wordsplit_free (&ws);
|
wordsplit_free (&ws);
|
||||||
fclose (fp);
|
fclose (fp);
|
||||||
if (err)
|
if (err)
|
||||||
FATAL_ERROR ((0, 0, _("errors reading map file")));
|
paxfatal (0, _("errors reading map file"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* UID translation */
|
/* UID translation */
|
||||||
|
|||||||
17
src/misc.c
17
src/misc.c
@@ -798,9 +798,9 @@ maybe_backup_file (const char *file_name, bool this_is_the_archive)
|
|||||||
{
|
{
|
||||||
/* The backup operation failed. */
|
/* The backup operation failed. */
|
||||||
int e = errno;
|
int e = errno;
|
||||||
ERROR ((0, e, _("%s: Cannot rename to %s"),
|
paxerror (e, _("%s: Cannot rename to %s"),
|
||||||
quotearg_colon (before_backup_name),
|
quotearg_colon (before_backup_name),
|
||||||
quote_n (1, after_backup_name)));
|
quote_n (1, after_backup_name));
|
||||||
assign_null (&after_backup_name);
|
assign_null (&after_backup_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -817,9 +817,9 @@ undo_last_backup (void)
|
|||||||
!= 0)
|
!= 0)
|
||||||
{
|
{
|
||||||
int e = errno;
|
int e = errno;
|
||||||
ERROR ((0, e, _("%s: Cannot rename to %s"),
|
paxerror (e, _("%s: Cannot rename to %s"),
|
||||||
quotearg_colon (after_backup_name),
|
quotearg_colon (after_backup_name),
|
||||||
quote_n (1, before_backup_name)));
|
quote_n (1, before_backup_name));
|
||||||
}
|
}
|
||||||
if (verbose_option)
|
if (verbose_option)
|
||||||
fprintf (stdlis, _("Renaming %s back to %s\n"),
|
fprintf (stdlis, _("Renaming %s back to %s\n"),
|
||||||
@@ -1201,9 +1201,8 @@ file_removed_diag (const char *name, bool top_level,
|
|||||||
{
|
{
|
||||||
if (!top_level && errno == ENOENT)
|
if (!top_level && errno == ENOENT)
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_FILE_REMOVED,
|
warnopt (WARN_FILE_REMOVED, 0, _("%s: File removed before we read it"),
|
||||||
(0, 0, _("%s: File removed before we read it"),
|
quotearg_colon (name));
|
||||||
quotearg_colon (name)));
|
|
||||||
set_exit_status (TAREXIT_DIFFERS);
|
set_exit_status (TAREXIT_DIFFERS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
74
src/names.c
74
src/names.c
@@ -385,10 +385,7 @@ handle_file_selection_option (int key, const char *arg)
|
|||||||
case 'X':
|
case 'X':
|
||||||
if (add_exclude_file (add_exclude, excluded, arg, EXCLUDE_OPTIONS, '\n')
|
if (add_exclude_file (add_exclude, excluded, arg, EXCLUDE_OPTIONS, '\n')
|
||||||
!= 0)
|
!= 0)
|
||||||
{
|
paxfatal (errno, "%s", quotearg_colon (arg));
|
||||||
int e = errno;
|
|
||||||
FATAL_ERROR ((0, e, "%s", quotearg_colon (arg)));
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ANCHORED_OPTION:
|
case ANCHORED_OPTION:
|
||||||
@@ -433,7 +430,7 @@ handle_file_selection_option (int key, const char *arg)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
FATAL_ERROR ((0, 0, "unhandled positional option %d", key));
|
paxfatal (0, "unhandled positional option %d", key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -745,7 +742,10 @@ unconsumed_option_report (void)
|
|||||||
{
|
{
|
||||||
struct name_elt *elt;
|
struct name_elt *elt;
|
||||||
|
|
||||||
ERROR ((0, 0, _("The following options were used after non-option arguments. These options are positional and affect only arguments that follow them. Please, rearrange them properly.")));
|
paxerror (0, _("The following options were used after non-option arguments."
|
||||||
|
" These options are positional and affect"
|
||||||
|
" only arguments that follow them."
|
||||||
|
" Please, rearrange them properly."));
|
||||||
|
|
||||||
elt = unconsumed_option_tail;
|
elt = unconsumed_option_tail;
|
||||||
while (elt->prev)
|
while (elt->prev)
|
||||||
@@ -756,17 +756,17 @@ unconsumed_option_report (void)
|
|||||||
switch (elt->type)
|
switch (elt->type)
|
||||||
{
|
{
|
||||||
case NELT_CHDIR:
|
case NELT_CHDIR:
|
||||||
ERROR ((0, 0, _("-C %s has no effect"), quote (elt->v.name)));
|
paxerror (0, _("-C %s has no effect"), quote (elt->v.name));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NELT_OPTION:
|
case NELT_OPTION:
|
||||||
if (elt->v.opt.arg)
|
if (elt->v.opt.arg)
|
||||||
ERROR ((0, 0, _("--%s %s has no effect"),
|
paxerror (0, _("--%s %s has no effect"),
|
||||||
file_selection_option_name (elt->v.opt.option),
|
file_selection_option_name (elt->v.opt.option),
|
||||||
quote (elt->v.opt.arg)));
|
quote (elt->v.opt.arg));
|
||||||
else
|
else
|
||||||
ERROR ((0, 0, _("--%s has no effect"),
|
paxerror (0, _("--%s has no effect"),
|
||||||
file_selection_option_name (elt->v.opt.option)));
|
file_selection_option_name (elt->v.opt.option));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -917,10 +917,9 @@ add_file_id (const char *filename)
|
|||||||
if (p->ino == st.st_ino && p->dev == st.st_dev)
|
if (p->ino == st.st_ino && p->dev == st.st_dev)
|
||||||
{
|
{
|
||||||
int oldc = set_char_quoting (NULL, ':', 1);
|
int oldc = set_char_quoting (NULL, ':', 1);
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("%s: file list requested from %s already read from %s"),
|
||||||
_("%s: file list requested from %s already read from %s"),
|
quotearg_n (0, filename),
|
||||||
quotearg_n (0, filename),
|
reading_from, p->from_file);
|
||||||
reading_from, p->from_file));
|
|
||||||
set_char_quoting (NULL, ':', oldc);
|
set_char_quoting (NULL, ':', oldc);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -997,11 +996,11 @@ handle_option (const char *str, struct name_elt const *ent)
|
|||||||
|
|
||||||
ws.ws_offs = 1;
|
ws.ws_offs = 1;
|
||||||
if (wordsplit (str, &ws, WRDSF_DEFFLAGS|WRDSF_DOOFFS))
|
if (wordsplit (str, &ws, WRDSF_DEFFLAGS|WRDSF_DOOFFS))
|
||||||
FATAL_ERROR ((0, 0, _("cannot split string '%s': %s"),
|
paxfatal (0, _("cannot split string '%s': %s"),
|
||||||
str, wordsplit_strerror (&ws)));
|
str, wordsplit_strerror (&ws));
|
||||||
int argc;
|
int argc;
|
||||||
if (ckd_add (&argc, ws.ws_wordc, ws.ws_offs))
|
if (ckd_add (&argc, ws.ws_wordc, ws.ws_offs))
|
||||||
FATAL_ERROR ((0, 0, _("too many options")));
|
paxfatal (0, _("too many options"));
|
||||||
ws.ws_wordv[0] = (char *) program_name;
|
ws.ws_wordv[0] = (char *) program_name;
|
||||||
loc.source = OPTS_FILE;
|
loc.source = OPTS_FILE;
|
||||||
loc.name = ent->v.file.name;
|
loc.name = ent->v.file.name;
|
||||||
@@ -1046,9 +1045,9 @@ read_next_name (struct name_elt *ent, struct name_elt *ret)
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
case file_list_zero:
|
case file_list_zero:
|
||||||
WARNOPT (WARN_FILENAME_WITH_NULS,
|
warnopt (WARN_FILENAME_WITH_NULS, 0,
|
||||||
(0, 0, N_("%s: file name read contains nul character"),
|
N_("%s: file name read contains nul character"),
|
||||||
quotearg_colon (ent->v.file.name)));
|
quotearg_colon (ent->v.file.name));
|
||||||
ent->v.file.term = 0;
|
ent->v.file.term = 0;
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case file_list_success:
|
case file_list_success:
|
||||||
@@ -1410,11 +1409,9 @@ regex_usage_warning (const char *name)
|
|||||||
&& fnmatch_pattern_has_wildcards (name, 0))
|
&& fnmatch_pattern_has_wildcards (name, 0))
|
||||||
{
|
{
|
||||||
warned_once = 1;
|
warned_once = 1;
|
||||||
WARN ((0, 0,
|
paxwarn (0, _("Pattern matching characters used in file names"));
|
||||||
_("Pattern matching characters used in file names")));
|
paxwarn (0, _("Use --wildcards to enable pattern matching,"
|
||||||
WARN ((0, 0,
|
" or --no-wildcards to suppress this warning"));
|
||||||
_("Use --wildcards to enable pattern matching,"
|
|
||||||
" or --no-wildcards to suppress this warning")));
|
|
||||||
}
|
}
|
||||||
return warned_once;
|
return warned_once;
|
||||||
}
|
}
|
||||||
@@ -1429,11 +1426,11 @@ names_notfound (void)
|
|||||||
if (!WASFOUND (cursor) && cursor->name[0])
|
if (!WASFOUND (cursor) && cursor->name[0])
|
||||||
{
|
{
|
||||||
regex_usage_warning (cursor->name);
|
regex_usage_warning (cursor->name);
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
(cursor->found_count == 0) ?
|
(cursor->found_count == 0
|
||||||
_("%s: Not found in archive") :
|
? _("%s: Not found in archive")
|
||||||
_("%s: Required occurrence not found in archive"),
|
: _("%s: Required occurrence not found in archive")),
|
||||||
quotearg_colon (cursor->name)));
|
quotearg_colon (cursor->name));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Don't bother freeing the name list; we're about to exit. */
|
/* Don't bother freeing the name list; we're about to exit. */
|
||||||
@@ -1447,8 +1444,7 @@ names_notfound (void)
|
|||||||
while ((name = name_next (true)))
|
while ((name = name_next (true)))
|
||||||
{
|
{
|
||||||
regex_usage_warning (name);
|
regex_usage_warning (name);
|
||||||
ERROR ((0, 0, _("%s: Not found in archive"),
|
paxerror (0, _("%s: Not found in archive"), quotearg_colon (name));
|
||||||
quotearg_colon (name)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1760,15 +1756,13 @@ collect_and_sort_names (void)
|
|||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
if (namelist->change_dir == 0)
|
if (namelist->change_dir == 0)
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("Using -C option inside file list is not "
|
||||||
_("Using -C option inside file list is not "
|
"allowed with --listed-incremental"));
|
||||||
"allowed with --listed-incremental")));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("Only one -C option is allowed with "
|
||||||
_("Only one -C option is allowed with "
|
"--listed-incremental"));
|
||||||
"--listed-incremental")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
read_directory_file ();
|
read_directory_file ();
|
||||||
|
|||||||
52
src/sparse.c
52
src/sparse.c
@@ -360,8 +360,7 @@ sparse_scan_file (struct tar_sparse_file *file)
|
|||||||
return true;
|
return true;
|
||||||
#else
|
#else
|
||||||
if (hole_detection == HOLE_DETECTION_SEEK)
|
if (hole_detection == HOLE_DETECTION_SEEK)
|
||||||
WARN((0, 0,
|
paxwarn (0, _("\"seek\" hole detection is not supported, using \"raw\"."));
|
||||||
_("\"seek\" hole detection is not supported, using \"raw\".")));
|
|
||||||
/* fall back to "raw" for this and all other files */
|
/* fall back to "raw" for this and all other files */
|
||||||
hole_detection = HOLE_DETECTION_RAW;
|
hole_detection = HOLE_DETECTION_RAW;
|
||||||
#endif
|
#endif
|
||||||
@@ -454,13 +453,12 @@ sparse_dump_region (struct tar_sparse_file *file, size_t i)
|
|||||||
+ file->stat_info->sparse_map[i].numbytes
|
+ file->stat_info->sparse_map[i].numbytes
|
||||||
- bytes_left);
|
- bytes_left);
|
||||||
|
|
||||||
WARNOPT (WARN_FILE_SHRANK,
|
warnopt (WARN_FILE_SHRANK, 0,
|
||||||
(0, 0,
|
ngettext ("%s: File shrank by %jd byte; padding with zeros",
|
||||||
ngettext ("%s: File shrank by %jd byte; padding with zeros",
|
"%s: File shrank by %jd bytes; padding with zeros",
|
||||||
"%s: File shrank by %jd bytes; padding with zeros",
|
n),
|
||||||
n),
|
quotearg_colon (file->stat_info->orig_file_name),
|
||||||
quotearg_colon (file->stat_info->orig_file_name),
|
intmax (n));
|
||||||
intmax (n)));
|
|
||||||
if (! ignore_failed_read_option)
|
if (! ignore_failed_read_option)
|
||||||
set_exit_status (TAREXIT_DIFFERS);
|
set_exit_status (TAREXIT_DIFFERS);
|
||||||
return false;
|
return false;
|
||||||
@@ -498,7 +496,7 @@ sparse_extract_region (struct tar_sparse_file *file, size_t i)
|
|||||||
union block *blk = find_next_block ();
|
union block *blk = find_next_block ();
|
||||||
if (!blk)
|
if (!blk)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxerror (0, _("Unexpected EOF in archive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
set_next_block_after (blk);
|
set_next_block_after (blk);
|
||||||
@@ -684,7 +682,7 @@ check_data_region (struct tar_sparse_file *file, size_t i)
|
|||||||
union block *blk = find_next_block ();
|
union block *blk = find_next_block ();
|
||||||
if (!blk)
|
if (!blk)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxerror (0, _("Unexpected EOF in archive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
set_next_block_after (blk);
|
set_next_block_after (blk);
|
||||||
@@ -843,7 +841,7 @@ oldgnu_get_sparse_info (struct tar_sparse_file *file)
|
|||||||
h = find_next_block ();
|
h = find_next_block ();
|
||||||
if (!h)
|
if (!h)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxerror (0, _("Unexpected EOF in archive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
set_next_block_after (h);
|
set_next_block_after (h);
|
||||||
@@ -853,8 +851,8 @@ oldgnu_get_sparse_info (struct tar_sparse_file *file)
|
|||||||
|
|
||||||
if (rc == add_fail)
|
if (rc == add_fail)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("%s: invalid sparse archive member"),
|
paxerror (0, _("%s: invalid sparse archive member"),
|
||||||
file->stat_info->orig_file_name));
|
file->stat_info->orig_file_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -975,7 +973,7 @@ star_get_sparse_info (struct tar_sparse_file *file)
|
|||||||
h = find_next_block ();
|
h = find_next_block ();
|
||||||
if (!h)
|
if (!h)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxerror (0, _("Unexpected EOF in archive"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
set_next_block_after (h);
|
set_next_block_after (h);
|
||||||
@@ -986,8 +984,8 @@ star_get_sparse_info (struct tar_sparse_file *file)
|
|||||||
|
|
||||||
if (rc == add_fail)
|
if (rc == add_fail)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("%s: invalid sparse archive member"),
|
paxerror (0, _("%s: invalid sparse archive member"),
|
||||||
file->stat_info->orig_file_name));
|
file->stat_info->orig_file_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -1279,8 +1277,8 @@ pax_decode_header (struct tar_sparse_file *file)
|
|||||||
{ \
|
{ \
|
||||||
if (dst == buf + UINTMAX_STRSIZE_BOUND -1) \
|
if (dst == buf + UINTMAX_STRSIZE_BOUND -1) \
|
||||||
{ \
|
{ \
|
||||||
ERROR ((0, 0, _("%s: numeric overflow in sparse archive member"), \
|
paxerror (0, _("%s: numeric overflow in sparse archive member"), \
|
||||||
file->stat_info->orig_file_name)); \
|
file->stat_info->orig_file_name); \
|
||||||
return false; \
|
return false; \
|
||||||
} \
|
} \
|
||||||
if (src == endp) \
|
if (src == endp) \
|
||||||
@@ -1288,7 +1286,7 @@ pax_decode_header (struct tar_sparse_file *file)
|
|||||||
set_next_block_after (b); \
|
set_next_block_after (b); \
|
||||||
b = find_next_block (); \
|
b = find_next_block (); \
|
||||||
if (!b) \
|
if (!b) \
|
||||||
FATAL_ERROR ((0, 0, _("Unexpected EOF in archive"))); \
|
paxfatal (0, _("Unexpected EOF in archive")); \
|
||||||
src = b->buffer; \
|
src = b->buffer; \
|
||||||
endp = b->buffer + BLOCKSIZE; \
|
endp = b->buffer + BLOCKSIZE; \
|
||||||
} \
|
} \
|
||||||
@@ -1302,13 +1300,13 @@ pax_decode_header (struct tar_sparse_file *file)
|
|||||||
set_next_block_after (current_header);
|
set_next_block_after (current_header);
|
||||||
blk = find_next_block ();
|
blk = find_next_block ();
|
||||||
if (!blk)
|
if (!blk)
|
||||||
FATAL_ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxfatal (0, _("Unexpected EOF in archive"));
|
||||||
p = blk->buffer;
|
p = blk->buffer;
|
||||||
COPY_BUF (blk,nbuf,p);
|
COPY_BUF (blk,nbuf,p);
|
||||||
if (!decode_num (&u, nbuf, SIZE_MAX))
|
if (!decode_num (&u, nbuf, SIZE_MAX))
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("%s: malformed sparse archive member"),
|
paxerror (0, _("%s: malformed sparse archive member"),
|
||||||
file->stat_info->orig_file_name));
|
file->stat_info->orig_file_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
file->stat_info->sparse_map_size = u;
|
file->stat_info->sparse_map_size = u;
|
||||||
@@ -1322,8 +1320,8 @@ pax_decode_header (struct tar_sparse_file *file)
|
|||||||
COPY_BUF (blk,nbuf,p);
|
COPY_BUF (blk,nbuf,p);
|
||||||
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))
|
if (!decode_num (&u, nbuf, TYPE_MAXIMUM (off_t)))
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("%s: malformed sparse archive member"),
|
paxerror (0, _("%s: malformed sparse archive member"),
|
||||||
file->stat_info->orig_file_name));
|
file->stat_info->orig_file_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sp.offset = u;
|
sp.offset = u;
|
||||||
@@ -1333,8 +1331,8 @@ pax_decode_header (struct tar_sparse_file *file)
|
|||||||
|| ckd_add (&size, sp.offset, u)
|
|| ckd_add (&size, sp.offset, u)
|
||||||
|| file->stat_info->stat.st_size < size)
|
|| file->stat_info->stat.st_size < size)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("%s: malformed sparse archive member"),
|
paxerror (0, _("%s: malformed sparse archive member"),
|
||||||
file->stat_info->orig_file_name));
|
file->stat_info->orig_file_name);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
sp.numbytes = u;
|
sp.numbytes = u;
|
||||||
|
|||||||
10
src/suffix.c
10
src/suffix.c
@@ -103,11 +103,11 @@ set_compression_program_by_suffix (const char *name, const char *defprog,
|
|||||||
{
|
{
|
||||||
use_compress_program_option = defprog;
|
use_compress_program_option = defprog;
|
||||||
if (len > 0 && verbose)
|
if (len > 0 && verbose)
|
||||||
WARN ((0, 0,
|
paxwarn (0,
|
||||||
_("no compression program is defined for suffix '%s';"
|
_("no compression program is defined for suffix '%s';"
|
||||||
" assuming %s"),
|
" assuming %s"),
|
||||||
name + len,
|
name + len,
|
||||||
defprog ? defprog : "uncompressed archive"));
|
defprog ? defprog : "uncompressed archive");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
68
src/system.c
68
src/system.c
@@ -147,14 +147,14 @@ sys_write_archive_buffer (void)
|
|||||||
void
|
void
|
||||||
sys_child_open_for_compress (void)
|
sys_child_open_for_compress (void)
|
||||||
{
|
{
|
||||||
FATAL_ERROR ((0, 0, _("Cannot use compressed or remote archives")));
|
paxfatal (0, _("Cannot use compressed or remote archives"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set ARCHIVE for uncompressing, then reading an archive. */
|
/* Set ARCHIVE for uncompressing, then reading an archive. */
|
||||||
void
|
void
|
||||||
sys_child_open_for_uncompress (void)
|
sys_child_open_for_uncompress (void)
|
||||||
{
|
{
|
||||||
FATAL_ERROR ((0, 0, _("Cannot use compressed or remote archives")));
|
paxfatal (0, _("Cannot use compressed or remote archives"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -164,7 +164,7 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
const char *fmt,
|
const char *fmt,
|
||||||
struct timespec *ts)
|
struct timespec *ts)
|
||||||
{
|
{
|
||||||
FATAL_ERROR ((0, 0, _("--set-mtime-command not implemented on this platform")));
|
paxfatal (0, _("--set-mtime-command not implemented on this platform"));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -233,11 +233,11 @@ sys_wait_for_child (pid_t child_pid, bool eof)
|
|||||||
{
|
{
|
||||||
int sig = WTERMSIG (wait_status);
|
int sig = WTERMSIG (wait_status);
|
||||||
if (!(!eof && sig == SIGPIPE))
|
if (!(!eof && sig == SIGPIPE))
|
||||||
FATAL_ERROR ((0, 0, _("Child died with signal %d"), sig));
|
paxfatal (0, _("Child died with signal %d"), sig);
|
||||||
}
|
}
|
||||||
else if (WEXITSTATUS (wait_status) != 0)
|
else if (WEXITSTATUS (wait_status) != 0)
|
||||||
FATAL_ERROR ((0, 0, _("Child returned status %d"),
|
paxfatal (0, _("Child returned status %d"),
|
||||||
WEXITSTATUS (wait_status)));
|
WEXITSTATUS (wait_status));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -328,10 +328,7 @@ xdup2 (int from, int into)
|
|||||||
if (from != into)
|
if (from != into)
|
||||||
{
|
{
|
||||||
if (dup2 (from, into) < 0)
|
if (dup2 (from, into) < 0)
|
||||||
{
|
paxfatal (errno, _("Cannot dup2"));
|
||||||
int e = errno;
|
|
||||||
FATAL_ERROR ((0, e, _("Cannot dup2")));
|
|
||||||
}
|
|
||||||
xclose (from);
|
xclose (from);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -517,14 +514,12 @@ run_decompress_program (void)
|
|||||||
{
|
{
|
||||||
if (prog)
|
if (prog)
|
||||||
{
|
{
|
||||||
WARNOPT (WARN_DECOMPRESS_PROGRAM,
|
warnopt (WARN_DECOMPRESS_PROGRAM, errno, _("cannot run %s"), prog);
|
||||||
(0, errno, _("cannot run %s"), prog));
|
warnopt (WARN_DECOMPRESS_PROGRAM, 0, _("trying %s"), p);
|
||||||
WARNOPT (WARN_DECOMPRESS_PROGRAM,
|
|
||||||
(0, 0, _("trying %s"), p));
|
|
||||||
}
|
}
|
||||||
if (wordsplit (p, &ws, wsflags))
|
if (wordsplit (p, &ws, wsflags))
|
||||||
FATAL_ERROR ((0, 0, _("cannot split string '%s': %s"),
|
paxfatal (0, _("cannot split string '%s': %s"),
|
||||||
p, wordsplit_strerror (&ws)));
|
p, wordsplit_strerror (&ws));
|
||||||
wsflags |= WRDSF_REUSE;
|
wsflags |= WRDSF_REUSE;
|
||||||
memmove (ws.ws_wordv, ws.ws_wordv + ws.ws_offs,
|
memmove (ws.ws_wordv, ws.ws_wordv + ws.ws_offs,
|
||||||
ws.ws_wordc * sizeof *ws.ws_wordv);
|
ws.ws_wordc * sizeof *ws.ws_wordv);
|
||||||
@@ -534,7 +529,7 @@ run_decompress_program (void)
|
|||||||
ws.ws_wordv[ws.ws_wordc] = NULL;
|
ws.ws_wordv[ws.ws_wordc] = NULL;
|
||||||
}
|
}
|
||||||
if (!prog)
|
if (!prog)
|
||||||
FATAL_ERROR ((0, 0, _("unable to run decompression program")));
|
paxfatal (0, _("unable to run decompression program"));
|
||||||
exec_fatal (prog);
|
exec_fatal (prog);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -805,17 +800,17 @@ sys_wait_command (void)
|
|||||||
if (WIFEXITED (status))
|
if (WIFEXITED (status))
|
||||||
{
|
{
|
||||||
if (!ignore_command_error_option && WEXITSTATUS (status))
|
if (!ignore_command_error_option && WEXITSTATUS (status))
|
||||||
ERROR ((0, 0, _("%jd: Child returned status %d"),
|
paxerror (0, _("%jd: Child returned status %d"),
|
||||||
intmax (global_pid), WEXITSTATUS (status)));
|
intmax (global_pid), WEXITSTATUS (status));
|
||||||
}
|
}
|
||||||
else if (WIFSIGNALED (status))
|
else if (WIFSIGNALED (status))
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("%jd: Child terminated on signal %d"),
|
paxwarn (0, _("%jd: Child terminated on signal %d"),
|
||||||
intmax (global_pid), WTERMSIG (status)));
|
intmax (global_pid), WTERMSIG (status));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ERROR ((0, 0, _("%jd: Child terminated on unknown reason"),
|
paxerror (0, _("%jd: Child terminated on unknown reason"),
|
||||||
intmax (global_pid)));
|
intmax (global_pid));
|
||||||
|
|
||||||
global_pid = -1;
|
global_pid = -1;
|
||||||
}
|
}
|
||||||
@@ -951,7 +946,7 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
int rc = 0;
|
int rc = 0;
|
||||||
|
|
||||||
if (pipe (p))
|
if (pipe (p))
|
||||||
FATAL_ERROR ((0, errno, _("pipe failed")));
|
paxfatal (errno, _("pipe failed"));
|
||||||
|
|
||||||
if ((pid = xfork ()) == 0)
|
if ((pid = xfork ()) == 0)
|
||||||
{
|
{
|
||||||
@@ -964,12 +959,12 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
if (dirfd != AT_FDCWD)
|
if (dirfd != AT_FDCWD)
|
||||||
{
|
{
|
||||||
if (fchdir (dirfd))
|
if (fchdir (dirfd))
|
||||||
FATAL_ERROR ((0, errno, _("chdir failed")));
|
paxfatal (errno, _("chdir failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
close (p[0]);
|
close (p[0]);
|
||||||
if (dup2 (p[1], STDOUT_FILENO) < 0)
|
if (dup2 (p[1], STDOUT_FILENO) < 0)
|
||||||
FATAL_ERROR ((0, errno, _("dup2 failed")));
|
paxfatal (errno, _("dup2 failed"));
|
||||||
if (p[1] != STDOUT_FILENO)
|
if (p[1] != STDOUT_FILENO)
|
||||||
close (p[1]);
|
close (p[1]);
|
||||||
|
|
||||||
@@ -992,7 +987,7 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
{
|
{
|
||||||
if (errno != EINTR)
|
if (errno != EINTR)
|
||||||
{
|
{
|
||||||
ERROR ((0, errno, _("poll failed")));
|
paxerror (errno, _("poll failed"));
|
||||||
stop = 1;
|
stop = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1010,7 +1005,7 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
ssize_t nread = read (pfd.fd, buffer + buflen, bufsize - buflen);
|
ssize_t nread = read (pfd.fd, buffer + buflen, bufsize - buflen);
|
||||||
if (nread < 0)
|
if (nread < 0)
|
||||||
{
|
{
|
||||||
ERROR ((0, errno, _("error reading output of %s"), script_name));
|
paxerror (errno, _("error reading output of %s"), script_name);
|
||||||
stop = 1;
|
stop = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -1036,7 +1031,7 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
|
|
||||||
if (buflen == 0)
|
if (buflen == 0)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("empty output from \"%s %s\""), script_name, file_name));
|
paxerror (0, _("empty output from \"%s %s\""), script_name, file_name);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1057,14 +1052,15 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
cp = strptime (buffer, fmt, &tm);
|
cp = strptime (buffer, fmt, &tm);
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("output from \"%s %s\" does not satisfy format string: %s"),
|
paxerror (0, _("output from \"%s %s\" does not satisfy format string:"
|
||||||
script_name, file_name, buffer));
|
" %s"),
|
||||||
|
script_name, file_name, buffer);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
else if (*cp != 0)
|
else if (*cp != 0)
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("unconsumed output from \"%s %s\": %s"),
|
paxwarn (0, _("unconsumed output from \"%s %s\": %s"),
|
||||||
script_name, file_name, cp));
|
script_name, file_name, cp);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1073,7 +1069,7 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
t = mktime (&tm);
|
t = mktime (&tm);
|
||||||
if (tm.tm_wday < 0)
|
if (tm.tm_wday < 0)
|
||||||
{
|
{
|
||||||
ERROR ((0, errno, _("mktime failed")));
|
paxerror (errno, _("mktime failed"));
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1085,8 +1081,8 @@ sys_exec_setmtime_script (const char *script_name,
|
|||||||
}
|
}
|
||||||
else if (! parse_datetime (ts, buffer, NULL))
|
else if (! parse_datetime (ts, buffer, NULL))
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("unparsable output from \"%s %s\": %s"),
|
paxerror (0, _("unparsable output from \"%s %s\": %s"),
|
||||||
script_name, file_name, buffer));
|
script_name, file_name, buffer);
|
||||||
rc = -1;
|
rc = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
160
src/tar.c
160
src/tar.c
@@ -167,8 +167,8 @@ void
|
|||||||
request_stdin (const char *option)
|
request_stdin (const char *option)
|
||||||
{
|
{
|
||||||
if (stdin_used_by)
|
if (stdin_used_by)
|
||||||
USAGE_ERROR ((0, 0, _("Options '%s' and '%s' both want standard input"),
|
paxusage (_("Options '%s' and '%s' both want standard input"),
|
||||||
stdin_used_by, option));
|
stdin_used_by, option);
|
||||||
|
|
||||||
stdin_used_by = option;
|
stdin_used_by = option;
|
||||||
}
|
}
|
||||||
@@ -242,8 +242,8 @@ set_archive_format (char const *name)
|
|||||||
|
|
||||||
for (p = fmttab; strcmp (p->name, name) != 0; )
|
for (p = fmttab; strcmp (p->name, name) != 0; )
|
||||||
if (! (++p)->name)
|
if (! (++p)->name)
|
||||||
USAGE_ERROR ((0, 0, _("%s: Invalid archive format"),
|
paxusage (_("%s: Invalid archive format"),
|
||||||
quotearg_colon (name)));
|
quotearg_colon (name));
|
||||||
|
|
||||||
archive_format = p->fmt;
|
archive_format = p->fmt;
|
||||||
}
|
}
|
||||||
@@ -273,8 +273,7 @@ static void
|
|||||||
assert_format (int fmt_mask)
|
assert_format (int fmt_mask)
|
||||||
{
|
{
|
||||||
if ((FORMAT_MASK (archive_format) & fmt_mask) == 0)
|
if ((FORMAT_MASK (archive_format) & fmt_mask) == 0)
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("GNU features wanted on incompatible archive format"));
|
||||||
_("GNU features wanted on incompatible archive format")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *
|
const char *
|
||||||
@@ -341,8 +340,10 @@ tar_set_quoting_style (char *arg)
|
|||||||
set_quoting_style (NULL, i);
|
set_quoting_style (NULL, i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0,
|
||||||
_("Unknown quoting style '%s'. Try '%s --quoting-style=help' to get a list."), arg, program_name));
|
_("Unknown quoting style '%s'."
|
||||||
|
" Try '%s --quoting-style=help' to get a list."),
|
||||||
|
arg, program_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -944,7 +945,7 @@ easprintf (char const *format, ...)
|
|||||||
va_end (args);
|
va_end (args);
|
||||||
|
|
||||||
if (!result)
|
if (!result)
|
||||||
FATAL_ERROR ((0, err, "vasprintf"));
|
paxfatal (err, "vasprintf");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,7 +973,7 @@ option_conflict_error (const char *a, const char *b)
|
|||||||
{
|
{
|
||||||
/* TRANSLATORS: Both %s in this statement are replaced with
|
/* TRANSLATORS: Both %s in this statement are replaced with
|
||||||
option names. */
|
option names. */
|
||||||
USAGE_ERROR ((0, 0, _("'%s' cannot be used with '%s'"), a, b));
|
paxusage (_("'%s' cannot be used with '%s'"), a, b);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Classes of options that can conflict: */
|
/* Classes of options that can conflict: */
|
||||||
@@ -1047,8 +1048,8 @@ set_subcommand_option (enum subcommand subcommand)
|
|||||||
{
|
{
|
||||||
if (subcommand_option != UNKNOWN_SUBCOMMAND
|
if (subcommand_option != UNKNOWN_SUBCOMMAND
|
||||||
&& subcommand_option != subcommand)
|
&& subcommand_option != subcommand)
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("You may not specify more than one '-Acdtrux',"
|
||||||
_("You may not specify more than one '-Acdtrux', '--delete' or '--test-label' option")));
|
" '--delete' or '--test-label' option"));
|
||||||
|
|
||||||
subcommand_option = subcommand;
|
subcommand_option = subcommand;
|
||||||
}
|
}
|
||||||
@@ -1060,7 +1061,7 @@ set_use_compress_program_option (const char *string, struct option_locus *loc)
|
|||||||
if (use_compress_program_option
|
if (use_compress_program_option
|
||||||
&& strcmp (use_compress_program_option, string) != 0
|
&& strcmp (use_compress_program_option, string) != 0
|
||||||
&& p->source == OPTS_COMMAND_LINE)
|
&& p->source == OPTS_COMMAND_LINE)
|
||||||
USAGE_ERROR ((0, 0, _("Conflicting compression options")));
|
paxusage (_("Conflicting compression options"));
|
||||||
|
|
||||||
use_compress_program_option = string;
|
use_compress_program_option = string;
|
||||||
}
|
}
|
||||||
@@ -1114,7 +1115,7 @@ decode_signal (const char *name)
|
|||||||
for (p = sigtab; p < sigtab + sizeof (sigtab) / sizeof (sigtab[0]); p++)
|
for (p = sigtab; p < sigtab + sizeof (sigtab) / sizeof (sigtab[0]); p++)
|
||||||
if (strcmp (p->name, s) == 0)
|
if (strcmp (p->name, s) == 0)
|
||||||
return p->signo;
|
return p->signo;
|
||||||
FATAL_ERROR ((0, 0, _("Unknown signal name: %s"), name));
|
paxfatal (0, _("Unknown signal name: %s"), name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1144,7 +1145,7 @@ get_date_or_file (struct tar_args *args, const char *option,
|
|||||||
if (stat (str, &st) != 0)
|
if (stat (str, &st) != 0)
|
||||||
{
|
{
|
||||||
stat_error (str);
|
stat_error (str);
|
||||||
USAGE_ERROR ((0, 0, _("Date sample file not found")));
|
paxusage (_("Date sample file not found"));
|
||||||
}
|
}
|
||||||
*ts = get_stat_mtime (&st);
|
*ts = get_stat_mtime (&st);
|
||||||
}
|
}
|
||||||
@@ -1152,8 +1153,8 @@ get_date_or_file (struct tar_args *args, const char *option,
|
|||||||
{
|
{
|
||||||
if (! parse_datetime (ts, str, NULL))
|
if (! parse_datetime (ts, str, NULL))
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("Substituting %s for unknown date format %s"),
|
paxwarn (0, _("Substituting %s for unknown date format %s"),
|
||||||
tartime (*ts, false), quote (str)));
|
tartime (*ts, false), quote (str));
|
||||||
ts->tv_nsec = 0;
|
ts->tv_nsec = 0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -1181,8 +1182,8 @@ report_textual_dates (struct tar_args *args)
|
|||||||
{
|
{
|
||||||
char const *treated_as = tartime (p->ts, true);
|
char const *treated_as = tartime (p->ts, true);
|
||||||
if (strcmp (p->date, treated_as) != 0)
|
if (strcmp (p->date, treated_as) != 0)
|
||||||
WARN ((0, 0, _("Option %s: Treating date '%s' as %s"),
|
paxwarn (0, _("Option %s: Treating date '%s' as %s"),
|
||||||
p->option, p->date, treated_as));
|
p->option, p->date, treated_as);
|
||||||
}
|
}
|
||||||
free (p->date);
|
free (p->date);
|
||||||
free (p);
|
free (p);
|
||||||
@@ -1346,8 +1347,8 @@ parse_owner_group (char *arg, uintmax_t field_max, char const **name_option)
|
|||||||
char *end;
|
char *end;
|
||||||
uintmax_t u = stoint (num, &end, &overflow, 0, field_max);
|
uintmax_t u = stoint (num, &end, &overflow, 0, field_max);
|
||||||
if ((end == num) | *end | overflow)
|
if ((end == num) | *end | overflow)
|
||||||
FATAL_ERROR ((0, 0, "%s: %s", quotearg_colon (num),
|
paxfatal (0, "%s: %s", quotearg_colon (num),
|
||||||
_("Invalid owner or group ID")));
|
_("Invalid owner or group ID"));
|
||||||
if (name_option)
|
if (name_option)
|
||||||
*name_option = name;
|
*name_option = name;
|
||||||
return u;
|
return u;
|
||||||
@@ -1464,8 +1465,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
(min (IDX_MAX, min (SSIZE_MAX, SIZE_MAX))
|
(min (IDX_MAX, min (SSIZE_MAX, SIZE_MAX))
|
||||||
/ BLOCKSIZE));
|
/ BLOCKSIZE));
|
||||||
if ((end == arg) | *end | overflow | !blocking_factor)
|
if ((end == arg) | *end | overflow | !blocking_factor)
|
||||||
USAGE_ERROR ((0, 0, "%s: %s", quotearg_colon (arg),
|
paxusage ("%s: %s", quotearg_colon (arg),
|
||||||
_("Invalid blocking factor")));
|
_("Invalid blocking factor"));
|
||||||
record_size = blocking_factor * BLOCKSIZE;
|
record_size = blocking_factor * BLOCKSIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1663,8 +1664,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
USAGE_ERROR ((0, 0, "%s: %s", quotearg_colon (arg),
|
paxusage ("%s: %s", quotearg_colon (arg),
|
||||||
_("Invalid tape length")));
|
_("Invalid tape length"));
|
||||||
}
|
}
|
||||||
|
|
||||||
multi_volume_option = true;
|
multi_volume_option = true;
|
||||||
@@ -1676,7 +1677,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
char *end;
|
char *end;
|
||||||
incremental_level = stoint (arg, &end, NULL, 0, 1);
|
incremental_level = stoint (arg, &end, NULL, 0, 1);
|
||||||
if ((end == arg) | *end)
|
if ((end == arg) | *end)
|
||||||
USAGE_ERROR ((0, 0, _("Invalid incremental level value")));
|
paxusage (_("Invalid incremental level value"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1722,7 +1723,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case NEWER_MTIME_OPTION:
|
case NEWER_MTIME_OPTION:
|
||||||
if (TIME_OPTION_INITIALIZED (newer_mtime_option))
|
if (TIME_OPTION_INITIALIZED (newer_mtime_option))
|
||||||
USAGE_ERROR ((0, 0, _("More than one threshold date")));
|
paxusage (_("More than one threshold date"));
|
||||||
get_date_or_file (args,
|
get_date_or_file (args,
|
||||||
key == NEWER_MTIME_OPTION ? "--newer-mtime"
|
key == NEWER_MTIME_OPTION ? "--newer-mtime"
|
||||||
: "--after-date", arg, &newer_mtime_option);
|
: "--after-date", arg, &newer_mtime_option);
|
||||||
@@ -1798,7 +1799,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
if ((p != arg) & (*p == '.'))
|
if ((p != arg) & (*p == '.'))
|
||||||
tar_sparse_minor = stoint (p + 1, &p, &vminor, 0, INTMAX_MAX);
|
tar_sparse_minor = stoint (p + 1, &p, &vminor, 0, INTMAX_MAX);
|
||||||
if ((p == arg) | *p | vmajor | vminor)
|
if ((p == arg) | *p | vmajor | vminor)
|
||||||
USAGE_ERROR ((0, 0, _("Invalid sparse version value")));
|
paxusage (_("Invalid sparse version value"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -1872,9 +1873,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
atime_preserve_args, atime_preserve_types)
|
atime_preserve_args, atime_preserve_types)
|
||||||
: replace_atime_preserve);
|
: replace_atime_preserve);
|
||||||
if (! O_NOATIME && atime_preserve_option == system_atime_preserve)
|
if (! O_NOATIME && atime_preserve_option == system_atime_preserve)
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0, _("--atime-preserve='system' is not supported"
|
||||||
_("--atime-preserve='system' is not supported"
|
" on this platform"));
|
||||||
" on this platform")));
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CHECK_DEVICE_OPTION:
|
case CHECK_DEVICE_OPTION:
|
||||||
@@ -1897,8 +1897,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
}
|
}
|
||||||
checkpoint_option = stoint (arg, &p, NULL, 0, INTMAX_MAX);
|
checkpoint_option = stoint (arg, &p, NULL, 0, INTMAX_MAX);
|
||||||
if (*p | (checkpoint_option <= 0))
|
if (*p | (checkpoint_option <= 0))
|
||||||
FATAL_ERROR ((0, 0,
|
paxfatal (0, _("invalid --checkpoint value"));
|
||||||
_("invalid --checkpoint value")));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
checkpoint_option = DEFAULT_CHECKPOINT;
|
checkpoint_option = DEFAULT_CHECKPOINT;
|
||||||
@@ -1976,7 +1975,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
case MODE_OPTION:
|
case MODE_OPTION:
|
||||||
mode_option = mode_compile (arg);
|
mode_option = mode_compile (arg);
|
||||||
if (!mode_option)
|
if (!mode_option)
|
||||||
FATAL_ERROR ((0, 0, _("Invalid mode given on option")));
|
paxfatal (0, _("Invalid mode given on option"));
|
||||||
initial_umask = umask (0);
|
initial_umask = umask (0);
|
||||||
umask (initial_umask);
|
umask (initial_umask);
|
||||||
break;
|
break;
|
||||||
@@ -2007,8 +2006,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
char *end;
|
char *end;
|
||||||
occurrence_option = stoint (arg, &end, NULL, 0, UINTMAX_MAX);
|
occurrence_option = stoint (arg, &end, NULL, 0, UINTMAX_MAX);
|
||||||
if (*end)
|
if (*end)
|
||||||
FATAL_ERROR ((0, 0, "%s: %s", quotearg_colon (arg),
|
paxfatal (0, "%s: %s", quotearg_colon (arg), _("Invalid number"));
|
||||||
_("Invalid number")));
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2072,11 +2070,9 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
if (! (xstrtoumax (arg, NULL, 10, &u, TAR_SIZE_SUFFIXES) == LONGINT_OK
|
if (! (xstrtoumax (arg, NULL, 10, &u, TAR_SIZE_SUFFIXES) == LONGINT_OK
|
||||||
&& !ckd_add (&record_size, u, 0)
|
&& !ckd_add (&record_size, u, 0)
|
||||||
&& record_size <= min (SSIZE_MAX, SIZE_MAX)))
|
&& record_size <= min (SSIZE_MAX, SIZE_MAX)))
|
||||||
USAGE_ERROR ((0, 0, "%s: %s", quotearg_colon (arg),
|
paxusage ("%s: %s", quotearg_colon (arg), _("Invalid record size"));
|
||||||
_("Invalid record size")));
|
|
||||||
if (record_size % BLOCKSIZE != 0)
|
if (record_size % BLOCKSIZE != 0)
|
||||||
USAGE_ERROR ((0, 0, _("Record size must be a multiple of %d."),
|
paxusage (_("Record size must be a multiple of %d."), BLOCKSIZE);
|
||||||
BLOCKSIZE));
|
|
||||||
blocking_factor = record_size / BLOCKSIZE;
|
blocking_factor = record_size / BLOCKSIZE;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -2120,8 +2116,8 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
char *end;
|
char *end;
|
||||||
strip_name_components = stoint (arg, &end, NULL, 0, SIZE_MAX);
|
strip_name_components = stoint (arg, &end, NULL, 0, SIZE_MAX);
|
||||||
if (*end)
|
if (*end)
|
||||||
USAGE_ERROR ((0, 0, "%s: %s", quotearg_colon (arg),
|
paxusage ("%s: %s", quotearg_colon (arg),
|
||||||
_("Invalid number of elements")));
|
_("Invalid number of elements"));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2145,7 +2141,7 @@ parse_opt (int key, char *arg, struct argp_state *state)
|
|||||||
|
|
||||||
case TO_COMMAND_OPTION:
|
case TO_COMMAND_OPTION:
|
||||||
if (to_command_option)
|
if (to_command_option)
|
||||||
USAGE_ERROR ((0, 0, _("Only one --to-command option allowed")));
|
paxusage (_("Only one --to-command option allowed"));
|
||||||
to_command_option = arg;
|
to_command_option = arg;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -2338,8 +2334,7 @@ parse_default_options (struct tar_args *args)
|
|||||||
|
|
||||||
ws.ws_offs = 1;
|
ws.ws_offs = 1;
|
||||||
if (wordsplit (opts, &ws, WRDSF_DEFFLAGS|WRDSF_DOOFFS))
|
if (wordsplit (opts, &ws, WRDSF_DEFFLAGS|WRDSF_DOOFFS))
|
||||||
FATAL_ERROR ((0, 0, _("cannot split TAR_OPTIONS: %s"),
|
paxfatal (0, _("cannot split TAR_OPTIONS: %s"), wordsplit_strerror (&ws));
|
||||||
wordsplit_strerror (&ws)));
|
|
||||||
if (ws.ws_wordc)
|
if (ws.ws_wordc)
|
||||||
{
|
{
|
||||||
int idx;
|
int idx;
|
||||||
@@ -2348,13 +2343,13 @@ parse_default_options (struct tar_args *args)
|
|||||||
args->loc = &loc;
|
args->loc = &loc;
|
||||||
int argc;
|
int argc;
|
||||||
if (ckd_add (&argc, ws.ws_offs, ws.ws_wordc))
|
if (ckd_add (&argc, ws.ws_offs, ws.ws_wordc))
|
||||||
FATAL_ERROR ((0, 0, "too many options"));
|
paxfatal (0, _("too many options"));
|
||||||
if (argp_parse (&argp, argc, ws.ws_wordv,
|
if (argp_parse (&argp, argc, ws.ws_wordv,
|
||||||
ARGP_IN_ORDER | ARGP_NO_EXIT, &idx, args))
|
ARGP_IN_ORDER | ARGP_NO_EXIT, &idx, args))
|
||||||
abort (); /* shouldn't happen */
|
abort (); /* shouldn't happen */
|
||||||
args->loc = save_loc_ptr;
|
args->loc = save_loc_ptr;
|
||||||
if (name_more_files ())
|
if (name_more_files ())
|
||||||
USAGE_ERROR ((0, 0, _("non-option arguments in %s"), loc.name));
|
paxusage (_("non-option arguments in %s"), loc.name);
|
||||||
/* Don't free consumed words */
|
/* Don't free consumed words */
|
||||||
ws.ws_wordc = 0;
|
ws.ws_wordc = 0;
|
||||||
}
|
}
|
||||||
@@ -2439,11 +2434,9 @@ decode_options (int argc, char **argv)
|
|||||||
opt = find_argp_option (&argp, *letter);
|
opt = find_argp_option (&argp, *letter);
|
||||||
if (opt && opt->arg)
|
if (opt && opt->arg)
|
||||||
{
|
{
|
||||||
if (in < argv + argc)
|
if (! (in < argv + argc))
|
||||||
*out++ = *in++;
|
paxusage (_("Old option '%c' requires an argument."), *letter);
|
||||||
else
|
*out++ = *in++;
|
||||||
USAGE_ERROR ((0, 0, _("Old option '%c' requires an argument."),
|
|
||||||
*letter));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2513,8 +2506,7 @@ decode_options (int argc, char **argv)
|
|||||||
if (occurrence_option)
|
if (occurrence_option)
|
||||||
{
|
{
|
||||||
if (!name_more_files ())
|
if (!name_more_files ())
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("--occurrence is meaningless without a file list"));
|
||||||
_("--occurrence is meaningless without a file list")));
|
|
||||||
if (!IS_SUBCOMMAND_CLASS (SUBCL_OCCUR))
|
if (!IS_SUBCOMMAND_CLASS (SUBCL_OCCUR))
|
||||||
{
|
{
|
||||||
if (option_set_in_cl (OC_OCCURRENCE))
|
if (option_set_in_cl (OC_OCCURRENCE))
|
||||||
@@ -2539,8 +2531,7 @@ decode_options (int argc, char **argv)
|
|||||||
/* Allow multiple archives only with '-M'. */
|
/* Allow multiple archives only with '-M'. */
|
||||||
|
|
||||||
if (archive_names > 1 && !multi_volume_option)
|
if (archive_names > 1 && !multi_volume_option)
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("Multiple archive files require '-M' option"));
|
||||||
_("Multiple archive files require '-M' option")));
|
|
||||||
|
|
||||||
if (listed_incremental_option
|
if (listed_incremental_option
|
||||||
&& TIME_OPTION_INITIALIZED (newer_mtime_option))
|
&& TIME_OPTION_INITIALIZED (newer_mtime_option))
|
||||||
@@ -2556,8 +2547,7 @@ decode_options (int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (0 <= incremental_level && !listed_incremental_option)
|
if (0 <= incremental_level && !listed_incremental_option)
|
||||||
WARN ((0, 0,
|
paxwarn (0, _("--level is meaningless without --listed-incremental"));
|
||||||
_("--level is meaningless without --listed-incremental")));
|
|
||||||
|
|
||||||
if (volume_label_option)
|
if (volume_label_option)
|
||||||
{
|
{
|
||||||
@@ -2573,10 +2563,9 @@ decode_options (int argc, char **argv)
|
|||||||
- 1 /* for sign, as 0 <= volno */)
|
- 1 /* for sign, as 0 <= volno */)
|
||||||
: 0));
|
: 0));
|
||||||
if (volume_label_max_len < strlen (volume_label_option))
|
if (volume_label_max_len < strlen (volume_label_option))
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("%s: Volume label length exceeds %d bytes"),
|
||||||
_("%s: Volume label length exceeds %d bytes"),
|
quotearg_colon (volume_label_option),
|
||||||
quotearg_colon (volume_label_option),
|
volume_label_max_len);
|
||||||
volume_label_max_len));
|
|
||||||
}
|
}
|
||||||
/* else FIXME
|
/* else FIXME
|
||||||
Label length in PAX format is limited by the volume size. */
|
Label length in PAX format is limited by the volume size. */
|
||||||
@@ -2585,9 +2574,9 @@ decode_options (int argc, char **argv)
|
|||||||
if (verify_option)
|
if (verify_option)
|
||||||
{
|
{
|
||||||
if (multi_volume_option)
|
if (multi_volume_option)
|
||||||
USAGE_ERROR ((0, 0, _("Cannot verify multi-volume archives")));
|
paxusage (_("Cannot verify multi-volume archives"));
|
||||||
if (use_compress_program_option)
|
if (use_compress_program_option)
|
||||||
USAGE_ERROR ((0, 0, _("Cannot verify compressed archives")));
|
paxusage (_("Cannot verify compressed archives"));
|
||||||
if (!IS_SUBCOMMAND_CLASS (SUBCL_WRITE))
|
if (!IS_SUBCOMMAND_CLASS (SUBCL_WRITE))
|
||||||
{
|
{
|
||||||
if (option_set_in_cl (OC_VERIFY))
|
if (option_set_in_cl (OC_VERIFY))
|
||||||
@@ -2601,27 +2590,23 @@ decode_options (int argc, char **argv)
|
|||||||
if (use_compress_program_option)
|
if (use_compress_program_option)
|
||||||
{
|
{
|
||||||
if (multi_volume_option)
|
if (multi_volume_option)
|
||||||
USAGE_ERROR ((0, 0, _("Cannot use multi-volume compressed archives")));
|
paxusage (_("Cannot use multi-volume compressed archives"));
|
||||||
if (IS_SUBCOMMAND_CLASS (SUBCL_UPDATE))
|
if (IS_SUBCOMMAND_CLASS (SUBCL_UPDATE))
|
||||||
USAGE_ERROR ((0, 0, _("Cannot update compressed archives")));
|
paxusage (_("Cannot update compressed archives"));
|
||||||
if (subcommand_option == CAT_SUBCOMMAND)
|
if (subcommand_option == CAT_SUBCOMMAND)
|
||||||
USAGE_ERROR ((0, 0, _("Cannot concatenate compressed archives")));
|
paxusage (_("Cannot concatenate compressed archives"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (set_mtime_command)
|
if (set_mtime_command)
|
||||||
{
|
{
|
||||||
if (set_mtime_option != USE_FILE_MTIME)
|
if (set_mtime_option != USE_FILE_MTIME)
|
||||||
{
|
paxusage (_("--mtime conflicts with --set-mtime-command"));
|
||||||
USAGE_ERROR ((0, 0,
|
|
||||||
_("--mtime conflicts with --set-mtime-command")));
|
|
||||||
}
|
|
||||||
set_mtime_option = COMMAND_MTIME;
|
set_mtime_option = COMMAND_MTIME;
|
||||||
}
|
}
|
||||||
else if (set_mtime_option == CLAMP_MTIME)
|
else if (set_mtime_option == CLAMP_MTIME)
|
||||||
{
|
{
|
||||||
if (!TIME_OPTION_INITIALIZED (mtime_option))
|
if (!TIME_OPTION_INITIALIZED (mtime_option))
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("--clamp-mtime needs a date specified using --mtime"));
|
||||||
_("--clamp-mtime needs a date specified using --mtime")));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* It is no harm to use --pax-option on non-pax archives in archive
|
/* It is no harm to use --pax-option on non-pax archives in archive
|
||||||
@@ -2631,24 +2616,24 @@ decode_options (int argc, char **argv)
|
|||||||
if (args.pax_option
|
if (args.pax_option
|
||||||
&& archive_format != POSIX_FORMAT
|
&& archive_format != POSIX_FORMAT
|
||||||
&& !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
&& !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
||||||
USAGE_ERROR ((0, 0, _("--pax-option can be used only on POSIX archives")));
|
paxusage (_("--pax-option can be used only on POSIX archives"));
|
||||||
|
|
||||||
/* star creates non-POSIX typed archives with xattr support, so allow the
|
/* star creates non-POSIX typed archives with xattr support, so allow the
|
||||||
extra headers when reading */
|
extra headers when reading */
|
||||||
if ((acls_option > 0)
|
if ((acls_option > 0)
|
||||||
&& archive_format != POSIX_FORMAT
|
&& archive_format != POSIX_FORMAT
|
||||||
&& !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
&& !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
||||||
USAGE_ERROR ((0, 0, _("--acls can be used only on POSIX archives")));
|
paxusage (_("--acls can be used only on POSIX archives"));
|
||||||
|
|
||||||
if ((selinux_context_option > 0)
|
if ((selinux_context_option > 0)
|
||||||
&& archive_format != POSIX_FORMAT
|
&& archive_format != POSIX_FORMAT
|
||||||
&& !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
&& !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
||||||
USAGE_ERROR ((0, 0, _("--selinux can be used only on POSIX archives")));
|
paxusage (_("--selinux can be used only on POSIX archives"));
|
||||||
|
|
||||||
if ((xattrs_option > 0)
|
if ((xattrs_option > 0)
|
||||||
&& archive_format != POSIX_FORMAT
|
&& archive_format != POSIX_FORMAT
|
||||||
&& !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
&& !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
||||||
USAGE_ERROR ((0, 0, _("--xattrs can be used only on POSIX archives")));
|
paxusage (_("--xattrs can be used only on POSIX archives"));
|
||||||
|
|
||||||
if (starting_file_option && !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
if (starting_file_option && !IS_SUBCOMMAND_CLASS (SUBCL_READ))
|
||||||
{
|
{
|
||||||
@@ -2696,9 +2681,8 @@ decode_options (int argc, char **argv)
|
|||||||
free (base);
|
free (base);
|
||||||
|
|
||||||
if (!one_top_level_dir)
|
if (!one_top_level_dir)
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("Cannot deduce top-level directory name; "
|
||||||
_("Cannot deduce top-level directory name; "
|
"please set it explicitly with --one-top-level=DIR"));
|
||||||
"please set it explicitly with --one-top-level=DIR")));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2730,7 +2714,7 @@ decode_options (int argc, char **argv)
|
|||||||
verbose_option = 2;
|
verbose_option = 2;
|
||||||
|
|
||||||
if (tape_length_option && tape_length_option < record_size)
|
if (tape_length_option && tape_length_option < record_size)
|
||||||
USAGE_ERROR ((0, 0, _("Volume length cannot be less than record size")));
|
paxusage (_("Volume length cannot be less than record size"));
|
||||||
|
|
||||||
if (same_order_option && listed_incremental_option)
|
if (same_order_option && listed_incremental_option)
|
||||||
{
|
{
|
||||||
@@ -2753,8 +2737,7 @@ decode_options (int argc, char **argv)
|
|||||||
{
|
{
|
||||||
case CREATE_SUBCOMMAND:
|
case CREATE_SUBCOMMAND:
|
||||||
if (!name_more_files ())
|
if (!name_more_files ())
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("Cowardly refusing to create an empty archive"));
|
||||||
_("Cowardly refusing to create an empty archive")));
|
|
||||||
if (args.compress_autodetect && archive_names
|
if (args.compress_autodetect && archive_names
|
||||||
&& strcmp (archive_name_array[0], "-"))
|
&& strcmp (archive_name_array[0], "-"))
|
||||||
set_compression_program_by_suffix (archive_name_array[0],
|
set_compression_program_by_suffix (archive_name_array[0],
|
||||||
@@ -2780,8 +2763,7 @@ decode_options (int argc, char **argv)
|
|||||||
archive_name_cursor < archive_name_array + archive_names;
|
archive_name_cursor < archive_name_array + archive_names;
|
||||||
archive_name_cursor++)
|
archive_name_cursor++)
|
||||||
if (!strcmp (*archive_name_cursor, "-"))
|
if (!strcmp (*archive_name_cursor, "-"))
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("Options '-Aru' are incompatible with '-f -'"));
|
||||||
_("Options '-Aru' are incompatible with '-f -'")));
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -2864,8 +2846,8 @@ main (int argc, char **argv)
|
|||||||
close_stdout_set_file_name (_("stdout"));
|
close_stdout_set_file_name (_("stdout"));
|
||||||
/* Make sure we have first three descriptors available */
|
/* Make sure we have first three descriptors available */
|
||||||
if (stdopen ())
|
if (stdopen ())
|
||||||
FATAL_ERROR ((0, 0, "%s",
|
paxfatal (0, _("failed to assert availability"
|
||||||
_("failed to assert availability of the standard file descriptors")));
|
" of the standard file descriptors"));
|
||||||
|
|
||||||
/* Pre-allocate a few structures. */
|
/* Pre-allocate a few structures. */
|
||||||
|
|
||||||
@@ -2894,8 +2876,8 @@ main (int argc, char **argv)
|
|||||||
switch (subcommand_option)
|
switch (subcommand_option)
|
||||||
{
|
{
|
||||||
case UNKNOWN_SUBCOMMAND:
|
case UNKNOWN_SUBCOMMAND:
|
||||||
USAGE_ERROR ((0, 0,
|
paxusage (_("You must specify one of the '-Acdtrux',"
|
||||||
_("You must specify one of the '-Acdtrux', '--delete' or '--test-label' options")));
|
" '--delete' or '--test-label' options"));
|
||||||
|
|
||||||
case CAT_SUBCOMMAND:
|
case CAT_SUBCOMMAND:
|
||||||
case UPDATE_SUBCOMMAND:
|
case UPDATE_SUBCOMMAND:
|
||||||
|
|||||||
@@ -200,17 +200,16 @@ parse_transform_expr (const char *expr)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (parse_xform_flags (&transform_flags, *expr))
|
if (parse_xform_flags (&transform_flags, *expr))
|
||||||
USAGE_ERROR ((0, 0, _("Unknown transform flag: %c"),
|
paxusage (_("Unknown transform flag: %c"), *expr);
|
||||||
*expr));
|
|
||||||
}
|
}
|
||||||
return expr;
|
return expr;
|
||||||
}
|
}
|
||||||
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
|
paxusage (_("Invalid transform expression"));
|
||||||
}
|
}
|
||||||
|
|
||||||
delim = expr[1];
|
delim = expr[1];
|
||||||
if (!delim)
|
if (!delim)
|
||||||
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
|
paxusage (_("Invalid transform expression"));
|
||||||
|
|
||||||
/* Scan regular expression */
|
/* Scan regular expression */
|
||||||
for (i = 2; expr[i] && expr[i] != delim; i++)
|
for (i = 2; expr[i] && expr[i] != delim; i++)
|
||||||
@@ -218,7 +217,7 @@ parse_transform_expr (const char *expr)
|
|||||||
i++;
|
i++;
|
||||||
|
|
||||||
if (expr[i] != delim)
|
if (expr[i] != delim)
|
||||||
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
|
paxusage (_("Invalid transform expression"));
|
||||||
|
|
||||||
/* Scan replacement expression */
|
/* Scan replacement expression */
|
||||||
for (j = i + 1; expr[j] && expr[j] != delim; j++)
|
for (j = i + 1; expr[j] && expr[j] != delim; j++)
|
||||||
@@ -226,7 +225,7 @@ parse_transform_expr (const char *expr)
|
|||||||
j++;
|
j++;
|
||||||
|
|
||||||
if (expr[j] != delim)
|
if (expr[j] != delim)
|
||||||
USAGE_ERROR ((0, 0, _("Invalid transform expression")));
|
paxusage (_("Invalid transform expression"));
|
||||||
|
|
||||||
/* Check flags */
|
/* Check flags */
|
||||||
tf->transform_type = transform_first;
|
tf->transform_type = transform_first;
|
||||||
@@ -257,8 +256,7 @@ parse_transform_expr (const char *expr)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (parse_xform_flags (&tf->flags, *p))
|
if (parse_xform_flags (&tf->flags, *p))
|
||||||
USAGE_ERROR ((0, 0, _("Unknown flag in transform expression: %c"),
|
paxusage (_("Unknown flag in transform expression: %c"), *p);
|
||||||
*p));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*p == ';')
|
if (*p == ';')
|
||||||
@@ -275,7 +273,7 @@ parse_transform_expr (const char *expr)
|
|||||||
{
|
{
|
||||||
char errbuf[512];
|
char errbuf[512];
|
||||||
regerror (rc, &tf->regex, errbuf, sizeof (errbuf));
|
regerror (rc, &tf->regex, errbuf, sizeof (errbuf));
|
||||||
USAGE_ERROR ((0, 0, _("Invalid transform expression: %s"), errbuf));
|
paxusage (_("Invalid transform expression: %s"), errbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str[0] == '^' || (i > 2 && str[i - 3] == '$'))
|
if (str[0] == '^' || (i > 2 && str[i - 3] == '$'))
|
||||||
@@ -301,8 +299,8 @@ parse_transform_expr (const char *expr)
|
|||||||
{
|
{
|
||||||
idx_t n = stoint (cur, &cur, NULL, 0, IDX_MAX);
|
idx_t n = stoint (cur, &cur, NULL, 0, IDX_MAX);
|
||||||
if (tf->regex.re_nsub < n)
|
if (tf->regex.re_nsub < n)
|
||||||
USAGE_ERROR ((0, 0, _("Invalid transform replacement:"
|
paxusage (_("Invalid transform replacement:"
|
||||||
" back reference out of range")));
|
" back reference out of range"));
|
||||||
add_backref_segment (tf, n);
|
add_backref_segment (tf, n);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -186,11 +186,11 @@ update_archive (void)
|
|||||||
switch (previous_status)
|
switch (previous_status)
|
||||||
{
|
{
|
||||||
case HEADER_STILL_UNREAD:
|
case HEADER_STILL_UNREAD:
|
||||||
WARN ((0, 0, _("This does not look like a tar archive")));
|
paxwarn (0, _("This does not look like a tar archive"));
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case HEADER_SUCCESS:
|
case HEADER_SUCCESS:
|
||||||
case HEADER_ZERO_BLOCK:
|
case HEADER_ZERO_BLOCK:
|
||||||
ERROR ((0, 0, _("Skipping to next header")));
|
paxerror (0, _("Skipping to next header"));
|
||||||
FALLTHROUGH;
|
FALLTHROUGH;
|
||||||
case HEADER_FAILURE:
|
case HEADER_FAILURE:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -111,3 +111,17 @@ set_warning_option (const char *arg)
|
|||||||
else
|
else
|
||||||
warning_option |= option;
|
warning_option |= option;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
warnopt (int opt, int errnum, char const *format, ...)
|
||||||
|
{
|
||||||
|
if (WARNING_ENABLED (opt))
|
||||||
|
{
|
||||||
|
if (error_hook)
|
||||||
|
error_hook ();
|
||||||
|
va_list ap;
|
||||||
|
va_start (ap, format);
|
||||||
|
verror (0, errnum, format, ap);
|
||||||
|
va_end (ap);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
41
src/xattrs.c
41
src/xattrs.c
@@ -300,11 +300,10 @@ xattrs__acls_set (struct tar_stat_info const *st,
|
|||||||
FILE_NAME may already have inherited default acls from parent
|
FILE_NAME may already have inherited default acls from parent
|
||||||
directory; clean them up. */
|
directory; clean them up. */
|
||||||
if (acl_delete_def_file_at (chdir_fd, file_name))
|
if (acl_delete_def_file_at (chdir_fd, file_name))
|
||||||
WARNOPT (WARN_XATTR_WRITE,
|
warnopt (WARN_XATTR_WRITE, errno,
|
||||||
(0, errno,
|
|
||||||
_("acl_delete_def_file_at: Cannot drop default POSIX ACLs "
|
_("acl_delete_def_file_at: Cannot drop default POSIX ACLs "
|
||||||
"for file '%s'"),
|
"for file '%s'"),
|
||||||
file_name));
|
file_name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -318,10 +317,9 @@ xattrs__acls_set (struct tar_stat_info const *st,
|
|||||||
|
|
||||||
if (acl_set_file_at (chdir_fd, file_name, type, acl) < 0)
|
if (acl_set_file_at (chdir_fd, file_name, type, acl) < 0)
|
||||||
/* warn even if filesystem does not support acls */
|
/* warn even if filesystem does not support acls */
|
||||||
WARNOPT (WARN_XATTR_WRITE,
|
warnopt (WARN_XATTR_WRITE, errno,
|
||||||
(0, errno,
|
_ ("acl_set_file_at: Cannot set POSIX ACLs for file '%s'"),
|
||||||
_ ("acl_set_file_at: Cannot set POSIX ACLs for file '%s'"),
|
file_name);
|
||||||
file_name));
|
|
||||||
|
|
||||||
acl_free (acl);
|
acl_free (acl);
|
||||||
}
|
}
|
||||||
@@ -373,7 +371,8 @@ acls_get_text (int parentfd, const char *file_name, acl_type_t type,
|
|||||||
static int warned;
|
static int warned;
|
||||||
if (!warned)
|
if (!warned)
|
||||||
{
|
{
|
||||||
WARN ((0, 0, _("--numeric-owner is ignored for ACLs: libacl is not available")));
|
paxwarn (0, _("--numeric-owner is ignored for ACLs:"
|
||||||
|
" libacl is not available"));
|
||||||
warned = 1;
|
warned = 1;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -456,7 +455,7 @@ xattrs_acls_get (MAYBE_UNUSED int parentfd, MAYBE_UNUSED char const *file_name,
|
|||||||
#ifndef HAVE_POSIX_ACLS
|
#ifndef HAVE_POSIX_ACLS
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
if (!done)
|
if (!done)
|
||||||
WARN ((0, 0, _("POSIX ACL support is not available")));
|
paxwarn (0, _("POSIX ACL support is not available"));
|
||||||
done = 1;
|
done = 1;
|
||||||
#else
|
#else
|
||||||
int err = file_has_acl_at (parentfd, file_name, &st->stat);
|
int err = file_has_acl_at (parentfd, file_name, &st->stat);
|
||||||
@@ -486,7 +485,7 @@ xattrs_acls_set (MAYBE_UNUSED struct tar_stat_info const *st,
|
|||||||
#ifndef HAVE_POSIX_ACLS
|
#ifndef HAVE_POSIX_ACLS
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
if (!done)
|
if (!done)
|
||||||
WARN ((0, 0, _("POSIX ACL support is not available")));
|
paxwarn (0, _("POSIX ACL support is not available"));
|
||||||
done = 1;
|
done = 1;
|
||||||
#else
|
#else
|
||||||
xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS,
|
xattrs__acls_set (st, file_name, ACL_TYPE_ACCESS,
|
||||||
@@ -550,7 +549,7 @@ xattrs_xattrs_get (int parentfd, char const *file_name,
|
|||||||
#ifndef HAVE_XATTRS
|
#ifndef HAVE_XATTRS
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
if (!done)
|
if (!done)
|
||||||
WARN ((0, 0, _("XATTR support is not available")));
|
paxwarn (0, _("XATTR support is not available"));
|
||||||
done = 1;
|
done = 1;
|
||||||
#else
|
#else
|
||||||
static size_t xsz = 1024;
|
static size_t xsz = 1024;
|
||||||
@@ -631,10 +630,9 @@ xattrs__fd_set (char const *file_name, char typeflag,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
WARNOPT (WARN_XATTR_WRITE,
|
warnopt (WARN_XATTR_WRITE, errno,
|
||||||
(0, errno,
|
_("%s: Cannot set '%s' extended attribute for file '%s'"),
|
||||||
_("%s: Cannot set '%s' extended attribute for file '%s'"),
|
sysname, attr, file_name);
|
||||||
sysname, attr, file_name));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@@ -650,7 +648,7 @@ xattrs_selinux_get (MAYBE_UNUSED int parentfd, MAYBE_UNUSED char const *file_nam
|
|||||||
#if HAVE_SELINUX_SELINUX_H != 1
|
#if HAVE_SELINUX_SELINUX_H != 1
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
if (!done)
|
if (!done)
|
||||||
WARN ((0, 0, _("SELinux support is not available")));
|
paxwarn (0, _("SELinux support is not available"));
|
||||||
done = 1;
|
done = 1;
|
||||||
#else
|
#else
|
||||||
int result = (fd
|
int result = (fd
|
||||||
@@ -672,7 +670,7 @@ xattrs_selinux_set (MAYBE_UNUSED struct tar_stat_info const *st,
|
|||||||
#if HAVE_SELINUX_SELINUX_H != 1
|
#if HAVE_SELINUX_SELINUX_H != 1
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
if (!done)
|
if (!done)
|
||||||
WARN ((0, 0, _("SELinux support is not available")));
|
paxwarn (0, _("SELinux support is not available"));
|
||||||
done = 1;
|
done = 1;
|
||||||
#else
|
#else
|
||||||
const char *sysname = "setfilecon";
|
const char *sysname = "setfilecon";
|
||||||
@@ -693,10 +691,9 @@ xattrs_selinux_set (MAYBE_UNUSED struct tar_stat_info const *st,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
WARNOPT (WARN_XATTR_WRITE,
|
warnopt (WARN_XATTR_WRITE, errno,
|
||||||
(0, errno,
|
_("%s: Cannot set SELinux context for file '%s'"),
|
||||||
_("%s: Cannot set SELinux context for file '%s'"),
|
sysname, file_name);
|
||||||
sysname, file_name));
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -754,7 +751,7 @@ xattrs_xattrs_set (struct tar_stat_info const *st,
|
|||||||
#ifndef HAVE_XATTRS
|
#ifndef HAVE_XATTRS
|
||||||
static int done = 0;
|
static int done = 0;
|
||||||
if (!done)
|
if (!done)
|
||||||
WARN ((0, 0, _("XATTR support is not available")));
|
paxwarn (0, _("XATTR support is not available"));
|
||||||
done = 1;
|
done = 1;
|
||||||
#else
|
#else
|
||||||
size_t i;
|
size_t i;
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ xheader_list_destroy (struct keyword_list **root)
|
|||||||
static _Noreturn void
|
static _Noreturn void
|
||||||
xheader_set_single_keyword (char *kw)
|
xheader_set_single_keyword (char *kw)
|
||||||
{
|
{
|
||||||
USAGE_ERROR ((0, 0, _("Keyword %s is unknown or not yet implemented"), kw));
|
paxusage (_("Keyword %s is unknown or not yet implemented"), kw);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -170,7 +170,7 @@ assign_time_option (char **sval, time_t *tval, const char *input)
|
|||||||
char *p;
|
char *p;
|
||||||
struct timespec t = decode_timespec (input, &p, false);
|
struct timespec t = decode_timespec (input, &p, false);
|
||||||
if (! valid_timespec (t) || *p)
|
if (! valid_timespec (t) || *p)
|
||||||
ERROR ((0, 0, _("Time stamp is out of allowed range")));
|
paxerror (0, _("Time stamp is out of allowed range"));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*tval = t.tv_sec;
|
*tval = t.tv_sec;
|
||||||
@@ -185,7 +185,7 @@ xheader_set_keyword_equal (char *kw, char *eq)
|
|||||||
char *p = eq;
|
char *p = eq;
|
||||||
|
|
||||||
if (eq == kw)
|
if (eq == kw)
|
||||||
USAGE_ERROR ((0, 0, _("Malformed pax option: %s"), quote (kw)));
|
paxusage (_("Malformed pax option: %s"), quote (kw));
|
||||||
|
|
||||||
if (eq[-1] == ':')
|
if (eq[-1] == ':')
|
||||||
{
|
{
|
||||||
@@ -204,7 +204,7 @@ xheader_set_keyword_equal (char *kw, char *eq)
|
|||||||
if (strcmp (kw, "delete") == 0)
|
if (strcmp (kw, "delete") == 0)
|
||||||
{
|
{
|
||||||
if (xheader_protected_pattern_p (p))
|
if (xheader_protected_pattern_p (p))
|
||||||
USAGE_ERROR ((0, 0, _("Pattern %s cannot be used"), quote (p)));
|
paxusage (_("Pattern %s cannot be used"), quote (p));
|
||||||
xheader_list_append (&keyword_pattern_list, p, NULL);
|
xheader_list_append (&keyword_pattern_list, p, NULL);
|
||||||
}
|
}
|
||||||
else if (strcmp (kw, "exthdr.name") == 0)
|
else if (strcmp (kw, "exthdr.name") == 0)
|
||||||
@@ -218,7 +218,7 @@ xheader_set_keyword_equal (char *kw, char *eq)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (xheader_protected_keyword_p (kw))
|
if (xheader_protected_keyword_p (kw))
|
||||||
USAGE_ERROR ((0, 0, _("Keyword %s cannot be overridden"), kw));
|
paxusage (_("Keyword %s cannot be overridden"), kw);
|
||||||
if (global)
|
if (global)
|
||||||
xheader_list_append (&keyword_global_override_list, kw, p);
|
xheader_list_append (&keyword_global_override_list, kw, p);
|
||||||
else
|
else
|
||||||
@@ -490,7 +490,7 @@ void
|
|||||||
xheader_forbid_global (void)
|
xheader_forbid_global (void)
|
||||||
{
|
{
|
||||||
if (keyword_global_override_list)
|
if (keyword_global_override_list)
|
||||||
USAGE_ERROR ((0, 0, _("can't update global extended header record")));
|
paxusage (_("can't update global extended header record"));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This is reversal function for xattr_encode_keyword. See comment for
|
/* This is reversal function for xattr_encode_keyword. See comment for
|
||||||
@@ -623,7 +623,7 @@ decode_record (struct xheader *xhdr,
|
|||||||
/* The length is missing.
|
/* The length is missing.
|
||||||
FIXME: Comment why this is diagnosed only if (*p), or change code. */
|
FIXME: Comment why this is diagnosed only if (*p), or change code. */
|
||||||
if (*p)
|
if (*p)
|
||||||
ERROR ((0, 0, _("Malformed extended header: missing length")));
|
paxerror (0, _("Malformed extended header: missing length"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -632,8 +632,8 @@ decode_record (struct xheader *xhdr,
|
|||||||
/* Avoid giant diagnostics, as this won't help user. */
|
/* Avoid giant diagnostics, as this won't help user. */
|
||||||
int len_len = min (len_lim - p, 1000);
|
int len_len = min (len_lim - p, 1000);
|
||||||
|
|
||||||
ERROR ((0, 0, _("Extended header length %.*s is out of range"),
|
paxerror (0, _("Extended header length %.*s is out of range"),
|
||||||
len_len, p));
|
len_len, p);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -643,8 +643,7 @@ decode_record (struct xheader *xhdr,
|
|||||||
continue;
|
continue;
|
||||||
if (p == len_lim)
|
if (p == len_lim)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0, _("Malformed extended header: missing blank after length"));
|
||||||
_("Malformed extended header: missing blank after length")));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -652,13 +651,13 @@ decode_record (struct xheader *xhdr,
|
|||||||
p = strchr (p, '=');
|
p = strchr (p, '=');
|
||||||
if (! (p && p < nextp))
|
if (! (p && p < nextp))
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Malformed extended header: missing equal sign")));
|
paxerror (0, _("Malformed extended header: missing equal sign"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nextp[-1] != '\n')
|
if (nextp[-1] != '\n')
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Malformed extended header: missing newline")));
|
paxerror (0, _("Malformed extended header: missing newline"));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,9 +694,9 @@ decx (void *data, char const *keyword, char const *value, size_t size)
|
|||||||
if (t)
|
if (t)
|
||||||
t->decoder (st, keyword, value, size);
|
t->decoder (st, keyword, value, size);
|
||||||
else
|
else
|
||||||
WARNOPT (WARN_UNKNOWN_KEYWORD,
|
warnopt (WARN_UNKNOWN_KEYWORD, 0,
|
||||||
(0, 0, _("Ignoring unknown extended header keyword %s"),
|
_("Ignoring unknown extended header keyword %s"),
|
||||||
quotearg_style (shell_escape_always_quoting_style, keyword)));
|
quotearg_style (shell_escape_always_quoting_style, keyword));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -803,7 +802,7 @@ xheader_read (struct xheader *xhdr, union block *p, off_t size)
|
|||||||
len = BLOCKSIZE;
|
len = BLOCKSIZE;
|
||||||
|
|
||||||
if (!p)
|
if (!p)
|
||||||
FATAL_ERROR ((0, 0, _("Unexpected EOF in archive")));
|
paxfatal (0, _("Unexpected EOF in archive"));
|
||||||
|
|
||||||
memcpy (&xhdr->buffer[j], p->buffer, len);
|
memcpy (&xhdr->buffer[j], p->buffer, len);
|
||||||
set_next_block_after (p);
|
set_next_block_after (p);
|
||||||
@@ -978,9 +977,10 @@ xheader_string_end (struct xheader *xhdr, char const *keyword)
|
|||||||
size = p;
|
size = p;
|
||||||
if (size != p)
|
if (size != p)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
_("Generated keyword/value pair is too long (keyword=%s, length=%s)"),
|
_("Generated keyword/value pair is too long"
|
||||||
keyword, nbuf));
|
" (keyword=%s, length=%s)"),
|
||||||
|
keyword, nbuf);
|
||||||
obstack_free (xhdr->stk, obstack_finish (xhdr->stk));
|
obstack_free (xhdr->stk, obstack_finish (xhdr->stk));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -1004,8 +1004,8 @@ out_of_range_header (char const *keyword, char const *value,
|
|||||||
{
|
{
|
||||||
/* TRANSLATORS: The first %s is the pax extended header keyword
|
/* TRANSLATORS: The first %s is the pax extended header keyword
|
||||||
(atime, gid, etc.). */
|
(atime, gid, etc.). */
|
||||||
ERROR ((0, 0, _("Extended header %s=%s is out of range %jd..%ju"),
|
paxerror (0, _("Extended header %s=%s is out of range %jd..%ju"),
|
||||||
keyword, value, minval, maxval));
|
keyword, value, minval, maxval);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -1055,14 +1055,14 @@ decode_time (struct timespec *ts, char const *arg, char const *keyword)
|
|||||||
out_of_range_header (keyword, arg, TYPE_MINIMUM (time_t),
|
out_of_range_header (keyword, arg, TYPE_MINIMUM (time_t),
|
||||||
TYPE_MAXIMUM (time_t));
|
TYPE_MAXIMUM (time_t));
|
||||||
else
|
else
|
||||||
ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
|
paxerror (0, _("Malformed extended header: invalid %s=%s"),
|
||||||
keyword, arg));
|
keyword, arg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (*arg_lim)
|
if (*arg_lim)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
|
paxerror (0, _("Malformed extended header: invalid %s=%s"),
|
||||||
keyword, arg));
|
keyword, arg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1095,8 +1095,8 @@ decode_signed_num (intmax_t *num, char const *arg,
|
|||||||
|
|
||||||
if ((arg_lim == arg) | *arg_lim)
|
if ((arg_lim == arg) | *arg_lim)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
|
paxerror (0, _("Malformed extended header: invalid %s=%s"),
|
||||||
keyword, arg));
|
keyword, arg);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1401,8 +1401,8 @@ sparse_offset_decoder (struct tar_stat_info *st,
|
|||||||
if (st->sparse_map_avail < st->sparse_map_size)
|
if (st->sparse_map_avail < st->sparse_map_size)
|
||||||
st->sparse_map[st->sparse_map_avail].offset = u;
|
st->sparse_map[st->sparse_map_avail].offset = u;
|
||||||
else
|
else
|
||||||
ERROR ((0, 0, _("Malformed extended header: excess %s=%s"),
|
paxerror (0, _("Malformed extended header: excess %s=%s"),
|
||||||
"GNU.sparse.offset", arg));
|
"GNU.sparse.offset", arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1426,8 +1426,8 @@ sparse_numbytes_decoder (struct tar_stat_info *st,
|
|||||||
if (st->sparse_map_avail < st->sparse_map_size)
|
if (st->sparse_map_avail < st->sparse_map_size)
|
||||||
st->sparse_map[st->sparse_map_avail++].numbytes = u;
|
st->sparse_map[st->sparse_map_avail++].numbytes = u;
|
||||||
else
|
else
|
||||||
ERROR ((0, 0, _("Malformed extended header: excess %s=%s"),
|
paxerror (0, _("Malformed extended header: excess %s=%s"),
|
||||||
keyword, arg));
|
keyword, arg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1448,8 +1448,8 @@ sparse_map_decoder (struct tar_stat_info *st,
|
|||||||
off_t u = stoint (arg, &delim, &overflow, 0, TYPE_MAXIMUM (off_t));
|
off_t u = stoint (arg, &delim, &overflow, 0, TYPE_MAXIMUM (off_t));
|
||||||
if (delim == arg)
|
if (delim == arg)
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
|
paxerror (0, _("Malformed extended header: invalid %s=%s"),
|
||||||
keyword, arg));
|
keyword, arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1474,8 +1474,8 @@ sparse_map_decoder (struct tar_stat_info *st,
|
|||||||
st->sparse_map[st->sparse_map_avail++] = e;
|
st->sparse_map[st->sparse_map_avail++] = e;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ERROR ((0, 0, _("Malformed extended header: excess %s=%s"),
|
paxerror (0, _("Malformed extended header: excess %s=%s"),
|
||||||
keyword, arg));
|
keyword, arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1486,9 +1486,10 @@ sparse_map_decoder (struct tar_stat_info *st,
|
|||||||
break;
|
break;
|
||||||
else if (*delim != ',')
|
else if (*delim != ',')
|
||||||
{
|
{
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
_("Malformed extended header: invalid %s: unexpected delimiter %c"),
|
_("Malformed extended header: invalid %s:"
|
||||||
keyword, *delim));
|
" unexpected delimiter %c"),
|
||||||
|
keyword, *delim);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1496,9 +1497,10 @@ sparse_map_decoder (struct tar_stat_info *st,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!offset)
|
if (!offset)
|
||||||
ERROR ((0, 0,
|
paxerror (0,
|
||||||
_("Malformed extended header: invalid %s: odd number of values"),
|
_("Malformed extended header: invalid %s:"
|
||||||
keyword));
|
" odd number of values"),
|
||||||
|
keyword);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|||||||
Reference in New Issue
Block a user