new upstream release 1.27 (#1016288)

This commit is contained in:
Ondřej Vašík 2013-10-09 11:39:11 +02:00
parent e72627093d
commit 67775841f5
16 changed files with 27 additions and 7793 deletions

2
.gitignore vendored
View File

@ -6,3 +6,5 @@ tar-1.23.tar.bz2.sig
/tar-1.25.tar.xz.sig
/tar-1.26.tar.xz
/tar-1.26.tar.xz.sig
/tar-1.27.tar.xz
/tar-1.27.tar.xz.sig

View File

@ -1,2 +1,2 @@
0ced6f20b9fa1bea588005b5ad4b52c1 tar-1.26.tar.xz
6618d5fe7785e138c27d7d6a24e998b2 tar-1.26.tar.xz.sig
3484fc42b7a82b82f2305b2971aa0e56 tar-1.27.tar.xz
402afd4829f508991c7e85b3d9a87077 tar-1.27.tar.xz.sig

View File

@ -1,14 +0,0 @@
diff -urNp tar-1.23-orig/src/tar.c tar-1.23/src/tar.c
--- tar-1.23-orig/src/tar.c 2010-06-01 13:55:03.792173060 +0200
+++ tar-1.23/src/tar.c 2010-06-01 14:01:40.494172986 +0200
@@ -1911,6 +1911,10 @@ parse_opt (int key, char *arg, struct ar
_("Invalid number")));
}
break;
+
+ case OLD_ARCHIVE_OPTION:
+ set_archive_format ("v7");
+ break;
case OVERWRITE_DIR_OPTION:
old_files_option = DEFAULT_OLD_FILES;

View File

@ -1,370 +0,0 @@
diff --git a/doc/tar.texi b/doc/tar.texi
index d70d113..a0e3d5f 100644
--- a/doc/tar.texi
+++ b/doc/tar.texi
@@ -1881,6 +1881,7 @@ The other operations of @command{tar} (@option{--list},
@option{--extract}, @option{--compare}, and @option{--update})
will act on the entire contents of the archive.
+@anchor{exit status}
@cindex exit status
@cindex return status
Besides successful exits, @GNUTAR{} may fail for
@@ -2815,7 +2816,10 @@ when extracting files from an archive.
@item --keep-old-files
@itemx -k
-Do not overwrite existing files when extracting files from an archive.
+Do not overwrite existing files when extracting files from an
+archive. Return error if such files exist. See also
+@ref{--skip-old-files}.
+
@xref{Keep Old Files}.
@opsummary{label}
@@ -3268,6 +3272,20 @@ the archive creation operations it instructs @command{tar} to list the
member names stored in the archive, as opposed to the actual file
names. @xref{listing member and file names}.
+@opsummary{skip-old-files}
+@item --skip-old-files
+
+Do not overwrite existing files when extracting files from an
+archive. @xref{Keep Old Files}.
+
+This option differs from @option{--keep-old-files} in that it does not
+treat such files as an error, instead it just silently avoids
+overwriting them.
+
+The @option{--warning=existing-file} option can be used together with
+this option to produce warning messages about existing old files
+(@pxref{warnings}).
+
@opsummary{sparse}
@item --sparse
@itemx -S
@@ -4443,11 +4461,11 @@ in the archive; the most recently archived members will be extracted
last. Additionally, an extracted member will @emph{replace} a file of
the same name which existed in the directory already, and @command{tar}
will not prompt you about this@footnote{Unless you give it
-@option{--keep-old-files} option, or the disk copy is newer than
-the one in the archive and you invoke @command{tar} with
-@option{--keep-newer-files} option.}. Thus, only the most recently archived
-member will end up being extracted, as it will replace the one
-extracted before it, and so on.
+@option{--keep-old-files} (or @option{--skip-old-files}) option, or
+the disk copy is newer than the one in the archive and you invoke
+@command{tar} with @option{--keep-newer-files} option.}. Thus, only
+the most recently archived member will end up being extracted, as it
+will replace the one extracted before it, and so on.
@cindex extracting @var{n}th copy of the file
@xopindex{occurrence, described}
@@ -5123,10 +5141,25 @@ such a directory, use the @option{--no-overwrite-dir} option.
@cindex Overwriting old files, prevention
@xopindex{keep-old-files, introduced}
To be even more cautious and prevent existing files from being replaced, use
-the @option{--keep-old-files} (@option{-k}) option. It causes @command{tar} to refuse
-to replace or update a file that already exists, i.e., a file with the
-same name as an archive member prevents extraction of that archive
-member. Instead, it reports an error.
+the @option{--keep-old-files} (@option{-k}) option. It causes
+@command{tar} to refuse to replace or update a file that already
+exists, i.e., a file with the same name as an archive member prevents
+extraction of that archive member. Instead, it reports an error. For
+example:
+
+@example
+$ @kbd{ls}
+blues
+$ @kbd{tar -x -k -f archive.tar}
+tar: blues: Cannot open: File exists
+tar: Exiting with failure status due to previous errors
+@end example
+
+@xopindex{skip-old-files, introduced}
+If you wish to preserve old files untouched, but don't want
+@command{tar} to treat them as errors, use the
+@option{--skip-old-files} option. This option causes @command{tar} to
+silently skip extracting over existing files.
@xopindex{overwrite, introduced}
To be more aggressive about altering existing files, use the
@@ -5192,16 +5225,24 @@ archive, but remove other files before extracting.
@node Keep Old Files
@unnumberedsubsubsec Keep Old Files
+@GNUTAR{} provides two options to control its actions in a situation
+when it is about to extract a file which already exists on disk.
+
@table @option
@opindex keep-old-files
@item --keep-old-files
@itemx -k
-Do not replace existing files from archive. The
-@option{--keep-old-files} (@option{-k}) option prevents @command{tar}
-from replacing existing files with files with the same name from the
-archive. The @option{--keep-old-files} option is meaningless with
-@option{--list} (@option{-t}). Prevents @command{tar} from replacing
-files in the file system during extraction.
+Do not replace existing files from archive. When such a file is
+encountered, @command{tar} issues an error message. Upon end of
+extraction, @command{tar} exits with code 2 (@pxref{exit status}).
+
+@item --skip-old-files
+Do not replace existing files from archive, but do not treat that
+as error. Such files are silently skipped and do not affect
+@command{tar} exit status.
+
+Additional verbosity can be obtained using @option{--warning=existing-file}
+together with that option (@pxref{warnings}).
@end table
@node Keep Newer Files
diff --git a/src/common.h b/src/common.h
index 0b9bd7a..2409413 100644
--- a/src/common.h
+++ b/src/common.h
@@ -182,6 +182,7 @@ enum old_files
OVERWRITE_OLD_FILES, /* --overwrite */
UNLINK_FIRST_OLD_FILES, /* --unlink-first */
KEEP_OLD_FILES, /* --keep-old-files */
+ SKIP_OLD_FILES, /* --skip-old-files */
KEEP_NEWER_FILES /* --keep-newer-files */
};
GLOBAL enum old_files old_files_option;
@@ -807,11 +808,12 @@ void checkpoint_run (bool do_write);
#define WARN_UNKNOWN_KEYWORD 0x00020000
#define WARN_XDEV 0x00040000
#define WARN_DECOMPRESS_PROGRAM 0x00080000
+#define WARN_EXISTING_FILE 0x00100000
/* The warnings composing WARN_VERBOSE_WARNINGS are enabled by default
in verbose mode */
#define WARN_VERBOSE_WARNINGS (WARN_RENAME_DIRECTORY|WARN_NEW_DIRECTORY|\
- WARN_DECOMPRESS_PROGRAM)
+ WARN_DECOMPRESS_PROGRAM|WARN_EXISTING_FILE)
#define WARN_ALL (~WARN_VERBOSE_WARNINGS)
void set_warning_option (const char *arg);
diff --git a/src/extract.c b/src/extract.c
index aaea56e..662ea0b 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -639,9 +639,14 @@ maybe_recoverable (char *file_name, bool regular, bool *interdir_made)
switch (old_files_option)
{
- case KEEP_OLD_FILES:
+ case SKIP_OLD_FILES:
+ WARNOPT (WARN_EXISTING_FILE,
+ (0, 0, _("%s: skipping existing file"), file_name));
return RECOVER_SKIP;
+ case KEEP_OLD_FILES:
+ return RECOVER_NO;
+
case KEEP_NEWER_FILES:
if (file_newer_p (file_name, stp, &current_stat_info))
break;
diff --git a/src/tar.c b/src/tar.c
index 7b62996..7a673e0 100644
--- a/src/tar.c
+++ b/src/tar.c
@@ -328,6 +328,7 @@ enum
SHOW_DEFAULTS_OPTION,
SHOW_OMITTED_DIRS_OPTION,
SHOW_TRANSFORMED_NAMES_OPTION,
+ SKIP_OLD_FILES_OPTION,
SPARSE_VERSION_OPTION,
STRIP_COMPONENTS_OPTION,
SUFFIX_OPTION,
@@ -452,7 +453,11 @@ static struct argp_option options[] = {
{"remove-files", REMOVE_FILES_OPTION, 0, 0,
N_("remove files after adding them to the archive"), GRID+1 },
{"keep-old-files", 'k', 0, 0,
- N_("don't replace existing files when extracting"), GRID+1 },
+ N_("don't replace existing files when extracting, "
+ "treat them as errors"), GRID+1 },
+ {"skip-old-files", SKIP_OLD_FILES_OPTION, 0, 0,
+ N_("don't replace existing files when extracting, silently skip over them"),
+ GRID+1 },
{"keep-newer-files", KEEP_NEWER_FILES_OPTION, 0, 0,
N_("don't replace existing files that are newer than their archive copies"), GRID+1 },
{"overwrite", OVERWRITE_OPTION, 0, 0,
@@ -1618,6 +1623,10 @@ parse_opt (int key, char *arg, struct argp_state *state)
sparse_option = true;
break;
+ case SKIP_OLD_FILES_OPTION:
+ old_files_option = SKIP_OLD_FILES;
+ break;
+
case SPARSE_VERSION_OPTION:
sparse_option = true;
{
diff --git a/src/warning.c b/src/warning.c
index 5d1bcab..ee9d684 100644
--- a/src/warning.c
+++ b/src/warning.c
@@ -42,6 +42,7 @@ static char const *const warning_args[] = {
"unknown-keyword",
"xdev",
"decompress-program",
+ "existing-file",
NULL
};
@@ -66,7 +67,8 @@ static int warning_types[] = {
WARN_UNKNOWN_CAST,
WARN_UNKNOWN_KEYWORD,
WARN_XDEV,
- WARN_DECOMPRESS_PROGRAM
+ WARN_DECOMPRESS_PROGRAM,
+ WARN_EXISTING_FILE,
};
ARGMATCH_VERIFY (warning_args, warning_types);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 119f1f3..3d78ea2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -77,6 +77,8 @@ TESTSUITE_AT = \
extrac07.at\
extrac08.at\
extrac09.at\
+ extrac18.at\
+ extrac19.at\
extrac10.at\
extrac11.at\
extrac12.at\
diff --git a/tests/extrac18.at b/tests/extrac18.at
new file mode 100644
index 0000000..8b42ef7
--- /dev/null
+++ b/tests/extrac18.at
@@ -0,0 +1,60 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Description: Check the functionality of the --keep-old-files option.
+# It should report an error and cause tar to exit with status 2.
+#
+# There was a regression in versions 1.23 to 1.26 inclusive, where
+# this option silently skipped such files.
+# Reported by: Doug McLaren <dougmc@frenzied.us>,
+# Gary Partis <gary@partis.co.uk>,
+# Jim Meyering <jim@meyering.net>
+#
+# References: <20111117045433.GA8245@algol.frenzied.us>,
+# <4F3D824717847C4487F77228F83329A3514CBB@server.Partis.local>,
+# <87wrar6zzz.fsf@rho.meyering.net>
+
+AT_SETUP([keep-old-files])
+AT_KEYWORDS([extract extrac18 old-files keep-old-files])
+
+AT_TAR_CHECK([
+mkdir dir
+cd dir
+echo 'Old file a' > a
+echo 'Old file b' > b
+
+tar cf ../archive .
+
+rm b
+echo 'File a' > a
+
+tar -x -k -f ../archive
+echo status=$?
+
+cat a
+],
+[0],
+[status=2
+File a
+],
+[tar: ./a: Cannot open: File exists
+tar: Exiting with failure status due to previous errors
+])
+
+AT_CLEANUP
+
diff --git a/tests/extrac19.at b/tests/extrac19.at
new file mode 100644
index 0000000..43c4c50
--- /dev/null
+++ b/tests/extrac19.at
@@ -0,0 +1,44 @@
+# Process this file with autom4te to create testsuite. -*- Autotest -*-
+#
+# Test suite for GNU tar.
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+AT_SETUP([skip-old-files])
+AT_KEYWORDS([extract extrac19 old-files skip-old-files])
+
+AT_TAR_CHECK([
+mkdir dir
+cd dir
+echo 'Old file a' > a
+echo 'Old file b' > b
+
+tar cf ../archive .
+
+rm b
+echo 'File a' > a
+
+tar -x --skip-old-files -f ../archive
+echo status=$?
+
+cat a
+],
+[0],
+[status=0
+File a
+])
+
+AT_CLEANUP
+
diff --git a/tests/testsuite.at b/tests/testsuite.at
index d1dab36..e43653e 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -166,6 +166,9 @@ m4_include([extrac15.at])
m4_include([extrac16.at])
m4_include([extrac17.at])
+m4_include([extrac18.at])
+m4_include([extrac19.at])
+
m4_include([label01.at])
m4_include([label02.at])
m4_include([label03.at])

View File

@ -1,27 +0,0 @@
diff --git a/src/extract.c b/src/extract.c
index 87b383a..340beea 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -1415,6 +1415,13 @@ extract_failure (char *file_name, int typeflag)
return 1;
}
+static int
+extract_skip (char *file_name, int typeflag)
+{
+ skip_member ();
+ return 0;
+}
+
typedef int (*tar_extractor_t) (char *file_name, int typeflag);
@@ -1495,7 +1502,7 @@ prepare_to_extract (char const *file_name, int typeflag, tar_extractor_t *fun)
ERROR ((0, 0,
_("%s: Cannot extract -- file is continued from another volume"),
quotearg_colon (current_stat_info.file_name)));
- *fun = extract_failure;
+ *fun = extract_skip;
break;
case GNUTYPE_LONGNAME:

View File

@ -2,16 +2,6 @@ diff --git a/doc/tar.texi b/doc/tar.texi
index d678db9..ab8a0c8 100644
--- a/doc/tar.texi
+++ b/doc/tar.texi
@@ -37,7 +37,8 @@ This manual is for @acronym{GNU} @command{tar} (version
from archives.
Copyright @copyright{} 1992, 1994, 1995, 1996, 1997, 1999, 2000, 2001,
-2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software Foundation, Inc.
+2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
+Foundation, Inc.
@quotation
Permission is granted to copy, distribute and/or modify this document
@@ -162,6 +163,7 @@ How to Create Archives
How to List Archives
@ -146,8 +136,8 @@ index d678db9..ab8a0c8 100644
@section How to Extract Members from an Archive
@cindex Extraction
@@ -2371,6 +2484,10 @@ Normally when creating an archive, @command{tar} strips an initial
@samp{/} from member names. This option disables that behavior.
@xref{absolute}.
treats names specially if they have initial @samp{/} or internal
@samp{..}. This option disables that behavior. @xref{absolute}.
+@opsummary{acls}
+@item --acls
@ -214,9 +204,9 @@ index d678db9..ab8a0c8 100644
@item --wildcards
Use wildcards when matching member names with patterns.
@@ -4218,6 +4359,11 @@ tar (child): trying gzip
This means that @command{tar} first tried to decompress
@file{archive.Z} using @command{compress}, and, when that
failed, switched to @command{gzip}.
@cindex @samp{Record size = %lu blocks}, warning message
@item record-size
@samp{Record size = %lu blocks}
+@kwindex xattr-write
+@item xattr-write
+@samp{%s: Cannot set '%s' extended attribute for file '%s'}

View File

@ -1,91 +0,0 @@
diff --git a/gnu/stat-time.h b/gnu/stat-time.h
index 1dc4098..7b8428e 100644
--- a/gnu/stat-time.h
+++ b/gnu/stat-time.h
@@ -144,7 +144,7 @@ get_stat_mtime (struct stat const *st)
}
/* Return *ST's birth time, if available; otherwise return a value
- with negative tv_nsec. */
+ with tv_sec and tv_nsec both equal to -1. */
static inline struct timespec
get_stat_birthtime (struct stat const *st)
{
@@ -163,7 +163,7 @@ get_stat_birthtime (struct stat const *st)
t.tv_sec = st->st_ctime;
t.tv_nsec = 0;
#else
- /* Birth time is not supported. Set tv_sec to avoid undefined behavior. */
+ /* Birth time is not supported. */
t.tv_sec = -1;
t.tv_nsec = -1;
/* Avoid a "parameter unused" warning. */
@@ -177,10 +177,12 @@ get_stat_birthtime (struct stat const *st)
using zero. Attempt to work around this problem. Alas, this can
report failure even for valid time stamps. Also, NetBSD
sometimes returns junk in the birth time fields; work around this
- bug if it it is detected. There's no need to detect negative
- tv_nsec junk as negative tv_nsec already indicates an error. */
- if (t.tv_sec == 0 || 1000000000 <= t.tv_nsec)
- t.tv_nsec = -1;
+ bug if it is detected. */
+ if (! (t.tv_sec && 0 <= t.tv_nsec && t.tv_nsec < 1000000000))
+ {
+ t.tv_sec = -1;
+ t.tv_nsec = -1;
+ }
#endif
return t;
diff --git a/src/extract.c b/src/extract.c
index 340beea..3afb95d 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -119,12 +119,15 @@ struct delayed_link
/* The next delayed link in the list. */
struct delayed_link *next;
- /* The device, inode number and ctime of the placeholder. Use
- ctime, not mtime, to make false matches less likely if some
- other process removes the placeholder. */
+ /* The device, inode number and birthtime of the placeholder.
+ birthtime.tv_nsec is negative if the birthtime is not available.
+ Don't use mtime as this would allow for false matches if some
+ other process removes the placeholder. Don't use ctime as
+ this would cause race conditions and other screwups, e.g.,
+ when restoring hard-linked symlinks. */
dev_t dev;
ino_t ino;
- struct timespec ctime;
+ struct timespec birthtime;
/* True if the link is symbolic. */
bool is_symlink;
@@ -1200,7 +1203,7 @@ create_placeholder_file (char *file_name, bool is_symlink, bool *interdir_made)
delayed_link_head = p;
p->dev = st.st_dev;
p->ino = st.st_ino;
- p->ctime = get_stat_ctime (&st);
+ p->birthtime = get_stat_birthtime (&st);
p->is_symlink = is_symlink;
if (is_symlink)
{
@@ -1265,7 +1268,8 @@ extract_link (char *file_name, int typeflag)
if (ds->change_dir == chdir_current
&& ds->dev == st1.st_dev
&& ds->ino == st1.st_ino
- && timespec_cmp (ds->ctime, get_stat_ctime (&st1)) == 0)
+ && (timespec_cmp (ds->birthtime, get_stat_birthtime (&st1))
+ == 0))
{
struct string_list *p = xmalloc (offsetof (struct string_list, string)
+ strlen (file_name) + 1);
@@ -1638,7 +1642,7 @@ apply_delayed_links (void)
if (fstatat (chdir_fd, source, &st, AT_SYMLINK_NOFOLLOW) == 0
&& st.st_dev == ds->dev
&& st.st_ino == ds->ino
- && timespec_cmp (get_stat_ctime (&st), ds->ctime) == 0)
+ && timespec_cmp (get_stat_birthtime (&st), ds->birthtime) == 0)
{
/* Unlink the placeholder, then create a hard link if possible,
a symbolic link otherwise. */

View File

@ -1,66 +0,0 @@
diff --git a/NEWS b/NEWS
index 8aeae33..8f3c416 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,15 @@
GNU tar NEWS - User visible changes. 2012-11-19
Please send GNU tar bug reports to <bug-tar@gnu.org>
+** Sparse files with large data
+
+When creating a PAX-format archive, tar no longer arbitrarily restricts
+the size of the representation of a sparse file to be less than 8 GiB.
+
version 1.26 - Sergey Poznyakoff, 2011-03-12
-* Bugfixes
+* Bug fixes
** Fix the --verify option, which broke in version 1.24.
diff --git a/src/sparse.c b/src/sparse.c
index 4b2f982..cfd0c66 100644
--- a/src/sparse.c
+++ b/src/sparse.c
@@ -919,6 +919,18 @@ pax_sparse_member_p (struct tar_sparse_file *file)
|| file->stat_info->sparse_major > 0;
}
+/* Start a header that uses the effective (shrunken) file size. */
+static union block *
+pax_start_header (struct tar_stat_info *st)
+{
+ off_t realsize = st->stat.st_size;
+ union block *blk;
+ st->stat.st_size = st->archive_file_size;
+ blk = start_header (st);
+ st->stat.st_size = realsize;
+ return blk;
+}
+
static bool
pax_dump_header_0 (struct tar_sparse_file *file)
{
@@ -968,9 +980,7 @@ pax_dump_header_0 (struct tar_sparse_file *file)
return false;
}
}
- blk = start_header (file->stat_info);
- /* Store the effective (shrunken) file size */
- OFF_TO_CHARS (file->stat_info->archive_file_size, blk->header.size);
+ blk = pax_start_header (file->stat_info);
finish_header (file->stat_info, blk, block_ordinal);
if (save_file_name)
{
@@ -1035,9 +1045,7 @@ pax_dump_header_1 (struct tar_sparse_file *file)
if (strlen (file->stat_info->file_name) > NAME_FIELD_SIZE)
file->stat_info->file_name[NAME_FIELD_SIZE] = 0;
- blk = start_header (file->stat_info);
- /* Store the effective (shrunken) file size */
- OFF_TO_CHARS (file->stat_info->archive_file_size, blk->header.size);
+ blk = pax_start_header (file->stat_info);
finish_header (file->stat_info, blk, block_ordinal);
free (file->stat_info->file_name);
file->stat_info->file_name = save_file_name;

View File

@ -1,15 +0,0 @@
diff --git a/src/create.c b/src/create.c
index 25387a9..9a7a05a 100644
--- a/src/create.c
+++ b/src/create.c
@@ -514,8 +514,8 @@ start_private_header (const char *name, size_t size, time_t t)
TIME_TO_CHARS (t, header->header.mtime);
MODE_TO_CHARS (S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH, header->header.mode);
- UID_TO_CHARS (getuid (), header->header.uid);
- GID_TO_CHARS (getgid (), header->header.gid);
+ UID_TO_CHARS (0, header->header.uid);
+ GID_TO_CHARS (0, header->header.gid);
MAJOR_TO_CHARS (0, header->header.devmajor);
MINOR_TO_CHARS (0, header->header.devminor);
strncpy (header->header.magic, TMAGIC, TMAGLEN);

File diff suppressed because it is too large Load Diff

View File

@ -1,230 +0,0 @@
diff --git a/lib/rmt.h b/lib/rmt.h
index 2ce9dc5..4580e49 100644
--- a/lib/rmt.h
+++ b/lib/rmt.h
@@ -17,8 +17,9 @@
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
-extern char *rmt_command;
-extern char *rmt_dev_name__;
+/* upstream fix 0b3d84a0ee */
+extern char const *rmt_command;
+extern char const *rmt_dev_name__;
int rmt_open__ (const char *, int, int, const char *);
int rmt_close__ (int);
diff --git a/lib/rtapelib.c b/lib/rtapelib.c
index 3aee428..1cef0fc 100644
--- a/lib/rtapelib.c
+++ b/lib/rtapelib.c
@@ -90,10 +90,10 @@ static int from_remote[MAXUNIT][2] = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
/* The pipes for sending data to remote tape drives. */
static int to_remote[MAXUNIT][2] = {{-1, -1}, {-1, -1}, {-1, -1}, {-1, -1}};
-char *rmt_command = DEFAULT_RMT_COMMAND;
+char const *rmt_command = DEFAULT_RMT_COMMAND; /* upstream fix 0b3d84a0ee */
/* Temporary variable used by macros in rmt.h. */
-char *rmt_dev_name__;
+char const *rmt_dev_name__; /* upstream fix 0b3d84a0ee */
/* If true, always consider file names to be local, even if they contain
colons */
@@ -490,15 +490,17 @@ rmt_open__ (const char *file_name, int open_mode, int bias,
{
/* Child. */
- close (STDIN_FILENO);
- dup (to_remote[remote_pipe_number][PREAD]);
- close (to_remote[remote_pipe_number][PREAD]);
- close (to_remote[remote_pipe_number][PWRITE]);
-
- close (STDOUT_FILENO);
- dup (from_remote[remote_pipe_number][PWRITE]);
- close (from_remote[remote_pipe_number][PREAD]);
- close (from_remote[remote_pipe_number][PWRITE]);
+ /* upstream fix 0b3d84a0ee */
+ if (dup2 (to_remote[remote_pipe_number][PREAD], STDIN_FILENO) < 0
+ || (to_remote[remote_pipe_number][PREAD] != STDIN_FILENO
+ && close (to_remote[remote_pipe_number][PREAD]) != 0)
+ || (to_remote[remote_pipe_number][PWRITE] != STDIN_FILENO
+ && close (to_remote[remote_pipe_number][PWRITE]) != 0)
+ || dup2 (from_remote[remote_pipe_number][PWRITE], STDOUT_FILENO) < 0
+ || close (from_remote[remote_pipe_number][PREAD]) != 0
+ || close (from_remote[remote_pipe_number][PWRITE]) != 0)
+ error (EXIT_ON_EXEC_ERROR, errno,
+ _("Cannot redirect files for remote shell"));
sys_reset_uid_gid ();
diff --git a/lib/system.h b/lib/system.h
index 2deb585..599d4ba 100644
--- a/lib/system.h
+++ b/lib/system.h
@@ -471,8 +471,13 @@ char *getenv ();
# define SET_BINARY_MODE(arc)
# define ERRNO_IS_EACCES 0
# define TTY_NAME "/dev/tty"
-# define sys_reset_uid_gid() \
- do { setuid (getuid ()); setgid (getgid ()); } while (0)
+
+/* upstream fix 0b3d84a0ee */
+# define sys_reset_uid_gid() \
+ do { \
+ if (! (setuid (getuid ()) == 0 && setgid (getgid ()) == 0)) \
+ abort (); \
+ } while (0)
#endif
#if XENIX
diff --git a/lib/wordsplit.c b/lib/wordsplit.c
index bd5d59d..5f555ea 100644
--- a/lib/wordsplit.c
+++ b/lib/wordsplit.c
@@ -796,6 +796,8 @@ expvar (struct wordsplit *wsp, const char *str, size_t len,
value = "";
}
/* FIXME: handle defstr */
+ (void) defstr; /* upstream commit 17f99bc6f1 */
+
if (value)
{
if (flg & _WSNF_QUOTE)
diff --git a/src/compare.c b/src/compare.c
index 273269a..796d7aa 100644
--- a/src/compare.c
+++ b/src/compare.c
@@ -362,7 +362,7 @@ static void
diff_dumpdir (void)
{
const char *dumpdir_buffer;
- dev_t dev = 0;
+ /* upstream fix 5bb04335079 */
struct stat stat_data;
if (deref_stat (current_stat_info.file_name, &stat_data) != 0)
@@ -372,8 +372,7 @@ diff_dumpdir (void)
else
stat_error (current_stat_info.file_name);
}
- else
- dev = stat_data.st_dev;
+ /* upstream fix 5bb04335079 */
dumpdir_buffer = directory_contents (scan_directory (&current_stat_info));
diff --git a/src/system.c b/src/system.c
index a27a7de..2049240 100644
--- a/src/system.c
+++ b/src/system.c
@@ -25,7 +25,7 @@
#include <signal.h>
#include <wordsplit.h>
-static void
+static void __attribute__ ((__noreturn__)) /* upstream (similar) fix in 17f99bc6f1405 */
xexec (const char *cmd)
{
struct wordsplit ws;
@@ -745,8 +745,7 @@ int
sys_exec_command (char *file_name, int typechar, struct tar_stat_info *st)
{
int p[2];
- char *argv[4];
-
+
xpipe (p);
pipe_handler = signal (SIGPIPE, SIG_IGN);
global_pid = xfork ();
@@ -806,7 +805,6 @@ int
sys_exec_info_script (const char **archive_name, int volume_number)
{
pid_t pid;
- char *argv[4];
char uintbuf[UINTMAX_STRSIZE_BOUND];
int p[2];
static RETSIGTYPE (*saved_handler) (int sig);
@@ -881,7 +879,7 @@ sys_exec_checkpoint_script (const char *script_name,
int checkpoint_number)
{
pid_t pid;
- char *argv[4];
+ /* upstream commit 17f99bc6f */
char uintbuf[UINTMAX_STRSIZE_BOUND];
pid = xfork ();
@@ -912,10 +910,7 @@ sys_exec_checkpoint_script (const char *script_name,
setenv ("TAR_FORMAT",
archive_format_string (current_format == DEFAULT_FORMAT ?
archive_format : current_format), 1);
- argv[0] = "/bin/sh";
- argv[1] = "-c";
- argv[2] = (char *) script_name;
- argv[3] = NULL;
+ /* upstream commit 17f99bc6f */
priv_set_restore_linkdir ();
xexec (script_name);
diff --git a/src/update.c b/src/update.c
index 4739e0d..3b28734 100644
--- a/src/update.c
+++ b/src/update.c
@@ -145,7 +145,7 @@ update_archive (void)
if (S_ISDIR (s.st_mode))
{
char *p, *dirp;
- DIR *stream;
+ DIR *stream = NULL; /* upstream commit 5bb043350790 */
int fd = openat (chdir_fd, name->name,
open_read_flags | O_DIRECTORY);
if (fd < 0)
diff --git a/tests/genfile.c b/tests/genfile.c
index 8541be6..fa480ef 100644
--- a/tests/genfile.c
+++ b/tests/genfile.c
@@ -485,9 +485,11 @@ generate_files_from_list ()
static void
mkhole (int fd, off_t displ)
{
- if (lseek (fd, displ, SEEK_CUR) == -1)
+ off_t offset = lseek (fd, displ, SEEK_CUR);
+ if (offset < 0)
error (EXIT_FAILURE, errno, "lseek");
- ftruncate (fd, lseek (fd, 0, SEEK_CUR));
+ if (ftruncate (fd, offset) != 0)
+ error (EXIT_FAILURE, errno, "ftruncate");
}
static void
@@ -685,13 +687,18 @@ exec_checkpoint (struct action *p)
error (0, errno, _("cannot open `%s'"), p->name);
break;
}
- ftruncate (fd, p->size);
+ if (ftruncate (fd, p->size) != 0)
+ {
+ error (0, errno, _("cannot truncate `%s'"), p->name);
+ break;
+ }
close (fd);
}
break;
case OPT_EXEC:
- system (p->name);
+ if (system (p->name) != 0)
+ error (0, 0, _("command failed: %s"), p->name);
break;
case OPT_UNLINK:
@@ -761,7 +768,8 @@ exec_command (void)
signal (SIGCHLD, SIG_DFL);
#endif
- pipe (fd);
+ if (pipe (fd) != 0)
+ error (EXIT_FAILURE, errno, "pipe");
pid = fork ();
if (pid == -1)

View File

@ -1,14 +0,0 @@
diff --git a/gnu/stdio.in.h b/gnu/stdio.in.h
index 465a9c9..b703457 100644
--- a/gnu/stdio.in.h
+++ b/gnu/stdio.in.h
@@ -164,7 +164,9 @@ _GL_WARN_ON_USE (fflush, "fflush is not always POSIX compliant - "
so any use of gets warrants an unconditional warning. Assume it is
always declared, since it is required by C89. */
#undef gets
+#if HAVE_RAW_DECL_GETS
_GL_WARN_ON_USE (gets, "gets is a security hole - use fgets instead");
+#endif
#if @GNULIB_FOPEN@
# if @REPLACE_FOPEN@

View File

@ -7,9 +7,9 @@ Previously, tar did not update archive with newly created files in archived
directory -- it failed instead with "file not found" error (because it looked
in bad directory in filesystem).
---
src/update.c | 4 +-
tests/Makefile.am | 3 +-
tests/testsuite.at | 3 +-
src/update.c | 2 +-
tests/Makefile.am | 1 +-
tests/testsuite.at | 1 +-
tests/update03.at | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 65 insertions(+), 4 deletions(-)
create mode 100644 tests/update03.at
@ -18,15 +18,6 @@ diff --git a/src/update.c b/src/update.c
index e3228d4..4739e0d 100644
--- a/src/update.c
+++ b/src/update.c
@@ -1,7 +1,7 @@
/* Update a tar archive.
Copyright (C) 1988, 1992, 1994, 1996, 1997, 1999, 2000, 2001, 2003,
- 2004, 2005, 2007, 2010 Free Software Foundation, Inc.
+ 2004, 2005, 2007, 2010, 2011, 2012 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
@@ -159,7 +159,7 @@ update_archive (void)
for (p = dirp; *p; p += strlen (p) + 1)
@ -40,15 +31,6 @@ diff --git a/tests/Makefile.am b/tests/Makefile.am
index ab7d104..119f1f3 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,7 +1,7 @@
# Makefile for GNU tar regression tests.
# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2009 Free Software Foundation, Inc.
+# 2006, 2007, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
# François Pinard <pinard@iro.umontreal.ca>, 1988.
# Sergey Poznyakoff <gray@mirddin.farlep.net>, 2004.
@@ -156,6 +156,7 @@ TESTSUITE_AT = \
update.at\
update01.at\
@ -61,23 +43,14 @@ diff --git a/tests/testsuite.at b/tests/testsuite.at
index 8366ef0..13f7506 100644
--- a/tests/testsuite.at
+++ b/tests/testsuite.at
@@ -1,7 +1,7 @@
# Process this file with autom4te to create testsuite. -*- Autotest -*-
# Test suite for GNU tar.
-# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010 Free Software
+# Copyright (C) 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
@@ -241,6 +241,7 @@ m4_include([spmvp10.at])
m4_include([update.at])
m4_include([update01.at])
m4_include([update02.at])
+m4_include([update03.at])
AT_BANNER([Verifying the archive])
m4_include([verify.at])
diff --git a/tests/update03.at b/tests/update03.at
new file mode 100644
index 0000000..185f9eb

View File

@ -33,4 +33,4 @@ index 5a4bf72..bdf6ba0 100644
+ if (xattrs_option > 0 && st->xattr_map_size)
{
int i;

File diff suppressed because it is too large Load Diff

View File

@ -4,8 +4,8 @@
Summary: A GNU file archiving program
Name: tar
Epoch: 2
Version: 1.26
Release: 28%{?dist}
Version: 1.27
Release: 1%{?dist}
License: GPLv3+
Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/
@ -39,90 +39,30 @@ Patch3: tar-1.17-wildcards.patch
# ~> still downstream
Patch4: tar-1.22-atime-rofs.patch
# The --old-archive option was not working.
# ~> #594044
# ~> http://lists.gnu.org/archive/html/bug-tar/2010-05/msg00015.html
# ~> upstream (2a61a37)
Patch5: tar-1.23-oldarchive.patch
# Fix for bad cooperation of -C and -u options.
# ~> #688567
# ~> http://lists.gnu.org/archive/html/bug-tar/2012-02/msg00007.html
# ~> still downstream
Patch6: tar-1.26-update-with-change-directory.patch
# Fix rawhide build failure with undefined gets.
# ~> upstream (gnulib)
Patch7: tar-1.26-stdio.in.patch
# Fix regression with --keep-old-files option.
# ~> #799252
# ~> http://lists.gnu.org/archive/html/bug-tar/2011-11/msg00043.html
# ~> upstream (7a5a3708c)
Patch8: tar-1.26-add-skip-old-files-option.patch
# Prepare included gnulib library for SELinux support.
# -> Related to the next patch.
Patch9: tar-1.26-selinux-gnulib.patch
# Add support for extended attributes, SELinux and POSIX ACLs.
# ~> Original implementation #200925
# ~> http://lists.gnu.org/archive/html/bug-tar/2012-08/msg00012.html
# ~> upstream (b997c90f9, 696338043, d36f5a3cc, 085cace18, up-to ~> 83701a590)
Patch10: tar-1.26-xattrs.patch
# Fix problem with bit UIDs/GIDs (> 2^21) and --posix format.
# ~> #913406
# ~> upstream (it is part of df7b55a8f6354e)
Patch11: tar-1.26-posix-biguid.patch
# Allow store sparse files of effective size >8GB into pax archives
# ~> #516309
# ~> http://lists.gnu.org/archive/html/bug-tar/2013-01/msg00001.html
# ~> already upstream (2f6c03cba)
Patch12: tar-1.26-pax-big-sparse-files.patch
# Fix: Allow extracting single volume in a multi-volume archive
# ~> #919897
# ~> http://lists.gnu.org/archive/html/bug-tar/2013-03/msg00002.html
# ~> upstream (beca89bc)
Patch13: tar-1.26-allow-extract-single-volume.patch
# Allow to pass arguments to commands called from tar
# ~> resolves #819187 (now we can use ./configure --with-lzma)
# ~> http://lists.gnu.org/archive/html/bug-tar/2013-02/msg00003.html
# ~> upstream: 7b5e803963
Patch14: tar-1.26-command-args.patch
Patch5: tar-1.26-update-with-change-directory.patch
# Do not print xattrs/selinux/acls when --no-xattrs/--no-acls/--no-selinux
# options are used during -tvv output. (TODO: merge this with xattrs patch
# once becomes upstream)
# ~> downstream (yet)
# ~> proposal: http://lists.gnu.org/archive/html/bug-tar/2013-05/msg00020.html
Patch15: tar-1.26-xattrs-printing.patch
# Use a birthtime instead of ctime.
# ~> upstream (189e43 & 49bd10)
# ~> http://lists.gnu.org/archive/html/bug-tar/2011-06/msg00000.html
# ~> http://lists.gnu.org/archive/html/bug-tar/2013-05/msg00022.html
Patch16: tar-1.26-fix-symlink-eating-bug.patch
Patch6: tar-1.26-xattrs-printing.patch
# Add documentation which was not yet pushed upstream
# ~> downstream
# ~> #996753
Patch17: tar-1.26-docu-xattrs.patch
Patch7: tar-1.26-docu-xattrs.patch
# The --xattrs-include or --xattrs-exclude options should imply --xattrs.
# ~> still downstream
# http://lists.gnu.org/archive/html/bug-tar/2013-05/msg00020.html
# ~> #965969
Patch18: tar-1.26-xattrs-include-implies-xattrs.patch
# Silence gcc warnings
# ~> upstream tar: 17f99bc6f, 5bb0433
# ~> upstream paxutils: 0b3d84a0
Patch999: tar-1.26-silence-gcc.patch
Patch8: tar-1.26-xattrs-include-implies-xattrs.patch
# run "make check" by default
%bcond_without check
@ -161,21 +101,10 @@ the rmt package on the remote box.
%patch2 -p1 -b .vfatTruncate
%patch3 -p1 -b .wildcards
%patch4 -p1 -b .rofs
%patch5 -p1 -b .oldarchive
%patch6 -p1 -b .update_and_changedir
%patch7 -p1 -b .gets %{?_rawbuild}
%patch8 -p1 -b .skip-old-files
%patch9 -p1 -b .selinux-gnulib-prep
%patch10 -p1 -b .xattrs-selinux-acls
%patch11 -p1 -b .big_uid_gid
%patch12 -p1 -b .pax-sparse-big-files
%patch13 -p1 -b .extract-single-volume
%patch14 -p1 -b .command-args
%patch15 -p1 -b .print-xattrs-fix
%patch16 -p1 -b .birthtime
%patch17 -p1 -b .xattrs-documentation
%patch18 -p1 -b .xattrs-if-xattrs-include
%patch999 -p1 -b .silence-gcc
%patch5 -p1 -b .update_and_changedir
%patch6 -p1 -b .print-xattrs-fix
%patch7 -p1 -b .xattrs-documentation
%patch8 -p1 -b .xattrs-if-xattrs-include
autoreconf -v
@ -234,6 +163,9 @@ fi
%{_infodir}/tar.info*
%changelog
* Wed Oct 09 2013 Ondrej Vasik <ovaisk@redhat.com> - 1.27-1
- new upstream release 1.27 (#1016288)
* Mon Sep 09 2013 Pavel Raiskup <praiskup@redhat.com> - 1.26-28
- add documenation for xattrs-like options (#996753)
- the --xattrs-include implies --xattrs now (#965969)