- start new epoch, downgrade to solid stable 1.15.1-16 (#206979),
- all patches are backported
This commit is contained in:
parent
7a1144edb1
commit
ba9d5e1fa5
@ -1,3 +1,3 @@
|
|||||||
tar-1.15.91.tar.gz
|
tar-1.15.1.tar.gz
|
||||||
tar-1.15.91.tar.gz.sig
|
tar-1.15.1.tar.gz.sig
|
||||||
tar.1
|
tar.1
|
||||||
|
4
sources
4
sources
@ -1,3 +1,3 @@
|
|||||||
fd74a2f1840e80d27bc6cc4bd07d5374 tar-1.15.91.tar.gz
|
d87021366fe6488e9dc398fcdcb6ed7d tar-1.15.1.tar.gz
|
||||||
2aabe87c0ea26c84c51e1d446ad4327f tar-1.15.91.tar.gz.sig
|
4be36b7651557cc236ed6fe9b6966fee tar-1.15.1.tar.gz.sig
|
||||||
0ee6e8f5657a0b8f08723bb0095aec18 tar.1
|
0ee6e8f5657a0b8f08723bb0095aec18 tar.1
|
||||||
|
214
tar-1.14-nolibrt.patch
Normal file
214
tar-1.14-nolibrt.patch
Normal file
@ -0,0 +1,214 @@
|
|||||||
|
--- 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
|
16
tar-1.15.1-gcc4.patch
Normal file
16
tar-1.15.1-gcc4.patch
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
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[] = {
|
121
tar-1.15.1-heapOverflow.patch
Normal file
121
tar-1.15.1-heapOverflow.patch
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
--- 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;
|
||||||
|
}
|
||||||
|
}
|
477
tar-1.15.1-hugeSparse.patch
Normal file
477
tar-1.15.1-hugeSparse.patch
Normal file
@ -0,0 +1,477 @@
|
|||||||
|
--- 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,
|
||||||
|
};
|
||||||
|
-
|
12
tar-1.15.1-incompatibilities.patch
Normal file
12
tar-1.15.1-incompatibilities.patch
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
--- 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;
|
162
tar-1.15.1-lseek.patch
Normal file
162
tar-1.15.1-lseek.patch
Normal file
@ -0,0 +1,162 @@
|
|||||||
|
--- 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)
|
46
tar-1.15.1-makeCheck.patch
Normal file
46
tar-1.15.1-makeCheck.patch
Normal file
@ -0,0 +1,46 @@
|
|||||||
|
--- 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
|
11
tar-1.15.1-newerOption.patch
Normal file
11
tar-1.15.1-newerOption.patch
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
--- 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;
|
14
tar-1.15.1-optionsOrder.patch
Normal file
14
tar-1.15.1-optionsOrder.patch
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
--- 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;
|
||||||
|
|
22
tar-1.15.1-padCorrectly.patch
Normal file
22
tar-1.15.1-padCorrectly.patch
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
--- 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;
|
||||||
|
}
|
||||||
|
}
|
42
tar-1.15.1-permissions.patch
Normal file
42
tar-1.15.1-permissions.patch
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
--- 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:
|
36
tar-1.15.1-sparseTotals.patch
Normal file
36
tar-1.15.1-sparseTotals.patch
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
--- 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)
|
4868
tar-1.15.1-xattrs.patch
Normal file
4868
tar-1.15.1-xattrs.patch
Normal file
File diff suppressed because it is too large
Load Diff
47
tar.spec
47
tar.spec
@ -1,18 +1,29 @@
|
|||||||
Summary: A GNU file archiving program.
|
Summary: A GNU file archiving program.
|
||||||
Name: tar
|
Name: tar
|
||||||
Version: 1.15.91
|
Epoch: 2
|
||||||
Release: 2
|
Version: 1.15.1
|
||||||
|
Release: 17
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Applications/Archiving
|
Group: Applications/Archiving
|
||||||
URL: http://www.gnu.org/software/tar/
|
URL: http://www.gnu.org/software/tar/
|
||||||
Source0: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.gz
|
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
|
Source1: ftp://ftp.gnu.org/pub/gnu/tar/tar-%{version}.tar.gz.sig
|
||||||
Source2: tar.1
|
Source2: tar.1
|
||||||
Patch1: tar-1.14-loneZeroWarning.patch
|
Patch1: tar-1.14-nolibrt.patch
|
||||||
Patch2: tar-1.15.1-vfatTruncate.patch
|
Patch2: tar-1.14-loneZeroWarning.patch
|
||||||
Patch3: tar-1.15.91-makeCheck.patch
|
Patch3: tar-1.15.1-makeCheck.patch
|
||||||
Patch4: tar-1.15.90-incompatibility.patch
|
Patch4: tar-1.15.1-gcc4.patch
|
||||||
Patch5: tar-1.15.90-xattrSupport.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
|
||||||
Prereq: info
|
Prereq: info
|
||||||
BuildRequires: autoconf automake gzip
|
BuildRequires: autoconf automake gzip
|
||||||
Buildroot: %{_tmppath}/%{name}-%{version}-root
|
Buildroot: %{_tmppath}/%{name}-%{version}-root
|
||||||
@ -31,11 +42,21 @@ the rmt package.
|
|||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -q
|
%setup -q
|
||||||
%patch1 -p1 -b .loneZeroWarning
|
%patch1 -p1 -b .nolibrt
|
||||||
%patch2 -p1 -b .vfatTruncate
|
%patch2 -p1 -b .loneZeroWarning
|
||||||
%patch3 -p1 -b .makeCheck
|
%patch3 -p1 -b .makeCheck
|
||||||
%patch4 -p1 -b .incompatibility
|
%patch4 -p1 -b .gcc4
|
||||||
%patch5 -p1 -b .xattrSupport
|
%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
|
||||||
|
|
||||||
%build
|
%build
|
||||||
%configure --bindir=/bin --libexecdir=/sbin
|
%configure --bindir=/bin --libexecdir=/sbin
|
||||||
@ -92,6 +113,10 @@ fi
|
|||||||
%{_infodir}/tar.info*
|
%{_infodir}/tar.info*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Sep 19 2006 Peter Vrabec <pvrabec@redhat.com> 2:1.15.1-17
|
||||||
|
- start new epoch, downgrade to solid stable 1.15.1-16 (#206979),
|
||||||
|
- all patches are backported
|
||||||
|
|
||||||
* Tue Sep 19 2006 Peter Vrabec <pvrabec@redhat.com> 1.15.91-2
|
* Tue Sep 19 2006 Peter Vrabec <pvrabec@redhat.com> 1.15.91-2
|
||||||
- apply patches, which were forgotten during upgrade
|
- apply patches, which were forgotten during upgrade
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user