new upstream release 1.23, remove applied patches

This commit is contained in:
Ondrej Vasik 2010-03-12 13:55:48 +00:00
parent 49a6d9c8ec
commit a4e0f129a4
14 changed files with 231 additions and 443 deletions

View File

@ -1,2 +1 @@
tar-1.22.tar.bz2 tar-1.23.tar.bz2
tar-1.22.tar.bz2.sig

View File

@ -1,2 +1 @@
07fa517027f426bb80f5f5ff91b63585 tar-1.22.tar.bz2 41e2ca4b924ec7860e51b43ad06cdb7e tar-1.23.tar.bz2
f6398627528d2a8c458cc422cccaeea1 tar-1.22.tar.bz2.sig

View File

@ -1,7 +1,7 @@
diff -ruNp tar-1.22.orig/src/list.c tar-1.22/src/list.c diff -ruNp tar-1.22.orig/src/list.c tar-1.22/src/list.c
--- tar-1.22.orig/src/list.c 2008-10-30 12:10:04.000000000 +0100 --- tar-1.22.orig/src/list.c 2008-10-30 12:10:04.000000000 +0100
+++ tar-1.22/src/list.c 2009-03-06 00:03:05.925105425 +0100 +++ tar-1.22/src/list.c 2009-03-06 00:03:05.925105425 +0100
@@ -136,6 +136,14 @@ read_and (void (*do_something) (void)) @@ -138,6 +138,14 @@ read_and (void (*do_something) (void))
if (!ignore_zeros_option) if (!ignore_zeros_option)
{ {
@ -15,13 +15,14 @@ diff -ruNp tar-1.22.orig/src/list.c tar-1.22/src/list.c
+ +
char buf[UINTMAX_STRSIZE_BOUND]; char buf[UINTMAX_STRSIZE_BOUND];
status = read_header (false); status = read_header (&current_header, &current_stat_info,
@@ -143,6 +151,8 @@ read_and (void (*do_something) (void)) @@ -147,6 +155,9 @@ read_and (void (*do_something) (void))
break; WARNOPT (WARN_ALONE_ZERO_BLOCK,
WARN ((0, 0, _("A lone zero block at %s"), (0, 0, _("A lone zero block at %s"),
STRINGIFY_BIGINT (current_block_ordinal (), buf))); STRINGIFY_BIGINT (current_block_ordinal (), buf)));
+#endif +#endif
+ status = read_header (false); + status = read_header (&current_header, &current_stat_info,
+ read_header_auto);
break; break;
} }
status = prev_status; status = prev_status;

View File

@ -1,12 +0,0 @@
diff -ruNp tar-1.20.orig/src/buffer.c tar-1.20/src/buffer.c
--- tar-1.20.orig/src/buffer.c 2008-11-07 19:16:05.578337476 +0100
+++ tar-1.20/src/buffer.c 2008-11-07 19:16:39.415962458 +0100
@@ -1290,7 +1290,7 @@ _write_volume_label (const char *str)
memset (label, 0, BLOCKSIZE);
- strcpy (label->header.name, volume_label_option);
+ strcpy (label->header.name, str);
assign_string (&current_stat_info.file_name,
label->header.name);
current_stat_info.had_trailing_slash =

View File

@ -54,15 +54,15 @@
/* Warn about implicit use of the wildcards in command line arguments. /* Warn about implicit use of the wildcards in command line arguments.
See TODO */ See TODO */
- warn_regex_usage = args.wildcards == default_wildcards; - warn_regex_usage = args.wildcards == default_wildcards;
+ warn_regex_usage = 0; //args.wildcards == default_wildcards; + warn_regex_usage = 0; /* args.wildcards == default_wildcards; */
/* Derive option values and check option consistency. */ /* Derive option values and check option consistency. */
--- tar-1.17/src/names.c.wildcards 2007-04-03 14:17:13.000000000 +0200 --- tar-1.17/src/names.c.wildcards 2007-04-03 14:17:13.000000000 +0200
+++ tar-1.17/src/names.c 2007-06-28 13:30:48.000000000 +0200 +++ tar-1.17/src/names.c 2007-06-28 13:30:48.000000000 +0200
@@ -812,10 +812,7 @@ collect_and_sort_names (void) @@ -812,10 +812,7 @@ collect_and_sort_names (void)
next_name = name->next; {
if (name->found_count || name->dir_contents) if (name->found_count || name->directory)
continue; continue;
- if (name->matching_flags & EXCLUDE_WILDCARDS) - if (name->matching_flags & EXCLUDE_WILDCARDS)
- /* NOTE: EXCLUDE_ANCHORED is not relevant here */ - /* NOTE: EXCLUDE_ANCHORED is not relevant here */
@ -70,5 +70,16 @@
- continue; - continue;
+ +
chdir_do (name->change_dir); chdir_do (name->change_dir);
if (name->name[0] == 0) if (name->name[0] == 0)
continue; diff -urNp tar-1.23-orig/tests/exclude01.at tar-1.23/tests/exclude01.at
--- tar-1.23-orig/tests/exclude01.at 2010-01-26 12:30:20.000000000 +0100
+++ tar-1.23/tests/exclude01.at 2010-03-12 14:42:31.000000000 +0100
@@ -59,6 +59,7 @@ testdir/dir2/file2
testdir/dir3/
NEXT
testdir/dir1/*
+testdir/dir1/file1
NEXT
testdir/dir1/*
NEXT

View File

@ -2,7 +2,7 @@ diff -urNp tar-1.22-orig/src/create.c tar-1.22/src/create.c
--- tar-1.22-orig/src/create.c 2009-05-15 10:50:38.000000000 +0200 --- tar-1.22-orig/src/create.c 2009-05-15 10:50:38.000000000 +0200
+++ tar-1.22/src/create.c 2009-05-15 10:51:52.000000000 +0200 +++ tar-1.22/src/create.c 2009-05-15 10:51:52.000000000 +0200
@@ -1691,7 +1691,8 @@ dump_file0 (struct tar_stat_info *st, co @@ -1691,7 +1691,8 @@ dump_file0 (struct tar_stat_info *st, co
exit_status = TAREXIT_DIFFERS; set_exit_status (TAREXIT_DIFFERS);
} }
else if (atime_preserve_option == replace_atime_preserve else if (atime_preserve_option == replace_atime_preserve
- && set_file_atime (fd, p, restore_times) != 0) - && set_file_atime (fd, p, restore_times) != 0)

View File

@ -1,59 +0,0 @@
From 6f02669c7ba8da9d9bd0592b8c4f87f399e60061 Mon Sep 17 00:00:00 2001
From: Sergey Poznyakoff <gray@gnu.org.ua>
Date: Mon, 8 Mar 2010 12:27:23 +0200
Subject: [PATCH] Fix eventual memory override and fd exhaustion in create.c
Both bugs reported by Kamil Dudka.
* src/create.c (check_exclusion_tags): Do not keep
pointer to a location within tagname: it may change
after xrealloc. Use byte offset instead.
(dump_file0): Close fd before returning without
dumping the directory.
---
src/create.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/create.c b/src/create.c
index 209e428..c69d340 100644
--- a/src/create.c
+++ b/src/create.c
@@ -79,7 +79,7 @@ check_exclusion_tags (const char *dirname, const char **tag_file_name)
struct exclusion_tag *tag;
size_t dlen = strlen (dirname);
int addslash = dirname[dlen-1] != '/';
- char *nptr = NULL;
+ size_t noff = 0;
for (tag = exclusion_tags; tag; tag = tag->next)
{
@@ -90,14 +90,14 @@ check_exclusion_tags (const char *dirname, const char **tag_file_name)
tagname = xrealloc (tagname, tagsize);
}
- if (!nptr)
+ if (noff == 0)
{
strcpy (tagname, dirname);
- nptr = tagname + dlen;
+ noff = dlen;
if (addslash)
- *nptr++ = '/';
+ tagname[noff++] = '/';
}
- strcpy (nptr, tag->name);
+ strcpy (tagname + noff, tag->name);
if (access (tagname, F_OK) == 0
&& (!tag->predicate || tag->predicate (tagname)))
{
@@ -1591,6 +1591,8 @@ dump_file0 (struct tar_stat_info *st, const char *p,
{
exclusion_tag_warning (st->orig_file_name, tag_file_name,
_("directory not dumped"));
+ if (fd >= 0)
+ close (fd);
return;
}
--
1.6.5

View File

@ -1,25 +0,0 @@
diff -urNp tar-1.22-orig/src/misc.c tar-1.22/src/misc.c
--- tar-1.22-orig/src/misc.c 2007-06-27 15:30:32.000000000 +0200
+++ tar-1.22/src/misc.c 2010-02-04 12:05:00.000000000 +0100
@@ -255,7 +255,20 @@ code_timespec (struct timespec t, char s
time_t s = t.tv_sec;
int ns = t.tv_nsec;
char *np;
- bool negative = s < 0;
+ bool negative;
+
+ /* ignore any negative ns value */
+ if (ns < 0)
+ ns = 0;
+
+ /* ensure (ns < BILLION) to avoid SIGSEGV within code_ns_fraction () */
+ if (BILLION <= ns )
+ {
+ s += ns / BILLION;
+ ns %= BILLION;
+ }
+
+ negative = s < 0;
if (negative && ns != 0)
{

View File

@ -1,13 +0,0 @@
diff -urNp tar-1.22-orig/lib/rtapelib.c tar-1.22/lib/rtapelib.c
--- tar-1.22-orig/lib/rtapelib.c 2007-08-12 09:57:15.000000000 +0200
+++ tar-1.22/lib/rtapelib.c 2010-02-22 13:58:07.000000000 +0100
@@ -573,6 +573,9 @@ rmt_read__ (int handle, char *buffer, si
|| (status = get_status (handle)) == SAFE_READ_ERROR)
return SAFE_READ_ERROR;
+ if (status > length)
+ return SAFE_READ_ERROR;
+
for (counter = 0; counter < status; counter += rlen, buffer += rlen)
{
rlen = safe_read (READ_SIDE (handle), buffer, status - counter);

View File

@ -1,59 +0,0 @@
diff -urNp tar-1.22-orig/src/buffer.c tar-1.22/src/buffer.c
--- tar-1.22-orig/src/buffer.c 2009-03-05 08:04:13.000000000 +0100
+++ tar-1.22/src/buffer.c 2009-06-25 21:42:34.000000000 +0200
@@ -679,6 +679,19 @@ archive_read_error (void)
return;
}
+static bool
+archive_is_dev ()
+{
+ struct stat st;
+
+ if (fstat (archive, &st))
+ {
+ stat_diag (*archive_name_cursor);
+ return false;
+ }
+ return S_ISBLK (st.st_mode) || S_ISCHR (st.st_mode);
+}
+
static void
short_read (size_t status)
{
@@ -690,7 +703,8 @@ short_read (size_t status)
if (left && left % BLOCKSIZE == 0
&& verbose_option
- && record_start_block == 0 && status != 0)
+ && record_start_block == 0 && status != 0
+ && archive_is_dev ())
{
unsigned long rsize = status / BLOCKSIZE;
WARN ((0, 0,
diff -urNp tar-1.22-orig/tests/sparsemvp.at tar-1.22/tests/sparsemvp.at
--- tar-1.22-orig/tests/sparsemvp.at 2008-10-19 23:56:00.000000000 +0200
+++ tar-1.22/tests/sparsemvp.at 2009-06-25 21:55:43.000000000 +0200
@@ -56,7 +56,5 @@ Test archive
sparsefile
Compare archive
],
-[tar: Record size = 12 blocks
-tar: Record size = 12 blocks
-],[],[],[pax])])
+[],[],[],[pax])])
diff -urNp tar-1.22-orig/tests/volsize.at tar-1.22/tests/volsize.at
--- tar-1.22-orig/tests/volsize.at 2008-10-19 23:54:53.000000000 +0200
+++ tar-1.22/tests/volsize.at 2009-06-25 21:56:08.000000000 +0200
@@ -52,9 +52,7 @@ Extracted directory
abc
abc/CCC
],
-[tar: Record size = 5 blocks
-tar: Record size = 5 blocks
-])
+[])
AT_CLEANUP

View File

@ -1,29 +0,0 @@
diff -urNp tar-1.22-orig/lib/utimens.c tar-1.22/lib/utimens.c
--- tar-1.22-orig/lib/utimens.c 2008-10-30 08:57:49.000000000 +0100
+++ tar-1.22/lib/utimens.c 2010-01-05 20:14:50.348792138 +0100
@@ -120,16 +120,17 @@ gl_futimens (int fd ATTRIBUTE_UNUSED,
}
#endif
#if HAVE_FUTIMENS
- {
- int result = futimens (fd, timespec);
+ if (0 <= fd)
+ {
+ int result = futimens (fd, timespec);
# ifdef __linux__
- /* Work around the same bug as above. */
- if (0 < result)
- errno = ENOSYS;
+ /* Work around the same bug as above. */
+ if (0 < result)
+ errno = ENOSYS;
# endif
- if (result == 0 || errno != ENOSYS)
- return result;
- }
+ if (result == 0 || errno != ENOSYS)
+ return result;
+ }
#endif
/* The platform lacks an interface to set file timestamps with

View File

@ -1,11 +0,0 @@
diff -urNp tar-1.22-orig/src/xheader.c tar-1.22/src/xheader.c
--- tar-1.22-orig/src/xheader.c 2009-11-23 15:29:22.000000000 +0100
+++ tar-1.22/src/xheader.c 2009-11-23 15:30:55.000000000 +0100
@@ -722,7 +722,6 @@ xheader_read (struct xheader *xhdr, unio
{
size_t j = 0;
- xheader_init (xhdr);
size += BLOCKSIZE;
xhdr->size = size;
xhdr->buffer = xmalloc (size + 1);

View File

@ -1,8 +1,7 @@
diff --git a/configure.ac b/configure.ac diff -urNp tar-1.23-orig/configure.ac tar-1.23/configure.ac
index 762f8e4..c442489 100644 --- tar-1.23-orig/configure.ac 2010-03-10 11:47:54.000000000 +0100
--- a/configure.ac +++ tar-1.23/configure.ac 2010-03-12 13:48:43.000000000 +0100
+++ b/configure.ac @@ -44,7 +44,7 @@ AC_CHECK_HEADERS_ONCE(fcntl.h linux/fd.h
@@ -40,7 +40,7 @@ AC_CHECK_HEADERS_ONCE(fcntl.h linux/fd.h memory.h net/errno.h \
sys/param.h sys/device.h sys/filio.h sys/gentape.h \ sys/param.h sys/device.h sys/filio.h sys/gentape.h \
sys/inet.h sys/io/trioctl.h \ sys/inet.h sys/io/trioctl.h \
sys/mtio.h sys/time.h sys/tprintf.h sys/tape.h \ sys/mtio.h sys/time.h sys/tprintf.h sys/tape.h \
@ -11,7 +10,7 @@ index 762f8e4..c442489 100644
AC_CHECK_HEADERS([sys/buf.h], [], [], AC_CHECK_HEADERS([sys/buf.h], [], [],
[#if HAVE_SYS_PARAM_H [#if HAVE_SYS_PARAM_H
@@ -88,6 +88,12 @@ gl_INIT @@ -91,6 +91,12 @@ gl_INIT
tar_PAXUTILS tar_PAXUTILS
AC_CHECK_FUNCS(fsync getdtablesize lstat mkfifo readlink symlink setlocale utimes) AC_CHECK_FUNCS(fsync getdtablesize lstat mkfifo readlink symlink setlocale utimes)
@ -24,7 +23,7 @@ index 762f8e4..c442489 100644
AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>]) AC_CHECK_DECLS([getgrgid],,, [#include <grp.h>])
AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>]) AC_CHECK_DECLS([getpwuid],,, [#include <pwd.h>])
AC_CHECK_DECLS([time],,, [#include <time.h>]) AC_CHECK_DECLS([time],,, [#include <time.h>])
@@ -203,6 +209,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_QUOTING_STYLE, $DEFAULT_QUOTING_STYLE, @@ -214,6 +220,7 @@ AC_DEFINE_UNQUOTED(DEFAULT_QUOTING_STYLE
# Iconv # Iconv
AM_ICONV AM_ICONV
AC_CHECK_HEADERS(iconv.h) AC_CHECK_HEADERS(iconv.h)
@ -32,7 +31,7 @@ index 762f8e4..c442489 100644
AC_CHECK_TYPE(iconv_t,:, AC_CHECK_TYPE(iconv_t,:,
AC_DEFINE(iconv_t, int, AC_DEFINE(iconv_t, int,
[Conversion descriptor type]), [Conversion descriptor type]),
@@ -212,6 +219,17 @@ AC_CHECK_TYPE(iconv_t,:, @@ -223,6 +230,17 @@ AC_CHECK_TYPE(iconv_t,:,
#endif #endif
]) ])
@ -50,11 +49,10 @@ index 762f8e4..c442489 100644
# Gettext. # Gettext.
AM_GNU_GETTEXT([external], [need-formatstring-macros]) AM_GNU_GETTEXT([external], [need-formatstring-macros])
AM_GNU_GETTEXT_VERSION([0.16]) AM_GNU_GETTEXT_VERSION([0.16])
diff --git a/doc/tar.texi b/doc/tar.texi diff -urNp tar-1.23-orig/doc/tar.texi tar-1.23/doc/tar.texi
index 7d8952b..e9c5693 100644 --- tar-1.23-orig/doc/tar.texi 2010-03-09 15:24:24.000000000 +0100
--- a/doc/tar.texi +++ tar-1.23/doc/tar.texi 2010-03-12 13:48:43.000000000 +0100
+++ b/doc/tar.texi @@ -2364,6 +2364,10 @@ Normally when creating an archive, @comm
@@ -2345,6 +2345,10 @@ Normally when creating an archive, @command{tar} strips an initial
@samp{/} from member names. This option disables that behavior. @samp{/} from member names. This option disables that behavior.
@xref{absolute}. @xref{absolute}.
@ -65,7 +63,7 @@ index 7d8952b..e9c5693 100644
@opsummary{after-date} @opsummary{after-date}
@item --after-date @item --after-date
@@ -2844,6 +2848,10 @@ contents have changed (as opposed to just @option{--newer}, which will @@ -2885,6 +2889,10 @@ contents have changed (as opposed to jus
also back up files for which any status information has also back up files for which any status information has
changed). @xref{after}. changed). @xref{after}.
@ -76,9 +74,9 @@ index 7d8952b..e9c5693 100644
@opsummary{no-anchored} @opsummary{no-anchored}
@item --no-anchored @item --no-anchored
An exclude pattern can match any subsequence of the name's components. An exclude pattern can match any subsequence of the name's components.
@@ -2919,11 +2927,21 @@ When extracting an archive, subtract the user's umask from files from @@ -2968,11 +2976,21 @@ locations. Usually @command{tar} determ
the permissions specified in the archive. This is the default behavior the archive can be seeked or not. Use this option to disable this
for ordinary users. mechanism.
+@opsummary{no-selinux} +@opsummary{no-selinux}
+@item --no-selinux +@item --no-selinux
@ -98,9 +96,9 @@ index 7d8952b..e9c5693 100644
@opsummary{no-wildcards} @opsummary{no-wildcards}
@item --no-wildcards @item --no-wildcards
Do not use wildcards. Do not use wildcards.
@@ -3151,6 +3169,11 @@ locations. Usually @command{tar} determines automatically whether @@ -3202,6 +3220,11 @@ in cases when such recognition fails. I
the archive can be seeked or not. This option is intended for use archive is open for reading (e.g. with @option{--list} or
in cases when such recognition fails. @option{--extract} options).
+@opsummary{selinux} +@opsummary{selinux}
+@item --selinux +@item --selinux
@ -110,9 +108,9 @@ index 7d8952b..e9c5693 100644
@opsummary{show-defaults} @opsummary{show-defaults}
@item --show-defaults @item --show-defaults
@@ -3349,6 +3372,11 @@ Used in conjunction with @option{--multi-volume}. @command{tar} will @@ -3411,6 +3434,11 @@ Enable or disable warning messages ident
keep track of which volume of a multi-volume archive it is working in messages are suppressed if @var{keyword} is prefixed with @samp{no-}.
@var{file}. @xref{volno-file}. @xref{warnings}.
+@opsummary{xattrs} +@opsummary{xattrs}
+@item --xattrs +@item --xattrs
@ -122,7 +120,7 @@ index 7d8952b..e9c5693 100644
@opsummary{wildcards} @opsummary{wildcards}
@item --wildcards @item --wildcards
Use wildcards when matching member names with patterns. Use wildcards when matching member names with patterns.
@@ -8350,6 +8378,8 @@ implementation able to read @samp{ustar} archives will be able to read @@ -8599,6 +8627,8 @@ implementation able to read @samp{ustar}
most @samp{posix} archives as well, with the only exception that any most @samp{posix} archives as well, with the only exception that any
additional information (such as long file names etc.) will in such additional information (such as long file names etc.) will in such
case be extracted as plain text files along with the files it refers to. case be extracted as plain text files along with the files it refers to.
@ -131,7 +129,7 @@ index 7d8952b..e9c5693 100644
This archive format will be the default format for future versions This archive format will be the default format for future versions
of @GNUTAR{}. of @GNUTAR{}.
@@ -8902,6 +8932,51 @@ Same as both @option{--same-permissions} and @option{--same-order}. @@ -9160,6 +9190,51 @@ Same as both @option{--same-permissions}
This option is deprecated, and will be removed in @GNUTAR{} version 1.23. This option is deprecated, and will be removed in @GNUTAR{} version 1.23.
@ -183,38 +181,10 @@ index 7d8952b..e9c5693 100644
@end table @end table
@node Portability @node Portability
diff --git a/src/Makefile.am b/src/Makefile.am diff -urNp tar-1.23-orig/src/common.h tar-1.23/src/common.h
index c22a568..8755333 100644 --- tar-1.23-orig/src/common.h 2010-01-26 13:21:18.000000000 +0100
--- a/src/Makefile.am +++ tar-1.23/src/common.h 2010-03-12 13:48:43.000000000 +0100
+++ b/src/Makefile.am @@ -251,6 +251,15 @@ GLOBAL int same_owner_option;
@@ -20,7 +20,7 @@
bin_PROGRAMS = tar
-noinst_HEADERS = arith.h common.h tar.h
+noinst_HEADERS = arith.h common.h tar.h xattrs.h
tar_SOURCES = \
buffer.c\
checkpoint.c\
@@ -39,10 +39,11 @@ tar_SOURCES = \
tar.c\
transform.c\
update.c\
- utf8.c
+ utf8.c\
+ xattrs.c
INCLUDES = -I$(top_srcdir)/lib -I../ -I../lib
LDADD = ../lib/libtar.a $(LIBINTL) $(LIBICONV)
-tar_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
+tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME)
diff --git a/src/common.h b/src/common.h
index 9897b46..5318279 100644
--- a/src/common.h
+++ b/src/common.h
@@ -248,6 +248,15 @@ GLOBAL int same_owner_option;
/* If positive, preserve permissions when extracting. */ /* If positive, preserve permissions when extracting. */
GLOBAL int same_permissions_option; GLOBAL int same_permissions_option;
@ -230,7 +200,7 @@ index 9897b46..5318279 100644
/* When set, strip the given number of file name components from the file name /* When set, strip the given number of file name components from the file name
before extracting */ before extracting */
GLOBAL size_t strip_name_components; GLOBAL size_t strip_name_components;
@@ -673,6 +682,9 @@ extern char *output_start; @@ -732,6 +741,9 @@ extern char *output_start;
void update_archive (void); void update_archive (void);
@ -240,7 +210,7 @@ index 9897b46..5318279 100644
/* Module xheader.c. */ /* Module xheader.c. */
void xheader_init (struct xheader *xhdr); void xheader_init (struct xheader *xhdr);
@@ -694,6 +706,12 @@ bool xheader_string_end (struct xheader *xhdr, char const *keyword); @@ -753,6 +765,12 @@ bool xheader_string_end (struct xheader
bool xheader_keyword_deleted_p (const char *kw); bool xheader_keyword_deleted_p (const char *kw);
char *xheader_format_name (struct tar_stat_info *st, const char *fmt, char *xheader_format_name (struct tar_stat_info *st, const char *fmt,
size_t n); size_t n);
@ -253,10 +223,9 @@ index 9897b46..5318279 100644
/* Module system.c */ /* Module system.c */
diff --git a/src/create.c b/src/create.c diff -urNp tar-1.23-orig/src/create.c tar-1.23/src/create.c
index a925160..29a6fd8 100644 --- tar-1.23-orig/src/create.c 2010-03-09 13:52:41.000000000 +0100
--- a/src/create.c +++ tar-1.23/src/create.c 2010-03-12 13:48:43.000000000 +0100
+++ b/src/create.c
@@ -24,6 +24,7 @@ @@ -24,6 +24,7 @@
#include <quotearg.h> #include <quotearg.h>
@ -265,7 +234,7 @@ index a925160..29a6fd8 100644
#include <hash.h> #include <hash.h>
struct link struct link
@@ -944,6 +945,30 @@ start_header (struct tar_stat_info *st) @@ -947,6 +948,30 @@ start_header (struct tar_stat_info *st)
GNAME_TO_CHARS (st->gname, header->header.gname); GNAME_TO_CHARS (st->gname, header->header.gname);
} }
@ -296,7 +265,7 @@ index a925160..29a6fd8 100644
return header; return header;
} }
@@ -1578,6 +1603,10 @@ dump_file0 (struct tar_stat_info *st, const char *p, @@ -1580,6 +1605,10 @@ dump_file0 (struct tar_stat_info *st, co
} }
} }
@ -307,7 +276,7 @@ index a925160..29a6fd8 100644
if (is_dir) if (is_dir)
{ {
const char *tag_file_name; const char *tag_file_name;
@@ -1709,6 +1738,9 @@ dump_file0 (struct tar_stat_info *st, const char *p, @@ -1702,6 +1731,9 @@ dump_file0 (struct tar_stat_info *st, co
if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size) if (NAME_FIELD_SIZE - (archive_format == OLDGNU_FORMAT) < size)
write_long_link (st); write_long_link (st);
@ -317,11 +286,10 @@ index a925160..29a6fd8 100644
block_ordinal = current_block_ordinal (); block_ordinal = current_block_ordinal ();
st->stat.st_size = 0; /* force 0 size on symlink */ st->stat.st_size = 0; /* force 0 size on symlink */
header = start_header (st); header = start_header (st);
diff --git a/src/extract.c b/src/extract.c diff -urNp tar-1.23-orig/src/extract.c tar-1.23/src/extract.c
index 6d70398..ac33df2 100644 --- tar-1.23-orig/src/extract.c 2010-01-26 12:28:09.000000000 +0100
--- a/src/extract.c +++ tar-1.23/src/extract.c 2010-03-12 13:48:43.000000000 +0100
+++ b/src/extract.c @@ -70,6 +70,13 @@ struct delayed_set_stat
@@ -69,6 +69,13 @@ struct delayed_set_stat
mode_t invert_permissions; mode_t invert_permissions;
enum permstatus permstatus; enum permstatus permstatus;
bool after_links; bool after_links;
@ -335,7 +303,7 @@ index 6d70398..ac33df2 100644
char file_name[1]; char file_name[1];
}; };
@@ -96,6 +103,18 @@ struct delayed_link @@ -97,6 +104,18 @@ struct delayed_link
hard-linked together. */ hard-linked together. */
struct string_list *sources; struct string_list *sources;
@ -354,7 +322,7 @@ index 6d70398..ac33df2 100644
/* The desired target of the desired link. */ /* The desired target of the desired link. */
char target[1]; char target[1];
}; };
@@ -276,6 +295,10 @@ set_stat (char const *file_name, @@ -290,6 +309,10 @@ set_stat (char const *file_name,
give files away. */ give files away. */
} }
@ -365,7 +333,7 @@ index 6d70398..ac33df2 100644
if (0 < same_owner_option && permstatus != INTERDIR_PERMSTATUS) if (0 < same_owner_option && permstatus != INTERDIR_PERMSTATUS)
{ {
/* When lchown exists, it should be used to change the attributes of /* When lchown exists, it should be used to change the attributes of
@@ -352,6 +375,29 @@ delay_set_stat (char const *file_name, struct tar_stat_info const *st, @@ -366,6 +389,29 @@ delay_set_stat (char const *file_name, s
data->invert_permissions = invert_permissions; data->invert_permissions = invert_permissions;
data->permstatus = permstatus; data->permstatus = permstatus;
data->after_links = 0; data->after_links = 0;
@ -395,7 +363,7 @@ index 6d70398..ac33df2 100644
strcpy (data->file_name, file_name); strcpy (data->file_name, file_name);
delayed_set_stat_head = data; delayed_set_stat_head = data;
} }
@@ -546,6 +592,31 @@ maybe_recoverable (char *file_name, int *interdir_made) @@ -571,6 +617,31 @@ maybe_recoverable (char *file_name, int
} }
} }
@ -427,7 +395,7 @@ index 6d70398..ac33df2 100644
/* Fix the statuses of all directories whose statuses need fixing, and /* Fix the statuses of all directories whose statuses need fixing, and
which are not ancestors of FILE_NAME. If AFTER_LINKS is which are not ancestors of FILE_NAME. If AFTER_LINKS is
nonzero, do this for all such directories; otherwise, stop at the nonzero, do this for all such directories; otherwise, stop at the
@@ -599,11 +670,22 @@ apply_nonancestor_delayed_set_stat (char const *file_name, bool after_links) @@ -624,11 +695,22 @@ apply_nonancestor_delayed_set_stat (char
sb.stat.st_gid = data->gid; sb.stat.st_gid = data->gid;
sb.atime = data->atime; sb.atime = data->atime;
sb.mtime = data->mtime; sb.mtime = data->mtime;
@ -450,7 +418,7 @@ index 6d70398..ac33df2 100644
free (data); free (data);
} }
} }
@@ -696,7 +778,7 @@ extract_dir (char *file_name, int typeflag) @@ -730,7 +812,7 @@ extract_dir (char *file_name, int typefl
static int static int
@ -459,7 +427,7 @@ index 6d70398..ac33df2 100644
{ {
int fd; int fd;
int openflag = (O_WRONLY | O_BINARY | O_CREAT int openflag = (O_WRONLY | O_BINARY | O_CREAT
@@ -704,6 +786,10 @@ open_output_file (char *file_name, int typeflag, mode_t mode) @@ -738,6 +820,10 @@ open_output_file (char *file_name, int t
? O_TRUNC ? O_TRUNC
: O_EXCL)); : O_EXCL));
@ -470,10 +438,10 @@ index 6d70398..ac33df2 100644
#if O_CTG #if O_CTG
/* Contiguous files (on the Masscomp) have to specify the size in /* Contiguous files (on the Masscomp) have to specify the size in
the open call that creates them. */ the open call that creates them. */
@@ -760,8 +846,18 @@ extract_file (char *file_name, int typeflag) @@ -796,8 +882,18 @@ extract_file (char *file_name, int typef
}
else else
{ {
int recover = RECOVER_NO;
+ int file_created = 0; + int file_created = 0;
+ if (set_xattr (file_name, &current_stat_info, invert_permissions, + if (set_xattr (file_name, &current_stat_info, invert_permissions,
+ typeflag, &file_created)) + typeflag, &file_created))
@ -487,10 +455,10 @@ index 6d70398..ac33df2 100644
- fd = open_output_file (file_name, typeflag, mode ^ invert_permissions); - fd = open_output_file (file_name, typeflag, mode ^ invert_permissions);
+ fd = open_output_file (file_name, typeflag, mode ^ invert_permissions, + fd = open_output_file (file_name, typeflag, mode ^ invert_permissions,
+ file_created); + file_created);
while (fd < 0 && maybe_recoverable (file_name, &interdir_made)); while (fd < 0
&& (recover = maybe_recoverable (file_name, &interdir_made))
if (fd < 0) == RECOVER_OK);
@@ -882,6 +978,13 @@ create_placeholder_file (char *file_name, bool is_symlink, int *interdir_made) @@ -922,6 +1018,13 @@ create_placeholder_file (char *file_name
+ strlen (file_name) + 1); + strlen (file_name) + 1);
p->sources->next = 0; p->sources->next = 0;
strcpy (p->sources->string, file_name); strcpy (p->sources->string, file_name);
@ -504,7 +472,7 @@ index 6d70398..ac33df2 100644
strcpy (p->target, current_stat_info.link_name); strcpy (p->target, current_stat_info.link_name);
h = delayed_set_stat_head; h = delayed_set_stat_head;
@@ -1288,6 +1391,13 @@ apply_delayed_links (void) @@ -1335,6 +1438,13 @@ apply_delayed_links (void)
struct tar_stat_info st1; struct tar_stat_info st1;
st1.stat.st_uid = ds->uid; st1.stat.st_uid = ds->uid;
st1.stat.st_gid = ds->gid; st1.stat.st_gid = ds->gid;
@ -518,7 +486,7 @@ index 6d70398..ac33df2 100644
set_stat (source, &st1, NULL, 0, 0, SYMTYPE); set_stat (source, &st1, NULL, 0, 0, SYMTYPE);
valid_source = source; valid_source = source;
} }
@@ -1301,6 +1411,9 @@ apply_delayed_links (void) @@ -1348,6 +1458,9 @@ apply_delayed_links (void)
sources = next; sources = next;
} }
@ -528,11 +496,10 @@ index 6d70398..ac33df2 100644
{ {
struct delayed_link *next = ds->next; struct delayed_link *next = ds->next;
free (ds); free (ds);
diff --git a/src/list.c b/src/list.c diff -urNp tar-1.23-orig/src/list.c tar-1.23/src/list.c
index c060701..abb94bf 100644 --- tar-1.23-orig/src/list.c 2010-03-12 13:40:53.000000000 +0100
--- a/src/list.c +++ tar-1.23/src/list.c 2010-03-12 13:48:43.000000000 +0100
+++ b/src/list.c @@ -585,6 +585,13 @@ decode_header (union block *header, stru
@@ -568,6 +568,13 @@ decode_header (union block *header, struct tar_stat_info *stat_info,
assign_string (&stat_info->gname, assign_string (&stat_info->gname,
header->header.gname[0] ? header->header.gname : NULL); header->header.gname[0] ? header->header.gname : NULL);
@ -546,11 +513,36 @@ index c060701..abb94bf 100644
if (format == OLDGNU_FORMAT && incremental_option) if (format == OLDGNU_FORMAT && incremental_option)
{ {
stat_info->atime.tv_sec = TIME_FROM_HEADER (header->oldgnu_header.atime); stat_info->atime.tv_sec = TIME_FROM_HEADER (header->oldgnu_header.atime);
diff --git a/src/tar.c b/src/tar.c diff -urNp tar-1.23-orig/src/Makefile.am tar-1.23/src/Makefile.am
index dbffc2a..510350b 100644 --- tar-1.23-orig/src/Makefile.am 2010-01-26 12:30:20.000000000 +0100
--- a/src/tar.c +++ tar-1.23/src/Makefile.am 2010-03-12 13:48:43.000000000 +0100
+++ b/src/tar.c @@ -20,7 +20,7 @@
@@ -246,7 +246,8 @@ tar_set_quoting_style (char *arg)
bin_PROGRAMS = tar
-noinst_HEADERS = arith.h common.h tar.h
+noinst_HEADERS = arith.h common.h tar.h xattrs.h
tar_SOURCES = \
buffer.c\
checkpoint.c\
@@ -42,10 +42,11 @@ tar_SOURCES = \
unlink.c\
update.c\
utf8.c\
- warning.c
+ warning.c\
+ xattrs.c
INCLUDES = -I$(top_srcdir)/gnu -I../ -I../gnu -I$(top_srcdir)/lib -I../lib
LDADD = ../lib/libtar.a ../gnu/libgnu.a $(LIBINTL) $(LIBICONV)
-tar_LDADD = $(LDADD) $(LIB_CLOCK_GETTIME)
+tar_LDADD = $(LIBS) $(LDADD) $(LIB_CLOCK_GETTIME)
diff -urNp tar-1.23-orig/src/tar.c tar-1.23/src/tar.c
--- tar-1.23-orig/src/tar.c 2010-03-09 13:52:41.000000000 +0100
+++ tar-1.23/src/tar.c 2010-03-12 13:48:43.000000000 +0100
@@ -255,7 +255,8 @@ tar_set_quoting_style (char *arg)
enum enum
{ {
@ -560,7 +552,7 @@ index dbffc2a..510350b 100644
ATIME_PRESERVE_OPTION, ATIME_PRESERVE_OPTION,
BACKUP_OPTION, BACKUP_OPTION,
CHECK_DEVICE_OPTION, CHECK_DEVICE_OPTION,
@@ -276,6 +277,7 @@ enum @@ -287,6 +288,7 @@ enum
MODE_OPTION, MODE_OPTION,
MTIME_OPTION, MTIME_OPTION,
NEWER_MTIME_OPTION, NEWER_MTIME_OPTION,
@ -568,10 +560,10 @@ index dbffc2a..510350b 100644
NO_ANCHORED_OPTION, NO_ANCHORED_OPTION,
NO_AUTO_COMPRESS_OPTION, NO_AUTO_COMPRESS_OPTION,
NO_CHECK_DEVICE_OPTION, NO_CHECK_DEVICE_OPTION,
@@ -288,9 +290,11 @@ enum @@ -300,9 +302,11 @@ enum
NO_RECURSION_OPTION,
NO_SAME_OWNER_OPTION, NO_SAME_OWNER_OPTION,
NO_SAME_PERMISSIONS_OPTION, NO_SAME_PERMISSIONS_OPTION,
NO_SEEK_OPTION,
+ NO_SELINUX_CONTEXT_OPTION, + NO_SELINUX_CONTEXT_OPTION,
NO_UNQUOTE_OPTION, NO_UNQUOTE_OPTION,
NO_WILDCARDS_MATCH_SLASH_OPTION, NO_WILDCARDS_MATCH_SLASH_OPTION,
@ -580,7 +572,7 @@ index dbffc2a..510350b 100644
NULL_OPTION, NULL_OPTION,
NUMERIC_OWNER_OPTION, NUMERIC_OWNER_OPTION,
OCCURRENCE_OPTION, OCCURRENCE_OPTION,
@@ -312,6 +316,7 @@ enum @@ -324,6 +328,7 @@ enum
RMT_COMMAND_OPTION, RMT_COMMAND_OPTION,
RSH_COMMAND_OPTION, RSH_COMMAND_OPTION,
SAME_OWNER_OPTION, SAME_OWNER_OPTION,
@ -588,9 +580,9 @@ index dbffc2a..510350b 100644
SHOW_DEFAULTS_OPTION, SHOW_DEFAULTS_OPTION,
SHOW_OMITTED_DIRS_OPTION, SHOW_OMITTED_DIRS_OPTION,
SHOW_TRANSFORMED_NAMES_OPTION, SHOW_TRANSFORMED_NAMES_OPTION,
@@ -328,7 +333,8 @@ enum @@ -339,7 +344,8 @@ enum
VERSION_OPTION,
VOLNO_FILE_OPTION, VOLNO_FILE_OPTION,
WARNING_OPTION,
WILDCARDS_MATCH_SLASH_OPTION, WILDCARDS_MATCH_SLASH_OPTION,
- WILDCARDS_OPTION - WILDCARDS_OPTION
+ WILDCARDS_OPTION, + WILDCARDS_OPTION,
@ -598,7 +590,7 @@ index dbffc2a..510350b 100644
}; };
const char *argp_program_version = "tar (" PACKAGE_NAME ") " VERSION; const char *argp_program_version = "tar (" PACKAGE_NAME ") " VERSION;
@@ -465,6 +471,10 @@ static struct argp_option options[] = { @@ -485,6 +491,10 @@ static struct argp_option options[] = {
{NULL, 0, NULL, 0, {NULL, 0, NULL, 0,
N_("Handling of file attributes:"), GRID }, N_("Handling of file attributes:"), GRID },
@ -609,7 +601,7 @@ index dbffc2a..510350b 100644
{"owner", OWNER_OPTION, N_("NAME"), 0, {"owner", OWNER_OPTION, N_("NAME"), 0,
N_("force NAME as owner for added files"), GRID+1 }, N_("force NAME as owner for added files"), GRID+1 },
{"group", GROUP_OPTION, N_("NAME"), 0, {"group", GROUP_OPTION, N_("NAME"), 0,
@@ -495,6 +505,14 @@ static struct argp_option options[] = { @@ -515,6 +525,14 @@ static struct argp_option options[] = {
{"preserve-order", 's', 0, 0, {"preserve-order", 's', 0, 0,
N_("sort names to extract to match archive"), GRID+1 }, N_("sort names to extract to match archive"), GRID+1 },
{"same-order", 0, 0, OPTION_ALIAS, NULL, GRID+1 }, {"same-order", 0, 0, OPTION_ALIAS, NULL, GRID+1 },
@ -624,7 +616,7 @@ index dbffc2a..510350b 100644
{"preserve", PRESERVE_OPTION, 0, 0, {"preserve", PRESERVE_OPTION, 0, 0,
N_("same as both -p and -s"), GRID+1 }, N_("same as both -p and -s"), GRID+1 },
{"delay-directory-restore", DELAY_DIRECTORY_RESTORE_OPTION, 0, 0, {"delay-directory-restore", DELAY_DIRECTORY_RESTORE_OPTION, 0, 0,
@@ -1932,6 +1950,37 @@ parse_opt (int key, char *arg, struct argp_state *state) @@ -2060,6 +2078,37 @@ parse_opt (int key, char *arg, struct ar
same_permissions_option = -1; same_permissions_option = -1;
break; break;
@ -662,7 +654,7 @@ index dbffc2a..510350b 100644
case RECURSION_OPTION: case RECURSION_OPTION:
recursion_option = FNM_LEADING_DIR; recursion_option = FNM_LEADING_DIR;
break; break;
@@ -2330,6 +2379,29 @@ decode_options (int argc, char **argv) @@ -2442,6 +2491,29 @@ decode_options (int argc, char **argv)
|| subcommand_option != LIST_SUBCOMMAND)) || subcommand_option != LIST_SUBCOMMAND))
USAGE_ERROR ((0, 0, _("--pax-option can be used only on POSIX archives"))); USAGE_ERROR ((0, 0, _("--pax-option can be used only on POSIX archives")));
@ -692,7 +684,7 @@ index dbffc2a..510350b 100644
/* If ready to unlink hierarchies, so we are for simpler files. */ /* If ready to unlink hierarchies, so we are for simpler files. */
if (recursive_unlink_option) if (recursive_unlink_option)
old_files_option = UNLINK_FIRST_OLD_FILES; old_files_option = UNLINK_FIRST_OLD_FILES;
@@ -2544,11 +2616,15 @@ tar_stat_init (struct tar_stat_info *st) @@ -2662,11 +2734,15 @@ tar_stat_init (struct tar_stat_info *st)
void void
tar_stat_destroy (struct tar_stat_info *st) tar_stat_destroy (struct tar_stat_info *st)
{ {
@ -708,10 +700,9 @@ index dbffc2a..510350b 100644
free (st->sparse_map); free (st->sparse_map);
free (st->dumpdir); free (st->dumpdir);
xheader_destroy (&st->xhdr); xheader_destroy (&st->xhdr);
diff --git a/src/tar.h b/src/tar.h diff -urNp tar-1.23-orig/src/tar.h tar-1.23/src/tar.h
index 7f72f3e..49ee1ee 100644 --- tar-1.23-orig/src/tar.h 2010-01-26 12:30:20.000000000 +0100
--- a/src/tar.h +++ tar-1.23/src/tar.h 2010-03-12 13:48:43.000000000 +0100
+++ b/src/tar.h
@@ -276,6 +276,14 @@ struct xheader @@ -276,6 +276,14 @@ struct xheader
uintmax_t string_length; uintmax_t string_length;
}; };
@ -753,11 +744,9 @@ index 7f72f3e..49ee1ee 100644
/* Extended headers */ /* Extended headers */
struct xheader xhdr; struct xheader xhdr;
diff --git a/src/xattrs.c b/src/xattrs.c diff -urNp tar-1.23-orig/src/xattrs.c tar-1.23/src/xattrs.c
new file mode 100644 --- tar-1.23-orig/src/xattrs.c 1970-01-01 01:00:00.000000000 +0100
index 0000000..fea18c3 +++ tar-1.23/src/xattrs.c 2010-03-12 13:48:43.000000000 +0100
--- /dev/null
+++ b/src/xattrs.c
@@ -0,0 +1,488 @@ @@ -0,0 +1,488 @@
+/* Create a tar archive. +/* Create a tar archive.
+ +
@ -1247,11 +1236,9 @@ index 0000000..fea18c3
+#endif +#endif
+ } + }
+} +}
diff --git a/src/xattrs.h b/src/xattrs.h diff -urNp tar-1.23-orig/src/xattrs.h tar-1.23/src/xattrs.h
new file mode 100644 --- tar-1.23-orig/src/xattrs.h 1970-01-01 01:00:00.000000000 +0100
index 0000000..ebbd5c6 +++ tar-1.23/src/xattrs.h 2010-03-12 13:48:43.000000000 +0100
--- /dev/null
+++ b/src/xattrs.h
@@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
+ +
+extern void xattrs_acls_get(struct tar_stat_info *st, +extern void xattrs_acls_get(struct tar_stat_info *st,
@ -1267,12 +1254,11 @@ index 0000000..ebbd5c6
+ char const *file_name, char typeflag); + char const *file_name, char typeflag);
+extern void xattrs_xattrs_set(struct tar_stat_info const *st, +extern void xattrs_xattrs_set(struct tar_stat_info const *st,
+ char const *file_name, char typeflag); + char const *file_name, char typeflag);
diff --git a/src/xheader.c b/src/xheader.c diff -urNp tar-1.23-orig/src/xheader.c tar-1.23/src/xheader.c
index 919ecd3..8e18421 100644 --- tar-1.23-orig/src/xheader.c 2010-02-12 11:03:09.000000000 +0100
--- a/src/xheader.c +++ tar-1.23/src/xheader.c 2010-03-12 13:50:44.000000000 +0100
+++ b/src/xheader.c @@ -459,6 +459,74 @@ xheader_write_global (struct xheader *xh
@@ -417,6 +417,74 @@ xheader_write_global (struct xheader *xhdr) }
free (name);
} }
+void xheader_xattr_init(struct tar_stat_info *st) +void xheader_xattr_init(struct tar_stat_info *st)
@ -1346,15 +1332,15 @@ index 919ecd3..8e18421 100644
/* General Interface */ /* General Interface */
@@ -427,6 +495,7 @@ struct xhdr_tab @@ -472,6 +540,7 @@ struct xhdr_tab
struct xheader *, void const *data); struct xheader *, void const *data);
void (*decoder) (struct tar_stat_info *, char const *, char const *, size_t); void (*decoder) (struct tar_stat_info *, char const *, char const *, size_t);
bool protect; int flags;
+ bool prefix; + bool prefix;
}; };
/* This declaration must be extern, because ISO C99 section 6.9.2 /* This declaration must be extern, because ISO C99 section 6.9.2
@@ -443,8 +512,17 @@ locate_handler (char const *keyword) @@ -488,8 +557,17 @@ locate_handler (char const *keyword)
struct xhdr_tab const *p; struct xhdr_tab const *p;
for (p = xhdr_tab; p->keyword; p++) for (p = xhdr_tab; p->keyword; p++)
@ -1374,25 +1360,25 @@ index 919ecd3..8e18421 100644
return NULL; return NULL;
} }
@@ -454,7 +532,7 @@ xheader_protected_pattern_p (const char *pattern) @@ -499,7 +577,7 @@ xheader_protected_pattern_p (const char
struct xhdr_tab const *p; struct xhdr_tab const *p;
for (p = xhdr_tab; p->keyword; p++) for (p = xhdr_tab; p->keyword; p++)
- if (p->protect && fnmatch (pattern, p->keyword, 0) == 0) - if ((p->flags & XHDR_PROTECTED) && fnmatch (pattern, p->keyword, 0) == 0)
+ if (!p->prefix && p->protect && fnmatch (pattern, p->keyword, 0) == 0) + if (!p->prefix && (p->flags & XHDR_PROTECTED) && fnmatch (pattern, p->keyword, 0) == 0)
return true; return true;
return false; return false;
} }
@@ -465,7 +543,7 @@ xheader_protected_keyword_p (const char *keyword) @@ -510,7 +588,7 @@ xheader_protected_keyword_p (const char
struct xhdr_tab const *p; struct xhdr_tab const *p;
for (p = xhdr_tab; p->keyword; p++) for (p = xhdr_tab; p->keyword; p++)
- if (p->protect && strcmp (p->keyword, keyword) == 0) - if ((p->flags & XHDR_PROTECTED) && strcmp (p->keyword, keyword) == 0)
+ if (!p->prefix && p->protect && strcmp (p->keyword, keyword) == 0) + if (!p->prefix && (p->flags & XHDR_PROTECTED) && strcmp (p->keyword, keyword) == 0)
return true; return true;
return false; return false;
} }
@@ -1417,6 +1495,71 @@ volume_filename_decoder (struct tar_stat_info *st, @@ -1469,6 +1547,71 @@ volume_filename_decoder (struct tar_stat
} }
static void static void
@ -1464,109 +1450,125 @@ index 919ecd3..8e18421 100644
sparse_major_coder (struct tar_stat_info const *st, char const *keyword, sparse_major_coder (struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr, void const *data) struct xheader *xhdr, void const *data)
{ {
@@ -1453,18 +1596,18 @@ sparse_minor_decoder (struct tar_stat_info *st, @@ -1505,53 +1648,53 @@ sparse_minor_decoder (struct tar_stat_in
} }
struct xhdr_tab const xhdr_tab[] = { struct xhdr_tab const xhdr_tab[] = {
- { "atime", atime_coder, atime_decoder, false }, - { "atime", atime_coder, atime_decoder, 0 },
- { "comment", dummy_coder, dummy_decoder, false }, - { "comment", dummy_coder, dummy_decoder, 0 },
- { "charset", dummy_coder, dummy_decoder, false }, - { "charset", dummy_coder, dummy_decoder, 0 },
- { "ctime", ctime_coder, ctime_decoder, false }, - { "ctime", ctime_coder, ctime_decoder, 0 },
- { "gid", gid_coder, gid_decoder, false }, - { "gid", gid_coder, gid_decoder, 0 },
- { "gname", gname_coder, gname_decoder, false }, - { "gname", gname_coder, gname_decoder, 0 },
- { "linkpath", linkpath_coder, linkpath_decoder, false }, - { "linkpath", linkpath_coder, linkpath_decoder, 0 },
- { "mtime", mtime_coder, mtime_decoder, false }, - { "mtime", mtime_coder, mtime_decoder, 0 },
- { "path", path_coder, path_decoder, false }, - { "path", path_coder, path_decoder, 0 },
- { "size", size_coder, size_decoder, false }, - { "size", size_coder, size_decoder, 0 },
- { "uid", uid_coder, uid_decoder, false }, - { "uid", uid_coder, uid_decoder, 0 },
- { "uname", uname_coder, uname_decoder, false }, - { "uname", uname_coder, uname_decoder, 0 },
+ { "atime", atime_coder, atime_decoder, false, false }, + { "atime", atime_coder, atime_decoder, 0, false },
+ { "comment", dummy_coder, dummy_decoder, false, false }, + { "comment", dummy_coder, dummy_decoder, 0, false },
+ { "charset", dummy_coder, dummy_decoder, false, false }, + { "charset", dummy_coder, dummy_decoder, 0, false },
+ { "ctime", ctime_coder, ctime_decoder, false, false }, + { "ctime", ctime_coder, ctime_decoder, 0, false },
+ { "gid", gid_coder, gid_decoder, false, false }, + { "gid", gid_coder, gid_decoder, 0, false },
+ { "gname", gname_coder, gname_decoder, false, false }, + { "gname", gname_coder, gname_decoder, 0, false },
+ { "linkpath", linkpath_coder, linkpath_decoder, false, false }, + { "linkpath", linkpath_coder, linkpath_decoder, 0, false },
+ { "mtime", mtime_coder, mtime_decoder, false, false }, + { "mtime", mtime_coder, mtime_decoder, 0, false },
+ { "path", path_coder, path_decoder, false, false }, + { "path", path_coder, path_decoder, 0, false },
+ { "size", size_coder, size_decoder, false, false }, + { "size", size_coder, size_decoder, 0, false },
+ { "uid", uid_coder, uid_decoder, false, false }, + { "uid", uid_coder, uid_decoder, 0, false },
+ { "uname", uname_coder, uname_decoder, false, false }, + { "uname", uname_coder, uname_decoder, 0, false },
/* Sparse file handling */ /* Sparse file handling */
{ "GNU.sparse.name", path_coder, path_decoder, { "GNU.sparse.name", path_coder, path_decoder,
@@ -1479,25 +1622,25 @@ struct xhdr_tab const xhdr_tab[] = { - XHDR_PROTECTED },
true }, + XHDR_PROTECTED, false },
{ "GNU.sparse.major", sparse_major_coder, sparse_major_decoder,
- XHDR_PROTECTED },
+ XHDR_PROTECTED, false },
{ "GNU.sparse.minor", sparse_minor_coder, sparse_minor_decoder,
- XHDR_PROTECTED },
+ XHDR_PROTECTED, false },
{ "GNU.sparse.realsize", sparse_size_coder, sparse_size_decoder,
- XHDR_PROTECTED },
+ XHDR_PROTECTED, false },
{ "GNU.sparse.numblocks", sparse_numblocks_coder, sparse_numblocks_decoder,
- XHDR_PROTECTED },
+ XHDR_PROTECTED, false },
/* tar 1.14 - 1.15.90 keywords. */ /* tar 1.14 - 1.15.90 keywords. */
- { "GNU.sparse.size", sparse_size_coder, sparse_size_decoder, true }, { "GNU.sparse.size", sparse_size_coder, sparse_size_decoder,
+ { "GNU.sparse.size", sparse_size_coder, sparse_size_decoder, true, false }, - XHDR_PROTECTED },
+ XHDR_PROTECTED, false },
/* tar 1.14 - 1.15.1 keywords. Multiple instances of these appeared in 'x' /* tar 1.14 - 1.15.1 keywords. Multiple instances of these appeared in 'x'
headers, and each of them was meaningful. It confilcted with POSIX specs, headers, and each of them was meaningful. It confilcted with POSIX specs,
which requires that "when extended header records conflict, the last one which requires that "when extended header records conflict, the last one
given in the header shall take precedence." */ given in the header shall take precedence." */
{ "GNU.sparse.offset", sparse_offset_coder, sparse_offset_decoder, { "GNU.sparse.offset", sparse_offset_coder, sparse_offset_decoder,
- true }, - XHDR_PROTECTED },
+ true, false }, + XHDR_PROTECTED, false },
{ "GNU.sparse.numbytes", sparse_numbytes_coder, sparse_numbytes_decoder, { "GNU.sparse.numbytes", sparse_numbytes_coder, sparse_numbytes_decoder,
- true }, - XHDR_PROTECTED },
+ true, false }, + XHDR_PROTECTED, false },
/* tar 1.15.90 keyword, introduced to remove the above-mentioned conflict. */ /* tar 1.15.90 keyword, introduced to remove the above-mentioned conflict. */
{ "GNU.sparse.map", NULL /* Unused, see pax_dump_header() */, { "GNU.sparse.map", NULL /* Unused, see pax_dump_header() */,
- sparse_map_decoder, false }, - sparse_map_decoder, 0 },
+ sparse_map_decoder, false, false }, + sparse_map_decoder, 0, false },
{ "GNU.dumpdir", dumpdir_coder, dumpdir_decoder, { "GNU.dumpdir", dumpdir_coder, dumpdir_decoder,
- true }, - XHDR_PROTECTED },
+ true, false }, + XHDR_PROTECTED, false },
/* Keeps the tape/volume label. May be present only in the global headers. /* Keeps the tape/volume label. May be present only in the global headers.
Equivalent to GNUTYPE_VOLHDR. */ Equivalent to GNUTYPE_VOLHDR. */
- { "GNU.volume.label", volume_label_coder, volume_label_decoder, true }, { "GNU.volume.label", volume_label_coder, volume_label_decoder,
+ { "GNU.volume.label", volume_label_coder, volume_label_decoder, true, false }, - XHDR_PROTECTED | XHDR_GLOBAL },
+ XHDR_PROTECTED | XHDR_GLOBAL, false },
/* These may be present in a first global header of the archive. /* These may be present in a first global header of the archive.
They provide the same functionality as GNUTYPE_MULTIVOL header. They provide the same functionality as GNUTYPE_MULTIVOL header.
@@ -1506,9 +1649,39 @@ struct xhdr_tab const xhdr_tab[] = { @@ -1560,11 +1703,40 @@ struct xhdr_tab const xhdr_tab[] = {
GNU.volume.offset keeps the offset of the start of this volume, GNU.volume.offset keeps the offset of the start of this volume,
otherwise kept in oldgnu_header.offset. */ otherwise kept in oldgnu_header.offset. */
{ "GNU.volume.filename", volume_label_coder, volume_filename_decoder, { "GNU.volume.filename", volume_label_coder, volume_filename_decoder,
- true }, - XHDR_PROTECTED | XHDR_GLOBAL },
- { "GNU.volume.size", volume_size_coder, volume_size_decoder, true }, + XHDR_PROTECTED | XHDR_GLOBAL, false },
- { "GNU.volume.offset", volume_offset_coder, volume_offset_decoder, true }, { "GNU.volume.size", volume_size_coder, volume_size_decoder,
+ true, false }, - XHDR_PROTECTED | XHDR_GLOBAL },
+ { "GNU.volume.size", volume_size_coder, volume_size_decoder, true, false }, + XHDR_PROTECTED | XHDR_GLOBAL, false },
+ { "GNU.volume.offset", volume_offset_coder, volume_offset_decoder, { "GNU.volume.offset", volume_offset_coder, volume_offset_decoder,
+ true, false }, - XHDR_PROTECTED | XHDR_GLOBAL },
+ XHDR_PROTECTED | XHDR_GLOBAL, false },
+ +
+ /* We get the SELinux value from filecon, so add a namespace for SELinux + /* We get the SELinux value from filecon, so add a namespace for SELinux
+ instead of storing it in SCHILY.xattr.* (which would be RAW). */ + instead of storing it in SCHILY.xattr.* (which would be RAW). */
+ { "RHT.security.selinux", + { "RHT.security.selinux",
+ xattr_selinux_coder, xattr_selinux_decoder, false, false }, + xattr_selinux_coder, xattr_selinux_decoder, 0, false },
+ +
+ /* ACLs, use the star format... */ + /* ACLs, use the star format... */
+ { "SCHILY.acl.access", + { "SCHILY.acl.access",
+ xattr_acls_a_coder, xattr_acls_a_decoder, false, false }, + xattr_acls_a_coder, xattr_acls_a_decoder, 0, false },
+ +
+ { "SCHILY.acl.default", + { "SCHILY.acl.default",
+ xattr_acls_d_coder, xattr_acls_d_decoder, false, false }, + xattr_acls_d_coder, xattr_acls_d_decoder, 0, false },
+ +
+ /* FIXME: These are compat. for FC-6 ... we shipped a tar using the generic + /* FIXME: These are compat. for FC-6 ... we shipped a tar using the generic
+ header names by accident. */ + header names by accident. */
+ { "SCHILY.xattr.security.selinux", + { "SCHILY.xattr.security.selinux",
+ xattr_selinux_coder, xattr_selinux_decoder, false, false }, + xattr_selinux_coder, xattr_selinux_decoder, 0, false },
+ { "SCHILY.xattr.system.posix_acl_access", + { "SCHILY.xattr.system.posix_acl_access",
+ xattr_acls_a_coder, xattr_acls_a_decoder, false, false }, + xattr_acls_a_coder, xattr_acls_a_decoder, 0, false },
+ { "SCHILY.xattr.system.posix_acl_default", + { "SCHILY.xattr.system.posix_acl_default",
+ xattr_acls_d_coder, xattr_acls_d_decoder, false, false }, + xattr_acls_d_coder, xattr_acls_d_decoder, 0, false },
+ +
+ /* xattrs use the star format. note we only save some variants... */ + /* xattrs use the star format. note we only save some variants... */
+ { "SCHILY.xattr.user", xattr_coder, xattr_decoder, false, true }, + { "SCHILY.xattr.user", xattr_coder, xattr_decoder, 0, true },
+ { "SCHILY.xattr.trusted", xattr_coder, xattr_decoder, false, true }, + { "SCHILY.xattr.trusted", xattr_coder, xattr_decoder, 0, true },
+ { "SCHILY.xattr.lustre", xattr_coder, xattr_decoder, false, true }, + { "SCHILY.xattr.lustre", xattr_coder, xattr_decoder, 0, true },
+ +
+ /* ignore everything else in the xattr namespaces... */ + /* ignore everything else in the xattr namespaces... */
+ { "SCHILY.xattr", dummy_coder, dummy_decoder, false, true }, + { "SCHILY.xattr", dummy_coder, dummy_decoder, 0, true },
{ NULL, NULL, NULL, false } - { NULL, NULL, NULL, 0 }
+ { NULL, NULL, NULL, 0, false }
}; };

View File

@ -4,8 +4,8 @@
Summary: A GNU file archiving program Summary: A GNU file archiving program
Name: tar Name: tar
Epoch: 2 Epoch: 2
Version: 1.22 Version: 1.23
Release: 17%{?dist} Release: 1%{?dist}
License: GPLv3+ License: GPLv3+
Group: Applications/Archiving Group: Applications/Archiving
URL: http://www.gnu.org/software/tar/ URL: http://www.gnu.org/software/tar/
@ -19,29 +19,16 @@ Patch1: tar-1.14-loneZeroWarning.patch
#when ftruncate may fail to grow the size of a file.(#179507) #when ftruncate may fail to grow the size of a file.(#179507)
Patch2: tar-1.15.1-vfatTruncate.patch Patch2: tar-1.15.1-vfatTruncate.patch
#Add support for selinux, acl and extended attributes #Add support for selinux, acl and extended attributes
Patch3: tar-1.19-xattrs.patch Patch3: tar-1.23-xattrs.patch
#change inclusion defaults of tar to "--wildcards --anchored #change inclusion defaults of tar to "--wildcards --anchored
#--wildcards-match-slash" for compatibility reasons (#206841) #--wildcards-match-slash" for compatibility reasons (#206841)
Patch4: tar-1.17-wildcards.patch Patch4: tar-1.17-wildcards.patch
#ignore errors from setting utime() for source file #ignore errors from setting utime() for source file
#on read-only filesystem (#500742) #on read-only filesystem (#500742)
Patch5: tar-1.22-atime-rofs.patch Patch5: tar-1.22-atime-rofs.patch
#Report record size only if the archive refers to a device(#487760)
Patch6: tar-1.22-shortreadbuffer.patch
#Do not sigabrt with new gcc/glibc because of writing to #Do not sigabrt with new gcc/glibc because of writing to
#struct members of gnutar header at once via strcpy #struct members of gnutar header at once via strcpy
Patch7: tar-1.22-fortifysourcessigabrt.patch Patch6: tar-1.22-fortifysourcessigabrt.patch
#fix memory leak in xheader (#518079)
Patch8: tar-1.22-xheaderleak.patch
#fix segfault in code_ns_fraction() with corrupted metadata (#531441)
Patch9: tar-1.22-nsfraction.patch
#update gnulib's utimens module to latest version to prevent utimens() bad file
#descriptor failures with POSIX2008 glibc
Patch10: tar-1.22-utimens.patch
#Fix potential place for overflow attack via rsh/ssh (#564368)
Patch11: tar-1.22-rtapelib-overflow.patch
#realloc within check_exclusion_tags() causes invalid write(#570591)
Patch12: tar-1.22-exclusion-tags.patch
Requires: info Requires: info
BuildRequires: autoconf automake gzip texinfo gettext libacl-devel gawk rsh BuildRequires: autoconf automake gzip texinfo gettext libacl-devel gawk rsh
%if %{WITH_SELINUX} %if %{WITH_SELINUX}
@ -70,13 +57,7 @@ the rmt package.
%patch3 -p1 -b .xattrs %patch3 -p1 -b .xattrs
%patch4 -p1 -b .wildcards %patch4 -p1 -b .wildcards
%patch5 -p1 -b .rofs %patch5 -p1 -b .rofs
%patch6 -p1 -b .shortread %patch6 -p1 -b .fortify
%patch7 -p1 -b .headerblackmagic
%patch8 -p1 -b .xheaderleak
%patch9 -p1 -b .nsfraction
%patch10 -p1 -b .utimens
%patch11 -p1 -b .overflow
%patch12 -p1 -b .exclude
autoreconf autoreconf
@ -138,6 +119,9 @@ fi
%{_infodir}/tar.info* %{_infodir}/tar.info*
%changelog %changelog
* Fri Mar 12 2010 Ondrej Vasik <ovasik@redhat.com> 2:1.23-1
- new upstream release 1.23, remove applied patches
* Wed Mar 10 2010 Ondrej Vasik <ovasik@redhat.com> 2:1.22-17 * Wed Mar 10 2010 Ondrej Vasik <ovasik@redhat.com> 2:1.22-17
- CVE-2010-0624 tar, cpio: Heap-based buffer overflow - CVE-2010-0624 tar, cpio: Heap-based buffer overflow
by expanding a specially-crafted archive (#572149) by expanding a specially-crafted archive (#572149)