upgrade to 1.17
This commit is contained in:
parent
b49f43c036
commit
fc86677545
@ -1,3 +1,2 @@
|
||||
tar-1.15.1.tar.gz
|
||||
tar-1.15.1.tar.gz.sig
|
||||
tar.1
|
||||
tar-1.17.tar.gz
|
||||
tar-1.17.tar.gz.sig
|
||||
|
5
sources
5
sources
@ -1,3 +1,2 @@
|
||||
d87021366fe6488e9dc398fcdcb6ed7d tar-1.15.1.tar.gz
|
||||
4be36b7651557cc236ed6fe9b6966fee tar-1.15.1.tar.gz.sig
|
||||
a554cb69d67c0c7d16d864b9c6f05c11 tar.1
|
||||
65e568b83caf7aa865144031e7a7c6a8 tar-1.17.tar.gz
|
||||
a7f959b4c8bd9aaa5a6677acfabff699 tar-1.17.tar.gz.sig
|
||||
|
@ -1,214 +0,0 @@
|
||||
--- tar-1.15.1/configure.nolibrt 2004-12-21 13:30:30.000000000 +0000
|
||||
+++ tar-1.15.1/configure 2005-01-07 11:18:51.878839553 +0000
|
||||
@@ -11470,20 +11470,20 @@
|
||||
# dnl Persuade glibc <time.h> to declare these functions.
|
||||
|
||||
|
||||
- # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
|
||||
+ # Solaris 2.5.1 needs -lposix4 to get the clock_gettyme function.
|
||||
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
|
||||
|
||||
# Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all*
|
||||
# programs in the package would end up linked with that potentially-shared
|
||||
# library, inducing unnecessary run-time overhead.
|
||||
fetish_saved_libs=$LIBS
|
||||
- echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
|
||||
-echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6
|
||||
-if test "${ac_cv_search_clock_gettime+set}" = set; then
|
||||
+ echo "$as_me:$LINENO: checking for library containing clock_gettyme" >&5
|
||||
+echo $ECHO_N "checking for library containing clock_gettyme... $ECHO_C" >&6
|
||||
+if test "${ac_cv_search_clock_gettyme+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_func_search_save_LIBS=$LIBS
|
||||
-ac_cv_search_clock_gettime=no
|
||||
+ac_cv_search_clock_gettyme=no
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
@@ -11497,11 +11497,11 @@
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
-char clock_gettime ();
|
||||
+char clock_gettyme ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-clock_gettime ();
|
||||
+clock_gettyme ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -11528,7 +11528,7 @@
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
- ac_cv_search_clock_gettime="none required"
|
||||
+ ac_cv_search_clock_gettyme="none required"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
@@ -11536,7 +11536,7 @@
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
-if test "$ac_cv_search_clock_gettime" = no; then
|
||||
+if test "$ac_cv_search_clock_gettyme" = no; then
|
||||
for ac_lib in rt posix4; do
|
||||
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
@@ -11552,11 +11552,11 @@
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
-char clock_gettime ();
|
||||
+char clock_gettyme ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-clock_gettime ();
|
||||
+clock_gettyme ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -11583,7 +11583,7 @@
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
- ac_cv_search_clock_gettime="-l$ac_lib"
|
||||
+ ac_cv_search_clock_gettyme="-l$ac_lib"
|
||||
break
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
@@ -11596,18 +11596,18 @@
|
||||
fi
|
||||
LIBS=$ac_func_search_save_LIBS
|
||||
fi
|
||||
-echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5
|
||||
-echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6
|
||||
-if test "$ac_cv_search_clock_gettime" != no; then
|
||||
- test "$ac_cv_search_clock_gettime" = "none required" || LIBS="$ac_cv_search_clock_gettime $LIBS"
|
||||
- test "$ac_cv_search_clock_gettime" = "none required" ||
|
||||
- LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime
|
||||
+echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettyme" >&5
|
||||
+echo "${ECHO_T}$ac_cv_search_clock_gettyme" >&6
|
||||
+if test "$ac_cv_search_clock_gettyme" != no; then
|
||||
+ test "$ac_cv_search_clock_gettyme" = "none required" || LIBS="$ac_cv_search_clock_gettyme $LIBS"
|
||||
+ test "$ac_cv_search_clock_gettyme" = "none required" ||
|
||||
+ LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettyme
|
||||
fi
|
||||
|
||||
|
||||
|
||||
|
||||
-for ac_func in clock_gettime clock_settime
|
||||
+for ac_func in clock_gettyme clock_settime
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
||||
@@ -20541,17 +20541,17 @@
|
||||
# programs in the package would end up linked with that potentially-shared
|
||||
# library, inducing unnecessary run-time overhead.
|
||||
|
||||
-# Solaris 2.5.1 needs -lposix4 to get the clock_gettime function.
|
||||
+# Solaris 2.5.1 needs -lposix4 to get the clock_gettyme function.
|
||||
# Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4.
|
||||
tar_save_LIBS=$LIBS
|
||||
LIB_CLOCK_GETTIME=
|
||||
- echo "$as_me:$LINENO: checking for library containing clock_gettime" >&5
|
||||
-echo $ECHO_N "checking for library containing clock_gettime... $ECHO_C" >&6
|
||||
-if test "${ac_cv_search_clock_gettime+set}" = set; then
|
||||
+ echo "$as_me:$LINENO: checking for library containing clock_gettyme" >&5
|
||||
+echo $ECHO_N "checking for library containing clock_gettyme... $ECHO_C" >&6
|
||||
+if test "${ac_cv_search_clock_gettyme+set}" = set; then
|
||||
echo $ECHO_N "(cached) $ECHO_C" >&6
|
||||
else
|
||||
ac_func_search_save_LIBS=$LIBS
|
||||
-ac_cv_search_clock_gettime=no
|
||||
+ac_cv_search_clock_gettyme=no
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
@@ -20565,11 +20565,11 @@
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
-char clock_gettime ();
|
||||
+char clock_gettyme ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-clock_gettime ();
|
||||
+clock_gettyme ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -20596,7 +20596,7 @@
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
- ac_cv_search_clock_gettime="none required"
|
||||
+ ac_cv_search_clock_gettyme="none required"
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
@@ -20604,7 +20604,7 @@
|
||||
fi
|
||||
rm -f conftest.err conftest.$ac_objext \
|
||||
conftest$ac_exeext conftest.$ac_ext
|
||||
-if test "$ac_cv_search_clock_gettime" = no; then
|
||||
+if test "$ac_cv_search_clock_gettyme" = no; then
|
||||
for ac_lib in rt posix4; do
|
||||
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
|
||||
cat >conftest.$ac_ext <<_ACEOF
|
||||
@@ -20620,11 +20620,11 @@
|
||||
#endif
|
||||
/* We use char because int might match the return type of a gcc2
|
||||
builtin and then its argument prototype would still apply. */
|
||||
-char clock_gettime ();
|
||||
+char clock_gettyme ();
|
||||
int
|
||||
main ()
|
||||
{
|
||||
-clock_gettime ();
|
||||
+clock_gettyme ();
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
@@ -20651,7 +20651,7 @@
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
- ac_cv_search_clock_gettime="-l$ac_lib"
|
||||
+ ac_cv_search_clock_gettyme="-l$ac_lib"
|
||||
break
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
@@ -20664,19 +20664,19 @@
|
||||
fi
|
||||
LIBS=$ac_func_search_save_LIBS
|
||||
fi
|
||||
-echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettime" >&5
|
||||
-echo "${ECHO_T}$ac_cv_search_clock_gettime" >&6
|
||||
-if test "$ac_cv_search_clock_gettime" != no; then
|
||||
- test "$ac_cv_search_clock_gettime" = "none required" || LIBS="$ac_cv_search_clock_gettime $LIBS"
|
||||
+echo "$as_me:$LINENO: result: $ac_cv_search_clock_gettyme" >&5
|
||||
+echo "${ECHO_T}$ac_cv_search_clock_gettyme" >&6
|
||||
+if test "$ac_cv_search_clock_gettyme" != no; then
|
||||
+ test "$ac_cv_search_clock_gettyme" = "none required" || LIBS="$ac_cv_search_clock_gettyme $LIBS"
|
||||
|
||||
fi
|
||||
|
||||
- case "$ac_cv_search_clock_gettime" in
|
||||
- -l*) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime;;
|
||||
+ case "$ac_cv_search_clock_gettyme" in
|
||||
+ -l*) LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettyme;;
|
||||
esac
|
||||
|
||||
|
||||
-for ac_func in clock_gettime
|
||||
+for ac_func in clock_gettyme
|
||||
do
|
||||
as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
|
||||
echo "$as_me:$LINENO: checking for $ac_func" >&5
|
@ -1,16 +0,0 @@
|
||||
Patch by Robert Scheck <redhat@linuxnetz.de> for tar >= 1.15.1, which makes tar
|
||||
rebuildable using gcc 4.
|
||||
|
||||
--- tar-1.15.1/tests/genfile.c 2004-09-08 13:50:20.000000000 +0200
|
||||
+++ tar-1.15.1/tests/genfile.c.gcc4 2005-03-13 16:25:15.000000000 +0100
|
||||
@@ -60,8 +60,8 @@
|
||||
/* Block buffer for sparse file */
|
||||
char *buffer;
|
||||
|
||||
-static const char *argp_program_version = "genfile (" PACKAGE ") " VERSION;
|
||||
-static const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
|
||||
+const char *argp_program_version = "genfile (" PACKAGE ") " VERSION;
|
||||
+const char *argp_program_bug_address = "<" PACKAGE_BUGREPORT ">";
|
||||
static char doc[] = N_("genfile generates data files for GNU paxutils test suite");
|
||||
|
||||
static struct argp_option options[] = {
|
@ -1,121 +0,0 @@
|
||||
--- src/xheader.c.orig 2004-09-06 06:31:14.000000000 -0500
|
||||
+++ src/xheader.c 2006-02-08 16:59:46.000000000 -0500
|
||||
@@ -783,6 +783,32 @@ code_num (uintmax_t value, char const *k
|
||||
xheader_print (xhdr, keyword, sbuf);
|
||||
}
|
||||
|
||||
+static bool
|
||||
+decode_num (uintmax_t *num, char const *arg, uintmax_t maxval,
|
||||
+ char const *keyword)
|
||||
+{
|
||||
+ uintmax_t u;
|
||||
+ char *arg_lim;
|
||||
+
|
||||
+ if (! (ISDIGIT (*arg)
|
||||
+ && (errno = 0, u = strtoumax (arg, &arg_lim, 10), !*arg_lim)))
|
||||
+ {
|
||||
+ ERROR ((0, 0, _("Malformed extended header: invalid %s=%s"),
|
||||
+ keyword, arg));
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ if (! (u <= maxval && errno != ERANGE))
|
||||
+ {
|
||||
+ ERROR ((0, 0, _("Extended header %s=%s is out of range"),
|
||||
+ keyword, arg));
|
||||
+ return false;
|
||||
+ }
|
||||
+
|
||||
+ *num = u;
|
||||
+ return true;
|
||||
+}
|
||||
+
|
||||
static void
|
||||
dummy_coder (struct tar_stat_info const *st __attribute__ ((unused)),
|
||||
char const *keyword __attribute__ ((unused)),
|
||||
@@ -821,7 +847,7 @@ static void
|
||||
gid_decoder (struct tar_stat_info *st, char const *arg)
|
||||
{
|
||||
uintmax_t u;
|
||||
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
|
||||
+ if (decode_num (&u, arg, TYPE_MAXIMUM (gid_t), "gid"))
|
||||
st->stat.st_gid = u;
|
||||
}
|
||||
|
||||
@@ -903,7 +929,7 @@ static void
|
||||
size_decoder (struct tar_stat_info *st, char const *arg)
|
||||
{
|
||||
uintmax_t u;
|
||||
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
|
||||
+ if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), "size"))
|
||||
st->archive_file_size = st->stat.st_size = u;
|
||||
}
|
||||
|
||||
@@ -918,7 +944,7 @@ static void
|
||||
uid_decoder (struct tar_stat_info *st, char const *arg)
|
||||
{
|
||||
uintmax_t u;
|
||||
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
|
||||
+ if (decode_num (&u, arg, TYPE_MAXIMUM (uid_t), "uid"))
|
||||
st->stat.st_uid = u;
|
||||
}
|
||||
|
||||
@@ -946,7 +972,7 @@ static void
|
||||
sparse_size_decoder (struct tar_stat_info *st, char const *arg)
|
||||
{
|
||||
uintmax_t u;
|
||||
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
|
||||
+ if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), "GNU.sparse.size"))
|
||||
st->stat.st_size = u;
|
||||
}
|
||||
|
||||
@@ -962,10 +988,10 @@ static void
|
||||
sparse_numblocks_decoder (struct tar_stat_info *st, char const *arg)
|
||||
{
|
||||
uintmax_t u;
|
||||
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
|
||||
+ if (decode_num (&u, arg, SIZE_MAX, "GNU.sparse.numblocks"))
|
||||
{
|
||||
st->sparse_map_size = u;
|
||||
- st->sparse_map = calloc(st->sparse_map_size, sizeof(st->sparse_map[0]));
|
||||
+ st->sparse_map = xcalloc (u, sizeof st->sparse_map[0]);
|
||||
st->sparse_map_avail = 0;
|
||||
}
|
||||
}
|
||||
@@ -982,8 +1008,14 @@ static void
|
||||
sparse_offset_decoder (struct tar_stat_info *st, char const *arg)
|
||||
{
|
||||
uintmax_t u;
|
||||
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
|
||||
+ if (decode_num (&u, arg, TYPE_MAXIMUM (off_t), "GNU.sparse.offset"))
|
||||
+ {
|
||||
+ if (st->sparse_map_avail < st->sparse_map_size)
|
||||
st->sparse_map[st->sparse_map_avail].offset = u;
|
||||
+ else
|
||||
+ ERROR ((0, 0, _("Malformed extended header: excess %s=%s"),
|
||||
+ "GNU.sparse.offset", arg));
|
||||
+ }
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -998,15 +1030,13 @@ static void
|
||||
sparse_numbytes_decoder (struct tar_stat_info *st, char const *arg)
|
||||
{
|
||||
uintmax_t u;
|
||||
- if (xstrtoumax (arg, NULL, 10, &u, "") == LONGINT_OK)
|
||||
+ if (decode_num (&u, arg, SIZE_MAX, "GNU.sparse.numbytes"))
|
||||
{
|
||||
if (st->sparse_map_avail == st->sparse_map_size)
|
||||
- {
|
||||
- st->sparse_map_size *= 2;
|
||||
- st->sparse_map = xrealloc (st->sparse_map,
|
||||
- st->sparse_map_size
|
||||
- * sizeof st->sparse_map[0]);
|
||||
- }
|
||||
+ st->sparse_map = x2nrealloc (st->sparse_map,
|
||||
+ &st->sparse_map_size,
|
||||
+ sizeof st->sparse_map[0]);
|
||||
+
|
||||
st->sparse_map[st->sparse_map_avail++].numbytes = u;
|
||||
}
|
||||
}
|
@ -1,477 +0,0 @@
|
||||
--- tar-1.15.1/src/sparse.c.hugeSparse 2006-09-19 22:01:19.000000000 +0200
|
||||
+++ tar-1.15.1/src/sparse.c 2006-09-19 22:08:33.000000000 +0200
|
||||
@@ -21,6 +21,7 @@
|
||||
#include "common.h"
|
||||
|
||||
struct tar_sparse_file;
|
||||
+static bool sparse_select_optab (struct tar_sparse_file *file);
|
||||
|
||||
enum sparse_scan_state
|
||||
{
|
||||
@@ -47,47 +48,47 @@
|
||||
{
|
||||
int fd; /* File descriptor */
|
||||
bool seekable; /* Is fd seekable? */
|
||||
- size_t offset; /* Current offset in fd if seekable==false.
|
||||
+ off_t offset; /* Current offset in fd if seekable==false.
|
||||
Otherwise unused */
|
||||
- size_t dumped_size; /* Number of bytes actually written
|
||||
+ off_t dumped_size; /* Number of bytes actually written
|
||||
to the archive */
|
||||
struct tar_stat_info *stat_info; /* Information about the file */
|
||||
- struct tar_sparse_optab *optab;
|
||||
+ struct tar_sparse_optab const *optab;
|
||||
void *closure; /* Any additional data optab calls might
|
||||
- reqiure */
|
||||
+ require */
|
||||
};
|
||||
|
||||
/* Dump zeros to file->fd until offset is reached. It is used instead of
|
||||
lseek if the output file is not seekable */
|
||||
-static long
|
||||
+static bool
|
||||
dump_zeros (struct tar_sparse_file *file, off_t offset)
|
||||
{
|
||||
- char buf[BLOCKSIZE];
|
||||
-
|
||||
- if (offset - file->offset < 0)
|
||||
+ static char const zero_buf[BLOCKSIZE];
|
||||
+
|
||||
+ if (offset < file->offset)
|
||||
{
|
||||
errno = EINVAL;
|
||||
- return -1;
|
||||
+ return false;
|
||||
}
|
||||
|
||||
- memset (buf, 0, sizeof buf);
|
||||
while (file->offset < offset)
|
||||
{
|
||||
- size_t size = offset - file->offset;
|
||||
- size_t wrbytes;
|
||||
-
|
||||
- if (size > sizeof buf)
|
||||
- size = sizeof buf;
|
||||
- wrbytes = write (file->fd, buf, size);
|
||||
+ size_t size = (BLOCKSIZE < offset - file->offset
|
||||
+ ? BLOCKSIZE
|
||||
+ : offset - file->offset);
|
||||
+ ssize_t wrbytes;
|
||||
+
|
||||
+ wrbytes = write (file->fd, zero_buf, size);
|
||||
if (wrbytes <= 0)
|
||||
{
|
||||
if (wrbytes == 0)
|
||||
errno = EINVAL;
|
||||
- return -1;
|
||||
+ return false;
|
||||
}
|
||||
file->offset += wrbytes;
|
||||
}
|
||||
- return file->offset;
|
||||
+
|
||||
+ return true;
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -101,9 +102,14 @@
|
||||
static bool
|
||||
tar_sparse_init (struct tar_sparse_file *file)
|
||||
{
|
||||
- file->dumped_size = 0;
|
||||
+ memset (file, 0, sizeof *file);
|
||||
+
|
||||
+ if (!sparse_select_optab (file))
|
||||
+ return false;
|
||||
+
|
||||
if (file->optab->init)
|
||||
return file->optab->init (file);
|
||||
+
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -168,14 +174,9 @@
|
||||
static bool
|
||||
lseek_or_error (struct tar_sparse_file *file, off_t offset)
|
||||
{
|
||||
- off_t off;
|
||||
-
|
||||
- if (file->seekable)
|
||||
- off = lseek (file->fd, offset, SEEK_SET);
|
||||
- else
|
||||
- off = dump_zeros (file, offset);
|
||||
-
|
||||
- if (off < 0)
|
||||
+ if (file->seekable
|
||||
+ ? lseek (file->fd, offset, SEEK_SET) < 0
|
||||
+ : ! dump_zeros (file, offset))
|
||||
{
|
||||
seek_diag_details (file->stat_info->orig_file_name, offset);
|
||||
return false;
|
||||
@@ -187,7 +188,7 @@
|
||||
it's made *entirely* of zeros, returning a 0 the instant it finds
|
||||
something that is a nonzero, i.e., useful data. */
|
||||
static bool
|
||||
-zero_block_p (char *buffer, size_t size)
|
||||
+zero_block_p (char const *buffer, size_t size)
|
||||
{
|
||||
while (size--)
|
||||
if (*buffer++)
|
||||
@@ -195,58 +196,46 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
-#define clear_block(p) memset (p, 0, BLOCKSIZE);
|
||||
-
|
||||
-#define SPARSES_INIT_COUNT SPARSES_IN_SPARSE_HEADER
|
||||
-
|
||||
static void
|
||||
-sparse_add_map (struct tar_sparse_file *file, struct sp_array *sp)
|
||||
+sparse_add_map (struct tar_stat_info *st, struct sp_array const *sp)
|
||||
{
|
||||
- if (file->stat_info->sparse_map == NULL)
|
||||
- {
|
||||
- file->stat_info->sparse_map =
|
||||
- xmalloc (SPARSES_INIT_COUNT * sizeof file->stat_info->sparse_map[0]);
|
||||
- file->stat_info->sparse_map_size = SPARSES_INIT_COUNT;
|
||||
- }
|
||||
- else if (file->stat_info->sparse_map_avail == file->stat_info->sparse_map_size)
|
||||
- {
|
||||
- file->stat_info->sparse_map_size *= 2;
|
||||
- file->stat_info->sparse_map =
|
||||
- xrealloc (file->stat_info->sparse_map,
|
||||
- file->stat_info->sparse_map_size
|
||||
- * sizeof file->stat_info->sparse_map[0]);
|
||||
- }
|
||||
- file->stat_info->sparse_map[file->stat_info->sparse_map_avail++] = *sp;
|
||||
+ struct sp_array *sparse_map = st->sparse_map;
|
||||
+ size_t avail = st->sparse_map_avail;
|
||||
+ if (avail == st->sparse_map_size)
|
||||
+ st->sparse_map = sparse_map =
|
||||
+ x2nrealloc (sparse_map, &st->sparse_map_size, sizeof *sparse_map);
|
||||
+ sparse_map[avail] = *sp;
|
||||
+ st->sparse_map_avail = avail + 1;
|
||||
}
|
||||
|
||||
/* Scan the sparse file and create its map */
|
||||
static bool
|
||||
sparse_scan_file (struct tar_sparse_file *file)
|
||||
{
|
||||
- static char buffer[BLOCKSIZE];
|
||||
+ struct tar_stat_info *st = file->stat_info;
|
||||
+ int fd = file->fd;
|
||||
+ char buffer[BLOCKSIZE];
|
||||
size_t count;
|
||||
off_t offset = 0;
|
||||
struct sp_array sp = {0, 0};
|
||||
|
||||
if (!lseek_or_error (file, 0))
|
||||
return false;
|
||||
- clear_block (buffer);
|
||||
-
|
||||
- file->stat_info->sparse_map_avail = 0;
|
||||
- file->stat_info->archive_file_size = 0;
|
||||
|
||||
+ st->archive_file_size = 0;
|
||||
+
|
||||
if (!tar_sparse_scan (file, scan_begin, NULL))
|
||||
return false;
|
||||
|
||||
- while ((count = safe_read (file->fd, buffer, sizeof buffer)) != 0
|
||||
+ while ((count = safe_read (fd, buffer, sizeof buffer)) != 0
|
||||
&& count != SAFE_READ_ERROR)
|
||||
{
|
||||
- /* Analize the block */
|
||||
+ /* Analyze the block. */
|
||||
if (zero_block_p (buffer, count))
|
||||
{
|
||||
if (sp.numbytes)
|
||||
{
|
||||
- sparse_add_map (file, &sp);
|
||||
+ sparse_add_map (st, &sp);
|
||||
sp.numbytes = 0;
|
||||
if (!tar_sparse_scan (file, scan_block, NULL))
|
||||
return false;
|
||||
@@ -257,26 +246,25 @@
|
||||
if (sp.numbytes == 0)
|
||||
sp.offset = offset;
|
||||
sp.numbytes += count;
|
||||
- file->stat_info->archive_file_size += count;
|
||||
+ st->archive_file_size += count;
|
||||
if (!tar_sparse_scan (file, scan_block, buffer))
|
||||
return false;
|
||||
}
|
||||
|
||||
offset += count;
|
||||
- clear_block (buffer);
|
||||
}
|
||||
|
||||
if (sp.numbytes == 0)
|
||||
sp.offset = offset;
|
||||
|
||||
- sparse_add_map (file, &sp);
|
||||
- file->stat_info->archive_file_size += count;
|
||||
+ sparse_add_map (st, &sp);
|
||||
+ st->archive_file_size += count;
|
||||
return tar_sparse_scan (file, scan_end, NULL);
|
||||
}
|
||||
|
||||
-static struct tar_sparse_optab oldgnu_optab;
|
||||
-static struct tar_sparse_optab star_optab;
|
||||
-static struct tar_sparse_optab pax_optab;
|
||||
+static struct tar_sparse_optab const oldgnu_optab;
|
||||
+static struct tar_sparse_optab const star_optab;
|
||||
+static struct tar_sparse_optab const pax_optab;
|
||||
|
||||
static bool
|
||||
sparse_select_optab (struct tar_sparse_file *file)
|
||||
@@ -321,18 +309,18 @@
|
||||
size_t bytes_read;
|
||||
|
||||
blk = find_next_block ();
|
||||
- memset (blk->buffer, 0, BLOCKSIZE);
|
||||
bytes_read = safe_read (file->fd, blk->buffer, bufsize);
|
||||
if (bytes_read == SAFE_READ_ERROR)
|
||||
{
|
||||
read_diag_details (file->stat_info->orig_file_name,
|
||||
- file->stat_info->sparse_map[i].offset
|
||||
- + file->stat_info->sparse_map[i].numbytes
|
||||
- - bytes_left,
|
||||
- bufsize);
|
||||
+ (file->stat_info->sparse_map[i].offset
|
||||
+ + file->stat_info->sparse_map[i].numbytes
|
||||
+ - bytes_left),
|
||||
+ bufsize);
|
||||
return false;
|
||||
}
|
||||
|
||||
+ memset (blk->buffer + bytes_read, 0, BLOCKSIZE - bytes_read);
|
||||
bytes_left -= bytes_read;
|
||||
file->dumped_size += bytes_read;
|
||||
set_next_block_after (blk);
|
||||
@@ -391,14 +379,12 @@
|
||||
bool rc;
|
||||
struct tar_sparse_file file;
|
||||
|
||||
+ if (!tar_sparse_init (&file))
|
||||
+ return dump_status_not_implemented;
|
||||
+
|
||||
file.stat_info = st;
|
||||
file.fd = fd;
|
||||
file.seekable = true; /* File *must* be seekable for dump to work */
|
||||
- file.offset = 0;
|
||||
-
|
||||
- if (!sparse_select_optab (&file)
|
||||
- || !tar_sparse_init (&file))
|
||||
- return dump_status_not_implemented;
|
||||
|
||||
rc = sparse_scan_file (&file);
|
||||
if (rc && file.optab->dump_region)
|
||||
@@ -414,7 +400,7 @@
|
||||
}
|
||||
}
|
||||
|
||||
- pad_archive(file.stat_info->archive_file_size - file.dumped_size);
|
||||
+ pad_archive (file.stat_info->archive_file_size - file.dumped_size);
|
||||
return (tar_sparse_done (&file) && rc) ? dump_status_ok : dump_status_short;
|
||||
}
|
||||
|
||||
@@ -432,7 +418,7 @@
|
||||
{
|
||||
struct tar_sparse_file file;
|
||||
|
||||
- if (!sparse_select_optab (&file))
|
||||
+ if (!tar_sparse_init (&file))
|
||||
return false;
|
||||
file.stat_info = st;
|
||||
return tar_sparse_member_p (&file);
|
||||
@@ -443,7 +429,7 @@
|
||||
{
|
||||
struct tar_sparse_file file;
|
||||
|
||||
- if (!sparse_select_optab (&file))
|
||||
+ if (!tar_sparse_init (&file))
|
||||
return false;
|
||||
file.stat_info = st;
|
||||
return tar_sparse_fixup_header (&file);
|
||||
@@ -456,14 +442,13 @@
|
||||
struct tar_sparse_file file;
|
||||
size_t i;
|
||||
|
||||
+ if (!tar_sparse_init (&file))
|
||||
+ return dump_status_not_implemented;
|
||||
+
|
||||
file.stat_info = st;
|
||||
file.fd = fd;
|
||||
file.seekable = lseek (fd, 0, SEEK_SET) == 0;
|
||||
file.offset = 0;
|
||||
-
|
||||
- if (!sparse_select_optab (&file)
|
||||
- || !tar_sparse_init (&file))
|
||||
- return dump_status_not_implemented;
|
||||
|
||||
rc = tar_sparse_decode_header (&file);
|
||||
for (i = 0; rc && i < file.stat_info->sparse_map_avail; i++)
|
||||
@@ -478,21 +463,18 @@
|
||||
bool rc = true;
|
||||
struct tar_sparse_file file;
|
||||
|
||||
+ if (!tar_sparse_init (&file))
|
||||
+ return dump_status_not_implemented;
|
||||
+
|
||||
file.stat_info = st;
|
||||
file.fd = -1;
|
||||
|
||||
- if (!sparse_select_optab (&file)
|
||||
- || !tar_sparse_init (&file))
|
||||
- return dump_status_not_implemented;
|
||||
-
|
||||
rc = tar_sparse_decode_header (&file);
|
||||
skip_file (file.stat_info->archive_file_size);
|
||||
return (tar_sparse_done (&file) && rc) ? dump_status_ok : dump_status_short;
|
||||
}
|
||||
|
||||
|
||||
-static char diff_buffer[BLOCKSIZE];
|
||||
-
|
||||
static bool
|
||||
check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end)
|
||||
{
|
||||
@@ -502,11 +484,9 @@
|
||||
while (beg < end)
|
||||
{
|
||||
size_t bytes_read;
|
||||
- size_t rdsize = end - beg;
|
||||
+ size_t rdsize = BLOCKSIZE < end - beg ? BLOCKSIZE : end - beg;
|
||||
+ char diff_buffer[BLOCKSIZE];
|
||||
|
||||
- if (rdsize > BLOCKSIZE)
|
||||
- rdsize = BLOCKSIZE;
|
||||
- clear_block (diff_buffer);
|
||||
bytes_read = safe_read (file->fd, diff_buffer, rdsize);
|
||||
if (bytes_read == SAFE_READ_ERROR)
|
||||
{
|
||||
@@ -518,7 +498,7 @@
|
||||
if (!zero_block_p (diff_buffer, bytes_read))
|
||||
{
|
||||
report_difference (file->stat_info,
|
||||
- _("File fragment at %lu is not a hole"), beg);
|
||||
+ _("File fragment at %lu is not a hole"), beg);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -539,6 +519,7 @@
|
||||
{
|
||||
size_t bytes_read;
|
||||
size_t rdsize = (size_left > BLOCKSIZE) ? BLOCKSIZE : size_left;
|
||||
+ char diff_buffer[BLOCKSIZE];
|
||||
|
||||
union block *blk = find_next_block ();
|
||||
if (!blk)
|
||||
@@ -551,9 +532,9 @@
|
||||
if (bytes_read == SAFE_READ_ERROR)
|
||||
{
|
||||
read_diag_details (file->stat_info->orig_file_name,
|
||||
- file->stat_info->sparse_map[i].offset
|
||||
- + file->stat_info->sparse_map[i].numbytes
|
||||
- - size_left,
|
||||
+ (file->stat_info->sparse_map[i].offset
|
||||
+ + file->stat_info->sparse_map[i].numbytes
|
||||
+ - size_left),
|
||||
rdsize);
|
||||
return false;
|
||||
}
|
||||
@@ -576,13 +557,12 @@
|
||||
size_t i;
|
||||
off_t offset = 0;
|
||||
|
||||
+ if (!tar_sparse_init (&file))
|
||||
+ return dump_status_not_implemented;
|
||||
+
|
||||
file.stat_info = st;
|
||||
file.fd = fd;
|
||||
|
||||
- if (!sparse_select_optab (&file)
|
||||
- || !tar_sparse_init (&file))
|
||||
- return dump_status_not_implemented;
|
||||
-
|
||||
rc = tar_sparse_decode_header (&file);
|
||||
for (i = 0; rc && i < file.stat_info->sparse_map_avail; i++)
|
||||
{
|
||||
@@ -647,7 +627,7 @@
|
||||
|| file->stat_info->archive_file_size < 0)
|
||||
return add_fail;
|
||||
|
||||
- sparse_add_map (file, &sp);
|
||||
+ sparse_add_map (file->stat_info, &sp);
|
||||
return add_ok;
|
||||
}
|
||||
|
||||
@@ -658,7 +638,7 @@
|
||||
which actually contains archived size. The following fixes it */
|
||||
file->stat_info->archive_file_size = file->stat_info->stat.st_size;
|
||||
file->stat_info->stat.st_size =
|
||||
- OFF_FROM_HEADER (current_header->oldgnu_header.realsize);
|
||||
+ OFF_FROM_HEADER (current_header->oldgnu_header.realsize);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -669,7 +649,7 @@
|
||||
size_t i;
|
||||
union block *h = current_header;
|
||||
int ext_p;
|
||||
- static enum oldgnu_add_status rc;
|
||||
+ enum oldgnu_add_status rc;
|
||||
|
||||
file->stat_info->sparse_map_avail = 0;
|
||||
for (i = 0; i < SPARSES_IN_OLDGNU_HEADER; i++)
|
||||
@@ -756,7 +736,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
-static struct tar_sparse_optab oldgnu_optab = {
|
||||
+static struct tar_sparse_optab const oldgnu_optab = {
|
||||
NULL, /* No init function */
|
||||
NULL, /* No done function */
|
||||
oldgnu_sparse_member_p,
|
||||
@@ -795,7 +775,7 @@
|
||||
size_t i;
|
||||
union block *h = current_header;
|
||||
int ext_p;
|
||||
- static enum oldgnu_add_status rc;
|
||||
+ enum oldgnu_add_status rc = add_ok;
|
||||
|
||||
file->stat_info->sparse_map_avail = 0;
|
||||
|
||||
@@ -837,7 +817,7 @@
|
||||
}
|
||||
|
||||
|
||||
-static struct tar_sparse_optab star_optab = {
|
||||
+static struct tar_sparse_optab const star_optab = {
|
||||
NULL, /* No init function */
|
||||
NULL, /* No done function */
|
||||
star_sparse_member_p,
|
||||
@@ -864,7 +844,7 @@
|
||||
static bool
|
||||
pax_sparse_member_p (struct tar_sparse_file *file)
|
||||
{
|
||||
- return file->stat_info->archive_file_size != file->stat_info->stat.st_size;
|
||||
+ return file->stat_info->sparse_map_avail > 0;
|
||||
}
|
||||
|
||||
static bool
|
||||
@@ -890,7 +870,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
-static struct tar_sparse_optab pax_optab = {
|
||||
+static struct tar_sparse_optab const pax_optab = {
|
||||
NULL, /* No init function */
|
||||
NULL, /* No done function */
|
||||
pax_sparse_member_p,
|
||||
@@ -901,4 +881,3 @@
|
||||
sparse_dump_region,
|
||||
sparse_extract_region,
|
||||
};
|
||||
-
|
@ -1,12 +0,0 @@
|
||||
--- tar-1.15.1/src/create.c.incompatibilities 2006-09-19 22:23:32.000000000 +0200
|
||||
+++ tar-1.15.1/src/create.c 2006-09-19 22:24:02.000000000 +0200
|
||||
@@ -254,7 +254,8 @@
|
||||
&& S_IROTH == TOREAD && S_IWOTH == TOWRITE && S_IXOTH == TOEXEC
|
||||
&& archive_format != POSIX_FORMAT
|
||||
&& archive_format != USTAR_FORMAT
|
||||
- && archive_format != GNU_FORMAT)
|
||||
+ && archive_format != GNU_FORMAT
|
||||
+ && archive_format != OLDGNU_FORMAT)
|
||||
{
|
||||
negative = v < 0;
|
||||
u = v;
|
@ -1,162 +0,0 @@
|
||||
--- tar-1.15.1/src/sparse.c.lseek 2004-09-06 13:30:57.000000000 +0200
|
||||
+++ tar-1.15.1/src/sparse.c 2005-04-15 10:33:17.990735744 +0200
|
||||
@@ -46,6 +46,9 @@
|
||||
struct tar_sparse_file
|
||||
{
|
||||
int fd; /* File descriptor */
|
||||
+ bool seekable; /* Is fd seekable? */
|
||||
+ size_t offset; /* Current offset in fd if seekable==false.
|
||||
+ Otherwise unused */
|
||||
size_t dumped_size; /* Number of bytes actually written
|
||||
to the archive */
|
||||
struct tar_stat_info *stat_info; /* Information about the file */
|
||||
@@ -54,6 +57,39 @@
|
||||
reqiure */
|
||||
};
|
||||
|
||||
+/* Dump zeros to file->fd until offset is reached. It is used instead of
|
||||
+ lseek if the output file is not seekable */
|
||||
+static long
|
||||
+dump_zeros (struct tar_sparse_file *file, off_t offset)
|
||||
+{
|
||||
+ char buf[BLOCKSIZE];
|
||||
+
|
||||
+ if (offset - file->offset < 0)
|
||||
+ {
|
||||
+ errno = EINVAL;
|
||||
+ return -1;
|
||||
+ }
|
||||
+
|
||||
+ memset (buf, 0, sizeof buf);
|
||||
+ while (file->offset < offset)
|
||||
+ {
|
||||
+ size_t size = offset - file->offset;
|
||||
+ size_t wrbytes;
|
||||
+
|
||||
+ if (size > sizeof buf)
|
||||
+ size = sizeof buf;
|
||||
+ wrbytes = write (file->fd, buf, size);
|
||||
+ if (wrbytes <= 0)
|
||||
+ {
|
||||
+ if (wrbytes == 0)
|
||||
+ errno = EINVAL;
|
||||
+ return -1;
|
||||
+ }
|
||||
+ file->offset += wrbytes;
|
||||
+ }
|
||||
+ return file->offset;
|
||||
+}
|
||||
+
|
||||
static bool
|
||||
tar_sparse_member_p (struct tar_sparse_file *file)
|
||||
{
|
||||
@@ -130,9 +166,16 @@
|
||||
|
||||
|
||||
static bool
|
||||
-lseek_or_error (struct tar_sparse_file *file, off_t offset, int whence)
|
||||
+lseek_or_error (struct tar_sparse_file *file, off_t offset)
|
||||
{
|
||||
- if (lseek (file->fd, offset, whence) < 0)
|
||||
+ off_t off;
|
||||
+
|
||||
+ if (file->seekable)
|
||||
+ off = lseek (file->fd, offset, SEEK_SET);
|
||||
+ else
|
||||
+ off = dump_zeros (file, offset);
|
||||
+
|
||||
+ if (off < 0)
|
||||
{
|
||||
seek_diag_details (file->stat_info->orig_file_name, offset);
|
||||
return false;
|
||||
@@ -182,10 +225,10 @@
|
||||
{
|
||||
static char buffer[BLOCKSIZE];
|
||||
size_t count;
|
||||
- size_t offset = 0;
|
||||
+ off_t offset = 0;
|
||||
struct sp_array sp = {0, 0};
|
||||
|
||||
- if (!lseek_or_error (file, 0, SEEK_SET))
|
||||
+ if (!lseek_or_error (file, 0))
|
||||
return false;
|
||||
clear_block (buffer);
|
||||
|
||||
@@ -269,8 +312,7 @@
|
||||
union block *blk;
|
||||
off_t bytes_left = file->stat_info->sparse_map[i].numbytes;
|
||||
|
||||
- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset,
|
||||
- SEEK_SET))
|
||||
+ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
|
||||
return false;
|
||||
|
||||
while (bytes_left > 0)
|
||||
@@ -304,8 +346,7 @@
|
||||
{
|
||||
size_t write_size;
|
||||
|
||||
- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset,
|
||||
- SEEK_SET))
|
||||
+ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
|
||||
return false;
|
||||
|
||||
write_size = file->stat_info->sparse_map[i].numbytes;
|
||||
@@ -313,7 +354,7 @@
|
||||
if (write_size == 0)
|
||||
{
|
||||
/* Last block of the file is a hole */
|
||||
- if (sys_truncate (file->fd))
|
||||
+ if (file->seekable && sys_truncate (file->fd))
|
||||
truncate_warn (file->stat_info->orig_file_name);
|
||||
}
|
||||
else while (write_size > 0)
|
||||
@@ -330,6 +371,7 @@
|
||||
count = full_write (file->fd, blk->buffer, wrbytes);
|
||||
write_size -= count;
|
||||
file->dumped_size += count;
|
||||
+ file->offset += count;
|
||||
if (count != wrbytes)
|
||||
{
|
||||
write_error_details (file->stat_info->orig_file_name,
|
||||
@@ -351,7 +393,9 @@
|
||||
|
||||
file.stat_info = st;
|
||||
file.fd = fd;
|
||||
-
|
||||
+ file.seekable = true; /* File *must* be seekable for dump to work */
|
||||
+ file.offset = 0;
|
||||
+
|
||||
if (!sparse_select_optab (&file)
|
||||
|| !tar_sparse_init (&file))
|
||||
return dump_status_not_implemented;
|
||||
@@ -414,7 +458,9 @@
|
||||
|
||||
file.stat_info = st;
|
||||
file.fd = fd;
|
||||
-
|
||||
+ file.seekable = lseek (fd, 0, SEEK_SET) == 0;
|
||||
+ file.offset = 0;
|
||||
+
|
||||
if (!sparse_select_optab (&file)
|
||||
|| !tar_sparse_init (&file))
|
||||
return dump_status_not_implemented;
|
||||
@@ -450,7 +496,7 @@
|
||||
static bool
|
||||
check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end)
|
||||
{
|
||||
- if (!lseek_or_error (file, beg, SEEK_SET))
|
||||
+ if (!lseek_or_error (file, beg))
|
||||
return false;
|
||||
|
||||
while (beg < end)
|
||||
@@ -486,8 +532,7 @@
|
||||
{
|
||||
size_t size_left;
|
||||
|
||||
- if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset,
|
||||
- SEEK_SET))
|
||||
+ if (!lseek_or_error (file, file->stat_info->sparse_map[i].offset))
|
||||
return false;
|
||||
size_left = file->stat_info->sparse_map[i].numbytes;
|
||||
while (size_left > 0)
|
@ -1,46 +0,0 @@
|
||||
--- tar-1.15.1/tests/testsuite.at.makeCheck 2004-12-21 13:41:40.000000000 +0100
|
||||
+++ tar-1.15.1/tests/testsuite.at 2005-07-26 14:56:10.000000000 +0200
|
||||
@@ -64,7 +64,7 @@
|
||||
|
||||
m4_include([options.at])
|
||||
|
||||
-m4_include([append.at])
|
||||
+#m4_include([append.at])
|
||||
|
||||
m4_include([delete01.at])
|
||||
m4_include([delete02.at])
|
||||
@@ -87,7 +87,7 @@
|
||||
m4_include([link01.at])
|
||||
|
||||
m4_include([listed01.at])
|
||||
-m4_include([listed02.at])
|
||||
+#m4_include([listed02.at])
|
||||
|
||||
m4_include([longv7.at])
|
||||
|
||||
--- tar-1.15.1/tests/pipe.at.makeCheck 2004-12-21 13:51:40.000000000 +0100
|
||||
+++ tar-1.15.1/tests/pipe.at 2005-07-26 14:54:33.000000000 +0200
|
||||
@@ -34,7 +34,7 @@
|
||||
mkdir directory
|
||||
genfile --length 10240 --pattern zeros > directory/file1
|
||||
genfile --length 13 > directory/file2
|
||||
-tar cf archive directory
|
||||
+tar cf archive directory/file1 directory/file2
|
||||
mv directory orig
|
||||
cat archive | tar xfv -
|
||||
echo "separator"
|
||||
@@ -42,11 +42,10 @@
|
||||
echo "separator"
|
||||
cmp orig/file2 directory/file2],
|
||||
[0],
|
||||
-[directory/
|
||||
-directory/file1
|
||||
+[directory/file1
|
||||
directory/file2
|
||||
separator
|
||||
separator
|
||||
])
|
||||
|
||||
-AT_CLEANUP
|
||||
\ No newline at end of file
|
||||
+AT_CLEANUP
|
@ -1,59 +0,0 @@
|
||||
--- tar-1.15.1/src/common.h.mangling 2006-12-04 12:47:40.000000000 +0100
|
||||
+++ tar-1.15.1/src/common.h 2006-12-04 12:47:40.000000000 +0100
|
||||
@@ -124,6 +124,9 @@
|
||||
|
||||
GLOBAL bool absolute_names_option;
|
||||
|
||||
+/* Allow GNUTYPE_NAMES type? */
|
||||
+GLOBAL bool allow_name_mangling_option;
|
||||
+
|
||||
/* Display file times in UTC */
|
||||
GLOBAL bool utc_option;
|
||||
|
||||
--- tar-1.15.1/src/extract.c.mangling 2006-12-04 12:47:40.000000000 +0100
|
||||
+++ tar-1.15.1/src/extract.c 2006-12-04 12:47:40.000000000 +0100
|
||||
@@ -1171,7 +1171,13 @@
|
||||
break;
|
||||
|
||||
case GNUTYPE_NAMES:
|
||||
- extract_mangle ();
|
||||
+ if (allow_name_mangling_option) {
|
||||
+ extract_mangle ();
|
||||
+ }
|
||||
+ else {
|
||||
+ ERROR ((0, 0, _("GNUTYPE_NAMES mangling ignored")));
|
||||
+ skip_member ();
|
||||
+ }
|
||||
break;
|
||||
|
||||
case GNUTYPE_MULTIVOL:
|
||||
--- tar-1.15.1/src/tar.c.mangling 2006-12-04 12:47:40.000000000 +0100
|
||||
+++ tar-1.15.1/src/tar.c 2006-12-04 12:55:35.000000000 +0100
|
||||
@@ -182,6 +182,7 @@
|
||||
{
|
||||
ACLS_OPTION = CHAR_MAX + 1,
|
||||
ANCHORED_OPTION,
|
||||
+ ALLOW_NAME_MANGLING_OPTION,
|
||||
ATIME_PRESERVE_OPTION,
|
||||
BACKUP_OPTION,
|
||||
CHECKPOINT_OPTION,
|
||||
@@ -546,6 +547,8 @@
|
||||
|
||||
{NULL, 'o', 0, 0,
|
||||
N_("when creating, same as --old-archive. When extracting, same as --no-same-owner"), 91 },
|
||||
+ {"allow-name-mangling", ALLOW_NAME_MANGLING_OPTION, 0, 0,
|
||||
+ N_("when creating, allow GNUTYPE_NAMES mangling -- considered dangerous"), 91 },
|
||||
|
||||
{NULL, 0, NULL, 0,
|
||||
N_("Other options:"), 100 },
|
||||
@@ -931,6 +934,10 @@
|
||||
case 'Z':
|
||||
set_use_compress_program_option ("compress");
|
||||
break;
|
||||
+
|
||||
+ case ALLOW_NAME_MANGLING_OPTION:
|
||||
+ allow_name_mangling_option = true;
|
||||
+ break;
|
||||
|
||||
case ANCHORED_OPTION:
|
||||
args->exclude_options |= EXCLUDE_ANCHORED;
|
@ -1,11 +0,0 @@
|
||||
--- tar-1.15.1/src/create.c.newerOption 2005-08-15 15:53:27.000000000 +0000
|
||||
+++ tar-1.15.1/src/create.c 2005-08-15 15:53:51.000000000 +0000
|
||||
@@ -1387,7 +1387,7 @@
|
||||
&& OLDER_STAT_TIME (st->stat, m)
|
||||
&& (!after_date_option || OLDER_STAT_TIME (st->stat, c)))
|
||||
{
|
||||
- if (!incremental_option)
|
||||
+ if (!incremental_option && verbose_option)
|
||||
WARN ((0, 0, _("%s: file is unchanged; not dumped"),
|
||||
quotearg_colon (p)));
|
||||
return;
|
@ -1,14 +0,0 @@
|
||||
--- tar-1.15.1/src/tar.c.optionsOrder 2006-09-19 21:39:41.000000000 +0200
|
||||
+++ tar-1.15.1/src/tar.c 2006-09-19 21:40:35.000000000 +0200
|
||||
@@ -617,9 +617,9 @@
|
||||
|
||||
switch (key)
|
||||
{
|
||||
- case 1:
|
||||
+ case ARGP_KEY_ARG:
|
||||
/* File name or non-parsed option, because of ARGP_IN_ORDER */
|
||||
- name_add (optarg);
|
||||
+ name_add (arg);
|
||||
args->input_files++;
|
||||
break;
|
||||
|
@ -1,22 +0,0 @@
|
||||
--- tar-1.15.1/src/create.c.padCorrectly 2005-11-04 10:18:08.000000000 -0500
|
||||
+++ tar-1.15.1/src/create.c 2005-11-04 10:21:05.000000000 -0500
|
||||
@@ -877,8 +877,8 @@
|
||||
return dump_status_short;
|
||||
}
|
||||
size_left -= count;
|
||||
-
|
||||
- set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
|
||||
+ if (count)
|
||||
+ set_next_block_after (blk + (bufsize - 1) / BLOCKSIZE);
|
||||
|
||||
if (count != bufsize)
|
||||
{
|
||||
@@ -892,7 +892,7 @@
|
||||
STRINGIFY_BIGINT (size_left, buf)));
|
||||
if (! ignore_failed_read_option)
|
||||
exit_status = TAREXIT_FAILURE;
|
||||
- pad_archive (size_left);
|
||||
+ pad_archive (size_left - (bufsize-count));
|
||||
return dump_status_short;
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
--- tar-1.15.1/src/extract.c.permissions 2004-12-21 10:55:12.000000000 +0100
|
||||
+++ tar-1.15.1/src/extract.c 2006-09-20 12:16:08.000000000 +0200
|
||||
@@ -404,7 +404,7 @@
|
||||
invert_permissions is zero, because
|
||||
repair_delayed_set_stat may need to update the struct. */
|
||||
delay_set_stat (file_name,
|
||||
- ¤t_stat_info.stat /* ignored */,
|
||||
+ ¤t_stat_info.stat,
|
||||
invert_permissions, INTERDIR_PERMSTATUS);
|
||||
|
||||
print_for_mkdir (file_name, cursor - file_name, mode);
|
||||
@@ -1065,7 +1065,7 @@
|
||||
}
|
||||
if (S_ISDIR (st.st_mode))
|
||||
{
|
||||
- mode = st.st_mode & ~ current_umask;
|
||||
+ mode = st.st_mode;
|
||||
goto directory_exists;
|
||||
}
|
||||
}
|
||||
@@ -1088,11 +1088,16 @@
|
||||
if (status == 0
|
||||
|| old_files_option == DEFAULT_OLD_FILES
|
||||
|| old_files_option == OVERWRITE_OLD_FILES)
|
||||
- delay_set_stat (file_name, ¤t_stat_info.stat,
|
||||
- MODE_RWX & (mode ^ current_stat_info.stat.st_mode),
|
||||
- (status == 0
|
||||
- ? ARCHIVED_PERMSTATUS
|
||||
- : UNKNOWN_PERMSTATUS));
|
||||
+ {
|
||||
+ if (status == 0)
|
||||
+ delay_set_stat (file_name, ¤t_stat_info.stat,
|
||||
+ MODE_RWX & (mode ^ current_stat_info.stat.st_mode),
|
||||
+ ARCHIVED_PERMSTATUS);
|
||||
+ else /* For an already existing directory, invert_perms must be 0 */
|
||||
+ delay_set_stat (file_name, ¤t_stat_info.stat,
|
||||
+ 0,
|
||||
+ UNKNOWN_PERMSTATUS);
|
||||
+ }
|
||||
break;
|
||||
|
||||
case GNUTYPE_VOLHDR:
|
@ -1,36 +0,0 @@
|
||||
--- tar-1.15.1/src/create.c.sparseTotals 2005-07-27 11:10:38.000000000 +0200
|
||||
+++ tar-1.15.1/src/create.c 2005-07-27 11:10:50.000000000 +0200
|
||||
@@ -332,16 +332,20 @@
|
||||
}
|
||||
|
||||
|
||||
-/* A file is not dumpable if
|
||||
+/* A file is considered dumpable if it is sparse and both --sparse and --totals
|
||||
+ are specified.
|
||||
+ Otherwise, it is dumpable unless any of the following conditions occur:
|
||||
+
|
||||
a) it is empty *and* world-readable, or
|
||||
b) current archive is /dev/null */
|
||||
|
||||
bool
|
||||
file_dumpable_p (struct tar_stat_info *st)
|
||||
{
|
||||
- return !(dev_null_output
|
||||
- || (st->archive_file_size == 0
|
||||
- && (st->stat.st_mode & MODE_R) == MODE_R));
|
||||
+ if (dev_null_output)
|
||||
+ return totals_option && sparse_option && sparse_file_p (st);
|
||||
+ return !(st->archive_file_size == 0
|
||||
+ && (st->stat.st_mode & MODE_R) == MODE_R);
|
||||
}
|
||||
|
||||
|
||||
@@ -1437,7 +1441,7 @@
|
||||
else
|
||||
fd = -1;
|
||||
|
||||
- if (sparse_option && sparse_file_p (st))
|
||||
+ if (fd != -1 && sparse_option && sparse_file_p (st))
|
||||
{
|
||||
status = sparse_dump_file (fd, st);
|
||||
if (status == dump_status_not_implemented)
|
File diff suppressed because it is too large
Load Diff
138
tar-1.17-testsuite.patch
Normal file
138
tar-1.17-testsuite.patch
Normal file
@ -0,0 +1,138 @@
|
||||
--- tar-1.17/tests/exclude.at.testsuite 2007-01-23 11:25:57.000000000 +0100
|
||||
+++ tar-1.17/tests/exclude.at 2007-06-27 11:30:42.000000000 +0200
|
||||
@@ -24,6 +24,8 @@ AT_SETUP([exclude])
|
||||
AT_KEYWORDS([exclude])
|
||||
|
||||
AT_TAR_CHECK([
|
||||
+AT_SORT_PREREQ
|
||||
+
|
||||
mkdir dir
|
||||
echo blues > dir/blues
|
||||
echo jazz > dir/jazz
|
||||
@@ -37,79 +39,79 @@ echo "test" > dir/rock/file
|
||||
for option in exclude-caches exclude-caches-under exclude-caches-all
|
||||
do
|
||||
echo OPTION $option
|
||||
- tar -cf archive.tar --$option -v dir 2>err
|
||||
+ tar -cf archive.tar --$option -v dir 2>err | sort
|
||||
cat err
|
||||
echo ARCHIVE
|
||||
- tar tf archive.tar
|
||||
+ tar tf archive.tar | sort
|
||||
done
|
||||
|
||||
for option in exclude-tag exclude-tag-under exclude-tag-all
|
||||
do
|
||||
echo OPTION $option
|
||||
- tar -cf archive.tar --${option}=tagfile -v dir 2>err
|
||||
+ tar -cf archive.tar --${option}=tagfile -v dir 2>err | sort
|
||||
cat err
|
||||
echo ARCHIVE
|
||||
- tar tf archive.tar
|
||||
+ tar tf archive.tar | sort
|
||||
done
|
||||
],
|
||||
[0],
|
||||
[OPTION exclude-caches
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
-dir/folk/tagfile
|
||||
dir/folk/sanjuan
|
||||
+dir/folk/tagfile
|
||||
+dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
tar: dir/rock/: contains a cache directory tag CACHEDIR.TAG; contents not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
-dir/folk/tagfile
|
||||
dir/folk/sanjuan
|
||||
+dir/folk/tagfile
|
||||
+dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
OPTION exclude-caches-under
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
-dir/folk/tagfile
|
||||
dir/folk/sanjuan
|
||||
+dir/folk/tagfile
|
||||
+dir/jazz
|
||||
dir/rock/
|
||||
tar: dir/rock/: contains a cache directory tag CACHEDIR.TAG; contents not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
-dir/folk/tagfile
|
||||
dir/folk/sanjuan
|
||||
+dir/folk/tagfile
|
||||
+dir/jazz
|
||||
dir/rock/
|
||||
OPTION exclude-caches-all
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
-dir/folk/tagfile
|
||||
dir/folk/sanjuan
|
||||
+dir/folk/tagfile
|
||||
+dir/jazz
|
||||
tar: dir/rock/: contains a cache directory tag CACHEDIR.TAG; directory not dumped
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
-dir/folk/tagfile
|
||||
dir/folk/sanjuan
|
||||
+dir/folk/tagfile
|
||||
+dir/jazz
|
||||
OPTION exclude-tag
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
dir/folk/tagfile
|
||||
+dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
@@ -117,17 +119,17 @@ tar: dir/folk/: contains a cache directo
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
dir/folk/tagfile
|
||||
+dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
OPTION exclude-tag-under
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
+dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
||||
@@ -135,8 +137,8 @@ tar: dir/folk/: contains a cache directo
|
||||
ARCHIVE
|
||||
dir/
|
||||
dir/blues
|
||||
-dir/jazz
|
||||
dir/folk/
|
||||
+dir/jazz
|
||||
dir/rock/
|
||||
dir/rock/CACHEDIR.TAG
|
||||
dir/rock/file
|
74
tar-1.17-wildcards.patch
Normal file
74
tar-1.17-wildcards.patch
Normal file
@ -0,0 +1,74 @@
|
||||
--- tar-1.17/doc/tar.texi.wildcards 2007-06-28 13:23:46.000000000 +0200
|
||||
+++ tar-1.17/doc/tar.texi 2007-06-28 13:23:46.000000000 +0200
|
||||
@@ -6871,7 +6871,7 @@ The following table summarizes pattern-m
|
||||
|
||||
@multitable @columnfractions .3 .7
|
||||
@headitem Members @tab Default settings
|
||||
-@item Inclusion @tab @option{--no-wildcards --anchored --no-wildcards-match-slash}
|
||||
+@item Inclusion @tab @option{--wildcards --anchored --wildcards-match-slash}
|
||||
@item Exclusion @tab @option{--wildcards --no-anchored --wildcards-match-slash}
|
||||
@end multitable
|
||||
|
||||
@@ -10666,6 +10666,9 @@ version of this document is available at
|
||||
@table @asis
|
||||
@item Use of globbing patterns when listing and extracting.
|
||||
|
||||
+Note: Following is true for original unpatched GNU tar.
|
||||
+For compatibility reasons, the old behavior was preserved.
|
||||
+
|
||||
Previous versions of GNU tar assumed shell-style globbing when
|
||||
extracting from or listing an archive. For example:
|
||||
|
||||
--- tar-1.17/src/tar.c.wildcards 2007-06-28 13:23:46.000000000 +0200
|
||||
+++ tar-1.17/src/tar.c 2007-06-28 13:23:46.000000000 +0200
|
||||
@@ -686,7 +686,7 @@ static struct argp_option options[] = {
|
||||
{"no-ignore-case", NO_IGNORE_CASE_OPTION, 0, 0,
|
||||
N_("case sensitive matching (default)"), GRID+1 },
|
||||
{"wildcards", WILDCARDS_OPTION, 0, 0,
|
||||
- N_("use wildcards (default for exclusion)"), GRID+1 },
|
||||
+ N_("use wildcards (default)"), GRID+1 },
|
||||
{"no-wildcards", NO_WILDCARDS_OPTION, 0, 0,
|
||||
N_("verbatim string matching"), GRID+1 },
|
||||
{"no-wildcards-match-slash", NO_WILDCARDS_MATCH_SLASH_OPTION, 0, 0,
|
||||
@@ -780,8 +780,7 @@ ARGMATCH_VERIFY (atime_preserve_args, at
|
||||
/* Wildcard matching settings */
|
||||
enum wildcards
|
||||
{
|
||||
- default_wildcards, /* For exclusion == enable_wildcards,
|
||||
- for inclusion == disable_wildcards */
|
||||
+ default_wildcards, /* enable_wildcards */
|
||||
disable_wildcards,
|
||||
enable_wildcards
|
||||
};
|
||||
@@ -809,7 +808,7 @@ struct tar_args /* Variables used
|
||||
| recursion_option)
|
||||
|
||||
#define MAKE_INCL_OPTIONS(args) \
|
||||
- ((((args)->wildcards == enable_wildcards) ? EXCLUDE_WILDCARDS : 0) \
|
||||
+ ((((args)->wildcards != disable_wildcards) ? EXCLUDE_WILDCARDS : 0) \
|
||||
| (args)->include_anchored \
|
||||
| (args)->matching_flags \
|
||||
| recursion_option)
|
||||
@@ -2126,7 +2125,7 @@ decode_options (int argc, char **argv)
|
||||
|
||||
/* Warn about implicit use of the wildcards in command line arguments.
|
||||
See TODO */
|
||||
- warn_regex_usage = args.wildcards == default_wildcards;
|
||||
+ warn_regex_usage = 0; //args.wildcards == default_wildcards;
|
||||
|
||||
/* 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 2007-06-28 13:30:48.000000000 +0200
|
||||
@@ -812,10 +812,7 @@ collect_and_sort_names (void)
|
||||
next_name = name->next;
|
||||
if (name->found_count || name->dir_contents)
|
||||
continue;
|
||||
- if (name->matching_flags & EXCLUDE_WILDCARDS)
|
||||
- /* NOTE: EXCLUDE_ANCHORED is not relevant here */
|
||||
- /* FIXME: just skip regexps for now */
|
||||
- continue;
|
||||
+
|
||||
chdir_do (name->change_dir);
|
||||
if (name->name[0] == 0)
|
||||
continue;
|
1710
tar-1.17-xattrs.patch
Normal file
1710
tar-1.17-xattrs.patch
Normal file
File diff suppressed because it is too large
Load Diff
57
tar.spec
57
tar.spec
@ -1,32 +1,20 @@
|
||||
Summary: A GNU file archiving program
|
||||
Name: tar
|
||||
Epoch: 2
|
||||
Version: 1.15.1
|
||||
Release: 26%{?dist}
|
||||
Version: 1.17
|
||||
Release: 1%{?dist}
|
||||
License: GPL
|
||||
Group: Applications/Archiving
|
||||
URL: http://www.gnu.org/software/tar/
|
||||
Source0: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.gz
|
||||
Source1: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.gz.sig
|
||||
Source2: tar.1
|
||||
Patch1: tar-1.14-nolibrt.patch
|
||||
Patch2: tar-1.14-loneZeroWarning.patch
|
||||
Patch3: tar-1.15.1-makeCheck.patch
|
||||
Patch4: tar-1.15.1-gcc4.patch
|
||||
Patch5: tar-1.15.1-lseek.patch
|
||||
Patch6: tar-1.15.1-sparseTotals.patch
|
||||
Patch7: tar-1.15.1-newerOption.patch
|
||||
Patch8: tar-1.15.1-padCorrectly.patch
|
||||
Patch9: tar-1.15.1-vfatTruncate.patch
|
||||
Patch10: tar-1.15.1-heapOverflow.patch
|
||||
Patch11: tar-1.15.1-hugeSparse.patch
|
||||
Patch12: tar-1.15.1-optionsOrder.patch
|
||||
Patch13: tar-1.15.1-permissions.patch
|
||||
Patch14: tar-1.15.1-incompatibilities.patch
|
||||
Patch15: tar-1.15.1-xattrs.patch
|
||||
Patch16: tar-1.15.1-mangling.patch
|
||||
Patch1: tar-1.14-loneZeroWarning.patch
|
||||
Patch2: tar-1.15.1-vfatTruncate.patch
|
||||
Patch3: tar-1.17-testsuite.patch
|
||||
Patch4: tar-1.17-xattrs.patch
|
||||
Patch5: tar-1.17-wildcards.patch
|
||||
Prereq: info
|
||||
BuildRequires: autoconf automake gzip
|
||||
BuildRequires: autoconf automake gzip texinfo gettext libacl-devel libselinux-devel
|
||||
Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
Requires(post): /sbin/install-info
|
||||
Requires(preun): /sbin/install-info
|
||||
@ -45,22 +33,11 @@ the rmt package.
|
||||
|
||||
%prep
|
||||
%setup -q
|
||||
%patch1 -p1 -b .nolibrt
|
||||
%patch2 -p1 -b .loneZeroWarning
|
||||
%patch3 -p1 -b .makeCheck
|
||||
%patch4 -p1 -b .gcc4
|
||||
%patch5 -p1 -b .lseek
|
||||
%patch6 -p1 -b .sparseTotals
|
||||
%patch7 -p1 -b .newerOption
|
||||
%patch8 -p1 -b .padCorrectly
|
||||
%patch9 -p1 -b .vfatTruncate
|
||||
%patch10 -p0 -b .heapOverflow
|
||||
%patch11 -p1 -b .hugeSparse
|
||||
%patch12 -p1 -b .optionsOrder
|
||||
%patch13 -p1 -b .permissions
|
||||
%patch14 -p1 -b .incompatibilities
|
||||
%patch15 -p1 -b .xattrs
|
||||
%patch16 -p1 -b .mangling
|
||||
%patch1 -p1 -b .loneZeroWarning
|
||||
%patch2 -p1 -b .vfatTruncate
|
||||
%patch3 -p1 -b .testsuite
|
||||
%patch4 -p1 -b .xattrs
|
||||
%patch5 -p1 -b .wildcards
|
||||
|
||||
%build
|
||||
%configure --bindir=/bin --libexecdir=/sbin
|
||||
@ -111,6 +88,14 @@ fi
|
||||
%{_infodir}/tar.info*
|
||||
|
||||
%changelog
|
||||
* Thu Jun 28 2007 Radek Brich <rbrich@redhat.com> 2:1.17-1
|
||||
- new upstream version
|
||||
- patch for wildcards incompatibility (#206841), restoring old behavior
|
||||
- patch for testsuite
|
||||
(http://lists.gnu.org/archive/html/bug-tar/2007-06/msg00010.html)
|
||||
- update -xattrs patch
|
||||
- drop 13 obsolete patches
|
||||
|
||||
* Tue Feb 06 2007 Peter Vrabec <pvrabec@redhat.com> 2:1.15.1-26
|
||||
- fix spec file to meet Fedora standards (#226478)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user